defmodule StellarBase.XDR.SorobanAuthorizedContractFunction 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 `SorobanAuthorizedContractFunction` type. """ @behaviour XDR.Declaration alias StellarBase.XDR.{ SCAddress, SCSymbol, SCVec } @struct_spec XDR.Struct.new( contract_address: SCAddress, function_name: SCSymbol, args: SCVec ) @type contract_address_type :: SCAddress.t() @type function_name_type :: SCSymbol.t() @type args_type :: SCVec.t() @type t :: %__MODULE__{ contract_address: contract_address_type(), function_name: function_name_type(), args: args_type() } defstruct [:contract_address, :function_name, :args] @spec new( contract_address :: contract_address_type(), function_name :: function_name_type(), args :: args_type() ) :: t() def new( %SCAddress{} = contract_address, %SCSymbol{} = function_name, %SCVec{} = args ), do: %__MODULE__{ contract_address: contract_address, function_name: function_name, args: args } @impl true def encode_xdr(%__MODULE__{ contract_address: contract_address, function_name: function_name, args: args }) do [contract_address: contract_address, function_name: function_name, args: args] |> XDR.Struct.new() |> XDR.Struct.encode_xdr() end @impl true def encode_xdr!(%__MODULE__{ contract_address: contract_address, function_name: function_name, args: args }) do [contract_address: contract_address, function_name: function_name, args: args] |> 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: [ contract_address: contract_address, function_name: function_name, args: args ] }, rest}} -> {:ok, {new(contract_address, function_name, args), rest}} error -> error end end @impl true def decode_xdr!(bytes, struct \\ @struct_spec) def decode_xdr!(bytes, struct) do {%XDR.Struct{ components: [contract_address: contract_address, function_name: function_name, args: args] }, rest} = XDR.Struct.decode_xdr!(bytes, struct) {new(contract_address, function_name, args), rest} end end