defmodule StellarBase.XDR.OperationMeta 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 `OperationMeta` type.
"""
@behaviour XDR.Declaration
alias StellarBase.XDR.LedgerEntryChanges
@struct_spec XDR.Struct.new(changes: LedgerEntryChanges)
@type changes_type :: LedgerEntryChanges.t()
@type t :: %__MODULE__{changes: changes_type()}
defstruct [:changes]
@spec new(changes :: changes_type()) :: t()
def new(%LedgerEntryChanges{} = changes),
do: %__MODULE__{changes: changes}
@impl true
def encode_xdr(%__MODULE__{changes: changes}) do
[changes: changes]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr()
end
@impl true
def encode_xdr!(%__MODULE__{changes: changes}) do
[changes: changes]
|> 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: [changes: changes]}, rest}} ->
{:ok, {new(changes), rest}}
error ->
error
end
end
@impl true
def decode_xdr!(bytes, struct \\ @struct_spec)
def decode_xdr!(bytes, struct) do
{%XDR.Struct{components: [changes: changes]}, rest} = XDR.Struct.decode_xdr!(bytes, struct)
{new(changes), rest}
end
end