@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,40 @@
|
|
|
1
|
+
import { Amount, Memo } from "../common/types/objects";
|
|
2
|
+
export type TransactionJSON = {
|
|
3
|
+
Account: string;
|
|
4
|
+
TransactionType: string;
|
|
5
|
+
Memos?: Memo[];
|
|
6
|
+
Flags?: number;
|
|
7
|
+
Fulfillment?: string;
|
|
8
|
+
[Field: string]: string | number | any[] | Amount | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type Outcome = {
|
|
11
|
+
result?: string;
|
|
12
|
+
ledgerVersion?: number;
|
|
13
|
+
indexInLedger?: number;
|
|
14
|
+
fee?: string;
|
|
15
|
+
balanceChanges?: {
|
|
16
|
+
[key: string]: {
|
|
17
|
+
currency: string;
|
|
18
|
+
counterparty?: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
lockedBalanceChanges?: {
|
|
23
|
+
[key: string]: {
|
|
24
|
+
currency: string;
|
|
25
|
+
counterparty?: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
orderbookChanges?: object;
|
|
30
|
+
channelChanges?: object;
|
|
31
|
+
nftokenChanges?: object;
|
|
32
|
+
nftokenOfferChanges?: object;
|
|
33
|
+
affectedObjects?: object;
|
|
34
|
+
deliveredAmount?: {
|
|
35
|
+
currency: string;
|
|
36
|
+
counterparty?: string;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
timestamp?: string;
|
|
40
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormattedMemo, Memo } from "../common/types/objects";
|
|
2
|
+
export interface ClassicAccountAndTag {
|
|
3
|
+
classicAccount: string;
|
|
4
|
+
tag: number | false | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function getClassicAccountAndTag(Account: string, expectedTag?: number): ClassicAccountAndTag;
|
|
7
|
+
export declare function convertStringToHex(value: string): string;
|
|
8
|
+
export declare function convertMemo(memo: FormattedMemo): Memo;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertMemo = exports.convertStringToHex = exports.getClassicAccountAndTag = void 0;
|
|
4
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
function getClassicAccountAndTag(Account, expectedTag) {
|
|
7
|
+
if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
|
|
8
|
+
const classic = (0, ripple_address_codec_1.xAddressToClassicAddress)(Account);
|
|
9
|
+
if (expectedTag != null && classic.tag !== expectedTag) {
|
|
10
|
+
throw new Error("address includes a tag that does not match the tag specified in the transaction");
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
classicAccount: classic.classicAddress,
|
|
14
|
+
tag: classic.tag,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return {
|
|
19
|
+
classicAccount: Account,
|
|
20
|
+
tag: expectedTag,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.getClassicAccountAndTag = getClassicAccountAndTag;
|
|
25
|
+
function convertStringToHex(value) {
|
|
26
|
+
return Buffer.from(value, "utf8").toString("hex").toUpperCase();
|
|
27
|
+
}
|
|
28
|
+
exports.convertStringToHex = convertStringToHex;
|
|
29
|
+
function convertMemo(memo) {
|
|
30
|
+
return {
|
|
31
|
+
Memo: (0, common_1.removeUndefined)({
|
|
32
|
+
MemoData: memo.data ? convertStringToHex(memo.data) : undefined,
|
|
33
|
+
MemoType: memo.type ? convertStringToHex(memo.type) : undefined,
|
|
34
|
+
MemoFormat: memo.format ? convertStringToHex(memo.format) : undefined,
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.convertMemo = convertMemo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function classicAddressFromValidatorPK(pk: string | Buffer): string | null;
|
|
3
|
+
export interface GenerateSecretsInterface {
|
|
4
|
+
key_type: string;
|
|
5
|
+
secret_key: string;
|
|
6
|
+
public_key: string;
|
|
7
|
+
PublicKey: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function generateSecrets(): GenerateSecretsInterface;
|
|
10
|
+
export declare function sign(message: Buffer | string, secret: string): string;
|
|
11
|
+
export declare function verify(message: Buffer | string, signature: string, publicKey: string): boolean;
|
|
12
|
+
export declare function verify2(message: Buffer, signature: string, publicKey: string): boolean;
|
package/lib/validator.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
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.verify2 = exports.verify = exports.sign = exports.generateSecrets = exports.classicAddressFromValidatorPK = void 0;
|
|
30
|
+
const assert = __importStar(require("assert"));
|
|
31
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
32
|
+
const Crypto = __importStar(require("crypto"));
|
|
33
|
+
const Base58 = __importStar(require("./base58"));
|
|
34
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
35
|
+
const elliptic_1 = __importDefault(require("elliptic"));
|
|
36
|
+
const secp256k1 = new elliptic_1.default.ec("secp256k1");
|
|
37
|
+
const ed25519 = new elliptic_1.default.eddsa("ed25519");
|
|
38
|
+
const rippleKeypairs = __importStar(require("ripple-keypairs"));
|
|
39
|
+
const DER_PRIVATE_KEY_PREFIX = Buffer.from("302E020100300506032B657004220420", "hex");
|
|
40
|
+
const DER_PUBLIC_KEY_PREFIX = Buffer.from("302A300506032B6570032100", "hex");
|
|
41
|
+
const VALIDATOR_HEX_PREFIX_ED25519 = "ED";
|
|
42
|
+
const VALIDATOR_NODE_PUBLIC_KEY_PREFIX = "n";
|
|
43
|
+
function classicAddressFromValidatorPK(pk) {
|
|
44
|
+
let pubkey = pk;
|
|
45
|
+
if (typeof pk === "string") {
|
|
46
|
+
pubkey = (0, ripple_address_codec_1.decodeNodePublic)(pk);
|
|
47
|
+
}
|
|
48
|
+
assert.ok(pubkey.length === 33);
|
|
49
|
+
assert.ok(Crypto.getHashes().includes("sha256"));
|
|
50
|
+
assert.ok(Crypto.getHashes().includes("ripemd160"));
|
|
51
|
+
const pubkeyInnerHash = Crypto.createHash("sha256").update(Buffer.from(pubkey));
|
|
52
|
+
const pubkeyOuterHash = Crypto.createHash("ripemd160");
|
|
53
|
+
pubkeyOuterHash.update(pubkeyInnerHash.digest());
|
|
54
|
+
const accountID = pubkeyOuterHash.digest();
|
|
55
|
+
const addressTypePrefix = Buffer.from([0x00]);
|
|
56
|
+
const payload = Buffer.concat([addressTypePrefix, accountID]);
|
|
57
|
+
const chksumHash1 = Crypto.createHash("sha256").update(payload).digest();
|
|
58
|
+
const chksumHash2 = Crypto.createHash("sha256").update(chksumHash1).digest();
|
|
59
|
+
const checksum = chksumHash2.slice(0, 4);
|
|
60
|
+
const dataToEncode = Buffer.concat([payload, checksum]);
|
|
61
|
+
const address = Base58.encode(dataToEncode);
|
|
62
|
+
return address;
|
|
63
|
+
}
|
|
64
|
+
exports.classicAddressFromValidatorPK = classicAddressFromValidatorPK;
|
|
65
|
+
function generateSecrets() {
|
|
66
|
+
const keypair = crypto_1.default.generateKeyPairSync("ed25519", {
|
|
67
|
+
privateKeyEncoding: { format: "der", type: "pkcs8" },
|
|
68
|
+
publicKeyEncoding: { format: "der", type: "spki" },
|
|
69
|
+
});
|
|
70
|
+
const { privateKey, publicKey } = keypair;
|
|
71
|
+
const PublicKey = VALIDATOR_HEX_PREFIX_ED25519 +
|
|
72
|
+
publicKey.slice(DER_PUBLIC_KEY_PREFIX.length, publicKey.length).toString("hex").toUpperCase();
|
|
73
|
+
const secretKey = ripple_address_codec_1.codec.encode(privateKey.slice(DER_PRIVATE_KEY_PREFIX.length, privateKey.length), {
|
|
74
|
+
versions: [0x20],
|
|
75
|
+
expectedLength: 32,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
key_type: "ed25519",
|
|
79
|
+
secret_key: secretKey,
|
|
80
|
+
public_key: (0, ripple_address_codec_1.encodeNodePublic)(Buffer.from(PublicKey, "hex")),
|
|
81
|
+
PublicKey,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
exports.generateSecrets = generateSecrets;
|
|
85
|
+
function sign(message, secret) {
|
|
86
|
+
if (typeof message === "string") {
|
|
87
|
+
message = Buffer.from(message, "utf8");
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const decoded = ripple_address_codec_1.codec.decode(secret, { versions: [0x20] });
|
|
91
|
+
secret = VALIDATOR_HEX_PREFIX_ED25519 + decoded.bytes.toString("hex");
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
}
|
|
95
|
+
return rippleKeypairs.sign(message.toString("hex"), secret).toUpperCase();
|
|
96
|
+
}
|
|
97
|
+
exports.sign = sign;
|
|
98
|
+
function verify(message, signature, publicKey) {
|
|
99
|
+
if (typeof message === "string") {
|
|
100
|
+
message = Buffer.from(message, "utf8");
|
|
101
|
+
}
|
|
102
|
+
if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
|
|
103
|
+
const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
|
|
104
|
+
publicKey = publicKeyBuffer.toString("hex").toUpperCase();
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return rippleKeypairs.verify(message.toString("hex"), signature, publicKey);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
exports.verify = verify;
|
|
114
|
+
function verify2(message, signature, publicKey) {
|
|
115
|
+
if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
|
|
116
|
+
const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
|
|
117
|
+
publicKey = publicKeyBuffer.toString("hex").toUpperCase();
|
|
118
|
+
}
|
|
119
|
+
if (publicKey.slice(0, 2) === VALIDATOR_HEX_PREFIX_ED25519) {
|
|
120
|
+
const verifyKey = ed25519.keyFromPublic(publicKey.slice(2), "hex");
|
|
121
|
+
if (verifyKey.verify(message.toString("hex"), signature)) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
const computedHash = crypto_1.default.createHash("sha512").update(message).digest().toString("hex").slice(0, 64);
|
|
127
|
+
const verifyKey = secp256k1.keyFromPublic(publicKey, "hex");
|
|
128
|
+
if (verifyKey.verify(computedHash, signature)) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
exports.verify2 = verify2;
|
package/lib/wallet.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Wallet, Transaction } from "xrpl";
|
|
3
|
+
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
4
|
+
interface GenerateAddressInterface {
|
|
5
|
+
publicKey: string;
|
|
6
|
+
privateKey: string;
|
|
7
|
+
address: string;
|
|
8
|
+
seed: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function generateAddress(): GenerateAddressInterface;
|
|
11
|
+
export declare function isValidClassicAddress(address: string): boolean;
|
|
12
|
+
export declare function checksumClassicAddress(buffer: Buffer): Buffer;
|
|
13
|
+
export declare function singTransaction(wallet: Wallet, transaction: Transaction, multisign?: boolean | string, definitions?: XrplDefinitionsBase): {
|
|
14
|
+
tx_blob: string;
|
|
15
|
+
hash: string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
package/lib/wallet.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
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.singTransaction = exports.checksumClassicAddress = exports.isValidClassicAddress = exports.generateAddress = void 0;
|
|
30
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
31
|
+
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
32
|
+
const Crypto = __importStar(require("crypto"));
|
|
33
|
+
const xrpl_1 = require("xrpl");
|
|
34
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
35
|
+
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
|
36
|
+
const ripple_keypairs_1 = require("ripple-keypairs");
|
|
37
|
+
const Base58 = __importStar(require("./base58"));
|
|
38
|
+
const common_1 = require("./common");
|
|
39
|
+
var HashPrefix;
|
|
40
|
+
(function (HashPrefix) {
|
|
41
|
+
HashPrefix[HashPrefix["TRANSACTION_ID"] = 1415073280] = "TRANSACTION_ID";
|
|
42
|
+
})(HashPrefix || (HashPrefix = {}));
|
|
43
|
+
function generateAddress() {
|
|
44
|
+
const wallet = xrpl_1.Wallet.generate();
|
|
45
|
+
const { publicKey, privateKey, classicAddress, seed } = wallet;
|
|
46
|
+
return { publicKey, privateKey, address: classicAddress, seed: seed };
|
|
47
|
+
}
|
|
48
|
+
exports.generateAddress = generateAddress;
|
|
49
|
+
function isValidClassicAddress(address) {
|
|
50
|
+
if (!address || address.length === 0) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const buffer = Base58.decode(address);
|
|
54
|
+
if (buffer === null) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const checksum = checksumClassicAddress(buffer);
|
|
58
|
+
if (checksum[0] !== buffer[21] ||
|
|
59
|
+
checksum[1] !== buffer[22] ||
|
|
60
|
+
checksum[2] !== buffer[23] ||
|
|
61
|
+
checksum[3] !== buffer[24]) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
exports.isValidClassicAddress = isValidClassicAddress;
|
|
67
|
+
function checksumClassicAddress(buffer) {
|
|
68
|
+
const hash = buffer.slice(0, 21);
|
|
69
|
+
const checksumPrepare = Crypto.createHash("sha256").update(Buffer.from(hash)).digest();
|
|
70
|
+
const checksum = Crypto.createHash("sha256").update(checksumPrepare).digest();
|
|
71
|
+
return checksum;
|
|
72
|
+
}
|
|
73
|
+
exports.checksumClassicAddress = checksumClassicAddress;
|
|
74
|
+
function singTransaction(wallet, transaction, multisign, definitions) {
|
|
75
|
+
let multisignAddress = false;
|
|
76
|
+
if (typeof multisign === "string" && multisign.startsWith("X")) {
|
|
77
|
+
multisignAddress = multisign;
|
|
78
|
+
}
|
|
79
|
+
else if (multisign) {
|
|
80
|
+
multisignAddress = wallet.classicAddress;
|
|
81
|
+
}
|
|
82
|
+
const tx = (0, omitBy_1.default)({ ...transaction }, (value) => value == null);
|
|
83
|
+
if (tx.TxnSignature || tx.Signers) {
|
|
84
|
+
throw new xrpl_1.ValidationError('txJSON must not contain "TxnSignature" or "Signers" properties');
|
|
85
|
+
}
|
|
86
|
+
removeTrailingZeros(tx);
|
|
87
|
+
(0, xrpl_1.validate)(tx);
|
|
88
|
+
const txToSignAndEncode = { ...tx };
|
|
89
|
+
txToSignAndEncode.SigningPubKey = multisignAddress ? "" : wallet.publicKey;
|
|
90
|
+
if (multisignAddress) {
|
|
91
|
+
const signer = {
|
|
92
|
+
Account: multisignAddress,
|
|
93
|
+
SigningPubKey: wallet.publicKey,
|
|
94
|
+
TxnSignature: computeSignature(txToSignAndEncode, wallet.privateKey, multisignAddress, definitions),
|
|
95
|
+
};
|
|
96
|
+
txToSignAndEncode.Signers = [{ Signer: signer }];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
txToSignAndEncode.TxnSignature = computeSignature(txToSignAndEncode, wallet.privateKey, undefined, definitions);
|
|
100
|
+
}
|
|
101
|
+
const serialized = (0, ripple_binary_codec_1.encode)(txToSignAndEncode, definitions);
|
|
102
|
+
return {
|
|
103
|
+
tx_blob: serialized,
|
|
104
|
+
hash: hashSignedTx(serialized, definitions),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
exports.singTransaction = singTransaction;
|
|
108
|
+
function computeSignature(tx, privateKey, signAs, definitions) {
|
|
109
|
+
if (signAs) {
|
|
110
|
+
const classicAddress = (0, ripple_address_codec_1.isValidXAddress)(signAs) ? (0, ripple_address_codec_1.xAddressToClassicAddress)(signAs).classicAddress : signAs;
|
|
111
|
+
return (0, ripple_keypairs_1.sign)((0, ripple_binary_codec_1.encodeForMultisigning)(tx, classicAddress, definitions), privateKey);
|
|
112
|
+
}
|
|
113
|
+
return (0, ripple_keypairs_1.sign)((0, ripple_binary_codec_1.encodeForSigning)(tx, definitions), privateKey);
|
|
114
|
+
}
|
|
115
|
+
function removeTrailingZeros(tx) {
|
|
116
|
+
if (tx.TransactionType === "Payment" &&
|
|
117
|
+
typeof tx.Amount !== "string" &&
|
|
118
|
+
tx.Amount.value.includes(".") &&
|
|
119
|
+
tx.Amount.value.endsWith("0")) {
|
|
120
|
+
tx.Amount = { ...tx.Amount };
|
|
121
|
+
tx.Amount.value = new bignumber_js_1.default(tx.Amount.value).toString();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function hashSignedTx(tx, definitions) {
|
|
125
|
+
let txBlob;
|
|
126
|
+
let txObject;
|
|
127
|
+
if (typeof tx === "string") {
|
|
128
|
+
txBlob = tx;
|
|
129
|
+
txObject = (0, ripple_binary_codec_1.decode)(tx, definitions);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
txBlob = (0, ripple_binary_codec_1.encode)(tx);
|
|
133
|
+
txObject = tx;
|
|
134
|
+
}
|
|
135
|
+
if (txObject.TxnSignature === undefined && txObject.Signers === undefined) {
|
|
136
|
+
throw new xrpl_1.ValidationError("The transaction must be signed to hash it.");
|
|
137
|
+
}
|
|
138
|
+
const prefix = HashPrefix.TRANSACTION_ID.toString(16).toUpperCase();
|
|
139
|
+
return (0, common_1.sha512Half)(prefix.concat(txBlob));
|
|
140
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bithomp/xrpl-api",
|
|
3
|
+
"version": "2.3.6",
|
|
4
|
+
"description": "A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"author": "Bithomp AB",
|
|
8
|
+
"license": "GPL-3.0",
|
|
9
|
+
"-publishConfig": {
|
|
10
|
+
"-registry": "https://npm.pkg.github.com/"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/Bithomp/xrpl-api.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Bithomp/xrpl-api/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/Bithomp/xrpl-api#readme",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node ./node_modules/mocha/bin/mocha",
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
24
|
+
"lint": "tslint -p tsconfig.json",
|
|
25
|
+
"prepare": "npm run build",
|
|
26
|
+
"-prepublishOnly": "npm test && npm run lint",
|
|
27
|
+
"preversion": "npm run lint",
|
|
28
|
+
"version": "npm run format && git add -A src",
|
|
29
|
+
"postversion": "git push && git push --tags"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"lib/**/*"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@types/nconf": "^0.10.3",
|
|
36
|
+
"axios": "^0.27.2",
|
|
37
|
+
"base-x": "^4.0.0",
|
|
38
|
+
"bignumber.js": "^9.1.1",
|
|
39
|
+
"elliptic": "^6.5.4",
|
|
40
|
+
"lodash": "^4.17.21",
|
|
41
|
+
"ripple-address-codec": "^4.3.0",
|
|
42
|
+
"ripple-binary-codec": "^1.6.0",
|
|
43
|
+
"xrpl": "^2.8.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/lodash": "^4.14.195",
|
|
47
|
+
"@types/chai": "^4.3.5",
|
|
48
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
49
|
+
"@types/mocha": "^10.0.1",
|
|
50
|
+
"@types/node": "^18.16.3",
|
|
51
|
+
"chai": "^4.3.7",
|
|
52
|
+
"chai-as-promised": "^7.1.1",
|
|
53
|
+
"mocha": "^10.2.0",
|
|
54
|
+
"nconf": "^0.12.0",
|
|
55
|
+
"prettier": "^2.8.8",
|
|
56
|
+
"ts-jest": "^29.1.0",
|
|
57
|
+
"ts-node": "^10.9.1",
|
|
58
|
+
"tslint": "^6.1.3",
|
|
59
|
+
"tslint-config-prettier": "^1.18.0",
|
|
60
|
+
"typescript": "^5.1.3"
|
|
61
|
+
}
|
|
62
|
+
}
|