Skip to content

Commit

Permalink
Finish review for account
Browse files Browse the repository at this point in the history
  • Loading branch information
lucca65 committed Mar 7, 2024
1 parent d8200df commit 37d5068
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
60 changes: 58 additions & 2 deletions lib/account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,18 @@ defmodule XRPL.Account do
optional(:marker, :string)

optional(:type, :enum,
values: ~w[check deposit_preauth escrow nft_offer nft_page offer payment_channel signer_list state ticket]
values: [
"check",
"deposit_preauth",
"escrow",
"nft_offer",
"nft_page",
"offer",
"payment_channel",
"signer_list",
"state",
"ticket"
]
)
end

Expand Down Expand Up @@ -165,7 +176,52 @@ defmodule XRPL.Account do
defparams "account_tx" do
required(:account, :string, format: XRPL.account_address_regex())

optional(:tx_type, :enum, values: XRPL.transaction_types())
optional(:tx_type, :enum,
values: [
"AccountSet",
"AccountDelete",
"AMMBid",
"AMMCreate",
"AMMDelete",
"AMMDeposit",
"AMMVote",
"AMMWithdraw",
"CheckCancel",
"CheckCash",
"CheckCreate",
"Clawback",
"DepositPreauth",
"DIDDelete",
"DIDSet",
"EscrowCancel",
"EscrowCreate",
"EscrowFinish",
"NFTokenAcceptOffer",
"NFTokenBurn",
"NFTokenCancelOffer",
"NFTokenCreateOffer",
"NFTokenMint",
"OfferCancel",
"OfferCreate",
"Payment",
"PaymentChannelClaim",
"PaymentChannelCreate",
"PaymentChannelFund",
"SetRegularKey",
"SignerListSet",
"TicketCreate",
"TrustSet",
"XChainAccountCreateCommit",
"XChainAddAccountCreateAttestation",
"XChainAddClaimAttestation",
"XChainClaim",
"XChainCommit",
"XChainCreateBridge",
"XChainCreateClaimID",
"XChainModifyBridge"
]
)

optional(:ledger_index_min, :integer)
optional(:ledger_index_max, :integer)
optional(:ledger_hash, :string, format: XRPL.is_hash())
Expand Down
4 changes: 0 additions & 4 deletions lib/xrpl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,4 @@ defmodule XRPL do
def ledger_index_regex do
~r/^(\d+|current|closed|validated)$/
end

def transaction_types do
~w(AccountSet AccountDelete AMMBid AMMCreate AMMDelete AMMDeposit AMMVote AMMWithdraw CheckCancel CheckCash CheckCreate Clawback DepositPreauth DIDDelete DIDSet EscrowCancel EscrowCreate EscrowFinish NFTokenAcceptOffer NFTokenBurn NFTokenCancelOffer NFTokenCreateOffer NFTokenMint OfferCancel OfferCreate Payment PaymentChannelClaim PaymentChannelCreate PaymentChannelFund SetRegularKey SignerListSet TicketCreate TrustSet XChainAccountCreateCommit XChainAddAccountCreateAttestation XChainAddClaimAttestation XChainClaim XChainCommit XChainCreateBridge XChainCreateClaimID XChainModifyBridge)
end
end
2 changes: 1 addition & 1 deletion test/account_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ defmodule XRPL.AccountTest do
describe "account_objects/1" do
test "returns information about an account's objects" do
assert {:ok, %Tesla.Env{status: 200}} =
Account.account_objects(@account)
Account.account_objects(%{account: @account})
end

test "it returns an error if we don't provide the required param" do
Expand Down

0 comments on commit 37d5068

Please sign in to comment.