@bithomp/xrpl-api 2.3.6
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/LICENSE +674 -0
- package/README.md +101 -0
- package/lib/base58.d.ts +3 -0
- package/lib/base58.js +33 -0
- package/lib/client.d.ts +19 -0
- package/lib/client.js +122 -0
- package/lib/common/errors/index.d.ts +3 -0
- package/lib/common/errors/index.js +7 -0
- package/lib/common/errors/ripple_error.d.ts +9 -0
- package/lib/common/errors/ripple_error.js +28 -0
- package/lib/common/errors/utils.d.ts +2 -0
- package/lib/common/errors/utils.js +19 -0
- package/lib/common/errors/validation_error.d.ts +4 -0
- package/lib/common/errors/validation_error.js +7 -0
- package/lib/common/index.d.ts +6 -0
- package/lib/common/index.js +44 -0
- package/lib/common/sha512Half.d.ts +2 -0
- package/lib/common/sha512Half.js +12 -0
- package/lib/common/utils.d.ts +10 -0
- package/lib/common/utils.js +113 -0
- package/lib/connection.d.ts +57 -0
- package/lib/connection.js +369 -0
- package/lib/faucet.d.ts +58 -0
- package/lib/faucet.js +89 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +35 -0
- package/lib/ledger/account_info.d.ts +12 -0
- package/lib/ledger/account_info.js +78 -0
- package/lib/ledger/account_lines.d.ts +11 -0
- package/lib/ledger/account_lines.js +69 -0
- package/lib/ledger/account_nfts.d.ts +21 -0
- package/lib/ledger/account_nfts.js +185 -0
- package/lib/ledger/account_objects.d.ts +28 -0
- package/lib/ledger/account_objects.js +169 -0
- package/lib/ledger/account_offers.d.ts +8 -0
- package/lib/ledger/account_offers.js +67 -0
- package/lib/ledger/account_tx.d.ts +29 -0
- package/lib/ledger/account_tx.js +256 -0
- package/lib/ledger/book_offers.d.ts +11 -0
- package/lib/ledger/book_offers.js +90 -0
- package/lib/ledger/currency.d.ts +27 -0
- package/lib/ledger/currency.js +167 -0
- package/lib/ledger/fee.d.ts +5 -0
- package/lib/ledger/fee.js +45 -0
- package/lib/ledger/gateway_balances.d.ts +13 -0
- package/lib/ledger/gateway_balances.js +101 -0
- package/lib/ledger/index.d.ts +16 -0
- package/lib/ledger/index.js +32 -0
- package/lib/ledger/ledger.d.ts +11 -0
- package/lib/ledger/ledger.js +72 -0
- package/lib/ledger/manifest.d.ts +8 -0
- package/lib/ledger/manifest.js +56 -0
- package/lib/ledger/nft_info.d.ts +4 -0
- package/lib/ledger/nft_info.js +56 -0
- package/lib/ledger/server_info.d.ts +8 -0
- package/lib/ledger/server_info.js +54 -0
- package/lib/ledger/transaction.d.ts +37 -0
- package/lib/ledger/transaction.js +214 -0
- package/lib/ledger/vl.d.ts +10 -0
- package/lib/ledger/vl.js +92 -0
- package/lib/models/account_info.d.ts +122 -0
- package/lib/models/account_info.js +102 -0
- package/lib/models/account_lines.d.ts +24 -0
- package/lib/models/account_lines.js +2 -0
- package/lib/models/account_nfts.d.ts +19 -0
- package/lib/models/account_nfts.js +45 -0
- package/lib/models/account_object.d.ts +38 -0
- package/lib/models/account_object.js +61 -0
- package/lib/models/base_model.d.ts +14 -0
- package/lib/models/base_model.js +2 -0
- package/lib/models/book_offers.d.ts +9 -0
- package/lib/models/book_offers.js +41 -0
- package/lib/models/index.d.ts +23 -0
- package/lib/models/index.js +56 -0
- package/lib/models/ledger.d.ts +6 -0
- package/lib/models/ledger.js +20 -0
- package/lib/models/manifest.d.ts +26 -0
- package/lib/models/manifest.js +187 -0
- package/lib/models/transaction/affected_objects.d.ts +6 -0
- package/lib/models/transaction/affected_objects.js +104 -0
- package/lib/models/transaction/balance_changes.d.ts +7 -0
- package/lib/models/transaction/balance_changes.js +125 -0
- package/lib/models/transaction/channel_changes.d.ts +9 -0
- package/lib/models/transaction/channel_changes.js +57 -0
- package/lib/models/transaction/locked_balance_changes.d.ts +7 -0
- package/lib/models/transaction/locked_balance_changes.js +114 -0
- package/lib/models/transaction/nftoken_changes.d.ts +1 -0
- package/lib/models/transaction/nftoken_changes.js +163 -0
- package/lib/models/transaction/nftoken_offer_changes.d.ts +1 -0
- package/lib/models/transaction/nftoken_offer_changes.js +107 -0
- package/lib/models/transaction/orderbook_changes.d.ts +3 -0
- package/lib/models/transaction/orderbook_changes.js +136 -0
- package/lib/models/transaction/quality.d.ts +2 -0
- package/lib/models/transaction/quality.js +46 -0
- package/lib/models/transaction.d.ts +39 -0
- package/lib/models/transaction.js +45 -0
- package/lib/models/trustline.d.ts +15 -0
- package/lib/models/trustline.js +2 -0
- package/lib/models/utils.d.ts +3 -0
- package/lib/models/utils.js +19 -0
- package/lib/models/vl.d.ts +60 -0
- package/lib/models/vl.js +377 -0
- package/lib/parse/index.d.ts +3 -0
- package/lib/parse/index.js +32 -0
- package/lib/parse/ledger/account-order.d.ts +10 -0
- package/lib/parse/ledger/account-order.js +39 -0
- package/lib/parse/ledger/account-trustline.d.ts +3 -0
- package/lib/parse/ledger/account-trustline.js +27 -0
- package/lib/parse/ledger/amount.d.ts +3 -0
- package/lib/parse/ledger/amount.js +17 -0
- package/lib/parse/ledger/currency-amount.d.ts +3 -0
- package/lib/parse/ledger/currency-amount.js +13 -0
- package/lib/parse/ledger/fields.d.ts +2 -0
- package/lib/parse/ledger/fields.js +42 -0
- package/lib/parse/ledger/flags.d.ts +4 -0
- package/lib/parse/ledger/flags.js +18 -0
- package/lib/parse/ledger/index.d.ts +4 -0
- package/lib/parse/ledger/index.js +25 -0
- package/lib/parse/ledger/ledger.d.ts +2 -0
- package/lib/parse/ledger/ledger.js +61 -0
- package/lib/parse/ledger/memos.d.ts +3 -0
- package/lib/parse/ledger/memos.js +17 -0
- package/lib/parse/ledger/nftoken-flags.d.ts +5 -0
- package/lib/parse/ledger/nftoken-flags.js +8 -0
- package/lib/parse/ledger/nftoken-offer-flags.d.ts +5 -0
- package/lib/parse/ledger/nftoken-offer-flags.js +8 -0
- package/lib/parse/ledger/orderbook-order.d.ts +16 -0
- package/lib/parse/ledger/orderbook-order.js +39 -0
- package/lib/parse/ledger/pathfind.d.ts +4 -0
- package/lib/parse/ledger/pathfind.js +41 -0
- package/lib/parse/ledger/payment-channel.d.ts +16 -0
- package/lib/parse/ledger/payment-channel.js +27 -0
- package/lib/parse/ledger/ripple-amount.d.ts +3 -0
- package/lib/parse/ledger/ripple-amount.js +17 -0
- package/lib/parse/outcome/affected_objects.d.ts +6 -0
- package/lib/parse/outcome/affected_objects.js +109 -0
- package/lib/parse/outcome/balance_changes.d.ts +7 -0
- package/lib/parse/outcome/balance_changes.js +103 -0
- package/lib/parse/outcome/channel_changes.d.ts +9 -0
- package/lib/parse/outcome/channel_changes.js +53 -0
- package/lib/parse/outcome/index.d.ts +7 -0
- package/lib/parse/outcome/index.js +17 -0
- package/lib/parse/outcome/locked_balance_changes.d.ts +7 -0
- package/lib/parse/outcome/locked_balance_changes.js +92 -0
- package/lib/parse/outcome/nftoken_changes.d.ts +1 -0
- package/lib/parse/outcome/nftoken_changes.js +143 -0
- package/lib/parse/outcome/nftoken_offer_changes.d.ts +2 -0
- package/lib/parse/outcome/nftoken_offer_changes.js +107 -0
- package/lib/parse/outcome/orderbook_changes.d.ts +3 -0
- package/lib/parse/outcome/orderbook_changes.js +111 -0
- package/lib/parse/outcome/orderbook_quality.d.ts +2 -0
- package/lib/parse/outcome/orderbook_quality.js +45 -0
- package/lib/parse/outcome.d.ts +3 -0
- package/lib/parse/outcome.js +80 -0
- package/lib/parse/specification/account-delete.d.ts +3 -0
- package/lib/parse/specification/account-delete.js +42 -0
- package/lib/parse/specification/amendment.d.ts +3 -0
- package/lib/parse/specification/amendment.js +14 -0
- package/lib/parse/specification/check-cancel.d.ts +3 -0
- package/lib/parse/specification/check-cancel.js +39 -0
- package/lib/parse/specification/check-cash.d.ts +3 -0
- package/lib/parse/specification/check-cash.js +42 -0
- package/lib/parse/specification/check-create.d.ts +3 -0
- package/lib/parse/specification/check-create.js +45 -0
- package/lib/parse/specification/deposit-preauth.d.ts +3 -0
- package/lib/parse/specification/deposit-preauth.js +40 -0
- package/lib/parse/specification/escrow-cancel.d.ts +3 -0
- package/lib/parse/specification/escrow-cancel.js +40 -0
- package/lib/parse/specification/escrow-create.d.ts +3 -0
- package/lib/parse/specification/escrow-create.js +47 -0
- package/lib/parse/specification/escrow-finish.d.ts +3 -0
- package/lib/parse/specification/escrow-finish.js +42 -0
- package/lib/parse/specification/fee-update.d.ts +3 -0
- package/lib/parse/specification/fee-update.js +19 -0
- package/lib/parse/specification/nftoken-accept-offer.d.ts +3 -0
- package/lib/parse/specification/nftoken-accept-offer.js +41 -0
- package/lib/parse/specification/nftoken-burn.d.ts +3 -0
- package/lib/parse/specification/nftoken-burn.js +40 -0
- package/lib/parse/specification/nftoken-cancel-offer.d.ts +3 -0
- package/lib/parse/specification/nftoken-cancel-offer.js +39 -0
- package/lib/parse/specification/nftoken-create-offer.d.ts +3 -0
- package/lib/parse/specification/nftoken-create-offer.js +50 -0
- package/lib/parse/specification/nftoken-mint.d.ts +3 -0
- package/lib/parse/specification/nftoken-mint.js +44 -0
- package/lib/parse/specification/offer-cancel.d.ts +3 -0
- package/lib/parse/specification/offer-cancel.js +38 -0
- package/lib/parse/specification/offer-create.d.ts +3 -0
- package/lib/parse/specification/offer-create.js +53 -0
- package/lib/parse/specification/payment-channel-claim.d.ts +3 -0
- package/lib/parse/specification/payment-channel-claim.js +47 -0
- package/lib/parse/specification/payment-channel-create.d.ts +3 -0
- package/lib/parse/specification/payment-channel-create.js +47 -0
- package/lib/parse/specification/payment-channel-fund.d.ts +3 -0
- package/lib/parse/specification/payment-channel-fund.js +43 -0
- package/lib/parse/specification/payment-channel.d.ts +16 -0
- package/lib/parse/specification/payment-channel.js +27 -0
- package/lib/parse/specification/payment.d.ts +3 -0
- package/lib/parse/specification/payment.js +67 -0
- package/lib/parse/specification/settings.d.ts +2 -0
- package/lib/parse/specification/settings.js +80 -0
- package/lib/parse/specification/ticket-create.d.ts +3 -0
- package/lib/parse/specification/ticket-create.js +39 -0
- package/lib/parse/specification/trustline.d.ts +3 -0
- package/lib/parse/specification/trustline.js +57 -0
- package/lib/parse/transaction.d.ts +27 -0
- package/lib/parse/transaction.js +114 -0
- package/lib/parse/utils.d.ts +6 -0
- package/lib/parse/utils.js +38 -0
- package/lib/types/amounts.d.ts +16 -0
- package/lib/types/amounts.js +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +2 -0
- package/lib/v1/common/constants.d.ts +16 -0
- package/lib/v1/common/constants.js +6 -0
- package/lib/v1/common/errors/index.d.ts +3 -0
- package/lib/v1/common/errors/index.js +7 -0
- package/lib/v1/common/errors/ripple_error.d.ts +9 -0
- package/lib/v1/common/errors/ripple_error.js +28 -0
- package/lib/v1/common/errors/utils.d.ts +2 -0
- package/lib/v1/common/errors/utils.js +19 -0
- package/lib/v1/common/errors/validation_error.d.ts +4 -0
- package/lib/v1/common/errors/validation_error.js +7 -0
- package/lib/v1/common/index.d.ts +3 -0
- package/lib/v1/common/index.js +31 -0
- package/lib/v1/common/txflags.d.ts +51 -0
- package/lib/v1/common/txflags.js +55 -0
- package/lib/v1/common/types/commands/account_info.d.ts +17 -0
- package/lib/v1/common/types/commands/account_info.js +2 -0
- package/lib/v1/common/types/commands/account_lines.d.ts +17 -0
- package/lib/v1/common/types/commands/account_lines.js +2 -0
- package/lib/v1/common/types/commands/account_objects.d.ts +26 -0
- package/lib/v1/common/types/commands/account_objects.js +2 -0
- package/lib/v1/common/types/commands/account_offers.d.ts +24 -0
- package/lib/v1/common/types/commands/account_offers.js +2 -0
- package/lib/v1/common/types/commands/book_offers.d.ts +23 -0
- package/lib/v1/common/types/commands/book_offers.js +2 -0
- package/lib/v1/common/types/commands/gateway_balances.d.ts +23 -0
- package/lib/v1/common/types/commands/gateway_balances.js +2 -0
- package/lib/v1/common/types/commands/index.d.ts +10 -0
- package/lib/v1/common/types/commands/index.js +26 -0
- package/lib/v1/common/types/commands/ledger.d.ts +18 -0
- package/lib/v1/common/types/commands/ledger.js +2 -0
- package/lib/v1/common/types/commands/ledger_data.d.ts +10 -0
- package/lib/v1/common/types/commands/ledger_data.js +2 -0
- package/lib/v1/common/types/commands/ledger_entry.d.ts +29 -0
- package/lib/v1/common/types/commands/ledger_entry.js +2 -0
- package/lib/v1/common/types/commands/path_find.d.ts +33 -0
- package/lib/v1/common/types/commands/path_find.js +2 -0
- package/lib/v1/common/types/commands/server_info.d.ts +49 -0
- package/lib/v1/common/types/commands/server_info.js +2 -0
- package/lib/v1/common/types/objects/account.d.ts +6 -0
- package/lib/v1/common/types/objects/account.js +2 -0
- package/lib/v1/common/types/objects/adjustments.d.ts +16 -0
- package/lib/v1/common/types/objects/adjustments.js +2 -0
- package/lib/v1/common/types/objects/amendments.d.ts +4 -0
- package/lib/v1/common/types/objects/amendments.js +2 -0
- package/lib/v1/common/types/objects/amounts.d.ts +13 -0
- package/lib/v1/common/types/objects/amounts.js +2 -0
- package/lib/v1/common/types/objects/checks.d.ts +17 -0
- package/lib/v1/common/types/objects/checks.js +2 -0
- package/lib/v1/common/types/objects/deposits.d.ts +5 -0
- package/lib/v1/common/types/objects/deposits.js +2 -0
- package/lib/v1/common/types/objects/escrows.d.ts +21 -0
- package/lib/v1/common/types/objects/escrows.js +2 -0
- package/lib/v1/common/types/objects/fees.d.ts +7 -0
- package/lib/v1/common/types/objects/fees.js +2 -0
- package/lib/v1/common/types/objects/flags.d.ts +5 -0
- package/lib/v1/common/types/objects/flags.js +8 -0
- package/lib/v1/common/types/objects/index.d.ts +15 -0
- package/lib/v1/common/types/objects/index.js +31 -0
- package/lib/v1/common/types/objects/ledger.d.ts +45 -0
- package/lib/v1/common/types/objects/ledger.js +2 -0
- package/lib/v1/common/types/objects/ledger_data.d.ts +10 -0
- package/lib/v1/common/types/objects/ledger_data.js +2 -0
- package/lib/v1/common/types/objects/ledger_entries.d.ts +158 -0
- package/lib/v1/common/types/objects/ledger_entries.js +2 -0
- package/lib/v1/common/types/objects/memos.d.ts +12 -0
- package/lib/v1/common/types/objects/memos.js +2 -0
- package/lib/v1/common/types/objects/nftokens.d.ts +47 -0
- package/lib/v1/common/types/objects/nftokens.js +13 -0
- package/lib/v1/common/types/objects/offers.d.ts +15 -0
- package/lib/v1/common/types/objects/offers.js +2 -0
- package/lib/v1/common/types/objects/orders.d.ts +13 -0
- package/lib/v1/common/types/objects/orders.js +2 -0
- package/lib/v1/common/types/objects/path_find.d.ts +27 -0
- package/lib/v1/common/types/objects/path_find.js +2 -0
- package/lib/v1/common/types/objects/payment_channels.d.ts +25 -0
- package/lib/v1/common/types/objects/payment_channels.js +2 -0
- package/lib/v1/common/types/objects/payments.d.ts +20 -0
- package/lib/v1/common/types/objects/payments.js +2 -0
- package/lib/v1/common/types/objects/queue_data.d.ts +15 -0
- package/lib/v1/common/types/objects/queue_data.js +2 -0
- package/lib/v1/common/types/objects/settings.d.ts +34 -0
- package/lib/v1/common/types/objects/settings.js +2 -0
- package/lib/v1/common/types/objects/signers.d.ts +6 -0
- package/lib/v1/common/types/objects/signers.js +2 -0
- package/lib/v1/common/types/objects/specification.d.ts +4 -0
- package/lib/v1/common/types/objects/specification.js +2 -0
- package/lib/v1/common/types/objects/tickets.d.ts +4 -0
- package/lib/v1/common/types/objects/tickets.js +2 -0
- package/lib/v1/common/types/objects/transactions.d.ts +21 -0
- package/lib/v1/common/types/objects/transactions.js +2 -0
- package/lib/v1/common/types/objects/trustlines.d.ts +38 -0
- package/lib/v1/common/types/objects/trustlines.js +2 -0
- package/lib/v1/common/types/pathfind-types.d.ts +59 -0
- package/lib/v1/common/types/pathfind-types.js +2 -0
- package/lib/v1/common/utils.d.ts +6 -0
- package/lib/v1/common/utils.js +58 -0
- package/lib/v1/index.d.ts +2 -0
- package/lib/v1/index.js +28 -0
- package/lib/v1/ledger/index.d.ts +1 -0
- package/lib/v1/ledger/index.js +27 -0
- package/lib/v1/ledger/parse/account-delete.d.ts +7 -0
- package/lib/v1/ledger/parse/account-delete.js +42 -0
- package/lib/v1/ledger/parse/account-order.d.ts +10 -0
- package/lib/v1/ledger/parse/account-order.js +39 -0
- package/lib/v1/ledger/parse/account-trustline.d.ts +3 -0
- package/lib/v1/ledger/parse/account-trustline.js +27 -0
- package/lib/v1/ledger/parse/amendment.d.ts +5 -0
- package/lib/v1/ledger/parse/amendment.js +14 -0
- package/lib/v1/ledger/parse/amount.d.ts +3 -0
- package/lib/v1/ledger/parse/amount.js +40 -0
- package/lib/v1/ledger/parse/cancellation.d.ts +2 -0
- package/lib/v1/ledger/parse/cancellation.js +38 -0
- package/lib/v1/ledger/parse/check-cancel.d.ts +5 -0
- package/lib/v1/ledger/parse/check-cancel.js +39 -0
- package/lib/v1/ledger/parse/check-cash.d.ts +8 -0
- package/lib/v1/ledger/parse/check-cash.js +42 -0
- package/lib/v1/ledger/parse/check-create.d.ts +10 -0
- package/lib/v1/ledger/parse/check-create.js +45 -0
- package/lib/v1/ledger/parse/currency-amount.d.ts +3 -0
- package/lib/v1/ledger/parse/currency-amount.js +13 -0
- package/lib/v1/ledger/parse/deposit-preauth.d.ts +6 -0
- package/lib/v1/ledger/parse/deposit-preauth.js +40 -0
- package/lib/v1/ledger/parse/escrow-cancellation.d.ts +2 -0
- package/lib/v1/ledger/parse/escrow-cancellation.js +40 -0
- package/lib/v1/ledger/parse/escrow-creation.d.ts +2 -0
- package/lib/v1/ledger/parse/escrow-creation.js +47 -0
- package/lib/v1/ledger/parse/escrow-execution.d.ts +2 -0
- package/lib/v1/ledger/parse/escrow-execution.js +42 -0
- package/lib/v1/ledger/parse/fee-update.d.ts +8 -0
- package/lib/v1/ledger/parse/fee-update.js +19 -0
- package/lib/v1/ledger/parse/fields.d.ts +2 -0
- package/lib/v1/ledger/parse/fields.js +42 -0
- package/lib/v1/ledger/parse/flags.d.ts +15 -0
- package/lib/v1/ledger/parse/flags.js +19 -0
- package/lib/v1/ledger/parse/index.d.ts +4 -0
- package/lib/v1/ledger/parse/index.js +25 -0
- package/lib/v1/ledger/parse/ledger.d.ts +18 -0
- package/lib/v1/ledger/parse/ledger.js +77 -0
- package/lib/v1/ledger/parse/memos.d.ts +3 -0
- package/lib/v1/ledger/parse/memos.js +17 -0
- package/lib/v1/ledger/parse/order.d.ts +3 -0
- package/lib/v1/ledger/parse/order.js +53 -0
- package/lib/v1/ledger/parse/orderbook-order.d.ts +16 -0
- package/lib/v1/ledger/parse/orderbook-order.js +66 -0
- package/lib/v1/ledger/parse/pathfind.d.ts +3 -0
- package/lib/v1/ledger/parse/pathfind.js +66 -0
- package/lib/v1/ledger/parse/payment-channel-claim.d.ts +2 -0
- package/lib/v1/ledger/parse/payment-channel-claim.js +47 -0
- package/lib/v1/ledger/parse/payment-channel-create.d.ts +2 -0
- package/lib/v1/ledger/parse/payment-channel-create.js +47 -0
- package/lib/v1/ledger/parse/payment-channel-fund.d.ts +2 -0
- package/lib/v1/ledger/parse/payment-channel-fund.js +43 -0
- package/lib/v1/ledger/parse/payment-channel.d.ts +16 -0
- package/lib/v1/ledger/parse/payment-channel.js +27 -0
- package/lib/v1/ledger/parse/payment.d.ts +2 -0
- package/lib/v1/ledger/parse/payment.js +69 -0
- package/lib/v1/ledger/parse/ripple-amount.d.ts +3 -0
- package/lib/v1/ledger/parse/ripple-amount.js +40 -0
- package/lib/v1/ledger/parse/settings.d.ts +2 -0
- package/lib/v1/ledger/parse/settings.js +82 -0
- package/lib/v1/ledger/parse/ticket-create.d.ts +2 -0
- package/lib/v1/ledger/parse/ticket-create.js +39 -0
- package/lib/v1/ledger/parse/transaction.d.ts +3 -0
- package/lib/v1/ledger/parse/transaction.js +110 -0
- package/lib/v1/ledger/parse/trustline.d.ts +2 -0
- package/lib/v1/ledger/parse/trustline.js +57 -0
- package/lib/v1/ledger/parse/utils.d.ts +6 -0
- package/lib/v1/ledger/parse/utils.js +63 -0
- package/lib/v1/ledger/parse_outcome.d.ts +2 -0
- package/lib/v1/ledger/parse_outcome.js +80 -0
- package/lib/v1/ledger/pathfind-types.d.ts +59 -0
- package/lib/v1/ledger/pathfind-types.js +2 -0
- package/lib/v1/transaction/payment.d.ts +14 -0
- package/lib/v1/transaction/payment.js +130 -0
- package/lib/v1/transaction/types.d.ts +40 -0
- package/lib/v1/transaction/types.js +2 -0
- package/lib/v1/transaction/utils.d.ts +8 -0
- package/lib/v1/transaction/utils.js +38 -0
- package/lib/validator.d.ts +12 -0
- package/lib/validator.js +134 -0
- package/lib/wallet.d.ts +17 -0
- package/lib/wallet.js +140 -0
- package/package.json +62 -0
|
@@ -0,0 +1,369 @@
|
|
|
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.Connection = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const events_1 = require("events");
|
|
9
|
+
const xrpl_1 = require("xrpl");
|
|
10
|
+
const ledger_1 = require("./models/ledger");
|
|
11
|
+
const common_1 = require("./common");
|
|
12
|
+
const LEDGER_CLOSED_TIMEOUT = 1000 * 15;
|
|
13
|
+
class Connection extends events_1.EventEmitter {
|
|
14
|
+
constructor(url, type, options = {}) {
|
|
15
|
+
super();
|
|
16
|
+
this.shutdown = false;
|
|
17
|
+
this.connectionTimer = null;
|
|
18
|
+
this.shutdown = false;
|
|
19
|
+
this.url = url;
|
|
20
|
+
this.hash = crypto_1.default.createHash("sha256").update(url).digest("hex");
|
|
21
|
+
this.type = type;
|
|
22
|
+
if (typeof this.type === "string") {
|
|
23
|
+
this.types = this.type.split(",").map((v) => v.trim());
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.types = [];
|
|
27
|
+
}
|
|
28
|
+
this.latency = [];
|
|
29
|
+
this.client = null;
|
|
30
|
+
this.logger = options.logger;
|
|
31
|
+
this.timeout = options.timeout;
|
|
32
|
+
this.connectionTimeout = options.connectionTimeout;
|
|
33
|
+
this.streams = {
|
|
34
|
+
ledger: 1,
|
|
35
|
+
};
|
|
36
|
+
this.accounts = {};
|
|
37
|
+
this.streamsSubscribed = false;
|
|
38
|
+
}
|
|
39
|
+
async connect() {
|
|
40
|
+
try {
|
|
41
|
+
if (this.client) {
|
|
42
|
+
this.client.disconnect();
|
|
43
|
+
}
|
|
44
|
+
this.client = new xrpl_1.Client(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
|
|
45
|
+
this.setupEmitter();
|
|
46
|
+
await this.client.connect();
|
|
47
|
+
await this.subscribe();
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
this.logger?.warn({
|
|
51
|
+
service: "Bithomp::XRPL::Connection",
|
|
52
|
+
function: "connect",
|
|
53
|
+
url: this.url,
|
|
54
|
+
error: err?.message || err?.name || err,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
this.connectionValidation();
|
|
58
|
+
}
|
|
59
|
+
async disconnect() {
|
|
60
|
+
this.shutdown = true;
|
|
61
|
+
await this.unsubscribe();
|
|
62
|
+
await this.client?.disconnect();
|
|
63
|
+
delete this.client;
|
|
64
|
+
clearTimeout(this.connectionTimer);
|
|
65
|
+
}
|
|
66
|
+
async request(request, options) {
|
|
67
|
+
try {
|
|
68
|
+
if (options?.skip_subscription_update !== true &&
|
|
69
|
+
(request.command === "subscribe" || request.command === "unsubscribe")) {
|
|
70
|
+
return this.updateSubscriptions(request);
|
|
71
|
+
}
|
|
72
|
+
if (!this.client || !this.isConnected()) {
|
|
73
|
+
return { error: "Not connected" };
|
|
74
|
+
}
|
|
75
|
+
const startDate = new Date();
|
|
76
|
+
const response = await this.client.request(request);
|
|
77
|
+
const endDate = new Date();
|
|
78
|
+
this.updateLatency(endDate.getTime() - startDate.getTime());
|
|
79
|
+
return response;
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
this.updateLatency(1000);
|
|
83
|
+
this.logger?.debug({
|
|
84
|
+
service: "Bithomp::XRPL::Connection",
|
|
85
|
+
function: "request",
|
|
86
|
+
url: this.url,
|
|
87
|
+
error: err?.message || err?.name || err,
|
|
88
|
+
});
|
|
89
|
+
if (err.data) {
|
|
90
|
+
return err.data;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return { error: err?.message || err?.name || err };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async submit(transaction) {
|
|
98
|
+
try {
|
|
99
|
+
return await this.request({ command: "submit", tx_blob: transaction, fail_hard: true });
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
this.updateLatency(1000);
|
|
103
|
+
this.logger?.debug({
|
|
104
|
+
service: "Bithomp::XRPL::Connection",
|
|
105
|
+
function: "submit",
|
|
106
|
+
url: this.url,
|
|
107
|
+
error: err?.message || err?.name || err,
|
|
108
|
+
});
|
|
109
|
+
if (err.data) {
|
|
110
|
+
return err.data;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return { error: err?.message || err?.name || err };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
isConnected() {
|
|
118
|
+
if (!this.client) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return this.client.isConnected();
|
|
122
|
+
}
|
|
123
|
+
getLatencyMs() {
|
|
124
|
+
return this.latency.map((info) => info.delta).reduce((a, b) => a + b, 0) / this.latency.length || 0;
|
|
125
|
+
}
|
|
126
|
+
updateLatency(delta) {
|
|
127
|
+
this.latency.push({
|
|
128
|
+
timestamp: new Date(),
|
|
129
|
+
delta,
|
|
130
|
+
});
|
|
131
|
+
this.latency.splice(0, this.latency.length - 10);
|
|
132
|
+
}
|
|
133
|
+
async reconnect() {
|
|
134
|
+
this.logger?.debug({
|
|
135
|
+
service: "Bithomp::XRPL::Connection",
|
|
136
|
+
function: "reconnect",
|
|
137
|
+
url: this.url,
|
|
138
|
+
shutdown: this.shutdown,
|
|
139
|
+
});
|
|
140
|
+
if (!this.shutdown) {
|
|
141
|
+
this.emit("reconnect");
|
|
142
|
+
try {
|
|
143
|
+
if (this.client) {
|
|
144
|
+
await this.client.disconnect();
|
|
145
|
+
}
|
|
146
|
+
await this.connect();
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
this.logger?.warn({
|
|
150
|
+
service: "Bithomp::XRPL::Connection",
|
|
151
|
+
function: "reconnect",
|
|
152
|
+
error: e.message,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
this.connectionValidation();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
setupEmitter() {
|
|
159
|
+
if (!this.client) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.client.on("connected", () => {
|
|
163
|
+
this.logger?.debug({
|
|
164
|
+
service: "Bithomp::XRPL::Connection",
|
|
165
|
+
emit: "connected",
|
|
166
|
+
url: this.url,
|
|
167
|
+
});
|
|
168
|
+
this.emit("connected");
|
|
169
|
+
});
|
|
170
|
+
this.client.on("disconnected", (code) => {
|
|
171
|
+
this.logger?.debug({
|
|
172
|
+
service: "Bithomp::XRPL::Connection",
|
|
173
|
+
emit: "disconnected",
|
|
174
|
+
code,
|
|
175
|
+
url: this.url,
|
|
176
|
+
});
|
|
177
|
+
this.streamsSubscribed = false;
|
|
178
|
+
this.emit("disconnected", code);
|
|
179
|
+
});
|
|
180
|
+
this.client.on("error", (source, message, error) => {
|
|
181
|
+
this.logger?.error({
|
|
182
|
+
service: "Bithomp::XRPL::Connection",
|
|
183
|
+
emit: "error",
|
|
184
|
+
source,
|
|
185
|
+
error: message || error?.name || error,
|
|
186
|
+
});
|
|
187
|
+
try {
|
|
188
|
+
this.emit("error", source, message, error);
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
this.logger?.warn({
|
|
192
|
+
service: "Bithomp::XRPL::Connection",
|
|
193
|
+
emit: "error",
|
|
194
|
+
url: this.url,
|
|
195
|
+
error: err?.message || err?.name || err,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
this.client.on("ledgerClosed", (ledgerStream) => {
|
|
200
|
+
const time = new Date().getTime();
|
|
201
|
+
const ledgerTime = (0, ledger_1.ledgerTimeToTimestamp)(ledgerStream.ledger_time);
|
|
202
|
+
if (ledgerTime < time) {
|
|
203
|
+
this.updateLatency(time - ledgerTime);
|
|
204
|
+
}
|
|
205
|
+
this.connectionValidation();
|
|
206
|
+
this.emit("ledgerClosed", ledgerStream);
|
|
207
|
+
});
|
|
208
|
+
this.client.on("transaction", (transactionStream) => {
|
|
209
|
+
this.emit("transaction", transactionStream);
|
|
210
|
+
});
|
|
211
|
+
this.client.on("validationReceived", (validation) => {
|
|
212
|
+
this.emit("validationReceived", validation);
|
|
213
|
+
});
|
|
214
|
+
this.client.on("peerStatusChange", (status) => {
|
|
215
|
+
this.emit("peerStatusChange", status);
|
|
216
|
+
});
|
|
217
|
+
this.client.on("consensusPhase", (consensus) => {
|
|
218
|
+
this.emit("consensusPhase", consensus);
|
|
219
|
+
});
|
|
220
|
+
this.client.on("path_find", (path) => {
|
|
221
|
+
this.emit("path_find", path);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async updateSubscriptions(request) {
|
|
225
|
+
if (request.command === "subscribe") {
|
|
226
|
+
const addStreams = [];
|
|
227
|
+
const addAccounts = [];
|
|
228
|
+
if (request.streams) {
|
|
229
|
+
for (const stream of request.streams) {
|
|
230
|
+
if (this.streams[stream] === undefined) {
|
|
231
|
+
this.streams[stream] = 1;
|
|
232
|
+
addStreams.push(stream);
|
|
233
|
+
}
|
|
234
|
+
else if (stream !== "ledger") {
|
|
235
|
+
this.streams[stream]++;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (request.accounts) {
|
|
240
|
+
for (const account of request.accounts) {
|
|
241
|
+
if (this.accounts[account] === undefined) {
|
|
242
|
+
this.accounts[account] = 1;
|
|
243
|
+
addAccounts.push(account);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this.accounts[account]++;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (addStreams.length > 0 || addAccounts.length > 0) {
|
|
251
|
+
return await this.subscribe(addStreams, addAccounts);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else if (request.command === "unsubscribe") {
|
|
255
|
+
const removeStreams = [];
|
|
256
|
+
const removeAccounts = [];
|
|
257
|
+
if (request.streams) {
|
|
258
|
+
for (const stream of request.streams) {
|
|
259
|
+
if (this.streams[stream] === undefined) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (stream !== "ledger") {
|
|
263
|
+
this.streams[stream]--;
|
|
264
|
+
}
|
|
265
|
+
if (this.streams[stream] === 0) {
|
|
266
|
+
delete this.streams[stream];
|
|
267
|
+
removeStreams.push(stream);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (request.accounts) {
|
|
272
|
+
for (const account of request.accounts) {
|
|
273
|
+
if (this.accounts[account] === undefined) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
this.accounts[account]--;
|
|
277
|
+
if (this.accounts[account] === 0) {
|
|
278
|
+
delete this.accounts[account];
|
|
279
|
+
removeAccounts.push(account);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (removeStreams.length > 0 || removeAccounts.length > 0) {
|
|
284
|
+
return await this.unsubscribe(removeStreams, removeAccounts);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return { status: "success" };
|
|
288
|
+
}
|
|
289
|
+
async subscribe(streams, accounts) {
|
|
290
|
+
if (this.streamsSubscribed === true && streams === undefined && accounts === undefined) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
streams = streams || Object.keys(this.streams);
|
|
294
|
+
accounts = accounts || Object.keys(this.accounts);
|
|
295
|
+
const request = { command: "subscribe" };
|
|
296
|
+
if (streams.length > 0) {
|
|
297
|
+
request.streams = streams;
|
|
298
|
+
}
|
|
299
|
+
if (accounts.length > 0) {
|
|
300
|
+
request.accounts = accounts;
|
|
301
|
+
}
|
|
302
|
+
const result = await this.request(request, { skip_subscription_update: true });
|
|
303
|
+
if (result.result) {
|
|
304
|
+
this.streamsSubscribed = true;
|
|
305
|
+
}
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
async unsubscribe(streams, accounts) {
|
|
309
|
+
if (streams === undefined && accounts === undefined) {
|
|
310
|
+
this.streamsSubscribed = false;
|
|
311
|
+
}
|
|
312
|
+
streams = streams || Object.keys(this.streams);
|
|
313
|
+
accounts = accounts || Object.keys(this.accounts);
|
|
314
|
+
const request = { command: "unsubscribe" };
|
|
315
|
+
if (streams.length > 0) {
|
|
316
|
+
request.streams = streams;
|
|
317
|
+
}
|
|
318
|
+
if (accounts.length > 0) {
|
|
319
|
+
request.accounts = accounts;
|
|
320
|
+
}
|
|
321
|
+
return await this.request(request, { skip_subscription_update: true });
|
|
322
|
+
}
|
|
323
|
+
connectionValidation() {
|
|
324
|
+
this.logger?.debug({
|
|
325
|
+
service: "Bithomp::XRPL::Connection",
|
|
326
|
+
function: "connectionValidation",
|
|
327
|
+
url: this.url,
|
|
328
|
+
shutdown: this.shutdown,
|
|
329
|
+
});
|
|
330
|
+
if (this.connectionTimer !== null) {
|
|
331
|
+
clearTimeout(this.connectionTimer);
|
|
332
|
+
this.connectionTimer = null;
|
|
333
|
+
}
|
|
334
|
+
if (!this.shutdown) {
|
|
335
|
+
if (this.streamsSubscribed === false) {
|
|
336
|
+
this.subscribe();
|
|
337
|
+
}
|
|
338
|
+
this.connectionTimer = setTimeout(() => {
|
|
339
|
+
this.connectionValidationTimeout();
|
|
340
|
+
}, LEDGER_CLOSED_TIMEOUT);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
this.client?.disconnect();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
async connectionValidationTimeout() {
|
|
347
|
+
this.logger?.debug({
|
|
348
|
+
service: "Bithomp::XRPL::Connection",
|
|
349
|
+
function: "connectionValidationTimeout",
|
|
350
|
+
url: this.url,
|
|
351
|
+
timeout: LEDGER_CLOSED_TIMEOUT,
|
|
352
|
+
shutdown: this.shutdown,
|
|
353
|
+
});
|
|
354
|
+
this.connectionTimer = null;
|
|
355
|
+
this.updateLatency(LEDGER_CLOSED_TIMEOUT);
|
|
356
|
+
try {
|
|
357
|
+
await this.reconnect();
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
360
|
+
this.logger?.warn({
|
|
361
|
+
service: "Bithomp::XRPL::Connection",
|
|
362
|
+
function: "connectionValidationTimeout",
|
|
363
|
+
error: e.message,
|
|
364
|
+
});
|
|
365
|
+
this.connectionValidation();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
exports.Connection = Connection;
|
package/lib/faucet.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
interface FaucetNetworkInterface {
|
|
2
|
+
url: string;
|
|
3
|
+
format?: string;
|
|
4
|
+
}
|
|
5
|
+
interface AxiosFaucetOptionsDataInterface {
|
|
6
|
+
destination: string;
|
|
7
|
+
}
|
|
8
|
+
interface AxiosFaucetOptionsInterface {
|
|
9
|
+
method: string;
|
|
10
|
+
url: string;
|
|
11
|
+
data?: AxiosFaucetOptionsDataInterface;
|
|
12
|
+
}
|
|
13
|
+
interface XrplLabsSuccessResponseInterface {
|
|
14
|
+
address: string;
|
|
15
|
+
secret: string;
|
|
16
|
+
xrp: number;
|
|
17
|
+
hash: string;
|
|
18
|
+
code: string;
|
|
19
|
+
}
|
|
20
|
+
interface XrplSuccessResponseAccountInterface {
|
|
21
|
+
xAddress: string;
|
|
22
|
+
secret?: string;
|
|
23
|
+
classicAddress: string;
|
|
24
|
+
address: string;
|
|
25
|
+
}
|
|
26
|
+
interface XrplSuccessResponseInterface {
|
|
27
|
+
account: XrplSuccessResponseAccountInterface;
|
|
28
|
+
amount: number;
|
|
29
|
+
balance: number;
|
|
30
|
+
hash?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const FaucetNetworks: {
|
|
33
|
+
test: {
|
|
34
|
+
url: string;
|
|
35
|
+
format: string;
|
|
36
|
+
};
|
|
37
|
+
dev: {
|
|
38
|
+
url: string;
|
|
39
|
+
format: string;
|
|
40
|
+
};
|
|
41
|
+
beta: {
|
|
42
|
+
url: string;
|
|
43
|
+
format: string;
|
|
44
|
+
};
|
|
45
|
+
"hooks-testnet-v3": {
|
|
46
|
+
url: string;
|
|
47
|
+
format: string;
|
|
48
|
+
};
|
|
49
|
+
amm: {
|
|
50
|
+
url: string;
|
|
51
|
+
format: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare function getFaucetNetwork(network: string): FaucetNetworkInterface | undefined;
|
|
55
|
+
export declare function foundWallet(network: string | FaucetNetworkInterface, account?: string): Promise<any>;
|
|
56
|
+
export declare function getAxiosFaucetOptions(network: FaucetNetworkInterface, account?: string): AxiosFaucetOptionsInterface;
|
|
57
|
+
export declare function xrplLabsToXrplResponse(data: XrplLabsSuccessResponseInterface): XrplSuccessResponseInterface;
|
|
58
|
+
export {};
|
package/lib/faucet.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
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.xrplLabsToXrplResponse = exports.getAxiosFaucetOptions = exports.foundWallet = exports.getFaucetNetwork = exports.FaucetNetworks = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const AddressCodec = require("ripple-address-codec");
|
|
9
|
+
exports.FaucetNetworks = {
|
|
10
|
+
test: {
|
|
11
|
+
url: "https://faucet.altnet.rippletest.net/accounts",
|
|
12
|
+
format: "xrpl",
|
|
13
|
+
},
|
|
14
|
+
dev: {
|
|
15
|
+
url: "https://faucet.devnet.rippletest.net/accounts",
|
|
16
|
+
format: "xrpl",
|
|
17
|
+
},
|
|
18
|
+
beta: {
|
|
19
|
+
url: "https://hooks-testnet-v3.xrpl-labs.com/newcreds",
|
|
20
|
+
format: "xrpl-labs",
|
|
21
|
+
},
|
|
22
|
+
"hooks-testnet-v3": {
|
|
23
|
+
url: "https://hooks-testnet-v3.xrpl-labs.com/newcreds",
|
|
24
|
+
format: "xrpl-labs",
|
|
25
|
+
},
|
|
26
|
+
amm: {
|
|
27
|
+
url: "https://ammfaucet.devnet.rippletest.net/accounts",
|
|
28
|
+
format: "xrpl",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
function getFaucetNetwork(network) {
|
|
32
|
+
if (network in exports.FaucetNetworks) {
|
|
33
|
+
return exports.FaucetNetworks[network];
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
exports.getFaucetNetwork = getFaucetNetwork;
|
|
38
|
+
async function foundWallet(network, account) {
|
|
39
|
+
if (typeof network === "string") {
|
|
40
|
+
network = getFaucetNetwork(network);
|
|
41
|
+
}
|
|
42
|
+
if (!network) {
|
|
43
|
+
throw new Error("Invalid network");
|
|
44
|
+
}
|
|
45
|
+
const options = getAxiosFaucetOptions(network, account);
|
|
46
|
+
const data = (await (0, axios_1.default)(options)).data;
|
|
47
|
+
if (network.format === "xrpl-labs" && data.code === "tesSUCCESS") {
|
|
48
|
+
return xrplLabsToXrplResponse(data);
|
|
49
|
+
}
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
exports.foundWallet = foundWallet;
|
|
53
|
+
function getAxiosFaucetOptions(network, account) {
|
|
54
|
+
const options = {
|
|
55
|
+
method: "post",
|
|
56
|
+
url: network.url,
|
|
57
|
+
};
|
|
58
|
+
if (account) {
|
|
59
|
+
if (network.format === "xrpl-labs") {
|
|
60
|
+
options.url += `?account=${account}`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
options.data = { destination: account };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return options;
|
|
67
|
+
}
|
|
68
|
+
exports.getAxiosFaucetOptions = getAxiosFaucetOptions;
|
|
69
|
+
function xrplLabsToXrplResponse(data) {
|
|
70
|
+
const secret = data.secret === "" ? undefined : data.secret;
|
|
71
|
+
const balance = secret ? data.xrp : undefined;
|
|
72
|
+
const response = {
|
|
73
|
+
account: {
|
|
74
|
+
xAddress: AddressCodec.classicAddressToXAddress(data.address, false, true),
|
|
75
|
+
classicAddress: data.address,
|
|
76
|
+
address: data.address,
|
|
77
|
+
},
|
|
78
|
+
amount: data.xrp,
|
|
79
|
+
hash: data.hash,
|
|
80
|
+
};
|
|
81
|
+
if (secret) {
|
|
82
|
+
response.account.secret = secret;
|
|
83
|
+
}
|
|
84
|
+
if (balance) {
|
|
85
|
+
response.balance = balance;
|
|
86
|
+
}
|
|
87
|
+
return response;
|
|
88
|
+
}
|
|
89
|
+
exports.xrplLabsToXrplResponse = xrplLabsToXrplResponse;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as xrpl from "xrpl";
|
|
2
|
+
export * as Client from "./client";
|
|
3
|
+
export * as Models from "./models";
|
|
4
|
+
export * as Wallet from "./wallet";
|
|
5
|
+
export * as Faucet from "./faucet";
|
|
6
|
+
export * as Validator from "./validator";
|
|
7
|
+
export * as Parse from "./parse";
|
|
8
|
+
export * as Common from "./common";
|
|
9
|
+
export * as Types from "./types";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Types = exports.Common = exports.Parse = exports.Validator = exports.Faucet = exports.Wallet = exports.Models = exports.Client = exports.xrpl = void 0;
|
|
27
|
+
exports.xrpl = __importStar(require("xrpl"));
|
|
28
|
+
exports.Client = __importStar(require("./client"));
|
|
29
|
+
exports.Models = __importStar(require("./models"));
|
|
30
|
+
exports.Wallet = __importStar(require("./wallet"));
|
|
31
|
+
exports.Faucet = __importStar(require("./faucet"));
|
|
32
|
+
exports.Validator = __importStar(require("./validator"));
|
|
33
|
+
exports.Parse = __importStar(require("./parse"));
|
|
34
|
+
exports.Common = __importStar(require("./common"));
|
|
35
|
+
exports.Types = __importStar(require("./types"));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Connection } from "../connection";
|
|
2
|
+
import { LedgerIndex } from "../models/ledger";
|
|
3
|
+
import { AccountInfoResponse, AccountInfoDataResponse } from "../models/account_info";
|
|
4
|
+
import { ErrorResponse } from "../models/base_model";
|
|
5
|
+
export interface GetAccountInfoOptions {
|
|
6
|
+
ledgerIndex?: LedgerIndex;
|
|
7
|
+
signerLists?: boolean;
|
|
8
|
+
connection?: Connection;
|
|
9
|
+
}
|
|
10
|
+
export declare function getAccountInfo(account: string, options?: GetAccountInfoOptions): Promise<AccountInfoResponse | ErrorResponse>;
|
|
11
|
+
export declare function getAccountInfoData(account: string, options?: GetAccountInfoOptions): Promise<AccountInfoDataResponse | ErrorResponse>;
|
|
12
|
+
export declare function isActivated(account: string): Promise<boolean>;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.isActivated = exports.getAccountInfoData = exports.getAccountInfo = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
async function getAccountInfo(account, options = {}) {
|
|
29
|
+
const connection = Client.findConnection();
|
|
30
|
+
if (!connection) {
|
|
31
|
+
throw new Error("There is no connection");
|
|
32
|
+
}
|
|
33
|
+
const response = await connection.request({
|
|
34
|
+
command: "account_info",
|
|
35
|
+
account,
|
|
36
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
37
|
+
signer_lists: !!options.signerLists,
|
|
38
|
+
});
|
|
39
|
+
if (!response) {
|
|
40
|
+
return {
|
|
41
|
+
account,
|
|
42
|
+
status: "error",
|
|
43
|
+
error: "invalidResponse",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (response.error) {
|
|
47
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
48
|
+
return {
|
|
49
|
+
account,
|
|
50
|
+
error,
|
|
51
|
+
error_code,
|
|
52
|
+
error_message,
|
|
53
|
+
status,
|
|
54
|
+
validated,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return response?.result;
|
|
58
|
+
}
|
|
59
|
+
exports.getAccountInfo = getAccountInfo;
|
|
60
|
+
async function getAccountInfoData(account, options = {}) {
|
|
61
|
+
const response = await getAccountInfo(account, options);
|
|
62
|
+
if ("error" in response) {
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
return response?.account_data;
|
|
66
|
+
}
|
|
67
|
+
exports.getAccountInfoData = getAccountInfoData;
|
|
68
|
+
async function isActivated(account) {
|
|
69
|
+
const response = await getAccountInfo(account);
|
|
70
|
+
if (!response) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if ("error" in response) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
exports.isActivated = isActivated;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { AccountLinesResponse } from "../models/account_lines";
|
|
3
|
+
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
export interface GetAccountLinesOptions {
|
|
5
|
+
counterparty?: string;
|
|
6
|
+
currency?: string;
|
|
7
|
+
ledgerIndex?: LedgerIndex;
|
|
8
|
+
limit?: number;
|
|
9
|
+
marker?: any;
|
|
10
|
+
}
|
|
11
|
+
export declare function getAccountLines(account: string, options?: GetAccountLinesOptions): Promise<AccountLinesResponse | ErrorResponse>;
|