riplle-lib 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +15 -0
- package/README.md +149 -0
- package/a4lpwwp5.cjs +1 -0
- package/build/ripple-latest-min.js +2 -0
- package/build/ripple-latest.js +5181 -0
- package/dist/npm/api.d.ts +272 -0
- package/dist/npm/api.d.ts.map +1 -0
- package/dist/npm/api.js +276 -0
- package/dist/npm/api.js.map +1 -0
- package/dist/npm/broadcast.d.ts +10 -0
- package/dist/npm/broadcast.d.ts.map +1 -0
- package/dist/npm/broadcast.js +67 -0
- package/dist/npm/broadcast.js.map +1 -0
- package/dist/npm/common/backoff.d.ts +14 -0
- package/dist/npm/common/backoff.d.ts.map +1 -0
- package/dist/npm/common/backoff.js +26 -0
- package/dist/npm/common/backoff.js.map +1 -0
- package/dist/npm/common/browser-hacks.d.ts +4 -0
- package/dist/npm/common/browser-hacks.d.ts.map +1 -0
- package/dist/npm/common/browser-hacks.js +21 -0
- package/dist/npm/common/browser-hacks.js.map +1 -0
- package/dist/npm/common/connection.d.ts +50 -0
- package/dist/npm/common/connection.d.ts.map +1 -0
- package/dist/npm/common/connection.js +467 -0
- package/dist/npm/common/connection.js.map +1 -0
- package/dist/npm/common/constants.d.ts +62 -0
- package/dist/npm/common/constants.d.ts.map +1 -0
- package/dist/npm/common/constants.js +54 -0
- package/dist/npm/common/constants.js.map +1 -0
- package/dist/npm/common/errors.d.ts +41 -0
- package/dist/npm/common/errors.d.ts.map +1 -0
- package/dist/npm/common/errors.js +101 -0
- package/dist/npm/common/errors.js.map +1 -0
- package/dist/npm/common/hashes/hash-prefix.d.ts +12 -0
- package/dist/npm/common/hashes/hash-prefix.d.ts.map +1 -0
- package/dist/npm/common/hashes/hash-prefix.js +15 -0
- package/dist/npm/common/hashes/hash-prefix.js.map +1 -0
- package/dist/npm/common/hashes/index.d.ts +13 -0
- package/dist/npm/common/hashes/index.d.ts.map +1 -0
- package/dist/npm/common/hashes/index.js +129 -0
- package/dist/npm/common/hashes/index.js.map +1 -0
- package/dist/npm/common/hashes/ledgerspaces.d.ts +21 -0
- package/dist/npm/common/hashes/ledgerspaces.d.ts.map +1 -0
- package/dist/npm/common/hashes/ledgerspaces.js +22 -0
- package/dist/npm/common/hashes/ledgerspaces.js.map +1 -0
- package/dist/npm/common/hashes/sha512Half.d.ts +3 -0
- package/dist/npm/common/hashes/sha512Half.d.ts.map +1 -0
- package/dist/npm/common/hashes/sha512Half.js +12 -0
- package/dist/npm/common/hashes/sha512Half.js.map +1 -0
- package/dist/npm/common/hashes/shamap.d.ts +38 -0
- package/dist/npm/common/hashes/shamap.d.ts.map +1 -0
- package/dist/npm/common/hashes/shamap.js +121 -0
- package/dist/npm/common/hashes/shamap.js.map +1 -0
- package/dist/npm/common/index.d.ts +10 -0
- package/dist/npm/common/index.d.ts.map +1 -0
- package/dist/npm/common/index.js +57 -0
- package/dist/npm/common/index.js.map +1 -0
- package/dist/npm/common/rangeset.d.ts +13 -0
- package/dist/npm/common/rangeset.d.ts.map +1 -0
- package/dist/npm/common/rangeset.js +72 -0
- package/dist/npm/common/rangeset.js.map +1 -0
- package/dist/npm/common/schema-validator.d.ts +5 -0
- package/dist/npm/common/schema-validator.d.ts.map +1 -0
- package/dist/npm/common/schema-validator.js +190 -0
- package/dist/npm/common/schema-validator.js.map +1 -0
- package/dist/npm/common/schemas/input/api-options.json +69 -0
- package/dist/npm/common/schemas/input/combine.json +19 -0
- package/dist/npm/common/schemas/input/compute-ledger-hash.json +13 -0
- package/dist/npm/common/schemas/input/generate-address.json +37 -0
- package/dist/npm/common/schemas/input/generate-x-address.json +37 -0
- package/dist/npm/common/schemas/input/get-account-info.json +24 -0
- package/dist/npm/common/schemas/input/get-account-objects.json +56 -0
- package/dist/npm/common/schemas/input/get-balance-sheet.json +30 -0
- package/dist/npm/common/schemas/input/get-balances.json +37 -0
- package/dist/npm/common/schemas/input/get-fee.json +13 -0
- package/dist/npm/common/schemas/input/get-ledger.json +35 -0
- package/dist/npm/common/schemas/input/get-orderbook.json +33 -0
- package/dist/npm/common/schemas/input/get-orders.json +29 -0
- package/dist/npm/common/schemas/input/get-paths.json +69 -0
- package/dist/npm/common/schemas/input/get-payment-channel.json +14 -0
- package/dist/npm/common/schemas/input/get-settings.json +24 -0
- package/dist/npm/common/schemas/input/get-transaction.json +28 -0
- package/dist/npm/common/schemas/input/get-transactions.json +71 -0
- package/dist/npm/common/schemas/input/get-trustlines.json +37 -0
- package/dist/npm/common/schemas/input/prepare-check-cancel.json +18 -0
- package/dist/npm/common/schemas/input/prepare-check-cash.json +18 -0
- package/dist/npm/common/schemas/input/prepare-check-create.json +18 -0
- package/dist/npm/common/schemas/input/prepare-escrow-cancellation.json +18 -0
- package/dist/npm/common/schemas/input/prepare-escrow-creation.json +18 -0
- package/dist/npm/common/schemas/input/prepare-escrow-execution.json +18 -0
- package/dist/npm/common/schemas/input/prepare-order-cancellation.json +18 -0
- package/dist/npm/common/schemas/input/prepare-order.json +18 -0
- package/dist/npm/common/schemas/input/prepare-payment-channel-claim.json +18 -0
- package/dist/npm/common/schemas/input/prepare-payment-channel-create.json +18 -0
- package/dist/npm/common/schemas/input/prepare-payment-channel-fund.json +18 -0
- package/dist/npm/common/schemas/input/prepare-payment.json +18 -0
- package/dist/npm/common/schemas/input/prepare-settings.json +18 -0
- package/dist/npm/common/schemas/input/prepare-ticket-create.json +18 -0
- package/dist/npm/common/schemas/input/prepare-trustline.json +18 -0
- package/dist/npm/common/schemas/input/sign-payment-channel-claim.json +21 -0
- package/dist/npm/common/schemas/input/sign.json +55 -0
- package/dist/npm/common/schemas/input/submit.json +17 -0
- package/dist/npm/common/schemas/input/verify-payment-channel-claim.json +25 -0
- package/dist/npm/common/schemas/objects/address.json +12 -0
- package/dist/npm/common/schemas/objects/adjustment.json +12 -0
- package/dist/npm/common/schemas/objects/amount.json +10 -0
- package/dist/npm/common/schemas/objects/amountbase.json +44 -0
- package/dist/npm/common/schemas/objects/balance.json +45 -0
- package/dist/npm/common/schemas/objects/blob.json +8 -0
- package/dist/npm/common/schemas/objects/classic-address.json +9 -0
- package/dist/npm/common/schemas/objects/currency.json +8 -0
- package/dist/npm/common/schemas/objects/destination-address-tag.json +15 -0
- package/dist/npm/common/schemas/objects/destination-adjustment.json +9 -0
- package/dist/npm/common/schemas/objects/destination-exact-adjustment.json +18 -0
- package/dist/npm/common/schemas/objects/hash128.json +7 -0
- package/dist/npm/common/schemas/objects/hash256.json +7 -0
- package/dist/npm/common/schemas/objects/instructions.json +59 -0
- package/dist/npm/common/schemas/objects/issue.json +9 -0
- package/dist/npm/common/schemas/objects/lax-amount.json +14 -0
- package/dist/npm/common/schemas/objects/lax-lax-amount.json +14 -0
- package/dist/npm/common/schemas/objects/ledger-version.json +15 -0
- package/dist/npm/common/schemas/objects/max-adjustment.json +18 -0
- package/dist/npm/common/schemas/objects/memo.json +25 -0
- package/dist/npm/common/schemas/objects/memos.json +10 -0
- package/dist/npm/common/schemas/objects/min-adjustment.json +18 -0
- package/dist/npm/common/schemas/objects/orderbook.json +11 -0
- package/dist/npm/common/schemas/objects/private-key.json +7 -0
- package/dist/npm/common/schemas/objects/public-key.json +7 -0
- package/dist/npm/common/schemas/objects/quality.json +8 -0
- package/dist/npm/common/schemas/objects/sequence.json +8 -0
- package/dist/npm/common/schemas/objects/settings-plus-memos.json +120 -0
- package/dist/npm/common/schemas/objects/signature.json +7 -0
- package/dist/npm/common/schemas/objects/signed-value.json +8 -0
- package/dist/npm/common/schemas/objects/source-adjustment.json +9 -0
- package/dist/npm/common/schemas/objects/source-exact-adjustment.json +18 -0
- package/dist/npm/common/schemas/objects/tag.json +7 -0
- package/dist/npm/common/schemas/objects/ticket-sequence.json +8 -0
- package/dist/npm/common/schemas/objects/transaction-hash.json +8 -0
- package/dist/npm/common/schemas/objects/transaction-type.json +25 -0
- package/dist/npm/common/schemas/objects/tx-json.json +12 -0
- package/dist/npm/common/schemas/objects/uint32.json +8 -0
- package/dist/npm/common/schemas/objects/value.json +8 -0
- package/dist/npm/common/schemas/objects/x-address.json +9 -0
- package/dist/npm/common/schemas/output/generate-address.json +26 -0
- package/dist/npm/common/schemas/output/generate-x-address.json +18 -0
- package/dist/npm/common/schemas/output/get-account-info.json +40 -0
- package/dist/npm/common/schemas/output/get-account-objects.json +48 -0
- package/dist/npm/common/schemas/output/get-balance-sheet.json +33 -0
- package/dist/npm/common/schemas/output/get-balances.json +6 -0
- package/dist/npm/common/schemas/output/get-ledger.json +90 -0
- package/dist/npm/common/schemas/output/get-orderbook.json +17 -0
- package/dist/npm/common/schemas/output/get-orders.json +36 -0
- package/dist/npm/common/schemas/output/get-paths.json +24 -0
- package/dist/npm/common/schemas/output/get-payment-channel.json +67 -0
- package/dist/npm/common/schemas/output/get-server-info.json +117 -0
- package/dist/npm/common/schemas/output/get-settings.json +8 -0
- package/dist/npm/common/schemas/output/get-transaction.json +237 -0
- package/dist/npm/common/schemas/output/get-transactions.json +8 -0
- package/dist/npm/common/schemas/output/get-trustlines.json +49 -0
- package/dist/npm/common/schemas/output/ledger-event.json +46 -0
- package/dist/npm/common/schemas/output/order-change.json +40 -0
- package/dist/npm/common/schemas/output/orderbook-orders.json +58 -0
- package/dist/npm/common/schemas/output/outcome.json +57 -0
- package/dist/npm/common/schemas/output/prepare.json +47 -0
- package/dist/npm/common/schemas/output/sign-payment-channel-claim.json +7 -0
- package/dist/npm/common/schemas/output/sign.json +18 -0
- package/dist/npm/common/schemas/output/submit.json +37 -0
- package/dist/npm/common/schemas/output/verify-payment-channel-claim.json +6 -0
- package/dist/npm/common/schemas/specifications/account-delete.json +30 -0
- package/dist/npm/common/schemas/specifications/check-cancel.json +15 -0
- package/dist/npm/common/schemas/specifications/check-cash.json +27 -0
- package/dist/npm/common/schemas/specifications/check-create.json +32 -0
- package/dist/npm/common/schemas/specifications/deposit-preauth.json +22 -0
- package/dist/npm/common/schemas/specifications/escrow-cancellation.json +19 -0
- package/dist/npm/common/schemas/specifications/escrow-creation.json +42 -0
- package/dist/npm/common/schemas/specifications/escrow-execution.json +29 -0
- package/dist/npm/common/schemas/specifications/get-payment.json +39 -0
- package/dist/npm/common/schemas/specifications/order-cancellation.json +15 -0
- package/dist/npm/common/schemas/specifications/order.json +49 -0
- package/dist/npm/common/schemas/specifications/payment-channel-claim.json +39 -0
- package/dist/npm/common/schemas/specifications/payment-channel-create.json +40 -0
- package/dist/npm/common/schemas/specifications/payment-channel-fund.json +24 -0
- package/dist/npm/common/schemas/specifications/payment.json +39 -0
- package/dist/npm/common/schemas/specifications/settings.json +20 -0
- package/dist/npm/common/schemas/specifications/trustline.json +43 -0
- package/dist/npm/common/serverinfo.d.ts +34 -0
- package/dist/npm/common/serverinfo.d.ts.map +1 -0
- package/dist/npm/common/serverinfo.js +63 -0
- package/dist/npm/common/serverinfo.js.map +1 -0
- package/dist/npm/common/txflags.d.ts +51 -0
- package/dist/npm/common/txflags.d.ts.map +1 -0
- package/dist/npm/common/txflags.js +55 -0
- package/dist/npm/common/txflags.js.map +1 -0
- package/dist/npm/common/types/commands/account_info.d.ts +18 -0
- package/dist/npm/common/types/commands/account_info.d.ts.map +1 -0
- package/dist/npm/common/types/commands/account_info.js +3 -0
- package/dist/npm/common/types/commands/account_info.js.map +1 -0
- package/dist/npm/common/types/commands/account_lines.d.ts +18 -0
- package/dist/npm/common/types/commands/account_lines.d.ts.map +1 -0
- package/dist/npm/common/types/commands/account_lines.js +3 -0
- package/dist/npm/common/types/commands/account_lines.js.map +1 -0
- package/dist/npm/common/types/commands/account_objects.d.ts +27 -0
- package/dist/npm/common/types/commands/account_objects.d.ts.map +1 -0
- package/dist/npm/common/types/commands/account_objects.js +3 -0
- package/dist/npm/common/types/commands/account_objects.js.map +1 -0
- package/dist/npm/common/types/commands/account_offers.d.ts +25 -0
- package/dist/npm/common/types/commands/account_offers.d.ts.map +1 -0
- package/dist/npm/common/types/commands/account_offers.js +3 -0
- package/dist/npm/common/types/commands/account_offers.js.map +1 -0
- package/dist/npm/common/types/commands/book_offers.d.ts +24 -0
- package/dist/npm/common/types/commands/book_offers.d.ts.map +1 -0
- package/dist/npm/common/types/commands/book_offers.js +3 -0
- package/dist/npm/common/types/commands/book_offers.js.map +1 -0
- package/dist/npm/common/types/commands/gateway_balances.d.ts +24 -0
- package/dist/npm/common/types/commands/gateway_balances.d.ts.map +1 -0
- package/dist/npm/common/types/commands/gateway_balances.js +3 -0
- package/dist/npm/common/types/commands/gateway_balances.js.map +1 -0
- package/dist/npm/common/types/commands/index.d.ts +11 -0
- package/dist/npm/common/types/commands/index.d.ts.map +1 -0
- package/dist/npm/common/types/commands/index.js +23 -0
- package/dist/npm/common/types/commands/index.js.map +1 -0
- package/dist/npm/common/types/commands/ledger.d.ts +19 -0
- package/dist/npm/common/types/commands/ledger.d.ts.map +1 -0
- package/dist/npm/common/types/commands/ledger.js +3 -0
- package/dist/npm/common/types/commands/ledger.js.map +1 -0
- package/dist/npm/common/types/commands/ledger_data.d.ts +11 -0
- package/dist/npm/common/types/commands/ledger_data.d.ts.map +1 -0
- package/dist/npm/common/types/commands/ledger_data.js +3 -0
- package/dist/npm/common/types/commands/ledger_data.js.map +1 -0
- package/dist/npm/common/types/commands/ledger_entry.d.ts +30 -0
- package/dist/npm/common/types/commands/ledger_entry.d.ts.map +1 -0
- package/dist/npm/common/types/commands/ledger_entry.js +3 -0
- package/dist/npm/common/types/commands/ledger_entry.js.map +1 -0
- package/dist/npm/common/types/commands/server_info.d.ts +50 -0
- package/dist/npm/common/types/commands/server_info.d.ts.map +1 -0
- package/dist/npm/common/types/commands/server_info.js +3 -0
- package/dist/npm/common/types/commands/server_info.js.map +1 -0
- package/dist/npm/common/types/objects/adjustments.d.ts +17 -0
- package/dist/npm/common/types/objects/adjustments.d.ts.map +1 -0
- package/dist/npm/common/types/objects/adjustments.js +3 -0
- package/dist/npm/common/types/objects/adjustments.js.map +1 -0
- package/dist/npm/common/types/objects/amounts.d.ts +14 -0
- package/dist/npm/common/types/objects/amounts.d.ts.map +1 -0
- package/dist/npm/common/types/objects/amounts.js +3 -0
- package/dist/npm/common/types/objects/amounts.js.map +1 -0
- package/dist/npm/common/types/objects/index.d.ts +13 -0
- package/dist/npm/common/types/objects/index.d.ts.map +1 -0
- package/dist/npm/common/types/objects/index.js +25 -0
- package/dist/npm/common/types/objects/index.js.map +1 -0
- package/dist/npm/common/types/objects/ledger.d.ts +30 -0
- package/dist/npm/common/types/objects/ledger.d.ts.map +1 -0
- package/dist/npm/common/types/objects/ledger.js +3 -0
- package/dist/npm/common/types/objects/ledger.js.map +1 -0
- package/dist/npm/common/types/objects/ledger_data.d.ts +11 -0
- package/dist/npm/common/types/objects/ledger_data.d.ts.map +1 -0
- package/dist/npm/common/types/objects/ledger_data.js +3 -0
- package/dist/npm/common/types/objects/ledger_data.js.map +1 -0
- package/dist/npm/common/types/objects/ledger_entries.d.ts +159 -0
- package/dist/npm/common/types/objects/ledger_entries.d.ts.map +1 -0
- package/dist/npm/common/types/objects/ledger_entries.js +3 -0
- package/dist/npm/common/types/objects/ledger_entries.js.map +1 -0
- package/dist/npm/common/types/objects/memos.d.ts +6 -0
- package/dist/npm/common/types/objects/memos.d.ts.map +1 -0
- package/dist/npm/common/types/objects/memos.js +3 -0
- package/dist/npm/common/types/objects/memos.js.map +1 -0
- package/dist/npm/common/types/objects/orders.d.ts +14 -0
- package/dist/npm/common/types/objects/orders.d.ts.map +1 -0
- package/dist/npm/common/types/objects/orders.js +3 -0
- package/dist/npm/common/types/objects/orders.js.map +1 -0
- package/dist/npm/common/types/objects/queue_data.d.ts +16 -0
- package/dist/npm/common/types/objects/queue_data.d.ts.map +1 -0
- package/dist/npm/common/types/objects/queue_data.js +3 -0
- package/dist/npm/common/types/objects/queue_data.js.map +1 -0
- package/dist/npm/common/types/objects/settings.d.ts +31 -0
- package/dist/npm/common/types/objects/settings.d.ts.map +1 -0
- package/dist/npm/common/types/objects/settings.js +3 -0
- package/dist/npm/common/types/objects/settings.js.map +1 -0
- package/dist/npm/common/types/objects/signers.d.ts +7 -0
- package/dist/npm/common/types/objects/signers.d.ts.map +1 -0
- package/dist/npm/common/types/objects/signers.js +3 -0
- package/dist/npm/common/types/objects/signers.js.map +1 -0
- package/dist/npm/common/types/objects/transactions.d.ts +22 -0
- package/dist/npm/common/types/objects/transactions.d.ts.map +1 -0
- package/dist/npm/common/types/objects/transactions.js +3 -0
- package/dist/npm/common/types/objects/transactions.js.map +1 -0
- package/dist/npm/common/types/objects/trustlines.d.ts +40 -0
- package/dist/npm/common/types/objects/trustlines.d.ts.map +1 -0
- package/dist/npm/common/types/objects/trustlines.js +3 -0
- package/dist/npm/common/types/objects/trustlines.js.map +1 -0
- package/dist/npm/common/utils.d.ts +12 -0
- package/dist/npm/common/utils.d.ts.map +1 -0
- package/dist/npm/common/utils.js +157 -0
- package/dist/npm/common/utils.js.map +1 -0
- package/dist/npm/common/validate.d.ts +38 -0
- package/dist/npm/common/validate.d.ts.map +1 -0
- package/dist/npm/common/validate.js +79 -0
- package/dist/npm/common/validate.js.map +1 -0
- package/dist/npm/common/wswrapper.d.ts +15 -0
- package/dist/npm/common/wswrapper.d.ts.map +1 -0
- package/dist/npm/common/wswrapper.js +38 -0
- package/dist/npm/common/wswrapper.js.map +1 -0
- package/dist/npm/index.d.ts +6 -0
- package/dist/npm/index.d.ts.map +1 -0
- package/dist/npm/index.js +19 -0
- package/dist/npm/index.js.map +1 -0
- package/dist/npm/ledger/accountinfo.d.ts +14 -0
- package/dist/npm/ledger/accountinfo.d.ts.map +1 -0
- package/dist/npm/ledger/accountinfo.js +36 -0
- package/dist/npm/ledger/accountinfo.js.map +1 -0
- package/dist/npm/ledger/accountobjects.d.ts +4 -0
- package/dist/npm/ledger/accountobjects.d.ts.map +1 -0
- package/dist/npm/ledger/accountobjects.js +27 -0
- package/dist/npm/ledger/accountobjects.js.map +1 -0
- package/dist/npm/ledger/balance-sheet.d.ts +17 -0
- package/dist/npm/ledger/balance-sheet.d.ts.map +1 -0
- package/dist/npm/ledger/balance-sheet.js +52 -0
- package/dist/npm/ledger/balance-sheet.js.map +1 -0
- package/dist/npm/ledger/balances.d.ts +11 -0
- package/dist/npm/ledger/balances.d.ts.map +1 -0
- package/dist/npm/ledger/balances.js +61 -0
- package/dist/npm/ledger/balances.js.map +1 -0
- package/dist/npm/ledger/ledger.d.ts +12 -0
- package/dist/npm/ledger/ledger.d.ts.map +1 -0
- package/dist/npm/ledger/ledger.js +28 -0
- package/dist/npm/ledger/ledger.js.map +1 -0
- package/dist/npm/ledger/orderbook.d.ts +22 -0
- package/dist/npm/ledger/orderbook.d.ts.map +1 -0
- package/dist/npm/ledger/orderbook.js +100 -0
- package/dist/npm/ledger/orderbook.js.map +1 -0
- package/dist/npm/ledger/orders.d.ts +8 -0
- package/dist/npm/ledger/orders.d.ts.map +1 -0
- package/dist/npm/ledger/orders.js +56 -0
- package/dist/npm/ledger/orders.js.map +1 -0
- package/dist/npm/ledger/parse/account-delete.d.ts +8 -0
- package/dist/npm/ledger/parse/account-delete.d.ts.map +1 -0
- package/dist/npm/ledger/parse/account-delete.js +36 -0
- package/dist/npm/ledger/parse/account-delete.js.map +1 -0
- package/dist/npm/ledger/parse/account-order.d.ts +11 -0
- package/dist/npm/ledger/parse/account-order.d.ts.map +1 -0
- package/dist/npm/ledger/parse/account-order.js +40 -0
- package/dist/npm/ledger/parse/account-order.js.map +1 -0
- package/dist/npm/ledger/parse/account-trustline.d.ts +4 -0
- package/dist/npm/ledger/parse/account-trustline.d.ts.map +1 -0
- package/dist/npm/ledger/parse/account-trustline.js +28 -0
- package/dist/npm/ledger/parse/account-trustline.js.map +1 -0
- package/dist/npm/ledger/parse/amendment.d.ts +5 -0
- package/dist/npm/ledger/parse/amendment.d.ts.map +1 -0
- package/dist/npm/ledger/parse/amendment.js +9 -0
- package/dist/npm/ledger/parse/amendment.js.map +1 -0
- package/dist/npm/ledger/parse/amount.d.ts +4 -0
- package/dist/npm/ledger/parse/amount.d.ts.map +1 -0
- package/dist/npm/ledger/parse/amount.js +37 -0
- package/dist/npm/ledger/parse/amount.js.map +1 -0
- package/dist/npm/ledger/parse/cancellation.d.ts +3 -0
- package/dist/npm/ledger/parse/cancellation.d.ts.map +1 -0
- package/dist/npm/ledger/parse/cancellation.js +32 -0
- package/dist/npm/ledger/parse/cancellation.js.map +1 -0
- package/dist/npm/ledger/parse/check-cancel.d.ts +6 -0
- package/dist/npm/ledger/parse/check-cancel.d.ts.map +1 -0
- package/dist/npm/ledger/parse/check-cancel.js +33 -0
- package/dist/npm/ledger/parse/check-cancel.js.map +1 -0
- package/dist/npm/ledger/parse/check-cash.d.ts +9 -0
- package/dist/npm/ledger/parse/check-cash.d.ts.map +1 -0
- package/dist/npm/ledger/parse/check-cash.js +39 -0
- package/dist/npm/ledger/parse/check-cash.js.map +1 -0
- package/dist/npm/ledger/parse/check-create.d.ts +11 -0
- package/dist/npm/ledger/parse/check-create.d.ts.map +1 -0
- package/dist/npm/ledger/parse/check-create.js +42 -0
- package/dist/npm/ledger/parse/check-create.js.map +1 -0
- package/dist/npm/ledger/parse/deposit-preauth.d.ts +7 -0
- package/dist/npm/ledger/parse/deposit-preauth.d.ts.map +1 -0
- package/dist/npm/ledger/parse/deposit-preauth.js +34 -0
- package/dist/npm/ledger/parse/deposit-preauth.js.map +1 -0
- package/dist/npm/ledger/parse/escrow-cancellation.d.ts +3 -0
- package/dist/npm/ledger/parse/escrow-cancellation.d.ts.map +1 -0
- package/dist/npm/ledger/parse/escrow-cancellation.js +34 -0
- package/dist/npm/ledger/parse/escrow-cancellation.js.map +1 -0
- package/dist/npm/ledger/parse/escrow-creation.d.ts +3 -0
- package/dist/npm/ledger/parse/escrow-creation.d.ts.map +1 -0
- package/dist/npm/ledger/parse/escrow-creation.js +43 -0
- package/dist/npm/ledger/parse/escrow-creation.js.map +1 -0
- package/dist/npm/ledger/parse/escrow-execution.d.ts +3 -0
- package/dist/npm/ledger/parse/escrow-execution.d.ts.map +1 -0
- package/dist/npm/ledger/parse/escrow-execution.js +36 -0
- package/dist/npm/ledger/parse/escrow-execution.js.map +1 -0
- package/dist/npm/ledger/parse/fee-update.d.ts +9 -0
- package/dist/npm/ledger/parse/fee-update.d.ts.map +1 -0
- package/dist/npm/ledger/parse/fee-update.js +20 -0
- package/dist/npm/ledger/parse/fee-update.js.map +1 -0
- package/dist/npm/ledger/parse/fields.d.ts +3 -0
- package/dist/npm/ledger/parse/fields.d.ts.map +1 -0
- package/dist/npm/ledger/parse/fields.js +47 -0
- package/dist/npm/ledger/parse/fields.js.map +1 -0
- package/dist/npm/ledger/parse/flags.d.ts +16 -0
- package/dist/npm/ledger/parse/flags.d.ts.map +1 -0
- package/dist/npm/ledger/parse/flags.js +20 -0
- package/dist/npm/ledger/parse/flags.js.map +1 -0
- package/dist/npm/ledger/parse/ledger.d.ts +19 -0
- package/dist/npm/ledger/parse/ledger.d.ts.map +1 -0
- package/dist/npm/ledger/parse/ledger.js +76 -0
- package/dist/npm/ledger/parse/ledger.js.map +1 -0
- package/dist/npm/ledger/parse/order.d.ts +4 -0
- package/dist/npm/ledger/parse/order.d.ts.map +1 -0
- package/dist/npm/ledger/parse/order.js +50 -0
- package/dist/npm/ledger/parse/order.js.map +1 -0
- package/dist/npm/ledger/parse/orderbook-order.d.ts +17 -0
- package/dist/npm/ledger/parse/orderbook-order.d.ts.map +1 -0
- package/dist/npm/ledger/parse/orderbook-order.js +63 -0
- package/dist/npm/ledger/parse/orderbook-order.js.map +1 -0
- package/dist/npm/ledger/parse/pathfind.d.ts +4 -0
- package/dist/npm/ledger/parse/pathfind.d.ts.map +1 -0
- package/dist/npm/ledger/parse/pathfind.js +63 -0
- package/dist/npm/ledger/parse/pathfind.js.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-claim.d.ts +3 -0
- package/dist/npm/ledger/parse/payment-channel-claim.d.ts.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-claim.js +44 -0
- package/dist/npm/ledger/parse/payment-channel-claim.js.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-create.d.ts +3 -0
- package/dist/npm/ledger/parse/payment-channel-create.d.ts.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-create.js +43 -0
- package/dist/npm/ledger/parse/payment-channel-create.js.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-fund.d.ts +3 -0
- package/dist/npm/ledger/parse/payment-channel-fund.d.ts.map +1 -0
- package/dist/npm/ledger/parse/payment-channel-fund.js +39 -0
- package/dist/npm/ledger/parse/payment-channel-fund.js.map +1 -0
- package/dist/npm/ledger/parse/payment-channel.d.ts +17 -0
- package/dist/npm/ledger/parse/payment-channel.d.ts.map +1 -0
- package/dist/npm/ledger/parse/payment-channel.js +24 -0
- package/dist/npm/ledger/parse/payment-channel.js.map +1 -0
- package/dist/npm/ledger/parse/payment.d.ts +3 -0
- package/dist/npm/ledger/parse/payment.d.ts.map +1 -0
- package/dist/npm/ledger/parse/payment.js +64 -0
- package/dist/npm/ledger/parse/payment.js.map +1 -0
- package/dist/npm/ledger/parse/settings.d.ts +3 -0
- package/dist/npm/ledger/parse/settings.d.ts.map +1 -0
- package/dist/npm/ledger/parse/settings.js +75 -0
- package/dist/npm/ledger/parse/settings.js.map +1 -0
- package/dist/npm/ledger/parse/ticket-create.d.ts +3 -0
- package/dist/npm/ledger/parse/ticket-create.d.ts.map +1 -0
- package/dist/npm/ledger/parse/ticket-create.js +33 -0
- package/dist/npm/ledger/parse/ticket-create.js.map +1 -0
- package/dist/npm/ledger/parse/transaction.d.ts +3 -0
- package/dist/npm/ledger/parse/transaction.d.ts.map +1 -0
- package/dist/npm/ledger/parse/transaction.js +98 -0
- package/dist/npm/ledger/parse/transaction.js.map +1 -0
- package/dist/npm/ledger/parse/trustline.d.ts +3 -0
- package/dist/npm/ledger/parse/trustline.d.ts.map +1 -0
- package/dist/npm/ledger/parse/trustline.js +50 -0
- package/dist/npm/ledger/parse/trustline.js.map +1 -0
- package/dist/npm/ledger/parse/utils.d.ts +10 -0
- package/dist/npm/ledger/parse/utils.d.ts.map +1 -0
- package/dist/npm/ledger/parse/utils.js +136 -0
- package/dist/npm/ledger/parse/utils.js.map +1 -0
- package/dist/npm/ledger/pathfind-types.d.ts +60 -0
- package/dist/npm/ledger/pathfind-types.d.ts.map +1 -0
- package/dist/npm/ledger/pathfind-types.js +3 -0
- package/dist/npm/ledger/pathfind-types.js.map +1 -0
- package/dist/npm/ledger/pathfind.d.ts +5 -0
- package/dist/npm/ledger/pathfind.d.ts.map +1 -0
- package/dist/npm/ledger/pathfind.js +141 -0
- package/dist/npm/ledger/pathfind.js.map +1 -0
- package/dist/npm/ledger/payment-channel.d.ts +5 -0
- package/dist/npm/ledger/payment-channel.d.ts.map +1 -0
- package/dist/npm/ledger/payment-channel.js +34 -0
- package/dist/npm/ledger/payment-channel.js.map +1 -0
- package/dist/npm/ledger/settings.d.ts +11 -0
- package/dist/npm/ledger/settings.d.ts.map +1 -0
- package/dist/npm/ledger/settings.js +53 -0
- package/dist/npm/ledger/settings.js.map +1 -0
- package/dist/npm/ledger/transaction.d.ts +10 -0
- package/dist/npm/ledger/transaction.d.ts.map +1 -0
- package/dist/npm/ledger/transaction.js +126 -0
- package/dist/npm/ledger/transaction.js.map +1 -0
- package/dist/npm/ledger/transactions.d.ts +20 -0
- package/dist/npm/ledger/transactions.d.ts.map +1 -0
- package/dist/npm/ledger/transactions.js +156 -0
- package/dist/npm/ledger/transactions.js.map +1 -0
- package/dist/npm/ledger/trustlines.d.ts +11 -0
- package/dist/npm/ledger/trustlines.d.ts.map +1 -0
- package/dist/npm/ledger/trustlines.js +58 -0
- package/dist/npm/ledger/trustlines.js.map +1 -0
- package/dist/npm/ledger/utils.d.ts +33 -0
- package/dist/npm/ledger/utils.d.ts.map +1 -0
- package/dist/npm/ledger/utils.js +107 -0
- package/dist/npm/ledger/utils.js.map +1 -0
- package/dist/npm/offline/derive.d.ts +8 -0
- package/dist/npm/offline/derive.d.ts.map +1 -0
- package/dist/npm/offline/derive.js +13 -0
- package/dist/npm/offline/derive.js.map +1 -0
- package/dist/npm/offline/generate-address.d.ts +15 -0
- package/dist/npm/offline/generate-address.d.ts.map +1 -0
- package/dist/npm/offline/generate-address.js +37 -0
- package/dist/npm/offline/generate-address.js.map +1 -0
- package/dist/npm/offline/ledgerhash.d.ts +6 -0
- package/dist/npm/offline/ledgerhash.d.ts.map +1 -0
- package/dist/npm/offline/ledgerhash.js +104 -0
- package/dist/npm/offline/ledgerhash.js.map +1 -0
- package/dist/npm/offline/sign-payment-channel-claim.d.ts +3 -0
- package/dist/npm/offline/sign-payment-channel-claim.d.ts.map +1 -0
- package/dist/npm/offline/sign-payment-channel-claim.js +38 -0
- package/dist/npm/offline/sign-payment-channel-claim.js.map +1 -0
- package/dist/npm/offline/utils.d.ts +10 -0
- package/dist/npm/offline/utils.d.ts.map +1 -0
- package/dist/npm/offline/utils.js +43 -0
- package/dist/npm/offline/utils.js.map +1 -0
- package/dist/npm/offline/verify-payment-channel-claim.d.ts +3 -0
- package/dist/npm/offline/verify-payment-channel-claim.d.ts.map +1 -0
- package/dist/npm/offline/verify-payment-channel-claim.js +18 -0
- package/dist/npm/offline/verify-payment-channel-claim.js.map +1 -0
- package/dist/npm/server/server.d.ts +8 -0
- package/dist/npm/server/server.d.ts.map +1 -0
- package/dist/npm/server/server.js +66 -0
- package/dist/npm/server/server.js.map +1 -0
- package/dist/npm/transaction/check-cancel.d.ts +8 -0
- package/dist/npm/transaction/check-cancel.d.ts.map +1 -0
- package/dist/npm/transaction/check-cancel.js +24 -0
- package/dist/npm/transaction/check-cancel.js.map +1 -0
- package/dist/npm/transaction/check-cash.d.ts +11 -0
- package/dist/npm/transaction/check-cash.d.ts.map +1 -0
- package/dist/npm/transaction/check-cash.js +55 -0
- package/dist/npm/transaction/check-cash.js.map +1 -0
- package/dist/npm/transaction/check-create.d.ts +13 -0
- package/dist/npm/transaction/check-create.d.ts.map +1 -0
- package/dist/npm/transaction/check-create.js +54 -0
- package/dist/npm/transaction/check-create.js.map +1 -0
- package/dist/npm/transaction/combine.d.ts +3 -0
- package/dist/npm/transaction/combine.d.ts.map +1 -0
- package/dist/npm/transaction/combine.js +62 -0
- package/dist/npm/transaction/combine.js.map +1 -0
- package/dist/npm/transaction/escrow-cancellation.d.ts +11 -0
- package/dist/npm/transaction/escrow-cancellation.d.ts.map +1 -0
- package/dist/npm/transaction/escrow-cancellation.js +46 -0
- package/dist/npm/transaction/escrow-cancellation.js.map +1 -0
- package/dist/npm/transaction/escrow-creation.d.ts +16 -0
- package/dist/npm/transaction/escrow-creation.d.ts.map +1 -0
- package/dist/npm/transaction/escrow-creation.js +69 -0
- package/dist/npm/transaction/escrow-creation.js.map +1 -0
- package/dist/npm/transaction/escrow-execution.d.ts +13 -0
- package/dist/npm/transaction/escrow-execution.d.ts.map +1 -0
- package/dist/npm/transaction/escrow-execution.js +58 -0
- package/dist/npm/transaction/escrow-execution.js.map +1 -0
- package/dist/npm/transaction/order.d.ts +6 -0
- package/dist/npm/transaction/order.d.ts.map +1 -0
- package/dist/npm/transaction/order.js +69 -0
- package/dist/npm/transaction/order.js.map +1 -0
- package/dist/npm/transaction/ordercancellation.d.ts +5 -0
- package/dist/npm/transaction/ordercancellation.d.ts.map +1 -0
- package/dist/npm/transaction/ordercancellation.js +50 -0
- package/dist/npm/transaction/ordercancellation.js.map +1 -0
- package/dist/npm/transaction/payment-channel-claim.d.ts +14 -0
- package/dist/npm/transaction/payment-channel-claim.d.ts.map +1 -0
- package/dist/npm/transaction/payment-channel-claim.js +76 -0
- package/dist/npm/transaction/payment-channel-claim.js.map +1 -0
- package/dist/npm/transaction/payment-channel-create.d.ts +14 -0
- package/dist/npm/transaction/payment-channel-create.d.ts.map +1 -0
- package/dist/npm/transaction/payment-channel-create.js +59 -0
- package/dist/npm/transaction/payment-channel-create.js.map +1 -0
- package/dist/npm/transaction/payment-channel-fund.d.ts +10 -0
- package/dist/npm/transaction/payment-channel-fund.d.ts.map +1 -0
- package/dist/npm/transaction/payment-channel-fund.js +51 -0
- package/dist/npm/transaction/payment-channel-fund.js.map +1 -0
- package/dist/npm/transaction/payment.d.ts +16 -0
- package/dist/npm/transaction/payment.d.ts.map +1 -0
- package/dist/npm/transaction/payment.js +163 -0
- package/dist/npm/transaction/payment.js.map +1 -0
- package/dist/npm/transaction/settings.d.ts +6 -0
- package/dist/npm/transaction/settings.d.ts.map +1 -0
- package/dist/npm/transaction/settings.js +130 -0
- package/dist/npm/transaction/settings.js.map +1 -0
- package/dist/npm/transaction/sign.d.ts +8 -0
- package/dist/npm/transaction/sign.d.ts.map +1 -0
- package/dist/npm/transaction/sign.js +173 -0
- package/dist/npm/transaction/sign.js.map +1 -0
- package/dist/npm/transaction/submit.d.ts +8 -0
- package/dist/npm/transaction/submit.d.ts.map +1 -0
- package/dist/npm/transaction/submit.js +59 -0
- package/dist/npm/transaction/submit.js.map +1 -0
- package/dist/npm/transaction/ticket.d.ts +9 -0
- package/dist/npm/transaction/ticket.d.ts.map +1 -0
- package/dist/npm/transaction/ticket.js +46 -0
- package/dist/npm/transaction/ticket.js.map +1 -0
- package/dist/npm/transaction/trustline.d.ts +6 -0
- package/dist/npm/transaction/trustline.d.ts.map +1 -0
- package/dist/npm/transaction/trustline.js +82 -0
- package/dist/npm/transaction/trustline.js.map +1 -0
- package/dist/npm/transaction/types.d.ts +138 -0
- package/dist/npm/transaction/types.d.ts.map +1 -0
- package/dist/npm/transaction/types.js +3 -0
- package/dist/npm/transaction/types.js.map +1 -0
- package/dist/npm/transaction/utils.d.ts +22 -0
- package/dist/npm/transaction/utils.d.ts.map +1 -0
- package/dist/npm/transaction/utils.js +285 -0
- package/dist/npm/transaction/utils.js.map +1 -0
- package/dist/npm/tsconfig.tsbuildinfo +4230 -0
- package/dist/npm/wallet/wallet-generation.d.ts +15 -0
- package/dist/npm/wallet/wallet-generation.d.ts.map +1 -0
- package/dist/npm/wallet/wallet-generation.js +150 -0
- package/dist/npm/wallet/wallet-generation.js.map +1 -0
- package/package.json +84 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
+
const _ = __importStar(require("lodash"));
|
23
|
+
const utils = __importStar(require("./utils"));
|
24
|
+
const validate = utils.common.validate;
|
25
|
+
const paymentFlags = utils.common.txFlags.Payment;
|
26
|
+
const ValidationError = utils.common.errors.ValidationError;
|
27
|
+
const common_1 = require("../common");
|
28
|
+
const utils_1 = require("./utils");
|
29
|
+
function isMaxAdjustment(source) {
|
30
|
+
return source.maxAmount != null;
|
31
|
+
}
|
32
|
+
function isMinAdjustment(destination) {
|
33
|
+
return destination.minAmount != null;
|
34
|
+
}
|
35
|
+
function isXRPToXRPPayment(payment) {
|
36
|
+
const { source, destination } = payment;
|
37
|
+
const sourceCurrency = isMaxAdjustment(source)
|
38
|
+
? source.maxAmount.currency
|
39
|
+
: source.amount.currency;
|
40
|
+
const destinationCurrency = isMinAdjustment(destination)
|
41
|
+
? destination.minAmount.currency
|
42
|
+
: destination.amount.currency;
|
43
|
+
return ((sourceCurrency === 'XRP' || sourceCurrency === 'drops') &&
|
44
|
+
(destinationCurrency === 'XRP' || destinationCurrency === 'drops'));
|
45
|
+
}
|
46
|
+
function isIOUWithoutCounterparty(amount) {
|
47
|
+
return (amount &&
|
48
|
+
amount.currency !== 'XRP' &&
|
49
|
+
amount.currency !== 'drops' &&
|
50
|
+
amount.counterparty == null);
|
51
|
+
}
|
52
|
+
function applyAnyCounterpartyEncoding(payment) {
|
53
|
+
[payment.source, payment.destination].forEach((adjustment) => {
|
54
|
+
['amount', 'minAmount', 'maxAmount'].forEach((key) => {
|
55
|
+
if (isIOUWithoutCounterparty(adjustment[key])) {
|
56
|
+
adjustment[key].counterparty = adjustment.address;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
});
|
60
|
+
}
|
61
|
+
function createMaximalAmount(amount) {
|
62
|
+
const maxXRPValue = '100000000000';
|
63
|
+
const maxIOUValue = '999999999999999900000000000000000000000000000000000000000000000000000000000000000000000000000000';
|
64
|
+
let maxValue;
|
65
|
+
if (amount.currency === 'XRP') {
|
66
|
+
maxValue = maxXRPValue;
|
67
|
+
}
|
68
|
+
else if (amount.currency === 'drops') {
|
69
|
+
maxValue = common_1.xrpToDrops(maxXRPValue);
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
maxValue = maxIOUValue;
|
73
|
+
}
|
74
|
+
return Object.assign({}, amount, { value: maxValue });
|
75
|
+
}
|
76
|
+
function validateAndNormalizeAddress(address, expectedTag) {
|
77
|
+
const classicAddress = utils_1.getClassicAccountAndTag(address, expectedTag);
|
78
|
+
classicAddress.tag =
|
79
|
+
classicAddress.tag === false ? undefined : classicAddress.tag;
|
80
|
+
return classicAddress;
|
81
|
+
}
|
82
|
+
function createPaymentTransaction(address, paymentArgument) {
|
83
|
+
const payment = _.cloneDeep(paymentArgument);
|
84
|
+
applyAnyCounterpartyEncoding(payment);
|
85
|
+
const sourceAddressAndTag = validateAndNormalizeAddress(payment.source.address, payment.source.tag);
|
86
|
+
const addressToVerifyAgainst = validateAndNormalizeAddress(address, undefined);
|
87
|
+
if (addressToVerifyAgainst.classicAccount !== sourceAddressAndTag.classicAccount) {
|
88
|
+
throw new ValidationError('address must match payment.source.address');
|
89
|
+
}
|
90
|
+
if (addressToVerifyAgainst.tag != null &&
|
91
|
+
sourceAddressAndTag.tag != null &&
|
92
|
+
addressToVerifyAgainst.tag !== sourceAddressAndTag.tag) {
|
93
|
+
throw new ValidationError('address includes a tag that does not match payment.source.tag');
|
94
|
+
}
|
95
|
+
const destinationAddressAndTag = validateAndNormalizeAddress(payment.destination.address, payment.destination.tag);
|
96
|
+
if ((isMaxAdjustment(payment.source) && isMinAdjustment(payment.destination)) ||
|
97
|
+
(!isMaxAdjustment(payment.source) && !isMinAdjustment(payment.destination))) {
|
98
|
+
throw new ValidationError('payment must specify either (source.maxAmount ' +
|
99
|
+
'and destination.amount) or (source.amount and destination.minAmount)');
|
100
|
+
}
|
101
|
+
const destinationAmount = isMinAdjustment(payment.destination)
|
102
|
+
? payment.destination.minAmount
|
103
|
+
: payment.destination.amount;
|
104
|
+
const sourceAmount = isMaxAdjustment(payment.source)
|
105
|
+
? payment.source.maxAmount
|
106
|
+
: payment.source.amount;
|
107
|
+
const amount = isMinAdjustment(payment.destination) && !isXRPToXRPPayment(payment)
|
108
|
+
? createMaximalAmount(destinationAmount)
|
109
|
+
: destinationAmount;
|
110
|
+
const txJSON = {
|
111
|
+
TransactionType: 'Payment',
|
112
|
+
Account: sourceAddressAndTag.classicAccount,
|
113
|
+
Destination: destinationAddressAndTag.classicAccount,
|
114
|
+
Amount: common_1.toRippledAmount(amount),
|
115
|
+
Flags: 0
|
116
|
+
};
|
117
|
+
if (payment.invoiceID != null) {
|
118
|
+
txJSON.InvoiceID = payment.invoiceID;
|
119
|
+
}
|
120
|
+
if (sourceAddressAndTag.tag != null) {
|
121
|
+
txJSON.SourceTag = sourceAddressAndTag.tag;
|
122
|
+
}
|
123
|
+
if (destinationAddressAndTag.tag != null) {
|
124
|
+
txJSON.DestinationTag = destinationAddressAndTag.tag;
|
125
|
+
}
|
126
|
+
if (payment.memos != null) {
|
127
|
+
txJSON.Memos = payment.memos.map(utils.convertMemo);
|
128
|
+
}
|
129
|
+
if (payment.noDirectRipple === true) {
|
130
|
+
txJSON.Flags |= paymentFlags.NoRippleDirect;
|
131
|
+
}
|
132
|
+
if (payment.limitQuality === true) {
|
133
|
+
txJSON.Flags |= paymentFlags.LimitQuality;
|
134
|
+
}
|
135
|
+
if (!isXRPToXRPPayment(payment)) {
|
136
|
+
if (payment.allowPartialPayment || isMinAdjustment(payment.destination)) {
|
137
|
+
txJSON.Flags |= paymentFlags.PartialPayment;
|
138
|
+
}
|
139
|
+
txJSON.SendMax = common_1.toRippledAmount(sourceAmount);
|
140
|
+
if (isMinAdjustment(payment.destination)) {
|
141
|
+
txJSON.DeliverMin = common_1.toRippledAmount(destinationAmount);
|
142
|
+
}
|
143
|
+
if (payment.paths != null) {
|
144
|
+
txJSON.Paths = JSON.parse(payment.paths);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
else if (payment.allowPartialPayment === true) {
|
148
|
+
throw new ValidationError('XRP to XRP payments cannot be partial payments');
|
149
|
+
}
|
150
|
+
return txJSON;
|
151
|
+
}
|
152
|
+
function preparePayment(address, payment, instructions = {}) {
|
153
|
+
try {
|
154
|
+
validate.preparePayment({ address, payment, instructions });
|
155
|
+
const txJSON = createPaymentTransaction(address, payment);
|
156
|
+
return utils.prepareTransaction(txJSON, this, instructions);
|
157
|
+
}
|
158
|
+
catch (e) {
|
159
|
+
return Promise.reject(e);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
exports.default = preparePayment;
|
163
|
+
//# sourceMappingURL=payment.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../src/transaction/payment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,+CAAgC;AAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAA;AACtC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,OA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5C;QAED,MAAM,CAAC,OAAO,GAAG,wBAAe,CAAC,YAAY,CAAC,CAAA;QAE9C,IAAI,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACxC,MAAM,CAAC,UAAU,GAAG,wBAAe,CAAC,iBAAiB,CAAC,CAAA;SACvD;QAED,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;YACzB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;SACzC;KACF;SAAM,IAAI,OAAO,CAAC,mBAAmB,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAI,eAAe,CAAC,gDAAgD,CAAC,CAAA;KAC5E;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,cAAc,CAErB,OAAe,EACf,OAAgB,EAChB,eAA6B,EAAE;IAE/B,IAAI;QACF,QAAQ,CAAC,cAAc,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAC,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzD,OAAO,KAAK,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;KAC5D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACzB;AACH,CAAC;AAED,kBAAe,cAAc,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Instructions, Prepare } from './types';
|
2
|
+
import { FormattedSettings } from '../common/types/objects';
|
3
|
+
import { RippleAPI } from '..';
|
4
|
+
declare function prepareSettings(this: RippleAPI, address: string, settings: FormattedSettings, instructions?: Instructions): Promise<Prepare>;
|
5
|
+
export default prepareSettings;
|
6
|
+
//# sourceMappingURL=settings.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/transaction/settings.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACZ,OAAO,EAGR,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,iBAAiB,EAAiB,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,IAAI,CAAA;AAyI5B,iBAAS,eAAe,CACtB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,GAAE,YAAiB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED,eAAe,eAAe,CAAA"}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
const assert = __importStar(require("assert"));
|
26
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
27
|
+
const utils = __importStar(require("./utils"));
|
28
|
+
const validate = utils.common.validate;
|
29
|
+
const AccountSetFlags = utils.common.constants.AccountSetFlags;
|
30
|
+
const AccountFields = utils.common.constants.AccountFields;
|
31
|
+
function setTransactionFlags(txJSON, values) {
|
32
|
+
const keys = Object.keys(values).filter((key) => AccountSetFlags[key] != null);
|
33
|
+
assert.ok(keys.length <= 1, 'ERROR: can only set one setting per transaction');
|
34
|
+
const flagName = keys[0];
|
35
|
+
const value = values[flagName];
|
36
|
+
const index = AccountSetFlags[flagName];
|
37
|
+
if (index != null) {
|
38
|
+
if (value) {
|
39
|
+
txJSON.SetFlag = index;
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
txJSON.ClearFlag = index;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
function setTransactionFields(txJSON, input) {
|
47
|
+
const fieldSchema = AccountFields;
|
48
|
+
for (const fieldName in fieldSchema) {
|
49
|
+
const field = fieldSchema[fieldName];
|
50
|
+
let value = input[field.name];
|
51
|
+
if (value === undefined) {
|
52
|
+
continue;
|
53
|
+
}
|
54
|
+
if (value === null && field.hasOwnProperty('defaults')) {
|
55
|
+
value = field.defaults;
|
56
|
+
}
|
57
|
+
if (field.encoding === 'hex' && !field.length) {
|
58
|
+
value = Buffer.from(value, 'ascii').toString('hex').toUpperCase();
|
59
|
+
}
|
60
|
+
txJSON[fieldName] = value;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
function convertTransferRate(transferRate) {
|
64
|
+
return new bignumber_js_1.default(transferRate).shiftedBy(9).toNumber();
|
65
|
+
}
|
66
|
+
function formatSignerEntry(signer) {
|
67
|
+
return {
|
68
|
+
SignerEntry: {
|
69
|
+
Account: signer.address,
|
70
|
+
SignerWeight: signer.weight
|
71
|
+
}
|
72
|
+
};
|
73
|
+
}
|
74
|
+
function createSettingsTransactionWithoutMemos(account, settings) {
|
75
|
+
if (settings.regularKey !== undefined) {
|
76
|
+
const removeRegularKey = {
|
77
|
+
TransactionType: 'SetRegularKey',
|
78
|
+
Account: account
|
79
|
+
};
|
80
|
+
if (settings.regularKey === null) {
|
81
|
+
return removeRegularKey;
|
82
|
+
}
|
83
|
+
return Object.assign({}, removeRegularKey, {
|
84
|
+
RegularKey: settings.regularKey
|
85
|
+
});
|
86
|
+
}
|
87
|
+
if (settings.signers != null) {
|
88
|
+
const setSignerList = {
|
89
|
+
TransactionType: 'SignerListSet',
|
90
|
+
Account: account,
|
91
|
+
SignerEntries: [],
|
92
|
+
SignerQuorum: settings.signers.threshold
|
93
|
+
};
|
94
|
+
if (settings.signers.weights != null) {
|
95
|
+
setSignerList.SignerEntries = settings.signers.weights.map(formatSignerEntry);
|
96
|
+
}
|
97
|
+
return setSignerList;
|
98
|
+
}
|
99
|
+
const txJSON = {
|
100
|
+
TransactionType: 'AccountSet',
|
101
|
+
Account: account
|
102
|
+
};
|
103
|
+
const settingsWithoutMemos = Object.assign({}, settings);
|
104
|
+
delete settingsWithoutMemos.memos;
|
105
|
+
setTransactionFlags(txJSON, settingsWithoutMemos);
|
106
|
+
setTransactionFields(txJSON, settings);
|
107
|
+
if (txJSON.TransferRate != null) {
|
108
|
+
txJSON.TransferRate = convertTransferRate(txJSON.TransferRate);
|
109
|
+
}
|
110
|
+
return txJSON;
|
111
|
+
}
|
112
|
+
function createSettingsTransaction(account, settings) {
|
113
|
+
const txJSON = createSettingsTransactionWithoutMemos(account, settings);
|
114
|
+
if (settings.memos != null) {
|
115
|
+
txJSON.Memos = settings.memos.map(utils.convertMemo);
|
116
|
+
}
|
117
|
+
return txJSON;
|
118
|
+
}
|
119
|
+
function prepareSettings(address, settings, instructions = {}) {
|
120
|
+
try {
|
121
|
+
validate.prepareSettings({ address, settings, instructions });
|
122
|
+
const txJSON = createSettingsTransaction(address, settings);
|
123
|
+
return utils.prepareTransaction(txJSON, this, instructions);
|
124
|
+
}
|
125
|
+
catch (e) {
|
126
|
+
return Promise.reject(e);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
exports.default = prepareSettings;
|
130
|
+
//# sourceMappingURL=settings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/transaction/settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,gEAAoC;AACpC,+CAAgC;AAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAA;AACtC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAA;AAC9D,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAA;AAU1D,SAAS,mBAAmB,CAC1B,MAAuB,EACvB,MAAyB;IAEzB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAA;IAC9E,MAAM,CAAC,EAAE,CACP,IAAI,CAAC,MAAM,IAAI,CAAC,EAChB,iDAAiD,CAClD,CAAA;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACxB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC9B,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IACvC,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA;SACvB;aAAM;YACL,MAAM,CAAC,SAAS,GAAG,KAAK,CAAA;SACzB;KACF;AACH,CAAC;AAGD,SAAS,oBAAoB,CAC3B,MAAuB,EACvB,KAAwB;IAExB,MAAM,WAAW,GAAG,aAAa,CAAA;IACjC,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE;QACnC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,C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B,IAAI;QACF,QAAQ,CAAC,eAAe,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,CAAC,CAAA;QAC3D,MAAM,MAAM,GAAG,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC3D,OAAO,KAAK,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;KAC5D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACzB;AACH,CAAC;AAED,kBAAe,eAAe,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { SignOptions, KeyPair } from './types';
|
2
|
+
import { RippleAPI } from '..';
|
3
|
+
declare function sign(this: RippleAPI, txJSON: string, secret?: any, options?: SignOptions, keypair?: KeyPair): {
|
4
|
+
signedTransaction: string;
|
5
|
+
id: string;
|
6
|
+
};
|
7
|
+
export default sign;
|
8
|
+
//# sourceMappingURL=sign.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/transaction/sign.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAA;AAG7D,OAAO,EAAC,SAAS,EAAC,MAAM,IAAI,CAAA;AA+M5B,iBAAS,IAAI,CACX,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,OAAO,GAChB;IAAC,iBAAiB,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAoBzC;AAED,eAAe,IAAI,CAAA"}
|
@@ -0,0 +1,173 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
const lodash_1 = __importDefault(require("lodash"));
|
26
|
+
const utils = __importStar(require("./utils"));
|
27
|
+
const ripple_keypairs_1 = __importDefault(require("ripple-keypairs"));
|
28
|
+
const ripple_binary_codec_1 = __importDefault(require("ripple-binary-codec"));
|
29
|
+
const hashes_1 = require("../common/hashes");
|
30
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
31
|
+
const common_1 = require("../common");
|
32
|
+
const validate = utils.common.validate;
|
33
|
+
function computeSignature(tx, privateKey, signAs) {
|
34
|
+
const signingData = signAs
|
35
|
+
? ripple_binary_codec_1.default.encodeForMultisigning(tx, signAs)
|
36
|
+
: ripple_binary_codec_1.default.encodeForSigning(tx);
|
37
|
+
return ripple_keypairs_1.default.sign(signingData, privateKey);
|
38
|
+
}
|
39
|
+
function signWithKeypair(api, txJSON, keypair, options = {
|
40
|
+
signAs: ''
|
41
|
+
}) {
|
42
|
+
validate.sign({ txJSON, keypair });
|
43
|
+
const tx = JSON.parse(txJSON);
|
44
|
+
if (tx.TxnSignature || tx.Signers) {
|
45
|
+
throw new utils.common.errors.ValidationError('txJSON must not contain "TxnSignature" or "Signers" properties');
|
46
|
+
}
|
47
|
+
checkFee(api, tx.Fee);
|
48
|
+
const txToSignAndEncode = Object.assign({}, tx);
|
49
|
+
txToSignAndEncode.SigningPubKey = options.signAs ? '' : keypair.publicKey;
|
50
|
+
if (options.signAs) {
|
51
|
+
const signer = {
|
52
|
+
Account: options.signAs,
|
53
|
+
SigningPubKey: keypair.publicKey,
|
54
|
+
TxnSignature: computeSignature(txToSignAndEncode, keypair.privateKey, options.signAs)
|
55
|
+
};
|
56
|
+
txToSignAndEncode.Signers = [{ Signer: signer }];
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
txToSignAndEncode.TxnSignature = computeSignature(txToSignAndEncode, keypair.privateKey);
|
60
|
+
}
|
61
|
+
const serialized = ripple_binary_codec_1.default.encode(txToSignAndEncode);
|
62
|
+
checkTxSerialization(serialized, tx);
|
63
|
+
return {
|
64
|
+
signedTransaction: serialized,
|
65
|
+
id: hashes_1.computeBinaryTransactionHash(serialized)
|
66
|
+
};
|
67
|
+
}
|
68
|
+
function objectDiff(a, b) {
|
69
|
+
const diffs = {};
|
70
|
+
const compare = function (i1, i2, k) {
|
71
|
+
const type1 = Object.prototype.toString.call(i1);
|
72
|
+
const type2 = Object.prototype.toString.call(i2);
|
73
|
+
if (type2 === '[object Undefined]') {
|
74
|
+
diffs[k] = null;
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
if (type1 !== type2) {
|
78
|
+
diffs[k] = i2;
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
if (type1 === '[object Object]') {
|
82
|
+
const objDiff = objectDiff(i1, i2);
|
83
|
+
if (Object.keys(objDiff).length > 0) {
|
84
|
+
diffs[k] = objDiff;
|
85
|
+
}
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
if (type1 === '[object Array]') {
|
89
|
+
if (!lodash_1.default.isEqual(i1, i2)) {
|
90
|
+
diffs[k] = i2;
|
91
|
+
}
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
if (type1 === '[object Function]') {
|
95
|
+
if (i1.toString() !== i2.toString()) {
|
96
|
+
diffs[k] = i2;
|
97
|
+
}
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
if (i1 !== i2) {
|
101
|
+
diffs[k] = i2;
|
102
|
+
}
|
103
|
+
};
|
104
|
+
for (const key in a) {
|
105
|
+
if (a.hasOwnProperty(key)) {
|
106
|
+
compare(a[key], b[key], key);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
for (const key in b) {
|
110
|
+
if (b.hasOwnProperty(key)) {
|
111
|
+
if (!a[key] && a[key] !== b[key]) {
|
112
|
+
diffs[key] = b[key];
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
return diffs;
|
117
|
+
}
|
118
|
+
function checkTxSerialization(serialized, tx) {
|
119
|
+
var _a;
|
120
|
+
const decoded = ripple_binary_codec_1.default.decode(serialized);
|
121
|
+
if (!decoded.TxnSignature && !decoded.Signers) {
|
122
|
+
throw new utils.common.errors.ValidationError('Serialized transaction must have a TxnSignature or Signers property');
|
123
|
+
}
|
124
|
+
delete decoded.TxnSignature;
|
125
|
+
delete decoded.Signers;
|
126
|
+
if (!tx.SigningPubKey) {
|
127
|
+
delete decoded.SigningPubKey;
|
128
|
+
}
|
129
|
+
(_a = tx.Memos) === null || _a === void 0 ? void 0 : _a.map(memo => {
|
130
|
+
var _a, _b, _c;
|
131
|
+
if ((_a = memo === null || memo === void 0 ? void 0 : memo.Memo) === null || _a === void 0 ? void 0 : _a.MemoData) {
|
132
|
+
memo.Memo.MemoData = memo.Memo.MemoData.toUpperCase();
|
133
|
+
}
|
134
|
+
if ((_b = memo === null || memo === void 0 ? void 0 : memo.Memo) === null || _b === void 0 ? void 0 : _b.MemoType) {
|
135
|
+
memo.Memo.MemoType = memo.Memo.MemoType.toUpperCase();
|
136
|
+
}
|
137
|
+
if ((_c = memo === null || memo === void 0 ? void 0 : memo.Memo) === null || _c === void 0 ? void 0 : _c.MemoFormat) {
|
138
|
+
memo.Memo.MemoFormat = memo.Memo.MemoFormat.toUpperCase();
|
139
|
+
}
|
140
|
+
return memo;
|
141
|
+
});
|
142
|
+
if (!lodash_1.default.isEqual(decoded, tx)) {
|
143
|
+
const error = new utils.common.errors.ValidationError('Serialized transaction does not match original txJSON. See `error.data`');
|
144
|
+
error.data = {
|
145
|
+
decoded,
|
146
|
+
tx,
|
147
|
+
diff: objectDiff(tx, decoded)
|
148
|
+
};
|
149
|
+
throw error;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
function checkFee(api, txFee) {
|
153
|
+
const fee = new bignumber_js_1.default(txFee);
|
154
|
+
const maxFeeDrops = common_1.xrpToDrops(api._maxFeeXRP);
|
155
|
+
if (fee.isGreaterThan(maxFeeDrops)) {
|
156
|
+
throw new utils.common.errors.ValidationError(`"Fee" should not exceed "${maxFeeDrops}". ` +
|
157
|
+
'To use a higher fee, set `maxFeeXRP` in the RippleAPI constructor.');
|
158
|
+
}
|
159
|
+
}
|
160
|
+
function sign(txJSON, secret, options, keypair) {
|
161
|
+
if (typeof secret === 'string') {
|
162
|
+
validate.sign({ txJSON, secret });
|
163
|
+
return signWithKeypair(this, txJSON, ripple_keypairs_1.default.deriveKeypair(secret), options);
|
164
|
+
}
|
165
|
+
else {
|
166
|
+
if (!keypair && !secret) {
|
167
|
+
throw new utils.common.errors.ValidationError('sign: Missing secret or keypair.');
|
168
|
+
}
|
169
|
+
return signWithKeypair(this, txJSON, keypair ? keypair : secret, options);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
exports.default = sign;
|
173
|
+
//# sourceMappingURL=sign.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../src/transaction/sign.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAs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K,CAAA;KACZ;AACH,CAAC;AAYD,SAAS,QAAQ,CAAC,GAAc,EAAE,KAAa;IAC7C,MAAM,GAAG,GAAG,IAAI,sBAAS,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,WAAW,GAAG,mBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAC9C,IAAI,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAC3C,4BAA4B,WAAW,KAAK;YAC1C,oEAAoE,CACvE,CAAA;KACF;AACH,CAAC;AAED,SAAS,IAAI,CAEX,MAAc,EACd,MAAY,EACZ,OAAqB,EACrB,OAAiB;IAEjB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAG9B,QAAQ,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC,CAAA;QAC/B,OAAO,eAAe,CACpB,IAAI,EACJ,MAAM,EACN,yBAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,CACR,CAAA;KACF;SAAM;QACL,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE;YAEvB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAC3C,kCAAkC,CACnC,CAAA;SACF;QACD,OAAO,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1E;AACH,CAAC;AAED,kBAAe,IAAI,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { RippleAPI } from '..';
|
2
|
+
export interface FormattedSubmitResponse {
|
3
|
+
resultCode: string;
|
4
|
+
resultMessage: string;
|
5
|
+
}
|
6
|
+
declare function submit(this: RippleAPI, signedTransaction: string, failHard?: boolean): Promise<FormattedSubmitResponse>;
|
7
|
+
export default submit;
|
8
|
+
//# sourceMappingURL=submit.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../src/transaction/submit.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAC,MAAM,IAAI,CAAA;AAE5B,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AA+BD,iBAAe,MAAM,CACnB,IAAI,EAAE,SAAS,EACf,iBAAiB,EAAE,MAAM,EACzB,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,uBAAuB,CAAC,CAUlC;AAED,eAAe,MAAM,CAAA"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
28
|
+
});
|
29
|
+
};
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
31
|
+
const utils = __importStar(require("./utils"));
|
32
|
+
const common_1 = require("../common");
|
33
|
+
function isImmediateRejection(engineResult) {
|
34
|
+
return engineResult.startsWith('tem');
|
35
|
+
}
|
36
|
+
function formatSubmitResponse(response) {
|
37
|
+
const data = {
|
38
|
+
resultCode: response.engine_result,
|
39
|
+
resultMessage: response.engine_result_message,
|
40
|
+
engine_result: response.engine_result,
|
41
|
+
engine_result_code: response.engine_result_code,
|
42
|
+
engine_result_message: response.engine_result_message,
|
43
|
+
tx_blob: response.tx_blob,
|
44
|
+
tx_json: response.tx_json
|
45
|
+
};
|
46
|
+
if (isImmediateRejection(response.engine_result)) {
|
47
|
+
throw new utils.common.errors.RippledError('Submit failed', data);
|
48
|
+
}
|
49
|
+
return data;
|
50
|
+
}
|
51
|
+
function submit(signedTransaction, failHard) {
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
53
|
+
common_1.validate.submit({ signedTransaction });
|
54
|
+
const response = yield this.request('submit', Object.assign({ tx_blob: signedTransaction }, (failHard ? { fail_hard: failHard } : {})));
|
55
|
+
return formatSubmitResponse(response);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
exports.default = submit;
|
59
|
+
//# sourceMappingURL=submit.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../src/transaction/submit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,+CAAgC;AAChC,sCAAkC;AAQlC,SAAS,oBAAoB,CAAC,YAAoB;IAOhD,OAAO,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAQ;IACpC,MAAM,IAAI,GAAG;QAEX,UAAU,EAAE,QAAQ,CAAC,aAAa;QAElC,aAAa,EAAE,QAAQ,CAAC,qBAAqB;QAC7C,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB;QACrD,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAA;IACD,IAAI,oBAAoB,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QAChD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;KAClE;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAGD,SAAe,MAAM,CAEnB,iBAAyB,EACzB,QAAkB;;QAGlB,iBAAQ,CAAC,MAAM,CAAC,EAAC,iBAAiB,EAAC,CAAC,CAAA;QAEpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,kBAC1C,OAAO,EAAE,iBAAiB,IACvB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC1C,CAAA;QAEF,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IACvC,CAAC;CAAA;AAED,kBAAe,MAAM,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Prepare, Instructions } from './types';
|
2
|
+
import { RippleAPI } from '..';
|
3
|
+
export interface Ticket {
|
4
|
+
account: string;
|
5
|
+
sequence: number;
|
6
|
+
}
|
7
|
+
declare function prepareTicketCreate(this: RippleAPI, address: string, ticketCount: number, instructions?: Instructions): Promise<Prepare>;
|
8
|
+
export default prepareTicketCreate;
|
9
|
+
//# sourceMappingURL=ticket.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ticket.d.ts","sourceRoot":"","sources":["../../../src/transaction/ticket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAmB,YAAY,EAAC,MAAM,SAAS,CAAA;AAC9D,OAAO,EAAC,SAAS,EAAC,MAAM,IAAI,CAAA;AAK5B,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAkBD,iBAAS,mBAAmB,CAC1B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,GAAE,YAAiB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED,eAAe,mBAAmB,CAAA"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
+
const utils = __importStar(require("./utils"));
|
23
|
+
const validate = utils.common.validate;
|
24
|
+
const ValidationError = utils.common.errors.ValidationError;
|
25
|
+
function createTicketTransaction(account, ticketCount) {
|
26
|
+
if (!ticketCount || ticketCount === 0)
|
27
|
+
throw new ValidationError('Ticket count must be greater than 0.');
|
28
|
+
const txJSON = {
|
29
|
+
TransactionType: 'TicketCreate',
|
30
|
+
Account: account,
|
31
|
+
TicketCount: ticketCount
|
32
|
+
};
|
33
|
+
return txJSON;
|
34
|
+
}
|
35
|
+
function prepareTicketCreate(address, ticketCount, instructions = {}) {
|
36
|
+
try {
|
37
|
+
validate.prepareTicketCreate({ address, ticketCount, instructions });
|
38
|
+
const txJSON = createTicketTransaction(address, ticketCount);
|
39
|
+
return utils.prepareTransaction(txJSON, this, instructions);
|
40
|
+
}
|
41
|
+
catch (e) {
|
42
|
+
return Promise.reject(e);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
exports.default = prepareTicketCreate;
|
46
|
+
//# sourceMappingURL=ticket.js.map
|