@bithomp/xrpl-api 3.7.30 → 3.7.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/connection.js +5 -3
- package/lib/parse/outcome/orderbook_changes.js +5 -4
- package/lib/parse/specification/offer-create.js +1 -0
- package/lib/src/base58.d.ts +2 -0
- package/lib/src/base58.js +32 -0
- package/lib/src/client.d.ts +25 -0
- package/lib/src/client.js +192 -0
- package/lib/src/common/errors/index.d.ts +3 -0
- package/lib/src/common/errors/index.js +7 -0
- package/lib/src/common/errors/validation_error.d.ts +4 -0
- package/lib/src/common/errors/validation_error.js +7 -0
- package/lib/src/common/errors/xrpl_api_error.d.ts +9 -0
- package/lib/src/common/errors/xrpl_api_error.js +28 -0
- package/lib/src/common/index.d.ts +9 -0
- package/lib/src/common/index.js +57 -0
- package/lib/src/common/sha512Half.d.ts +2 -0
- package/lib/src/common/sha512Half.js +12 -0
- package/lib/src/common/utils.d.ts +14 -0
- package/lib/src/common/utils.js +147 -0
- package/lib/src/connection.d.ts +76 -0
- package/lib/src/connection.js +653 -0
- package/lib/src/faucet.d.ts +58 -0
- package/lib/src/faucet.js +129 -0
- package/lib/src/index.d.ts +9 -0
- package/lib/src/index.js +45 -0
- package/lib/src/ledger/account_info.d.ts +16 -0
- package/lib/src/ledger/account_info.js +112 -0
- package/lib/src/ledger/account_lines.d.ts +11 -0
- package/lib/src/ledger/account_lines.js +90 -0
- package/lib/src/ledger/account_namespace.d.ts +7 -0
- package/lib/src/ledger/account_namespace.js +72 -0
- package/lib/src/ledger/account_nfts.d.ts +21 -0
- package/lib/src/ledger/account_nfts.js +199 -0
- package/lib/src/ledger/account_objects.d.ts +44 -0
- package/lib/src/ledger/account_objects.js +222 -0
- package/lib/src/ledger/account_offers.d.ts +13 -0
- package/lib/src/ledger/account_offers.js +142 -0
- package/lib/src/ledger/account_tx.d.ts +37 -0
- package/lib/src/ledger/account_tx.js +376 -0
- package/lib/src/ledger/amm_info.d.ts +13 -0
- package/lib/src/ledger/amm_info.js +114 -0
- package/lib/src/ledger/book_offers.d.ts +15 -0
- package/lib/src/ledger/book_offers.js +102 -0
- package/lib/src/ledger/currency.d.ts +28 -0
- package/lib/src/ledger/currency.js +250 -0
- package/lib/src/ledger/fee.d.ts +13 -0
- package/lib/src/ledger/fee.js +99 -0
- package/lib/src/ledger/gateway_balances.d.ts +16 -0
- package/lib/src/ledger/gateway_balances.js +119 -0
- package/lib/src/ledger/index.d.ts +21 -0
- package/lib/src/ledger/index.js +37 -0
- package/lib/src/ledger/ledger.d.ts +16 -0
- package/lib/src/ledger/ledger.js +99 -0
- package/lib/src/ledger/ledger_entry.d.ts +16 -0
- package/lib/src/ledger/ledger_entry.js +118 -0
- package/lib/src/ledger/manifest.d.ts +8 -0
- package/lib/src/ledger/manifest.js +67 -0
- package/lib/src/ledger/nft_info.d.ts +4 -0
- package/lib/src/ledger/nft_info.js +67 -0
- package/lib/src/ledger/server_definitions.d.ts +7 -0
- package/lib/src/ledger/server_definitions.js +65 -0
- package/lib/src/ledger/server_info.d.ts +8 -0
- package/lib/src/ledger/server_info.js +65 -0
- package/lib/src/ledger/transaction.d.ts +47 -0
- package/lib/src/ledger/transaction.js +440 -0
- package/lib/src/ledger/vl-v2.d.ts +3 -0
- package/lib/src/ledger/vl-v2.js +124 -0
- package/lib/src/ledger/vl.d.ts +4 -0
- package/lib/src/ledger/vl.js +131 -0
- package/lib/src/models/account_info.d.ts +184 -0
- package/lib/src/models/account_info.js +139 -0
- package/lib/src/models/account_lines.d.ts +26 -0
- package/lib/src/models/account_lines.js +2 -0
- package/lib/src/models/account_namespace.d.ts +16 -0
- package/lib/src/models/account_namespace.js +2 -0
- package/lib/src/models/account_nfts.d.ts +20 -0
- package/lib/src/models/account_nfts.js +92 -0
- package/lib/src/models/account_object.d.ts +61 -0
- package/lib/src/models/account_object.js +125 -0
- package/lib/src/models/account_offers.d.ts +9 -0
- package/lib/src/models/account_offers.js +2 -0
- package/lib/src/models/account_uritokens.d.ts +11 -0
- package/lib/src/models/account_uritokens.js +2 -0
- package/lib/src/models/amm_info.d.ts +1 -0
- package/lib/src/models/amm_info.js +4 -0
- package/lib/src/models/base_model.d.ts +15 -0
- package/lib/src/models/base_model.js +2 -0
- package/lib/src/models/book_offers.d.ts +9 -0
- package/lib/src/models/book_offers.js +40 -0
- package/lib/src/models/gateway_balances.d.ts +19 -0
- package/lib/src/models/gateway_balances.js +2 -0
- package/lib/src/models/index.d.ts +38 -0
- package/lib/src/models/index.js +82 -0
- package/lib/src/models/ledger.d.ts +7 -0
- package/lib/src/models/ledger.js +20 -0
- package/lib/src/models/manifest.d.ts +25 -0
- package/lib/src/models/manifest.js +199 -0
- package/lib/src/models/mptoken.d.ts +7 -0
- package/lib/src/models/mptoken.js +59 -0
- package/lib/src/models/path_find.d.ts +11 -0
- package/lib/src/models/path_find.js +2 -0
- package/lib/src/models/server_definitions.d.ts +33 -0
- package/lib/src/models/server_definitions.js +2 -0
- package/lib/src/models/transaction.d.ts +52 -0
- package/lib/src/models/transaction.js +141 -0
- package/lib/src/models/transactions/CronSet.d.ts +3 -0
- package/lib/src/models/transactions/CronSet.js +2 -0
- package/lib/src/models/transactions/SetRemarks.d.ts +3 -0
- package/lib/src/models/transactions/SetRemarks.js +2 -0
- package/lib/src/models/transactions/URITokenMint.d.ts +3 -0
- package/lib/src/models/transactions/URITokenMint.js +2 -0
- package/lib/src/models/vl.d.ts +82 -0
- package/lib/src/models/vl.js +498 -0
- package/lib/src/parse/index.d.ts +6 -0
- package/lib/src/parse/index.js +46 -0
- package/lib/src/parse/ledger/account-fields.d.ts +5 -0
- package/lib/src/parse/ledger/account-fields.js +43 -0
- package/lib/src/parse/ledger/account-info.d.ts +3 -0
- package/lib/src/parse/ledger/account-info.js +15 -0
- package/lib/src/parse/ledger/account-order.d.ts +18 -0
- package/lib/src/parse/ledger/account-order.js +48 -0
- package/lib/src/parse/ledger/account-settings-flags.d.ts +2 -0
- package/lib/src/parse/ledger/account-settings-flags.js +77 -0
- package/lib/src/parse/ledger/account.d.ts +1 -0
- package/lib/src/parse/ledger/account.js +7 -0
- package/lib/src/parse/ledger/amount.d.ts +3 -0
- package/lib/src/parse/ledger/amount.js +25 -0
- package/lib/src/parse/ledger/asset.d.ts +3 -0
- package/lib/src/parse/ledger/asset.js +19 -0
- package/lib/src/parse/ledger/auth-accounts.d.ts +3 -0
- package/lib/src/parse/ledger/auth-accounts.js +18 -0
- package/lib/src/parse/ledger/credential-flags.d.ts +5 -0
- package/lib/src/parse/ledger/credential-flags.js +8 -0
- package/lib/src/parse/ledger/credential.d.ts +3 -0
- package/lib/src/parse/ledger/credential.js +13 -0
- package/lib/src/parse/ledger/currency-amount.d.ts +3 -0
- package/lib/src/parse/ledger/currency-amount.js +13 -0
- package/lib/src/parse/ledger/delegate.d.ts +2 -0
- package/lib/src/parse/ledger/delegate.js +11 -0
- package/lib/src/parse/ledger/destination.d.ts +2 -0
- package/lib/src/parse/ledger/destination.js +12 -0
- package/lib/src/parse/ledger/emit_details.d.ts +2 -0
- package/lib/src/parse/ledger/emit_details.js +14 -0
- package/lib/src/parse/ledger/flags.d.ts +4 -0
- package/lib/src/parse/ledger/flags.js +17 -0
- package/lib/src/parse/ledger/gateway-balances.d.ts +3 -0
- package/lib/src/parse/ledger/gateway-balances.js +31 -0
- package/lib/src/parse/ledger/genesis-mints.d.ts +2 -0
- package/lib/src/parse/ledger/genesis-mints.js +17 -0
- package/lib/src/parse/ledger/import.d.ts +2 -0
- package/lib/src/parse/ledger/import.js +40 -0
- package/lib/src/parse/ledger/index.d.ts +6 -0
- package/lib/src/parse/ledger/index.js +29 -0
- package/lib/src/parse/ledger/ledger.d.ts +2 -0
- package/lib/src/parse/ledger/ledger.js +98 -0
- package/lib/src/parse/ledger/memos.d.ts +4 -0
- package/lib/src/parse/ledger/memos.js +27 -0
- package/lib/src/parse/ledger/mptoken-flags.d.ts +6 -0
- package/lib/src/parse/ledger/mptoken-flags.js +8 -0
- package/lib/src/parse/ledger/mptoken-issuance-flags.d.ts +6 -0
- package/lib/src/parse/ledger/mptoken-issuance-flags.js +8 -0
- package/lib/src/parse/ledger/nftoken-flags.d.ts +5 -0
- package/lib/src/parse/ledger/nftoken-flags.js +8 -0
- package/lib/src/parse/ledger/nftoken-offer-flags.d.ts +5 -0
- package/lib/src/parse/ledger/nftoken-offer-flags.js +8 -0
- package/lib/src/parse/ledger/offer-flags.d.ts +5 -0
- package/lib/src/parse/ledger/offer-flags.js +8 -0
- package/lib/src/parse/ledger/orderbook-order.d.ts +21 -0
- package/lib/src/parse/ledger/orderbook-order.js +42 -0
- package/lib/src/parse/ledger/permissions.d.ts +2 -0
- package/lib/src/parse/ledger/permissions.js +9 -0
- package/lib/src/parse/ledger/regular-key.d.ts +2 -0
- package/lib/src/parse/ledger/regular-key.js +14 -0
- package/lib/src/parse/ledger/remark-flags.d.ts +5 -0
- package/lib/src/parse/ledger/remark-flags.js +8 -0
- package/lib/src/parse/ledger/remarks.d.ts +3 -0
- package/lib/src/parse/ledger/remarks.js +37 -0
- package/lib/src/parse/ledger/signers.d.ts +2 -0
- package/lib/src/parse/ledger/signers.js +12 -0
- package/lib/src/parse/ledger/source.d.ts +3 -0
- package/lib/src/parse/ledger/source.js +28 -0
- package/lib/src/parse/ledger/trustline-flags.d.ts +5 -0
- package/lib/src/parse/ledger/trustline-flags.js +8 -0
- package/lib/src/parse/ledger/tx-account-set-flags.d.ts +4 -0
- package/lib/src/parse/ledger/tx-account-set-flags.js +36 -0
- package/lib/src/parse/ledger/tx-amm-clawback-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-clawback-flags.js +8 -0
- package/lib/src/parse/ledger/tx-amm-deposit-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-deposit-flags.js +8 -0
- package/lib/src/parse/ledger/tx-amm-withdraw-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-amm-withdraw-flags.js +8 -0
- package/lib/src/parse/ledger/tx-batch-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-batch-flags.js +8 -0
- package/lib/src/parse/ledger/tx-cron-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-cron-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-global-flags.d.ts +5 -0
- package/lib/src/parse/ledger/tx-global-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-authorize-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-authorize-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-mptoken-issuance-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-nftoken-mint-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-nftoken-mint-flags.js +8 -0
- package/lib/src/parse/ledger/tx-nftoken-offer-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-nftoken-offer-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-offer-create-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-offer-create-flags.js +8 -0
- package/lib/src/parse/ledger/tx-payment-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-payment-flags.js +8 -0
- package/lib/src/parse/ledger/tx-trust-set-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-trust-set-flags.js +8 -0
- package/lib/src/parse/ledger/tx-uritoken-mint-flags.d.ts +6 -0
- package/lib/src/parse/ledger/tx-uritoken-mint-flags.js +8 -0
- package/lib/src/parse/ledger/uritoken-flags.d.ts +5 -0
- package/lib/src/parse/ledger/uritoken-flags.js +8 -0
- package/lib/src/parse/mptoken_normalize.d.ts +5 -0
- package/lib/src/parse/mptoken_normalize.js +215 -0
- package/lib/src/parse/outcome/account_setting_changes.d.ts +4 -0
- package/lib/src/parse/outcome/account_setting_changes.js +67 -0
- package/lib/src/parse/outcome/affected_objects.d.ts +7 -0
- package/lib/src/parse/outcome/affected_objects.js +147 -0
- package/lib/src/parse/outcome/amendment_changes.d.ts +8 -0
- package/lib/src/parse/outcome/amendment_changes.js +84 -0
- package/lib/src/parse/outcome/amm_changes.d.ts +52 -0
- package/lib/src/parse/outcome/amm_changes.js +214 -0
- package/lib/src/parse/outcome/balance_changes.d.ts +24 -0
- package/lib/src/parse/outcome/balance_changes.js +337 -0
- package/lib/src/parse/outcome/channel_changes.d.ts +20 -0
- package/lib/src/parse/outcome/channel_changes.js +70 -0
- package/lib/src/parse/outcome/check_changes.d.ts +17 -0
- package/lib/src/parse/outcome/check_changes.js +63 -0
- package/lib/src/parse/outcome/credential_changes.d.ts +16 -0
- package/lib/src/parse/outcome/credential_changes.js +59 -0
- package/lib/src/parse/outcome/cron_changes.d.ts +13 -0
- package/lib/src/parse/outcome/cron_changes.js +72 -0
- package/lib/src/parse/outcome/delegate_changes.d.ts +12 -0
- package/lib/src/parse/outcome/delegate_changes.js +59 -0
- package/lib/src/parse/outcome/delivered_amount.d.ts +4 -0
- package/lib/src/parse/outcome/delivered_amount.js +63 -0
- package/lib/src/parse/outcome/did_changes.d.ts +14 -0
- package/lib/src/parse/outcome/did_changes.js +50 -0
- package/lib/src/parse/outcome/emitted_txns.d.ts +9 -0
- package/lib/src/parse/outcome/emitted_txns.js +57 -0
- package/lib/src/parse/outcome/escrow_changes.d.ts +16 -0
- package/lib/src/parse/outcome/escrow_changes.js +75 -0
- package/lib/src/parse/outcome/hooks_executions.d.ts +13 -0
- package/lib/src/parse/outcome/hooks_executions.js +42 -0
- package/lib/src/parse/outcome/index.d.ts +26 -0
- package/lib/src/parse/outcome/index.js +55 -0
- package/lib/src/parse/outcome/locked_balance_changes.d.ts +20 -0
- package/lib/src/parse/outcome/locked_balance_changes.js +117 -0
- package/lib/src/parse/outcome/mptoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/mptoken_changes.js +113 -0
- package/lib/src/parse/outcome/mptoken_issuance_changes.d.ts +1 -0
- package/lib/src/parse/outcome/mptoken_issuance_changes.js +119 -0
- package/lib/src/parse/outcome/nftoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/nftoken_changes.js +234 -0
- package/lib/src/parse/outcome/nftoken_offer_changes.d.ts +2 -0
- package/lib/src/parse/outcome/nftoken_offer_changes.js +106 -0
- package/lib/src/parse/outcome/oracle_changes.d.ts +29 -0
- package/lib/src/parse/outcome/oracle_changes.js +150 -0
- package/lib/src/parse/outcome/orderbook_changes.d.ts +21 -0
- package/lib/src/parse/outcome/orderbook_changes.js +108 -0
- package/lib/src/parse/outcome/orderbook_quality.d.ts +2 -0
- package/lib/src/parse/outcome/orderbook_quality.js +49 -0
- package/lib/src/parse/outcome/remarks_changes.d.ts +14 -0
- package/lib/src/parse/outcome/remarks_changes.js +68 -0
- package/lib/src/parse/outcome/unl_report_changes.d.ts +13 -0
- package/lib/src/parse/outcome/unl_report_changes.js +48 -0
- package/lib/src/parse/outcome/uritoken_changes.d.ts +1 -0
- package/lib/src/parse/outcome/uritoken_changes.js +83 -0
- package/lib/src/parse/outcome/uritoken_sell_offer_changes.d.ts +1 -0
- package/lib/src/parse/outcome/uritoken_sell_offer_changes.js +105 -0
- package/lib/src/parse/outcome.d.ts +4 -0
- package/lib/src/parse/outcome.js +264 -0
- package/lib/src/parse/specification/account-delete.d.ts +4 -0
- package/lib/src/parse/specification/account-delete.js +59 -0
- package/lib/src/parse/specification/amendment.d.ts +3 -0
- package/lib/src/parse/specification/amendment.js +50 -0
- package/lib/src/parse/specification/amm-bid.d.ts +4 -0
- package/lib/src/parse/specification/amm-bid.js +66 -0
- package/lib/src/parse/specification/amm-clawback.d.ts +4 -0
- package/lib/src/parse/specification/amm-clawback.js +65 -0
- package/lib/src/parse/specification/amm-create.d.ts +4 -0
- package/lib/src/parse/specification/amm-create.js +62 -0
- package/lib/src/parse/specification/amm-delete.d.ts +4 -0
- package/lib/src/parse/specification/amm-delete.js +61 -0
- package/lib/src/parse/specification/amm-deposit.d.ts +4 -0
- package/lib/src/parse/specification/amm-deposit.js +66 -0
- package/lib/src/parse/specification/amm-vote.d.ts +4 -0
- package/lib/src/parse/specification/amm-vote.js +62 -0
- package/lib/src/parse/specification/amm-withdraw.d.ts +4 -0
- package/lib/src/parse/specification/amm-withdraw.js +66 -0
- package/lib/src/parse/specification/batch.d.ts +4 -0
- package/lib/src/parse/specification/batch.js +83 -0
- package/lib/src/parse/specification/check-cancel.d.ts +4 -0
- package/lib/src/parse/specification/check-cancel.js +58 -0
- package/lib/src/parse/specification/check-cash.d.ts +4 -0
- package/lib/src/parse/specification/check-cash.js +64 -0
- package/lib/src/parse/specification/check-create.d.ts +4 -0
- package/lib/src/parse/specification/check-create.js +67 -0
- package/lib/src/parse/specification/clawback.d.ts +4 -0
- package/lib/src/parse/specification/clawback.js +62 -0
- package/lib/src/parse/specification/credential-accept.d.ts +4 -0
- package/lib/src/parse/specification/credential-accept.js +56 -0
- package/lib/src/parse/specification/credential-create.d.ts +4 -0
- package/lib/src/parse/specification/credential-create.js +58 -0
- package/lib/src/parse/specification/credential-delete.d.ts +4 -0
- package/lib/src/parse/specification/credential-delete.js +57 -0
- package/lib/src/parse/specification/cron-set.d.ts +3 -0
- package/lib/src/parse/specification/cron-set.js +62 -0
- package/lib/src/parse/specification/cron.d.ts +3 -0
- package/lib/src/parse/specification/cron.js +47 -0
- package/lib/src/parse/specification/delegate-set.d.ts +4 -0
- package/lib/src/parse/specification/delegate-set.js +60 -0
- package/lib/src/parse/specification/deposit-preauth.d.ts +4 -0
- package/lib/src/parse/specification/deposit-preauth.js +62 -0
- package/lib/src/parse/specification/did-delete.d.ts +4 -0
- package/lib/src/parse/specification/did-delete.js +57 -0
- package/lib/src/parse/specification/did-set.d.ts +4 -0
- package/lib/src/parse/specification/did-set.js +60 -0
- package/lib/src/parse/specification/escrow-cancel.d.ts +4 -0
- package/lib/src/parse/specification/escrow-cancel.js +59 -0
- package/lib/src/parse/specification/escrow-create.d.ts +4 -0
- package/lib/src/parse/specification/escrow-create.js +64 -0
- package/lib/src/parse/specification/escrow-finish.d.ts +4 -0
- package/lib/src/parse/specification/escrow-finish.js +61 -0
- package/lib/src/parse/specification/fee-update.d.ts +3 -0
- package/lib/src/parse/specification/fee-update.js +69 -0
- package/lib/src/parse/specification/genesis-mint.d.ts +3 -0
- package/lib/src/parse/specification/genesis-mint.js +53 -0
- package/lib/src/parse/specification/import.d.ts +3 -0
- package/lib/src/parse/specification/import.js +55 -0
- package/lib/src/parse/specification/invoke.d.ts +3 -0
- package/lib/src/parse/specification/invoke.js +54 -0
- package/lib/src/parse/specification/mptoken-authorize.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-authorize.js +60 -0
- package/lib/src/parse/specification/mptoken-issuance-create.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-create.js +62 -0
- package/lib/src/parse/specification/mptoken-issuance-destroy.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-destroy.js +56 -0
- package/lib/src/parse/specification/mptoken-issuance-set.d.ts +4 -0
- package/lib/src/parse/specification/mptoken-issuance-set.js +60 -0
- package/lib/src/parse/specification/nftoken-accept-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-accept-offer.js +58 -0
- package/lib/src/parse/specification/nftoken-burn.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-burn.js +56 -0
- package/lib/src/parse/specification/nftoken-cancel-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-cancel-offer.js +56 -0
- package/lib/src/parse/specification/nftoken-create-offer.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-create-offer.js +69 -0
- package/lib/src/parse/specification/nftoken-mint.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-mint.js +73 -0
- package/lib/src/parse/specification/nftoken-modify.d.ts +4 -0
- package/lib/src/parse/specification/nftoken-modify.js +58 -0
- package/lib/src/parse/specification/offer-cancel.d.ts +4 -0
- package/lib/src/parse/specification/offer-cancel.js +58 -0
- package/lib/src/parse/specification/offer-create.d.ts +4 -0
- package/lib/src/parse/specification/offer-create.js +78 -0
- package/lib/src/parse/specification/oracle-delete.d.ts +4 -0
- package/lib/src/parse/specification/oracle-delete.js +56 -0
- package/lib/src/parse/specification/oracle-set.d.ts +4 -0
- package/lib/src/parse/specification/oracle-set.js +62 -0
- package/lib/src/parse/specification/payment-channel-claim.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-claim.js +67 -0
- package/lib/src/parse/specification/payment-channel-create.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-create.js +68 -0
- package/lib/src/parse/specification/payment-channel-fund.d.ts +4 -0
- package/lib/src/parse/specification/payment-channel-fund.js +65 -0
- package/lib/src/parse/specification/payment.d.ts +4 -0
- package/lib/src/parse/specification/payment.js +75 -0
- package/lib/src/parse/specification/permissioned-domain-set.d.ts +4 -0
- package/lib/src/parse/specification/permissioned-domain-set.js +56 -0
- package/lib/src/parse/specification/remit.d.ts +3 -0
- package/lib/src/parse/specification/remit.js +90 -0
- package/lib/src/parse/specification/set-remarks.d.ts +3 -0
- package/lib/src/parse/specification/set-remarks.js +56 -0
- package/lib/src/parse/specification/settings.d.ts +4 -0
- package/lib/src/parse/specification/settings.js +64 -0
- package/lib/src/parse/specification/ticket-create.d.ts +4 -0
- package/lib/src/parse/specification/ticket-create.js +58 -0
- package/lib/src/parse/specification/trust-set.d.ts +4 -0
- package/lib/src/parse/specification/trust-set.js +80 -0
- package/lib/src/parse/specification/unl-modify.d.ts +4 -0
- package/lib/src/parse/specification/unl-modify.js +52 -0
- package/lib/src/parse/specification/unl-report.d.ts +3 -0
- package/lib/src/parse/specification/unl-report.js +51 -0
- package/lib/src/parse/specification/unrecognized.d.ts +4 -0
- package/lib/src/parse/specification/unrecognized.js +24 -0
- package/lib/src/parse/specification/uritoken-burn.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-burn.js +54 -0
- package/lib/src/parse/specification/uritoken-buy.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-buy.js +55 -0
- package/lib/src/parse/specification/uritoken-cancel-sell-offer.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-cancel-sell-offer.js +54 -0
- package/lib/src/parse/specification/uritoken-create-sell-offer.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-create-sell-offer.js +57 -0
- package/lib/src/parse/specification/uritoken-mint.d.ts +3 -0
- package/lib/src/parse/specification/uritoken-mint.js +63 -0
- package/lib/src/parse/transaction.d.ts +168 -0
- package/lib/src/parse/transaction.js +228 -0
- package/lib/src/parse/utils.d.ts +33 -0
- package/lib/src/parse/utils.js +119 -0
- package/lib/src/types/account.d.ts +26 -0
- package/lib/src/types/account.js +2 -0
- package/lib/src/types/adjustments.d.ts +16 -0
- package/lib/src/types/adjustments.js +2 -0
- package/lib/src/types/amendments.d.ts +4 -0
- package/lib/src/types/amendments.js +2 -0
- package/lib/src/types/amm.d.ts +98 -0
- package/lib/src/types/amm.js +68 -0
- package/lib/src/types/amounts.d.ts +20 -0
- package/lib/src/types/amounts.js +2 -0
- package/lib/src/types/batch.d.ts +21 -0
- package/lib/src/types/batch.js +26 -0
- package/lib/src/types/checks.d.ts +17 -0
- package/lib/src/types/checks.js +2 -0
- package/lib/src/types/clawback.d.ts +5 -0
- package/lib/src/types/clawback.js +2 -0
- package/lib/src/types/credentials.d.ts +30 -0
- package/lib/src/types/credentials.js +10 -0
- package/lib/src/types/cron.d.ts +17 -0
- package/lib/src/types/cron.js +6 -0
- package/lib/src/types/delegate.d.ts +5 -0
- package/lib/src/types/delegate.js +2 -0
- package/lib/src/types/deposits.d.ts +11 -0
- package/lib/src/types/deposits.js +2 -0
- package/lib/src/types/did.d.ts +7 -0
- package/lib/src/types/did.js +2 -0
- package/lib/src/types/emit_details.d.ts +7 -0
- package/lib/src/types/emit_details.js +2 -0
- package/lib/src/types/escrows.d.ts +18 -0
- package/lib/src/types/escrows.js +2 -0
- package/lib/src/types/fees.d.ts +9 -0
- package/lib/src/types/fees.js +2 -0
- package/lib/src/types/gateway_balances.d.ts +11 -0
- package/lib/src/types/gateway_balances.js +2 -0
- package/lib/src/types/genesis_mint.d.ts +9 -0
- package/lib/src/types/genesis_mint.js +2 -0
- package/lib/src/types/global.d.ts +14 -0
- package/lib/src/types/global.js +26 -0
- package/lib/src/types/hooks.d.ts +14 -0
- package/lib/src/types/hooks.js +2 -0
- package/lib/src/types/import.d.ts +21 -0
- package/lib/src/types/import.js +2 -0
- package/lib/src/types/index.d.ts +31 -0
- package/lib/src/types/index.js +47 -0
- package/lib/src/types/invoke.d.ts +5 -0
- package/lib/src/types/invoke.js +2 -0
- package/lib/src/types/ledger.d.ts +46 -0
- package/lib/src/types/ledger.js +2 -0
- package/lib/src/types/ledger_data.d.ts +10 -0
- package/lib/src/types/ledger_data.js +2 -0
- package/lib/src/types/ledger_entries.d.ts +163 -0
- package/lib/src/types/ledger_entries.js +2 -0
- package/lib/src/types/memos.d.ts +12 -0
- package/lib/src/types/memos.js +2 -0
- package/lib/src/types/mptokens.d.ts +84 -0
- package/lib/src/types/mptokens.js +76 -0
- package/lib/src/types/nftokens.d.ts +62 -0
- package/lib/src/types/nftokens.js +44 -0
- package/lib/src/types/offers.d.ts +46 -0
- package/lib/src/types/offers.js +33 -0
- package/lib/src/types/oracle.d.ts +19 -0
- package/lib/src/types/oracle.js +2 -0
- package/lib/src/types/outcome.d.ts +22 -0
- package/lib/src/types/outcome.js +2 -0
- package/lib/src/types/payment_channels.d.ts +23 -0
- package/lib/src/types/payment_channels.js +2 -0
- package/lib/src/types/payments.d.ts +24 -0
- package/lib/src/types/payments.js +25 -0
- package/lib/src/types/queue_data.d.ts +15 -0
- package/lib/src/types/queue_data.js +2 -0
- package/lib/src/types/remarks.d.ts +24 -0
- package/lib/src/types/remarks.js +6 -0
- package/lib/src/types/remits.d.ts +15 -0
- package/lib/src/types/remits.js +2 -0
- package/lib/src/types/settings.d.ts +27 -0
- package/lib/src/types/settings.js +2 -0
- package/lib/src/types/signers.d.ts +22 -0
- package/lib/src/types/signers.js +2 -0
- package/lib/src/types/specification.d.ts +14 -0
- package/lib/src/types/specification.js +2 -0
- package/lib/src/types/tickets.d.ts +4 -0
- package/lib/src/types/tickets.js +2 -0
- package/lib/src/types/trustlines.d.ts +85 -0
- package/lib/src/types/trustlines.js +43 -0
- package/lib/src/types/unl_modify.d.ts +6 -0
- package/lib/src/types/unl_modify.js +2 -0
- package/lib/src/types/unl_reports.d.ts +5 -0
- package/lib/src/types/unl_reports.js +2 -0
- package/lib/src/types/unrecognized.d.ts +5 -0
- package/lib/src/types/unrecognized.js +2 -0
- package/lib/src/types/uri_tokens.d.ts +7 -0
- package/lib/src/types/uri_tokens.js +6 -0
- package/lib/src/types/uritokens.d.ts +41 -0
- package/lib/src/types/uritokens.js +22 -0
- package/lib/src/v1/transaction/payment.d.ts +14 -0
- package/lib/src/v1/transaction/payment.js +142 -0
- package/lib/src/v1/types.d.ts +9 -0
- package/lib/src/v1/types.js +2 -0
- package/lib/src/v1/utils.d.ts +7 -0
- package/lib/src/v1/utils.js +49 -0
- package/lib/src/validator.d.ts +11 -0
- package/lib/src/validator.js +130 -0
- package/lib/src/wallet.d.ts +34 -0
- package/lib/src/wallet.js +284 -0
- package/lib/types/offers.d.ts +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,498 @@
|
|
|
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.parseVL = parseVL;
|
|
37
|
+
exports.isValidVL = isValidVL;
|
|
38
|
+
exports.encodeVLBlob = encodeVLBlob;
|
|
39
|
+
exports.parseValidationData = parseValidationData;
|
|
40
|
+
const manifest_1 = require("./manifest");
|
|
41
|
+
const utils_1 = require("../parse/utils");
|
|
42
|
+
const ledger_1 = require("./ledger");
|
|
43
|
+
const Validator = __importStar(require("../validator"));
|
|
44
|
+
function parseVL(vl) {
|
|
45
|
+
const decoded = {};
|
|
46
|
+
decoded.version = vl.version;
|
|
47
|
+
if (decoded.version !== 1 && decoded.version !== 2) {
|
|
48
|
+
decoded.error = "Invalid version";
|
|
49
|
+
}
|
|
50
|
+
decoded.PublicKey = vl.public_key;
|
|
51
|
+
decoded.manifest = vl.manifest;
|
|
52
|
+
let error = isValidVLFormat(vl);
|
|
53
|
+
if (error) {
|
|
54
|
+
decoded.error = error;
|
|
55
|
+
}
|
|
56
|
+
decoded.decodedManifest = (0, manifest_1.parseManifest)(vl.manifest);
|
|
57
|
+
if (!decoded.error && decoded.decodedManifest.error) {
|
|
58
|
+
decoded.error = decoded.decodedManifest.error;
|
|
59
|
+
}
|
|
60
|
+
if (!decoded.error &&
|
|
61
|
+
decoded.PublicKey !== decoded.decodedManifest.PublicKey &&
|
|
62
|
+
decoded.PublicKey !== decoded.decodedManifest.SigningPubKey) {
|
|
63
|
+
decoded.error = "PublicKey does not match manifest";
|
|
64
|
+
}
|
|
65
|
+
if (decoded.version === 1) {
|
|
66
|
+
decoded.signature = vl.signature;
|
|
67
|
+
if (!decoded.error && !decoded.signature) {
|
|
68
|
+
decoded.error = "Signature (blob) is missing";
|
|
69
|
+
}
|
|
70
|
+
if (decoded.signature && decoded.decodedManifest.SigningPubKey && vl.blob) {
|
|
71
|
+
if (!decoded.error &&
|
|
72
|
+
!Validator.verify(Buffer.from(vl.blob, "base64"), decoded.signature, decoded.decodedManifest.SigningPubKey)) {
|
|
73
|
+
decoded.error = "Signature is not valid";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const blob = decodeVLBlob(vl.blob);
|
|
77
|
+
error = isValidVLBlob(blob);
|
|
78
|
+
if (!decoded.error && error) {
|
|
79
|
+
decoded.error = error;
|
|
80
|
+
}
|
|
81
|
+
decoded.blob = {
|
|
82
|
+
sequence: blob?.sequence,
|
|
83
|
+
expiration: (0, ledger_1.ledgerTimeToUnixTime)(blob?.expiration),
|
|
84
|
+
validators: [],
|
|
85
|
+
};
|
|
86
|
+
for (const validator of blob?.validators) {
|
|
87
|
+
error = isValidVLBlobValidator(validator);
|
|
88
|
+
if (!decoded.error && error) {
|
|
89
|
+
decoded.error = error;
|
|
90
|
+
}
|
|
91
|
+
const validatorManifest = (0, manifest_1.parseManifest)(validator.manifest);
|
|
92
|
+
if (!decoded.error && validatorManifest.error) {
|
|
93
|
+
decoded.error = validatorManifest.error;
|
|
94
|
+
}
|
|
95
|
+
if (decoded.blob.validators) {
|
|
96
|
+
decoded.blob.validators.push({
|
|
97
|
+
PublicKey: validator.validation_public_key,
|
|
98
|
+
manifest: validator.manifest,
|
|
99
|
+
decodedManifest: validatorManifest,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (decoded.version === 2) {
|
|
105
|
+
const blobs = (vl["blobs-v2"] || vl["blobs_v2"]);
|
|
106
|
+
if (!decoded.blobs) {
|
|
107
|
+
decoded.blobs = [];
|
|
108
|
+
}
|
|
109
|
+
if (!blobs) {
|
|
110
|
+
return decoded;
|
|
111
|
+
}
|
|
112
|
+
for (const blobInfo of blobs) {
|
|
113
|
+
const blob = decodeVLBlob(blobInfo.blob);
|
|
114
|
+
error = isValidVLBlob(blob);
|
|
115
|
+
if (!decoded.error && error) {
|
|
116
|
+
decoded.error = error;
|
|
117
|
+
}
|
|
118
|
+
const decodedBlob = {
|
|
119
|
+
sequence: blob?.sequence,
|
|
120
|
+
expiration: (0, ledger_1.ledgerTimeToUnixTime)(blob?.expiration),
|
|
121
|
+
signature: blobInfo.signature,
|
|
122
|
+
validators: [],
|
|
123
|
+
};
|
|
124
|
+
if (blob?.effective) {
|
|
125
|
+
decodedBlob.effective = (0, ledger_1.ledgerTimeToUnixTime)(blob.effective);
|
|
126
|
+
}
|
|
127
|
+
if (blobInfo?.manifest) {
|
|
128
|
+
decodedBlob.manifest = blobInfo.manifest;
|
|
129
|
+
decodedBlob.decodedManifest = (0, manifest_1.parseManifest)(blobInfo.manifest);
|
|
130
|
+
if (!decoded.error && decodedBlob.decodedManifest.error) {
|
|
131
|
+
decoded.error = decodedBlob.decodedManifest.error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const decodedManifest = decodedBlob.decodedManifest || decoded.decodedManifest;
|
|
135
|
+
if (!decoded.error &&
|
|
136
|
+
decoded.PublicKey !== decodedManifest.PublicKey &&
|
|
137
|
+
decoded.PublicKey !== decodedManifest.SigningPubKey) {
|
|
138
|
+
decoded.error = "PublicKey does not match manifest";
|
|
139
|
+
}
|
|
140
|
+
if (!decoded.error && !decodedBlob.signature) {
|
|
141
|
+
decoded.error = "Signature (blob) is missing";
|
|
142
|
+
}
|
|
143
|
+
if (decodedBlob.signature && decodedManifest.SigningPubKey && blobInfo.blob) {
|
|
144
|
+
if (!decoded.error &&
|
|
145
|
+
!Validator.verify(Buffer.from(blobInfo.blob, "base64"), decodedBlob.signature, decodedManifest.SigningPubKey)) {
|
|
146
|
+
decoded.error = "Signature is not valid";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (const validator of blob?.validators) {
|
|
150
|
+
error = isValidVLBlobValidator(validator);
|
|
151
|
+
if (!decoded.error && error) {
|
|
152
|
+
decoded.error = error;
|
|
153
|
+
}
|
|
154
|
+
const validatorManifest = (0, manifest_1.parseManifest)(validator.manifest);
|
|
155
|
+
if (!decoded.error && validatorManifest.error) {
|
|
156
|
+
decoded.error = validatorManifest.error;
|
|
157
|
+
}
|
|
158
|
+
if (decodedBlob.validators) {
|
|
159
|
+
decodedBlob.validators.push({
|
|
160
|
+
PublicKey: validator.validation_public_key,
|
|
161
|
+
manifest: validator.manifest,
|
|
162
|
+
decodedManifest: validatorManifest,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
decoded.blobs.push(decodedBlob);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return decoded;
|
|
170
|
+
}
|
|
171
|
+
function isValidVL(vl) {
|
|
172
|
+
let error = isValidVLFormat(vl);
|
|
173
|
+
if (error) {
|
|
174
|
+
return error;
|
|
175
|
+
}
|
|
176
|
+
const vlManifest = (0, manifest_1.parseManifest)(vl.manifest);
|
|
177
|
+
if (vlManifest.error) {
|
|
178
|
+
return vlManifest.error;
|
|
179
|
+
}
|
|
180
|
+
if (vl.version === 1) {
|
|
181
|
+
const blob = decodeVLBlob(vl.blob);
|
|
182
|
+
error = isValidVLBlob(blob);
|
|
183
|
+
if (error) {
|
|
184
|
+
return error;
|
|
185
|
+
}
|
|
186
|
+
for (const validator of blob?.validators) {
|
|
187
|
+
error = isValidVLBlobValidator(validator);
|
|
188
|
+
if (error) {
|
|
189
|
+
return error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (vl.version === 2) {
|
|
194
|
+
const blobs = (vl["blobs-v2"] || vl["blobs_v2"]);
|
|
195
|
+
if (!blobs) {
|
|
196
|
+
return "blobs_v2 missing from vl";
|
|
197
|
+
}
|
|
198
|
+
for (const blobInfo of blobs) {
|
|
199
|
+
const blob = decodeVLBlob(blobInfo.blob);
|
|
200
|
+
error = isValidVLBlob(blob);
|
|
201
|
+
if (error) {
|
|
202
|
+
return error;
|
|
203
|
+
}
|
|
204
|
+
for (const validator of blob?.validators) {
|
|
205
|
+
error = isValidVLBlobValidator(validator);
|
|
206
|
+
if (error) {
|
|
207
|
+
return error;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return "Invalid version";
|
|
214
|
+
}
|
|
215
|
+
return error;
|
|
216
|
+
}
|
|
217
|
+
function isValidVLFormat(vl) {
|
|
218
|
+
const { version, public_key, manifest, blob } = vl;
|
|
219
|
+
let error = null;
|
|
220
|
+
if (version === undefined) {
|
|
221
|
+
error = "Version missing from vl";
|
|
222
|
+
}
|
|
223
|
+
else if (public_key === undefined) {
|
|
224
|
+
error = "Public key missing from vl";
|
|
225
|
+
}
|
|
226
|
+
else if (manifest === undefined) {
|
|
227
|
+
error = "Manifest missing from vl";
|
|
228
|
+
}
|
|
229
|
+
else if (version === 1) {
|
|
230
|
+
if (blob === undefined) {
|
|
231
|
+
error = "Blob missing from vl";
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (version === 2) {
|
|
235
|
+
const blobs = (vl["blobs-v2"] || vl["blobs_v2"]);
|
|
236
|
+
if (blob !== undefined) {
|
|
237
|
+
error = "Blob should not be present in vl version 2";
|
|
238
|
+
}
|
|
239
|
+
else if (blobs === undefined) {
|
|
240
|
+
error = "blobs_v2 missing from vl";
|
|
241
|
+
}
|
|
242
|
+
else if (!Array.isArray(blobs)) {
|
|
243
|
+
error = "blobs_v2 should be an array";
|
|
244
|
+
}
|
|
245
|
+
else if (blobs.length === 0) {
|
|
246
|
+
error = "blobs_v2 should not be empty";
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
error = "Version is not supported";
|
|
251
|
+
}
|
|
252
|
+
return error;
|
|
253
|
+
}
|
|
254
|
+
function decodeVLBlob(blob) {
|
|
255
|
+
const decoded = Buffer.from(blob, "base64").toString("ascii");
|
|
256
|
+
return JSON.parse(decoded);
|
|
257
|
+
}
|
|
258
|
+
function encodeVLBlob(vlBlob) {
|
|
259
|
+
return Buffer.from(JSON.stringify(vlBlob)).toString("base64");
|
|
260
|
+
}
|
|
261
|
+
function isValidVLBlob(blob) {
|
|
262
|
+
if (blob === null) {
|
|
263
|
+
return "Blob is not valid";
|
|
264
|
+
}
|
|
265
|
+
const { sequence, expiration, validators } = blob;
|
|
266
|
+
let error = null;
|
|
267
|
+
if (sequence === undefined) {
|
|
268
|
+
error = "Sequence missing from blob";
|
|
269
|
+
}
|
|
270
|
+
if (expiration === undefined) {
|
|
271
|
+
error = "Expiration missing from blob";
|
|
272
|
+
}
|
|
273
|
+
if (validators === undefined) {
|
|
274
|
+
error = "Validators missing from blob";
|
|
275
|
+
}
|
|
276
|
+
if (validators && validators.length === 0) {
|
|
277
|
+
error = "Validators is empty";
|
|
278
|
+
}
|
|
279
|
+
return error;
|
|
280
|
+
}
|
|
281
|
+
function isValidVLBlobValidator(validator) {
|
|
282
|
+
const { validation_public_key, manifest } = validator;
|
|
283
|
+
let error = null;
|
|
284
|
+
if (validation_public_key === undefined) {
|
|
285
|
+
error = "Validation public key missing from validator";
|
|
286
|
+
}
|
|
287
|
+
if (manifest === undefined) {
|
|
288
|
+
error = "Manifest missing from validator";
|
|
289
|
+
}
|
|
290
|
+
const parsedManifest = (0, manifest_1.parseManifest)(manifest);
|
|
291
|
+
if (parsedManifest.error) {
|
|
292
|
+
return parsedManifest.error;
|
|
293
|
+
}
|
|
294
|
+
return error;
|
|
295
|
+
}
|
|
296
|
+
function parseValidationData(data, publicKey) {
|
|
297
|
+
const buf = Buffer.from(data, "hex");
|
|
298
|
+
const decoded = {};
|
|
299
|
+
let cur = 0;
|
|
300
|
+
if (buf[cur++] !== 0x22 || buf.length - cur < 5) {
|
|
301
|
+
decoded.error = "sfFlags missing or incomplete";
|
|
302
|
+
return decoded;
|
|
303
|
+
}
|
|
304
|
+
decoded.Flags = parseInt((0, utils_1.parseUint32)(buf, cur), 10);
|
|
305
|
+
cur += 4;
|
|
306
|
+
if (buf[cur++] !== 0x26 || buf.length - cur < 5) {
|
|
307
|
+
decoded.error = "sfLedgerSequnece missing or incomplete";
|
|
308
|
+
return decoded;
|
|
309
|
+
}
|
|
310
|
+
decoded.LedgerSequence = parseInt((0, utils_1.parseUint32)(buf, cur), 10);
|
|
311
|
+
cur += 4;
|
|
312
|
+
if (buf[cur] === 0x27) {
|
|
313
|
+
cur++;
|
|
314
|
+
if (buf.length - cur < 4) {
|
|
315
|
+
decoded.error = "sfCloseTime missing or incomplete";
|
|
316
|
+
return decoded;
|
|
317
|
+
}
|
|
318
|
+
decoded.CloseTime = parseInt((0, utils_1.parseUint32)(buf, cur), 10);
|
|
319
|
+
cur += 4;
|
|
320
|
+
}
|
|
321
|
+
if (buf[cur++] !== 0x29 || buf.length - cur < 5) {
|
|
322
|
+
decoded.error = "sfSigningTime missing or incomplete";
|
|
323
|
+
return decoded;
|
|
324
|
+
}
|
|
325
|
+
decoded.SigningTime = parseInt((0, utils_1.parseUint32)(buf, cur), 10);
|
|
326
|
+
cur += 4;
|
|
327
|
+
if (buf[cur] === 0x20 && buf.length - cur >= 1 && buf[cur + 1] === 0x18) {
|
|
328
|
+
cur += 2;
|
|
329
|
+
if (buf.length - cur < 4) {
|
|
330
|
+
decoded.error = "sfLoadFee payload missing";
|
|
331
|
+
return decoded;
|
|
332
|
+
}
|
|
333
|
+
decoded.LoadFee = (0, utils_1.parseUint32)(buf, cur);
|
|
334
|
+
cur += 4;
|
|
335
|
+
}
|
|
336
|
+
if (buf[cur] === 0x20 && buf.length - cur >= 1 && buf[cur + 1] === 0x1f) {
|
|
337
|
+
cur += 2;
|
|
338
|
+
if (buf.length - cur < 4) {
|
|
339
|
+
decoded.error = "sfReserveBase payload missing";
|
|
340
|
+
return decoded;
|
|
341
|
+
}
|
|
342
|
+
decoded.ReserveBase = (0, utils_1.parseUint32)(buf, cur);
|
|
343
|
+
cur += 4;
|
|
344
|
+
}
|
|
345
|
+
if (buf[cur] === 0x20 && buf.length - cur >= 1 && buf[cur + 1] === 0x20) {
|
|
346
|
+
cur += 2;
|
|
347
|
+
if (buf.length - cur < 4) {
|
|
348
|
+
decoded.error = "sfReserveIncrement payload missing";
|
|
349
|
+
return decoded;
|
|
350
|
+
}
|
|
351
|
+
decoded.ReserveIncrement = (0, utils_1.parseUint32)(buf, cur);
|
|
352
|
+
cur += 4;
|
|
353
|
+
}
|
|
354
|
+
if (buf[cur] === 0x35) {
|
|
355
|
+
cur++;
|
|
356
|
+
if (buf.length - cur < 8) {
|
|
357
|
+
decoded.error = "sfBaseFee missing or incomplete";
|
|
358
|
+
return decoded;
|
|
359
|
+
}
|
|
360
|
+
decoded.BaseFee = (0, utils_1.parseUint64)(buf, cur);
|
|
361
|
+
cur += 8;
|
|
362
|
+
}
|
|
363
|
+
if (buf[cur] === 0x3a) {
|
|
364
|
+
cur++;
|
|
365
|
+
if (buf.length - cur < 8) {
|
|
366
|
+
decoded.error = "sfCookie missing or incomplete";
|
|
367
|
+
return decoded;
|
|
368
|
+
}
|
|
369
|
+
decoded.Cookie = (0, utils_1.parseUint64)(buf, cur);
|
|
370
|
+
cur += 8;
|
|
371
|
+
}
|
|
372
|
+
if (buf[cur] === 0x3b) {
|
|
373
|
+
cur++;
|
|
374
|
+
if (buf.length - cur < 8) {
|
|
375
|
+
decoded.error = "sfServerVersion missing or incomplete";
|
|
376
|
+
return decoded;
|
|
377
|
+
}
|
|
378
|
+
decoded.ServerVersion = (0, utils_1.parseUint64)(buf, cur);
|
|
379
|
+
cur += 8;
|
|
380
|
+
}
|
|
381
|
+
if (buf[cur++] !== 0x51 || buf.length - cur < 5) {
|
|
382
|
+
decoded.error = "sfLedgerHash missing or incomplete";
|
|
383
|
+
return decoded;
|
|
384
|
+
}
|
|
385
|
+
decoded.LedgerHash = buf
|
|
386
|
+
.slice(cur, cur + 32)
|
|
387
|
+
.toString("hex")
|
|
388
|
+
.toUpperCase();
|
|
389
|
+
cur += 32;
|
|
390
|
+
if (buf[cur] === 0x50 && buf.length - cur >= 1 && buf[cur + 1] === 0x17) {
|
|
391
|
+
cur += 2;
|
|
392
|
+
if (buf.length - cur < 32) {
|
|
393
|
+
decoded.error = "sfConsensusHash payload missing";
|
|
394
|
+
return decoded;
|
|
395
|
+
}
|
|
396
|
+
decoded.ConsensusHash = buf
|
|
397
|
+
.slice(cur, cur + 32)
|
|
398
|
+
.toString("hex")
|
|
399
|
+
.toUpperCase();
|
|
400
|
+
cur += 32;
|
|
401
|
+
}
|
|
402
|
+
if (buf[cur] === 0x50 && buf.length - cur >= 1 && buf[cur + 1] === 0x19) {
|
|
403
|
+
cur += 2;
|
|
404
|
+
if (buf.length - cur < 32) {
|
|
405
|
+
decoded.error = "sfValidatedHash payload missing";
|
|
406
|
+
return decoded;
|
|
407
|
+
}
|
|
408
|
+
decoded.ValidatedHash = buf
|
|
409
|
+
.slice(cur, cur + 32)
|
|
410
|
+
.toString("hex")
|
|
411
|
+
.toUpperCase();
|
|
412
|
+
cur += 32;
|
|
413
|
+
}
|
|
414
|
+
if (buf[cur++] !== 0x73 || buf.length - cur < 2) {
|
|
415
|
+
decoded.error = "sfSigningPubKey missing or incomplete";
|
|
416
|
+
return decoded;
|
|
417
|
+
}
|
|
418
|
+
const keySize = buf[cur++];
|
|
419
|
+
if (buf.length - cur < keySize) {
|
|
420
|
+
decoded.error = "sfSigningPubKey payload missing";
|
|
421
|
+
return decoded;
|
|
422
|
+
}
|
|
423
|
+
decoded.SigningPubKey = buf
|
|
424
|
+
.slice(cur, cur + keySize)
|
|
425
|
+
.toString("hex")
|
|
426
|
+
.toUpperCase();
|
|
427
|
+
cur += keySize;
|
|
428
|
+
const sigStart = cur;
|
|
429
|
+
if (buf[cur++] !== 0x76 || buf.length - cur < 2) {
|
|
430
|
+
decoded.error = "sfSignature missing or incomplete";
|
|
431
|
+
return decoded;
|
|
432
|
+
}
|
|
433
|
+
const sigSize = buf[cur++];
|
|
434
|
+
if (buf.length - cur < sigSize) {
|
|
435
|
+
decoded.error = "sfSignature payload missing";
|
|
436
|
+
return decoded;
|
|
437
|
+
}
|
|
438
|
+
decoded.Signature = buf
|
|
439
|
+
.slice(cur, cur + sigSize)
|
|
440
|
+
.toString("hex")
|
|
441
|
+
.toUpperCase();
|
|
442
|
+
cur += sigSize;
|
|
443
|
+
const sigEnd = cur;
|
|
444
|
+
if (buf.length - cur >= 1 && buf[cur] === 0x03 && buf[cur + 1] === 0x13) {
|
|
445
|
+
cur += 2;
|
|
446
|
+
if (buf.length - cur < 1) {
|
|
447
|
+
decoded.error = "sfAmendments payload missing or incomplete [1]";
|
|
448
|
+
return decoded;
|
|
449
|
+
}
|
|
450
|
+
let len = buf[cur++];
|
|
451
|
+
if (len <= 192) {
|
|
452
|
+
}
|
|
453
|
+
else if (len >= 193 && len <= 240) {
|
|
454
|
+
if (buf.length - cur < 1) {
|
|
455
|
+
decoded.error = "sfAmendments payload missing or incomplete [2]";
|
|
456
|
+
return decoded;
|
|
457
|
+
}
|
|
458
|
+
len = 193 + (len - 193) * 256 + buf[cur++];
|
|
459
|
+
}
|
|
460
|
+
else if (len >= 241 && len <= 254) {
|
|
461
|
+
if (buf.length - cur < 2) {
|
|
462
|
+
decoded.error = "sfAmendments payload missing or incomplete [3]";
|
|
463
|
+
return decoded;
|
|
464
|
+
}
|
|
465
|
+
len = 12481 + (len - 241) * 65536 + buf[cur + 1] * 256 + buf[cur + 2];
|
|
466
|
+
cur += 2;
|
|
467
|
+
}
|
|
468
|
+
if (buf.length - cur < len) {
|
|
469
|
+
decoded.error = "sfAmendments payload missing or incomplete [3]";
|
|
470
|
+
return decoded;
|
|
471
|
+
}
|
|
472
|
+
decoded.Amendments = [];
|
|
473
|
+
const amendmentsCurEnd = cur + len;
|
|
474
|
+
while (cur < amendmentsCurEnd) {
|
|
475
|
+
decoded.Amendments.push(buf.slice(cur, cur + 32).toString("hex"));
|
|
476
|
+
cur += 32;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (publicKey.toUpperCase() !== decoded.SigningPubKey) {
|
|
480
|
+
decoded._verified = false;
|
|
481
|
+
decoded.error = "SigningPubKey did not match or was not present";
|
|
482
|
+
return decoded;
|
|
483
|
+
}
|
|
484
|
+
const verifyFields = Buffer.concat([
|
|
485
|
+
Buffer.from("VAL\x00", "utf-8"),
|
|
486
|
+
buf.slice(0, sigStart),
|
|
487
|
+
buf.slice(sigEnd, buf.length),
|
|
488
|
+
]);
|
|
489
|
+
if (decoded.SigningPubKey && decoded.Signature) {
|
|
490
|
+
if (!Validator.verify(verifyFields, decoded.Signature, decoded.SigningPubKey)) {
|
|
491
|
+
decoded._verified = false;
|
|
492
|
+
decoded.error = "Signature did not match or was not present";
|
|
493
|
+
return decoded;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
decoded._verified = true;
|
|
497
|
+
return decoded;
|
|
498
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * as Ledger from "./ledger";
|
|
2
|
+
export * as Utils from "./utils";
|
|
3
|
+
export * as Outcomes from "./outcome/index";
|
|
4
|
+
export { parseOutcome } from "./outcome";
|
|
5
|
+
export { parseTransactionType, parseTransaction } from "./transaction";
|
|
6
|
+
export { normalizeMPTokensPreviousFields } from "./mptoken_normalize";
|
|
@@ -0,0 +1,46 @@
|
|
|
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.normalizeMPTokensPreviousFields = exports.parseTransaction = exports.parseTransactionType = exports.parseOutcome = exports.Outcomes = exports.Utils = exports.Ledger = void 0;
|
|
37
|
+
exports.Ledger = __importStar(require("./ledger"));
|
|
38
|
+
exports.Utils = __importStar(require("./utils"));
|
|
39
|
+
exports.Outcomes = __importStar(require("./outcome/index"));
|
|
40
|
+
var outcome_1 = require("./outcome");
|
|
41
|
+
Object.defineProperty(exports, "parseOutcome", { enumerable: true, get: function () { return outcome_1.parseOutcome; } });
|
|
42
|
+
var transaction_1 = require("./transaction");
|
|
43
|
+
Object.defineProperty(exports, "parseTransactionType", { enumerable: true, get: function () { return transaction_1.parseTransactionType; } });
|
|
44
|
+
Object.defineProperty(exports, "parseTransaction", { enumerable: true, get: function () { return transaction_1.parseTransaction; } });
|
|
45
|
+
var mptoken_normalize_1 = require("./mptoken_normalize");
|
|
46
|
+
Object.defineProperty(exports, "normalizeMPTokensPreviousFields", { enumerable: true, get: function () { return mptoken_normalize_1.normalizeMPTokensPreviousFields; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AccountSet, SetRegularKey, SignerListSet } from "xrpl";
|
|
2
|
+
import { AccountFieldParametersInterface } from "../../models/account_info";
|
|
3
|
+
export declare function parseField(info: AccountFieldParametersInterface, value: any): any;
|
|
4
|
+
declare function parseAccountFields(tx: AccountSet | SetRegularKey | SignerListSet): object;
|
|
5
|
+
export default parseAccountFields;
|
|
@@ -0,0 +1,43 @@
|
|
|
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.parseField = parseField;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const account_info_1 = require("../../models/account_info");
|
|
9
|
+
function parseField(info, value) {
|
|
10
|
+
if (info.encoding === "hex" && !info.length) {
|
|
11
|
+
return Buffer.from(value, "hex").toString("ascii");
|
|
12
|
+
}
|
|
13
|
+
if (info.shift) {
|
|
14
|
+
return new bignumber_js_1.default(value).shiftedBy(-info.shift).toNumber();
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function parseAccountFields(tx) {
|
|
19
|
+
const settings = {};
|
|
20
|
+
for (const fieldName in account_info_1.AccountFields) {
|
|
21
|
+
const fieldValue = tx[fieldName];
|
|
22
|
+
if (fieldValue != null) {
|
|
23
|
+
const info = account_info_1.AccountFields[fieldName];
|
|
24
|
+
settings[info.name] = parseField(info, fieldValue);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (tx.ClearFlag === account_info_1.AccountSetFlags.authorizedMinter && !settings.nftokenMinter) {
|
|
28
|
+
settings.nftokenMinter = "";
|
|
29
|
+
}
|
|
30
|
+
if (tx.SignerEntries && Array.isArray(tx.SignerEntries) && tx.SignerEntries.length > 0) {
|
|
31
|
+
settings.signerEntries = tx.SignerEntries.map((entry) => {
|
|
32
|
+
return {
|
|
33
|
+
account: entry.SignerEntry.Account,
|
|
34
|
+
signerWeight: entry.SignerEntry.SignerWeight,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (tx.SignerQuorum) {
|
|
39
|
+
settings.signerQuorum = tx.SignerQuorum;
|
|
40
|
+
}
|
|
41
|
+
return settings;
|
|
42
|
+
}
|
|
43
|
+
exports.default = parseAccountFields;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAccountInfoData = parseAccountInfoData;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
function parseAccountInfoData(response) {
|
|
6
|
+
const data = response.account_data;
|
|
7
|
+
return (0, common_1.removeUndefined)({
|
|
8
|
+
sequence: data.Sequence,
|
|
9
|
+
xrpBalance: (0, common_1.dropsToXrp)(data.Balance),
|
|
10
|
+
ownerCount: data.OwnerCount,
|
|
11
|
+
previousInitiatedTransactionID: data.AccountTxnID,
|
|
12
|
+
previousAffectingTransactionID: data.PreviousTxnID,
|
|
13
|
+
previousAffectingTransactionLedgerVersion: data.PreviousTxnLgrSeq,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormattedOfferCreateSpecification } from "../../types";
|
|
2
|
+
export type FormattedAccountOrders = {
|
|
3
|
+
account: string;
|
|
4
|
+
offers?: FormattedAccountOrder[];
|
|
5
|
+
ledger_current_index?: number;
|
|
6
|
+
ledger_index?: number;
|
|
7
|
+
ledger_hash?: string;
|
|
8
|
+
marker?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type FormattedAccountOrder = {
|
|
11
|
+
specification: FormattedOfferCreateSpecification;
|
|
12
|
+
properties: {
|
|
13
|
+
maker: string;
|
|
14
|
+
sequence: number;
|
|
15
|
+
makerExchangeRate: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function parseAccountOrder(address: string, order: any): FormattedAccountOrder;
|
|
@@ -0,0 +1,48 @@
|
|
|
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.parseAccountOrder = parseAccountOrder;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const xrpl_1 = require("xrpl");
|
|
9
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const common_1 = require("../../common");
|
|
12
|
+
const offer_flags_1 = __importDefault(require("../ledger/offer-flags"));
|
|
13
|
+
function computeQuality(takerGets, takerPays) {
|
|
14
|
+
const quotient = new bignumber_js_1.default(takerPays.value).dividedBy(takerGets.value);
|
|
15
|
+
return quotient.precision(16, bignumber_js_1.default.ROUND_HALF_UP).toString();
|
|
16
|
+
}
|
|
17
|
+
function parseAccountOrder(address, order) {
|
|
18
|
+
const flags = (0, offer_flags_1.default)(order.flags);
|
|
19
|
+
const takerGets = (0, amount_1.default)(order.taker_gets);
|
|
20
|
+
const takerPays = (0, amount_1.default)(order.taker_pays);
|
|
21
|
+
const quantity = flags.sell === true ? takerGets : takerPays;
|
|
22
|
+
const totalPrice = flags.sell === true ? takerPays : takerGets;
|
|
23
|
+
const specification = (0, common_1.removeUndefined)({
|
|
24
|
+
flags: flags,
|
|
25
|
+
expirationTime: (0, utils_1.parseTimestamp)(order.expiration),
|
|
26
|
+
takerGets: takerGets,
|
|
27
|
+
takerPays: takerPays,
|
|
28
|
+
direction: (order.flags & xrpl_1.LedgerEntry.OfferFlags.lsfSell) === 0 ? "buy" : "sell",
|
|
29
|
+
passive: (order.flags & xrpl_1.LedgerEntry.OfferFlags.lsfPassive) !== 0 || undefined,
|
|
30
|
+
quantity: quantity,
|
|
31
|
+
totalPrice: totalPrice,
|
|
32
|
+
});
|
|
33
|
+
let makerExchangeRate;
|
|
34
|
+
if (order.quality) {
|
|
35
|
+
const takerGetsCurrency = takerGets.issuer ? null : takerGets.currency;
|
|
36
|
+
const takerPaysCurrency = takerPays.issuer ? null : takerPays.currency;
|
|
37
|
+
makerExchangeRate = (0, utils_1.adjustQualityForXRP)(order.quality.toString(), takerGetsCurrency, takerPaysCurrency);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
makerExchangeRate = computeQuality(takerGets, takerPays);
|
|
41
|
+
}
|
|
42
|
+
const properties = {
|
|
43
|
+
maker: address,
|
|
44
|
+
sequence: order.seq,
|
|
45
|
+
makerExchangeRate: makerExchangeRate,
|
|
46
|
+
};
|
|
47
|
+
return { specification, properties };
|
|
48
|
+
}
|