@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,77 @@
|
|
|
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.parseLedger = void 0;
|
|
27
|
+
const _ = __importStar(require("lodash"));
|
|
28
|
+
const common_1 = require("../../common");
|
|
29
|
+
const transaction_1 = require("./transaction");
|
|
30
|
+
function parseTransactionWrapper(ledgerVersion, includeRawTransaction, tx) {
|
|
31
|
+
const transaction = Object.assign({}, _.omit(tx, 'metaData'), {
|
|
32
|
+
meta: tx.metaData,
|
|
33
|
+
ledger_index: ledgerVersion
|
|
34
|
+
});
|
|
35
|
+
const result = (0, transaction_1.parseTransaction)(transaction, includeRawTransaction);
|
|
36
|
+
if (!result.outcome.ledgerVersion) {
|
|
37
|
+
result.outcome.ledgerVersion = ledgerVersion;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
function parseTransactions(transactions, ledgerVersion, includeRawTransactions) {
|
|
42
|
+
if (_.isEmpty(transactions)) {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
if (typeof transactions[0] === 'string') {
|
|
46
|
+
return { transactionHashes: transactions };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
transactions: transactions.map(_.partial(parseTransactionWrapper, ledgerVersion, includeRawTransactions))
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function parseState(state) {
|
|
53
|
+
if (_.isEmpty(state)) {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
if (typeof state[0] === 'string') {
|
|
57
|
+
return { stateHashes: state };
|
|
58
|
+
}
|
|
59
|
+
return { rawState: JSON.stringify(state) };
|
|
60
|
+
}
|
|
61
|
+
function parseLedger(ledger, includeRawTransactions) {
|
|
62
|
+
const ledgerVersion = parseInt(ledger.ledger_index, 10);
|
|
63
|
+
return (0, common_1.removeUndefined)(Object.assign({
|
|
64
|
+
stateHash: ledger.account_hash,
|
|
65
|
+
close_time: (0, common_1.rippleToUnixTime)(ledger.close_time),
|
|
66
|
+
closeTime: (0, common_1.rippleTimeToISO8601)(ledger.close_time),
|
|
67
|
+
closeTimeResolution: ledger.close_time_resolution,
|
|
68
|
+
closeFlags: ledger.close_flags,
|
|
69
|
+
ledgerHash: ledger.ledger_hash,
|
|
70
|
+
ledgerVersion: ledgerVersion,
|
|
71
|
+
parentLedgerHash: ledger.parent_hash,
|
|
72
|
+
parentCloseTime: (0, common_1.rippleTimeToISO8601)(ledger.parent_close_time),
|
|
73
|
+
totalDrops: ledger.total_coins,
|
|
74
|
+
transactionHash: ledger.transaction_hash
|
|
75
|
+
}, parseTransactions(ledger.transactions, ledgerVersion, includeRawTransactions), parseState(ledger.accountState)));
|
|
76
|
+
}
|
|
77
|
+
exports.parseLedger = parseLedger;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const common_1 = require("../../common");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
function parseMemos(tx) {
|
|
6
|
+
if (!Array.isArray(tx.Memos) || tx.Memos.length === 0) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return tx.Memos.map((m) => {
|
|
10
|
+
return (0, common_1.removeUndefined)({
|
|
11
|
+
type: m.Memo.parsed_memo_type || (0, utils_1.hexToString)(m.Memo.MemoType),
|
|
12
|
+
format: m.Memo.parsed_memo_format || (0, utils_1.hexToString)(m.Memo.MemoFormat),
|
|
13
|
+
data: m.Memo.parsed_memo_data || (0, utils_1.hexToString)(m.Memo.MemoData),
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.default = parseMemos;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const xrpl_1 = require("xrpl");
|
|
31
|
+
const utils_1 = require("./utils");
|
|
32
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
33
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
34
|
+
const common_1 = require("../../common");
|
|
35
|
+
function parseOrder(tx) {
|
|
36
|
+
assert.ok(tx.TransactionType === 'OfferCreate');
|
|
37
|
+
const direction = (tx.Flags & xrpl_1.OfferCreateFlags.tfSell) === 0 ? 'buy' : 'sell';
|
|
38
|
+
const takerGetsAmount = (0, amount_1.default)(tx.TakerGets);
|
|
39
|
+
const takerPaysAmount = (0, amount_1.default)(tx.TakerPays);
|
|
40
|
+
const quantity = direction === 'buy' ? takerPaysAmount : takerGetsAmount;
|
|
41
|
+
const totalPrice = direction === 'buy' ? takerGetsAmount : takerPaysAmount;
|
|
42
|
+
return (0, common_1.removeUndefined)({
|
|
43
|
+
memos: (0, memos_1.default)(tx),
|
|
44
|
+
direction: direction,
|
|
45
|
+
quantity: quantity,
|
|
46
|
+
totalPrice: totalPrice,
|
|
47
|
+
passive: (tx.Flags & xrpl_1.OfferCreateFlags.tfPassive) !== 0 || undefined,
|
|
48
|
+
immediateOrCancel: (tx.Flags & xrpl_1.OfferCreateFlags.tfImmediateOrCancel) !== 0 || undefined,
|
|
49
|
+
fillOrKill: (tx.Flags & xrpl_1.OfferCreateFlags.tfFillOrKill) !== 0 || undefined,
|
|
50
|
+
expirationTime: (0, utils_1.parseTimestamp)(tx.Expiration)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.default = parseOrder;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BookOffer } from '../../common/types/commands';
|
|
2
|
+
import { Amount, FormattedOrderSpecification } from '../../common/types/objects';
|
|
3
|
+
export type FormattedOrderbookOrder = {
|
|
4
|
+
specification: FormattedOrderSpecification;
|
|
5
|
+
properties: {
|
|
6
|
+
maker: string;
|
|
7
|
+
sequence: number;
|
|
8
|
+
makerExchangeRate: string;
|
|
9
|
+
};
|
|
10
|
+
state?: {
|
|
11
|
+
fundedAmount?: Amount;
|
|
12
|
+
priceOfFundedAmount?: Amount;
|
|
13
|
+
};
|
|
14
|
+
data: BookOffer;
|
|
15
|
+
};
|
|
16
|
+
export declare function parseOrderbookOrder(data: BookOffer): FormattedOrderbookOrder;
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.parseOrderbookOrder = void 0;
|
|
30
|
+
const _ = __importStar(require("lodash"));
|
|
31
|
+
const utils_1 = require("./utils");
|
|
32
|
+
const common_1 = require("../../common");
|
|
33
|
+
const flags_1 = require("./flags");
|
|
34
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
35
|
+
function parseOrderbookOrder(data) {
|
|
36
|
+
const direction = (data.Flags & flags_1.orderFlags.Sell) === 0 ? 'buy' : 'sell';
|
|
37
|
+
const takerGetsAmount = (0, amount_1.default)(data.TakerGets);
|
|
38
|
+
const takerPaysAmount = (0, amount_1.default)(data.TakerPays);
|
|
39
|
+
const quantity = direction === 'buy' ? takerPaysAmount : takerGetsAmount;
|
|
40
|
+
const totalPrice = direction === 'buy' ? takerGetsAmount : takerPaysAmount;
|
|
41
|
+
const specification = (0, common_1.removeUndefined)({
|
|
42
|
+
direction: direction,
|
|
43
|
+
quantity: quantity,
|
|
44
|
+
totalPrice: totalPrice,
|
|
45
|
+
passive: (data.Flags & flags_1.orderFlags.Passive) !== 0 || undefined,
|
|
46
|
+
expirationTime: (0, utils_1.parseTimestamp)(data.Expiration)
|
|
47
|
+
});
|
|
48
|
+
const properties = {
|
|
49
|
+
maker: data.Account,
|
|
50
|
+
sequence: data.Sequence,
|
|
51
|
+
makerExchangeRate: (0, utils_1.adjustQualityForXRP)(data.quality, takerGetsAmount.currency, takerPaysAmount.currency)
|
|
52
|
+
};
|
|
53
|
+
const takerGetsFunded = data.taker_gets_funded
|
|
54
|
+
? (0, amount_1.default)(data.taker_gets_funded)
|
|
55
|
+
: undefined;
|
|
56
|
+
const takerPaysFunded = data.taker_pays_funded
|
|
57
|
+
? (0, amount_1.default)(data.taker_pays_funded)
|
|
58
|
+
: undefined;
|
|
59
|
+
const available = (0, common_1.removeUndefined)({
|
|
60
|
+
fundedAmount: takerGetsFunded,
|
|
61
|
+
priceOfFundedAmount: takerPaysFunded
|
|
62
|
+
});
|
|
63
|
+
const state = _.isEmpty(available) ? undefined : available;
|
|
64
|
+
return (0, common_1.removeUndefined)({ specification, properties, state, data });
|
|
65
|
+
}
|
|
66
|
+
exports.parseOrderbookOrder = parseOrderbookOrder;
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const _ = __importStar(require("lodash"));
|
|
30
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
31
|
+
function parsePaths(paths) {
|
|
32
|
+
return paths.map((steps) => steps.map((step) => _.omit(step, ['type', 'type_hex'])));
|
|
33
|
+
}
|
|
34
|
+
function removeAnyCounterpartyEncoding(address, amount) {
|
|
35
|
+
return amount.counterparty === address
|
|
36
|
+
? _.omit(amount, 'counterparty')
|
|
37
|
+
: amount;
|
|
38
|
+
}
|
|
39
|
+
function createAdjustment(address, adjustmentWithoutAddress) {
|
|
40
|
+
const amountKey = Object.keys(adjustmentWithoutAddress)[0];
|
|
41
|
+
const amount = adjustmentWithoutAddress[amountKey];
|
|
42
|
+
return _.set({ address: address }, amountKey, removeAnyCounterpartyEncoding(address, amount));
|
|
43
|
+
}
|
|
44
|
+
function parseAlternative(sourceAddress, destinationAddress, destinationAmount, alternative) {
|
|
45
|
+
const amounts = alternative.destination_amount != null
|
|
46
|
+
? {
|
|
47
|
+
source: { amount: (0, amount_1.default)(alternative.source_amount) },
|
|
48
|
+
destination: { minAmount: (0, amount_1.default)(alternative.destination_amount) }
|
|
49
|
+
}
|
|
50
|
+
: {
|
|
51
|
+
source: { maxAmount: (0, amount_1.default)(alternative.source_amount) },
|
|
52
|
+
destination: { amount: (0, amount_1.default)(destinationAmount) }
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
source: createAdjustment(sourceAddress, amounts.source),
|
|
56
|
+
destination: createAdjustment(destinationAddress, amounts.destination),
|
|
57
|
+
paths: JSON.stringify(parsePaths(alternative.paths_computed))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function parsePathfind(pathfindResult) {
|
|
61
|
+
const sourceAddress = pathfindResult.source_account;
|
|
62
|
+
const destinationAddress = pathfindResult.destination_account;
|
|
63
|
+
const destinationAmount = pathfindResult.destination_amount;
|
|
64
|
+
return pathfindResult.alternatives.map((alt) => parseAlternative(sourceAddress, destinationAddress, destinationAmount, alt));
|
|
65
|
+
}
|
|
66
|
+
exports.default = parsePathfind;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const xrpl_1 = require("xrpl");
|
|
31
|
+
const common_1 = require("../../common");
|
|
32
|
+
const ripple_amount_1 = __importDefault(require("./ripple-amount"));
|
|
33
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
34
|
+
function parsePaymentChannelClaim(tx) {
|
|
35
|
+
assert.ok(tx.TransactionType === 'PaymentChannelClaim');
|
|
36
|
+
return (0, common_1.removeUndefined)({
|
|
37
|
+
memos: (0, memos_1.default)(tx),
|
|
38
|
+
channel: tx.Channel,
|
|
39
|
+
balance: (0, ripple_amount_1.default)(tx.Balance),
|
|
40
|
+
amount: (0, ripple_amount_1.default)(tx.Amount),
|
|
41
|
+
signature: tx.Signature,
|
|
42
|
+
publicKey: tx.PublicKey,
|
|
43
|
+
renew: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfRenew) || undefined,
|
|
44
|
+
close: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfClose) || undefined
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.default = parsePaymentChannelClaim;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const utils_1 = require("./utils");
|
|
31
|
+
const common_1 = require("../../common");
|
|
32
|
+
const ripple_amount_1 = __importDefault(require("./ripple-amount"));
|
|
33
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
34
|
+
function parsePaymentChannelCreate(tx) {
|
|
35
|
+
assert.ok(tx.TransactionType === 'PaymentChannelCreate');
|
|
36
|
+
return (0, common_1.removeUndefined)({
|
|
37
|
+
memos: (0, memos_1.default)(tx),
|
|
38
|
+
amount: (0, ripple_amount_1.default)(tx.Amount),
|
|
39
|
+
destination: tx.Destination,
|
|
40
|
+
settleDelay: tx.SettleDelay,
|
|
41
|
+
publicKey: tx.PublicKey,
|
|
42
|
+
cancelAfter: tx.CancelAfter && (0, utils_1.parseTimestamp)(tx.CancelAfter),
|
|
43
|
+
sourceTag: tx.SourceTag,
|
|
44
|
+
destinationTag: tx.DestinationTag
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.default = parsePaymentChannelCreate;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const assert = __importStar(require("assert"));
|
|
30
|
+
const utils_1 = require("./utils");
|
|
31
|
+
const common_1 = require("../../common");
|
|
32
|
+
const ripple_amount_1 = __importDefault(require("./ripple-amount"));
|
|
33
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
34
|
+
function parsePaymentChannelFund(tx) {
|
|
35
|
+
assert.ok(tx.TransactionType === 'PaymentChannelFund');
|
|
36
|
+
return (0, common_1.removeUndefined)({
|
|
37
|
+
memos: (0, memos_1.default)(tx),
|
|
38
|
+
channel: tx.Channel,
|
|
39
|
+
amount: (0, ripple_amount_1.default)(tx.Amount),
|
|
40
|
+
expiration: tx.Expiration && (0, utils_1.parseTimestamp)(tx.Expiration)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.default = parsePaymentChannelFund;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PayChannelLedgerEntry } from '../../common/types/objects';
|
|
2
|
+
export type FormattedPaymentChannel = {
|
|
3
|
+
account: string;
|
|
4
|
+
amount: string;
|
|
5
|
+
balance: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
destination: string;
|
|
8
|
+
settleDelay: number;
|
|
9
|
+
expiration?: string;
|
|
10
|
+
cancelAfter?: string;
|
|
11
|
+
sourceTag?: number;
|
|
12
|
+
destinationTag?: number;
|
|
13
|
+
previousAffectingTransactionID: string;
|
|
14
|
+
previousAffectingTransactionLedgerVersion: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function parsePaymentChannel(data: PayChannelLedgerEntry): FormattedPaymentChannel;
|
|
@@ -0,0 +1,27 @@
|
|
|
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.parsePaymentChannel = void 0;
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const common_1 = require("../../common");
|
|
9
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
10
|
+
function parsePaymentChannel(data) {
|
|
11
|
+
return (0, common_1.removeUndefined)({
|
|
12
|
+
memos: (0, memos_1.default)(data),
|
|
13
|
+
account: data.Account,
|
|
14
|
+
amount: (0, common_1.dropsToXrp)(data.Amount),
|
|
15
|
+
balance: (0, common_1.dropsToXrp)(data.Balance),
|
|
16
|
+
destination: data.Destination,
|
|
17
|
+
publicKey: data.PublicKey,
|
|
18
|
+
settleDelay: data.SettleDelay,
|
|
19
|
+
expiration: (0, utils_1.parseTimestamp)(data.Expiration),
|
|
20
|
+
cancelAfter: (0, utils_1.parseTimestamp)(data.CancelAfter),
|
|
21
|
+
sourceTag: data.SourceTag,
|
|
22
|
+
destinationTag: data.DestinationTag,
|
|
23
|
+
previousAffectingTransactionID: data.PreviousTxnID,
|
|
24
|
+
previousAffectingTransactionLedgerVersion: data.PreviousTxnLgrSeq
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.parsePaymentChannel = parsePaymentChannel;
|
|
@@ -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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const _ = __importStar(require("lodash"));
|
|
30
|
+
const assert = __importStar(require("assert"));
|
|
31
|
+
const xrpl_1 = require("xrpl");
|
|
32
|
+
const utils_1 = require("./utils");
|
|
33
|
+
const common_1 = require("../../common");
|
|
34
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
35
|
+
const memos_1 = __importDefault(require("./memos"));
|
|
36
|
+
function isNoDirectRipple(tx) {
|
|
37
|
+
return (tx.Flags & xrpl_1.PaymentFlags.tfNoDirectRipple) !== 0;
|
|
38
|
+
}
|
|
39
|
+
function isQualityLimited(tx) {
|
|
40
|
+
return (tx.Flags & xrpl_1.PaymentFlags.tfLimitQuality) !== 0;
|
|
41
|
+
}
|
|
42
|
+
function removeGenericCounterparty(amount, address) {
|
|
43
|
+
return amount.counterparty === address
|
|
44
|
+
? _.omit(amount, 'counterparty')
|
|
45
|
+
: amount;
|
|
46
|
+
}
|
|
47
|
+
function parsePayment(tx) {
|
|
48
|
+
assert.ok(tx.TransactionType === 'Payment');
|
|
49
|
+
const source = {
|
|
50
|
+
address: tx.Account,
|
|
51
|
+
maxAmount: removeGenericCounterparty((0, amount_1.default)(tx.SendMax || tx.Amount), tx.Account),
|
|
52
|
+
tag: tx.SourceTag
|
|
53
|
+
};
|
|
54
|
+
const destination = {
|
|
55
|
+
address: tx.Destination,
|
|
56
|
+
tag: tx.DestinationTag
|
|
57
|
+
};
|
|
58
|
+
return (0, common_1.removeUndefined)({
|
|
59
|
+
source: (0, common_1.removeUndefined)(source),
|
|
60
|
+
destination: (0, common_1.removeUndefined)(destination),
|
|
61
|
+
memos: (0, memos_1.default)(tx),
|
|
62
|
+
invoiceID: tx.InvoiceID,
|
|
63
|
+
paths: tx.Paths ? JSON.stringify(tx.Paths) : undefined,
|
|
64
|
+
allowPartialPayment: (0, utils_1.isPartialPayment)(tx) || undefined,
|
|
65
|
+
noDirectRipple: isNoDirectRipple(tx) || undefined,
|
|
66
|
+
limitQuality: isQualityLimited(tx) || undefined
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.default = parsePayment;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const common = __importStar(require("../../common"));
|
|
30
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
31
|
+
function parseRippledAmount(amount) {
|
|
32
|
+
if (amount === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
if (typeof amount === "string") {
|
|
36
|
+
return common.dropsToXrp(amount);
|
|
37
|
+
}
|
|
38
|
+
return (0, amount_1.default)(amount);
|
|
39
|
+
}
|
|
40
|
+
exports.default = parseRippledAmount;
|