Packages
Low-level elixir library to read, write, hash, and sign XDR primitive constructs used in the Stellar network.
Current section
Files
Jump to
Current section
Files
lib/xdr/transactions/transaction_meta_v4.ex
defmodule StellarBase.XDR.TransactionMetaV4 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 `TransactionMetaV4` type.
"""
@behaviour XDR.Declaration
alias StellarBase.XDR.{
ExtensionPoint,
LedgerEntryChanges,
OperationMetaV2List,
OptionalSorobanTransactionMetaV2,
TransactionEventList,
DiagnosticEventList
}
@struct_spec XDR.Struct.new(
ext: ExtensionPoint,
tx_changes_before: LedgerEntryChanges,
operations: OperationMetaV2List,
tx_changes_after: LedgerEntryChanges,
soroban_meta: OptionalSorobanTransactionMetaV2,
events: TransactionEventList,
diagnostic_events: DiagnosticEventList
)
@type ext_type :: ExtensionPoint.t()
@type tx_changes_before_type :: LedgerEntryChanges.t()
@type operations_type :: OperationMetaV2List.t()
@type tx_changes_after_type :: LedgerEntryChanges.t()
@type soroban_meta_type :: OptionalSorobanTransactionMetaV2.t()
@type events_type :: TransactionEventList.t()
@type diagnostic_events_type :: DiagnosticEventList.t()
@type t :: %__MODULE__{
ext: ext_type(),
tx_changes_before: tx_changes_before_type(),
operations: operations_type(),
tx_changes_after: tx_changes_after_type(),
soroban_meta: soroban_meta_type(),
events: events_type(),
diagnostic_events: diagnostic_events_type()
}
defstruct [
:ext,
:tx_changes_before,
:operations,
:tx_changes_after,
:soroban_meta,
:events,
:diagnostic_events
]
@spec new(
ext :: ext_type(),
tx_changes_before :: tx_changes_before_type(),
operations :: operations_type(),
tx_changes_after :: tx_changes_after_type(),
soroban_meta :: soroban_meta_type(),
events :: events_type(),
diagnostic_events :: diagnostic_events_type()
) :: t()
def new(
%ExtensionPoint{} = ext,
%LedgerEntryChanges{} = tx_changes_before,
%OperationMetaV2List{} = operations,
%LedgerEntryChanges{} = tx_changes_after,
%OptionalSorobanTransactionMetaV2{} = soroban_meta,
%TransactionEventList{} = events,
%DiagnosticEventList{} = diagnostic_events
),
do: %__MODULE__{
ext: ext,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
}
@impl true
def encode_xdr(%__MODULE__{
ext: ext,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
}) do
[
ext: ext,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr()
end
@impl true
def encode_xdr!(%__MODULE__{
ext: ext,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
}) do
[
ext: ext,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
]
|> 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,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
]
}, rest}} ->
{:ok,
{new(
ext,
tx_changes_before,
operations,
tx_changes_after,
soroban_meta,
events,
diagnostic_events
), 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,
tx_changes_before: tx_changes_before,
operations: operations,
tx_changes_after: tx_changes_after,
soroban_meta: soroban_meta,
events: events,
diagnostic_events: diagnostic_events
]
},
rest} =
XDR.Struct.decode_xdr!(bytes, struct)
{new(
ext,
tx_changes_before,
operations,
tx_changes_after,
soroban_meta,
events,
diagnostic_events
), rest}
end
end