@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,440 @@
|
|
|
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.getTransaction = getTransaction;
|
|
37
|
+
exports.getTransactionByCTID = getTransactionByCTID;
|
|
38
|
+
exports.submitPaymentTransactionV1 = submitPaymentTransactionV1;
|
|
39
|
+
exports.getAccountPaymentParams = getAccountPaymentParams;
|
|
40
|
+
exports.getTxSubmitParams = getTxSubmitParams;
|
|
41
|
+
exports.submit = submit;
|
|
42
|
+
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
|
43
|
+
const balance_changes_1 = require("../parse/outcome/balance_changes");
|
|
44
|
+
const Client = __importStar(require("../client"));
|
|
45
|
+
const common_1 = require("../common");
|
|
46
|
+
const utils_1 = require("../common/utils");
|
|
47
|
+
const payment_1 = require("../v1/transaction/payment");
|
|
48
|
+
const transaction_1 = require("../models/transaction");
|
|
49
|
+
const wallet_1 = require("../wallet");
|
|
50
|
+
const submitErrorsGroup = ["tem", "tef", "tel", "ter"];
|
|
51
|
+
const FEE_LIMIT = 0.5;
|
|
52
|
+
const LEDGER_CLOSE_TIME_AWAIT = 2000;
|
|
53
|
+
const MAX_LEDGERS_AWAIT = 5;
|
|
54
|
+
async function getTransaction(transaction, options = {}) {
|
|
55
|
+
if ((0, transaction_1.isCTID)(transaction)) {
|
|
56
|
+
return getTransactionByCTID(transaction, options);
|
|
57
|
+
}
|
|
58
|
+
const formatted = options.legacy === true || options.formatted === true;
|
|
59
|
+
const connection = Client.findConnection("history");
|
|
60
|
+
if (!connection) {
|
|
61
|
+
throw new Error("There is no connection");
|
|
62
|
+
}
|
|
63
|
+
const response = await connection.request({
|
|
64
|
+
command: "tx",
|
|
65
|
+
transaction,
|
|
66
|
+
binary: !!options.binary,
|
|
67
|
+
min_ledger: options.minLedger,
|
|
68
|
+
max_ledger: options.maxLedger,
|
|
69
|
+
});
|
|
70
|
+
if (!response) {
|
|
71
|
+
return {
|
|
72
|
+
status: "error",
|
|
73
|
+
error: "invalidResponse",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (response.error) {
|
|
77
|
+
const { error, error_code, error_message, error_exception, status, validated } = response;
|
|
78
|
+
return (0, utils_1.removeUndefined)({
|
|
79
|
+
transaction,
|
|
80
|
+
error,
|
|
81
|
+
error_code,
|
|
82
|
+
error_message,
|
|
83
|
+
error_exception,
|
|
84
|
+
status,
|
|
85
|
+
validated,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const result = response?.result;
|
|
89
|
+
if (typeof result === "object") {
|
|
90
|
+
if (formatted === true) {
|
|
91
|
+
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true, Client.getNativeCurrency(), options.definitions);
|
|
92
|
+
}
|
|
93
|
+
if (options.balanceChanges === true && typeof result.meta === "object") {
|
|
94
|
+
const tx = result.tx || result.tx_json || result;
|
|
95
|
+
result.balanceChanges = (0, balance_changes_1.parseBalanceChanges)(result.meta, Client.getNativeCurrency(), tx);
|
|
96
|
+
}
|
|
97
|
+
if (options.specification === true) {
|
|
98
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, Client.getNativeCurrency(), options.definitions);
|
|
99
|
+
result.specification = details.specification;
|
|
100
|
+
result.outcome = details.outcome;
|
|
101
|
+
if (details.rawTransaction) {
|
|
102
|
+
result.rawTransaction = details.rawTransaction;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (!result.hasOwnProperty("ctid")) {
|
|
107
|
+
const ctid = (0, transaction_1.encodeCTIDforTransaction)(result, connection.getNetworkID());
|
|
108
|
+
if (ctid) {
|
|
109
|
+
result.ctid = ctid;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (result.hasOwnProperty("tx_json") && result.tx_json.hasOwnProperty("ctid")) {
|
|
113
|
+
delete result.tx_json.ctid;
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
async function getTransactionByCTID(ctid, options = {}) {
|
|
118
|
+
if (!(0, transaction_1.isCTID)(ctid)) {
|
|
119
|
+
return {
|
|
120
|
+
status: "error",
|
|
121
|
+
error: "invalidCTID",
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const { ledgerIndex, txIndex, networkID } = (0, transaction_1.decodeCTID)(ctid);
|
|
125
|
+
const formatted = options.legacy === true || options.formatted === true;
|
|
126
|
+
const connection = Client.findConnection("history", undefined, undefined, undefined, networkID);
|
|
127
|
+
if (!connection) {
|
|
128
|
+
throw new Error("There is no connection");
|
|
129
|
+
}
|
|
130
|
+
const ledgerInfo = await Client.getLedger({
|
|
131
|
+
ledgerIndex,
|
|
132
|
+
transactions: true,
|
|
133
|
+
expand: true,
|
|
134
|
+
connection,
|
|
135
|
+
});
|
|
136
|
+
if (!ledgerInfo) {
|
|
137
|
+
return {
|
|
138
|
+
transaction: ctid,
|
|
139
|
+
ledger_index: ledgerIndex,
|
|
140
|
+
status: "error",
|
|
141
|
+
error: "invalidResponse",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if ("error" in ledgerInfo) {
|
|
145
|
+
const { error, error_code, error_message, status, validated } = ledgerInfo;
|
|
146
|
+
return {
|
|
147
|
+
transaction: ctid,
|
|
148
|
+
error,
|
|
149
|
+
error_code,
|
|
150
|
+
error_message,
|
|
151
|
+
status,
|
|
152
|
+
validated,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const ledger = ledgerInfo.ledger;
|
|
156
|
+
const { transactions } = ledger;
|
|
157
|
+
if (!Array.isArray(transactions)) {
|
|
158
|
+
return {
|
|
159
|
+
transaction: ctid,
|
|
160
|
+
status: "error",
|
|
161
|
+
error: "txnNotFound",
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const ledgerTx = transactions.find((tx) => tx.metaData.TransactionIndex === txIndex);
|
|
165
|
+
if (!ledgerTx) {
|
|
166
|
+
return {
|
|
167
|
+
transaction: ctid,
|
|
168
|
+
status: "error",
|
|
169
|
+
error: "txnNotFound",
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
ledgerTx.ctid = ctid;
|
|
173
|
+
const result = (0, transaction_1.ledgerTxToTx)(ledgerTx, ledgerIndex, ledger.close_time);
|
|
174
|
+
if (formatted === true) {
|
|
175
|
+
return (0, transaction_1.getTxDetails)(result, options.includeRawTransaction === true, Client.getNativeCurrency(), options.definitions);
|
|
176
|
+
}
|
|
177
|
+
if (options.balanceChanges === true && typeof result.meta === "object") {
|
|
178
|
+
const tx = result.tx || result.tx_json || result;
|
|
179
|
+
result.balanceChanges = (0, balance_changes_1.parseBalanceChanges)(result.meta, Client.getNativeCurrency(), tx);
|
|
180
|
+
}
|
|
181
|
+
if (options.specification === true) {
|
|
182
|
+
const details = (0, transaction_1.getTxDetails)(result, options.includeRawTransaction, Client.getNativeCurrency(), options.definitions);
|
|
183
|
+
result.specification = details.specification;
|
|
184
|
+
result.outcome = details.outcome;
|
|
185
|
+
if (details.rawTransaction) {
|
|
186
|
+
result.rawTransaction = details.rawTransaction;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
async function submitPaymentTransactionV1(data, definitions, validateTx) {
|
|
192
|
+
const connection = Client.findConnection("payment, submit, !clio");
|
|
193
|
+
if (!connection) {
|
|
194
|
+
throw new Error("There is no connection");
|
|
195
|
+
}
|
|
196
|
+
const txPayment = {
|
|
197
|
+
source: {
|
|
198
|
+
address: data.sourceAddress,
|
|
199
|
+
tag: data.sourceTag,
|
|
200
|
+
maxAmount: {
|
|
201
|
+
value: data.sourceValue.toString(),
|
|
202
|
+
currency: data.sourceCurrency,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
destination: {
|
|
206
|
+
address: data.destinationAddress,
|
|
207
|
+
tag: data.destinationTag,
|
|
208
|
+
amount: {
|
|
209
|
+
value: data.destinationValue.toString(),
|
|
210
|
+
currency: data.destinationCurrency,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
networkID: data.networkID,
|
|
214
|
+
memos: data.memos,
|
|
215
|
+
};
|
|
216
|
+
const transaction = (0, payment_1.createPaymentTransaction)(data.sourceAddress, txPayment);
|
|
217
|
+
const skip = {
|
|
218
|
+
fee: data.fee ? true : false,
|
|
219
|
+
sequence: data.sequence ? true : false,
|
|
220
|
+
lastLedgerSequence: data.lastLedgerSequence ? true : false,
|
|
221
|
+
};
|
|
222
|
+
const submitParams = await getTxSubmitParams(data.sourceAddress, transaction, definitions, connection, skip);
|
|
223
|
+
if ("error" in submitParams) {
|
|
224
|
+
return submitParams;
|
|
225
|
+
}
|
|
226
|
+
if (data.fee) {
|
|
227
|
+
transaction.Fee = (0, common_1.xrpToDrops)(data.fee);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
transaction.Fee = submitParams.fee;
|
|
231
|
+
}
|
|
232
|
+
if (data.sequence) {
|
|
233
|
+
transaction.Sequence = data.sequence;
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
transaction.Sequence = submitParams.sequence;
|
|
237
|
+
}
|
|
238
|
+
if (data.lastLedgerSequence) {
|
|
239
|
+
transaction.LastLedgerSequence = data.lastLedgerSequence;
|
|
240
|
+
}
|
|
241
|
+
else if (submitParams.lastLedgerSequence) {
|
|
242
|
+
transaction.LastLedgerSequence = submitParams.lastLedgerSequence;
|
|
243
|
+
}
|
|
244
|
+
const wallet = (0, wallet_1.walletFromSeed)(data.secret, { seedAddress: transaction.Account });
|
|
245
|
+
const signedTransaction = (0, wallet_1.signTransaction)(wallet, transaction, false, definitions, validateTx).tx_blob;
|
|
246
|
+
return await submit(signedTransaction, { connection, definitions });
|
|
247
|
+
}
|
|
248
|
+
async function getAccountPaymentParams(account, connection) {
|
|
249
|
+
try {
|
|
250
|
+
connection = connection || Client.findConnection("submit") || undefined;
|
|
251
|
+
if (!connection) {
|
|
252
|
+
throw new Error("There is no connection");
|
|
253
|
+
}
|
|
254
|
+
const feePromise = new Promise(async (resolve) => {
|
|
255
|
+
const baseFee = await Client.getFee({ connection });
|
|
256
|
+
let fee = parseFloat(baseFee);
|
|
257
|
+
if (fee > FEE_LIMIT) {
|
|
258
|
+
fee = FEE_LIMIT;
|
|
259
|
+
}
|
|
260
|
+
if (!fee) {
|
|
261
|
+
throw new Error("Fee is not defined");
|
|
262
|
+
}
|
|
263
|
+
resolve((0, common_1.xrpToDrops)(fee.toString()));
|
|
264
|
+
});
|
|
265
|
+
const sequencePromise = new Promise(async (resolve, rejects) => {
|
|
266
|
+
try {
|
|
267
|
+
const accountData = (await Client.getAccountInfoData(account, { connection }));
|
|
268
|
+
if (!accountData) {
|
|
269
|
+
return rejects(new Error("Account not found"));
|
|
270
|
+
}
|
|
271
|
+
if ("error" in accountData) {
|
|
272
|
+
return rejects(new Error(accountData.error));
|
|
273
|
+
}
|
|
274
|
+
resolve(accountData.Sequence);
|
|
275
|
+
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
rejects(e);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
const lastLedgerSequencePromise = new Promise(async (resolve) => {
|
|
281
|
+
try {
|
|
282
|
+
const ledgerIndex = await Client.getLedgerIndex();
|
|
283
|
+
if (ledgerIndex !== undefined) {
|
|
284
|
+
resolve(ledgerIndex + MAX_LEDGERS_AWAIT);
|
|
285
|
+
}
|
|
286
|
+
resolve(undefined);
|
|
287
|
+
}
|
|
288
|
+
catch (_err) {
|
|
289
|
+
resolve(undefined);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
const result = await Promise.all([feePromise, sequencePromise, lastLedgerSequencePromise]);
|
|
293
|
+
return {
|
|
294
|
+
fee: result[0],
|
|
295
|
+
sequence: result[1],
|
|
296
|
+
lastLedgerSequence: result[2],
|
|
297
|
+
networkID: connection.getNetworkID(),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
catch (e) {
|
|
301
|
+
return {
|
|
302
|
+
account,
|
|
303
|
+
status: "error",
|
|
304
|
+
error: e.message,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async function getTxSubmitParams(account, tx, definitions, connection, skip) {
|
|
309
|
+
try {
|
|
310
|
+
connection = connection || Client.findConnection("submit") || undefined;
|
|
311
|
+
if (!connection) {
|
|
312
|
+
throw new Error("There is no connection");
|
|
313
|
+
}
|
|
314
|
+
let feePromise;
|
|
315
|
+
let sequencePromise;
|
|
316
|
+
let lastLedgerSequencePromise;
|
|
317
|
+
if (skip?.fee !== true) {
|
|
318
|
+
feePromise = new Promise(async (resolve, rejects) => {
|
|
319
|
+
try {
|
|
320
|
+
if (tx && typeof tx === "object") {
|
|
321
|
+
tx = { ...tx, Sequence: 0, Fee: "0", SigningPubKey: "" };
|
|
322
|
+
}
|
|
323
|
+
const baseFee = await Client.getFee({ connection, tx, definitions });
|
|
324
|
+
let fee = parseFloat(baseFee);
|
|
325
|
+
if (fee > FEE_LIMIT) {
|
|
326
|
+
fee = FEE_LIMIT;
|
|
327
|
+
}
|
|
328
|
+
if (!fee) {
|
|
329
|
+
throw new Error("Fee is not defined");
|
|
330
|
+
}
|
|
331
|
+
resolve((0, common_1.xrpToDrops)(fee.toString()));
|
|
332
|
+
}
|
|
333
|
+
catch (e) {
|
|
334
|
+
rejects(e);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
if (skip?.sequence !== true) {
|
|
339
|
+
sequencePromise = new Promise(async (resolve, rejects) => {
|
|
340
|
+
try {
|
|
341
|
+
const accountData = (await Client.getAccountInfoData(account, { connection }));
|
|
342
|
+
if (!accountData) {
|
|
343
|
+
return rejects(new Error("Account not found"));
|
|
344
|
+
}
|
|
345
|
+
if ("error" in accountData) {
|
|
346
|
+
return rejects(new Error(accountData.error));
|
|
347
|
+
}
|
|
348
|
+
resolve(accountData.Sequence);
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
rejects(e);
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
if (skip?.lastLedgerSequence !== true) {
|
|
356
|
+
lastLedgerSequencePromise = new Promise(async (resolve) => {
|
|
357
|
+
try {
|
|
358
|
+
const ledgerIndex = await Client.getLedgerIndex();
|
|
359
|
+
if (ledgerIndex !== undefined) {
|
|
360
|
+
resolve(ledgerIndex + MAX_LEDGERS_AWAIT);
|
|
361
|
+
}
|
|
362
|
+
resolve(undefined);
|
|
363
|
+
}
|
|
364
|
+
catch (_err) {
|
|
365
|
+
resolve(undefined);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
const result = await Promise.all([feePromise, sequencePromise, lastLedgerSequencePromise]);
|
|
370
|
+
return {
|
|
371
|
+
fee: result[0],
|
|
372
|
+
sequence: result[1],
|
|
373
|
+
lastLedgerSequence: result[2],
|
|
374
|
+
networkID: connection.getNetworkID(),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
catch (e) {
|
|
378
|
+
return {
|
|
379
|
+
account,
|
|
380
|
+
status: "error",
|
|
381
|
+
error: e.message,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
async function submit(signedTransaction, options = {}) {
|
|
386
|
+
const connection = options.connection || Client.findConnection("submit");
|
|
387
|
+
if (!connection) {
|
|
388
|
+
throw new Error("There is no connection");
|
|
389
|
+
}
|
|
390
|
+
const response = await connection.submit(signedTransaction);
|
|
391
|
+
if (response.error) {
|
|
392
|
+
return response;
|
|
393
|
+
}
|
|
394
|
+
const result = response?.result;
|
|
395
|
+
const resultGroup = result?.engine_result?.slice(0, 3);
|
|
396
|
+
if ((submitErrorsGroup.includes(resultGroup) && result?.engine_result !== "terQUEUED") || result?.kept === false) {
|
|
397
|
+
return result;
|
|
398
|
+
}
|
|
399
|
+
const txHash = result?.tx_json?.hash;
|
|
400
|
+
if (!txHash) {
|
|
401
|
+
return result;
|
|
402
|
+
}
|
|
403
|
+
let lastLedger = 0;
|
|
404
|
+
const transaction = (0, ripple_binary_codec_1.decode)(signedTransaction, options.definitions);
|
|
405
|
+
if (transaction.LastLedgerSequence) {
|
|
406
|
+
lastLedger = transaction.LastLedgerSequence;
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
const ledgerIndex = await Client.getLedgerIndex();
|
|
410
|
+
if (ledgerIndex !== undefined) {
|
|
411
|
+
const ledgersToWait = MAX_LEDGERS_AWAIT * 2;
|
|
412
|
+
lastLedger = ledgerIndex + ledgersToWait;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const finalResult = await waitForFinalTransactionOutcome(txHash, lastLedger);
|
|
416
|
+
return finalResult;
|
|
417
|
+
}
|
|
418
|
+
async function waitForFinalTransactionOutcome(txHash, lastLedger) {
|
|
419
|
+
await (0, utils_1.sleep)(LEDGER_CLOSE_TIME_AWAIT);
|
|
420
|
+
const tx = await getTransaction(txHash);
|
|
421
|
+
const error = tx?.error;
|
|
422
|
+
if (error === "notConnected" || error === "shutdownConnection") {
|
|
423
|
+
return tx;
|
|
424
|
+
}
|
|
425
|
+
if (!tx || error === "txnNotFound" || tx.validated !== true) {
|
|
426
|
+
const ledgerIndex = await Client.getLedgerIndex();
|
|
427
|
+
if (ledgerIndex === undefined || lastLedger > ledgerIndex) {
|
|
428
|
+
return waitForFinalTransactionOutcome(txHash, lastLedger);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (tx && !tx.hasOwnProperty("error") && tx.validated === false) {
|
|
432
|
+
if (tx.hasOwnProperty("LastLedgerSequence")) {
|
|
433
|
+
return { ...tx, status: "error", error: "lastLedgerIndexReached" };
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
return { ...tx, status: "error", error: "waitingForValidation" };
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return tx;
|
|
440
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { VLInterface, VLBlobInterface, VLV2ValidatorsPublishBlobInterface, VLSecretKeysInterface } from "../models/vl";
|
|
2
|
+
export declare function createVLv2(masterKey: VLSecretKeysInterface, ephemeralKey: VLSecretKeysInterface, publishBlobs: VLV2ValidatorsPublishBlobInterface[]): Promise<VLInterface>;
|
|
3
|
+
export declare function createVLBlobV2(sequence: number, effective: number | undefined, expiration: number, validatorsPublicKeys: string[]): Promise<VLBlobInterface>;
|
|
@@ -0,0 +1,124 @@
|
|
|
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.createVLv2 = createVLv2;
|
|
37
|
+
exports.createVLBlobV2 = createVLBlobV2;
|
|
38
|
+
const vl_1 = require("../models/vl");
|
|
39
|
+
const manifest_1 = require("../models/manifest");
|
|
40
|
+
const ledger_1 = require("../models/ledger");
|
|
41
|
+
const Validator = __importStar(require("../validator"));
|
|
42
|
+
const vl_2 = require("./vl");
|
|
43
|
+
const common_1 = require("../common");
|
|
44
|
+
async function createVLv2(masterKey, ephemeralKey, publishBlobs) {
|
|
45
|
+
if (!masterKey) {
|
|
46
|
+
throw new Error("Master key is required");
|
|
47
|
+
}
|
|
48
|
+
if (!ephemeralKey) {
|
|
49
|
+
throw new Error("Ephemeral key is required");
|
|
50
|
+
}
|
|
51
|
+
if (masterKey.publicKey === ephemeralKey.publicKey) {
|
|
52
|
+
throw new Error("Master and ephemeral keys must be different.");
|
|
53
|
+
}
|
|
54
|
+
let globalSequence;
|
|
55
|
+
const blobs = [];
|
|
56
|
+
for (const publishBlob of publishBlobs) {
|
|
57
|
+
const { sequence, effective, expiration, validatorsPublicKeys } = publishBlob;
|
|
58
|
+
if (typeof sequence !== "number") {
|
|
59
|
+
throw new Error("sequence must be a number.");
|
|
60
|
+
}
|
|
61
|
+
if (typeof effective !== "number" && effective !== undefined) {
|
|
62
|
+
throw new Error("effective must be a number.");
|
|
63
|
+
}
|
|
64
|
+
if (typeof expiration !== "number") {
|
|
65
|
+
throw new Error("expiration must be a number.");
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(validatorsPublicKeys) === false) {
|
|
68
|
+
throw new Error("validatorsPublicKeys must be an array.");
|
|
69
|
+
}
|
|
70
|
+
if (validatorsPublicKeys.length === 0) {
|
|
71
|
+
throw new Error("validatorsPublicKeys must not be empty.");
|
|
72
|
+
}
|
|
73
|
+
for (const publicKey of validatorsPublicKeys) {
|
|
74
|
+
if (typeof publicKey !== "string") {
|
|
75
|
+
throw new Error("validatorsPublicKeys must be an array of strings.");
|
|
76
|
+
}
|
|
77
|
+
if (publicKey[0] !== "n") {
|
|
78
|
+
throw new Error("validatorsPublicKeys must be an array of strings starting with 'n'.");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const blobInfo = {};
|
|
82
|
+
const vlBlob = await createVLBlobV2(sequence, effective, expiration, validatorsPublicKeys);
|
|
83
|
+
blobInfo.blob = (0, vl_1.encodeVLBlob)(vlBlob);
|
|
84
|
+
blobInfo.signature = Validator.sign(Buffer.from(blobInfo.blob, "base64"), ephemeralKey.privateKey);
|
|
85
|
+
if (globalSequence === undefined) {
|
|
86
|
+
globalSequence = sequence;
|
|
87
|
+
}
|
|
88
|
+
else if (globalSequence !== sequence) {
|
|
89
|
+
blobInfo.manifest = (0, manifest_1.generateManifest)({
|
|
90
|
+
Sequence: sequence,
|
|
91
|
+
PublicKey: masterKey.publicKey,
|
|
92
|
+
SigningPubKey: ephemeralKey.publicKey,
|
|
93
|
+
SigningPrivateKey: ephemeralKey.privateKey,
|
|
94
|
+
MasterPrivateKey: masterKey.privateKey,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
blobs.push(blobInfo);
|
|
98
|
+
}
|
|
99
|
+
if (globalSequence === undefined) {
|
|
100
|
+
throw new Error("sequence must be a number.");
|
|
101
|
+
}
|
|
102
|
+
const globalManifest = (0, manifest_1.generateManifest)({
|
|
103
|
+
Sequence: globalSequence,
|
|
104
|
+
PublicKey: masterKey.publicKey,
|
|
105
|
+
SigningPubKey: ephemeralKey.publicKey,
|
|
106
|
+
SigningPrivateKey: ephemeralKey.privateKey,
|
|
107
|
+
MasterPrivateKey: masterKey.privateKey,
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
"blobs_v2": blobs,
|
|
111
|
+
manifest: globalManifest,
|
|
112
|
+
public_key: masterKey.publicKey,
|
|
113
|
+
version: 2,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async function createVLBlobV2(sequence, effective, expiration, validatorsPublicKeys) {
|
|
117
|
+
const validators = await (0, vl_2.getVLBlobValidatorsManifest)(validatorsPublicKeys);
|
|
118
|
+
return (0, common_1.removeUndefined)({
|
|
119
|
+
sequence,
|
|
120
|
+
effective: effective ? (0, ledger_1.unixTimeToLedgerTime)(effective) : undefined,
|
|
121
|
+
expiration: (0, ledger_1.unixTimeToLedgerTime)(expiration),
|
|
122
|
+
validators,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VLInterface, ValidatorInterface, VLBlobInterface, VLSecretKeysInterface } from "../models/vl";
|
|
2
|
+
export declare function createVL(masterKey: VLSecretKeysInterface, ephemeralKey: VLSecretKeysInterface, sequence: number, expiration: number, validatorsPublicKeys: string[]): Promise<VLInterface>;
|
|
3
|
+
export declare function createVLBlob(sequence: number, expiration: number, validatorsPublicKeys: string[]): Promise<VLBlobInterface>;
|
|
4
|
+
export declare function getVLBlobValidatorsManifest(validatorsPublicKeys: string[]): Promise<ValidatorInterface[]>;
|