@bithomp/xrpl-api 3.7.31 → 3.7.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/connection.js +5 -3
- package/lib/src/base58.d.ts +2 -0
- package/lib/src/base58.js +32 -0
- package/lib/src/client.d.ts +25 -0
- package/lib/src/client.js +192 -0
- package/lib/src/common/errors/index.d.ts +3 -0
- package/lib/src/common/errors/index.js +7 -0
- package/lib/src/common/errors/validation_error.d.ts +4 -0
- package/lib/src/common/errors/validation_error.js +7 -0
- package/lib/src/common/errors/xrpl_api_error.d.ts +9 -0
- package/lib/src/common/errors/xrpl_api_error.js +28 -0
- package/lib/src/common/index.d.ts +9 -0
- package/lib/src/common/index.js +57 -0
- package/lib/src/common/sha512Half.d.ts +2 -0
- package/lib/src/common/sha512Half.js +12 -0
- package/lib/src/common/utils.d.ts +14 -0
- package/lib/src/common/utils.js +147 -0
- package/lib/src/connection.d.ts +76 -0
- package/lib/src/connection.js +653 -0
- package/lib/src/faucet.d.ts +58 -0
- package/lib/src/faucet.js +129 -0
- package/lib/src/index.d.ts +9 -0
- package/lib/src/index.js +45 -0
- package/lib/src/ledger/account_info.d.ts +16 -0
- package/lib/src/ledger/account_info.js +112 -0
- package/lib/src/ledger/account_lines.d.ts +11 -0
- package/lib/src/ledger/account_lines.js +90 -0
- package/lib/src/ledger/account_namespace.d.ts +7 -0
- package/lib/src/ledger/account_namespace.js +72 -0
- package/lib/src/ledger/account_nfts.d.ts +21 -0
- package/lib/src/ledger/account_nfts.js +199 -0
- package/lib/src/ledger/account_objects.d.ts +44 -0
- package/lib/src/ledger/account_objects.js +222 -0
- package/lib/src/ledger/account_offers.d.ts +13 -0
- package/lib/src/ledger/account_offers.js +142 -0
- package/lib/src/ledger/account_tx.d.ts +37 -0
- package/lib/src/ledger/account_tx.js +376 -0
- package/lib/src/ledger/amm_info.d.ts +13 -0
- package/lib/src/ledger/amm_info.js +114 -0
- package/lib/src/ledger/book_offers.d.ts +15 -0
- package/lib/src/ledger/book_offers.js +102 -0
- package/lib/src/ledger/currency.d.ts +28 -0
- package/lib/src/ledger/currency.js +250 -0
- package/lib/src/ledger/fee.d.ts +13 -0
- package/lib/src/ledger/fee.js +99 -0
- package/lib/src/ledger/gateway_balances.d.ts +16 -0
- package/lib/src/ledger/gateway_balances.js +119 -0
- package/lib/src/ledger/index.d.ts +21 -0
- package/lib/src/ledger/index.js +37 -0
- package/lib/src/ledger/ledger.d.ts +16 -0
- package/lib/src/ledger/ledger.js +99 -0
- package/lib/src/ledger/ledger_entry.d.ts +16 -0
- package/lib/src/ledger/ledger_entry.js +118 -0
- package/lib/src/ledger/manifest.d.ts +8 -0
- package/lib/src/ledger/manifest.js +67 -0
- package/lib/src/ledger/nft_info.d.ts +4 -0
- package/lib/src/ledger/nft_info.js +67 -0
- package/lib/src/ledger/server_definitions.d.ts +7 -0
- package/lib/src/ledger/server_definitions.js +65 -0
- package/lib/src/ledger/server_info.d.ts +8 -0
- package/lib/src/ledger/server_info.js +65 -0
- package/lib/src/ledger/transaction.d.ts +47 -0
- package/lib/src/ledger/transaction.js +440 -0
- package/lib/src/ledger/vl-v2.d.ts +3 -0
- package/lib/src/ledger/vl-v2.js +124 -0
- package/lib/src/ledger/vl.d.ts +4 -0
- package/lib/src/ledger/vl.js +131 -0
- package/lib/src/models/account_info.d.ts +184 -0
- package/lib/src/models/account_info.js +139 -0
- package/lib/src/models/account_lines.d.ts +26 -0
- package/lib/src/models/account_lines.js +2 -0
- package/lib/src/models/account_namespace.d.ts +16 -0
- package/lib/src/models/account_namespace.js +2 -0
- package/lib/src/models/account_nfts.d.ts +20 -0
- package/lib/src/models/account_nfts.js +92 -0
- package/lib/src/models/account_object.d.ts +61 -0
- package/lib/src/models/account_object.js +125 -0
- package/lib/src/models/account_offers.d.ts +9 -0
- package/lib/src/models/account_offers.js +2 -0
- package/lib/src/models/account_uritokens.d.ts +11 -0
- package/lib/src/models/account_uritokens.js +2 -0
- package/lib/src/models/amm_info.d.ts +1 -0
- package/lib/src/models/amm_info.js +4 -0
- package/lib/src/models/base_model.d.ts +15 -0
- package/lib/src/models/base_model.js +2 -0
- package/lib/src/models/book_offers.d.ts +9 -0
- package/lib/src/models/book_offers.js +40 -0
- package/lib/src/models/gateway_balances.d.ts +19 -0
- package/lib/src/models/gateway_balances.js +2 -0
- package/lib/src/models/index.d.ts +38 -0
- package/lib/src/models/index.js +82 -0
- package/lib/src/models/ledger.d.ts +7 -0
- package/lib/src/models/ledger.js +20 -0
- package/lib/src/models/manifest.d.ts +25 -0
- package/lib/src/models/manifest.js +199 -0
- package/lib/src/models/mptoken.d.ts +7 -0
- package/lib/src/models/mptoken.js +59 -0
- package/lib/src/models/path_find.d.ts +11 -0
- package/lib/src/models/path_find.js +2 -0
- package/lib/src/models/server_definitions.d.ts +33 -0
- package/lib/src/models/server_definitions.js +2 -0
- package/lib/src/models/transaction.d.ts +52 -0
- package/lib/src/models/transaction.js +141 -0
- package/lib/src/models/transactions/CronSet.d.ts +3 -0
- package/lib/src/models/transactions/CronSet.js +2 -0
- package/lib/src/models/transactions/SetRemarks.d.ts +3 -0
- package/lib/src/models/transactions/SetRemarks.js +2 -0
- package/lib/src/models/transactions/URITokenMint.d.ts +3 -0
- package/lib/src/models/transactions/URITokenMint.js +2 -0
- package/lib/src/models/vl.d.ts +82 -0
- package/lib/src/models/vl.js +498 -0
- package/lib/src/parse/index.d.ts +6 -0
- package/lib/src/parse/index.js +46 -0
- package/lib/src/parse/ledger/account-fields.d.ts +5 -0
- package/lib/src/parse/ledger/account-fields.js +43 -0
- package/lib/src/parse/ledger/account-info.d.ts +3 -0
- package/lib/src/parse/ledger/account-info.js +15 -0
- package/lib/src/parse/ledger/account-order.d.ts +18 -0
- package/lib/src/parse/ledger/account-order.js +48 -0
- package/lib/src/parse/ledger/account-settings-flags.d.ts +2 -0
- package/lib/src/parse/ledger/account-settings-flags.js +77 -0
- package/lib/src/parse/ledger/account.d.ts +1 -0
- package/lib/src/parse/ledger/account.js +7 -0
- package/lib/src/parse/ledger/amount.d.ts +3 -0
- package/lib/src/parse/ledger/amount.js +25 -0
- package/lib/src/parse/ledger/asset.d.ts +3 -0
- package/lib/src/parse/ledger/asset.js +19 -0
- package/lib/src/parse/ledger/auth-accounts.d.ts +3 -0
- package/lib/src/parse/ledger/auth-accounts.js +18 -0
- package/lib/src/parse/ledger/credential-flags.d.ts +5 -0
- package/lib/src/parse/ledger/credential-flags.js +8 -0
- package/lib/src/parse/ledger/credential.d.ts +3 -0
- package/lib/src/parse/ledger/credential.js +13 -0
- package/lib/src/parse/ledger/currency-amount.d.ts +3 -0
- package/lib/src/parse/ledger/currency-amount.js +13 -0
- package/lib/src/parse/ledger/delegate.d.ts +2 -0
- package/lib/src/parse/ledger/delegate.js +11 -0
- package/lib/src/parse/ledger/destination.d.ts +2 -0
- package/lib/src/parse/ledger/destination.js +12 -0
- package/lib/src/parse/ledger/emit_details.d.ts +2 -0
- package/lib/src/parse/ledger/emit_details.js +14 -0
- package/lib/src/parse/ledger/flags.d.ts +4 -0
- package/lib/src/parse/ledger/flags.js +17 -0
- package/lib/src/parse/ledger/gateway-balances.d.ts +3 -0
- package/lib/src/parse/ledger/gateway-balances.js +31 -0
- package/lib/src/parse/ledger/genesis-mints.d.ts +2 -0
- package/lib/src/parse/ledger/genesis-mints.js +17 -0
- package/lib/src/parse/ledger/import.d.ts +2 -0
- package/lib/src/parse/ledger/import.js +40 -0
- package/lib/src/parse/ledger/index.d.ts +6 -0
- package/lib/src/parse/ledger/index.js +29 -0
- package/lib/src/parse/ledger/ledger.d.ts +2 -0
- package/lib/src/parse/ledger/ledger.js +98 -0
- package/lib/src/parse/ledger/memos.d.ts +4 -0
- package/lib/src/parse/ledger/memos.js +27 -0
- package/lib/src/parse/ledger/mptoken-flags.d.ts +6 -0
- package/lib/src/parse/ledger/mptoken-flags.js +8 -0
- package/lib/src/parse/ledger/mptoken-issuance-flags.d.ts +6 -0
- package/lib/src/parse/ledger/mptoken-issuance-flags.js +8 -0
- package/lib/src/parse/ledger/nftoken-flags.d.ts +5 -0
- package/lib/src/parse/ledger/nftoken-flags.js +8 -0
- package/lib/src/parse/ledger/nftoken-offer-flags.d.ts +5 -0
- package/lib/src/parse/ledger/nftoken-offer-flags.js +8 -0
- package/lib/src/parse/ledger/offer-flags.d.ts +5 -0
- package/lib/src/parse/ledger/offer-flags.js +8 -0
- package/lib/src/parse/ledger/orderbook-order.d.ts +21 -0
- package/lib/src/parse/ledger/orderbook-order.js +42 -0
- package/lib/src/parse/ledger/permissions.d.ts +2 -0
- package/lib/src/parse/ledger/permissions.js +9 -0
- package/lib/src/parse/ledger/regular-key.d.ts +2 -0
- package/lib/src/parse/ledger/regular-key.js +14 -0
- package/lib/src/parse/ledger/remark-flags.d.ts +5 -0
- package/lib/src/parse/ledger/remark-flags.js +8 -0
- package/lib/src/parse/ledger/remarks.d.ts +3 -0
- package/lib/src/parse/ledger/remarks.js +37 -0
- package/lib/src/parse/ledger/signers.d.ts +2 -0
- package/lib/src/parse/ledger/signers.js +12 -0
- package/lib/src/parse/ledger/source.d.ts +3 -0
- package/lib/src/parse/ledger/source.js +28 -0
- package/lib/src/parse/ledger/trustline-flags.d.ts +5 -0
- package/lib/src/parse/ledger/trustline-flags.js +8 -0
- package/lib/src/parse/ledger/tx-account-set-flags.d.ts +4 -0
- package/lib/src/parse/ledger/tx-account-set-flags.js +36 -0
- package/lib/src/parse/ledger/tx-amm-clawback-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-clawback-flags.js +8 -0
- package/lib/src/parse/ledger/tx-amm-deposit-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-deposit-flags.js +8 -0
- package/lib/src/parse/ledger/tx-amm-withdraw-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-withdraw-flags.js +8 -0
- package/lib/src/parse/ledger/tx-batch-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-batch-flags.js +8 -0
- package/lib/src/parse/ledger/tx-cron-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-cron-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-global-flags.d.ts +5 -0
- package/lib/src/parse/ledger/tx-global-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-authorize-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-authorize-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-nftoken-mint-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-nftoken-mint-flags.js +8 -0
- package/lib/src/parse/ledger/tx-nftoken-offer-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-nftoken-offer-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-offer-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-offer-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-payment-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-payment-flags.js +8 -0
- package/lib/src/parse/ledger/tx-trust-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-trust-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-uritoken-mint-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-uritoken-mint-flags.js +8 -0
- package/lib/src/parse/ledger/uritoken-flags.d.ts +5 -0
- package/lib/src/parse/ledger/uritoken-flags.js +8 -0
- package/lib/src/parse/mptoken_normalize.d.ts +5 -0
- package/lib/src/parse/mptoken_normalize.js +215 -0
- package/lib/src/parse/outcome/account_setting_changes.d.ts +4 -0
- package/lib/src/parse/outcome/account_setting_changes.js +67 -0
- package/lib/src/parse/outcome/affected_objects.d.ts +7 -0
- package/lib/src/parse/outcome/affected_objects.js +147 -0
- package/lib/src/parse/outcome/amendment_changes.d.ts +8 -0
- package/lib/src/parse/outcome/amendment_changes.js +84 -0
- package/lib/src/parse/outcome/amm_changes.d.ts +52 -0
- package/lib/src/parse/outcome/amm_changes.js +214 -0
- package/lib/src/parse/outcome/balance_changes.d.ts +24 -0
- package/lib/src/parse/outcome/balance_changes.js +337 -0
- package/lib/src/parse/outcome/channel_changes.d.ts +20 -0
- package/lib/src/parse/outcome/channel_changes.js +70 -0
- package/lib/src/parse/outcome/check_changes.d.ts +17 -0
- package/lib/src/parse/outcome/check_changes.js +63 -0
- package/lib/src/parse/outcome/credential_changes.d.ts +16 -0
- package/lib/src/parse/outcome/credential_changes.js +59 -0
- package/lib/src/parse/outcome/cron_changes.d.ts +13 -0
- package/lib/src/parse/outcome/cron_changes.js +72 -0
- package/lib/src/parse/outcome/delegate_changes.d.ts +12 -0
- package/lib/src/parse/outcome/delegate_changes.js +59 -0
- package/lib/src/parse/outcome/delivered_amount.d.ts +4 -0
- package/lib/src/parse/outcome/delivered_amount.js +63 -0
- package/lib/src/parse/outcome/did_changes.d.ts +14 -0
- package/lib/src/parse/outcome/did_changes.js +50 -0
- package/lib/src/parse/outcome/emitted_txns.d.ts +9 -0
- package/lib/src/parse/outcome/emitted_txns.js +57 -0
- package/lib/src/parse/outcome/escrow_changes.d.ts +16 -0
- package/lib/src/parse/outcome/escrow_changes.js +75 -0
- package/lib/src/parse/outcome/hooks_executions.d.ts +13 -0
- package/lib/src/parse/outcome/hooks_executions.js +42 -0
- package/lib/src/parse/outcome/index.d.ts +26 -0
- package/lib/src/parse/outcome/index.js +55 -0
- package/lib/src/parse/outcome/locked_balance_changes.d.ts +20 -0
- package/lib/src/parse/outcome/locked_balance_changes.js +117 -0
- package/lib/src/parse/outcome/mptoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/mptoken_changes.js +113 -0
- package/lib/src/parse/outcome/mptoken_issuance_changes.d.ts +1 -0
- package/lib/src/parse/outcome/mptoken_issuance_changes.js +119 -0
- package/lib/src/parse/outcome/nftoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/nftoken_changes.js +234 -0
- package/lib/src/parse/outcome/nftoken_offer_changes.d.ts +2 -0
- package/lib/src/parse/outcome/nftoken_offer_changes.js +106 -0
- package/lib/src/parse/outcome/oracle_changes.d.ts +29 -0
- package/lib/src/parse/outcome/oracle_changes.js +150 -0
- package/lib/src/parse/outcome/orderbook_changes.d.ts +21 -0
- package/lib/src/parse/outcome/orderbook_changes.js +108 -0
- package/lib/src/parse/outcome/orderbook_quality.d.ts +2 -0
- package/lib/src/parse/outcome/orderbook_quality.js +49 -0
- package/lib/src/parse/outcome/remarks_changes.d.ts +14 -0
- package/lib/src/parse/outcome/remarks_changes.js +68 -0
- package/lib/src/parse/outcome/unl_report_changes.d.ts +13 -0
- package/lib/src/parse/outcome/unl_report_changes.js +48 -0
- package/lib/src/parse/outcome/uritoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/uritoken_changes.js +83 -0
- package/lib/src/parse/outcome/uritoken_sell_offer_changes.d.ts +1 -0
- package/lib/src/parse/outcome/uritoken_sell_offer_changes.js +105 -0
- package/lib/src/parse/outcome.d.ts +4 -0
- package/lib/src/parse/outcome.js +264 -0
- package/lib/src/parse/specification/account-delete.d.ts +4 -0
- package/lib/src/parse/specification/account-delete.js +59 -0
- package/lib/src/parse/specification/amendment.d.ts +3 -0
- package/lib/src/parse/specification/amendment.js +50 -0
- package/lib/src/parse/specification/amm-bid.d.ts +4 -0
- package/lib/src/parse/specification/amm-bid.js +66 -0
- package/lib/src/parse/specification/amm-clawback.d.ts +4 -0
- package/lib/src/parse/specification/amm-clawback.js +65 -0
- package/lib/src/parse/specification/amm-create.d.ts +4 -0
- package/lib/src/parse/specification/amm-create.js +62 -0
- package/lib/src/parse/specification/amm-delete.d.ts +4 -0
- package/lib/src/parse/specification/amm-delete.js +61 -0
- package/lib/src/parse/specification/amm-deposit.d.ts +4 -0
- package/lib/src/parse/specification/amm-deposit.js +66 -0
- package/lib/src/parse/specification/amm-vote.d.ts +4 -0
- package/lib/src/parse/specification/amm-vote.js +62 -0
- package/lib/src/parse/specification/amm-withdraw.d.ts +4 -0
- package/lib/src/parse/specification/amm-withdraw.js +66 -0
- package/lib/src/parse/specification/batch.d.ts +4 -0
- package/lib/src/parse/specification/batch.js +83 -0
- package/lib/src/parse/specification/check-cancel.d.ts +4 -0
- package/lib/src/parse/specification/check-cancel.js +58 -0
- package/lib/src/parse/specification/check-cash.d.ts +4 -0
- package/lib/src/parse/specification/check-cash.js +64 -0
- package/lib/src/parse/specification/check-create.d.ts +4 -0
- package/lib/src/parse/specification/check-create.js +67 -0
- package/lib/src/parse/specification/clawback.d.ts +4 -0
- package/lib/src/parse/specification/clawback.js +62 -0
- package/lib/src/parse/specification/credential-accept.d.ts +4 -0
- package/lib/src/parse/specification/credential-accept.js +56 -0
- package/lib/src/parse/specification/credential-create.d.ts +4 -0
- package/lib/src/parse/specification/credential-create.js +58 -0
- package/lib/src/parse/specification/credential-delete.d.ts +4 -0
- package/lib/src/parse/specification/credential-delete.js +57 -0
- package/lib/src/parse/specification/cron-set.d.ts +3 -0
- package/lib/src/parse/specification/cron-set.js +62 -0
- package/lib/src/parse/specification/cron.d.ts +3 -0
- package/lib/src/parse/specification/cron.js +47 -0
- package/lib/src/parse/specification/delegate-set.d.ts +4 -0
- package/lib/src/parse/specification/delegate-set.js +60 -0
- package/lib/src/parse/specification/deposit-preauth.d.ts +4 -0
- package/lib/src/parse/specification/deposit-preauth.js +62 -0
- package/lib/src/parse/specification/did-delete.d.ts +4 -0
- package/lib/src/parse/specification/did-delete.js +57 -0
- package/lib/src/parse/specification/did-set.d.ts +4 -0
- package/lib/src/parse/specification/did-set.js +60 -0
- package/lib/src/parse/specification/escrow-cancel.d.ts +4 -0
- package/lib/src/parse/specification/escrow-cancel.js +59 -0
- package/lib/src/parse/specification/escrow-create.d.ts +4 -0
- package/lib/src/parse/specification/escrow-create.js +64 -0
- package/lib/src/parse/specification/escrow-finish.d.ts +4 -0
- package/lib/src/parse/specification/escrow-finish.js +61 -0
- package/lib/src/parse/specification/fee-update.d.ts +3 -0
- package/lib/src/parse/specification/fee-update.js +69 -0
- package/lib/src/parse/specification/genesis-mint.d.ts +3 -0
- package/lib/src/parse/specification/genesis-mint.js +53 -0
- package/lib/src/parse/specification/import.d.ts +3 -0
- package/lib/src/parse/specification/import.js +55 -0
- package/lib/src/parse/specification/invoke.d.ts +3 -0
- package/lib/src/parse/specification/invoke.js +54 -0
- package/lib/src/parse/specification/mptoken-authorize.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-authorize.js +60 -0
- package/lib/src/parse/specification/mptoken-issuance-create.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-create.js +62 -0
- package/lib/src/parse/specification/mptoken-issuance-destroy.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-destroy.js +56 -0
- package/lib/src/parse/specification/mptoken-issuance-set.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-set.js +60 -0
- package/lib/src/parse/specification/nftoken-accept-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-accept-offer.js +58 -0
- package/lib/src/parse/specification/nftoken-burn.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-burn.js +56 -0
- package/lib/src/parse/specification/nftoken-cancel-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-cancel-offer.js +56 -0
- package/lib/src/parse/specification/nftoken-create-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-create-offer.js +69 -0
- package/lib/src/parse/specification/nftoken-mint.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-mint.js +73 -0
- package/lib/src/parse/specification/nftoken-modify.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-modify.js +58 -0
- package/lib/src/parse/specification/offer-cancel.d.ts +4 -0
- package/lib/src/parse/specification/offer-cancel.js +58 -0
- package/lib/src/parse/specification/offer-create.d.ts +4 -0
- package/lib/src/parse/specification/offer-create.js +78 -0
- package/lib/src/parse/specification/oracle-delete.d.ts +4 -0
- package/lib/src/parse/specification/oracle-delete.js +56 -0
- package/lib/src/parse/specification/oracle-set.d.ts +4 -0
- package/lib/src/parse/specification/oracle-set.js +62 -0
- package/lib/src/parse/specification/payment-channel-claim.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-claim.js +67 -0
- package/lib/src/parse/specification/payment-channel-create.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-create.js +68 -0
- package/lib/src/parse/specification/payment-channel-fund.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-fund.js +65 -0
- package/lib/src/parse/specification/payment.d.ts +4 -0
- package/lib/src/parse/specification/payment.js +75 -0
- package/lib/src/parse/specification/permissioned-domain-set.d.ts +4 -0
- package/lib/src/parse/specification/permissioned-domain-set.js +56 -0
- package/lib/src/parse/specification/remit.d.ts +3 -0
- package/lib/src/parse/specification/remit.js +90 -0
- package/lib/src/parse/specification/set-remarks.d.ts +3 -0
- package/lib/src/parse/specification/set-remarks.js +56 -0
- package/lib/src/parse/specification/settings.d.ts +4 -0
- package/lib/src/parse/specification/settings.js +64 -0
- package/lib/src/parse/specification/ticket-create.d.ts +4 -0
- package/lib/src/parse/specification/ticket-create.js +58 -0
- package/lib/src/parse/specification/trust-set.d.ts +4 -0
- package/lib/src/parse/specification/trust-set.js +80 -0
- package/lib/src/parse/specification/unl-modify.d.ts +4 -0
- package/lib/src/parse/specification/unl-modify.js +52 -0
- package/lib/src/parse/specification/unl-report.d.ts +3 -0
- package/lib/src/parse/specification/unl-report.js +51 -0
- package/lib/src/parse/specification/unrecognized.d.ts +4 -0
- package/lib/src/parse/specification/unrecognized.js +24 -0
- package/lib/src/parse/specification/uritoken-burn.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-burn.js +54 -0
- package/lib/src/parse/specification/uritoken-buy.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-buy.js +55 -0
- package/lib/src/parse/specification/uritoken-cancel-sell-offer.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-cancel-sell-offer.js +54 -0
- package/lib/src/parse/specification/uritoken-create-sell-offer.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-create-sell-offer.js +57 -0
- package/lib/src/parse/specification/uritoken-mint.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-mint.js +63 -0
- package/lib/src/parse/transaction.d.ts +168 -0
- package/lib/src/parse/transaction.js +228 -0
- package/lib/src/parse/utils.d.ts +33 -0
- package/lib/src/parse/utils.js +119 -0
- package/lib/src/types/account.d.ts +26 -0
- package/lib/src/types/account.js +2 -0
- package/lib/src/types/adjustments.d.ts +16 -0
- package/lib/src/types/adjustments.js +2 -0
- package/lib/src/types/amendments.d.ts +4 -0
- package/lib/src/types/amendments.js +2 -0
- package/lib/src/types/amm.d.ts +98 -0
- package/lib/src/types/amm.js +68 -0
- package/lib/src/types/amounts.d.ts +20 -0
- package/lib/src/types/amounts.js +2 -0
- package/lib/src/types/batch.d.ts +21 -0
- package/lib/src/types/batch.js +26 -0
- package/lib/src/types/checks.d.ts +17 -0
- package/lib/src/types/checks.js +2 -0
- package/lib/src/types/clawback.d.ts +5 -0
- package/lib/src/types/clawback.js +2 -0
- package/lib/src/types/credentials.d.ts +30 -0
- package/lib/src/types/credentials.js +10 -0
- package/lib/src/types/cron.d.ts +17 -0
- package/lib/src/types/cron.js +6 -0
- package/lib/src/types/delegate.d.ts +5 -0
- package/lib/src/types/delegate.js +2 -0
- package/lib/src/types/deposits.d.ts +11 -0
- package/lib/src/types/deposits.js +2 -0
- package/lib/src/types/did.d.ts +7 -0
- package/lib/src/types/did.js +2 -0
- package/lib/src/types/emit_details.d.ts +7 -0
- package/lib/src/types/emit_details.js +2 -0
- package/lib/src/types/escrows.d.ts +18 -0
- package/lib/src/types/escrows.js +2 -0
- package/lib/src/types/fees.d.ts +9 -0
- package/lib/src/types/fees.js +2 -0
- package/lib/src/types/gateway_balances.d.ts +11 -0
- package/lib/src/types/gateway_balances.js +2 -0
- package/lib/src/types/genesis_mint.d.ts +9 -0
- package/lib/src/types/genesis_mint.js +2 -0
- package/lib/src/types/global.d.ts +14 -0
- package/lib/src/types/global.js +26 -0
- package/lib/src/types/hooks.d.ts +14 -0
- package/lib/src/types/hooks.js +2 -0
- package/lib/src/types/import.d.ts +21 -0
- package/lib/src/types/import.js +2 -0
- package/lib/src/types/index.d.ts +31 -0
- package/lib/src/types/index.js +47 -0
- package/lib/src/types/invoke.d.ts +5 -0
- package/lib/src/types/invoke.js +2 -0
- package/lib/src/types/ledger.d.ts +46 -0
- package/lib/src/types/ledger.js +2 -0
- package/lib/src/types/ledger_data.d.ts +10 -0
- package/lib/src/types/ledger_data.js +2 -0
- package/lib/src/types/ledger_entries.d.ts +163 -0
- package/lib/src/types/ledger_entries.js +2 -0
- package/lib/src/types/memos.d.ts +12 -0
- package/lib/src/types/memos.js +2 -0
- package/lib/src/types/mptokens.d.ts +84 -0
- package/lib/src/types/mptokens.js +76 -0
- package/lib/src/types/nftokens.d.ts +62 -0
- package/lib/src/types/nftokens.js +44 -0
- package/lib/src/types/offers.d.ts +46 -0
- package/lib/src/types/offers.js +33 -0
- package/lib/src/types/oracle.d.ts +19 -0
- package/lib/src/types/oracle.js +2 -0
- package/lib/src/types/outcome.d.ts +22 -0
- package/lib/src/types/outcome.js +2 -0
- package/lib/src/types/payment_channels.d.ts +23 -0
- package/lib/src/types/payment_channels.js +2 -0
- package/lib/src/types/payments.d.ts +24 -0
- package/lib/src/types/payments.js +25 -0
- package/lib/src/types/queue_data.d.ts +15 -0
- package/lib/src/types/queue_data.js +2 -0
- package/lib/src/types/remarks.d.ts +24 -0
- package/lib/src/types/remarks.js +6 -0
- package/lib/src/types/remits.d.ts +15 -0
- package/lib/src/types/remits.js +2 -0
- package/lib/src/types/settings.d.ts +27 -0
- package/lib/src/types/settings.js +2 -0
- package/lib/src/types/signers.d.ts +22 -0
- package/lib/src/types/signers.js +2 -0
- package/lib/src/types/specification.d.ts +14 -0
- package/lib/src/types/specification.js +2 -0
- package/lib/src/types/tickets.d.ts +4 -0
- package/lib/src/types/tickets.js +2 -0
- package/lib/src/types/trustlines.d.ts +85 -0
- package/lib/src/types/trustlines.js +43 -0
- package/lib/src/types/unl_modify.d.ts +6 -0
- package/lib/src/types/unl_modify.js +2 -0
- package/lib/src/types/unl_reports.d.ts +5 -0
- package/lib/src/types/unl_reports.js +2 -0
- package/lib/src/types/unrecognized.d.ts +5 -0
- package/lib/src/types/unrecognized.js +2 -0
- package/lib/src/types/uri_tokens.d.ts +7 -0
- package/lib/src/types/uri_tokens.js +6 -0
- package/lib/src/types/uritokens.d.ts +41 -0
- package/lib/src/types/uritokens.js +22 -0
- package/lib/src/v1/transaction/payment.d.ts +14 -0
- package/lib/src/v1/transaction/payment.js +142 -0
- package/lib/src/v1/types.d.ts +9 -0
- package/lib/src/v1/types.js +2 -0
- package/lib/src/v1/utils.d.ts +7 -0
- package/lib/src/v1/utils.js +49 -0
- package/lib/src/validator.d.ts +11 -0
- package/lib/src/validator.js +130 -0
- package/lib/src/wallet.d.ts +34 -0
- package/lib/src/wallet.js +284 -0
- package/package.json +11 -11
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getTransactions = getTransactions;
|
|
40
|
+
exports.findTransactionsExt = findTransactionsExt;
|
|
41
|
+
exports.findTransactions = findTransactions;
|
|
42
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
43
|
+
const Client = __importStar(require("../client"));
|
|
44
|
+
const utils_1 = require("../common/utils");
|
|
45
|
+
const transaction_1 = require("../models/transaction");
|
|
46
|
+
const balance_changes_1 = require("../parse/outcome/balance_changes");
|
|
47
|
+
const MAX_LIMIT = 1000;
|
|
48
|
+
const DEFAULT_LIMIT = 200;
|
|
49
|
+
const MAX_LIMIT_WITH_FILTER = 20;
|
|
50
|
+
const MAX_LIMIT_WITH_TAG = 3;
|
|
51
|
+
const LIMIT_INCREASE_COUNT = 10;
|
|
52
|
+
const DEFAULT_TIMEOUT = 15000;
|
|
53
|
+
async function getTransactions(account, options = { limit: DEFAULT_LIMIT }) {
|
|
54
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
55
|
+
options.marker = marker;
|
|
56
|
+
const connection = Client.findConnection("history", undefined, undefined, hash);
|
|
57
|
+
if (!connection) {
|
|
58
|
+
throw new Error("There is no connection");
|
|
59
|
+
}
|
|
60
|
+
const command = {
|
|
61
|
+
command: "account_tx",
|
|
62
|
+
account,
|
|
63
|
+
ledger_index_min: options.ledgerIndexMin,
|
|
64
|
+
ledger_index_max: options.ledgerIndexMax,
|
|
65
|
+
ledger_hash: options.ledgerHash,
|
|
66
|
+
ledger_index: options.ledgerIndex,
|
|
67
|
+
binary: !!options.binary,
|
|
68
|
+
forward: !!options.forward,
|
|
69
|
+
limit: options.limit,
|
|
70
|
+
marker: options.marker,
|
|
71
|
+
};
|
|
72
|
+
const response = await connection.request(command);
|
|
73
|
+
if (!response) {
|
|
74
|
+
return {
|
|
75
|
+
account,
|
|
76
|
+
status: "error",
|
|
77
|
+
error: "invalidResponse",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (response.error) {
|
|
81
|
+
const { error, error_code, error_message, error_exception, status, validated, warnings } = response;
|
|
82
|
+
return (0, utils_1.removeUndefined)({
|
|
83
|
+
account,
|
|
84
|
+
error,
|
|
85
|
+
error_code,
|
|
86
|
+
error_message,
|
|
87
|
+
error_exception,
|
|
88
|
+
status,
|
|
89
|
+
validated,
|
|
90
|
+
warnings,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const result = response?.result;
|
|
94
|
+
if (!result) {
|
|
95
|
+
return (0, utils_1.removeUndefined)({
|
|
96
|
+
account,
|
|
97
|
+
status: "error",
|
|
98
|
+
error: "invalidResponse",
|
|
99
|
+
warnings: response.warnings,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (Array.isArray(result.transactions)) {
|
|
103
|
+
if (options.balanceChanges === true || options.specification === true) {
|
|
104
|
+
for (const transaction of result.transactions) {
|
|
105
|
+
if (options.balanceChanges === true) {
|
|
106
|
+
const tx = transaction.tx || transaction;
|
|
107
|
+
transaction.balanceChanges = (0, balance_changes_1.parseBalanceChanges)(transaction.meta, Client.getNativeCurrency(), tx);
|
|
108
|
+
}
|
|
109
|
+
if (options.specification === true) {
|
|
110
|
+
const details = (0, transaction_1.getAccountTxDetails)(transaction, options.includeRawTransactions);
|
|
111
|
+
transaction.specification = details.specification;
|
|
112
|
+
transaction.outcome = details.outcome;
|
|
113
|
+
if (details.rawTransaction) {
|
|
114
|
+
transaction.rawTransaction = details.rawTransaction;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (Array.isArray(result.transactions)) {
|
|
121
|
+
for (const transaction of result.transactions) {
|
|
122
|
+
const tx = transaction.tx || transaction;
|
|
123
|
+
if (!tx.hasOwnProperty("ctid")) {
|
|
124
|
+
const ctid = (0, transaction_1.encodeCTIDforTransaction)(transaction, connection.getNetworkID());
|
|
125
|
+
if (ctid) {
|
|
126
|
+
tx.ctid = ctid;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
132
|
+
if (newMarker) {
|
|
133
|
+
result.marker = newMarker;
|
|
134
|
+
}
|
|
135
|
+
if (response.warnings && response.warnings.length > 0) {
|
|
136
|
+
result.warnings = response.warnings;
|
|
137
|
+
}
|
|
138
|
+
result.bithompHash = connection.hash;
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
async function findTransactionsExt(account, options = { limit: DEFAULT_LIMIT, timeout: DEFAULT_TIMEOUT }) {
|
|
142
|
+
let transactions = [];
|
|
143
|
+
let accountTransactionsError = null;
|
|
144
|
+
const timeStart = new Date();
|
|
145
|
+
const loadOptions = { ...options };
|
|
146
|
+
if (!loadOptions.limit || loadOptions.limit <= 0) {
|
|
147
|
+
loadOptions.limit = DEFAULT_LIMIT;
|
|
148
|
+
}
|
|
149
|
+
if (!loadOptions.timeout || loadOptions.timeout <= 0) {
|
|
150
|
+
loadOptions.timeout = DEFAULT_TIMEOUT;
|
|
151
|
+
}
|
|
152
|
+
const formatted = loadOptions.legacy === true || loadOptions.formatted === true;
|
|
153
|
+
loadOptions.binary = false;
|
|
154
|
+
applyLimitOptions(loadOptions);
|
|
155
|
+
await applyStartTxOptions(loadOptions);
|
|
156
|
+
let getTransactionsLimit = loadOptions.limit;
|
|
157
|
+
if (transactions.length === 0 && loadOptions.startTxHash) {
|
|
158
|
+
getTransactionsLimit += LIMIT_INCREASE_COUNT;
|
|
159
|
+
}
|
|
160
|
+
if (loadOptions.sourceTag || loadOptions.destinationTag) {
|
|
161
|
+
getTransactionsLimit += LIMIT_INCREASE_COUNT;
|
|
162
|
+
}
|
|
163
|
+
if (loadOptions.types) {
|
|
164
|
+
getTransactionsLimit += LIMIT_INCREASE_COUNT;
|
|
165
|
+
}
|
|
166
|
+
if (getTransactionsLimit > MAX_LIMIT) {
|
|
167
|
+
getTransactionsLimit = MAX_LIMIT;
|
|
168
|
+
}
|
|
169
|
+
while (transactions.length !== loadOptions.limit) {
|
|
170
|
+
const currentTime = new Date();
|
|
171
|
+
if (loadOptions.timeout && currentTime.getTime() - timeStart.getTime() > loadOptions.timeout) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
const accountTransactions = await getTransactions(account, {
|
|
175
|
+
...loadOptions,
|
|
176
|
+
...{ balanceChanges: false, specification: false, limit: getTransactionsLimit },
|
|
177
|
+
});
|
|
178
|
+
if (accountTransactions.error) {
|
|
179
|
+
if (accountTransactions.error_message === "Request timeout.") {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
accountTransactionsError = accountTransactions;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
let newTransactions = accountTransactions.transactions;
|
|
188
|
+
loadOptions.marker = accountTransactions.marker;
|
|
189
|
+
newTransactions = newTransactions
|
|
190
|
+
.filter(lodash_1.default.partial(filterHelperTransactions, account, loadOptions))
|
|
191
|
+
.filter(lodash_1.default.partial(filterHelperStartTx, loadOptions));
|
|
192
|
+
if (formatted !== true && (loadOptions.balanceChanges === true || loadOptions.specification === true)) {
|
|
193
|
+
for (const newTransaction of newTransactions) {
|
|
194
|
+
if (loadOptions.balanceChanges === true) {
|
|
195
|
+
const tx = newTransaction.tx || newTransaction;
|
|
196
|
+
newTransaction.balanceChanges = (0, balance_changes_1.parseBalanceChanges)(newTransaction.meta, Client.getNativeCurrency(), tx);
|
|
197
|
+
}
|
|
198
|
+
if (loadOptions.specification === true) {
|
|
199
|
+
const details = (0, transaction_1.getAccountTxDetails)(newTransaction, options.includeRawTransactions);
|
|
200
|
+
newTransaction.specification = details.specification;
|
|
201
|
+
newTransaction.outcome = details.outcome;
|
|
202
|
+
if (details.rawTransaction) {
|
|
203
|
+
newTransaction.rawTransaction = details.rawTransaction;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (newTransactions.length === 0 && getTransactionsLimit < MAX_LIMIT) {
|
|
209
|
+
getTransactionsLimit += LIMIT_INCREASE_COUNT;
|
|
210
|
+
if (getTransactionsLimit > MAX_LIMIT) {
|
|
211
|
+
getTransactionsLimit = MAX_LIMIT;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (newTransactions.length > 0) {
|
|
215
|
+
const transactionsToTake = loadOptions.limit - transactions.length;
|
|
216
|
+
if (transactionsToTake !== newTransactions.length) {
|
|
217
|
+
const isClio = (0, utils_1.isClioResponse)(accountTransactions);
|
|
218
|
+
let markerTransaction = null;
|
|
219
|
+
if (isClio) {
|
|
220
|
+
markerTransaction = newTransactions[transactionsToTake - 1];
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
markerTransaction = newTransactions[transactionsToTake];
|
|
224
|
+
}
|
|
225
|
+
if (markerTransaction) {
|
|
226
|
+
const bithompHash = loadOptions.marker?.bithompHash || accountTransactions.bithompHash;
|
|
227
|
+
loadOptions.marker = {
|
|
228
|
+
ledger: markerTransaction.tx.ledger_index,
|
|
229
|
+
seq: markerTransaction.meta.TransactionIndex,
|
|
230
|
+
};
|
|
231
|
+
if (bithompHash) {
|
|
232
|
+
loadOptions.marker.bithompHash = bithompHash;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
newTransactions = newTransactions.slice(0, transactionsToTake);
|
|
237
|
+
transactions = transactions.concat(newTransactions);
|
|
238
|
+
}
|
|
239
|
+
if (loadOptions.marker === undefined) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (accountTransactionsError && transactions.length === 0) {
|
|
244
|
+
if (loadOptions.marker) {
|
|
245
|
+
accountTransactionsError.marker = loadOptions.marker;
|
|
246
|
+
}
|
|
247
|
+
return accountTransactionsError;
|
|
248
|
+
}
|
|
249
|
+
if (loadOptions.marker && transactions.length === 0) {
|
|
250
|
+
return {
|
|
251
|
+
status: "error",
|
|
252
|
+
error: "searchTimeout",
|
|
253
|
+
marker: loadOptions.marker,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
if (formatted === true) {
|
|
257
|
+
transactions = transactions.map((transaction) => (0, transaction_1.getAccountTxDetails)(transaction, loadOptions.includeRawTransactions === true));
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
account,
|
|
261
|
+
transactions,
|
|
262
|
+
marker: loadOptions.marker,
|
|
263
|
+
validated: true,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
async function findTransactions(account, options = { limit: DEFAULT_LIMIT, timeout: 15000 }) {
|
|
267
|
+
const result = await findTransactionsExt(account, options);
|
|
268
|
+
if (result.error) {
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
return result.transactions || [];
|
|
272
|
+
}
|
|
273
|
+
function applyLimitOptions(options) {
|
|
274
|
+
if (options.sourceTag > 0 || options.destinationTag > 0) {
|
|
275
|
+
if (!options.limit || options.limit > MAX_LIMIT_WITH_TAG) {
|
|
276
|
+
options.limit = MAX_LIMIT_WITH_TAG;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else if (options.types || options.initiated || options.counterparty) {
|
|
280
|
+
if (!options.limit || options.limit > MAX_LIMIT_WITH_FILTER) {
|
|
281
|
+
options.limit = MAX_LIMIT_WITH_FILTER;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
async function applyStartTxOptions(options) {
|
|
286
|
+
if (options.startTxHash) {
|
|
287
|
+
const accountTransaction = await Client.getTransaction(options.startTxHash);
|
|
288
|
+
if (accountTransaction && !accountTransaction.error) {
|
|
289
|
+
options.startTx = {
|
|
290
|
+
tx: accountTransaction,
|
|
291
|
+
meta: accountTransaction.meta,
|
|
292
|
+
};
|
|
293
|
+
if (options.forward === true) {
|
|
294
|
+
const ledgerIndex = options.startTx.tx.ledger_index;
|
|
295
|
+
if (options.ledgerIndexMin === undefined || ledgerIndex > options.ledgerIndexMin) {
|
|
296
|
+
options.ledgerIndexMin = ledgerIndex;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
const ledgerIndex = options.startTx.tx.ledger_index;
|
|
301
|
+
if (options.ledgerIndexMax === undefined || ledgerIndex < options.ledgerIndexMax) {
|
|
302
|
+
options.ledgerIndexMax = ledgerIndex;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function filterHelperStartTx(options, transaction) {
|
|
309
|
+
return (!options.startTx ||
|
|
310
|
+
(options.forward === true
|
|
311
|
+
? (0, utils_1.compareTransactions)(transaction, options.startTx) > 0
|
|
312
|
+
: (0, utils_1.compareTransactions)(transaction, options.startTx) < 0));
|
|
313
|
+
}
|
|
314
|
+
function filterHelperTransactions(account, options, transaction) {
|
|
315
|
+
if (transaction.validated === false) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
if (options.excludeFailures === true && transaction.meta.TransactionResult !== "tesSUCCESS") {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
if (options.types && !options.types.includes(transaction.tx.TransactionType)) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (options.initiated === true && transaction.tx.Account !== account) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (options.initiated === false && transaction.tx.Account === account) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
if (options.counterparty && !counterpartyFilter(options, transaction)) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
if (typeof options.sourceTag === "number" && transaction.tx.SourceTag !== options.sourceTag) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
if (typeof options.destinationTag === "number" && transaction.tx.DestinationTag !== options.destinationTag) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
function counterpartyFilter(options, transaction) {
|
|
342
|
+
if (transaction.tx.Account === options.counterparty) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
if (transaction.tx.Destination === options.counterparty) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
if (transaction.tx.Delegate === options.counterparty) {
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
if (transaction.tx.Subject === options.counterparty) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
if (transaction.tx.Amount?.issuer === options.counterparty) {
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
if (transaction.tx.SendMax?.issuer === options.counterparty) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
if (typeof transaction.tx.TakerGets === "object" && transaction.tx.TakerGets?.issuer === options.counterparty) {
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
if (typeof transaction.tx.TakerPays === "object" && transaction.tx.TakerPays?.issuer === options.counterparty) {
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
if (transaction.tx.LimitAmount?.issuer === options.counterparty) {
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
if (transaction.tx.Issuer === options.counterparty) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
if (transaction.tx.NFTokenMinter === options.counterparty) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Connection } from "../connection";
|
|
2
|
+
import { ErrorResponse } from "../models/base_model";
|
|
3
|
+
import { IssuedCurrency } from "../types";
|
|
4
|
+
import { LedgerIndex } from "../models/ledger";
|
|
5
|
+
export interface GetAmmInfoOptions {
|
|
6
|
+
url?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
connection?: Connection;
|
|
9
|
+
ledgerIndex?: LedgerIndex;
|
|
10
|
+
account?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getAmmInfo(ammAccount: string, options?: GetAmmInfoOptions): Promise<object | ErrorResponse>;
|
|
13
|
+
export declare function getAmmInfoByAssets(asset: string | IssuedCurrency, asset2: string | IssuedCurrency, options?: GetAmmInfoOptions): Promise<object | ErrorResponse>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getAmmInfo = getAmmInfo;
|
|
37
|
+
exports.getAmmInfoByAssets = getAmmInfoByAssets;
|
|
38
|
+
const Client = __importStar(require("../client"));
|
|
39
|
+
const utils_1 = require("../common/utils");
|
|
40
|
+
async function getAmmInfo(ammAccount, options = {}) {
|
|
41
|
+
const connection = options.connection || Client.findConnection(options.type, options.url, true);
|
|
42
|
+
if (!connection) {
|
|
43
|
+
throw new Error("There is no connection");
|
|
44
|
+
}
|
|
45
|
+
if (!ammAccount) {
|
|
46
|
+
return {
|
|
47
|
+
error: "invalidParams",
|
|
48
|
+
error_code: 31,
|
|
49
|
+
error_message: "Invalid parameters.",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const response = await connection.request({
|
|
53
|
+
command: "amm_info",
|
|
54
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
55
|
+
account: options.account,
|
|
56
|
+
amm_account: ammAccount,
|
|
57
|
+
});
|
|
58
|
+
if (!response) {
|
|
59
|
+
return {
|
|
60
|
+
status: "error",
|
|
61
|
+
error: "invalidResponse",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (response.error) {
|
|
65
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
66
|
+
return (0, utils_1.removeUndefined)({
|
|
67
|
+
error,
|
|
68
|
+
error_code,
|
|
69
|
+
error_message,
|
|
70
|
+
error_exception,
|
|
71
|
+
status,
|
|
72
|
+
validated,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return response?.result;
|
|
76
|
+
}
|
|
77
|
+
async function getAmmInfoByAssets(asset, asset2, options = {}) {
|
|
78
|
+
const connection = options.connection || Client.findConnection(options.type, options.url, true);
|
|
79
|
+
if (!connection) {
|
|
80
|
+
throw new Error("There is no connection");
|
|
81
|
+
}
|
|
82
|
+
if (!asset || !asset2) {
|
|
83
|
+
return {
|
|
84
|
+
error: "invalidParams",
|
|
85
|
+
error_code: 31,
|
|
86
|
+
error_message: "Invalid parameters.",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const response = await connection.request({
|
|
90
|
+
command: "amm_info",
|
|
91
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
92
|
+
account: options.account,
|
|
93
|
+
asset: asset,
|
|
94
|
+
asset2: asset2,
|
|
95
|
+
});
|
|
96
|
+
if (!response) {
|
|
97
|
+
return {
|
|
98
|
+
status: "error",
|
|
99
|
+
error: "invalidResponse",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (response.error) {
|
|
103
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
104
|
+
return (0, utils_1.removeUndefined)({
|
|
105
|
+
error,
|
|
106
|
+
error_code,
|
|
107
|
+
error_message,
|
|
108
|
+
error_exception,
|
|
109
|
+
status,
|
|
110
|
+
validated,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return response?.result;
|
|
114
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { OrderbookInfo } from "../models/book_offers";
|
|
3
|
+
import { IssuedCurrency } from "../types";
|
|
4
|
+
import { ErrorResponse } from "../models/base_model";
|
|
5
|
+
export interface GetGetBookOffersOptions {
|
|
6
|
+
ledgerIndex?: LedgerIndex;
|
|
7
|
+
limit?: number;
|
|
8
|
+
marker?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare function getBookOffers(taker: string, takerGets: IssuedCurrency, takerPays: IssuedCurrency, options?: GetGetBookOffersOptions): Promise<object | ErrorResponse>;
|
|
11
|
+
export interface GetGetOrderBookOptions {
|
|
12
|
+
ledgerIndex?: LedgerIndex;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function getOrderbook(taker: string, orderbook: OrderbookInfo, options?: GetGetOrderBookOptions): Promise<object | ErrorResponse>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getBookOffers = getBookOffers;
|
|
37
|
+
exports.getOrderbook = getOrderbook;
|
|
38
|
+
const Client = __importStar(require("../client"));
|
|
39
|
+
const book_offers_1 = require("../models/book_offers");
|
|
40
|
+
const utils_1 = require("../common/utils");
|
|
41
|
+
const common_1 = require("../common");
|
|
42
|
+
async function getBookOffers(taker, takerGets, takerPays, options = {}) {
|
|
43
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
44
|
+
options.marker = marker;
|
|
45
|
+
const connection = Client.findConnection("book_offers", undefined, undefined, hash);
|
|
46
|
+
if (!connection) {
|
|
47
|
+
throw new Error("There is no connection");
|
|
48
|
+
}
|
|
49
|
+
const response = await connection.request({
|
|
50
|
+
command: "book_offers",
|
|
51
|
+
taker,
|
|
52
|
+
taker_gets: takerGets,
|
|
53
|
+
taker_pays: takerPays,
|
|
54
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
55
|
+
limit: options.limit,
|
|
56
|
+
marker: options.marker,
|
|
57
|
+
});
|
|
58
|
+
if (!response) {
|
|
59
|
+
return {
|
|
60
|
+
taker,
|
|
61
|
+
status: "error",
|
|
62
|
+
error: "invalidResponse",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (response.error) {
|
|
66
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
67
|
+
return (0, common_1.removeUndefined)({
|
|
68
|
+
taker,
|
|
69
|
+
error,
|
|
70
|
+
error_code,
|
|
71
|
+
error_message,
|
|
72
|
+
error_exception,
|
|
73
|
+
status,
|
|
74
|
+
validated,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const result = response.result;
|
|
78
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
79
|
+
if (newMarker) {
|
|
80
|
+
result.marker = newMarker;
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
function convertIssueToTakerAmount(obj) {
|
|
85
|
+
const issuer = obj.counterparty != null ? obj.counterparty : obj.issuer != null ? obj.issuer : undefined;
|
|
86
|
+
const withIssuer = Object.assign({}, obj, { issuer });
|
|
87
|
+
delete withIssuer.counterparty;
|
|
88
|
+
return withIssuer;
|
|
89
|
+
}
|
|
90
|
+
async function getOrderbook(taker, orderbook, options = {}) {
|
|
91
|
+
const [directOfferResults, reverseOfferResults] = await Promise.all([
|
|
92
|
+
getBookOffers(taker, convertIssueToTakerAmount(orderbook.base), convertIssueToTakerAmount(orderbook.counter), options),
|
|
93
|
+
getBookOffers(taker, convertIssueToTakerAmount(orderbook.counter), convertIssueToTakerAmount(orderbook.base), options),
|
|
94
|
+
]);
|
|
95
|
+
if (directOfferResults.error) {
|
|
96
|
+
return directOfferResults;
|
|
97
|
+
}
|
|
98
|
+
if (reverseOfferResults.error) {
|
|
99
|
+
return reverseOfferResults;
|
|
100
|
+
}
|
|
101
|
+
return (0, book_offers_1.formatBidsAndAsks)(orderbook, [...directOfferResults.offers, ...reverseOfferResults.offers]);
|
|
102
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare function parseCurrencyInformation(currency: any): Promise<null | DecodeHexCurrencyInterface | DecodedNFTCurrencyInterface>;
|
|
2
|
+
interface DecodedNFTCurrencyInterface {
|
|
3
|
+
type: string;
|
|
4
|
+
currencyCode: string;
|
|
5
|
+
currency: string;
|
|
6
|
+
cti: number;
|
|
7
|
+
ctiLedger: number;
|
|
8
|
+
ctiTxIndex: number;
|
|
9
|
+
ctiValid: boolean;
|
|
10
|
+
ctiVerified: boolean;
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
ctiTx: DecodedNFTCurrencyTransactionInterface;
|
|
13
|
+
}
|
|
14
|
+
interface DecodedNFTCurrencyTransactionInterface {
|
|
15
|
+
type?: string;
|
|
16
|
+
account?: string;
|
|
17
|
+
destination?: string;
|
|
18
|
+
issuer?: string;
|
|
19
|
+
counterparty?: string;
|
|
20
|
+
hash?: string;
|
|
21
|
+
memos?: string;
|
|
22
|
+
}
|
|
23
|
+
interface DecodeHexCurrencyInterface {
|
|
24
|
+
type: string;
|
|
25
|
+
currencyCode: string;
|
|
26
|
+
currency: string;
|
|
27
|
+
}
|
|
28
|
+
export {};
|