@bithomp/xrpl-api 3.7.30 → 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/parse/outcome/orderbook_changes.js +5 -4
- package/lib/parse/specification/offer-create.js +1 -0
- 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/lib/types/offers.d.ts +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,250 @@
|
|
|
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.parseCurrencyInformation = parseCurrencyInformation;
|
|
37
|
+
const Client = __importStar(require("../client"));
|
|
38
|
+
const utils_1 = require("../parse/utils");
|
|
39
|
+
const transaction_1 = require("../parse/transaction");
|
|
40
|
+
const client_1 = require("../client");
|
|
41
|
+
const common_1 = require("../common");
|
|
42
|
+
const amm_info_1 = require("../models/amm_info");
|
|
43
|
+
const maxLength = 20;
|
|
44
|
+
const DECODED_HEX_CURRENCY_REGEX = /[^-\w\(\)\[\]\u0020-\u007E\u00A0-\uFFFF]*/g;
|
|
45
|
+
async function parseCurrencyInformation(currency) {
|
|
46
|
+
if (!currency || typeof currency !== "string") {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (currency.length < 3) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (currency.length === 3 && currency.trim().toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
53
|
+
return decodeSimple(currency);
|
|
54
|
+
}
|
|
55
|
+
if (isHex(currency)) {
|
|
56
|
+
return await decodeCurrencyHex(currency);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function decodeSimple(currencyCode) {
|
|
61
|
+
return {
|
|
62
|
+
type: "simple",
|
|
63
|
+
currencyCode,
|
|
64
|
+
currency: currencyCode.trim(),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function decodeCurrencyHex(currencyCode) {
|
|
68
|
+
const prefix = currencyCode.substring(0, 2);
|
|
69
|
+
if (prefix === "02" && isXlf15d(currencyCode)) {
|
|
70
|
+
return await decodeXlf15d(currencyCode);
|
|
71
|
+
}
|
|
72
|
+
else if (prefix === "03" && amm_info_1.AMM_LP_TOKEN_REGEX.test(currencyCode)) {
|
|
73
|
+
return decodeLPTokenHex(currencyCode);
|
|
74
|
+
}
|
|
75
|
+
else if (prefix === "01" && isDemurrageHex(currencyCode)) {
|
|
76
|
+
return decodeDemurrageHex(currencyCode);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return decodeHex(currencyCode);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function decodeXlf15d(currencyCode) {
|
|
83
|
+
const hex = currencyCode.toString().replace(/(00)+$/g, "");
|
|
84
|
+
const ctiHex = hex.substring(2, 16);
|
|
85
|
+
const cti = BigInt("0x" + ctiHex);
|
|
86
|
+
const ctiLedger = Number(ctiLedgerIndex(cti));
|
|
87
|
+
const ctiTxIndex = Number(ctiTransactionIndex(cti));
|
|
88
|
+
const currencyHex = hex.substring(16, hex.length);
|
|
89
|
+
const currency = (0, utils_1.hexToString)(currencyHex)?.trim()?.replace(/\0/g, "");
|
|
90
|
+
const ledgerInfo = await getLedger(ctiLedger);
|
|
91
|
+
const ledger = ledgerInfo?.ledger;
|
|
92
|
+
let ctiVerified = false;
|
|
93
|
+
let ctiValid = false;
|
|
94
|
+
let timestamp;
|
|
95
|
+
let ctiTx = {};
|
|
96
|
+
if (ledger) {
|
|
97
|
+
timestamp = Math.round(new Date(ledger.close_time_human).getTime() / 1000);
|
|
98
|
+
for (const transaction of ledger.transactions) {
|
|
99
|
+
if (transaction.metaData.TransactionIndex === ctiTxIndex) {
|
|
100
|
+
const { Account: account, Destination: destination, LimitAmount: limit, Memos: memos, hash: hash, } = transaction;
|
|
101
|
+
const type = (0, transaction_1.parseTransactionType)(transaction.TransactionType);
|
|
102
|
+
ctiTx = (0, common_1.removeUndefined)({
|
|
103
|
+
type,
|
|
104
|
+
account,
|
|
105
|
+
destination,
|
|
106
|
+
issuer: limit?.issuer,
|
|
107
|
+
counterparty: limit?.issuer,
|
|
108
|
+
hash,
|
|
109
|
+
memos,
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (ledger) {
|
|
116
|
+
ctiVerified = true;
|
|
117
|
+
if (ctiTx.hash) {
|
|
118
|
+
ctiValid =
|
|
119
|
+
ctiLedgerCheck(cti) === ctiLedgerCheckGen(ledger.hash || ledger.ledger_hash) &&
|
|
120
|
+
ctiTransactionCheck(cti) === ctiTransactionCheckGen(ctiTx.hash);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
type: "nft",
|
|
125
|
+
currencyCode,
|
|
126
|
+
currency,
|
|
127
|
+
cti: Number(cti),
|
|
128
|
+
ctiLedger,
|
|
129
|
+
ctiTxIndex,
|
|
130
|
+
ctiValid,
|
|
131
|
+
ctiVerified,
|
|
132
|
+
timestamp,
|
|
133
|
+
ctiTx,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function decodeHex(currencyHex) {
|
|
137
|
+
let hex = currencyHex;
|
|
138
|
+
const prefix = currencyHex.substring(0, 2);
|
|
139
|
+
if (prefix === "02") {
|
|
140
|
+
hex = currencyHex.substring(16, currencyHex.length);
|
|
141
|
+
}
|
|
142
|
+
const decoded = (0, utils_1.hexToString)(hex)
|
|
143
|
+
?.slice(0, maxLength)
|
|
144
|
+
?.replace(/^\u0000+/, "")
|
|
145
|
+
?.replace(/\u0000+$/, "")
|
|
146
|
+
?.trim();
|
|
147
|
+
const trimmed = decoded
|
|
148
|
+
.replace(DECODED_HEX_CURRENCY_REGEX, "")
|
|
149
|
+
.replace(/[�]*/g, "")
|
|
150
|
+
.replace(/\s+/g, " ")
|
|
151
|
+
.trim();
|
|
152
|
+
if (trimmed.length > 1 &&
|
|
153
|
+
trimmed.length >= decoded.length / 2 &&
|
|
154
|
+
trimmed.toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
155
|
+
return {
|
|
156
|
+
type: "hex",
|
|
157
|
+
currencyCode: currencyHex,
|
|
158
|
+
currency: trimmed,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
function decodeLPTokenHex(currencyHex) {
|
|
164
|
+
return {
|
|
165
|
+
type: "lp_token",
|
|
166
|
+
currencyCode: currencyHex,
|
|
167
|
+
currency: "LP Token",
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function decodeDemurrageHex(currencyHex) {
|
|
171
|
+
const hex = currencyHex.substring(2, 8);
|
|
172
|
+
const currencyText = (0, utils_1.hexToString)(hex)?.trim()?.replace(/\0/g, "");
|
|
173
|
+
let valuePrefix = "";
|
|
174
|
+
const year = 31536000;
|
|
175
|
+
const decimals = 2;
|
|
176
|
+
const interestPeriod = hex2double(currencyHex.substring(16, 32));
|
|
177
|
+
const interest = Math.exp(year / interestPeriod);
|
|
178
|
+
const percentage = (interest * 100) - 100;
|
|
179
|
+
const decimalMultiplier = decimals ? Math.pow(10, decimals) : 100;
|
|
180
|
+
const rate = Math.round(percentage * decimalMultiplier) / decimalMultiplier;
|
|
181
|
+
valuePrefix = `(${rate > 0 ? "+" : ""}${rate}%pa)`;
|
|
182
|
+
const currency = `${currencyText} ${valuePrefix}`;
|
|
183
|
+
return {
|
|
184
|
+
type: "demurrage",
|
|
185
|
+
currencyCode: currencyHex,
|
|
186
|
+
currency,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function isDemurrageHex(currencyHex) {
|
|
190
|
+
const hex = currencyHex.substring(2, 8);
|
|
191
|
+
const currencyText = (0, utils_1.hexToString)(hex)?.trim()?.replace(/\0/g, "");
|
|
192
|
+
if (!currencyText || currencyText.length < 3) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
if (!currencyText.match(/^[a-zA-Z0-9\s]+$/)) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
const interestPeriod = hex2double(currencyHex.substring(16, 32));
|
|
199
|
+
if (isNaN(interestPeriod)) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const interestStart = Buffer.from(currencyHex.substring(8, 16), "hex").readUInt32BE(0);
|
|
203
|
+
if (isNaN(interestStart) || interestStart < 0) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
function hex2double(hex) {
|
|
209
|
+
const buffer = Buffer.from(hex, "hex");
|
|
210
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
211
|
+
return view.getFloat64(0, false);
|
|
212
|
+
}
|
|
213
|
+
async function getLedger(ledgerIndex) {
|
|
214
|
+
let ledgerInfo = null;
|
|
215
|
+
try {
|
|
216
|
+
ledgerInfo = await Client.getLedger({ ledgerIndex, transactions: true, expand: true });
|
|
217
|
+
}
|
|
218
|
+
catch (_err) {
|
|
219
|
+
}
|
|
220
|
+
return ledgerInfo;
|
|
221
|
+
}
|
|
222
|
+
function ctiTransactionIndex(cti) {
|
|
223
|
+
return (cti >> 32n) & 0xffffn;
|
|
224
|
+
}
|
|
225
|
+
function ctiLedgerIndex(cti) {
|
|
226
|
+
return cti & 0xffffffffn;
|
|
227
|
+
}
|
|
228
|
+
function ctiLedgerCheck(cti) {
|
|
229
|
+
return (cti >> 52n) & 0xfn;
|
|
230
|
+
}
|
|
231
|
+
function ctiTransactionCheck(cti) {
|
|
232
|
+
return (cti >> 48n) & 0xfn;
|
|
233
|
+
}
|
|
234
|
+
function ctiLedgerCheckGen(ledgerHash) {
|
|
235
|
+
return BigInt(parseInt(ledgerHash.slice(0, 1), 16));
|
|
236
|
+
}
|
|
237
|
+
function ctiTransactionCheckGen(txHash) {
|
|
238
|
+
return BigInt(parseInt(txHash.slice(0, 1), 16));
|
|
239
|
+
}
|
|
240
|
+
function isXlf15d(currencyHex) {
|
|
241
|
+
const hex = currencyHex.toString().replace(/(00)+$/g, "");
|
|
242
|
+
const xlf15d = Buffer.from(hex, "hex").slice(8).toString("utf-8").slice(0, maxLength).trim();
|
|
243
|
+
if (xlf15d.match(/[a-zA-Z0-9]{3,}/) && xlf15d.toUpperCase() !== (0, client_1.getNativeCurrency)()) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
function isHex(currencyCode) {
|
|
249
|
+
return !!currencyCode.match(/^[a-fA-F0-9]{40}$/) && !isNaN(parseInt(currencyCode, 16));
|
|
250
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
2
|
+
import { Connection } from "../connection";
|
|
3
|
+
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
export interface GetFeeOptions {
|
|
5
|
+
connection?: Connection;
|
|
6
|
+
tx?: any;
|
|
7
|
+
definitions?: XrplDefinitionsBase;
|
|
8
|
+
}
|
|
9
|
+
export interface GetFeeDataResult {
|
|
10
|
+
fee: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function getFeeData(options?: GetFeeOptions): Promise<GetFeeDataResult | ErrorResponse>;
|
|
13
|
+
export declare function getFee(options?: GetFeeOptions): Promise<string | null>;
|
|
@@ -0,0 +1,99 @@
|
|
|
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.getFeeData = getFeeData;
|
|
40
|
+
exports.getFee = getFee;
|
|
41
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
42
|
+
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
|
43
|
+
const Client = __importStar(require("../client"));
|
|
44
|
+
const common_1 = require("../common");
|
|
45
|
+
async function getFeeData(options = {}) {
|
|
46
|
+
const connection = options.connection || Client.findConnection();
|
|
47
|
+
if (!connection) {
|
|
48
|
+
throw new Error("There is no connection");
|
|
49
|
+
}
|
|
50
|
+
let txBlob;
|
|
51
|
+
if (typeof options.tx === "string") {
|
|
52
|
+
txBlob = options.tx;
|
|
53
|
+
}
|
|
54
|
+
else if (typeof options.tx === "object") {
|
|
55
|
+
txBlob = (0, ripple_binary_codec_1.encode)(options.tx, options.definitions);
|
|
56
|
+
}
|
|
57
|
+
const response = await connection.request({
|
|
58
|
+
command: "fee",
|
|
59
|
+
tx_blob: txBlob,
|
|
60
|
+
});
|
|
61
|
+
if (!response) {
|
|
62
|
+
return {
|
|
63
|
+
status: "error",
|
|
64
|
+
error: "invalidResponse",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (response.error) {
|
|
68
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
69
|
+
return (0, common_1.removeUndefined)({
|
|
70
|
+
error,
|
|
71
|
+
error_code,
|
|
72
|
+
error_message,
|
|
73
|
+
error_exception,
|
|
74
|
+
status,
|
|
75
|
+
validated,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const openLedgerFee = response?.result?.drops?.open_ledger_fee;
|
|
79
|
+
if (!openLedgerFee) {
|
|
80
|
+
return {
|
|
81
|
+
status: "error",
|
|
82
|
+
error: "No open_ledger_fee data in response",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const fee = new bignumber_js_1.default(openLedgerFee)
|
|
86
|
+
.multipliedBy(Client.feeCushion)
|
|
87
|
+
.dividedBy(common_1.dropsInXRP)
|
|
88
|
+
.decimalPlaces(6, bignumber_js_1.default.ROUND_UP);
|
|
89
|
+
return {
|
|
90
|
+
fee: fee.toString(),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function getFee(options = {}) {
|
|
94
|
+
const response = await getFeeData(options);
|
|
95
|
+
if ("fee" in response) {
|
|
96
|
+
return response.fee;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Trustline } from "../models/account_lines";
|
|
2
|
+
import { LedgerIndex } from "../models/ledger";
|
|
3
|
+
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
import { GatewayBalances } from "../models/gateway_balances";
|
|
5
|
+
import { FormattedGatewayBalances } from "../types";
|
|
6
|
+
export interface GetBalanceSheetOptions {
|
|
7
|
+
ledgerIndex?: LedgerIndex;
|
|
8
|
+
hotwallet?: string;
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
formatted?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function getBalanceSheet(account: string, options?: GetBalanceSheetOptions): Promise<GatewayBalances | FormattedGatewayBalances | ErrorResponse>;
|
|
13
|
+
export interface ObligationTrustline extends Trustline {
|
|
14
|
+
obligation?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function getAccountObligations(account: string): Promise<object | ErrorResponse>;
|
|
@@ -0,0 +1,119 @@
|
|
|
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.getBalanceSheet = getBalanceSheet;
|
|
40
|
+
exports.getAccountObligations = getAccountObligations;
|
|
41
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
42
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
43
|
+
const Client = __importStar(require("../client"));
|
|
44
|
+
const gateway_balances_1 = require("../parse/ledger/gateway-balances");
|
|
45
|
+
const utils_1 = require("../common/utils");
|
|
46
|
+
async function getBalanceSheet(account, options = {}) {
|
|
47
|
+
const formatted = options.formatted === true;
|
|
48
|
+
const connection = Client.findConnection("gateway_balances");
|
|
49
|
+
if (!connection) {
|
|
50
|
+
throw new Error("There is no connection");
|
|
51
|
+
}
|
|
52
|
+
const response = await connection.request({
|
|
53
|
+
command: "gateway_balances",
|
|
54
|
+
account,
|
|
55
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
56
|
+
hotwallet: options.hotwallet,
|
|
57
|
+
strict: !!options.strict,
|
|
58
|
+
});
|
|
59
|
+
if (!response) {
|
|
60
|
+
return {
|
|
61
|
+
account,
|
|
62
|
+
status: "error",
|
|
63
|
+
error: "invalidResponse",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (response.error) {
|
|
67
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
68
|
+
return (0, utils_1.removeUndefined)({
|
|
69
|
+
account,
|
|
70
|
+
error,
|
|
71
|
+
error_code,
|
|
72
|
+
error_message,
|
|
73
|
+
error_exception,
|
|
74
|
+
status,
|
|
75
|
+
validated,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const result = response.result;
|
|
79
|
+
if (formatted) {
|
|
80
|
+
return (0, gateway_balances_1.parseGatewayBalances)(result);
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
async function getAccountObligations(account) {
|
|
85
|
+
const response = (await getBalanceSheet(account));
|
|
86
|
+
if (response.error) {
|
|
87
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
88
|
+
return (0, utils_1.removeUndefined)({
|
|
89
|
+
account,
|
|
90
|
+
error,
|
|
91
|
+
error_code,
|
|
92
|
+
error_message,
|
|
93
|
+
error_exception,
|
|
94
|
+
status,
|
|
95
|
+
validated,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const obligations = response.obligations;
|
|
99
|
+
const obligationsLines = [];
|
|
100
|
+
lodash_1.default.map(obligations, (value, currency) => {
|
|
101
|
+
obligationsLines.push(ObligationToObligationTrustline(account, value, currency));
|
|
102
|
+
});
|
|
103
|
+
delete response.obligations;
|
|
104
|
+
delete response.assets;
|
|
105
|
+
response.lines = obligationsLines;
|
|
106
|
+
return response;
|
|
107
|
+
}
|
|
108
|
+
function ObligationToObligationTrustline(account, value, currency) {
|
|
109
|
+
return {
|
|
110
|
+
account,
|
|
111
|
+
currency,
|
|
112
|
+
balance: new bignumber_js_1.default(value).times(-1).toString(),
|
|
113
|
+
limit: "0",
|
|
114
|
+
limit_peer: "0",
|
|
115
|
+
quality_in: 0,
|
|
116
|
+
quality_out: 0,
|
|
117
|
+
obligation: true,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./account_info";
|
|
2
|
+
export * from "./account_lines";
|
|
3
|
+
export * from "./account_namespace";
|
|
4
|
+
export * from "./account_nfts";
|
|
5
|
+
export * from "./account_objects";
|
|
6
|
+
export * from "./account_offers";
|
|
7
|
+
export * from "./account_tx";
|
|
8
|
+
export * from "./amm_info";
|
|
9
|
+
export * from "./book_offers";
|
|
10
|
+
export * from "./currency";
|
|
11
|
+
export * from "./fee";
|
|
12
|
+
export * from "./gateway_balances";
|
|
13
|
+
export * from "./ledger";
|
|
14
|
+
export * from "./ledger_entry";
|
|
15
|
+
export * from "./manifest";
|
|
16
|
+
export * from "./nft_info";
|
|
17
|
+
export * from "./server_info";
|
|
18
|
+
export * from "./server_definitions";
|
|
19
|
+
export * from "./transaction";
|
|
20
|
+
export * from "./vl";
|
|
21
|
+
export * from "./vl-v2";
|
|
@@ -0,0 +1,37 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account_info"), exports);
|
|
18
|
+
__exportStar(require("./account_lines"), exports);
|
|
19
|
+
__exportStar(require("./account_namespace"), exports);
|
|
20
|
+
__exportStar(require("./account_nfts"), exports);
|
|
21
|
+
__exportStar(require("./account_objects"), exports);
|
|
22
|
+
__exportStar(require("./account_offers"), exports);
|
|
23
|
+
__exportStar(require("./account_tx"), exports);
|
|
24
|
+
__exportStar(require("./amm_info"), exports);
|
|
25
|
+
__exportStar(require("./book_offers"), exports);
|
|
26
|
+
__exportStar(require("./currency"), exports);
|
|
27
|
+
__exportStar(require("./fee"), exports);
|
|
28
|
+
__exportStar(require("./gateway_balances"), exports);
|
|
29
|
+
__exportStar(require("./ledger"), exports);
|
|
30
|
+
__exportStar(require("./ledger_entry"), exports);
|
|
31
|
+
__exportStar(require("./manifest"), exports);
|
|
32
|
+
__exportStar(require("./nft_info"), exports);
|
|
33
|
+
__exportStar(require("./server_info"), exports);
|
|
34
|
+
__exportStar(require("./server_definitions"), exports);
|
|
35
|
+
__exportStar(require("./transaction"), exports);
|
|
36
|
+
__exportStar(require("./vl"), exports);
|
|
37
|
+
__exportStar(require("./vl-v2"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Connection } from "../connection";
|
|
2
|
+
import { LedgerIndex } from "../models/ledger";
|
|
3
|
+
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
import { FormattedLedger } from "../types";
|
|
5
|
+
export interface GetLedgerOptions {
|
|
6
|
+
ledgerIndex?: LedgerIndex;
|
|
7
|
+
ledgerHash?: string;
|
|
8
|
+
transactions?: boolean;
|
|
9
|
+
expand?: boolean;
|
|
10
|
+
legacy?: boolean;
|
|
11
|
+
formatted?: boolean;
|
|
12
|
+
includeRawTransactions?: boolean;
|
|
13
|
+
connection?: Connection;
|
|
14
|
+
}
|
|
15
|
+
export declare function getLedger(options?: GetLedgerOptions): Promise<object | FormattedLedger | ErrorResponse>;
|
|
16
|
+
export declare function getLedgerIndex(options?: GetLedgerOptions): Promise<number | undefined>;
|
|
@@ -0,0 +1,99 @@
|
|
|
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.getLedger = getLedger;
|
|
37
|
+
exports.getLedgerIndex = getLedgerIndex;
|
|
38
|
+
const Client = __importStar(require("../client"));
|
|
39
|
+
const ledger_1 = require("../parse/ledger/ledger");
|
|
40
|
+
const utils_1 = require("../common/utils");
|
|
41
|
+
async function getLedger(options = {}) {
|
|
42
|
+
const formatted = options.legacy === true || options.formatted === true;
|
|
43
|
+
const connection = options.connection || Client.findConnectionByLedger(options.ledgerIndex, options.ledgerHash);
|
|
44
|
+
if (!connection) {
|
|
45
|
+
throw new Error("There is no connection");
|
|
46
|
+
}
|
|
47
|
+
if (options.ledgerIndex && !connection.isLedgerIndexAvailable(options.ledgerIndex)) {
|
|
48
|
+
return {
|
|
49
|
+
status: "error",
|
|
50
|
+
error: "lgrNotFound",
|
|
51
|
+
error_message: "ledger number is out of available range",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const request = {
|
|
55
|
+
command: "ledger",
|
|
56
|
+
transactions: !!options.transactions,
|
|
57
|
+
expand: !!options.expand,
|
|
58
|
+
};
|
|
59
|
+
if (options.ledgerHash) {
|
|
60
|
+
request.ledger_hash = options.ledgerHash;
|
|
61
|
+
}
|
|
62
|
+
else if (options.ledgerIndex) {
|
|
63
|
+
request.ledger_index = options.ledgerIndex;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
request.ledger_index = "validated";
|
|
67
|
+
}
|
|
68
|
+
const response = await connection.request(request);
|
|
69
|
+
if (response.error) {
|
|
70
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
71
|
+
return (0, utils_1.removeUndefined)({
|
|
72
|
+
error,
|
|
73
|
+
error_code,
|
|
74
|
+
error_message,
|
|
75
|
+
error_exception,
|
|
76
|
+
status,
|
|
77
|
+
validated,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const result = response?.result;
|
|
81
|
+
if (!result) {
|
|
82
|
+
return {
|
|
83
|
+
status: "error",
|
|
84
|
+
error: "invalidResponse",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (formatted === true) {
|
|
88
|
+
result.ledger = (0, ledger_1.parseLedger)(result.ledger, options.includeRawTransactions === true);
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
async function getLedgerIndex(options = {}) {
|
|
93
|
+
const ledgerInfo = await Client.getLedger(options);
|
|
94
|
+
const ledger = ledgerInfo?.ledger;
|
|
95
|
+
if (ledger) {
|
|
96
|
+
return parseInt(ledger.ledger_index, 10);
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|