@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,69 @@
|
|
|
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.getAccountLines = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
const utils_1 = require("../common/utils");
|
|
29
|
+
async function getAccountLines(account, options = {}) {
|
|
30
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
31
|
+
options.marker = marker;
|
|
32
|
+
const connection = Client.findConnection(undefined, undefined, undefined, hash);
|
|
33
|
+
if (!connection) {
|
|
34
|
+
throw new Error("There is no connection");
|
|
35
|
+
}
|
|
36
|
+
const response = await connection.request({
|
|
37
|
+
command: "account_lines",
|
|
38
|
+
account,
|
|
39
|
+
counterparty: options.counterparty,
|
|
40
|
+
currency: options.currency,
|
|
41
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
42
|
+
limit: options.limit,
|
|
43
|
+
});
|
|
44
|
+
if (!response) {
|
|
45
|
+
return {
|
|
46
|
+
account,
|
|
47
|
+
status: "error",
|
|
48
|
+
error: "invalidResponse",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (response.error) {
|
|
52
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
53
|
+
return {
|
|
54
|
+
account,
|
|
55
|
+
error,
|
|
56
|
+
error_code,
|
|
57
|
+
error_message,
|
|
58
|
+
status,
|
|
59
|
+
validated,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const result = response.result;
|
|
63
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
64
|
+
if (newMarker) {
|
|
65
|
+
result.marker = newMarker;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
exports.getAccountLines = getAccountLines;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { ErrorResponse } from "../models/base_model";
|
|
3
|
+
export interface GetAccountNftsOptions {
|
|
4
|
+
ledgerIndex?: LedgerIndex;
|
|
5
|
+
limit?: number;
|
|
6
|
+
marker?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function getAccountNfts(account: string, options?: GetAccountNftsOptions): Promise<object[] | ErrorResponse>;
|
|
9
|
+
interface FindAccountNftsOptions extends GetAccountNftsOptions {
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function findAccountNfts(account: string, options?: FindAccountNftsOptions): Promise<object[] | ErrorResponse>;
|
|
13
|
+
export interface GetAccountNftSellOffersOptions {
|
|
14
|
+
ledgerIndex?: LedgerIndex;
|
|
15
|
+
}
|
|
16
|
+
export declare function getAccountNftSellOffers(nftID: string, options?: GetAccountNftSellOffersOptions): Promise<object[] | ErrorResponse>;
|
|
17
|
+
export interface GetAccountNftBuyOffersOptions {
|
|
18
|
+
ledgerIndex?: LedgerIndex;
|
|
19
|
+
}
|
|
20
|
+
export declare function getAccountNftBuyOffers(nftID: string, options?: GetAccountNftBuyOffersOptions): Promise<object[] | object>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
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.getAccountNftBuyOffers = exports.getAccountNftSellOffers = exports.findAccountNfts = exports.getAccountNfts = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
const account_nfts_1 = require("../models/account_nfts");
|
|
29
|
+
const utils_1 = require("../common/utils");
|
|
30
|
+
async function getAccountNfts(account, options = {}) {
|
|
31
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
32
|
+
options.marker = marker;
|
|
33
|
+
const connection = Client.findConnection(undefined, undefined, undefined, hash);
|
|
34
|
+
if (!connection) {
|
|
35
|
+
throw new Error("There is no connection");
|
|
36
|
+
}
|
|
37
|
+
const response = await connection.request({
|
|
38
|
+
command: "account_nfts",
|
|
39
|
+
account,
|
|
40
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
41
|
+
marker: options.marker,
|
|
42
|
+
});
|
|
43
|
+
if (!response) {
|
|
44
|
+
return {
|
|
45
|
+
account,
|
|
46
|
+
status: "error",
|
|
47
|
+
error: "invalidResponse",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (response.error) {
|
|
51
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
52
|
+
return {
|
|
53
|
+
account,
|
|
54
|
+
error,
|
|
55
|
+
error_code,
|
|
56
|
+
error_message,
|
|
57
|
+
status,
|
|
58
|
+
validated,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const result = response?.result;
|
|
62
|
+
if (!result) {
|
|
63
|
+
return {
|
|
64
|
+
account,
|
|
65
|
+
status: "error",
|
|
66
|
+
error: "invalidResponse",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(result.account_nfts)) {
|
|
70
|
+
result.account_nfts = result.account_nfts.sort(account_nfts_1.sortHelperAccountNFToken);
|
|
71
|
+
}
|
|
72
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
73
|
+
if (newMarker) {
|
|
74
|
+
result.marker = newMarker;
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
exports.getAccountNfts = getAccountNfts;
|
|
79
|
+
async function findAccountNfts(account, options = { timeout: 15000 }) {
|
|
80
|
+
const timeStart = new Date();
|
|
81
|
+
const limit = options.limit;
|
|
82
|
+
let response;
|
|
83
|
+
const accountNfts = [];
|
|
84
|
+
while (true) {
|
|
85
|
+
const currentTime = new Date();
|
|
86
|
+
if (options.timeout && currentTime.getTime() - timeStart.getTime() > options.timeout) {
|
|
87
|
+
options.timeout = currentTime.getTime() - timeStart.getTime();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (options.limit && limit) {
|
|
91
|
+
options.limit = limit - accountNfts.length;
|
|
92
|
+
}
|
|
93
|
+
response = await getAccountNfts(account, options);
|
|
94
|
+
if (!response || response.error) {
|
|
95
|
+
return response;
|
|
96
|
+
}
|
|
97
|
+
accountNfts.push(...response.account_nfts);
|
|
98
|
+
if (limit && accountNfts.length >= limit) {
|
|
99
|
+
response.limit = accountNfts.length;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
if (response.marker) {
|
|
103
|
+
options.marker = response.marker;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (response.error) {
|
|
110
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
111
|
+
return {
|
|
112
|
+
account,
|
|
113
|
+
error,
|
|
114
|
+
error_code,
|
|
115
|
+
error_message,
|
|
116
|
+
status,
|
|
117
|
+
validated,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
response.account_nfts = accountNfts;
|
|
121
|
+
return response;
|
|
122
|
+
}
|
|
123
|
+
exports.findAccountNfts = findAccountNfts;
|
|
124
|
+
async function getAccountNftSellOffers(nftID, options = {}) {
|
|
125
|
+
const connection = Client.findConnection("!clio");
|
|
126
|
+
if (!connection) {
|
|
127
|
+
throw new Error("There is no connection");
|
|
128
|
+
}
|
|
129
|
+
const response = await connection.request({
|
|
130
|
+
command: "nft_sell_offers",
|
|
131
|
+
nft_id: nftID,
|
|
132
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
133
|
+
});
|
|
134
|
+
if (!response) {
|
|
135
|
+
return {
|
|
136
|
+
nft_id: nftID,
|
|
137
|
+
status: "error",
|
|
138
|
+
error: "invalidResponse",
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (response.error) {
|
|
142
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
143
|
+
return {
|
|
144
|
+
nft_id: nftID,
|
|
145
|
+
error,
|
|
146
|
+
error_code,
|
|
147
|
+
error_message,
|
|
148
|
+
status,
|
|
149
|
+
validated,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return response?.result;
|
|
153
|
+
}
|
|
154
|
+
exports.getAccountNftSellOffers = getAccountNftSellOffers;
|
|
155
|
+
async function getAccountNftBuyOffers(nftID, options = {}) {
|
|
156
|
+
const connection = Client.findConnection("!clio");
|
|
157
|
+
if (!connection) {
|
|
158
|
+
throw new Error("There is no connection");
|
|
159
|
+
}
|
|
160
|
+
const response = await connection.request({
|
|
161
|
+
command: "nft_buy_offers",
|
|
162
|
+
nft_id: nftID,
|
|
163
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
164
|
+
});
|
|
165
|
+
if (!response) {
|
|
166
|
+
return {
|
|
167
|
+
nft_id: nftID,
|
|
168
|
+
status: "error",
|
|
169
|
+
error: "invalidResponse",
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (response.error) {
|
|
173
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
174
|
+
return {
|
|
175
|
+
nft_id: nftID,
|
|
176
|
+
error,
|
|
177
|
+
error_code,
|
|
178
|
+
error_message,
|
|
179
|
+
status,
|
|
180
|
+
validated,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return response?.result;
|
|
184
|
+
}
|
|
185
|
+
exports.getAccountNftBuyOffers = getAccountNftBuyOffers;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AccountObjectType, AccountObjectsResponse, AccountNFTObjectsResponse } from "../models/account_object";
|
|
2
|
+
import { AccountLinesResponse } from "../models/account_lines";
|
|
3
|
+
import { ErrorResponse } from "../models/base_model";
|
|
4
|
+
import { LedgerIndex } from "../models/ledger";
|
|
5
|
+
export interface GetAccountObjectsOptions {
|
|
6
|
+
type?: AccountObjectType;
|
|
7
|
+
ledgerHash?: string;
|
|
8
|
+
ledgerIndex?: LedgerIndex;
|
|
9
|
+
limit?: number;
|
|
10
|
+
marker?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getAccountObjects(account: string, options?: GetAccountObjectsOptions): Promise<AccountObjectsResponse | ErrorResponse>;
|
|
13
|
+
export interface GetAccountAllObjectsOptions extends GetAccountObjectsOptions {
|
|
14
|
+
timeout?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function getAccountAllObjects(account: string, options?: GetAccountAllObjectsOptions): Promise<AccountObjectsResponse | ErrorResponse>;
|
|
17
|
+
export interface GetAccountLinesObjectsOptions {
|
|
18
|
+
ledgerHash?: string;
|
|
19
|
+
ledgerIndex?: LedgerIndex;
|
|
20
|
+
}
|
|
21
|
+
export declare function getAccountLinesObjects(account: string, options?: GetAccountLinesObjectsOptions): Promise<AccountLinesResponse | ErrorResponse>;
|
|
22
|
+
export interface GetAccountNFTOffersObjectsOptions {
|
|
23
|
+
ledgerHash?: string;
|
|
24
|
+
ledgerIndex?: LedgerIndex;
|
|
25
|
+
limit?: number;
|
|
26
|
+
marker?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function getAccountNFTOffersObjects(account: string, options?: GetAccountNFTOffersObjectsOptions): Promise<AccountNFTObjectsResponse | ErrorResponse>;
|
|
@@ -0,0 +1,169 @@
|
|
|
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.getAccountNFTOffersObjects = exports.getAccountLinesObjects = exports.getAccountAllObjects = exports.getAccountObjects = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
const account_object_1 = require("../models/account_object");
|
|
29
|
+
const utils_1 = require("../common/utils");
|
|
30
|
+
const OBJECTS_LIMIT_DEFAULT = 200;
|
|
31
|
+
const OBJECTS_LIMIT_MAX = 400;
|
|
32
|
+
const OBJECTS_LIMIT_MIN = 10;
|
|
33
|
+
async function getAccountObjects(account, options = {}) {
|
|
34
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
35
|
+
options.marker = marker;
|
|
36
|
+
const connection = Client.findConnection("account_objects", undefined, undefined, hash);
|
|
37
|
+
if (!connection) {
|
|
38
|
+
throw new Error("There is no connection");
|
|
39
|
+
}
|
|
40
|
+
const request = {
|
|
41
|
+
command: "account_objects",
|
|
42
|
+
account,
|
|
43
|
+
type: options.type,
|
|
44
|
+
ledger_hash: options.ledgerHash,
|
|
45
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
46
|
+
limit: options.limit || OBJECTS_LIMIT_DEFAULT,
|
|
47
|
+
marker: options.marker,
|
|
48
|
+
};
|
|
49
|
+
const response = await connection.request(request);
|
|
50
|
+
if (!response) {
|
|
51
|
+
return {
|
|
52
|
+
account,
|
|
53
|
+
status: "error",
|
|
54
|
+
error: "invalidResponse",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (response.error) {
|
|
58
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
59
|
+
return {
|
|
60
|
+
account,
|
|
61
|
+
error,
|
|
62
|
+
error_code,
|
|
63
|
+
error_message,
|
|
64
|
+
status,
|
|
65
|
+
validated,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const result = response.result;
|
|
69
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
70
|
+
if (newMarker) {
|
|
71
|
+
result.marker = newMarker;
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
exports.getAccountObjects = getAccountObjects;
|
|
76
|
+
async function getAccountAllObjects(account, options = {}) {
|
|
77
|
+
const timeStart = new Date();
|
|
78
|
+
const limit = options.limit;
|
|
79
|
+
let response;
|
|
80
|
+
const accountObjects = [];
|
|
81
|
+
while (true) {
|
|
82
|
+
const currentTime = new Date();
|
|
83
|
+
if (options.timeout && currentTime.getTime() - timeStart.getTime() > options.timeout) {
|
|
84
|
+
options.timeout = currentTime.getTime() - timeStart.getTime();
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (options.limit && limit) {
|
|
88
|
+
const left = limit - accountObjects.length;
|
|
89
|
+
const parts = Math.floor(left / OBJECTS_LIMIT_MAX);
|
|
90
|
+
if (parts === 0) {
|
|
91
|
+
options.limit = left;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
options.limit = left - OBJECTS_LIMIT_MIN;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
response = await getAccountObjects(account, options);
|
|
98
|
+
if (response.error) {
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
accountObjects.push(...response.account_objects);
|
|
102
|
+
if (limit && accountObjects.length >= limit) {
|
|
103
|
+
response.limit = accountObjects.length;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (response.marker) {
|
|
107
|
+
options.marker = response.marker;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (response.error) {
|
|
114
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
115
|
+
return {
|
|
116
|
+
account,
|
|
117
|
+
error,
|
|
118
|
+
error_code,
|
|
119
|
+
error_message,
|
|
120
|
+
status,
|
|
121
|
+
validated,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
response.account_objects = accountObjects;
|
|
125
|
+
return response;
|
|
126
|
+
}
|
|
127
|
+
exports.getAccountAllObjects = getAccountAllObjects;
|
|
128
|
+
async function getAccountLinesObjects(account, options = {}) {
|
|
129
|
+
const response = await getAccountAllObjects(account, {
|
|
130
|
+
type: "state",
|
|
131
|
+
ledgerHash: options.ledgerHash,
|
|
132
|
+
ledgerIndex: options.ledgerIndex,
|
|
133
|
+
});
|
|
134
|
+
if ("error" in response) {
|
|
135
|
+
return response;
|
|
136
|
+
}
|
|
137
|
+
const accountObjects = response.account_objects;
|
|
138
|
+
const accountLines = (0, account_object_1.accountObjectsToAccountLines)(account, accountObjects);
|
|
139
|
+
return {
|
|
140
|
+
account: response.account,
|
|
141
|
+
ledger_hash: response.ledger_hash,
|
|
142
|
+
ledger_index: response.ledger_index,
|
|
143
|
+
validated: response.validated,
|
|
144
|
+
lines: accountLines,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
exports.getAccountLinesObjects = getAccountLinesObjects;
|
|
148
|
+
async function getAccountNFTOffersObjects(account, options = {}) {
|
|
149
|
+
const response = await getAccountAllObjects(account, {
|
|
150
|
+
type: "nft_offer",
|
|
151
|
+
ledgerHash: options.ledgerHash,
|
|
152
|
+
ledgerIndex: options.ledgerIndex,
|
|
153
|
+
limit: options.limit,
|
|
154
|
+
marker: options.marker,
|
|
155
|
+
});
|
|
156
|
+
if ("error" in response) {
|
|
157
|
+
return response;
|
|
158
|
+
}
|
|
159
|
+
const accountObjects = response.account_objects;
|
|
160
|
+
const nftOffers = (0, account_object_1.accountObjectsToNFTOffers)(accountObjects);
|
|
161
|
+
return {
|
|
162
|
+
account: response.account,
|
|
163
|
+
ledger_hash: response.ledger_hash,
|
|
164
|
+
ledger_index: response.ledger_index,
|
|
165
|
+
validated: response.validated,
|
|
166
|
+
nft_offers: nftOffers,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
exports.getAccountNFTOffersObjects = getAccountNFTOffersObjects;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { ErrorResponse } from "../models/base_model";
|
|
3
|
+
export interface GetAccountOffers {
|
|
4
|
+
ledgerIndex?: LedgerIndex;
|
|
5
|
+
limit?: number;
|
|
6
|
+
marker?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function getAccountOffers(account: string, options?: GetAccountOffers): Promise<object | ErrorResponse>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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.getAccountOffers = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
const utils_1 = require("../common/utils");
|
|
29
|
+
async function getAccountOffers(account, options = {}) {
|
|
30
|
+
const { hash, marker } = (0, utils_1.parseMarker)(options.marker);
|
|
31
|
+
options.marker = marker;
|
|
32
|
+
const connection = Client.findConnection(undefined, undefined, undefined, hash);
|
|
33
|
+
if (!connection) {
|
|
34
|
+
throw new Error("There is no connection");
|
|
35
|
+
}
|
|
36
|
+
const response = await connection.request({
|
|
37
|
+
command: "account_offers",
|
|
38
|
+
account,
|
|
39
|
+
ledger_index: options.ledgerIndex || "validated",
|
|
40
|
+
limit: options.limit,
|
|
41
|
+
});
|
|
42
|
+
if (!response) {
|
|
43
|
+
return {
|
|
44
|
+
account,
|
|
45
|
+
status: "error",
|
|
46
|
+
error: "invalidResponse",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (response.error) {
|
|
50
|
+
const { error, error_code, error_message, status, validated } = response;
|
|
51
|
+
return {
|
|
52
|
+
account,
|
|
53
|
+
error,
|
|
54
|
+
error_code,
|
|
55
|
+
error_message,
|
|
56
|
+
status,
|
|
57
|
+
validated,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const result = response.result;
|
|
61
|
+
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
62
|
+
if (newMarker) {
|
|
63
|
+
result.marker = newMarker;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
exports.getAccountOffers = getAccountOffers;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { ErrorResponse } from "../models/base_model";
|
|
3
|
+
export interface GetTransactionsOptions {
|
|
4
|
+
ledgerIndexMin?: number;
|
|
5
|
+
ledgerIndexMax?: number;
|
|
6
|
+
ledgerHash?: string;
|
|
7
|
+
ledgerIndex?: LedgerIndex;
|
|
8
|
+
binary?: boolean;
|
|
9
|
+
forward?: boolean;
|
|
10
|
+
limit: number;
|
|
11
|
+
marker?: any;
|
|
12
|
+
balanceChanges?: boolean;
|
|
13
|
+
specification?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getTransactions(account: string, options?: GetTransactionsOptions): Promise<object | ErrorResponse>;
|
|
16
|
+
export interface FindTransactionsOptions extends GetTransactionsOptions {
|
|
17
|
+
startTxHash?: string;
|
|
18
|
+
excludeFailures?: boolean;
|
|
19
|
+
initiated?: boolean;
|
|
20
|
+
counterparty?: string;
|
|
21
|
+
types?: string[];
|
|
22
|
+
sourceTag?: number;
|
|
23
|
+
destinationTag?: number;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
legacy?: boolean;
|
|
26
|
+
formatted?: boolean;
|
|
27
|
+
includeRawTransactions?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function findTransactions(account: string, options?: FindTransactionsOptions): Promise<object[] | ErrorResponse>;
|