-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: norn <keliumJU@users.noreply.github.com>
- Loading branch information
1 parent
16b1ad1
commit 11ef347
Showing
25 changed files
with
1,302 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,5 @@ stellar_sdk-*.tar | |
|
||
# DS_Store | ||
.DS_Store | ||
|
||
.elixir_ls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
defmodule StellarBase.XDR.SCHostAuthErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostAuthErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_AUTH_UNKNOWN_ERROR: 0, | ||
HOST_AUTH_NONCE_ERROR: 1, | ||
HOST_AUTH_DUPLICATE_AUTHORIZATION: 2, | ||
HOST_AUTH_NOT_AUTHORIZED: 3 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_AUTH_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
defmodule StellarBase.XDR.SCHostContextErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostContextErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_CONTEXT_UNKNOWN_ERROR: 0, | ||
HOST_CONTEXT_NO_CONTRACT_RUNNING: 1 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_CONTEXT_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
defmodule StellarBase.XDR.SCHostFnErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostFnErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_FN_UNKNOWN_ERROR: 0, | ||
HOST_FN_UNEXPECTED_HOST_FUNCTION_ACTION: 1, | ||
HOST_FN_INPUT_ARGS_WRONG_LENGTH: 2, | ||
HOST_FN_INPUT_ARGS_WRONG_TYPE: 3, | ||
HOST_FN_INPUT_ARGS_INVALID: 4 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_FN_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
defmodule StellarBase.XDR.SCHostObjErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostObjErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_OBJECT_UNKNOWN_ERROR: 0, | ||
HOST_OBJECT_UNKNOWN_REFERENCE: 1, | ||
HOST_OBJECT_UNEXPECTED_TYPE: 2, | ||
HOST_OBJECT_OBJECT_COUNT_EXCEEDS_U32_MAX: 3, | ||
HOST_OBJECT_OBJECT_NOT_EXIST: 4, | ||
HOST_OBJECT_VEC_INDEX_OUT_OF_BOUND: 5, | ||
HOST_OBJECT_CONTRACT_HASH_WRONG_LENGTH: 6 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_OBJECT_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
defmodule StellarBase.XDR.SCHostStorageErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostStorageErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_STORAGE_UNKNOWN_ERROR: 0, | ||
HOST_STORAGE_EXPECT_CONTRACT_DATA: 1, | ||
HOST_STORAGE_READWRITE_ACCESS_TO_READONLY_ENTRY: 2, | ||
HOST_STORAGE_ACCESS_TO_UNKNOWN_ENTRY: 3, | ||
HOST_STORAGE_MISSING_KEY_IN_GET: 4, | ||
HOST_STORAGE_GET_ON_DELETED_KEY: 5 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_STORAGE_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
defmodule StellarBase.XDR.SCHostValErrorCode do | ||
@moduledoc """ | ||
Representation of Stellar `SCHostValErrorCode` type. | ||
""" | ||
|
||
@behaviour XDR.Declaration | ||
|
||
@declarations [ | ||
HOST_VALUE_UNKNOWN_ERROR: 0, | ||
HOST_VALUE_RESERVED_TAG_VALUE: 1, | ||
HOST_VALUE_UNEXPECTED_VAL_TYPE: 2, | ||
HOST_VALUE_U63_OUT_OF_RANGE: 3, | ||
HOST_VALUE_U32_OUT_OF_RANGE: 4, | ||
HOST_VALUE_STATIC_UNKNOWN: 5, | ||
HOST_VALUE_MISSING_OBJECT: 6, | ||
HOST_VALUE_SYMBOL_TOO_LONG: 7, | ||
HOST_VALUE_SYMBOL_BAD_CHAR: 8, | ||
HOST_VALUE_SYMBOL_CONTAINS_NON_UTF8: 9, | ||
HOST_VALUE_BITSET_TOO_MANY_BITS: 10, | ||
HOST_VALUE_STATUS_UNKNOWN: 11 | ||
] | ||
|
||
@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} | ||
|
||
@type t :: %__MODULE__{identifier: atom()} | ||
|
||
defstruct [:identifier] | ||
|
||
@spec new(type :: atom()) :: t() | ||
def new(type \\ :HOST_VALUE_UNKNOWN_ERROR), | ||
do: %__MODULE__{identifier: type} | ||
|
||
@impl true | ||
def encode_xdr(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr() | ||
end | ||
|
||
@impl true | ||
def encode_xdr!(%__MODULE__{identifier: type}) do | ||
@declarations | ||
|> XDR.Enum.new(type) | ||
|> XDR.Enum.encode_xdr!() | ||
end | ||
|
||
@impl true | ||
def decode_xdr(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr(bytes, spec) do | ||
case XDR.Enum.decode_xdr(bytes, spec) do | ||
{:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} | ||
error -> error | ||
end | ||
end | ||
|
||
@impl true | ||
def decode_xdr!(bytes, spec \\ @enum_spec) | ||
|
||
def decode_xdr!(bytes, spec) do | ||
{%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) | ||
{new(type), rest} | ||
end | ||
end |
Oops, something went wrong.