defmodule StellarBase.XDR.Operations.BumpFootprintExpiration do
@moduledoc """
Automatically generated by xdrgen
DO NOT EDIT or your changes may be overwritten
Target implementation: elixir_xdr at https://hex.pm/packages/elixir_xdr
Representation of Stellar `BumpFootprintExpiration` type.
"""
@behaviour XDR.Declaration
alias StellarBase.XDR.{
ExtensionPoint,
UInt32
}
@struct_spec XDR.Struct.new(
ext: ExtensionPoint,
ledgers_to_expire: UInt32
)
@type ext_type :: ExtensionPoint.t()
@type ledgers_to_expire_type :: UInt32.t()
@type t :: %__MODULE__{ext: ext_type(), ledgers_to_expire: ledgers_to_expire_type()}
defstruct [:ext, :ledgers_to_expire]
@spec new(ext :: ext_type(), ledgers_to_expire :: ledgers_to_expire_type()) :: t()
def new(
%ExtensionPoint{} = ext,
%UInt32{} = ledgers_to_expire
),
do: %__MODULE__{ext: ext, ledgers_to_expire: ledgers_to_expire}
@impl true
def encode_xdr(%__MODULE__{ext: ext, ledgers_to_expire: ledgers_to_expire}) do
[ext: ext, ledgers_to_expire: ledgers_to_expire]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr()
end
@impl true
def encode_xdr!(%__MODULE__{ext: ext, ledgers_to_expire: ledgers_to_expire}) do
[ext: ext, ledgers_to_expire: ledgers_to_expire]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr!()
end
@impl true
def decode_xdr(bytes, struct \\ @struct_spec)
def decode_xdr(bytes, struct) do
case XDR.Struct.decode_xdr(bytes, struct) do
{:ok, {%XDR.Struct{components: [ext: ext, ledgers_to_expire: ledgers_to_expire]}, rest}} ->
{:ok, {new(ext, ledgers_to_expire), rest}}
error ->
error
end
end
@impl true
def decode_xdr!(bytes, struct \\ @struct_spec)
def decode_xdr!(bytes, struct) do
{%XDR.Struct{components: [ext: ext, ledgers_to_expire: ledgers_to_expire]}, rest} =
XDR.Struct.decode_xdr!(bytes, struct)
{new(ext, ledgers_to_expire), rest}
end
end