@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,10 @@
|
|
|
1
|
+
import { VLInterface, ValidatorInterface, VLBlobInterface } from "../models/vl";
|
|
2
|
+
export declare function createVL(masterSecret: {
|
|
3
|
+
privateKey: string;
|
|
4
|
+
publicKey: string;
|
|
5
|
+
}, ephemeralSecret: {
|
|
6
|
+
privateKey: string;
|
|
7
|
+
publicKey: string;
|
|
8
|
+
}, sequence: number, expiration: number, validatorsPublicKeys: string[]): Promise<VLInterface>;
|
|
9
|
+
export declare function createVLBlob(sequence: number, expiration: number, validatorsPublicKeys: string[]): Promise<VLBlobInterface>;
|
|
10
|
+
export declare function getVLBlobValidatorsManifets(validatorsPublicKeys: string[]): Promise<ValidatorInterface[]>;
|
package/lib/ledger/vl.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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.getVLBlobValidatorsManifets = exports.createVLBlob = exports.createVL = void 0;
|
|
27
|
+
const Client = __importStar(require("../client"));
|
|
28
|
+
const vl_1 = require("../models/vl");
|
|
29
|
+
const manifest_1 = require("../models/manifest");
|
|
30
|
+
const ledger_1 = require("../models/ledger");
|
|
31
|
+
const Validator = __importStar(require("../validator"));
|
|
32
|
+
async function createVL(masterSecret, ephemeralSecret, sequence, expiration, validatorsPublicKeys) {
|
|
33
|
+
if (!masterSecret) {
|
|
34
|
+
throw new Error("Master key is required");
|
|
35
|
+
}
|
|
36
|
+
if (!ephemeralSecret) {
|
|
37
|
+
throw new Error("Ephemeral key is required");
|
|
38
|
+
}
|
|
39
|
+
const vlBlob = await createVLBlob(sequence, expiration, validatorsPublicKeys);
|
|
40
|
+
const blob = (0, vl_1.encodeVLBlob)(vlBlob);
|
|
41
|
+
const manifest = (0, manifest_1.generateManifest)({
|
|
42
|
+
Sequence: sequence,
|
|
43
|
+
PublicKey: masterSecret.publicKey,
|
|
44
|
+
SigningPubKey: ephemeralSecret.publicKey,
|
|
45
|
+
SigningPrivateKey: ephemeralSecret.privateKey,
|
|
46
|
+
MasterPrivateKey: masterSecret.privateKey,
|
|
47
|
+
});
|
|
48
|
+
const signature = Validator.sign(Buffer.from(blob, "base64"), ephemeralSecret.privateKey);
|
|
49
|
+
return {
|
|
50
|
+
blob,
|
|
51
|
+
manifest,
|
|
52
|
+
signature,
|
|
53
|
+
public_key: masterSecret.publicKey,
|
|
54
|
+
version: 1,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.createVL = createVL;
|
|
58
|
+
async function createVLBlob(sequence, expiration, validatorsPublicKeys) {
|
|
59
|
+
const validators = await getVLBlobValidatorsManifets(validatorsPublicKeys);
|
|
60
|
+
return {
|
|
61
|
+
sequence,
|
|
62
|
+
expiration: (0, ledger_1.unixTimeToLedgerTime)(expiration),
|
|
63
|
+
validators,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.createVLBlob = createVLBlob;
|
|
67
|
+
async function getVLBlobValidatorsManifets(validatorsPublicKeys) {
|
|
68
|
+
const connection = Client.findConnection("manifest");
|
|
69
|
+
if (!connection) {
|
|
70
|
+
throw new Error("There is no connection");
|
|
71
|
+
}
|
|
72
|
+
const validatorsManifests = await Promise.all(validatorsPublicKeys.map(async (publicKey) => {
|
|
73
|
+
const response = await connection.request({
|
|
74
|
+
command: "manifest",
|
|
75
|
+
public_key: publicKey,
|
|
76
|
+
});
|
|
77
|
+
if (response.error) {
|
|
78
|
+
Promise.reject(response.error);
|
|
79
|
+
}
|
|
80
|
+
return response.result;
|
|
81
|
+
}));
|
|
82
|
+
const validators = validatorsManifests.map((info) => {
|
|
83
|
+
const validationPublicKey = info.requested;
|
|
84
|
+
const manifest = info.manifest;
|
|
85
|
+
return {
|
|
86
|
+
validation_public_key: validationPublicKey,
|
|
87
|
+
manifest,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
return validators;
|
|
91
|
+
}
|
|
92
|
+
exports.getVLBlobValidatorsManifets = getVLBlobValidatorsManifets;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { LedgerEntry, AccountSetAsfFlags } from "xrpl";
|
|
2
|
+
import { QueueData } from "../v1/common/types/objects/queue_data";
|
|
3
|
+
export declare const AccountRootFlagsKeys: {
|
|
4
|
+
passwordSpent: LedgerEntry.AccountRootFlags;
|
|
5
|
+
requireDestTag: LedgerEntry.AccountRootFlags;
|
|
6
|
+
requireAuth: LedgerEntry.AccountRootFlags;
|
|
7
|
+
depositAuth: LedgerEntry.AccountRootFlags;
|
|
8
|
+
disallowXRP: LedgerEntry.AccountRootFlags;
|
|
9
|
+
disableMaster: LedgerEntry.AccountRootFlags;
|
|
10
|
+
noFreeze: LedgerEntry.AccountRootFlags;
|
|
11
|
+
globalFreeze: LedgerEntry.AccountRootFlags;
|
|
12
|
+
defaultRipple: LedgerEntry.AccountRootFlags;
|
|
13
|
+
disallowIncomingNFTokenOffer: LedgerEntry.AccountRootFlags;
|
|
14
|
+
disallowIncomingCheck: LedgerEntry.AccountRootFlags;
|
|
15
|
+
disallowIncomingPayChan: LedgerEntry.AccountRootFlags;
|
|
16
|
+
disallowIncomingTrustline: LedgerEntry.AccountRootFlags;
|
|
17
|
+
};
|
|
18
|
+
export interface AccountRootFlagsKeysInterface {
|
|
19
|
+
passwordSpent?: boolean;
|
|
20
|
+
requireDestTag?: boolean;
|
|
21
|
+
requireAuth?: boolean;
|
|
22
|
+
depositAuth?: boolean;
|
|
23
|
+
disallowXRP?: boolean;
|
|
24
|
+
disableMaster?: boolean;
|
|
25
|
+
noFreeze?: boolean;
|
|
26
|
+
globalFreeze?: boolean;
|
|
27
|
+
defaultRipple?: boolean;
|
|
28
|
+
disallowIncomingNFTokenOffer?: boolean;
|
|
29
|
+
disallowIncomingCheck?: boolean;
|
|
30
|
+
disallowIncomingPayChan?: boolean;
|
|
31
|
+
disallowIncomingTrustline?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const AccountSetFlags: {
|
|
34
|
+
requireDestinationTag: AccountSetAsfFlags;
|
|
35
|
+
requireAuthorization: AccountSetAsfFlags;
|
|
36
|
+
depositAuth: AccountSetAsfFlags;
|
|
37
|
+
disallowIncomingXRP: AccountSetAsfFlags;
|
|
38
|
+
disableMasterKey: AccountSetAsfFlags;
|
|
39
|
+
enableTransactionIDTracking: AccountSetAsfFlags;
|
|
40
|
+
noFreeze: AccountSetAsfFlags;
|
|
41
|
+
globalFreeze: AccountSetAsfFlags;
|
|
42
|
+
defaultRipple: AccountSetAsfFlags;
|
|
43
|
+
authorizedMinter: AccountSetAsfFlags;
|
|
44
|
+
disallowIncomingNFTokenOffer: AccountSetAsfFlags;
|
|
45
|
+
disallowIncomingCheck: AccountSetAsfFlags;
|
|
46
|
+
disallowIncomingPayChan: AccountSetAsfFlags;
|
|
47
|
+
disallowIncomingTrustline: AccountSetAsfFlags;
|
|
48
|
+
};
|
|
49
|
+
export declare const SignerListFlagsKeys: {
|
|
50
|
+
oneOwnerCount: LedgerEntry.SignerListFlags;
|
|
51
|
+
};
|
|
52
|
+
export interface SignerListFlagsKeysInterface {
|
|
53
|
+
oneOwnerCount?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const AccountFields: {
|
|
56
|
+
EmailHash: {
|
|
57
|
+
name: string;
|
|
58
|
+
encoding: string;
|
|
59
|
+
length: number;
|
|
60
|
+
defaults: string;
|
|
61
|
+
};
|
|
62
|
+
WalletLocator: {
|
|
63
|
+
name: string;
|
|
64
|
+
};
|
|
65
|
+
MessageKey: {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
Domain: {
|
|
69
|
+
name: string;
|
|
70
|
+
encoding: string;
|
|
71
|
+
};
|
|
72
|
+
TransferRate: {
|
|
73
|
+
name: string;
|
|
74
|
+
defaults: number;
|
|
75
|
+
shift: number;
|
|
76
|
+
};
|
|
77
|
+
TickSize: {
|
|
78
|
+
name: string;
|
|
79
|
+
defaults: number;
|
|
80
|
+
};
|
|
81
|
+
RegularKey: {
|
|
82
|
+
name: string;
|
|
83
|
+
};
|
|
84
|
+
NFTokenMinter: {
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export interface AccountInfoResponse {
|
|
89
|
+
account_data: AccountInfoDataResponse;
|
|
90
|
+
ledger_current_index?: number;
|
|
91
|
+
ledger_index?: number;
|
|
92
|
+
queue_data?: QueueData;
|
|
93
|
+
validated?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface AccountSignerListResponse {
|
|
96
|
+
signer_lists?: LedgerEntry.SignerList[];
|
|
97
|
+
}
|
|
98
|
+
export interface AccountInfoDataResponse extends LedgerEntry.AccountRoot, AccountSignerListResponse {
|
|
99
|
+
}
|
|
100
|
+
export interface AccountFieldsInterface {
|
|
101
|
+
blackholed?: boolean;
|
|
102
|
+
emailHash?: string;
|
|
103
|
+
walletLocator?: string;
|
|
104
|
+
messageKey?: string;
|
|
105
|
+
domain?: string;
|
|
106
|
+
transferRate?: number;
|
|
107
|
+
tickSize?: number;
|
|
108
|
+
regularKey?: string;
|
|
109
|
+
nftokenMinter?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface AccountSettingsInterface extends AccountFieldsInterface, AccountRootFlagsKeysInterface {
|
|
112
|
+
}
|
|
113
|
+
export declare function getSettings(accountInfo: AccountInfoDataResponse, excludeFalse?: boolean): AccountSettingsInterface;
|
|
114
|
+
export declare function parseAccountFlags(value: number, options?: {
|
|
115
|
+
excludeFalse?: boolean;
|
|
116
|
+
}): AccountRootFlagsKeysInterface;
|
|
117
|
+
export declare function parseAccountFields(accountInfo: AccountInfoDataResponse, options?: {
|
|
118
|
+
excludeFalse?: boolean;
|
|
119
|
+
}): AccountFieldsInterface;
|
|
120
|
+
export declare function parseSignerListFlags(value: number, options?: {
|
|
121
|
+
excludeFalse?: boolean;
|
|
122
|
+
}): SignerListFlagsKeysInterface;
|
|
@@ -0,0 +1,102 @@
|
|
|
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.parseSignerListFlags = exports.parseAccountFields = exports.parseAccountFlags = exports.getSettings = exports.AccountFields = exports.SignerListFlagsKeys = exports.AccountSetFlags = exports.AccountRootFlagsKeys = void 0;
|
|
7
|
+
const xrpl_1 = require("xrpl");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const flags_1 = require("../parse/ledger/flags");
|
|
11
|
+
exports.AccountRootFlagsKeys = {
|
|
12
|
+
passwordSpent: xrpl_1.LedgerEntry.AccountRootFlags.lsfPasswordSpent,
|
|
13
|
+
requireDestTag: xrpl_1.LedgerEntry.AccountRootFlags.lsfRequireDestTag,
|
|
14
|
+
requireAuth: xrpl_1.LedgerEntry.AccountRootFlags.lsfRequireAuth,
|
|
15
|
+
depositAuth: xrpl_1.LedgerEntry.AccountRootFlags.lsfDepositAuth,
|
|
16
|
+
disallowXRP: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisallowXRP,
|
|
17
|
+
disableMaster: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisableMaster,
|
|
18
|
+
noFreeze: xrpl_1.LedgerEntry.AccountRootFlags.lsfNoFreeze,
|
|
19
|
+
globalFreeze: xrpl_1.LedgerEntry.AccountRootFlags.lsfGlobalFreeze,
|
|
20
|
+
defaultRipple: xrpl_1.LedgerEntry.AccountRootFlags.lsfDefaultRipple,
|
|
21
|
+
disallowIncomingNFTokenOffer: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisallowIncomingNFTokenOffer,
|
|
22
|
+
disallowIncomingCheck: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisallowIncomingCheck,
|
|
23
|
+
disallowIncomingPayChan: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisallowIncomingPayChan,
|
|
24
|
+
disallowIncomingTrustline: xrpl_1.LedgerEntry.AccountRootFlags.lsfDisallowIncomingTrustline,
|
|
25
|
+
};
|
|
26
|
+
exports.AccountSetFlags = {
|
|
27
|
+
requireDestinationTag: xrpl_1.AccountSetAsfFlags.asfRequireDest,
|
|
28
|
+
requireAuthorization: xrpl_1.AccountSetAsfFlags.asfRequireAuth,
|
|
29
|
+
depositAuth: xrpl_1.AccountSetAsfFlags.asfDepositAuth,
|
|
30
|
+
disallowIncomingXRP: xrpl_1.AccountSetAsfFlags.asfDisallowXRP,
|
|
31
|
+
disableMasterKey: xrpl_1.AccountSetAsfFlags.asfDisableMaster,
|
|
32
|
+
enableTransactionIDTracking: xrpl_1.AccountSetAsfFlags.asfAccountTxnID,
|
|
33
|
+
noFreeze: xrpl_1.AccountSetAsfFlags.asfNoFreeze,
|
|
34
|
+
globalFreeze: xrpl_1.AccountSetAsfFlags.asfGlobalFreeze,
|
|
35
|
+
defaultRipple: xrpl_1.AccountSetAsfFlags.asfDefaultRipple,
|
|
36
|
+
authorizedMinter: xrpl_1.AccountSetAsfFlags.asfAuthorizedNFTokenMinter,
|
|
37
|
+
disallowIncomingNFTokenOffer: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingNFTokenOffer,
|
|
38
|
+
disallowIncomingCheck: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingCheck,
|
|
39
|
+
disallowIncomingPayChan: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingPayChan,
|
|
40
|
+
disallowIncomingTrustline: xrpl_1.AccountSetAsfFlags.asfDisallowIncomingTrustline,
|
|
41
|
+
};
|
|
42
|
+
exports.SignerListFlagsKeys = {
|
|
43
|
+
oneOwnerCount: xrpl_1.LedgerEntry.SignerListFlags.lsfOneOwnerCount,
|
|
44
|
+
};
|
|
45
|
+
exports.AccountFields = {
|
|
46
|
+
EmailHash: { name: "emailHash", encoding: "hex", length: 32, defaults: "00000000000000000000000000000000" },
|
|
47
|
+
WalletLocator: { name: "walletLocator" },
|
|
48
|
+
MessageKey: { name: "messageKey" },
|
|
49
|
+
Domain: { name: "domain", encoding: "hex" },
|
|
50
|
+
TransferRate: { name: "transferRate", defaults: 0, shift: 9 },
|
|
51
|
+
TickSize: { name: "tickSize", defaults: 0 },
|
|
52
|
+
RegularKey: { name: "regularKey" },
|
|
53
|
+
NFTokenMinter: { name: "nftokenMinter" },
|
|
54
|
+
};
|
|
55
|
+
function getSettings(accountInfo, excludeFalse = true) {
|
|
56
|
+
const parsedFlags = parseAccountFlags(accountInfo.Flags, { excludeFalse });
|
|
57
|
+
const parsedFields = parseAccountFields(accountInfo, { excludeFalse });
|
|
58
|
+
return {
|
|
59
|
+
...parsedFlags,
|
|
60
|
+
...parsedFields,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.getSettings = getSettings;
|
|
64
|
+
function parseAccountFlags(value, options = {}) {
|
|
65
|
+
return (0, flags_1.parseFlags)(value, exports.AccountRootFlagsKeys, options);
|
|
66
|
+
}
|
|
67
|
+
exports.parseAccountFlags = parseAccountFlags;
|
|
68
|
+
function parseAccountFields(accountInfo, options = {}) {
|
|
69
|
+
const settings = {};
|
|
70
|
+
if (accountInfo.hasOwnProperty("signer_lists")) {
|
|
71
|
+
if (accountInfo.Flags & exports.AccountRootFlagsKeys.disableMaster &&
|
|
72
|
+
common_1.BLACKHOLE_ACCOUNTS.includes(accountInfo.RegularKey) &&
|
|
73
|
+
accountInfo.signer_lists?.length === 0) {
|
|
74
|
+
settings.blackholed = true;
|
|
75
|
+
}
|
|
76
|
+
else if (!options.excludeFalse) {
|
|
77
|
+
settings.blackholed = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const fieldName in exports.AccountFields) {
|
|
81
|
+
const fieldValue = accountInfo[fieldName];
|
|
82
|
+
if (fieldValue != null) {
|
|
83
|
+
const info = exports.AccountFields[fieldName];
|
|
84
|
+
settings[info.name] = parseField(info, fieldValue);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function parseField(info, value) {
|
|
88
|
+
if (info.encoding === "hex" && !info.length) {
|
|
89
|
+
return Buffer.from(value, "hex").toString("ascii");
|
|
90
|
+
}
|
|
91
|
+
if (info.shift) {
|
|
92
|
+
return new bignumber_js_1.default(value).shiftedBy(-info.shift).toNumber();
|
|
93
|
+
}
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
return settings;
|
|
97
|
+
}
|
|
98
|
+
exports.parseAccountFields = parseAccountFields;
|
|
99
|
+
function parseSignerListFlags(value, options = {}) {
|
|
100
|
+
return (0, flags_1.parseFlags)(value, exports.SignerListFlagsKeys, options);
|
|
101
|
+
}
|
|
102
|
+
exports.parseSignerListFlags = parseSignerListFlags;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Trustline {
|
|
2
|
+
account: string;
|
|
3
|
+
balance: string;
|
|
4
|
+
currency: string;
|
|
5
|
+
limit: string;
|
|
6
|
+
limit_peer: string;
|
|
7
|
+
quality_in: number;
|
|
8
|
+
quality_out: number;
|
|
9
|
+
no_ripple?: boolean;
|
|
10
|
+
no_ripple_peer?: boolean;
|
|
11
|
+
authorized?: boolean;
|
|
12
|
+
peer_authorized?: boolean;
|
|
13
|
+
freeze?: boolean;
|
|
14
|
+
freeze_peer?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface AccountLinesResponse {
|
|
17
|
+
account: string;
|
|
18
|
+
lines: Trustline[];
|
|
19
|
+
ledger_current_index?: number;
|
|
20
|
+
ledger_index?: number;
|
|
21
|
+
ledger_hash?: string;
|
|
22
|
+
marker?: unknown;
|
|
23
|
+
validated?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SortDirection } from "../common";
|
|
2
|
+
export interface NFTokenInterface {
|
|
3
|
+
Flags: number;
|
|
4
|
+
Issuer: string;
|
|
5
|
+
NFTokenID: string;
|
|
6
|
+
NFTokenTaxon: number;
|
|
7
|
+
TransferFee: number;
|
|
8
|
+
Sequence: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AccountNFTokenInterface {
|
|
11
|
+
Flags: number;
|
|
12
|
+
Issuer: string;
|
|
13
|
+
NFTokenID: string;
|
|
14
|
+
TokenTaxons: number;
|
|
15
|
+
nft_serial: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function sortHelperAccountNFToken(a: AccountNFTokenInterface, b: AccountNFTokenInterface): SortDirection;
|
|
18
|
+
export declare function cipheredTaxon(tokenSeq: number, taxon: number): number;
|
|
19
|
+
export declare function parseNFTokenID(nftokenID: string): NFTokenInterface | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.parseNFTokenID = exports.cipheredTaxon = exports.sortHelperAccountNFToken = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const AddressCodec = require("ripple-address-codec");
|
|
9
|
+
function sortHelperAccountNFToken(a, b) {
|
|
10
|
+
const cmpIssuer = a.Issuer.localeCompare(b.Issuer);
|
|
11
|
+
if (cmpIssuer !== 0) {
|
|
12
|
+
return cmpIssuer;
|
|
13
|
+
}
|
|
14
|
+
if (a.nft_serial < b.nft_serial) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
if (a.nft_serial > b.nft_serial) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
exports.sortHelperAccountNFToken = sortHelperAccountNFToken;
|
|
23
|
+
function cipheredTaxon(tokenSeq, taxon) {
|
|
24
|
+
return (taxon ^ ((384160001 * tokenSeq + 2459) >>> 0)) >>> 0;
|
|
25
|
+
}
|
|
26
|
+
exports.cipheredTaxon = cipheredTaxon;
|
|
27
|
+
function parseNFTokenID(nftokenID) {
|
|
28
|
+
if (typeof nftokenID !== "string" || nftokenID.length !== 64) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const flags = new bignumber_js_1.default(nftokenID.slice(0, 4), 16).toNumber();
|
|
32
|
+
const transferFee = new bignumber_js_1.default(nftokenID.slice(4, 8), 16).toNumber();
|
|
33
|
+
const issuer = AddressCodec.encodeAccountID(Buffer.from(nftokenID.slice(8, 48), "hex"));
|
|
34
|
+
const scrambledTaxon = new bignumber_js_1.default(nftokenID.slice(48, 56), 16).toNumber();
|
|
35
|
+
const sequence = new bignumber_js_1.default(nftokenID.slice(56, 64), 16).toNumber();
|
|
36
|
+
return {
|
|
37
|
+
NFTokenID: nftokenID,
|
|
38
|
+
Flags: flags,
|
|
39
|
+
TransferFee: transferFee,
|
|
40
|
+
Issuer: issuer,
|
|
41
|
+
NFTokenTaxon: cipheredTaxon(sequence, scrambledTaxon),
|
|
42
|
+
Sequence: sequence,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.parseNFTokenID = parseNFTokenID;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LedgerEntry } from "xrpl";
|
|
2
|
+
import { Trustline } from "./account_lines";
|
|
3
|
+
import { Amount } from "../v1/common/types/objects";
|
|
4
|
+
export type AccountObject = LedgerEntry.Check | LedgerEntry.DepositPreauth | LedgerEntry.Escrow | LedgerEntry.Offer | LedgerEntry.PayChannel | LedgerEntry.SignerList | LedgerEntry.Ticket | LedgerEntry.RippleState;
|
|
5
|
+
export type AccountObjectType = "check" | "escrow" | "offer" | "payment_channel" | "signer_list" | "state" | "ticket" | "nft_offer";
|
|
6
|
+
export interface AccountObjectsResponse {
|
|
7
|
+
account: string;
|
|
8
|
+
account_objects: AccountObject[];
|
|
9
|
+
ledger_hash?: string;
|
|
10
|
+
ledger_index?: number;
|
|
11
|
+
ledger_current_index?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
marker?: string;
|
|
14
|
+
validated?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface AccountNFTObjectsResponse {
|
|
17
|
+
account: string;
|
|
18
|
+
nft_offers: AccountNFTOffersInterface[];
|
|
19
|
+
ledger_hash?: string;
|
|
20
|
+
ledger_index?: number;
|
|
21
|
+
ledger_current_index?: number;
|
|
22
|
+
limit?: number;
|
|
23
|
+
marker?: string;
|
|
24
|
+
validated?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface AccountNFTOffersInterface {
|
|
27
|
+
nft_id: string;
|
|
28
|
+
amount: Amount;
|
|
29
|
+
flags: number;
|
|
30
|
+
index: string;
|
|
31
|
+
owner: string;
|
|
32
|
+
destination?: string;
|
|
33
|
+
expiration?: number;
|
|
34
|
+
ledger_index: number;
|
|
35
|
+
transaction_hash: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function accountObjectsToAccountLines(account: string, accountObjects: AccountObject[]): Trustline[];
|
|
38
|
+
export declare function accountObjectsToNFTOffers(accountObjects: AccountObject[]): AccountNFTOffersInterface[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountObjectsToNFTOffers = exports.accountObjectsToAccountLines = void 0;
|
|
4
|
+
const xrpl_1 = require("xrpl");
|
|
5
|
+
const { RippleStateFlags } = xrpl_1.LedgerEntry;
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const ledger_1 = require("../models/ledger");
|
|
8
|
+
function accountObjectsToAccountLines(account, accountObjects) {
|
|
9
|
+
const notInDefaultState = accountObjects.filter((node) => {
|
|
10
|
+
return (node.LedgerEntryType === "RippleState" &&
|
|
11
|
+
node.Flags & RippleStateFlags[node.HighLimit.issuer === account ? "lsfHighReserve" : "lsfLowReserve"]);
|
|
12
|
+
});
|
|
13
|
+
const accountLinesFormatted = notInDefaultState.map((node) => RippleStateToTrustLine(node, account));
|
|
14
|
+
return accountLinesFormatted;
|
|
15
|
+
}
|
|
16
|
+
exports.accountObjectsToAccountLines = accountObjectsToAccountLines;
|
|
17
|
+
const RippleStateToTrustLine = (ledgerEntry, account) => {
|
|
18
|
+
const parties = [ledgerEntry.HighLimit, ledgerEntry.LowLimit];
|
|
19
|
+
const [self, counterparty] = ledgerEntry.HighLimit.issuer === account ? parties : parties.reverse();
|
|
20
|
+
const ripplingFlags = [
|
|
21
|
+
(RippleStateFlags.lsfHighNoRipple & ledgerEntry.Flags) === RippleStateFlags.lsfHighNoRipple,
|
|
22
|
+
(RippleStateFlags.lsfLowNoRipple & ledgerEntry.Flags) === RippleStateFlags.lsfLowNoRipple,
|
|
23
|
+
];
|
|
24
|
+
const [no_ripple, no_ripple_peer] = ledgerEntry.HighLimit.issuer === account ? ripplingFlags : ripplingFlags.reverse();
|
|
25
|
+
const balance = ledgerEntry.HighLimit.issuer === account && ledgerEntry.Balance.value.startsWith("-")
|
|
26
|
+
? ledgerEntry.Balance.value.slice(1)
|
|
27
|
+
: ledgerEntry.Balance.value;
|
|
28
|
+
return {
|
|
29
|
+
account: counterparty.issuer,
|
|
30
|
+
balance,
|
|
31
|
+
currency: self.currency,
|
|
32
|
+
limit: self.value,
|
|
33
|
+
limit_peer: counterparty.value,
|
|
34
|
+
no_ripple,
|
|
35
|
+
no_ripple_peer,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
function accountObjectsToNFTOffers(accountObjects) {
|
|
39
|
+
const nftOfferObjects = accountObjects.filter((obj) => {
|
|
40
|
+
return obj.LedgerEntryType === "NFTokenOffer";
|
|
41
|
+
});
|
|
42
|
+
const nftOffers = nftOfferObjects.map((obj) => {
|
|
43
|
+
let expiration = obj.Expiration;
|
|
44
|
+
if (typeof expiration === "number") {
|
|
45
|
+
expiration = (0, ledger_1.ledgerTimeToUnixTime)(expiration);
|
|
46
|
+
}
|
|
47
|
+
return (0, common_1.removeUndefined)({
|
|
48
|
+
nft_id: obj.NFTokenID,
|
|
49
|
+
amount: obj.Amount,
|
|
50
|
+
flags: obj.Flags,
|
|
51
|
+
index: obj.index,
|
|
52
|
+
owner: obj.Owner,
|
|
53
|
+
destination: obj.Destination,
|
|
54
|
+
expiration,
|
|
55
|
+
ledger_index: obj.PreviousTxnLgrSeq,
|
|
56
|
+
transaction_hash: obj.PreviousTxnID,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return nftOffers;
|
|
60
|
+
}
|
|
61
|
+
exports.accountObjectsToNFTOffers = accountObjectsToNFTOffers;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ErrorResponse {
|
|
2
|
+
id?: number | string;
|
|
3
|
+
account?: string;
|
|
4
|
+
transaction?: string;
|
|
5
|
+
public_key?: string;
|
|
6
|
+
nft_id?: string;
|
|
7
|
+
status: "error" | "timeout";
|
|
8
|
+
error: string;
|
|
9
|
+
error_code?: string;
|
|
10
|
+
error_message?: string;
|
|
11
|
+
api_version?: number;
|
|
12
|
+
marker?: any;
|
|
13
|
+
validated?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormattedIssuedCurrency } from "../types";
|
|
2
|
+
export type OrderbookInfo = {
|
|
3
|
+
base: FormattedIssuedCurrency;
|
|
4
|
+
counter: FormattedIssuedCurrency;
|
|
5
|
+
};
|
|
6
|
+
export declare function formatBidsAndAsks(orderbook: OrderbookInfo, offers: any[]): {
|
|
7
|
+
bids: any[];
|
|
8
|
+
asks: any[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
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.formatBidsAndAsks = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const orderbook_order_1 = require("../parse/ledger/orderbook-order");
|
|
10
|
+
function isSameIssue(a, b) {
|
|
11
|
+
return a.currency === b.currency && a.counterparty === b.counterparty;
|
|
12
|
+
}
|
|
13
|
+
function directionFilter(direction, order) {
|
|
14
|
+
return order.specification.direction === direction;
|
|
15
|
+
}
|
|
16
|
+
function flipOrder(order) {
|
|
17
|
+
const specification = order.specification;
|
|
18
|
+
const flippedSpecification = {
|
|
19
|
+
quantity: specification.totalPrice,
|
|
20
|
+
totalPrice: specification.quantity,
|
|
21
|
+
direction: specification.direction === "buy" ? "sell" : "buy",
|
|
22
|
+
};
|
|
23
|
+
const newSpecification = lodash_1.default.merge({}, specification, flippedSpecification);
|
|
24
|
+
return lodash_1.default.merge({}, order, { specification: newSpecification });
|
|
25
|
+
}
|
|
26
|
+
function alignOrder(base, order) {
|
|
27
|
+
const quantity = order.specification.quantity;
|
|
28
|
+
return isSameIssue(quantity, base) ? order : flipOrder(order);
|
|
29
|
+
}
|
|
30
|
+
function formatBidsAndAsks(orderbook, offers) {
|
|
31
|
+
const orders = offers
|
|
32
|
+
.sort((a, b) => {
|
|
33
|
+
return new bignumber_js_1.default(a.quality).comparedTo(b.quality);
|
|
34
|
+
})
|
|
35
|
+
.map(orderbook_order_1.parseOrderbookOrder);
|
|
36
|
+
const alignedOrders = orders.map(lodash_1.default.partial(alignOrder, orderbook.base));
|
|
37
|
+
const bids = alignedOrders.filter(lodash_1.default.partial(directionFilter, "buy"));
|
|
38
|
+
const asks = alignedOrders.filter(lodash_1.default.partial(directionFilter, "sell"));
|
|
39
|
+
return { bids, asks };
|
|
40
|
+
}
|
|
41
|
+
exports.formatBidsAndAsks = formatBidsAndAsks;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./account_info";
|
|
2
|
+
export * from "./account_nfts";
|
|
3
|
+
export * from "./account_object";
|
|
4
|
+
export * from "./ledger";
|
|
5
|
+
export * from "./manifest";
|
|
6
|
+
export * from "./transaction";
|
|
7
|
+
export * from "./account_lines";
|
|
8
|
+
export * from "./vl";
|
|
9
|
+
export { parseAffectedObjects } from "../parse/outcome/affected_objects";
|
|
10
|
+
export { parseNFTokenChanges } from "../parse/outcome/nftoken_changes";
|
|
11
|
+
export { parseNFTokenOfferChanges } from "../parse/outcome/nftoken_offer_changes";
|
|
12
|
+
export { parseBalanceChanges } from "../parse/outcome/balance_changes";
|
|
13
|
+
export { parseLockedBalanceChanges } from "../parse/outcome/locked_balance_changes";
|
|
14
|
+
export { parseChannelChanges } from "../parse/outcome/channel_changes";
|
|
15
|
+
export { parseOrderbookChanges } from "../parse/outcome/orderbook_changes";
|
|
16
|
+
import parseNFTokenBurn from "../parse/specification/nftoken-burn";
|
|
17
|
+
import parseNFTokenMint from "../parse/specification/nftoken-mint";
|
|
18
|
+
import parseNFTokenFlags from "../parse/ledger/nftoken-flags";
|
|
19
|
+
import parseNFTOfferFlags from "../parse/ledger/nftoken-offer-flags";
|
|
20
|
+
import parseNFTokenAcceptOffer from "../parse/specification/nftoken-accept-offer";
|
|
21
|
+
import parseNFTokenCancelOffer from "../parse/specification/nftoken-cancel-offer";
|
|
22
|
+
import parseNFTokenCreateOffer from "../parse/specification/nftoken-create-offer";
|
|
23
|
+
export { parseNFTokenMint, parseNFTokenBurn, parseNFTokenFlags, parseNFTOfferFlags, parseNFTokenAcceptOffer, parseNFTokenCancelOffer, parseNFTokenCreateOffer, };
|