@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,85 @@
|
|
|
1
|
+
import { LedgerEntry, TrustSetFlags } from "xrpl";
|
|
2
|
+
import { FormattedBaseSpecification } from "./specification";
|
|
3
|
+
import { TxGlobalFlagsKeysInterface } from "./global";
|
|
4
|
+
export declare const TrustSetFlagsKeys: {
|
|
5
|
+
setfAuth: TrustSetFlags;
|
|
6
|
+
setNoRipple: TrustSetFlags;
|
|
7
|
+
clearNoRipple: TrustSetFlags;
|
|
8
|
+
setFreeze: TrustSetFlags;
|
|
9
|
+
clearFreeze: TrustSetFlags;
|
|
10
|
+
setDeepFreeze: TrustSetFlags;
|
|
11
|
+
clearDeepFreeze: TrustSetFlags;
|
|
12
|
+
};
|
|
13
|
+
export declare function getTrustSetFlagsKeys(nativeCurrency?: string): Record<string, number>;
|
|
14
|
+
export interface TrustSetFlagsKeysInterface extends TxGlobalFlagsKeysInterface {
|
|
15
|
+
setfAuth?: boolean;
|
|
16
|
+
setNoRipple?: boolean;
|
|
17
|
+
clearNoRipple?: boolean;
|
|
18
|
+
setFreeze?: boolean;
|
|
19
|
+
clearFreeze?: boolean;
|
|
20
|
+
setDeepFreeze?: boolean;
|
|
21
|
+
clearDeepFreeze?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const TrustlineFlagsKeys: {
|
|
24
|
+
lowReserve: LedgerEntry.RippleStateFlags;
|
|
25
|
+
highReserve: LedgerEntry.RippleStateFlags;
|
|
26
|
+
lowAuth: LedgerEntry.RippleStateFlags;
|
|
27
|
+
highAuth: LedgerEntry.RippleStateFlags;
|
|
28
|
+
lowNoRipple: LedgerEntry.RippleStateFlags;
|
|
29
|
+
highNoRipple: LedgerEntry.RippleStateFlags;
|
|
30
|
+
lowFreeze: LedgerEntry.RippleStateFlags;
|
|
31
|
+
highFreeze: LedgerEntry.RippleStateFlags;
|
|
32
|
+
ammNode: LedgerEntry.RippleStateFlags;
|
|
33
|
+
lowDeepFreeze: LedgerEntry.RippleStateFlags;
|
|
34
|
+
highDeepFreeze: LedgerEntry.RippleStateFlags;
|
|
35
|
+
};
|
|
36
|
+
export interface TrustlineFlagsKeysInterface {
|
|
37
|
+
lowReserve: boolean;
|
|
38
|
+
highReserve: boolean;
|
|
39
|
+
lowAuth: boolean;
|
|
40
|
+
highAuth: boolean;
|
|
41
|
+
lowNoRipple: boolean;
|
|
42
|
+
highNoRipple: boolean;
|
|
43
|
+
lowFreeze: boolean;
|
|
44
|
+
highFreeze: boolean;
|
|
45
|
+
ammNode: boolean;
|
|
46
|
+
lowDeepFreeze: boolean;
|
|
47
|
+
highDeepFreeze: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface Trustline {
|
|
50
|
+
account: string;
|
|
51
|
+
balance: string;
|
|
52
|
+
currency: string;
|
|
53
|
+
limit: string;
|
|
54
|
+
limit_peer: string;
|
|
55
|
+
quality_in: number;
|
|
56
|
+
quality_out: number;
|
|
57
|
+
no_ripple?: boolean;
|
|
58
|
+
no_ripple_peer?: boolean;
|
|
59
|
+
freeze?: boolean;
|
|
60
|
+
freeze_peer?: boolean;
|
|
61
|
+
authorized?: boolean;
|
|
62
|
+
peer_authorized?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export type FormattedTrustlineSpecification = {
|
|
65
|
+
currency: string;
|
|
66
|
+
counterparty: string;
|
|
67
|
+
limit: string;
|
|
68
|
+
qualityIn?: number;
|
|
69
|
+
qualityOut?: number;
|
|
70
|
+
ripplingDisabled?: boolean;
|
|
71
|
+
authorized?: boolean;
|
|
72
|
+
frozen?: boolean;
|
|
73
|
+
} & FormattedBaseSpecification;
|
|
74
|
+
export type FormattedTrustline = {
|
|
75
|
+
specification: FormattedTrustlineSpecification;
|
|
76
|
+
counterparty: {
|
|
77
|
+
limit: string;
|
|
78
|
+
ripplingDisabled?: boolean;
|
|
79
|
+
frozen?: boolean;
|
|
80
|
+
authorized?: boolean;
|
|
81
|
+
};
|
|
82
|
+
state: {
|
|
83
|
+
balance: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrustlineFlagsKeys = exports.TrustSetFlagsKeys = void 0;
|
|
4
|
+
exports.getTrustSetFlagsKeys = getTrustSetFlagsKeys;
|
|
5
|
+
const xrpl_1 = require("xrpl");
|
|
6
|
+
const { RippleStateFlags } = xrpl_1.LedgerEntry;
|
|
7
|
+
const global_1 = require("./global");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.TrustSetFlagsKeys = {
|
|
10
|
+
setfAuth: xrpl_1.TrustSetFlags.tfSetfAuth,
|
|
11
|
+
setNoRipple: xrpl_1.TrustSetFlags.tfSetNoRipple,
|
|
12
|
+
clearNoRipple: xrpl_1.TrustSetFlags.tfClearNoRipple,
|
|
13
|
+
setFreeze: xrpl_1.TrustSetFlags.tfSetFreeze,
|
|
14
|
+
clearFreeze: xrpl_1.TrustSetFlags.tfClearFreeze,
|
|
15
|
+
setDeepFreeze: xrpl_1.TrustSetFlags.tfSetDeepFreeze,
|
|
16
|
+
clearDeepFreeze: xrpl_1.TrustSetFlags.tfClearDeepFreeze,
|
|
17
|
+
};
|
|
18
|
+
const nativeCurrencyTrustSetFlags = {};
|
|
19
|
+
function getTrustSetFlagsKeys(nativeCurrency) {
|
|
20
|
+
if (!nativeCurrency) {
|
|
21
|
+
nativeCurrency = common_1.MAINNET_NATIVE_CURRENCY;
|
|
22
|
+
}
|
|
23
|
+
if (!nativeCurrencyTrustSetFlags[nativeCurrency]) {
|
|
24
|
+
nativeCurrencyTrustSetFlags[nativeCurrency] = {
|
|
25
|
+
...(0, global_1.getTxGlobalFlagsKeys)(nativeCurrency),
|
|
26
|
+
...exports.TrustSetFlagsKeys,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return nativeCurrencyTrustSetFlags[nativeCurrency];
|
|
30
|
+
}
|
|
31
|
+
exports.TrustlineFlagsKeys = {
|
|
32
|
+
lowReserve: RippleStateFlags.lsfLowReserve,
|
|
33
|
+
highReserve: RippleStateFlags.lsfHighReserve,
|
|
34
|
+
lowAuth: RippleStateFlags.lsfLowAuth,
|
|
35
|
+
highAuth: RippleStateFlags.lsfHighAuth,
|
|
36
|
+
lowNoRipple: RippleStateFlags.lsfLowNoRipple,
|
|
37
|
+
highNoRipple: RippleStateFlags.lsfHighNoRipple,
|
|
38
|
+
lowFreeze: RippleStateFlags.lsfLowFreeze,
|
|
39
|
+
highFreeze: RippleStateFlags.lsfHighFreeze,
|
|
40
|
+
ammNode: RippleStateFlags.lsfAMMNode,
|
|
41
|
+
lowDeepFreeze: RippleStateFlags.lsfLowDeepFreeze,
|
|
42
|
+
highDeepFreeze: RippleStateFlags.lsfHighDeepFreeze,
|
|
43
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { URITokenMintFlags } from "../models/transactions/URITokenMint";
|
|
2
|
+
import { FormattedBaseSpecification } from "./specification";
|
|
3
|
+
import { Amount } from "./amounts";
|
|
4
|
+
import { FormattedSourceAddress, FormattedDestinationAddress } from "./account";
|
|
5
|
+
import { TxGlobalFlagsKeysInterface } from "./global";
|
|
6
|
+
export declare const URITokenFlagsKeys: {
|
|
7
|
+
burnable: URITokenMintFlags;
|
|
8
|
+
};
|
|
9
|
+
export declare function getURITokenMintFlagsKeys(nativeCurrency?: string): Record<string, number>;
|
|
10
|
+
export interface URITokenFlagsKeysInterface extends TxGlobalFlagsKeysInterface {
|
|
11
|
+
burnable?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type FormattedURITokenBurnSpecification = {
|
|
14
|
+
uritokenID: string;
|
|
15
|
+
} & FormattedBaseSpecification;
|
|
16
|
+
export type FormattedURITokenBuySpecification = {
|
|
17
|
+
uritokenID: string;
|
|
18
|
+
amount: string;
|
|
19
|
+
} & FormattedBaseSpecification;
|
|
20
|
+
export type FormattedURITokenMintSpecification = {
|
|
21
|
+
uri?: string;
|
|
22
|
+
flags?: URITokenFlagsKeysInterface;
|
|
23
|
+
digest?: string;
|
|
24
|
+
amount: Amount;
|
|
25
|
+
source?: FormattedSourceAddress;
|
|
26
|
+
destination?: FormattedDestinationAddress;
|
|
27
|
+
} & FormattedBaseSpecification;
|
|
28
|
+
export type FormattedURITokenCancelSellOfferSpecification = {
|
|
29
|
+
uritokenID: string;
|
|
30
|
+
} & FormattedBaseSpecification;
|
|
31
|
+
export type FormattedURITokenCreateSellOfferSpecification = {
|
|
32
|
+
uritokenID: string;
|
|
33
|
+
amount: string;
|
|
34
|
+
source?: FormattedSourceAddress;
|
|
35
|
+
destination?: FormattedDestinationAddress;
|
|
36
|
+
} & FormattedBaseSpecification;
|
|
37
|
+
export type FormattedURITokenAcceptOfferSpecification = {
|
|
38
|
+
nftokenSellOffer?: string;
|
|
39
|
+
nftokenBuyOffer?: string;
|
|
40
|
+
nftokenBrokerFee?: string;
|
|
41
|
+
} & FormattedBaseSpecification;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URITokenFlagsKeys = void 0;
|
|
4
|
+
exports.getURITokenMintFlagsKeys = getURITokenMintFlagsKeys;
|
|
5
|
+
const global_1 = require("./global");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.URITokenFlagsKeys = {
|
|
8
|
+
burnable: 1,
|
|
9
|
+
};
|
|
10
|
+
const nativeCurrencyURITokenMintFlags = {};
|
|
11
|
+
function getURITokenMintFlagsKeys(nativeCurrency) {
|
|
12
|
+
if (!nativeCurrency) {
|
|
13
|
+
nativeCurrency = common_1.MAINNET_NATIVE_CURRENCY;
|
|
14
|
+
}
|
|
15
|
+
if (!nativeCurrencyURITokenMintFlags[nativeCurrency]) {
|
|
16
|
+
nativeCurrencyURITokenMintFlags[nativeCurrency] = {
|
|
17
|
+
...(0, global_1.getTxGlobalFlagsKeys)(nativeCurrency),
|
|
18
|
+
...exports.URITokenFlagsKeys,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return nativeCurrencyURITokenMintFlags[nativeCurrency];
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TransactionJSON } from "../types";
|
|
2
|
+
import { Adjustment, MaxAdjustment, MinAdjustment, FormattedMemo } from "../../types";
|
|
3
|
+
export interface Payment {
|
|
4
|
+
source: Adjustment | MaxAdjustment;
|
|
5
|
+
destination: Adjustment | MinAdjustment;
|
|
6
|
+
paths?: string;
|
|
7
|
+
networkID?: number;
|
|
8
|
+
memos?: FormattedMemo[];
|
|
9
|
+
invoiceID?: string;
|
|
10
|
+
allowPartialPayment?: boolean;
|
|
11
|
+
noDirectRipple?: boolean;
|
|
12
|
+
limitQuality?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function createPaymentTransaction(address: string, paymentArgument: Payment): TransactionJSON;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createPaymentTransaction = createPaymentTransaction;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const xrpl_1 = require("xrpl");
|
|
9
|
+
const common_1 = require("../../common");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const memos_1 = require("../../parse/ledger/memos");
|
|
12
|
+
const client_1 = require("../../client");
|
|
13
|
+
function isMaxAdjustment(source) {
|
|
14
|
+
return source.maxAmount != null;
|
|
15
|
+
}
|
|
16
|
+
function isMinAdjustment(destination) {
|
|
17
|
+
return destination.minAmount != null;
|
|
18
|
+
}
|
|
19
|
+
function isXRPToXRPPayment(payment) {
|
|
20
|
+
const { source, destination } = payment;
|
|
21
|
+
const sourceCurrency = isMaxAdjustment(source) ? source.maxAmount.currency : source.amount.currency;
|
|
22
|
+
const destinationCurrency = isMinAdjustment(destination)
|
|
23
|
+
? destination.minAmount.currency
|
|
24
|
+
: destination.amount.currency;
|
|
25
|
+
return ((sourceCurrency === (0, client_1.getNativeCurrency)() || sourceCurrency === "drops") &&
|
|
26
|
+
(destinationCurrency === (0, client_1.getNativeCurrency)() || destinationCurrency === "drops"));
|
|
27
|
+
}
|
|
28
|
+
function isIOUWithoutCounterparty(amount) {
|
|
29
|
+
if (typeof amount === "object") {
|
|
30
|
+
if ("currency" in amount && amount.currency !== (0, client_1.getNativeCurrency)() && amount.currency !== "drops") {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if ("mpt_issuance_id" in amount && amount.mpt_issuance_id) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (amount.issuer == null &&
|
|
37
|
+
amount.counterparty == null) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function applyAnyCounterpartyEncoding(payment) {
|
|
44
|
+
[payment.source, payment.destination].forEach((adjustment) => {
|
|
45
|
+
["amount", "minAmount", "maxAmount"].forEach((key) => {
|
|
46
|
+
if (isIOUWithoutCounterparty(adjustment[key])) {
|
|
47
|
+
adjustment[key].issuer = adjustment.address;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function createMaximalAmount(amount) {
|
|
53
|
+
const maxXRPValue = "100000000000";
|
|
54
|
+
const maxIOUValue = "999999999999999900000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
|
55
|
+
let maxValue;
|
|
56
|
+
if (amount.currency === (0, client_1.getNativeCurrency)()) {
|
|
57
|
+
maxValue = maxXRPValue;
|
|
58
|
+
}
|
|
59
|
+
else if (amount.currency === "drops") {
|
|
60
|
+
maxValue = (0, common_1.xrpToDrops)(maxXRPValue);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
maxValue = maxIOUValue;
|
|
64
|
+
}
|
|
65
|
+
return Object.assign({}, amount, { value: maxValue });
|
|
66
|
+
}
|
|
67
|
+
function validateAndNormalizeAddress(address, expectedTag) {
|
|
68
|
+
const classicAddress = (0, utils_1.getClassicAccountAndTag)(address, expectedTag);
|
|
69
|
+
classicAddress.tag = classicAddress.tag === false ? undefined : classicAddress.tag;
|
|
70
|
+
return classicAddress;
|
|
71
|
+
}
|
|
72
|
+
function createPaymentTransaction(address, paymentArgument) {
|
|
73
|
+
const payment = lodash_1.default.cloneDeep(paymentArgument);
|
|
74
|
+
applyAnyCounterpartyEncoding(payment);
|
|
75
|
+
const sourceAddressAndTag = validateAndNormalizeAddress(payment.source.address, payment.source.tag);
|
|
76
|
+
const addressToVerifyAgainst = validateAndNormalizeAddress(address, undefined);
|
|
77
|
+
if (addressToVerifyAgainst.classicAccount !== sourceAddressAndTag.classicAccount) {
|
|
78
|
+
throw new Error("address must match payment.source.address");
|
|
79
|
+
}
|
|
80
|
+
if (addressToVerifyAgainst.tag != null &&
|
|
81
|
+
sourceAddressAndTag.tag != null &&
|
|
82
|
+
addressToVerifyAgainst.tag !== sourceAddressAndTag.tag) {
|
|
83
|
+
throw new Error("address includes a tag that does not match payment.source.tag");
|
|
84
|
+
}
|
|
85
|
+
const destinationAddressAndTag = validateAndNormalizeAddress(payment.destination.address, payment.destination.tag);
|
|
86
|
+
if ((isMaxAdjustment(payment.source) && isMinAdjustment(payment.destination)) ||
|
|
87
|
+
(!isMaxAdjustment(payment.source) && !isMinAdjustment(payment.destination))) {
|
|
88
|
+
throw new Error("payment must specify either (source.maxAmount " +
|
|
89
|
+
"and destination.amount) or (source.amount and destination.minAmount)");
|
|
90
|
+
}
|
|
91
|
+
const destinationAmount = isMinAdjustment(payment.destination)
|
|
92
|
+
? payment.destination.minAmount
|
|
93
|
+
: payment.destination.amount;
|
|
94
|
+
const sourceAmount = isMaxAdjustment(payment.source) ? payment.source.maxAmount : payment.source.amount;
|
|
95
|
+
const amount = isMinAdjustment(payment.destination) && !isXRPToXRPPayment(payment)
|
|
96
|
+
? createMaximalAmount(destinationAmount)
|
|
97
|
+
: destinationAmount;
|
|
98
|
+
const txJSON = {
|
|
99
|
+
TransactionType: "Payment",
|
|
100
|
+
Account: sourceAddressAndTag.classicAccount,
|
|
101
|
+
Destination: destinationAddressAndTag.classicAccount,
|
|
102
|
+
Amount: (0, utils_1.toRippledAmount)(amount),
|
|
103
|
+
Flags: 0,
|
|
104
|
+
};
|
|
105
|
+
if (payment.invoiceID != null) {
|
|
106
|
+
txJSON.InvoiceID = payment.invoiceID;
|
|
107
|
+
}
|
|
108
|
+
if (sourceAddressAndTag.tag != null) {
|
|
109
|
+
txJSON.SourceTag = sourceAddressAndTag.tag;
|
|
110
|
+
}
|
|
111
|
+
if (destinationAddressAndTag.tag != null) {
|
|
112
|
+
txJSON.DestinationTag = destinationAddressAndTag.tag;
|
|
113
|
+
}
|
|
114
|
+
if (payment.networkID != null) {
|
|
115
|
+
txJSON.NetworkID = payment.networkID;
|
|
116
|
+
}
|
|
117
|
+
if (payment.memos != null) {
|
|
118
|
+
txJSON.Memos = payment.memos.map(memos_1.formattedMemoToMemo);
|
|
119
|
+
}
|
|
120
|
+
if (payment.noDirectRipple === true) {
|
|
121
|
+
txJSON.Flags |= xrpl_1.PaymentFlags.tfNoRippleDirect;
|
|
122
|
+
}
|
|
123
|
+
if (payment.limitQuality === true) {
|
|
124
|
+
txJSON.Flags |= xrpl_1.PaymentFlags.tfLimitQuality;
|
|
125
|
+
}
|
|
126
|
+
if (!isXRPToXRPPayment(payment)) {
|
|
127
|
+
if (payment.allowPartialPayment || isMinAdjustment(payment.destination)) {
|
|
128
|
+
txJSON.Flags |= xrpl_1.PaymentFlags.tfPartialPayment;
|
|
129
|
+
}
|
|
130
|
+
txJSON.SendMax = (0, utils_1.toRippledAmount)(sourceAmount);
|
|
131
|
+
if (isMinAdjustment(payment.destination)) {
|
|
132
|
+
txJSON.DeliverMin = (0, utils_1.toRippledAmount)(destinationAmount);
|
|
133
|
+
}
|
|
134
|
+
if (payment.paths != null) {
|
|
135
|
+
txJSON.Paths = JSON.parse(payment.paths);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else if (payment.allowPartialPayment === true) {
|
|
139
|
+
throw new Error("XRP to XRP payments cannot be partial payments");
|
|
140
|
+
}
|
|
141
|
+
return txJSON;
|
|
142
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Amount, FormattedIssuedCurrencyAmount } from "../types";
|
|
2
|
+
export declare function toRippledAmount(amount: Amount | FormattedIssuedCurrencyAmount): Amount | undefined;
|
|
3
|
+
export interface ClassicAccountAndTag {
|
|
4
|
+
classicAccount: string;
|
|
5
|
+
tag: number | false | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function getClassicAccountAndTag(Account: string, expectedTag?: number): ClassicAccountAndTag;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRippledAmount = toRippledAmount;
|
|
4
|
+
exports.getClassicAccountAndTag = getClassicAccountAndTag;
|
|
5
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
function toRippledAmount(amount) {
|
|
9
|
+
if (typeof amount === "string")
|
|
10
|
+
return amount;
|
|
11
|
+
if ("currency" in amount) {
|
|
12
|
+
if (amount.currency === (0, client_1.getNativeCurrency)()) {
|
|
13
|
+
return (0, common_1.xrpToDrops)(amount.value);
|
|
14
|
+
}
|
|
15
|
+
else if (amount.currency === "drops") {
|
|
16
|
+
return amount.value;
|
|
17
|
+
}
|
|
18
|
+
const issuer = amount.counterparty || amount.issuer;
|
|
19
|
+
return {
|
|
20
|
+
currency: amount.currency,
|
|
21
|
+
issuer,
|
|
22
|
+
value: amount.value,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if ("mpt_issuance_id" in amount) {
|
|
26
|
+
return {
|
|
27
|
+
value: amount.value,
|
|
28
|
+
mpt_issuance_id: amount.mpt_issuance_id,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getClassicAccountAndTag(Account, expectedTag) {
|
|
33
|
+
if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
|
|
34
|
+
const classic = (0, ripple_address_codec_1.xAddressToClassicAddress)(Account);
|
|
35
|
+
if (expectedTag != null && classic.tag !== expectedTag) {
|
|
36
|
+
throw new Error("address includes a tag that does not match the tag specified in the transaction");
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
classicAccount: classic.classicAddress,
|
|
40
|
+
tag: classic.tag,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return {
|
|
45
|
+
classicAccount: Account,
|
|
46
|
+
tag: expectedTag,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function classicAddressFromValidatorPK(pk: string | Buffer): string | null;
|
|
2
|
+
export interface GenerateSecretsInterface {
|
|
3
|
+
key_type: string;
|
|
4
|
+
secret_key: string;
|
|
5
|
+
public_key: string;
|
|
6
|
+
PublicKey: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateSecrets(): GenerateSecretsInterface;
|
|
9
|
+
export declare function sign(message: Buffer | string, secret: string): string;
|
|
10
|
+
export declare function verify(message: Buffer | string, signature: string, publicKey: string): boolean;
|
|
11
|
+
export declare function verify2(message: Buffer, signature: string, publicKey: string): boolean;
|
|
@@ -0,0 +1,130 @@
|
|
|
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.classicAddressFromValidatorPK = classicAddressFromValidatorPK;
|
|
37
|
+
exports.generateSecrets = generateSecrets;
|
|
38
|
+
exports.sign = sign;
|
|
39
|
+
exports.verify = verify;
|
|
40
|
+
exports.verify2 = verify2;
|
|
41
|
+
const assert = __importStar(require("assert"));
|
|
42
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
43
|
+
const Crypto = __importStar(require("crypto"));
|
|
44
|
+
const rippleKeypairs = __importStar(require("ripple-keypairs"));
|
|
45
|
+
const utils_1 = require("./parse/utils");
|
|
46
|
+
const secp256k1 = __importStar(require("@noble/secp256k1"));
|
|
47
|
+
const ed25519 = __importStar(require("@noble/ed25519"));
|
|
48
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
49
|
+
ed25519.hashes.sha512 = sha2_js_1.sha512;
|
|
50
|
+
const DER_PRIVATE_KEY_PREFIX = Buffer.from("302E020100300506032B657004220420", "hex");
|
|
51
|
+
const DER_PUBLIC_KEY_PREFIX = Buffer.from("302A300506032B6570032100", "hex");
|
|
52
|
+
const VALIDATOR_HEX_PREFIX_ED25519 = "ED";
|
|
53
|
+
const VALIDATOR_NODE_PUBLIC_KEY_PREFIX = "n";
|
|
54
|
+
function classicAddressFromValidatorPK(pk) {
|
|
55
|
+
let pubkey = pk;
|
|
56
|
+
if (typeof pk === "string") {
|
|
57
|
+
pubkey = Buffer.from((0, ripple_address_codec_1.decodeNodePublic)(pk).buffer);
|
|
58
|
+
}
|
|
59
|
+
assert.ok(pubkey.length === 33);
|
|
60
|
+
assert.ok(Crypto.getHashes().includes("sha256"));
|
|
61
|
+
assert.ok(Crypto.getHashes().includes("ripemd160"));
|
|
62
|
+
const pubkeyInnerHash = Crypto.createHash("sha256").update(pubkey);
|
|
63
|
+
const pubkeyOuterHash = Crypto.createHash("ripemd160");
|
|
64
|
+
pubkeyOuterHash.update(pubkeyInnerHash.digest());
|
|
65
|
+
const accountID = pubkeyOuterHash.digest();
|
|
66
|
+
return (0, ripple_address_codec_1.encodeAccountID)(accountID);
|
|
67
|
+
}
|
|
68
|
+
function generateSecrets() {
|
|
69
|
+
const keypair = Crypto.generateKeyPairSync("ed25519", {
|
|
70
|
+
privateKeyEncoding: { format: "der", type: "pkcs8" },
|
|
71
|
+
publicKeyEncoding: { format: "der", type: "spki" },
|
|
72
|
+
});
|
|
73
|
+
const { privateKey, publicKey } = keypair;
|
|
74
|
+
const PublicKey = VALIDATOR_HEX_PREFIX_ED25519 +
|
|
75
|
+
publicKey.slice(DER_PUBLIC_KEY_PREFIX.length, publicKey.length).toString("hex").toUpperCase();
|
|
76
|
+
const secretKey = ripple_address_codec_1.codec.encode(privateKey.slice(DER_PRIVATE_KEY_PREFIX.length, privateKey.length), {
|
|
77
|
+
versions: [0x20],
|
|
78
|
+
expectedLength: 32,
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
key_type: "ed25519",
|
|
82
|
+
secret_key: secretKey,
|
|
83
|
+
public_key: (0, ripple_address_codec_1.encodeNodePublic)(Buffer.from(PublicKey, "hex")),
|
|
84
|
+
PublicKey,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function sign(message, secret) {
|
|
88
|
+
if (typeof message === "string") {
|
|
89
|
+
message = Buffer.from(message, "utf8");
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const decoded = ripple_address_codec_1.codec.decode(secret, { versions: [0x20] });
|
|
93
|
+
secret = VALIDATOR_HEX_PREFIX_ED25519 + (0, utils_1.bytesToHex)(decoded.bytes.buffer);
|
|
94
|
+
}
|
|
95
|
+
catch (_err) {
|
|
96
|
+
}
|
|
97
|
+
return rippleKeypairs.sign(message.toString("hex"), secret).toUpperCase();
|
|
98
|
+
}
|
|
99
|
+
function verify(message, signature, publicKey) {
|
|
100
|
+
if (typeof message === "string") {
|
|
101
|
+
message = Buffer.from(message, "utf8");
|
|
102
|
+
}
|
|
103
|
+
if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
|
|
104
|
+
const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
|
|
105
|
+
publicKey = (0, utils_1.bytesToHex)(publicKeyBuffer.buffer);
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
return rippleKeypairs.verify(message.toString("hex"), signature, publicKey);
|
|
109
|
+
}
|
|
110
|
+
catch (_err) {
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
function verify2(message, signature, publicKey) {
|
|
115
|
+
if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
|
|
116
|
+
const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
|
|
117
|
+
publicKey = (0, utils_1.bytesToHex)(publicKeyBuffer.buffer);
|
|
118
|
+
}
|
|
119
|
+
if (publicKey.slice(0, 2) === VALIDATOR_HEX_PREFIX_ED25519) {
|
|
120
|
+
const publicKeyBytes = Buffer.from(publicKey.slice(2), "hex");
|
|
121
|
+
const signatureBytes = Buffer.from(signature, "hex");
|
|
122
|
+
return ed25519.verify(signatureBytes, message, publicKeyBytes);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const computedHash = Crypto.createHash("sha512").update(message).digest().slice(0, 32);
|
|
126
|
+
const publicKeyBytes = Buffer.from(publicKey, "hex");
|
|
127
|
+
const signatureBytes = Buffer.from(signature, "hex");
|
|
128
|
+
return secp256k1.verify(signatureBytes, computedHash, publicKeyBytes);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Wallet, Transaction, ECDSA } from "xrpl";
|
|
2
|
+
import { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS } from "ripple-binary-codec";
|
|
3
|
+
interface GenerateAddressInterface {
|
|
4
|
+
publicKey: string;
|
|
5
|
+
privateKey: string;
|
|
6
|
+
address: string;
|
|
7
|
+
seed: string;
|
|
8
|
+
}
|
|
9
|
+
export interface VerifySignatureInterface {
|
|
10
|
+
signedBy?: string;
|
|
11
|
+
signatureValid?: boolean;
|
|
12
|
+
signatureMultiSign?: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function isValidSecret(secret: string): boolean;
|
|
16
|
+
export interface WalletFromSeedInterface {
|
|
17
|
+
masterAddress?: string;
|
|
18
|
+
algorithm?: ECDSA;
|
|
19
|
+
seedAddress?: string;
|
|
20
|
+
ignoreSeedPayload?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function walletFromSeed(seed: string, options?: WalletFromSeedInterface): Wallet;
|
|
23
|
+
export declare function generateAddress(): GenerateAddressInterface;
|
|
24
|
+
export declare function isValidClassicAddress(address: string): boolean;
|
|
25
|
+
export declare function checksumClassicAddress(buffer: Buffer): Buffer;
|
|
26
|
+
export declare function signTransaction(wallet: Wallet, transaction: Transaction, multisign?: boolean | string, definitions?: XrplDefinitionsBase, validateTx?: boolean): {
|
|
27
|
+
tx_blob: string;
|
|
28
|
+
hash: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function verifyTransaction(signedTransaction: Transaction | string, definitions?: XrplDefinitionsBase): boolean;
|
|
31
|
+
export declare function verifySignature(signedTransaction: Transaction | string, explicitMultiSigner?: string | null, definitions?: XrplDefinitionsBase): VerifySignatureInterface;
|
|
32
|
+
declare function hashSignedTx(tx: Transaction | string, definitions?: XrplDefinitionsBase, validateTx?: boolean): string;
|
|
33
|
+
declare function getXahauDefinitions(): XrplDefinitionsBase | undefined;
|
|
34
|
+
export { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS, hashSignedTx, getXahauDefinitions };
|