xrpl 4.3.0 → 4.4.0
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/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest-min.js.map +1 -1
- package/build/xrpl-latest.js +1609 -1773
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/client/index.d.ts +3 -3
- package/dist/npm/client/index.d.ts.map +1 -1
- package/dist/npm/client/index.js +10 -7
- package/dist/npm/client/index.js.map +1 -1
- package/dist/npm/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/client/partialPayment.js +2 -2
- package/dist/npm/client/partialPayment.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +17 -0
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.d.ts +4 -2
- package/dist/npm/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.js +1 -0
- package/dist/npm/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/models/ledger/DirectoryNode.d.ts +1 -0
- package/dist/npm/models/ledger/DirectoryNode.d.ts.map +1 -1
- package/dist/npm/models/ledger/Escrow.d.ts +2 -0
- package/dist/npm/models/ledger/Escrow.d.ts.map +1 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPToken.d.ts +1 -0
- package/dist/npm/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts +1 -0
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/models/ledger/Offer.d.ts +10 -1
- package/dist/npm/models/ledger/Offer.d.ts.map +1 -1
- package/dist/npm/models/ledger/Offer.js +1 -0
- package/dist/npm/models/ledger/Offer.js.map +1 -1
- package/dist/npm/models/ledger/Vault.d.ts +21 -0
- package/dist/npm/models/ledger/Vault.d.ts.map +1 -0
- package/dist/npm/models/ledger/Vault.js +3 -0
- package/dist/npm/models/ledger/Vault.js.map +1 -0
- package/dist/npm/models/ledger/index.d.ts +2 -1
- package/dist/npm/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/index.js.map +1 -1
- package/dist/npm/models/methods/bookOffers.d.ts +1 -0
- package/dist/npm/models/methods/bookOffers.d.ts.map +1 -1
- package/dist/npm/models/methods/index.d.ts +5 -4
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/pathFind.d.ts +2 -0
- package/dist/npm/models/methods/pathFind.d.ts.map +1 -1
- package/dist/npm/models/methods/ripplePathFind.d.ts +1 -0
- package/dist/npm/models/methods/ripplePathFind.d.ts.map +1 -1
- package/dist/npm/models/methods/subscribe.d.ts +4 -0
- package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/models/methods/vaultInfo.d.ts +46 -0
- package/dist/npm/models/methods/vaultInfo.d.ts.map +1 -0
- package/dist/npm/models/methods/vaultInfo.js +3 -0
- package/dist/npm/models/methods/vaultInfo.js.map +1 -0
- package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.js +7 -5
- package/dist/npm/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/models/transactions/AMMClawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMClawback.js +5 -6
- package/dist/npm/models/transactions/AMMClawback.js.map +1 -1
- package/dist/npm/models/transactions/AMMDelete.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMDelete.js +2 -2
- package/dist/npm/models/transactions/AMMDelete.js.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.js +3 -3
- package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/models/transactions/AMMVote.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMVote.js +2 -2
- package/dist/npm/models/transactions/AMMVote.js.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.js +3 -3
- package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +17 -8
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js +4 -4
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.js +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.js +6 -2
- package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
- package/dist/npm/models/transactions/accountSet.d.ts +2 -1
- package/dist/npm/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountSet.js +1 -0
- package/dist/npm/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCreate.js +1 -2
- package/dist/npm/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/models/transactions/clawback.d.ts +2 -2
- package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/clawback.js +4 -6
- package/dist/npm/models/transactions/clawback.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +13 -4
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +184 -28
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts +2 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.js +1 -6
- package/dist/npm/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +9 -3
- package/dist/npm/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/models/transactions/index.js +5 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/offerCreate.d.ts +4 -1
- package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/offerCreate.js +10 -0
- package/dist/npm/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/models/transactions/oracleSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/oracleSet.js +22 -21
- package/dist/npm/models/transactions/oracleSet.js.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts +2 -0
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +7 -4
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/signerListSet.js +10 -16
- package/dist/npm/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts +7 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +28 -35
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/transactions/vaultClawback.d.ts +10 -0
- package/dist/npm/models/transactions/vaultClawback.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultClawback.js +12 -0
- package/dist/npm/models/transactions/vaultClawback.js.map +1 -0
- package/dist/npm/models/transactions/vaultCreate.d.ts +24 -0
- package/dist/npm/models/transactions/vaultCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultCreate.js +60 -0
- package/dist/npm/models/transactions/vaultCreate.js.map +1 -0
- package/dist/npm/models/transactions/vaultDelete.d.ts +7 -0
- package/dist/npm/models/transactions/vaultDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultDelete.js +10 -0
- package/dist/npm/models/transactions/vaultDelete.js.map +1 -0
- package/dist/npm/models/transactions/vaultDeposit.d.ts +9 -0
- package/dist/npm/models/transactions/vaultDeposit.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultDeposit.js +11 -0
- package/dist/npm/models/transactions/vaultDeposit.js.map +1 -0
- package/dist/npm/models/transactions/vaultSet.d.ts +10 -0
- package/dist/npm/models/transactions/vaultSet.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultSet.js +25 -0
- package/dist/npm/models/transactions/vaultSet.js.map +1 -0
- package/dist/npm/models/transactions/vaultWithdraw.d.ts +10 -0
- package/dist/npm/models/transactions/vaultWithdraw.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultWithdraw.js +12 -0
- package/dist/npm/models/transactions/vaultWithdraw.js.map +1 -0
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js +2 -0
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/snippets/src/permissionedDEX.d.ts +2 -0
- package/dist/npm/snippets/src/permissionedDEX.d.ts.map +1 -0
- package/dist/npm/snippets/src/permissionedDEX.js +173 -0
- package/dist/npm/snippets/src/permissionedDEX.js.map +1 -0
- package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
- package/dist/npm/src/client/index.d.ts +3 -3
- package/dist/npm/src/client/index.d.ts.map +1 -1
- package/dist/npm/src/client/index.js +10 -7
- package/dist/npm/src/client/index.js.map +1 -1
- package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/src/client/partialPayment.js +2 -2
- package/dist/npm/src/client/partialPayment.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +17 -0
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.d.ts +4 -2
- package/dist/npm/src/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.js +1 -0
- package/dist/npm/src/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/src/models/ledger/DirectoryNode.d.ts +1 -0
- package/dist/npm/src/models/ledger/DirectoryNode.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Escrow.d.ts +2 -0
- package/dist/npm/src/models/ledger/Escrow.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPToken.d.ts +1 -0
- package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +1 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Offer.d.ts +10 -1
- package/dist/npm/src/models/ledger/Offer.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Offer.js +1 -0
- package/dist/npm/src/models/ledger/Offer.js.map +1 -1
- package/dist/npm/src/models/ledger/Vault.d.ts +21 -0
- package/dist/npm/src/models/ledger/Vault.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/Vault.js +3 -0
- package/dist/npm/src/models/ledger/Vault.js.map +1 -0
- package/dist/npm/src/models/ledger/index.d.ts +2 -1
- package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/index.js.map +1 -1
- package/dist/npm/src/models/methods/bookOffers.d.ts +1 -0
- package/dist/npm/src/models/methods/bookOffers.d.ts.map +1 -1
- package/dist/npm/src/models/methods/index.d.ts +5 -4
- package/dist/npm/src/models/methods/index.d.ts.map +1 -1
- package/dist/npm/src/models/methods/pathFind.d.ts +2 -0
- package/dist/npm/src/models/methods/pathFind.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ripplePathFind.d.ts +1 -0
- package/dist/npm/src/models/methods/ripplePathFind.d.ts.map +1 -1
- package/dist/npm/src/models/methods/subscribe.d.ts +4 -0
- package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/src/models/methods/vaultInfo.d.ts +46 -0
- package/dist/npm/src/models/methods/vaultInfo.d.ts.map +1 -0
- package/dist/npm/src/models/methods/vaultInfo.js +3 -0
- package/dist/npm/src/models/methods/vaultInfo.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.js +7 -5
- package/dist/npm/src/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMClawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMClawback.js +5 -6
- package/dist/npm/src/models/transactions/AMMClawback.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDelete.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMDelete.js +2 -2
- package/dist/npm/src/models/transactions/AMMDelete.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.js +3 -3
- package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMVote.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMVote.js +2 -2
- package/dist/npm/src/models/transactions/AMMVote.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.js +3 -3
- package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +17 -8
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +4 -4
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.js +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.js +6 -2
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.js.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts +2 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.js +1 -0
- package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.js +1 -2
- package/dist/npm/src/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/clawback.d.ts +2 -2
- package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/clawback.js +4 -6
- package/dist/npm/src/models/transactions/clawback.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +13 -4
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +184 -28
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts +2 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.js +1 -6
- package/dist/npm/src/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +9 -3
- package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/index.js +5 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts +4 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.js +10 -0
- package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/oracleSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/oracleSet.js +22 -21
- package/dist/npm/src/models/transactions/oracleSet.js.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts +2 -0
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js +7 -4
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.js +10 -16
- package/dist/npm/src/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts +7 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +28 -35
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/transactions/vaultClawback.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultClawback.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultClawback.js +12 -0
- package/dist/npm/src/models/transactions/vaultClawback.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultCreate.d.ts +24 -0
- package/dist/npm/src/models/transactions/vaultCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultCreate.js +60 -0
- package/dist/npm/src/models/transactions/vaultCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultDelete.d.ts +7 -0
- package/dist/npm/src/models/transactions/vaultDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultDelete.js +10 -0
- package/dist/npm/src/models/transactions/vaultDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultDeposit.d.ts +9 -0
- package/dist/npm/src/models/transactions/vaultDeposit.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultDeposit.js +11 -0
- package/dist/npm/src/models/transactions/vaultDeposit.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultSet.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultSet.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultSet.js +25 -0
- package/dist/npm/src/models/transactions/vaultSet.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.js +12 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.js.map +1 -0
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js +2 -0
- package/dist/npm/src/models/utils/flags.js.map +1 -1
- package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/src/sugar/autofill.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/package.json +6 -5
- package/src/client/index.ts +43 -38
- package/src/client/partialPayment.ts +1 -2
- package/src/models/common/index.ts +27 -0
- package/src/models/ledger/AccountRoot.ts +11 -1
- package/src/models/ledger/DirectoryNode.ts +3 -0
- package/src/models/ledger/Escrow.ts +14 -1
- package/src/models/ledger/LedgerEntry.ts +3 -0
- package/src/models/ledger/MPToken.ts +1 -0
- package/src/models/ledger/MPTokenIssuance.ts +1 -0
- package/src/models/ledger/Offer.ts +21 -0
- package/src/models/ledger/Vault.ts +83 -0
- package/src/models/ledger/index.ts +3 -1
- package/src/models/methods/bookOffers.ts +7 -0
- package/src/models/methods/index.ts +10 -0
- package/src/models/methods/pathFind.ts +10 -0
- package/src/models/methods/ripplePathFind.ts +5 -0
- package/src/models/methods/subscribe.ts +21 -0
- package/src/models/methods/vaultInfo.ts +193 -0
- package/src/models/transactions/AMMBid.ts +12 -20
- package/src/models/transactions/AMMClawback.ts +8 -11
- package/src/models/transactions/AMMDelete.ts +7 -3
- package/src/models/transactions/AMMDeposit.ts +4 -4
- package/src/models/transactions/AMMVote.ts +7 -3
- package/src/models/transactions/AMMWithdraw.ts +4 -4
- package/src/models/transactions/MPTokenIssuanceCreate.ts +36 -11
- package/src/models/transactions/MPTokenIssuanceSet.ts +1 -1
- package/src/models/transactions/NFTokenCancelOffer.ts +2 -2
- package/src/models/transactions/NFTokenCreateOffer.ts +8 -4
- package/src/models/transactions/accountSet.ts +2 -0
- package/src/models/transactions/checkCreate.ts +2 -6
- package/src/models/transactions/clawback.ts +9 -10
- package/src/models/transactions/common.ts +350 -42
- package/src/models/transactions/escrowCreate.ts +8 -12
- package/src/models/transactions/index.ts +14 -3
- package/src/models/transactions/offerCreate.ts +25 -0
- package/src/models/transactions/oracleSet.ts +32 -39
- package/src/models/transactions/payment.ts +25 -7
- package/src/models/transactions/signerListSet.ts +21 -21
- package/src/models/transactions/transaction.ts +46 -43
- package/src/models/transactions/vaultClawback.ts +55 -0
- package/src/models/transactions/vaultCreate.ts +166 -0
- package/src/models/transactions/vaultDelete.ts +32 -0
- package/src/models/transactions/vaultDeposit.ts +42 -0
- package/src/models/transactions/vaultSet.ts +71 -0
- package/src/models/transactions/vaultWithdraw.ts +51 -0
- package/src/models/utils/flags.ts +2 -0
- package/src/sugar/autofill.ts +5 -6
package/build/xrpl-latest.js
CHANGED
@@ -5454,6 +5454,107 @@ exports.crypto = void 0;
|
|
5454
5454
|
exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
5455
5455
|
|
5456
5456
|
|
5457
|
+
/***/ }),
|
5458
|
+
|
5459
|
+
/***/ "../../node_modules/@noble/hashes/hmac.js":
|
5460
|
+
/*!************************************************!*\
|
5461
|
+
!*** ../../node_modules/@noble/hashes/hmac.js ***!
|
5462
|
+
\************************************************/
|
5463
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
5464
|
+
|
5465
|
+
"use strict";
|
5466
|
+
|
5467
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5468
|
+
exports.hmac = exports.HMAC = void 0;
|
5469
|
+
/**
|
5470
|
+
* HMAC: RFC2104 message authentication code.
|
5471
|
+
* @module
|
5472
|
+
*/
|
5473
|
+
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@noble/hashes/utils.js");
|
5474
|
+
class HMAC extends utils_ts_1.Hash {
|
5475
|
+
constructor(hash, _key) {
|
5476
|
+
super();
|
5477
|
+
this.finished = false;
|
5478
|
+
this.destroyed = false;
|
5479
|
+
(0, utils_ts_1.ahash)(hash);
|
5480
|
+
const key = (0, utils_ts_1.toBytes)(_key);
|
5481
|
+
this.iHash = hash.create();
|
5482
|
+
if (typeof this.iHash.update !== 'function')
|
5483
|
+
throw new Error('Expected instance of class which extends utils.Hash');
|
5484
|
+
this.blockLen = this.iHash.blockLen;
|
5485
|
+
this.outputLen = this.iHash.outputLen;
|
5486
|
+
const blockLen = this.blockLen;
|
5487
|
+
const pad = new Uint8Array(blockLen);
|
5488
|
+
// blockLen can be bigger than outputLen
|
5489
|
+
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
5490
|
+
for (let i = 0; i < pad.length; i++)
|
5491
|
+
pad[i] ^= 0x36;
|
5492
|
+
this.iHash.update(pad);
|
5493
|
+
// By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
|
5494
|
+
this.oHash = hash.create();
|
5495
|
+
// Undo internal XOR && apply outer XOR
|
5496
|
+
for (let i = 0; i < pad.length; i++)
|
5497
|
+
pad[i] ^= 0x36 ^ 0x5c;
|
5498
|
+
this.oHash.update(pad);
|
5499
|
+
(0, utils_ts_1.clean)(pad);
|
5500
|
+
}
|
5501
|
+
update(buf) {
|
5502
|
+
(0, utils_ts_1.aexists)(this);
|
5503
|
+
this.iHash.update(buf);
|
5504
|
+
return this;
|
5505
|
+
}
|
5506
|
+
digestInto(out) {
|
5507
|
+
(0, utils_ts_1.aexists)(this);
|
5508
|
+
(0, utils_ts_1.abytes)(out, this.outputLen);
|
5509
|
+
this.finished = true;
|
5510
|
+
this.iHash.digestInto(out);
|
5511
|
+
this.oHash.update(out);
|
5512
|
+
this.oHash.digestInto(out);
|
5513
|
+
this.destroy();
|
5514
|
+
}
|
5515
|
+
digest() {
|
5516
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
5517
|
+
this.digestInto(out);
|
5518
|
+
return out;
|
5519
|
+
}
|
5520
|
+
_cloneInto(to) {
|
5521
|
+
// Create new instance without calling constructor since key already in state and we don't know it.
|
5522
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
5523
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
5524
|
+
to = to;
|
5525
|
+
to.finished = finished;
|
5526
|
+
to.destroyed = destroyed;
|
5527
|
+
to.blockLen = blockLen;
|
5528
|
+
to.outputLen = outputLen;
|
5529
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
5530
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
5531
|
+
return to;
|
5532
|
+
}
|
5533
|
+
clone() {
|
5534
|
+
return this._cloneInto();
|
5535
|
+
}
|
5536
|
+
destroy() {
|
5537
|
+
this.destroyed = true;
|
5538
|
+
this.oHash.destroy();
|
5539
|
+
this.iHash.destroy();
|
5540
|
+
}
|
5541
|
+
}
|
5542
|
+
exports.HMAC = HMAC;
|
5543
|
+
/**
|
5544
|
+
* HMAC: RFC2104 message authentication code.
|
5545
|
+
* @param hash - function that would be used e.g. sha256
|
5546
|
+
* @param key - message key
|
5547
|
+
* @param message - message data
|
5548
|
+
* @example
|
5549
|
+
* import { hmac } from '@noble/hashes/hmac';
|
5550
|
+
* import { sha256 } from '@noble/hashes/sha2';
|
5551
|
+
* const mac1 = hmac(sha256, 'key', 'message');
|
5552
|
+
*/
|
5553
|
+
const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
5554
|
+
exports.hmac = hmac;
|
5555
|
+
exports.hmac.create = (hash, key) => new HMAC(hash, key);
|
5556
|
+
|
5557
|
+
|
5457
5558
|
/***/ }),
|
5458
5559
|
|
5459
5560
|
/***/ "../../node_modules/@noble/hashes/legacy.js":
|
@@ -5751,6 +5852,117 @@ exports.RIPEMD160 = RIPEMD160;
|
|
5751
5852
|
exports.ripemd160 = (0, utils_ts_1.createHasher)(() => new RIPEMD160());
|
5752
5853
|
|
5753
5854
|
|
5855
|
+
/***/ }),
|
5856
|
+
|
5857
|
+
/***/ "../../node_modules/@noble/hashes/pbkdf2.js":
|
5858
|
+
/*!**************************************************!*\
|
5859
|
+
!*** ../../node_modules/@noble/hashes/pbkdf2.js ***!
|
5860
|
+
\**************************************************/
|
5861
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
5862
|
+
|
5863
|
+
"use strict";
|
5864
|
+
|
5865
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
5866
|
+
exports.pbkdf2 = pbkdf2;
|
5867
|
+
exports.pbkdf2Async = pbkdf2Async;
|
5868
|
+
/**
|
5869
|
+
* PBKDF (RFC 2898). Can be used to create a key from password and salt.
|
5870
|
+
* @module
|
5871
|
+
*/
|
5872
|
+
const hmac_ts_1 = __webpack_require__(/*! ./hmac.js */ "../../node_modules/@noble/hashes/hmac.js");
|
5873
|
+
// prettier-ignore
|
5874
|
+
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@noble/hashes/utils.js");
|
5875
|
+
// Common prologue and epilogue for sync/async functions
|
5876
|
+
function pbkdf2Init(hash, _password, _salt, _opts) {
|
5877
|
+
(0, utils_ts_1.ahash)(hash);
|
5878
|
+
const opts = (0, utils_ts_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts);
|
5879
|
+
const { c, dkLen, asyncTick } = opts;
|
5880
|
+
(0, utils_ts_1.anumber)(c);
|
5881
|
+
(0, utils_ts_1.anumber)(dkLen);
|
5882
|
+
(0, utils_ts_1.anumber)(asyncTick);
|
5883
|
+
if (c < 1)
|
5884
|
+
throw new Error('iterations (c) should be >= 1');
|
5885
|
+
const password = (0, utils_ts_1.kdfInputToBytes)(_password);
|
5886
|
+
const salt = (0, utils_ts_1.kdfInputToBytes)(_salt);
|
5887
|
+
// DK = PBKDF2(PRF, Password, Salt, c, dkLen);
|
5888
|
+
const DK = new Uint8Array(dkLen);
|
5889
|
+
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
5890
|
+
const PRF = hmac_ts_1.hmac.create(hash, password);
|
5891
|
+
const PRFSalt = PRF._cloneInto().update(salt);
|
5892
|
+
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
5893
|
+
}
|
5894
|
+
function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
|
5895
|
+
PRF.destroy();
|
5896
|
+
PRFSalt.destroy();
|
5897
|
+
if (prfW)
|
5898
|
+
prfW.destroy();
|
5899
|
+
(0, utils_ts_1.clean)(u);
|
5900
|
+
return DK;
|
5901
|
+
}
|
5902
|
+
/**
|
5903
|
+
* PBKDF2-HMAC: RFC 2898 key derivation function
|
5904
|
+
* @param hash - hash function that would be used e.g. sha256
|
5905
|
+
* @param password - password from which a derived key is generated
|
5906
|
+
* @param salt - cryptographic salt
|
5907
|
+
* @param opts - {c, dkLen} where c is work factor and dkLen is output message size
|
5908
|
+
* @example
|
5909
|
+
* const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
|
5910
|
+
*/
|
5911
|
+
function pbkdf2(hash, password, salt, opts) {
|
5912
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
5913
|
+
let prfW; // Working copy
|
5914
|
+
const arr = new Uint8Array(4);
|
5915
|
+
const view = (0, utils_ts_1.createView)(arr);
|
5916
|
+
const u = new Uint8Array(PRF.outputLen);
|
5917
|
+
// DK = T1 + T2 + ⋯ + Tdklen/hlen
|
5918
|
+
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
5919
|
+
// Ti = F(Password, Salt, c, i)
|
5920
|
+
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
5921
|
+
view.setInt32(0, ti, false);
|
5922
|
+
// F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
|
5923
|
+
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
5924
|
+
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
5925
|
+
Ti.set(u.subarray(0, Ti.length));
|
5926
|
+
for (let ui = 1; ui < c; ui++) {
|
5927
|
+
// Uc = PRF(Password, Uc−1)
|
5928
|
+
PRF._cloneInto(prfW).update(u).digestInto(u);
|
5929
|
+
for (let i = 0; i < Ti.length; i++)
|
5930
|
+
Ti[i] ^= u[i];
|
5931
|
+
}
|
5932
|
+
}
|
5933
|
+
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
5934
|
+
}
|
5935
|
+
/**
|
5936
|
+
* PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
|
5937
|
+
* @example
|
5938
|
+
* await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
|
5939
|
+
*/
|
5940
|
+
async function pbkdf2Async(hash, password, salt, opts) {
|
5941
|
+
const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
5942
|
+
let prfW; // Working copy
|
5943
|
+
const arr = new Uint8Array(4);
|
5944
|
+
const view = (0, utils_ts_1.createView)(arr);
|
5945
|
+
const u = new Uint8Array(PRF.outputLen);
|
5946
|
+
// DK = T1 + T2 + ⋯ + Tdklen/hlen
|
5947
|
+
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
5948
|
+
// Ti = F(Password, Salt, c, i)
|
5949
|
+
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
5950
|
+
view.setInt32(0, ti, false);
|
5951
|
+
// F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
|
5952
|
+
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
5953
|
+
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
5954
|
+
Ti.set(u.subarray(0, Ti.length));
|
5955
|
+
await (0, utils_ts_1.asyncLoop)(c - 1, asyncTick, () => {
|
5956
|
+
// Uc = PRF(Password, Uc−1)
|
5957
|
+
PRF._cloneInto(prfW).update(u).digestInto(u);
|
5958
|
+
for (let i = 0; i < Ti.length; i++)
|
5959
|
+
Ti[i] ^= u[i];
|
5960
|
+
});
|
5961
|
+
}
|
5962
|
+
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
5963
|
+
}
|
5964
|
+
|
5965
|
+
|
5754
5966
|
/***/ }),
|
5755
5967
|
|
5756
5968
|
/***/ "../../node_modules/@noble/hashes/ripemd160.js":
|
@@ -6578,10 +6790,17 @@ function randomBytes(bytesLength = 32) {
|
|
6578
6790
|
|
6579
6791
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
6580
6792
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
6581
|
-
exports.bytes = exports.stringToBytes = exports.str = exports.bytesToString = exports.hex = exports.utf8 = exports.bech32m = exports.bech32 = exports.base58check = exports.createBase58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64urlnopad = exports.base64url = exports.base64nopad = exports.base64 = exports.base32crockford = exports.base32hexnopad = exports.base32hex = exports.base32nopad = exports.base32 = exports.base16 = exports.utils =
|
6793
|
+
exports.bytes = exports.stringToBytes = exports.str = exports.bytesToString = exports.hex = exports.utf8 = exports.bech32m = exports.bech32 = exports.base58check = exports.createBase58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64urlnopad = exports.base64url = exports.base64nopad = exports.base64 = exports.base32crockford = exports.base32hexnopad = exports.base32hex = exports.base32nopad = exports.base32 = exports.base16 = exports.utils = void 0;
|
6582
6794
|
function isBytes(a) {
|
6583
6795
|
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
6584
6796
|
}
|
6797
|
+
/** Asserts something is Uint8Array. */
|
6798
|
+
function abytes(b, ...lengths) {
|
6799
|
+
if (!isBytes(b))
|
6800
|
+
throw new Error('Uint8Array expected');
|
6801
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
6802
|
+
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
6803
|
+
}
|
6585
6804
|
function isArrayOf(isString, arr) {
|
6586
6805
|
if (!Array.isArray(arr))
|
6587
6806
|
return false;
|
@@ -6609,7 +6828,6 @@ function anumber(n) {
|
|
6609
6828
|
if (!Number.isSafeInteger(n))
|
6610
6829
|
throw new Error(`invalid integer: ${n}`);
|
6611
6830
|
}
|
6612
|
-
exports.assertNumber = anumber;
|
6613
6831
|
function aArr(input) {
|
6614
6832
|
if (!Array.isArray(input))
|
6615
6833
|
throw new Error('array expected');
|
@@ -6906,41 +7124,172 @@ exports.utils = {
|
|
6906
7124
|
// RFC 4648 aka RFC 3548
|
6907
7125
|
// ---------------------
|
6908
7126
|
/**
|
6909
|
-
* base16 encoding.
|
7127
|
+
* base16 encoding from RFC 4648.
|
7128
|
+
* @example
|
7129
|
+
* ```js
|
7130
|
+
* base16.encode(Uint8Array.from([0x12, 0xab]));
|
7131
|
+
* // => '12AB'
|
7132
|
+
* ```
|
6910
7133
|
*/
|
6911
7134
|
exports.base16 = chain(radix2(4), alphabet('0123456789ABCDEF'), join(''));
|
7135
|
+
/**
|
7136
|
+
* base32 encoding from RFC 4648. Has padding.
|
7137
|
+
* Use `base32nopad` for unpadded version.
|
7138
|
+
* Also check out `base32hex`, `base32hexnopad`, `base32crockford`.
|
7139
|
+
* @example
|
7140
|
+
* ```js
|
7141
|
+
* base32.encode(Uint8Array.from([0x12, 0xab]));
|
7142
|
+
* // => 'CKVQ===='
|
7143
|
+
* base32.decode('CKVQ====');
|
7144
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7145
|
+
* ```
|
7146
|
+
*/
|
6912
7147
|
exports.base32 = chain(radix2(5), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'), padding(5), join(''));
|
7148
|
+
/**
|
7149
|
+
* base32 encoding from RFC 4648. No padding.
|
7150
|
+
* Use `base32` for padded version.
|
7151
|
+
* Also check out `base32hex`, `base32hexnopad`, `base32crockford`.
|
7152
|
+
* @example
|
7153
|
+
* ```js
|
7154
|
+
* base32nopad.encode(Uint8Array.from([0x12, 0xab]));
|
7155
|
+
* // => 'CKVQ'
|
7156
|
+
* base32nopad.decode('CKVQ');
|
7157
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7158
|
+
* ```
|
7159
|
+
*/
|
6913
7160
|
exports.base32nopad = chain(radix2(5), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'), join(''));
|
7161
|
+
/**
|
7162
|
+
* base32 encoding from RFC 4648. Padded. Compared to ordinary `base32`, slightly different alphabet.
|
7163
|
+
* Use `base32hexnopad` for unpadded version.
|
7164
|
+
* @example
|
7165
|
+
* ```js
|
7166
|
+
* base32hex.encode(Uint8Array.from([0x12, 0xab]));
|
7167
|
+
* // => '2ALG===='
|
7168
|
+
* base32hex.decode('2ALG====');
|
7169
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7170
|
+
* ```
|
7171
|
+
*/
|
6914
7172
|
exports.base32hex = chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), padding(5), join(''));
|
7173
|
+
/**
|
7174
|
+
* base32 encoding from RFC 4648. No padding. Compared to ordinary `base32`, slightly different alphabet.
|
7175
|
+
* Use `base32hex` for padded version.
|
7176
|
+
* @example
|
7177
|
+
* ```js
|
7178
|
+
* base32hexnopad.encode(Uint8Array.from([0x12, 0xab]));
|
7179
|
+
* // => '2ALG'
|
7180
|
+
* base32hexnopad.decode('2ALG');
|
7181
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7182
|
+
* ```
|
7183
|
+
*/
|
6915
7184
|
exports.base32hexnopad = chain(radix2(5), alphabet('0123456789ABCDEFGHIJKLMNOPQRSTUV'), join(''));
|
7185
|
+
/**
|
7186
|
+
* base32 encoding from RFC 4648. Doug Crockford's version.
|
7187
|
+
* https://www.crockford.com/base32.html
|
7188
|
+
* @example
|
7189
|
+
* ```js
|
7190
|
+
* base32crockford.encode(Uint8Array.from([0x12, 0xab]));
|
7191
|
+
* // => '2ANG'
|
7192
|
+
* base32crockford.decode('2ANG');
|
7193
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7194
|
+
* ```
|
7195
|
+
*/
|
6916
7196
|
exports.base32crockford = chain(radix2(5), alphabet('0123456789ABCDEFGHJKMNPQRSTVWXYZ'), join(''), normalize((s) => s.toUpperCase().replace(/O/g, '0').replace(/[IL]/g, '1')));
|
7197
|
+
// Built-in base64 conversion https://caniuse.com/mdn-javascript_builtins_uint8array_frombase64
|
7198
|
+
// prettier-ignore
|
7199
|
+
const hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === 'function' &&
|
7200
|
+
typeof Uint8Array.fromBase64 === 'function')();
|
7201
|
+
const decodeBase64Builtin = (s, isUrl) => {
|
7202
|
+
astr('base64', s);
|
7203
|
+
const re = isUrl ? /^[A-Za-z0-9=_-]+$/ : /^[A-Za-z0-9=+/]+$/;
|
7204
|
+
const alphabet = isUrl ? 'base64url' : 'base64';
|
7205
|
+
if (s.length > 0 && !re.test(s))
|
7206
|
+
throw new Error('invalid base64');
|
7207
|
+
return Uint8Array.fromBase64(s, { alphabet, lastChunkHandling: 'strict' });
|
7208
|
+
};
|
6917
7209
|
/**
|
6918
|
-
* base64
|
7210
|
+
* base64 from RFC 4648. Padded.
|
7211
|
+
* Use `base64nopad` for unpadded version.
|
7212
|
+
* Also check out `base64url`, `base64urlnopad`.
|
7213
|
+
* Falls back to built-in function, when available.
|
6919
7214
|
* @example
|
6920
|
-
*
|
6921
|
-
* base64.encode(
|
7215
|
+
* ```js
|
7216
|
+
* base64.encode(Uint8Array.from([0x12, 0xab]));
|
7217
|
+
* // => 'Eqs='
|
7218
|
+
* base64.decode('Eqs=');
|
7219
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7220
|
+
* ```
|
6922
7221
|
*/
|
6923
|
-
|
7222
|
+
// prettier-ignore
|
7223
|
+
exports.base64 = hasBase64Builtin ? {
|
7224
|
+
encode(b) { abytes(b); return b.toBase64(); },
|
7225
|
+
decode(s) { return decodeBase64Builtin(s, false); },
|
7226
|
+
} : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), padding(6), join(''));
|
6924
7227
|
/**
|
6925
|
-
* base64
|
7228
|
+
* base64 from RFC 4648. No padding.
|
7229
|
+
* Use `base64` for padded version.
|
7230
|
+
* @example
|
7231
|
+
* ```js
|
7232
|
+
* base64nopad.encode(Uint8Array.from([0x12, 0xab]));
|
7233
|
+
* // => 'Eqs'
|
7234
|
+
* base64nopad.decode('Eqs');
|
7235
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7236
|
+
* ```
|
6926
7237
|
*/
|
6927
7238
|
exports.base64nopad = chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'), join(''));
|
6928
|
-
|
7239
|
+
/**
|
7240
|
+
* base64 from RFC 4648, using URL-safe alphabet. Padded.
|
7241
|
+
* Use `base64urlnopad` for unpadded version.
|
7242
|
+
* Falls back to built-in function, when available.
|
7243
|
+
* @example
|
7244
|
+
* ```js
|
7245
|
+
* base64url.encode(Uint8Array.from([0x12, 0xab]));
|
7246
|
+
* // => 'Eqs='
|
7247
|
+
* base64url.decode('Eqs=');
|
7248
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7249
|
+
* ```
|
7250
|
+
*/
|
7251
|
+
// prettier-ignore
|
7252
|
+
exports.base64url = hasBase64Builtin ? {
|
7253
|
+
encode(b) { abytes(b); return b.toBase64({ alphabet: 'base64url' }); },
|
7254
|
+
decode(s) { return decodeBase64Builtin(s, true); },
|
7255
|
+
} : chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'), padding(6), join(''));
|
7256
|
+
/**
|
7257
|
+
* base64 from RFC 4648, using URL-safe alphabet. No padding.
|
7258
|
+
* Use `base64url` for padded version.
|
7259
|
+
* @example
|
7260
|
+
* ```js
|
7261
|
+
* base64urlnopad.encode(Uint8Array.from([0x12, 0xab]));
|
7262
|
+
* // => 'Eqs'
|
7263
|
+
* base64urlnopad.decode('Eqs');
|
7264
|
+
* // => Uint8Array.from([0x12, 0xab])
|
7265
|
+
* ```
|
7266
|
+
*/
|
6929
7267
|
exports.base64urlnopad = chain(radix2(6), alphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'), join(''));
|
6930
7268
|
// base58 code
|
6931
7269
|
// -----------
|
6932
7270
|
const genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => chain(radix(58), alphabet(abc), join(''));
|
6933
7271
|
/**
|
6934
|
-
*
|
7272
|
+
* base58: base64 without ambigous characters +, /, 0, O, I, l.
|
6935
7273
|
* Quadratic (O(n^2)) - so, can't be used on large inputs.
|
7274
|
+
* @example
|
7275
|
+
* ```js
|
7276
|
+
* base58.decode('01abcdef');
|
7277
|
+
* // => '3UhJW'
|
7278
|
+
* ```
|
6936
7279
|
*/
|
6937
7280
|
exports.base58 = genBase58('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
|
7281
|
+
/**
|
7282
|
+
* base58: flickr version. Check out `base58`.
|
7283
|
+
*/
|
6938
7284
|
exports.base58flickr = genBase58('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ');
|
7285
|
+
/**
|
7286
|
+
* base58: XRP version. Check out `base58`.
|
7287
|
+
*/
|
6939
7288
|
exports.base58xrp = genBase58('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz');
|
6940
7289
|
// Data len (index) -> encoded block len
|
6941
7290
|
const XMR_BLOCK_LEN = [0, 2, 3, 5, 6, 7, 9, 10, 11];
|
6942
7291
|
/**
|
6943
|
-
* XMR version
|
7292
|
+
* base58: XMR version. Check out `base58`.
|
6944
7293
|
* Done in 8-byte blocks (which equals 11 chars in decoding). Last (non-full) block padded with '1' to size in XMR_BLOCK_LEN.
|
6945
7294
|
* Block encoding significantly reduces quadratic complexity of base58.
|
6946
7295
|
*/
|
@@ -6968,6 +7317,10 @@ exports.base58xmr = {
|
|
6968
7317
|
return Uint8Array.from(res);
|
6969
7318
|
},
|
6970
7319
|
};
|
7320
|
+
/**
|
7321
|
+
* Method, which creates base58check encoder.
|
7322
|
+
* Requires function, calculating sha256.
|
7323
|
+
*/
|
6971
7324
|
const createBase58check = (sha256) => chain(checksum(4, (data) => sha256(sha256(data))), exports.base58);
|
6972
7325
|
exports.createBase58check = createBase58check;
|
6973
7326
|
/**
|
@@ -7071,36 +7424,60 @@ function genBech32(encoding) {
|
|
7071
7424
|
};
|
7072
7425
|
}
|
7073
7426
|
/**
|
7074
|
-
*
|
7427
|
+
* bech32 from BIP 173. Operates on words.
|
7428
|
+
* For high-level, check out scure-btc-signer:
|
7429
|
+
* https://github.com/paulmillr/scure-btc-signer.
|
7075
7430
|
*/
|
7076
7431
|
exports.bech32 = genBech32('bech32');
|
7432
|
+
/**
|
7433
|
+
* bech32m from BIP 350. Operates on words.
|
7434
|
+
* It was to mitigate `bech32` weaknesses.
|
7435
|
+
* For high-level, check out scure-btc-signer:
|
7436
|
+
* https://github.com/paulmillr/scure-btc-signer.
|
7437
|
+
*/
|
7077
7438
|
exports.bech32m = genBech32('bech32m');
|
7078
7439
|
/**
|
7079
7440
|
* UTF-8-to-byte decoder. Uses built-in TextDecoder / TextEncoder.
|
7080
7441
|
* @example
|
7442
|
+
* ```js
|
7081
7443
|
* const b = utf8.decode("hey"); // => new Uint8Array([ 104, 101, 121 ])
|
7082
7444
|
* const str = utf8.encode(b); // "hey"
|
7445
|
+
* ```
|
7083
7446
|
*/
|
7084
7447
|
exports.utf8 = {
|
7085
7448
|
encode: (data) => new TextDecoder().decode(data),
|
7086
7449
|
decode: (str) => new TextEncoder().encode(str),
|
7087
7450
|
};
|
7451
|
+
// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
|
7452
|
+
// prettier-ignore
|
7453
|
+
const hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === 'function' &&
|
7454
|
+
typeof Uint8Array.fromHex === 'function')();
|
7455
|
+
// prettier-ignore
|
7456
|
+
const hexBuiltin = {
|
7457
|
+
encode(data) { abytes(data); return data.toHex(); },
|
7458
|
+
decode(s) { astr('hex', s); return Uint8Array.fromHex(s); },
|
7459
|
+
};
|
7088
7460
|
/**
|
7089
|
-
* hex string decoder.
|
7461
|
+
* hex string decoder. Uses built-in function, when available.
|
7090
7462
|
* @example
|
7463
|
+
* ```js
|
7091
7464
|
* const b = hex.decode("0102ff"); // => new Uint8Array([ 1, 2, 255 ])
|
7092
7465
|
* const str = hex.encode(b); // "0102ff"
|
7466
|
+
* ```
|
7093
7467
|
*/
|
7094
|
-
exports.hex =
|
7095
|
-
|
7096
|
-
|
7097
|
-
|
7098
|
-
})
|
7468
|
+
exports.hex = hasHexBuiltin
|
7469
|
+
? hexBuiltin
|
7470
|
+
: chain(radix2(4), alphabet('0123456789abcdef'), join(''), normalize((s) => {
|
7471
|
+
if (typeof s !== 'string' || s.length % 2 !== 0)
|
7472
|
+
throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`);
|
7473
|
+
return s.toLowerCase();
|
7474
|
+
}));
|
7099
7475
|
// prettier-ignore
|
7100
7476
|
const CODERS = {
|
7101
7477
|
utf8: exports.utf8, hex: exports.hex, base16: exports.base16, base32: exports.base32, base64: exports.base64, base64url: exports.base64url, base58: exports.base58, base58xmr: exports.base58xmr
|
7102
7478
|
};
|
7103
7479
|
const coderTypeError = 'Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr';
|
7480
|
+
/** @deprecated */
|
7104
7481
|
const bytesToString = (type, bytes) => {
|
7105
7482
|
if (typeof type !== 'string' || !CODERS.hasOwnProperty(type))
|
7106
7483
|
throw new TypeError(coderTypeError);
|
@@ -7109,7 +7486,9 @@ const bytesToString = (type, bytes) => {
|
|
7109
7486
|
return CODERS[type].encode(bytes);
|
7110
7487
|
};
|
7111
7488
|
exports.bytesToString = bytesToString;
|
7489
|
+
/** @deprecated */
|
7112
7490
|
exports.str = exports.bytesToString; // as in python, but for bytes only
|
7491
|
+
/** @deprecated */
|
7113
7492
|
const stringToBytes = (type, str) => {
|
7114
7493
|
if (!CODERS.hasOwnProperty(type))
|
7115
7494
|
throw new TypeError(coderTypeError);
|
@@ -7118,6 +7497,7 @@ const stringToBytes = (type, str) => {
|
|
7118
7497
|
return CODERS[type].decode(str);
|
7119
7498
|
};
|
7120
7499
|
exports.stringToBytes = stringToBytes;
|
7500
|
+
/** @deprecated */
|
7121
7501
|
exports.bytes = exports.stringToBytes;
|
7122
7502
|
|
7123
7503
|
|
@@ -8664,11 +9044,9 @@ exports.validateMnemonic = validateMnemonic;
|
|
8664
9044
|
exports.mnemonicToSeed = mnemonicToSeed;
|
8665
9045
|
exports.mnemonicToSeedSync = mnemonicToSeedSync;
|
8666
9046
|
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
|
8667
|
-
const
|
8668
|
-
const
|
8669
|
-
const
|
8670
|
-
const sha512_1 = __webpack_require__(/*! @noble/hashes/sha512 */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/sha512.js");
|
8671
|
-
const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
9047
|
+
const pbkdf2_1 = __webpack_require__(/*! @noble/hashes/pbkdf2 */ "../../node_modules/@noble/hashes/pbkdf2.js");
|
9048
|
+
const sha2_1 = __webpack_require__(/*! @noble/hashes/sha2 */ "../../node_modules/@noble/hashes/sha2.js");
|
9049
|
+
const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "../../node_modules/@noble/hashes/utils.js");
|
8672
9050
|
const base_1 = __webpack_require__(/*! @scure/base */ "../../node_modules/@scure/base/lib/index.js");
|
8673
9051
|
// Japanese wordlist
|
8674
9052
|
const isJapanese = (wordlist) => wordlist[0] === '\u3042\u3044\u3053\u304f\u3057\u3093';
|
@@ -8689,7 +9067,7 @@ function normalize(str) {
|
|
8689
9067
|
return { nfkd: norm, words };
|
8690
9068
|
}
|
8691
9069
|
function aentropy(ent) {
|
8692
|
-
(0,
|
9070
|
+
(0, utils_1.abytes)(ent, 16, 20, 24, 28, 32);
|
8693
9071
|
}
|
8694
9072
|
/**
|
8695
9073
|
* Generate x random words. Uses Cryptographically-Secure Random Number Generator.
|
@@ -8700,7 +9078,7 @@ function aentropy(ent) {
|
|
8700
9078
|
* // 'legal winner thank year wave sausage worth useful legal winner thank yellow'
|
8701
9079
|
*/
|
8702
9080
|
function generateMnemonic(wordlist, strength = 128) {
|
8703
|
-
(0,
|
9081
|
+
(0, utils_1.anumber)(strength);
|
8704
9082
|
if (strength % 32 !== 0 || strength > 256)
|
8705
9083
|
throw new TypeError('Invalid entropy');
|
8706
9084
|
return entropyToMnemonic((0, utils_1.randomBytes)(strength / 8), wordlist);
|
@@ -8710,7 +9088,7 @@ const calcChecksum = (entropy) => {
|
|
8710
9088
|
const bitsLeft = 8 - entropy.length / 4;
|
8711
9089
|
// Zero rightmost "bitsLeft" bits in byte
|
8712
9090
|
// For example: bitsLeft=4 val=10111101 -> 10110000
|
8713
|
-
return new Uint8Array([((0,
|
9091
|
+
return new Uint8Array([((0, sha2_1.sha256)(entropy)[0] >> bitsLeft) << bitsLeft]);
|
8714
9092
|
};
|
8715
9093
|
function getCoder(wordlist) {
|
8716
9094
|
if (!Array.isArray(wordlist) || wordlist.length !== 2048 || typeof wordlist[0] !== 'string')
|
@@ -8778,1210 +9156,24 @@ const psalt = (passphrase) => nfkd('mnemonic' + passphrase);
|
|
8778
9156
|
* @returns 64 bytes of key data
|
8779
9157
|
* @example
|
8780
9158
|
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
8781
|
-
* await mnemonicToSeed(mnem, 'password');
|
8782
|
-
* // new Uint8Array([...64 bytes])
|
8783
|
-
*/
|
8784
|
-
function mnemonicToSeed(mnemonic, passphrase = '') {
|
8785
|
-
return (0, pbkdf2_1.pbkdf2Async)(
|
8786
|
-
}
|
8787
|
-
/**
|
8788
|
-
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
8789
|
-
* @param mnemonic 12-24 words
|
8790
|
-
* @param passphrase string that will additionally protect the key
|
8791
|
-
* @returns 64 bytes of key data
|
8792
|
-
* @example
|
8793
|
-
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
8794
|
-
* mnemonicToSeedSync(mnem, 'password');
|
8795
|
-
* // new Uint8Array([...64 bytes])
|
8796
|
-
*/
|
8797
|
-
function mnemonicToSeedSync(mnemonic, passphrase = '') {
|
8798
|
-
return (0, pbkdf2_1.pbkdf2)(
|
8799
|
-
}
|
8800
|
-
|
8801
|
-
|
8802
|
-
/***/ }),
|
8803
|
-
|
8804
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js":
|
8805
|
-
/*!*****************************************************************************!*\
|
8806
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js ***!
|
8807
|
-
\*****************************************************************************/
|
8808
|
-
/***/ ((__unused_webpack_module, exports) => {
|
8809
|
-
|
8810
|
-
"use strict";
|
8811
|
-
|
8812
|
-
/**
|
8813
|
-
* Internal assertion helpers.
|
8814
|
-
* @module
|
8815
|
-
*/
|
8816
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8817
|
-
exports.anumber = anumber;
|
8818
|
-
exports.abytes = abytes;
|
8819
|
-
exports.ahash = ahash;
|
8820
|
-
exports.aexists = aexists;
|
8821
|
-
exports.aoutput = aoutput;
|
8822
|
-
/** Asserts something is positive integer. */
|
8823
|
-
function anumber(n) {
|
8824
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
8825
|
-
throw new Error('positive integer expected, got ' + n);
|
8826
|
-
}
|
8827
|
-
/** Is number an Uint8Array? Copied from utils for perf. */
|
8828
|
-
function isBytes(a) {
|
8829
|
-
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
8830
|
-
}
|
8831
|
-
/** Asserts something is Uint8Array. */
|
8832
|
-
function abytes(b, ...lengths) {
|
8833
|
-
if (!isBytes(b))
|
8834
|
-
throw new Error('Uint8Array expected');
|
8835
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
8836
|
-
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
8837
|
-
}
|
8838
|
-
/** Asserts something is hash */
|
8839
|
-
function ahash(h) {
|
8840
|
-
if (typeof h !== 'function' || typeof h.create !== 'function')
|
8841
|
-
throw new Error('Hash should be wrapped by utils.wrapConstructor');
|
8842
|
-
anumber(h.outputLen);
|
8843
|
-
anumber(h.blockLen);
|
8844
|
-
}
|
8845
|
-
/** Asserts a hash instance has not been destroyed / finished */
|
8846
|
-
function aexists(instance, checkFinished = true) {
|
8847
|
-
if (instance.destroyed)
|
8848
|
-
throw new Error('Hash instance has been destroyed');
|
8849
|
-
if (checkFinished && instance.finished)
|
8850
|
-
throw new Error('Hash#digest() has already been called');
|
8851
|
-
}
|
8852
|
-
/** Asserts output is properly-sized byte array */
|
8853
|
-
function aoutput(out, instance) {
|
8854
|
-
abytes(out);
|
8855
|
-
const min = instance.outputLen;
|
8856
|
-
if (out.length < min) {
|
8857
|
-
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
8858
|
-
}
|
8859
|
-
}
|
8860
|
-
|
8861
|
-
|
8862
|
-
/***/ }),
|
8863
|
-
|
8864
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_md.js":
|
8865
|
-
/*!*************************************************************************!*\
|
8866
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/_md.js ***!
|
8867
|
-
\*************************************************************************/
|
8868
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
8869
|
-
|
8870
|
-
"use strict";
|
8871
|
-
|
8872
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
8873
|
-
exports.HashMD = void 0;
|
8874
|
-
exports.setBigUint64 = setBigUint64;
|
8875
|
-
exports.Chi = Chi;
|
8876
|
-
exports.Maj = Maj;
|
8877
|
-
/**
|
8878
|
-
* Internal Merkle-Damgard hash utils.
|
8879
|
-
* @module
|
8880
|
-
*/
|
8881
|
-
const _assert_ts_1 = __webpack_require__(/*! ./_assert.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js");
|
8882
|
-
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
8883
|
-
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
8884
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
8885
|
-
if (typeof view.setBigUint64 === 'function')
|
8886
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
8887
|
-
const _32n = BigInt(32);
|
8888
|
-
const _u32_max = BigInt(0xffffffff);
|
8889
|
-
const wh = Number((value >> _32n) & _u32_max);
|
8890
|
-
const wl = Number(value & _u32_max);
|
8891
|
-
const h = isLE ? 4 : 0;
|
8892
|
-
const l = isLE ? 0 : 4;
|
8893
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
8894
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
8895
|
-
}
|
8896
|
-
/** Choice: a ? b : c */
|
8897
|
-
function Chi(a, b, c) {
|
8898
|
-
return (a & b) ^ (~a & c);
|
8899
|
-
}
|
8900
|
-
/** Majority function, true if any two inputs is true. */
|
8901
|
-
function Maj(a, b, c) {
|
8902
|
-
return (a & b) ^ (a & c) ^ (b & c);
|
8903
|
-
}
|
8904
|
-
/**
|
8905
|
-
* Merkle-Damgard hash construction base class.
|
8906
|
-
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
8907
|
-
*/
|
8908
|
-
class HashMD extends utils_ts_1.Hash {
|
8909
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
8910
|
-
super();
|
8911
|
-
this.finished = false;
|
8912
|
-
this.length = 0;
|
8913
|
-
this.pos = 0;
|
8914
|
-
this.destroyed = false;
|
8915
|
-
this.blockLen = blockLen;
|
8916
|
-
this.outputLen = outputLen;
|
8917
|
-
this.padOffset = padOffset;
|
8918
|
-
this.isLE = isLE;
|
8919
|
-
this.buffer = new Uint8Array(blockLen);
|
8920
|
-
this.view = (0, utils_ts_1.createView)(this.buffer);
|
8921
|
-
}
|
8922
|
-
update(data) {
|
8923
|
-
(0, _assert_ts_1.aexists)(this);
|
8924
|
-
const { view, buffer, blockLen } = this;
|
8925
|
-
data = (0, utils_ts_1.toBytes)(data);
|
8926
|
-
const len = data.length;
|
8927
|
-
for (let pos = 0; pos < len;) {
|
8928
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
8929
|
-
// Fast path: we have at least one block in input, cast it to view and process
|
8930
|
-
if (take === blockLen) {
|
8931
|
-
const dataView = (0, utils_ts_1.createView)(data);
|
8932
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
8933
|
-
this.process(dataView, pos);
|
8934
|
-
continue;
|
8935
|
-
}
|
8936
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
8937
|
-
this.pos += take;
|
8938
|
-
pos += take;
|
8939
|
-
if (this.pos === blockLen) {
|
8940
|
-
this.process(view, 0);
|
8941
|
-
this.pos = 0;
|
8942
|
-
}
|
8943
|
-
}
|
8944
|
-
this.length += data.length;
|
8945
|
-
this.roundClean();
|
8946
|
-
return this;
|
8947
|
-
}
|
8948
|
-
digestInto(out) {
|
8949
|
-
(0, _assert_ts_1.aexists)(this);
|
8950
|
-
(0, _assert_ts_1.aoutput)(out, this);
|
8951
|
-
this.finished = true;
|
8952
|
-
// Padding
|
8953
|
-
// We can avoid allocation of buffer for padding completely if it
|
8954
|
-
// was previously not allocated here. But it won't change performance.
|
8955
|
-
const { buffer, view, blockLen, isLE } = this;
|
8956
|
-
let { pos } = this;
|
8957
|
-
// append the bit '1' to the message
|
8958
|
-
buffer[pos++] = 0b10000000;
|
8959
|
-
this.buffer.subarray(pos).fill(0);
|
8960
|
-
// we have less than padOffset left in buffer, so we cannot put length in
|
8961
|
-
// current block, need process it and pad again
|
8962
|
-
if (this.padOffset > blockLen - pos) {
|
8963
|
-
this.process(view, 0);
|
8964
|
-
pos = 0;
|
8965
|
-
}
|
8966
|
-
// Pad until full block byte with zeros
|
8967
|
-
for (let i = pos; i < blockLen; i++)
|
8968
|
-
buffer[i] = 0;
|
8969
|
-
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
8970
|
-
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
8971
|
-
// So we just write lowest 64 bits of that value.
|
8972
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
8973
|
-
this.process(view, 0);
|
8974
|
-
const oview = (0, utils_ts_1.createView)(out);
|
8975
|
-
const len = this.outputLen;
|
8976
|
-
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
|
8977
|
-
if (len % 4)
|
8978
|
-
throw new Error('_sha2: outputLen should be aligned to 32bit');
|
8979
|
-
const outLen = len / 4;
|
8980
|
-
const state = this.get();
|
8981
|
-
if (outLen > state.length)
|
8982
|
-
throw new Error('_sha2: outputLen bigger than state');
|
8983
|
-
for (let i = 0; i < outLen; i++)
|
8984
|
-
oview.setUint32(4 * i, state[i], isLE);
|
8985
|
-
}
|
8986
|
-
digest() {
|
8987
|
-
const { buffer, outputLen } = this;
|
8988
|
-
this.digestInto(buffer);
|
8989
|
-
const res = buffer.slice(0, outputLen);
|
8990
|
-
this.destroy();
|
8991
|
-
return res;
|
8992
|
-
}
|
8993
|
-
_cloneInto(to) {
|
8994
|
-
to || (to = new this.constructor());
|
8995
|
-
to.set(...this.get());
|
8996
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
8997
|
-
to.length = length;
|
8998
|
-
to.pos = pos;
|
8999
|
-
to.finished = finished;
|
9000
|
-
to.destroyed = destroyed;
|
9001
|
-
if (length % blockLen)
|
9002
|
-
to.buffer.set(buffer);
|
9003
|
-
return to;
|
9004
|
-
}
|
9005
|
-
}
|
9006
|
-
exports.HashMD = HashMD;
|
9007
|
-
|
9008
|
-
|
9009
|
-
/***/ }),
|
9010
|
-
|
9011
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_u64.js":
|
9012
|
-
/*!**************************************************************************!*\
|
9013
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/_u64.js ***!
|
9014
|
-
\**************************************************************************/
|
9015
|
-
/***/ ((__unused_webpack_module, exports) => {
|
9016
|
-
|
9017
|
-
"use strict";
|
9018
|
-
|
9019
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9020
|
-
exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = void 0;
|
9021
|
-
exports.fromBig = fromBig;
|
9022
|
-
exports.split = split;
|
9023
|
-
exports.add = add;
|
9024
|
-
/**
|
9025
|
-
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
9026
|
-
* @todo re-check https://issues.chromium.org/issues/42212588
|
9027
|
-
* @module
|
9028
|
-
*/
|
9029
|
-
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
9030
|
-
const _32n = /* @__PURE__ */ BigInt(32);
|
9031
|
-
function fromBig(n, le = false) {
|
9032
|
-
if (le)
|
9033
|
-
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
9034
|
-
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
9035
|
-
}
|
9036
|
-
function split(lst, le = false) {
|
9037
|
-
let Ah = new Uint32Array(lst.length);
|
9038
|
-
let Al = new Uint32Array(lst.length);
|
9039
|
-
for (let i = 0; i < lst.length; i++) {
|
9040
|
-
const { h, l } = fromBig(lst[i], le);
|
9041
|
-
[Ah[i], Al[i]] = [h, l];
|
9042
|
-
}
|
9043
|
-
return [Ah, Al];
|
9044
|
-
}
|
9045
|
-
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
9046
|
-
exports.toBig = toBig;
|
9047
|
-
// for Shift in [0, 32)
|
9048
|
-
const shrSH = (h, _l, s) => h >>> s;
|
9049
|
-
exports.shrSH = shrSH;
|
9050
|
-
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
9051
|
-
exports.shrSL = shrSL;
|
9052
|
-
// Right rotate for Shift in [1, 32)
|
9053
|
-
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
|
9054
|
-
exports.rotrSH = rotrSH;
|
9055
|
-
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
9056
|
-
exports.rotrSL = rotrSL;
|
9057
|
-
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
|
9058
|
-
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
|
9059
|
-
exports.rotrBH = rotrBH;
|
9060
|
-
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
9061
|
-
exports.rotrBL = rotrBL;
|
9062
|
-
// Right rotate for shift===32 (just swaps l&h)
|
9063
|
-
const rotr32H = (_h, l) => l;
|
9064
|
-
exports.rotr32H = rotr32H;
|
9065
|
-
const rotr32L = (h, _l) => h;
|
9066
|
-
exports.rotr32L = rotr32L;
|
9067
|
-
// Left rotate for Shift in [1, 32)
|
9068
|
-
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
9069
|
-
exports.rotlSH = rotlSH;
|
9070
|
-
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
9071
|
-
exports.rotlSL = rotlSL;
|
9072
|
-
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
9073
|
-
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
9074
|
-
exports.rotlBH = rotlBH;
|
9075
|
-
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
9076
|
-
exports.rotlBL = rotlBL;
|
9077
|
-
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
9078
|
-
// simple take carry out of low bit sum by shift, we need to use division.
|
9079
|
-
function add(Ah, Al, Bh, Bl) {
|
9080
|
-
const l = (Al >>> 0) + (Bl >>> 0);
|
9081
|
-
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
9082
|
-
}
|
9083
|
-
// Addition with more than 2 elements
|
9084
|
-
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
9085
|
-
exports.add3L = add3L;
|
9086
|
-
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
9087
|
-
exports.add3H = add3H;
|
9088
|
-
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
9089
|
-
exports.add4L = add4L;
|
9090
|
-
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
9091
|
-
exports.add4H = add4H;
|
9092
|
-
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
9093
|
-
exports.add5L = add5L;
|
9094
|
-
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
9095
|
-
exports.add5H = add5H;
|
9096
|
-
// prettier-ignore
|
9097
|
-
const u64 = {
|
9098
|
-
fromBig, split, toBig,
|
9099
|
-
shrSH, shrSL,
|
9100
|
-
rotrSH, rotrSL, rotrBH, rotrBL,
|
9101
|
-
rotr32H, rotr32L,
|
9102
|
-
rotlSH, rotlSL, rotlBH, rotlBL,
|
9103
|
-
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
9104
|
-
};
|
9105
|
-
exports["default"] = u64;
|
9106
|
-
|
9107
|
-
|
9108
|
-
/***/ }),
|
9109
|
-
|
9110
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/crypto.js":
|
9111
|
-
/*!****************************************************************************!*\
|
9112
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/crypto.js ***!
|
9113
|
-
\****************************************************************************/
|
9114
|
-
/***/ ((__unused_webpack_module, exports) => {
|
9115
|
-
|
9116
|
-
"use strict";
|
9117
|
-
|
9118
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9119
|
-
exports.crypto = void 0;
|
9120
|
-
exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
9121
|
-
|
9122
|
-
|
9123
|
-
/***/ }),
|
9124
|
-
|
9125
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/hmac.js":
|
9126
|
-
/*!**************************************************************************!*\
|
9127
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/hmac.js ***!
|
9128
|
-
\**************************************************************************/
|
9129
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
9130
|
-
|
9131
|
-
"use strict";
|
9132
|
-
|
9133
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9134
|
-
exports.hmac = exports.HMAC = void 0;
|
9135
|
-
/**
|
9136
|
-
* HMAC: RFC2104 message authentication code.
|
9137
|
-
* @module
|
9138
|
-
*/
|
9139
|
-
const _assert_ts_1 = __webpack_require__(/*! ./_assert.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js");
|
9140
|
-
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
9141
|
-
class HMAC extends utils_ts_1.Hash {
|
9142
|
-
constructor(hash, _key) {
|
9143
|
-
super();
|
9144
|
-
this.finished = false;
|
9145
|
-
this.destroyed = false;
|
9146
|
-
(0, _assert_ts_1.ahash)(hash);
|
9147
|
-
const key = (0, utils_ts_1.toBytes)(_key);
|
9148
|
-
this.iHash = hash.create();
|
9149
|
-
if (typeof this.iHash.update !== 'function')
|
9150
|
-
throw new Error('Expected instance of class which extends utils.Hash');
|
9151
|
-
this.blockLen = this.iHash.blockLen;
|
9152
|
-
this.outputLen = this.iHash.outputLen;
|
9153
|
-
const blockLen = this.blockLen;
|
9154
|
-
const pad = new Uint8Array(blockLen);
|
9155
|
-
// blockLen can be bigger than outputLen
|
9156
|
-
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
9157
|
-
for (let i = 0; i < pad.length; i++)
|
9158
|
-
pad[i] ^= 0x36;
|
9159
|
-
this.iHash.update(pad);
|
9160
|
-
// By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
|
9161
|
-
this.oHash = hash.create();
|
9162
|
-
// Undo internal XOR && apply outer XOR
|
9163
|
-
for (let i = 0; i < pad.length; i++)
|
9164
|
-
pad[i] ^= 0x36 ^ 0x5c;
|
9165
|
-
this.oHash.update(pad);
|
9166
|
-
pad.fill(0);
|
9167
|
-
}
|
9168
|
-
update(buf) {
|
9169
|
-
(0, _assert_ts_1.aexists)(this);
|
9170
|
-
this.iHash.update(buf);
|
9171
|
-
return this;
|
9172
|
-
}
|
9173
|
-
digestInto(out) {
|
9174
|
-
(0, _assert_ts_1.aexists)(this);
|
9175
|
-
(0, _assert_ts_1.abytes)(out, this.outputLen);
|
9176
|
-
this.finished = true;
|
9177
|
-
this.iHash.digestInto(out);
|
9178
|
-
this.oHash.update(out);
|
9179
|
-
this.oHash.digestInto(out);
|
9180
|
-
this.destroy();
|
9181
|
-
}
|
9182
|
-
digest() {
|
9183
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
9184
|
-
this.digestInto(out);
|
9185
|
-
return out;
|
9186
|
-
}
|
9187
|
-
_cloneInto(to) {
|
9188
|
-
// Create new instance without calling constructor since key already in state and we don't know it.
|
9189
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
9190
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
9191
|
-
to = to;
|
9192
|
-
to.finished = finished;
|
9193
|
-
to.destroyed = destroyed;
|
9194
|
-
to.blockLen = blockLen;
|
9195
|
-
to.outputLen = outputLen;
|
9196
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
9197
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
9198
|
-
return to;
|
9199
|
-
}
|
9200
|
-
destroy() {
|
9201
|
-
this.destroyed = true;
|
9202
|
-
this.oHash.destroy();
|
9203
|
-
this.iHash.destroy();
|
9204
|
-
}
|
9205
|
-
}
|
9206
|
-
exports.HMAC = HMAC;
|
9207
|
-
/**
|
9208
|
-
* HMAC: RFC2104 message authentication code.
|
9209
|
-
* @param hash - function that would be used e.g. sha256
|
9210
|
-
* @param key - message key
|
9211
|
-
* @param message - message data
|
9212
|
-
* @example
|
9213
|
-
* import { hmac } from '@noble/hashes/hmac';
|
9214
|
-
* import { sha256 } from '@noble/hashes/sha2';
|
9215
|
-
* const mac1 = hmac(sha256, 'key', 'message');
|
9216
|
-
*/
|
9217
|
-
const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
9218
|
-
exports.hmac = hmac;
|
9219
|
-
exports.hmac.create = (hash, key) => new HMAC(hash, key);
|
9220
|
-
|
9221
|
-
|
9222
|
-
/***/ }),
|
9223
|
-
|
9224
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/pbkdf2.js":
|
9225
|
-
/*!****************************************************************************!*\
|
9226
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/pbkdf2.js ***!
|
9227
|
-
\****************************************************************************/
|
9228
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
9229
|
-
|
9230
|
-
"use strict";
|
9231
|
-
|
9232
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9233
|
-
exports.pbkdf2 = pbkdf2;
|
9234
|
-
exports.pbkdf2Async = pbkdf2Async;
|
9235
|
-
/**
|
9236
|
-
* PBKDF (RFC 2898). Can be used to create a key from password and salt.
|
9237
|
-
* @module
|
9238
|
-
*/
|
9239
|
-
const _assert_ts_1 = __webpack_require__(/*! ./_assert.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js");
|
9240
|
-
const hmac_ts_1 = __webpack_require__(/*! ./hmac.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/hmac.js");
|
9241
|
-
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
9242
|
-
// Common prologue and epilogue for sync/async functions
|
9243
|
-
function pbkdf2Init(hash, _password, _salt, _opts) {
|
9244
|
-
(0, _assert_ts_1.ahash)(hash);
|
9245
|
-
const opts = (0, utils_ts_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts);
|
9246
|
-
const { c, dkLen, asyncTick } = opts;
|
9247
|
-
(0, _assert_ts_1.anumber)(c);
|
9248
|
-
(0, _assert_ts_1.anumber)(dkLen);
|
9249
|
-
(0, _assert_ts_1.anumber)(asyncTick);
|
9250
|
-
if (c < 1)
|
9251
|
-
throw new Error('PBKDF2: iterations (c) should be >= 1');
|
9252
|
-
const password = (0, utils_ts_1.toBytes)(_password);
|
9253
|
-
const salt = (0, utils_ts_1.toBytes)(_salt);
|
9254
|
-
// DK = PBKDF2(PRF, Password, Salt, c, dkLen);
|
9255
|
-
const DK = new Uint8Array(dkLen);
|
9256
|
-
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
9257
|
-
const PRF = hmac_ts_1.hmac.create(hash, password);
|
9258
|
-
const PRFSalt = PRF._cloneInto().update(salt);
|
9259
|
-
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
9260
|
-
}
|
9261
|
-
function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
|
9262
|
-
PRF.destroy();
|
9263
|
-
PRFSalt.destroy();
|
9264
|
-
if (prfW)
|
9265
|
-
prfW.destroy();
|
9266
|
-
u.fill(0);
|
9267
|
-
return DK;
|
9268
|
-
}
|
9269
|
-
/**
|
9270
|
-
* PBKDF2-HMAC: RFC 2898 key derivation function
|
9271
|
-
* @param hash - hash function that would be used e.g. sha256
|
9272
|
-
* @param password - password from which a derived key is generated
|
9273
|
-
* @param salt - cryptographic salt
|
9274
|
-
* @param opts - {c, dkLen} where c is work factor and dkLen is output message size
|
9275
|
-
* @example
|
9276
|
-
* const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: 2 ** 18 });
|
9277
|
-
*/
|
9278
|
-
function pbkdf2(hash, password, salt, opts) {
|
9279
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
9280
|
-
let prfW; // Working copy
|
9281
|
-
const arr = new Uint8Array(4);
|
9282
|
-
const view = (0, utils_ts_1.createView)(arr);
|
9283
|
-
const u = new Uint8Array(PRF.outputLen);
|
9284
|
-
// DK = T1 + T2 + ⋯ + Tdklen/hlen
|
9285
|
-
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
9286
|
-
// Ti = F(Password, Salt, c, i)
|
9287
|
-
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
9288
|
-
view.setInt32(0, ti, false);
|
9289
|
-
// F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
|
9290
|
-
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
9291
|
-
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
9292
|
-
Ti.set(u.subarray(0, Ti.length));
|
9293
|
-
for (let ui = 1; ui < c; ui++) {
|
9294
|
-
// Uc = PRF(Password, Uc−1)
|
9295
|
-
PRF._cloneInto(prfW).update(u).digestInto(u);
|
9296
|
-
for (let i = 0; i < Ti.length; i++)
|
9297
|
-
Ti[i] ^= u[i];
|
9298
|
-
}
|
9299
|
-
}
|
9300
|
-
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
9301
|
-
}
|
9302
|
-
/**
|
9303
|
-
* PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
|
9304
|
-
* @example
|
9305
|
-
* await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
|
9306
|
-
*/
|
9307
|
-
async function pbkdf2Async(hash, password, salt, opts) {
|
9308
|
-
const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
9309
|
-
let prfW; // Working copy
|
9310
|
-
const arr = new Uint8Array(4);
|
9311
|
-
const view = (0, utils_ts_1.createView)(arr);
|
9312
|
-
const u = new Uint8Array(PRF.outputLen);
|
9313
|
-
// DK = T1 + T2 + ⋯ + Tdklen/hlen
|
9314
|
-
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
9315
|
-
// Ti = F(Password, Salt, c, i)
|
9316
|
-
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
9317
|
-
view.setInt32(0, ti, false);
|
9318
|
-
// F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
|
9319
|
-
// U1 = PRF(Password, Salt + INT_32_BE(i))
|
9320
|
-
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
9321
|
-
Ti.set(u.subarray(0, Ti.length));
|
9322
|
-
await (0, utils_ts_1.asyncLoop)(c - 1, asyncTick, () => {
|
9323
|
-
// Uc = PRF(Password, Uc−1)
|
9324
|
-
PRF._cloneInto(prfW).update(u).digestInto(u);
|
9325
|
-
for (let i = 0; i < Ti.length; i++)
|
9326
|
-
Ti[i] ^= u[i];
|
9327
|
-
});
|
9328
|
-
}
|
9329
|
-
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
9330
|
-
}
|
9331
|
-
|
9332
|
-
|
9333
|
-
/***/ }),
|
9334
|
-
|
9335
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/sha256.js":
|
9336
|
-
/*!****************************************************************************!*\
|
9337
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/sha256.js ***!
|
9338
|
-
\****************************************************************************/
|
9339
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
9340
|
-
|
9341
|
-
"use strict";
|
9342
|
-
|
9343
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9344
|
-
exports.sha224 = exports.sha256 = exports.SHA256 = void 0;
|
9345
|
-
/**
|
9346
|
-
* SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
|
9347
|
-
*
|
9348
|
-
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
|
9349
|
-
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
9350
|
-
*
|
9351
|
-
* Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
9352
|
-
* @module
|
9353
|
-
*/
|
9354
|
-
const _md_ts_1 = __webpack_require__(/*! ./_md.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_md.js");
|
9355
|
-
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
9356
|
-
/** Round constants: first 32 bits of fractional parts of the cube roots of the first 64 primes 2..311). */
|
9357
|
-
// prettier-ignore
|
9358
|
-
const SHA256_K = /* @__PURE__ */ new Uint32Array([
|
9359
|
-
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
9360
|
-
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
9361
|
-
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
9362
|
-
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
9363
|
-
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
9364
|
-
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
9365
|
-
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
9366
|
-
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
9367
|
-
]);
|
9368
|
-
/** Initial state: first 32 bits of fractional parts of the square roots of the first 8 primes 2..19. */
|
9369
|
-
// prettier-ignore
|
9370
|
-
const SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
9371
|
-
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
9372
|
-
]);
|
9373
|
-
/**
|
9374
|
-
* Temporary buffer, not used to store anything between runs.
|
9375
|
-
* Named this way because it matches specification.
|
9376
|
-
*/
|
9377
|
-
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
9378
|
-
class SHA256 extends _md_ts_1.HashMD {
|
9379
|
-
constructor(outputLen = 32) {
|
9380
|
-
super(64, outputLen, 8, false);
|
9381
|
-
// We cannot use array here since array allows indexing by variable
|
9382
|
-
// which means optimizer/compiler cannot use registers.
|
9383
|
-
this.A = SHA256_IV[0] | 0;
|
9384
|
-
this.B = SHA256_IV[1] | 0;
|
9385
|
-
this.C = SHA256_IV[2] | 0;
|
9386
|
-
this.D = SHA256_IV[3] | 0;
|
9387
|
-
this.E = SHA256_IV[4] | 0;
|
9388
|
-
this.F = SHA256_IV[5] | 0;
|
9389
|
-
this.G = SHA256_IV[6] | 0;
|
9390
|
-
this.H = SHA256_IV[7] | 0;
|
9391
|
-
}
|
9392
|
-
get() {
|
9393
|
-
const { A, B, C, D, E, F, G, H } = this;
|
9394
|
-
return [A, B, C, D, E, F, G, H];
|
9395
|
-
}
|
9396
|
-
// prettier-ignore
|
9397
|
-
set(A, B, C, D, E, F, G, H) {
|
9398
|
-
this.A = A | 0;
|
9399
|
-
this.B = B | 0;
|
9400
|
-
this.C = C | 0;
|
9401
|
-
this.D = D | 0;
|
9402
|
-
this.E = E | 0;
|
9403
|
-
this.F = F | 0;
|
9404
|
-
this.G = G | 0;
|
9405
|
-
this.H = H | 0;
|
9406
|
-
}
|
9407
|
-
process(view, offset) {
|
9408
|
-
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
9409
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
9410
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
9411
|
-
for (let i = 16; i < 64; i++) {
|
9412
|
-
const W15 = SHA256_W[i - 15];
|
9413
|
-
const W2 = SHA256_W[i - 2];
|
9414
|
-
const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ (W15 >>> 3);
|
9415
|
-
const s1 = (0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ (W2 >>> 10);
|
9416
|
-
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
|
9417
|
-
}
|
9418
|
-
// Compression function main loop, 64 rounds
|
9419
|
-
let { A, B, C, D, E, F, G, H } = this;
|
9420
|
-
for (let i = 0; i < 64; i++) {
|
9421
|
-
const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
|
9422
|
-
const T1 = (H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
9423
|
-
const sigma0 = (0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22);
|
9424
|
-
const T2 = (sigma0 + (0, _md_ts_1.Maj)(A, B, C)) | 0;
|
9425
|
-
H = G;
|
9426
|
-
G = F;
|
9427
|
-
F = E;
|
9428
|
-
E = (D + T1) | 0;
|
9429
|
-
D = C;
|
9430
|
-
C = B;
|
9431
|
-
B = A;
|
9432
|
-
A = (T1 + T2) | 0;
|
9433
|
-
}
|
9434
|
-
// Add the compressed chunk to the current hash value
|
9435
|
-
A = (A + this.A) | 0;
|
9436
|
-
B = (B + this.B) | 0;
|
9437
|
-
C = (C + this.C) | 0;
|
9438
|
-
D = (D + this.D) | 0;
|
9439
|
-
E = (E + this.E) | 0;
|
9440
|
-
F = (F + this.F) | 0;
|
9441
|
-
G = (G + this.G) | 0;
|
9442
|
-
H = (H + this.H) | 0;
|
9443
|
-
this.set(A, B, C, D, E, F, G, H);
|
9444
|
-
}
|
9445
|
-
roundClean() {
|
9446
|
-
SHA256_W.fill(0);
|
9447
|
-
}
|
9448
|
-
destroy() {
|
9449
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
9450
|
-
this.buffer.fill(0);
|
9451
|
-
}
|
9452
|
-
}
|
9453
|
-
exports.SHA256 = SHA256;
|
9454
|
-
/**
|
9455
|
-
* Constants taken from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf.
|
9456
|
-
*/
|
9457
|
-
class SHA224 extends SHA256 {
|
9458
|
-
constructor() {
|
9459
|
-
super(28);
|
9460
|
-
this.A = 0xc1059ed8 | 0;
|
9461
|
-
this.B = 0x367cd507 | 0;
|
9462
|
-
this.C = 0x3070dd17 | 0;
|
9463
|
-
this.D = 0xf70e5939 | 0;
|
9464
|
-
this.E = 0xffc00b31 | 0;
|
9465
|
-
this.F = 0x68581511 | 0;
|
9466
|
-
this.G = 0x64f98fa7 | 0;
|
9467
|
-
this.H = 0xbefa4fa4 | 0;
|
9468
|
-
}
|
9469
|
-
}
|
9470
|
-
/** SHA2-256 hash function */
|
9471
|
-
exports.sha256 = (0, utils_ts_1.wrapConstructor)(() => new SHA256());
|
9472
|
-
/** SHA2-224 hash function */
|
9473
|
-
exports.sha224 = (0, utils_ts_1.wrapConstructor)(() => new SHA224());
|
9474
|
-
|
9475
|
-
|
9476
|
-
/***/ }),
|
9477
|
-
|
9478
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/sha512.js":
|
9479
|
-
/*!****************************************************************************!*\
|
9480
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/sha512.js ***!
|
9481
|
-
\****************************************************************************/
|
9482
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
9483
|
-
|
9484
|
-
"use strict";
|
9485
|
-
|
9486
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9487
|
-
exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA384 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA512 = void 0;
|
9488
|
-
/**
|
9489
|
-
* SHA2-512 a.k.a. sha512 and sha384. It is slower than sha256 in js because u64 operations are slow.
|
9490
|
-
*
|
9491
|
-
* Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
|
9492
|
-
* [the paper on truncated SHA512/256](https://eprint.iacr.org/2010/548.pdf).
|
9493
|
-
* @module
|
9494
|
-
*/
|
9495
|
-
const _md_ts_1 = __webpack_require__(/*! ./_md.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_md.js");
|
9496
|
-
const _u64_ts_1 = __webpack_require__(/*! ./_u64.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_u64.js");
|
9497
|
-
const utils_ts_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js");
|
9498
|
-
// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):
|
9499
|
-
// prettier-ignore
|
9500
|
-
const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_ts_1.default.split([
|
9501
|
-
'0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
|
9502
|
-
'0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
|
9503
|
-
'0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
|
9504
|
-
'0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
|
9505
|
-
'0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
|
9506
|
-
'0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
|
9507
|
-
'0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
|
9508
|
-
'0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
|
9509
|
-
'0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
|
9510
|
-
'0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
|
9511
|
-
'0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
|
9512
|
-
'0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
|
9513
|
-
'0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
|
9514
|
-
'0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
|
9515
|
-
'0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
|
9516
|
-
'0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
|
9517
|
-
'0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
|
9518
|
-
'0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
|
9519
|
-
'0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
|
9520
|
-
'0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
|
9521
|
-
].map(n => BigInt(n))))();
|
9522
|
-
// Temporary buffer, not used to store anything between runs
|
9523
|
-
const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
|
9524
|
-
const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
|
9525
|
-
class SHA512 extends _md_ts_1.HashMD {
|
9526
|
-
constructor(outputLen = 64) {
|
9527
|
-
super(128, outputLen, 16, false);
|
9528
|
-
// We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.
|
9529
|
-
// Also looks cleaner and easier to verify with spec.
|
9530
|
-
// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
|
9531
|
-
// h -- high 32 bits, l -- low 32 bits
|
9532
|
-
this.Ah = 0x6a09e667 | 0;
|
9533
|
-
this.Al = 0xf3bcc908 | 0;
|
9534
|
-
this.Bh = 0xbb67ae85 | 0;
|
9535
|
-
this.Bl = 0x84caa73b | 0;
|
9536
|
-
this.Ch = 0x3c6ef372 | 0;
|
9537
|
-
this.Cl = 0xfe94f82b | 0;
|
9538
|
-
this.Dh = 0xa54ff53a | 0;
|
9539
|
-
this.Dl = 0x5f1d36f1 | 0;
|
9540
|
-
this.Eh = 0x510e527f | 0;
|
9541
|
-
this.El = 0xade682d1 | 0;
|
9542
|
-
this.Fh = 0x9b05688c | 0;
|
9543
|
-
this.Fl = 0x2b3e6c1f | 0;
|
9544
|
-
this.Gh = 0x1f83d9ab | 0;
|
9545
|
-
this.Gl = 0xfb41bd6b | 0;
|
9546
|
-
this.Hh = 0x5be0cd19 | 0;
|
9547
|
-
this.Hl = 0x137e2179 | 0;
|
9548
|
-
}
|
9549
|
-
// prettier-ignore
|
9550
|
-
get() {
|
9551
|
-
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
9552
|
-
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
9553
|
-
}
|
9554
|
-
// prettier-ignore
|
9555
|
-
set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
9556
|
-
this.Ah = Ah | 0;
|
9557
|
-
this.Al = Al | 0;
|
9558
|
-
this.Bh = Bh | 0;
|
9559
|
-
this.Bl = Bl | 0;
|
9560
|
-
this.Ch = Ch | 0;
|
9561
|
-
this.Cl = Cl | 0;
|
9562
|
-
this.Dh = Dh | 0;
|
9563
|
-
this.Dl = Dl | 0;
|
9564
|
-
this.Eh = Eh | 0;
|
9565
|
-
this.El = El | 0;
|
9566
|
-
this.Fh = Fh | 0;
|
9567
|
-
this.Fl = Fl | 0;
|
9568
|
-
this.Gh = Gh | 0;
|
9569
|
-
this.Gl = Gl | 0;
|
9570
|
-
this.Hh = Hh | 0;
|
9571
|
-
this.Hl = Hl | 0;
|
9572
|
-
}
|
9573
|
-
process(view, offset) {
|
9574
|
-
// Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
|
9575
|
-
for (let i = 0; i < 16; i++, offset += 4) {
|
9576
|
-
SHA512_W_H[i] = view.getUint32(offset);
|
9577
|
-
SHA512_W_L[i] = view.getUint32((offset += 4));
|
9578
|
-
}
|
9579
|
-
for (let i = 16; i < 80; i++) {
|
9580
|
-
// s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
|
9581
|
-
const W15h = SHA512_W_H[i - 15] | 0;
|
9582
|
-
const W15l = SHA512_W_L[i - 15] | 0;
|
9583
|
-
const s0h = _u64_ts_1.default.rotrSH(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSH(W15h, W15l, 8) ^ _u64_ts_1.default.shrSH(W15h, W15l, 7);
|
9584
|
-
const s0l = _u64_ts_1.default.rotrSL(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSL(W15h, W15l, 8) ^ _u64_ts_1.default.shrSL(W15h, W15l, 7);
|
9585
|
-
// s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
|
9586
|
-
const W2h = SHA512_W_H[i - 2] | 0;
|
9587
|
-
const W2l = SHA512_W_L[i - 2] | 0;
|
9588
|
-
const s1h = _u64_ts_1.default.rotrSH(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBH(W2h, W2l, 61) ^ _u64_ts_1.default.shrSH(W2h, W2l, 6);
|
9589
|
-
const s1l = _u64_ts_1.default.rotrSL(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBL(W2h, W2l, 61) ^ _u64_ts_1.default.shrSL(W2h, W2l, 6);
|
9590
|
-
// SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
|
9591
|
-
const SUMl = _u64_ts_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
|
9592
|
-
const SUMh = _u64_ts_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
|
9593
|
-
SHA512_W_H[i] = SUMh | 0;
|
9594
|
-
SHA512_W_L[i] = SUMl | 0;
|
9595
|
-
}
|
9596
|
-
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
9597
|
-
// Compression function main loop, 80 rounds
|
9598
|
-
for (let i = 0; i < 80; i++) {
|
9599
|
-
// S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
|
9600
|
-
const sigma1h = _u64_ts_1.default.rotrSH(Eh, El, 14) ^ _u64_ts_1.default.rotrSH(Eh, El, 18) ^ _u64_ts_1.default.rotrBH(Eh, El, 41);
|
9601
|
-
const sigma1l = _u64_ts_1.default.rotrSL(Eh, El, 14) ^ _u64_ts_1.default.rotrSL(Eh, El, 18) ^ _u64_ts_1.default.rotrBL(Eh, El, 41);
|
9602
|
-
//const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
9603
|
-
const CHIh = (Eh & Fh) ^ (~Eh & Gh);
|
9604
|
-
const CHIl = (El & Fl) ^ (~El & Gl);
|
9605
|
-
// T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
|
9606
|
-
// prettier-ignore
|
9607
|
-
const T1ll = _u64_ts_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
|
9608
|
-
const T1h = _u64_ts_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
|
9609
|
-
const T1l = T1ll | 0;
|
9610
|
-
// S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
|
9611
|
-
const sigma0h = _u64_ts_1.default.rotrSH(Ah, Al, 28) ^ _u64_ts_1.default.rotrBH(Ah, Al, 34) ^ _u64_ts_1.default.rotrBH(Ah, Al, 39);
|
9612
|
-
const sigma0l = _u64_ts_1.default.rotrSL(Ah, Al, 28) ^ _u64_ts_1.default.rotrBL(Ah, Al, 34) ^ _u64_ts_1.default.rotrBL(Ah, Al, 39);
|
9613
|
-
const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
|
9614
|
-
const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
|
9615
|
-
Hh = Gh | 0;
|
9616
|
-
Hl = Gl | 0;
|
9617
|
-
Gh = Fh | 0;
|
9618
|
-
Gl = Fl | 0;
|
9619
|
-
Fh = Eh | 0;
|
9620
|
-
Fl = El | 0;
|
9621
|
-
({ h: Eh, l: El } = _u64_ts_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
9622
|
-
Dh = Ch | 0;
|
9623
|
-
Dl = Cl | 0;
|
9624
|
-
Ch = Bh | 0;
|
9625
|
-
Cl = Bl | 0;
|
9626
|
-
Bh = Ah | 0;
|
9627
|
-
Bl = Al | 0;
|
9628
|
-
const All = _u64_ts_1.default.add3L(T1l, sigma0l, MAJl);
|
9629
|
-
Ah = _u64_ts_1.default.add3H(All, T1h, sigma0h, MAJh);
|
9630
|
-
Al = All | 0;
|
9631
|
-
}
|
9632
|
-
// Add the compressed chunk to the current hash value
|
9633
|
-
({ h: Ah, l: Al } = _u64_ts_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
9634
|
-
({ h: Bh, l: Bl } = _u64_ts_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
9635
|
-
({ h: Ch, l: Cl } = _u64_ts_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
|
9636
|
-
({ h: Dh, l: Dl } = _u64_ts_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
9637
|
-
({ h: Eh, l: El } = _u64_ts_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
9638
|
-
({ h: Fh, l: Fl } = _u64_ts_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
9639
|
-
({ h: Gh, l: Gl } = _u64_ts_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
9640
|
-
({ h: Hh, l: Hl } = _u64_ts_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
9641
|
-
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
9642
|
-
}
|
9643
|
-
roundClean() {
|
9644
|
-
SHA512_W_H.fill(0);
|
9645
|
-
SHA512_W_L.fill(0);
|
9646
|
-
}
|
9647
|
-
destroy() {
|
9648
|
-
this.buffer.fill(0);
|
9649
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
9650
|
-
}
|
9651
|
-
}
|
9652
|
-
exports.SHA512 = SHA512;
|
9653
|
-
class SHA512_224 extends SHA512 {
|
9654
|
-
constructor() {
|
9655
|
-
super(28);
|
9656
|
-
// h -- high 32 bits, l -- low 32 bits
|
9657
|
-
this.Ah = 0x8c3d37c8 | 0;
|
9658
|
-
this.Al = 0x19544da2 | 0;
|
9659
|
-
this.Bh = 0x73e19966 | 0;
|
9660
|
-
this.Bl = 0x89dcd4d6 | 0;
|
9661
|
-
this.Ch = 0x1dfab7ae | 0;
|
9662
|
-
this.Cl = 0x32ff9c82 | 0;
|
9663
|
-
this.Dh = 0x679dd514 | 0;
|
9664
|
-
this.Dl = 0x582f9fcf | 0;
|
9665
|
-
this.Eh = 0x0f6d2b69 | 0;
|
9666
|
-
this.El = 0x7bd44da8 | 0;
|
9667
|
-
this.Fh = 0x77e36f73 | 0;
|
9668
|
-
this.Fl = 0x04c48942 | 0;
|
9669
|
-
this.Gh = 0x3f9d85a8 | 0;
|
9670
|
-
this.Gl = 0x6a1d36c8 | 0;
|
9671
|
-
this.Hh = 0x1112e6ad | 0;
|
9672
|
-
this.Hl = 0x91d692a1 | 0;
|
9673
|
-
}
|
9674
|
-
}
|
9675
|
-
exports.SHA512_224 = SHA512_224;
|
9676
|
-
class SHA512_256 extends SHA512 {
|
9677
|
-
constructor() {
|
9678
|
-
super(32);
|
9679
|
-
// h -- high 32 bits, l -- low 32 bits
|
9680
|
-
this.Ah = 0x22312194 | 0;
|
9681
|
-
this.Al = 0xfc2bf72c | 0;
|
9682
|
-
this.Bh = 0x9f555fa3 | 0;
|
9683
|
-
this.Bl = 0xc84c64c2 | 0;
|
9684
|
-
this.Ch = 0x2393b86b | 0;
|
9685
|
-
this.Cl = 0x6f53b151 | 0;
|
9686
|
-
this.Dh = 0x96387719 | 0;
|
9687
|
-
this.Dl = 0x5940eabd | 0;
|
9688
|
-
this.Eh = 0x96283ee2 | 0;
|
9689
|
-
this.El = 0xa88effe3 | 0;
|
9690
|
-
this.Fh = 0xbe5e1e25 | 0;
|
9691
|
-
this.Fl = 0x53863992 | 0;
|
9692
|
-
this.Gh = 0x2b0199fc | 0;
|
9693
|
-
this.Gl = 0x2c85b8aa | 0;
|
9694
|
-
this.Hh = 0x0eb72ddc | 0;
|
9695
|
-
this.Hl = 0x81c52ca2 | 0;
|
9696
|
-
}
|
9697
|
-
}
|
9698
|
-
exports.SHA512_256 = SHA512_256;
|
9699
|
-
class SHA384 extends SHA512 {
|
9700
|
-
constructor() {
|
9701
|
-
super(48);
|
9702
|
-
// h -- high 32 bits, l -- low 32 bits
|
9703
|
-
this.Ah = 0xcbbb9d5d | 0;
|
9704
|
-
this.Al = 0xc1059ed8 | 0;
|
9705
|
-
this.Bh = 0x629a292a | 0;
|
9706
|
-
this.Bl = 0x367cd507 | 0;
|
9707
|
-
this.Ch = 0x9159015a | 0;
|
9708
|
-
this.Cl = 0x3070dd17 | 0;
|
9709
|
-
this.Dh = 0x152fecd8 | 0;
|
9710
|
-
this.Dl = 0xf70e5939 | 0;
|
9711
|
-
this.Eh = 0x67332667 | 0;
|
9712
|
-
this.El = 0xffc00b31 | 0;
|
9713
|
-
this.Fh = 0x8eb44a87 | 0;
|
9714
|
-
this.Fl = 0x68581511 | 0;
|
9715
|
-
this.Gh = 0xdb0c2e0d | 0;
|
9716
|
-
this.Gl = 0x64f98fa7 | 0;
|
9717
|
-
this.Hh = 0x47b5481d | 0;
|
9718
|
-
this.Hl = 0xbefa4fa4 | 0;
|
9719
|
-
}
|
9720
|
-
}
|
9721
|
-
exports.SHA384 = SHA384;
|
9722
|
-
/** SHA2-512 hash function. */
|
9723
|
-
exports.sha512 = (0, utils_ts_1.wrapConstructor)(() => new SHA512());
|
9724
|
-
/** SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks. */
|
9725
|
-
exports.sha512_224 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_224());
|
9726
|
-
/** SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks. */
|
9727
|
-
exports.sha512_256 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_256());
|
9728
|
-
/** SHA2-384 hash function. */
|
9729
|
-
exports.sha384 = (0, utils_ts_1.wrapConstructor)(() => new SHA384());
|
9730
|
-
|
9731
|
-
|
9732
|
-
/***/ }),
|
9733
|
-
|
9734
|
-
/***/ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js":
|
9735
|
-
/*!***************************************************************************!*\
|
9736
|
-
!*** ../../node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js ***!
|
9737
|
-
\***************************************************************************/
|
9738
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
9739
|
-
|
9740
|
-
"use strict";
|
9741
|
-
|
9742
|
-
/**
|
9743
|
-
* Utilities for hex, bytes, CSPRNG.
|
9744
|
-
* @module
|
9745
|
-
*/
|
9746
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
9747
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
9748
|
-
exports.Hash = exports.nextTick = exports.byteSwapIfBE = exports.isLE = void 0;
|
9749
|
-
exports.isBytes = isBytes;
|
9750
|
-
exports.u8 = u8;
|
9751
|
-
exports.u32 = u32;
|
9752
|
-
exports.createView = createView;
|
9753
|
-
exports.rotr = rotr;
|
9754
|
-
exports.rotl = rotl;
|
9755
|
-
exports.byteSwap = byteSwap;
|
9756
|
-
exports.byteSwap32 = byteSwap32;
|
9757
|
-
exports.bytesToHex = bytesToHex;
|
9758
|
-
exports.hexToBytes = hexToBytes;
|
9759
|
-
exports.asyncLoop = asyncLoop;
|
9760
|
-
exports.utf8ToBytes = utf8ToBytes;
|
9761
|
-
exports.toBytes = toBytes;
|
9762
|
-
exports.concatBytes = concatBytes;
|
9763
|
-
exports.checkOpts = checkOpts;
|
9764
|
-
exports.wrapConstructor = wrapConstructor;
|
9765
|
-
exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
|
9766
|
-
exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
|
9767
|
-
exports.randomBytes = randomBytes;
|
9768
|
-
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
9769
|
-
// node.js versions earlier than v19 don't declare it in global scope.
|
9770
|
-
// For node.js, package.json#exports field mapping rewrites import
|
9771
|
-
// from `crypto` to `cryptoNode`, which imports native module.
|
9772
|
-
// Makes the utils un-importable in browsers without a bundler.
|
9773
|
-
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
9774
|
-
const crypto_1 = __webpack_require__(/*! @noble/hashes/crypto */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/crypto.js");
|
9775
|
-
const _assert_ts_1 = __webpack_require__(/*! ./_assert.js */ "../../node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js");
|
9776
|
-
// export { isBytes } from './_assert.ts';
|
9777
|
-
// We can't reuse isBytes from _assert, because somehow this causes huge perf issues
|
9778
|
-
function isBytes(a) {
|
9779
|
-
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
9780
|
-
}
|
9781
|
-
// Cast array to different type
|
9782
|
-
function u8(arr) {
|
9783
|
-
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
9784
|
-
}
|
9785
|
-
function u32(arr) {
|
9786
|
-
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
9787
|
-
}
|
9788
|
-
// Cast array to view
|
9789
|
-
function createView(arr) {
|
9790
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
9791
|
-
}
|
9792
|
-
/** The rotate right (circular right shift) operation for uint32 */
|
9793
|
-
function rotr(word, shift) {
|
9794
|
-
return (word << (32 - shift)) | (word >>> shift);
|
9795
|
-
}
|
9796
|
-
/** The rotate left (circular left shift) operation for uint32 */
|
9797
|
-
function rotl(word, shift) {
|
9798
|
-
return (word << shift) | ((word >>> (32 - shift)) >>> 0);
|
9799
|
-
}
|
9800
|
-
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
9801
|
-
exports.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
9802
|
-
// The byte swap operation for uint32
|
9803
|
-
function byteSwap(word) {
|
9804
|
-
return (((word << 24) & 0xff000000) |
|
9805
|
-
((word << 8) & 0xff0000) |
|
9806
|
-
((word >>> 8) & 0xff00) |
|
9807
|
-
((word >>> 24) & 0xff));
|
9808
|
-
}
|
9809
|
-
/** Conditionally byte swap if on a big-endian platform */
|
9810
|
-
exports.byteSwapIfBE = exports.isLE
|
9811
|
-
? (n) => n
|
9812
|
-
: (n) => byteSwap(n);
|
9813
|
-
/** In place byte swap for Uint32Array */
|
9814
|
-
function byteSwap32(arr) {
|
9815
|
-
for (let i = 0; i < arr.length; i++) {
|
9816
|
-
arr[i] = byteSwap(arr[i]);
|
9817
|
-
}
|
9818
|
-
}
|
9819
|
-
// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
|
9820
|
-
const hasHexBuiltin =
|
9821
|
-
// @ts-ignore
|
9822
|
-
typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function';
|
9823
|
-
// Array where index 0xf0 (240) is mapped to string 'f0'
|
9824
|
-
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
|
9825
|
-
/**
|
9826
|
-
* Convert byte array to hex string. Uses built-in function, when available.
|
9827
|
-
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
9828
|
-
*/
|
9829
|
-
function bytesToHex(bytes) {
|
9830
|
-
(0, _assert_ts_1.abytes)(bytes);
|
9831
|
-
// @ts-ignore
|
9832
|
-
if (hasHexBuiltin)
|
9833
|
-
return bytes.toHex();
|
9834
|
-
// pre-caching improves the speed 6x
|
9835
|
-
let hex = '';
|
9836
|
-
for (let i = 0; i < bytes.length; i++) {
|
9837
|
-
hex += hexes[bytes[i]];
|
9838
|
-
}
|
9839
|
-
return hex;
|
9840
|
-
}
|
9841
|
-
// We use optimized technique to convert hex string to byte array
|
9842
|
-
const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
9843
|
-
function asciiToBase16(ch) {
|
9844
|
-
if (ch >= asciis._0 && ch <= asciis._9)
|
9845
|
-
return ch - asciis._0; // '2' => 50-48
|
9846
|
-
if (ch >= asciis.A && ch <= asciis.F)
|
9847
|
-
return ch - (asciis.A - 10); // 'B' => 66-(65-10)
|
9848
|
-
if (ch >= asciis.a && ch <= asciis.f)
|
9849
|
-
return ch - (asciis.a - 10); // 'b' => 98-(97-10)
|
9850
|
-
return;
|
9851
|
-
}
|
9852
|
-
/**
|
9853
|
-
* Convert hex string to byte array. Uses built-in function, when available.
|
9854
|
-
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
9855
|
-
*/
|
9856
|
-
function hexToBytes(hex) {
|
9857
|
-
if (typeof hex !== 'string')
|
9858
|
-
throw new Error('hex string expected, got ' + typeof hex);
|
9859
|
-
// @ts-ignore
|
9860
|
-
if (hasHexBuiltin)
|
9861
|
-
return Uint8Array.fromHex(hex);
|
9862
|
-
const hl = hex.length;
|
9863
|
-
const al = hl / 2;
|
9864
|
-
if (hl % 2)
|
9865
|
-
throw new Error('hex string expected, got unpadded hex of length ' + hl);
|
9866
|
-
const array = new Uint8Array(al);
|
9867
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
9868
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
9869
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
9870
|
-
if (n1 === undefined || n2 === undefined) {
|
9871
|
-
const char = hex[hi] + hex[hi + 1];
|
9872
|
-
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
9873
|
-
}
|
9874
|
-
array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
|
9875
|
-
}
|
9876
|
-
return array;
|
9877
|
-
}
|
9878
|
-
/**
|
9879
|
-
* There is no setImmediate in browser and setTimeout is slow.
|
9880
|
-
* Call of async fn will return Promise, which will be fullfiled only on
|
9881
|
-
* next scheduler queue processing step and this is exactly what we need.
|
9882
|
-
*/
|
9883
|
-
const nextTick = async () => { };
|
9884
|
-
exports.nextTick = nextTick;
|
9885
|
-
/** Returns control to thread each 'tick' ms to avoid blocking. */
|
9886
|
-
async function asyncLoop(iters, tick, cb) {
|
9887
|
-
let ts = Date.now();
|
9888
|
-
for (let i = 0; i < iters; i++) {
|
9889
|
-
cb(i);
|
9890
|
-
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
|
9891
|
-
const diff = Date.now() - ts;
|
9892
|
-
if (diff >= 0 && diff < tick)
|
9893
|
-
continue;
|
9894
|
-
await (0, exports.nextTick)();
|
9895
|
-
ts += diff;
|
9896
|
-
}
|
9897
|
-
}
|
9898
|
-
/**
|
9899
|
-
* Convert JS string to byte array.
|
9900
|
-
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
9901
|
-
*/
|
9902
|
-
function utf8ToBytes(str) {
|
9903
|
-
if (typeof str !== 'string')
|
9904
|
-
throw new Error('utf8ToBytes expected string, got ' + typeof str);
|
9905
|
-
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
9906
|
-
}
|
9907
|
-
/**
|
9908
|
-
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
9909
|
-
* Warning: when Uint8Array is passed, it would NOT get copied.
|
9910
|
-
* Keep in mind for future mutable operations.
|
9911
|
-
*/
|
9912
|
-
function toBytes(data) {
|
9913
|
-
if (typeof data === 'string')
|
9914
|
-
data = utf8ToBytes(data);
|
9915
|
-
(0, _assert_ts_1.abytes)(data);
|
9916
|
-
return data;
|
9917
|
-
}
|
9918
|
-
/**
|
9919
|
-
* Copies several Uint8Arrays into one.
|
9920
|
-
*/
|
9921
|
-
function concatBytes(...arrays) {
|
9922
|
-
let sum = 0;
|
9923
|
-
for (let i = 0; i < arrays.length; i++) {
|
9924
|
-
const a = arrays[i];
|
9925
|
-
(0, _assert_ts_1.abytes)(a);
|
9926
|
-
sum += a.length;
|
9927
|
-
}
|
9928
|
-
const res = new Uint8Array(sum);
|
9929
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
9930
|
-
const a = arrays[i];
|
9931
|
-
res.set(a, pad);
|
9932
|
-
pad += a.length;
|
9933
|
-
}
|
9934
|
-
return res;
|
9935
|
-
}
|
9936
|
-
/** For runtime check if class implements interface */
|
9937
|
-
class Hash {
|
9938
|
-
// Safe version that clones internal state
|
9939
|
-
clone() {
|
9940
|
-
return this._cloneInto();
|
9941
|
-
}
|
9942
|
-
}
|
9943
|
-
exports.Hash = Hash;
|
9944
|
-
function checkOpts(defaults, opts) {
|
9945
|
-
if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
|
9946
|
-
throw new Error('Options should be object or undefined');
|
9947
|
-
const merged = Object.assign(defaults, opts);
|
9948
|
-
return merged;
|
9949
|
-
}
|
9950
|
-
/** Wraps hash function, creating an interface on top of it */
|
9951
|
-
function wrapConstructor(hashCons) {
|
9952
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
9953
|
-
const tmp = hashCons();
|
9954
|
-
hashC.outputLen = tmp.outputLen;
|
9955
|
-
hashC.blockLen = tmp.blockLen;
|
9956
|
-
hashC.create = () => hashCons();
|
9957
|
-
return hashC;
|
9958
|
-
}
|
9959
|
-
function wrapConstructorWithOpts(hashCons) {
|
9960
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
9961
|
-
const tmp = hashCons({});
|
9962
|
-
hashC.outputLen = tmp.outputLen;
|
9963
|
-
hashC.blockLen = tmp.blockLen;
|
9964
|
-
hashC.create = (opts) => hashCons(opts);
|
9965
|
-
return hashC;
|
9966
|
-
}
|
9967
|
-
function wrapXOFConstructorWithOpts(hashCons) {
|
9968
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
9969
|
-
const tmp = hashCons({});
|
9970
|
-
hashC.outputLen = tmp.outputLen;
|
9971
|
-
hashC.blockLen = tmp.blockLen;
|
9972
|
-
hashC.create = (opts) => hashCons(opts);
|
9973
|
-
return hashC;
|
9974
|
-
}
|
9975
|
-
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
9976
|
-
function randomBytes(bytesLength = 32) {
|
9977
|
-
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
|
9978
|
-
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
9979
|
-
}
|
9980
|
-
// Legacy Node.js compatibility
|
9981
|
-
if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === 'function') {
|
9982
|
-
return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
|
9983
|
-
}
|
9984
|
-
throw new Error('crypto.getRandomValues must be defined');
|
9159
|
+
* await mnemonicToSeed(mnem, 'password');
|
9160
|
+
* // new Uint8Array([...64 bytes])
|
9161
|
+
*/
|
9162
|
+
function mnemonicToSeed(mnemonic, passphrase = '') {
|
9163
|
+
return (0, pbkdf2_1.pbkdf2Async)(sha2_1.sha512, normalize(mnemonic).nfkd, psalt(passphrase), { c: 2048, dkLen: 64 });
|
9164
|
+
}
|
9165
|
+
/**
|
9166
|
+
* Irreversible: Uses KDF to derive 64 bytes of key data from mnemonic + optional password.
|
9167
|
+
* @param mnemonic 12-24 words
|
9168
|
+
* @param passphrase string that will additionally protect the key
|
9169
|
+
* @returns 64 bytes of key data
|
9170
|
+
* @example
|
9171
|
+
* const mnem = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
|
9172
|
+
* mnemonicToSeedSync(mnem, 'password');
|
9173
|
+
* // new Uint8Array([...64 bytes])
|
9174
|
+
*/
|
9175
|
+
function mnemonicToSeedSync(mnemonic, passphrase = '') {
|
9176
|
+
return (0, pbkdf2_1.pbkdf2)(sha2_1.sha512, normalize(mnemonic).nfkd, psalt(passphrase), { c: 2048, dkLen: 64 });
|
9985
9177
|
}
|
9986
9178
|
|
9987
9179
|
|
@@ -12221,345 +11413,144 @@ const hexToBytes = (hex) => {
|
|
12221
11413
|
if (!shared_1.HEX_REGEX.test(hex)) {
|
12222
11414
|
throw new Error('Invalid hex string');
|
12223
11415
|
}
|
12224
|
-
for (let i = 0; i < array.length; i++) {
|
12225
|
-
const j = i * 2;
|
12226
|
-
const hexByte = hex.slice(j, j + 2);
|
12227
|
-
const byte = Number.parseInt(hexByte, 16);
|
12228
|
-
if (Number.isNaN(byte) || byte < 0) {
|
12229
|
-
throw new Error('Invalid byte sequence');
|
12230
|
-
}
|
12231
|
-
array[i] = byte;
|
12232
|
-
}
|
12233
|
-
return array;
|
12234
|
-
};
|
12235
|
-
exports.hexToBytes = hexToBytes;
|
12236
|
-
const hexToString = (hex, encoding = 'utf8') => {
|
12237
|
-
return new TextDecoder(encoding).decode((0, exports.hexToBytes)(hex));
|
12238
|
-
};
|
12239
|
-
exports.hexToString = hexToString;
|
12240
|
-
const stringToHex = (string) => {
|
12241
|
-
return (0, exports.bytesToHex)(new TextEncoder().encode(string));
|
12242
|
-
};
|
12243
|
-
exports.stringToHex = stringToHex;
|
12244
|
-
/* eslint-enable func-style */
|
12245
|
-
exports.randomBytes = utils_1.randomBytes;
|
12246
|
-
__exportStar(__webpack_require__(/*! ./shared */ "../../node_modules/@xrplf/isomorphic/dist/utils/shared.js"), exports);
|
12247
|
-
|
12248
|
-
|
12249
|
-
/***/ }),
|
12250
|
-
|
12251
|
-
/***/ "../../node_modules/@xrplf/isomorphic/dist/utils/shared.js":
|
12252
|
-
/*!*****************************************************************!*\
|
12253
|
-
!*** ../../node_modules/@xrplf/isomorphic/dist/utils/shared.js ***!
|
12254
|
-
\*****************************************************************/
|
12255
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
12256
|
-
|
12257
|
-
"use strict";
|
12258
|
-
|
12259
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
12260
|
-
exports.equal = exports.concat = exports.HEX_REGEX = void 0;
|
12261
|
-
const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "../../node_modules/@noble/hashes/utils.js");
|
12262
|
-
exports.HEX_REGEX = /^[A-F0-9]*$/iu;
|
12263
|
-
function concat(views) {
|
12264
|
-
return (0, utils_1.concatBytes)(...views);
|
12265
|
-
}
|
12266
|
-
exports.concat = concat;
|
12267
|
-
function equal(buf1, buf2) {
|
12268
|
-
if (buf1.byteLength !== buf2.byteLength) {
|
12269
|
-
return false;
|
12270
|
-
}
|
12271
|
-
const dv1 = new Int8Array(buf1);
|
12272
|
-
const dv2 = new Int8Array(buf2);
|
12273
|
-
for (let i = 0; i !== buf1.byteLength; i++) {
|
12274
|
-
if (dv1[i] !== dv2[i]) {
|
12275
|
-
return false;
|
12276
|
-
}
|
12277
|
-
}
|
12278
|
-
return true;
|
12279
|
-
}
|
12280
|
-
exports.equal = equal;
|
12281
|
-
|
12282
|
-
|
12283
|
-
/***/ }),
|
12284
|
-
|
12285
|
-
/***/ "../../node_modules/@xrplf/isomorphic/dist/ws/browser.js":
|
12286
|
-
/*!***************************************************************!*\
|
12287
|
-
!*** ../../node_modules/@xrplf/isomorphic/dist/ws/browser.js ***!
|
12288
|
-
\***************************************************************/
|
12289
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
12290
|
-
|
12291
|
-
"use strict";
|
12292
|
-
|
12293
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
12294
|
-
/* eslint-disable max-classes-per-file -- Needs to be a wrapper for ws */
|
12295
|
-
const eventemitter3_1 = __webpack_require__(/*! eventemitter3 */ "../../node_modules/eventemitter3/index.js");
|
12296
|
-
/**
|
12297
|
-
* Provides `EventEmitter` interface for native browser `WebSocket`,
|
12298
|
-
* same, as `ws` package provides.
|
12299
|
-
*/
|
12300
|
-
class WSWrapper extends eventemitter3_1.EventEmitter {
|
12301
|
-
/**
|
12302
|
-
* Constructs a browser-safe websocket.
|
12303
|
-
*
|
12304
|
-
* @param url - URL to connect to.
|
12305
|
-
* @param _protocols - Not used.
|
12306
|
-
* @param _websocketOptions - Not used.
|
12307
|
-
*/
|
12308
|
-
constructor(url, _protocols, _websocketOptions) {
|
12309
|
-
super();
|
12310
|
-
this.ws = new WebSocket(url);
|
12311
|
-
this.ws.onclose = (closeEvent) => {
|
12312
|
-
let reason;
|
12313
|
-
if (closeEvent.reason) {
|
12314
|
-
const enc = new TextEncoder();
|
12315
|
-
reason = enc.encode(closeEvent.reason);
|
12316
|
-
}
|
12317
|
-
this.emit('close', closeEvent.code, reason);
|
12318
|
-
};
|
12319
|
-
this.ws.onopen = () => {
|
12320
|
-
this.emit('open');
|
12321
|
-
};
|
12322
|
-
this.ws.onerror = (error) => {
|
12323
|
-
this.emit('error', error);
|
12324
|
-
};
|
12325
|
-
this.ws.onmessage = (message) => {
|
12326
|
-
this.emit('message', message.data);
|
12327
|
-
};
|
12328
|
-
}
|
12329
|
-
/**
|
12330
|
-
* Get the ready state of the websocket.
|
12331
|
-
*
|
12332
|
-
* @returns The Websocket's ready state.
|
12333
|
-
*/
|
12334
|
-
get readyState() {
|
12335
|
-
return this.ws.readyState;
|
12336
|
-
}
|
12337
|
-
/**
|
12338
|
-
* Closes the websocket.
|
12339
|
-
*
|
12340
|
-
* @param code - Close code.
|
12341
|
-
* @param reason - Close reason.
|
12342
|
-
*/
|
12343
|
-
close(code, reason) {
|
12344
|
-
if (this.readyState === 1) {
|
12345
|
-
this.ws.close(code, reason);
|
12346
|
-
}
|
12347
|
-
}
|
12348
|
-
/**
|
12349
|
-
* Sends a message over the Websocket connection.
|
12350
|
-
*
|
12351
|
-
* @param message - Message to send.
|
12352
|
-
*/
|
12353
|
-
send(message) {
|
12354
|
-
this.ws.send(message);
|
12355
|
-
}
|
12356
|
-
}
|
12357
|
-
WSWrapper.CONNECTING = 0;
|
12358
|
-
WSWrapper.OPEN = 1;
|
12359
|
-
WSWrapper.CLOSING = 2;
|
12360
|
-
WSWrapper.CLOSED = 3;
|
12361
|
-
exports["default"] = WSWrapper;
|
12362
|
-
|
12363
|
-
|
12364
|
-
/***/ }),
|
12365
|
-
|
12366
|
-
/***/ "../../node_modules/@xrplf/secret-numbers/dist/index.js":
|
12367
|
-
/*!**************************************************************!*\
|
12368
|
-
!*** ../../node_modules/@xrplf/secret-numbers/dist/index.js ***!
|
12369
|
-
\**************************************************************/
|
12370
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
12371
|
-
|
12372
|
-
"use strict";
|
12373
|
-
|
12374
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
12375
|
-
if (k2 === undefined) k2 = k;
|
12376
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
12377
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
12378
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
12379
|
-
}
|
12380
|
-
Object.defineProperty(o, k2, desc);
|
12381
|
-
}) : (function(o, m, k, k2) {
|
12382
|
-
if (k2 === undefined) k2 = k;
|
12383
|
-
o[k2] = m[k];
|
12384
|
-
}));
|
12385
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
12386
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
12387
|
-
};
|
12388
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
12389
|
-
__exportStar(__webpack_require__(/*! ./schema/Account */ "../../node_modules/@xrplf/secret-numbers/dist/schema/Account.js"), exports);
|
12390
|
-
__exportStar(__webpack_require__(/*! ./utils */ "../../node_modules/@xrplf/secret-numbers/dist/utils/index.js"), exports);
|
12391
|
-
|
12392
|
-
|
12393
|
-
/***/ }),
|
12394
|
-
|
12395
|
-
/***/ "../../node_modules/@xrplf/secret-numbers/dist/schema/Account.js":
|
12396
|
-
/*!***********************************************************************!*\
|
12397
|
-
!*** ../../node_modules/@xrplf/secret-numbers/dist/schema/Account.js ***!
|
12398
|
-
\***********************************************************************/
|
12399
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
12400
|
-
|
12401
|
-
"use strict";
|
12402
|
-
|
12403
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
12404
|
-
exports.Account = void 0;
|
12405
|
-
const ripple_keypairs_1 = __webpack_require__(/*! ripple-keypairs */ "../../node_modules/ripple-keypairs/dist/index.js");
|
12406
|
-
const utils_1 = __webpack_require__(/*! ../utils */ "../../node_modules/@xrplf/secret-numbers/dist/utils/index.js");
|
12407
|
-
class Account {
|
12408
|
-
constructor(secretNumbers) {
|
12409
|
-
this._account = {
|
12410
|
-
familySeed: '',
|
12411
|
-
address: '',
|
12412
|
-
keypair: {
|
12413
|
-
publicKey: '',
|
12414
|
-
privateKey: '',
|
12415
|
-
},
|
12416
|
-
};
|
12417
|
-
if (typeof secretNumbers === 'string') {
|
12418
|
-
this._secret = (0, utils_1.parseSecretString)(secretNumbers);
|
12419
|
-
}
|
12420
|
-
else if (Array.isArray(secretNumbers)) {
|
12421
|
-
this._secret = secretNumbers;
|
12422
|
-
}
|
12423
|
-
else if (secretNumbers instanceof Uint8Array) {
|
12424
|
-
this._secret = (0, utils_1.entropyToSecret)(secretNumbers);
|
12425
|
-
}
|
12426
|
-
else {
|
12427
|
-
this._secret = (0, utils_1.randomSecret)();
|
12428
|
-
}
|
12429
|
-
validateLengths(this._secret);
|
12430
|
-
this.derive();
|
12431
|
-
}
|
12432
|
-
getSecret() {
|
12433
|
-
return this._secret;
|
12434
|
-
}
|
12435
|
-
getSecretString() {
|
12436
|
-
return this._secret.join(' ');
|
12437
|
-
}
|
12438
|
-
getAddress() {
|
12439
|
-
return this._account.address;
|
12440
|
-
}
|
12441
|
-
getFamilySeed() {
|
12442
|
-
return this._account.familySeed;
|
12443
|
-
}
|
12444
|
-
getKeypair() {
|
12445
|
-
return this._account.keypair;
|
12446
|
-
}
|
12447
|
-
toString() {
|
12448
|
-
return this.getSecretString();
|
12449
|
-
}
|
12450
|
-
derive() {
|
12451
|
-
try {
|
12452
|
-
const entropy = (0, utils_1.secretToEntropy)(this._secret);
|
12453
|
-
this._account.familySeed = (0, ripple_keypairs_1.generateSeed)({ entropy });
|
12454
|
-
this._account.keypair = (0, ripple_keypairs_1.deriveKeypair)(this._account.familySeed);
|
12455
|
-
this._account.address = (0, ripple_keypairs_1.deriveAddress)(this._account.keypair.publicKey);
|
12456
|
-
}
|
12457
|
-
catch (error) {
|
12458
|
-
let message = 'Unknown Error';
|
12459
|
-
if (error instanceof Error) {
|
12460
|
-
message = error.message;
|
12461
|
-
}
|
12462
|
-
throw new Error(message);
|
12463
|
-
}
|
12464
|
-
}
|
12465
|
-
}
|
12466
|
-
exports.Account = Account;
|
12467
|
-
function validateLengths(secretNumbers) {
|
12468
|
-
if (secretNumbers.length !== 8) {
|
12469
|
-
throw new Error('Secret must have 8 numbers');
|
12470
|
-
}
|
12471
|
-
secretNumbers.forEach((num) => {
|
12472
|
-
if (num.length !== 6) {
|
12473
|
-
throw new Error('Each secret number must be 6 digits');
|
11416
|
+
for (let i = 0; i < array.length; i++) {
|
11417
|
+
const j = i * 2;
|
11418
|
+
const hexByte = hex.slice(j, j + 2);
|
11419
|
+
const byte = Number.parseInt(hexByte, 16);
|
11420
|
+
if (Number.isNaN(byte) || byte < 0) {
|
11421
|
+
throw new Error('Invalid byte sequence');
|
12474
11422
|
}
|
12475
|
-
|
12476
|
-
}
|
11423
|
+
array[i] = byte;
|
11424
|
+
}
|
11425
|
+
return array;
|
11426
|
+
};
|
11427
|
+
exports.hexToBytes = hexToBytes;
|
11428
|
+
const hexToString = (hex, encoding = 'utf8') => {
|
11429
|
+
return new TextDecoder(encoding).decode((0, exports.hexToBytes)(hex));
|
11430
|
+
};
|
11431
|
+
exports.hexToString = hexToString;
|
11432
|
+
const stringToHex = (string) => {
|
11433
|
+
return (0, exports.bytesToHex)(new TextEncoder().encode(string));
|
11434
|
+
};
|
11435
|
+
exports.stringToHex = stringToHex;
|
11436
|
+
/* eslint-enable func-style */
|
11437
|
+
exports.randomBytes = utils_1.randomBytes;
|
11438
|
+
__exportStar(__webpack_require__(/*! ./shared */ "../../node_modules/@xrplf/isomorphic/dist/utils/shared.js"), exports);
|
12477
11439
|
|
12478
11440
|
|
12479
11441
|
/***/ }),
|
12480
11442
|
|
12481
|
-
/***/ "../../node_modules/@xrplf/
|
12482
|
-
|
12483
|
-
!*** ../../node_modules/@xrplf/
|
12484
|
-
|
11443
|
+
/***/ "../../node_modules/@xrplf/isomorphic/dist/utils/shared.js":
|
11444
|
+
/*!*****************************************************************!*\
|
11445
|
+
!*** ../../node_modules/@xrplf/isomorphic/dist/utils/shared.js ***!
|
11446
|
+
\*****************************************************************/
|
12485
11447
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
12486
11448
|
|
12487
11449
|
"use strict";
|
12488
11450
|
|
12489
11451
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
12490
|
-
exports.
|
12491
|
-
const utils_1 = __webpack_require__(/*! @
|
12492
|
-
|
12493
|
-
|
12494
|
-
|
12495
|
-
exports.randomEntropy = randomEntropy;
|
12496
|
-
function calculateChecksum(position, value) {
|
12497
|
-
return (value * (position * 2 + 1)) % 9;
|
11452
|
+
exports.equal = exports.concat = exports.HEX_REGEX = void 0;
|
11453
|
+
const utils_1 = __webpack_require__(/*! @noble/hashes/utils */ "../../node_modules/@noble/hashes/utils.js");
|
11454
|
+
exports.HEX_REGEX = /^[A-F0-9]*$/iu;
|
11455
|
+
function concat(views) {
|
11456
|
+
return (0, utils_1.concatBytes)(...views);
|
12498
11457
|
}
|
12499
|
-
exports.
|
12500
|
-
function
|
12501
|
-
|
12502
|
-
|
12503
|
-
if (typeof value === 'string') {
|
12504
|
-
if (value.length !== 6) {
|
12505
|
-
throw new Error('value must have a length of 6');
|
12506
|
-
}
|
12507
|
-
normalizedChecksum = parseInt(value.slice(5), 10);
|
12508
|
-
normalizedValue = parseInt(value.slice(0, 5), 10);
|
11458
|
+
exports.concat = concat;
|
11459
|
+
function equal(buf1, buf2) {
|
11460
|
+
if (buf1.byteLength !== buf2.byteLength) {
|
11461
|
+
return false;
|
12509
11462
|
}
|
12510
|
-
|
12511
|
-
|
12512
|
-
|
11463
|
+
const dv1 = new Int8Array(buf1);
|
11464
|
+
const dv2 = new Int8Array(buf2);
|
11465
|
+
for (let i = 0; i !== buf1.byteLength; i++) {
|
11466
|
+
if (dv1[i] !== dv2[i]) {
|
11467
|
+
return false;
|
12513
11468
|
}
|
12514
|
-
normalizedChecksum = checksum;
|
12515
|
-
normalizedValue = value;
|
12516
11469
|
}
|
12517
|
-
return
|
11470
|
+
return true;
|
12518
11471
|
}
|
12519
|
-
exports.
|
12520
|
-
|
12521
|
-
|
12522
|
-
|
12523
|
-
|
12524
|
-
|
12525
|
-
|
12526
|
-
|
12527
|
-
|
12528
|
-
|
12529
|
-
|
11472
|
+
exports.equal = equal;
|
11473
|
+
|
11474
|
+
|
11475
|
+
/***/ }),
|
11476
|
+
|
11477
|
+
/***/ "../../node_modules/@xrplf/isomorphic/dist/ws/browser.js":
|
11478
|
+
/*!***************************************************************!*\
|
11479
|
+
!*** ../../node_modules/@xrplf/isomorphic/dist/ws/browser.js ***!
|
11480
|
+
\***************************************************************/
|
11481
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
11482
|
+
|
11483
|
+
"use strict";
|
11484
|
+
|
11485
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
11486
|
+
/* eslint-disable max-classes-per-file -- Needs to be a wrapper for ws */
|
11487
|
+
const eventemitter3_1 = __webpack_require__(/*! eventemitter3 */ "../../node_modules/eventemitter3/index.js");
|
11488
|
+
/**
|
11489
|
+
* Provides `EventEmitter` interface for native browser `WebSocket`,
|
11490
|
+
* same, as `ws` package provides.
|
11491
|
+
*/
|
11492
|
+
class WSWrapper extends eventemitter3_1.EventEmitter {
|
11493
|
+
/**
|
11494
|
+
* Constructs a browser-safe websocket.
|
11495
|
+
*
|
11496
|
+
* @param url - URL to connect to.
|
11497
|
+
* @param _protocols - Not used.
|
11498
|
+
* @param _websocketOptions - Not used.
|
11499
|
+
*/
|
11500
|
+
constructor(url, _protocols, _websocketOptions) {
|
11501
|
+
super();
|
11502
|
+
this.ws = new WebSocket(url);
|
11503
|
+
this.ws.onclose = (closeEvent) => {
|
11504
|
+
let reason;
|
11505
|
+
if (closeEvent.reason) {
|
11506
|
+
const enc = new TextEncoder();
|
11507
|
+
reason = enc.encode(closeEvent.reason);
|
11508
|
+
}
|
11509
|
+
this.emit('close', closeEvent.code, reason);
|
11510
|
+
};
|
11511
|
+
this.ws.onopen = () => {
|
11512
|
+
this.emit('open');
|
11513
|
+
};
|
11514
|
+
this.ws.onerror = (error) => {
|
11515
|
+
this.emit('error', error);
|
11516
|
+
};
|
11517
|
+
this.ws.onmessage = (message) => {
|
11518
|
+
this.emit('message', message.data);
|
11519
|
+
};
|
12530
11520
|
}
|
12531
|
-
|
12532
|
-
|
12533
|
-
|
12534
|
-
|
12535
|
-
|
12536
|
-
|
12537
|
-
|
12538
|
-
|
12539
|
-
|
12540
|
-
|
12541
|
-
|
12542
|
-
|
12543
|
-
|
12544
|
-
|
12545
|
-
|
12546
|
-
|
11521
|
+
/**
|
11522
|
+
* Get the ready state of the websocket.
|
11523
|
+
*
|
11524
|
+
* @returns The Websocket's ready state.
|
11525
|
+
*/
|
11526
|
+
get readyState() {
|
11527
|
+
return this.ws.readyState;
|
11528
|
+
}
|
11529
|
+
/**
|
11530
|
+
* Closes the websocket.
|
11531
|
+
*
|
11532
|
+
* @param code - Close code.
|
11533
|
+
* @param reason - Close reason.
|
11534
|
+
*/
|
11535
|
+
close(code, reason) {
|
11536
|
+
if (this.readyState === 1) {
|
11537
|
+
this.ws.close(code, reason);
|
12547
11538
|
}
|
12548
|
-
const hex = `0000${no.toString(16)}`.slice(-4);
|
12549
|
-
return (0, utils_1.hexToBytes)(hex);
|
12550
|
-
}));
|
12551
|
-
}
|
12552
|
-
exports.secretToEntropy = secretToEntropy;
|
12553
|
-
function parseSecretString(secret) {
|
12554
|
-
const normalizedSecret = secret.replace(/[^0-9]/gu, '');
|
12555
|
-
if (normalizedSecret.length !== 48) {
|
12556
|
-
throw new Error('Invalid secret string (should contain 8 blocks of 6 digits');
|
12557
11539
|
}
|
12558
|
-
|
12559
|
-
|
12560
|
-
|
11540
|
+
/**
|
11541
|
+
* Sends a message over the Websocket connection.
|
11542
|
+
*
|
11543
|
+
* @param message - Message to send.
|
11544
|
+
*/
|
11545
|
+
send(message) {
|
11546
|
+
this.ws.send(message);
|
11547
|
+
}
|
12561
11548
|
}
|
12562
|
-
|
11549
|
+
WSWrapper.CONNECTING = 0;
|
11550
|
+
WSWrapper.OPEN = 1;
|
11551
|
+
WSWrapper.CLOSING = 2;
|
11552
|
+
WSWrapper.CLOSED = 3;
|
11553
|
+
exports["default"] = WSWrapper;
|
12563
11554
|
|
12564
11555
|
|
12565
11556
|
/***/ }),
|
@@ -15481,7 +14472,8 @@ var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalObject) {
|
|
15481
14472
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
15482
14473
|
|
15483
14474
|
// Node.js and other environments that support module.exports.
|
15484
|
-
} else
|
14475
|
+
} else // removed by dead control flow
|
14476
|
+
{}
|
15485
14477
|
})(this);
|
15486
14478
|
|
15487
14479
|
|
@@ -16747,7 +15739,9 @@ class XrplDefinitionsBase {
|
|
16747
15739
|
this.field['TransactionType'].associatedType = this.transactionType;
|
16748
15740
|
this.field['TransactionResult'].associatedType = this.transactionResult;
|
16749
15741
|
this.field['LedgerEntryType'].associatedType = this.ledgerEntryType;
|
16750
|
-
this.field['PermissionValue']
|
15742
|
+
if (this.field['PermissionValue']) {
|
15743
|
+
this.field['PermissionValue'].associatedType = this.delegatablePermissions;
|
15744
|
+
}
|
16751
15745
|
}
|
16752
15746
|
getAssociatedTypes() {
|
16753
15747
|
return this.dataTypes;
|
@@ -18636,6 +17630,7 @@ Object.defineProperty(exports, "Hash192", ({ enumerable: true, get: function ()
|
|
18636
17630
|
const hash_256_1 = __webpack_require__(/*! ./hash-256 */ "../../node_modules/ripple-binary-codec/dist/types/hash-256.js");
|
18637
17631
|
Object.defineProperty(exports, "Hash256", ({ enumerable: true, get: function () { return hash_256_1.Hash256; } }));
|
18638
17632
|
const issue_1 = __webpack_require__(/*! ./issue */ "../../node_modules/ripple-binary-codec/dist/types/issue.js");
|
17633
|
+
const st_number_1 = __webpack_require__(/*! ./st-number */ "../../node_modules/ripple-binary-codec/dist/types/st-number.js");
|
18639
17634
|
const path_set_1 = __webpack_require__(/*! ./path-set */ "../../node_modules/ripple-binary-codec/dist/types/path-set.js");
|
18640
17635
|
Object.defineProperty(exports, "PathSet", ({ enumerable: true, get: function () { return path_set_1.PathSet; } }));
|
18641
17636
|
const st_array_1 = __webpack_require__(/*! ./st-array */ "../../node_modules/ripple-binary-codec/dist/types/st-array.js");
|
@@ -18664,6 +17659,7 @@ const coreTypes = {
|
|
18664
17659
|
Hash192: hash_192_1.Hash192,
|
18665
17660
|
Hash256: hash_256_1.Hash256,
|
18666
17661
|
Issue: issue_1.Issue,
|
17662
|
+
Number: st_number_1.STNumber,
|
18667
17663
|
PathSet: path_set_1.PathSet,
|
18668
17664
|
STArray: st_array_1.STArray,
|
18669
17665
|
STObject: st_object_1.STObject,
|
@@ -19062,11 +18058,13 @@ class SerializedType {
|
|
19062
18058
|
}
|
19063
18059
|
static fromParser(parser, hint) {
|
19064
18060
|
throw new Error('fromParser not implemented');
|
19065
|
-
|
18061
|
+
// removed by dead control flow
|
18062
|
+
{}
|
19066
18063
|
}
|
19067
18064
|
static from(value) {
|
19068
18065
|
throw new Error('from not implemented');
|
19069
|
-
|
18066
|
+
// removed by dead control flow
|
18067
|
+
{}
|
19070
18068
|
}
|
19071
18069
|
/**
|
19072
18070
|
* Write the bytes representation of a SerializedType to a BytesList
|
@@ -19226,27 +18224,245 @@ class STArray extends serialized_type_1.SerializedType {
|
|
19226
18224
|
throw new Error('Cannot construct STArray from value given');
|
19227
18225
|
}
|
19228
18226
|
/**
|
19229
|
-
* Return the JSON representation of this.bytes
|
18227
|
+
* Return the JSON representation of this.bytes
|
18228
|
+
*
|
18229
|
+
* @param definitions optional, types and values to use to encode/decode a transaction
|
18230
|
+
* @returns An Array of JSON objects
|
18231
|
+
*/
|
18232
|
+
toJSON(definitions = enums_1.DEFAULT_DEFINITIONS) {
|
18233
|
+
const result = [];
|
18234
|
+
const arrayParser = new binary_parser_1.BinaryParser(this.toString(), definitions);
|
18235
|
+
while (!arrayParser.end()) {
|
18236
|
+
const field = arrayParser.readField();
|
18237
|
+
if (field.name === ARRAY_END_MARKER_NAME) {
|
18238
|
+
break;
|
18239
|
+
}
|
18240
|
+
const outer = {};
|
18241
|
+
outer[field.name] = st_object_1.STObject.fromParser(arrayParser).toJSON(definitions);
|
18242
|
+
result.push(outer);
|
18243
|
+
}
|
18244
|
+
return result;
|
18245
|
+
}
|
18246
|
+
}
|
18247
|
+
exports.STArray = STArray;
|
18248
|
+
|
18249
|
+
|
18250
|
+
/***/ }),
|
18251
|
+
|
18252
|
+
/***/ "../../node_modules/ripple-binary-codec/dist/types/st-number.js":
|
18253
|
+
/*!**********************************************************************!*\
|
18254
|
+
!*** ../../node_modules/ripple-binary-codec/dist/types/st-number.js ***!
|
18255
|
+
\**********************************************************************/
|
18256
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
18257
|
+
|
18258
|
+
"use strict";
|
18259
|
+
|
18260
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
18261
|
+
exports.STNumber = void 0;
|
18262
|
+
const serialized_type_1 = __webpack_require__(/*! ./serialized-type */ "../../node_modules/ripple-binary-codec/dist/types/serialized-type.js");
|
18263
|
+
const utils_1 = __webpack_require__(/*! ../utils */ "../../node_modules/ripple-binary-codec/dist/utils.js");
|
18264
|
+
/**
|
18265
|
+
* Constants for mantissa and exponent normalization per XRPL Number spec.
|
18266
|
+
* These define allowed magnitude for mantissa and exponent after normalization.
|
18267
|
+
*/
|
18268
|
+
const MIN_MANTISSA = BigInt('1000000000000000');
|
18269
|
+
const MAX_MANTISSA = BigInt('9999999999999999');
|
18270
|
+
const MIN_EXPONENT = -32768;
|
18271
|
+
const MAX_EXPONENT = 32768;
|
18272
|
+
const DEFAULT_VALUE_EXPONENT = -2147483648;
|
18273
|
+
/**
|
18274
|
+
* Extract mantissa, exponent, and sign from a number string.
|
18275
|
+
*
|
18276
|
+
* @param val - The string representing the number (may be integer, decimal, or scientific notation).
|
18277
|
+
* @returns Object containing mantissa (BigInt), exponent (number), and isNegative (boolean).
|
18278
|
+
* @throws Error if the string cannot be parsed as a valid number.
|
18279
|
+
*
|
18280
|
+
* Examples:
|
18281
|
+
* '123' -> { mantissa: 123n, exponent: 0, isNegative: false }
|
18282
|
+
* '-00123.45' -> { mantissa: -12345n, exponent: -2, isNegative: true }
|
18283
|
+
* '+7.1e2' -> { mantissa: 71n, exponent: -1 + 2 = 1, isNegative: false }
|
18284
|
+
*/
|
18285
|
+
function extractNumberPartsFromString(val) {
|
18286
|
+
/**
|
18287
|
+
* Regex for parsing decimal/float/scientific number strings with optional sign, integer, decimal, and exponent parts.
|
18288
|
+
*
|
18289
|
+
* Pattern: /^([-+]?)([0-9]+)(?:\.([0-9]+))?(?:[eE]([+-]?[0-9]+))?$/
|
18290
|
+
*
|
18291
|
+
* Breakdown:
|
18292
|
+
* 1. ([-+]?) - Optional '+' or '-' sign at the start.
|
18293
|
+
* 2. ([0-9]+) - Integer part: one or more digits (leading zeros allowed).
|
18294
|
+
* 3. (?:\.([0-9]+))? - Optional decimal point followed by one or more digits.
|
18295
|
+
* 4. (?:[eE]([+-]?[0-9]+))? - Optional exponent, starting with 'e' or 'E', optional sign, and digits.
|
18296
|
+
*
|
18297
|
+
* Notes:
|
18298
|
+
* - Leading zeros are accepted and normalized by code after parsing.
|
18299
|
+
* - Empty decimal ('123.') and missing integer ('.456') are NOT matched—must be fully specified.
|
18300
|
+
*/
|
18301
|
+
const regex = /^([-+]?)([0-9]+)(?:\.([0-9]+))?(?:[eE]([+-]?[0-9]+))?$/;
|
18302
|
+
const match = regex.exec(val);
|
18303
|
+
if (!match)
|
18304
|
+
throw new Error(`Unable to parse number from string: ${val}`);
|
18305
|
+
const [, sign, intPart, fracPart, expPart] = match;
|
18306
|
+
// Remove leading zeros (unless the entire intPart is zeros)
|
18307
|
+
const cleanIntPart = intPart.replace(/^0+(?=\d)/, '') || '0';
|
18308
|
+
let mantissaStr = cleanIntPart;
|
18309
|
+
let exponent = 0;
|
18310
|
+
if (fracPart) {
|
18311
|
+
mantissaStr += fracPart;
|
18312
|
+
exponent -= fracPart.length;
|
18313
|
+
}
|
18314
|
+
if (expPart)
|
18315
|
+
exponent += parseInt(expPart, 10);
|
18316
|
+
let mantissa = BigInt(mantissaStr);
|
18317
|
+
if (sign === '-')
|
18318
|
+
mantissa = -mantissa;
|
18319
|
+
const isNegative = mantissa < BigInt(0);
|
18320
|
+
return { mantissa, exponent, isNegative };
|
18321
|
+
}
|
18322
|
+
/**
|
18323
|
+
* Normalize the mantissa and exponent to XRPL constraints.
|
18324
|
+
*
|
18325
|
+
* Ensures that after normalization, the mantissa is between MIN_MANTISSA and MAX_MANTISSA (unless zero).
|
18326
|
+
* Adjusts the exponent as needed by shifting the mantissa left/right (multiplying/dividing by 10).
|
18327
|
+
*
|
18328
|
+
* @param mantissa - The unnormalized mantissa (BigInt).
|
18329
|
+
* @param exponent - The unnormalized exponent (number).
|
18330
|
+
* @returns An object with normalized mantissa and exponent.
|
18331
|
+
* @throws Error if the number cannot be normalized within allowed exponent range.
|
18332
|
+
*/
|
18333
|
+
function normalize(mantissa, exponent) {
|
18334
|
+
let m = mantissa < BigInt(0) ? -mantissa : mantissa;
|
18335
|
+
const isNegative = mantissa < BigInt(0);
|
18336
|
+
while (m !== BigInt(0) && m < MIN_MANTISSA && exponent > MIN_EXPONENT) {
|
18337
|
+
exponent -= 1;
|
18338
|
+
m *= BigInt(10);
|
18339
|
+
}
|
18340
|
+
while (m > MAX_MANTISSA) {
|
18341
|
+
if (exponent >= MAX_EXPONENT)
|
18342
|
+
throw new Error('Mantissa and exponent are too large');
|
18343
|
+
exponent += 1;
|
18344
|
+
m /= BigInt(10);
|
18345
|
+
}
|
18346
|
+
if (isNegative)
|
18347
|
+
m = -m;
|
18348
|
+
return { mantissa: m, exponent };
|
18349
|
+
}
|
18350
|
+
/**
|
18351
|
+
* STNumber: Encodes XRPL's "Number" type.
|
18352
|
+
*
|
18353
|
+
* - Always encoded as 12 bytes: 8-byte signed mantissa, 4-byte signed exponent, both big-endian.
|
18354
|
+
* - Can only be constructed from a valid number string or another STNumber instance.
|
18355
|
+
*
|
18356
|
+
* Usage:
|
18357
|
+
* STNumber.from("1.2345e5")
|
18358
|
+
* STNumber.from("-123")
|
18359
|
+
* STNumber.fromParser(parser)
|
18360
|
+
*/
|
18361
|
+
class STNumber extends serialized_type_1.SerializedType {
|
18362
|
+
/**
|
18363
|
+
* Construct a STNumber from 12 bytes (8 for mantissa, 4 for exponent).
|
18364
|
+
* @param bytes - 12-byte Uint8Array
|
18365
|
+
* @throws Error if input is not a Uint8Array of length 12.
|
18366
|
+
*/
|
18367
|
+
constructor(bytes) {
|
18368
|
+
const used = bytes !== null && bytes !== void 0 ? bytes : STNumber.defaultBytes;
|
18369
|
+
if (!(used instanceof Uint8Array) || used.length !== 12) {
|
18370
|
+
throw new Error(`STNumber must be constructed from a 12-byte Uint8Array, got ${used === null || used === void 0 ? void 0 : used.length}`);
|
18371
|
+
}
|
18372
|
+
super(used);
|
18373
|
+
}
|
18374
|
+
/**
|
18375
|
+
* Construct from a number string (or another STNumber).
|
18376
|
+
*
|
18377
|
+
* @param value - A string, or STNumber instance.
|
18378
|
+
* @returns STNumber instance.
|
18379
|
+
* @throws Error if not a string or STNumber.
|
18380
|
+
*/
|
18381
|
+
static from(value) {
|
18382
|
+
if (value instanceof STNumber) {
|
18383
|
+
return value;
|
18384
|
+
}
|
18385
|
+
if (typeof value === 'string') {
|
18386
|
+
return STNumber.fromValue(value);
|
18387
|
+
}
|
18388
|
+
throw new Error('STNumber.from: Only string or STNumber instance is supported');
|
18389
|
+
}
|
18390
|
+
/**
|
18391
|
+
* Construct from a number string (integer, decimal, or scientific notation).
|
18392
|
+
* Handles normalization to XRPL Number constraints.
|
19230
18393
|
*
|
19231
|
-
* @param
|
19232
|
-
* @returns
|
18394
|
+
* @param val - The number as a string (e.g. '1.23', '-123e5').
|
18395
|
+
* @returns STNumber instance
|
18396
|
+
* @throws Error if val is not a valid number string.
|
19233
18397
|
*/
|
19234
|
-
|
19235
|
-
const
|
19236
|
-
|
19237
|
-
|
19238
|
-
|
19239
|
-
|
19240
|
-
|
19241
|
-
}
|
19242
|
-
const outer = {};
|
19243
|
-
outer[field.name] = st_object_1.STObject.fromParser(arrayParser).toJSON(definitions);
|
19244
|
-
result.push(outer);
|
18398
|
+
static fromValue(val) {
|
18399
|
+
const { mantissa, exponent, isNegative } = extractNumberPartsFromString(val);
|
18400
|
+
let normalizedMantissa;
|
18401
|
+
let normalizedExponent;
|
18402
|
+
if (mantissa === BigInt(0) && exponent === 0 && !isNegative) {
|
18403
|
+
normalizedMantissa = BigInt(0);
|
18404
|
+
normalizedExponent = DEFAULT_VALUE_EXPONENT;
|
19245
18405
|
}
|
19246
|
-
|
18406
|
+
else {
|
18407
|
+
;
|
18408
|
+
({ mantissa: normalizedMantissa, exponent: normalizedExponent } =
|
18409
|
+
normalize(mantissa, exponent));
|
18410
|
+
}
|
18411
|
+
const bytes = new Uint8Array(12);
|
18412
|
+
(0, utils_1.writeInt64BE)(bytes, normalizedMantissa, 0);
|
18413
|
+
(0, utils_1.writeInt32BE)(bytes, normalizedExponent, 8);
|
18414
|
+
return new STNumber(bytes);
|
19247
18415
|
}
|
19248
|
-
|
19249
|
-
|
18416
|
+
/**
|
18417
|
+
* Read a STNumber from a BinaryParser stream (12 bytes).
|
18418
|
+
* @param parser - BinaryParser positioned at the start of a number
|
18419
|
+
* @returns STNumber instance
|
18420
|
+
*/
|
18421
|
+
static fromParser(parser) {
|
18422
|
+
return new STNumber(parser.read(12));
|
18423
|
+
}
|
18424
|
+
/**
|
18425
|
+
* Convert this STNumber to a normalized string representation.
|
18426
|
+
* The output is decimal or scientific notation, depending on exponent range.
|
18427
|
+
* Follows XRPL convention: zero is "0", other values are normalized to a canonical string.
|
18428
|
+
*
|
18429
|
+
* @returns String representation of the value
|
18430
|
+
*/
|
18431
|
+
// eslint-disable-next-line complexity -- required
|
18432
|
+
toJSON() {
|
18433
|
+
const b = this.bytes;
|
18434
|
+
if (!b || b.length !== 12)
|
18435
|
+
throw new Error('STNumber internal bytes not set or wrong length');
|
18436
|
+
// Signed 64-bit mantissa
|
18437
|
+
const mantissa = (0, utils_1.readInt64BE)(b, 0);
|
18438
|
+
// Signed 32-bit exponent
|
18439
|
+
const exponent = (0, utils_1.readInt32BE)(b, 8);
|
18440
|
+
// Special zero: XRPL encodes canonical zero as mantissa=0, exponent=DEFAULT_VALUE_EXPONENT.
|
18441
|
+
if (mantissa === BigInt(0) && exponent === DEFAULT_VALUE_EXPONENT) {
|
18442
|
+
return '0';
|
18443
|
+
}
|
18444
|
+
if (exponent === 0)
|
18445
|
+
return mantissa.toString();
|
18446
|
+
// Use scientific notation for small/large exponents, decimal otherwise
|
18447
|
+
if (exponent < -25 || exponent > -5) {
|
18448
|
+
return `${mantissa}e${exponent}`;
|
18449
|
+
}
|
18450
|
+
// Decimal rendering for -25 <= exp <= -5
|
18451
|
+
const isNegative = mantissa < BigInt(0);
|
18452
|
+
const mantissaAbs = mantissa < BigInt(0) ? -mantissa : mantissa;
|
18453
|
+
const padPrefix = 27;
|
18454
|
+
const padSuffix = 23;
|
18455
|
+
const mantissaStr = mantissaAbs.toString();
|
18456
|
+
const rawValue = '0'.repeat(padPrefix) + mantissaStr + '0'.repeat(padSuffix);
|
18457
|
+
const OFFSET = exponent + 43;
|
18458
|
+
const integerPart = rawValue.slice(0, OFFSET).replace(/^0+/, '') || '0';
|
18459
|
+
const fractionPart = rawValue.slice(OFFSET).replace(/0+$/, '');
|
18460
|
+
return `${isNegative ? '-' : ''}${integerPart}${fractionPart ? '.' + fractionPart : ''}`;
|
18461
|
+
}
|
18462
|
+
}
|
18463
|
+
exports.STNumber = STNumber;
|
18464
|
+
/** 12 zero bytes, represents canonical zero. */
|
18465
|
+
STNumber.defaultBytes = new Uint8Array(12);
|
19250
18466
|
|
19251
18467
|
|
19252
18468
|
/***/ }),
|
@@ -19378,13 +18594,18 @@ class STObject extends serialized_type_1.SerializedType {
|
|
19378
18594
|
sorted = sorted.filter(filter);
|
19379
18595
|
}
|
19380
18596
|
sorted.forEach((field) => {
|
18597
|
+
var _a;
|
19381
18598
|
const associatedValue = field.type.name === ST_OBJECT
|
19382
18599
|
? this.from(xAddressDecoded[field.name], undefined, definitions)
|
19383
18600
|
: field.type.name === 'STArray'
|
19384
18601
|
? st_array_1.STArray.from(xAddressDecoded[field.name], definitions)
|
19385
18602
|
: field.type.name === 'UInt64'
|
19386
18603
|
? uint_64_1.UInt64.from(xAddressDecoded[field.name], field.name)
|
19387
|
-
: field.associatedType.from
|
18604
|
+
: ((_a = field.associatedType) === null || _a === void 0 ? void 0 : _a.from)
|
18605
|
+
? field.associatedType.from(xAddressDecoded[field.name])
|
18606
|
+
: (() => {
|
18607
|
+
throw new Error(`Type ${field.type.name} for field ${field.name} is missing associatedType.from`);
|
18608
|
+
})();
|
19388
18609
|
if (associatedValue == undefined) {
|
19389
18610
|
throw new TypeError(`Unable to interpret "${field.name}: ${xAddressDecoded[field.name]}".`);
|
19390
18611
|
}
|
@@ -19561,10 +18782,14 @@ const enums_1 = __webpack_require__(/*! ../enums */ "../../node_modules/ripple-b
|
|
19561
18782
|
const HEX_REGEX = /^[a-fA-F0-9]{1,16}$/;
|
19562
18783
|
const BASE10_REGEX = /^[0-9]{1,20}$/;
|
19563
18784
|
const mask = BigInt(0x00000000ffffffff);
|
19564
|
-
|
19565
|
-
|
19566
|
-
|
19567
|
-
|
18785
|
+
const BASE10_AMOUNT_FIELDS = new Set([
|
18786
|
+
'MaximumAmount',
|
18787
|
+
'OutstandingAmount',
|
18788
|
+
'MPTAmount',
|
18789
|
+
'LockedAmount',
|
18790
|
+
]);
|
18791
|
+
function isBase10(fieldName) {
|
18792
|
+
return BASE10_AMOUNT_FIELDS.has(fieldName);
|
19568
18793
|
}
|
19569
18794
|
/**
|
19570
18795
|
* Derived UInt class for serializing/deserializing 64 bit UInt
|
@@ -19598,7 +18823,7 @@ class UInt64 extends uint_1.UInt {
|
|
19598
18823
|
return new UInt64((0, utils_1.concat)(intBuf));
|
19599
18824
|
}
|
19600
18825
|
if (typeof val === 'string') {
|
19601
|
-
if (
|
18826
|
+
if (isBase10(fieldName)) {
|
19602
18827
|
if (!BASE10_REGEX.test(val)) {
|
19603
18828
|
throw new Error(`${fieldName} ${val} is not a valid base 10 string`);
|
19604
18829
|
}
|
@@ -19626,7 +18851,7 @@ class UInt64 extends uint_1.UInt {
|
|
19626
18851
|
*/
|
19627
18852
|
toJSON(_definitions = enums_1.DEFAULT_DEFINITIONS, fieldName = '') {
|
19628
18853
|
const hexString = (0, utils_1.bytesToHex)(this.bytes);
|
19629
|
-
if (
|
18854
|
+
if (isBase10(fieldName)) {
|
19630
18855
|
return BigInt('0x' + hexString).toString(10);
|
19631
18856
|
}
|
19632
18857
|
return hexString;
|
@@ -19974,7 +19199,7 @@ XChainBridge.TYPE_ORDER = [
|
|
19974
19199
|
"use strict";
|
19975
19200
|
|
19976
19201
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
19977
|
-
exports.compare = exports.equal = exports.readUInt32BE = exports.readUInt16BE = exports.writeUInt32BE = exports.writeUInt16BE = exports.writeUInt8 = void 0;
|
19202
|
+
exports.compare = exports.equal = exports.readInt64BE = exports.readInt32BE = exports.readUInt32BE = exports.readUInt16BE = exports.writeInt64BE = exports.writeInt32BE = exports.writeUInt32BE = exports.writeUInt16BE = exports.writeUInt8 = void 0;
|
19978
19203
|
/**
|
19979
19204
|
* Writes value to array at the specified offset. The value must be a valid unsigned 8-bit integer.
|
19980
19205
|
* @param array Uint8Array to be written to
|
@@ -20011,6 +19236,28 @@ function writeUInt32BE(array, value, offset) {
|
|
20011
19236
|
array[offset + 3] = value & 0xff;
|
20012
19237
|
}
|
20013
19238
|
exports.writeUInt32BE = writeUInt32BE;
|
19239
|
+
/**
|
19240
|
+
* Writes a signed 32-bit integer to a Uint8Array at the specified offset (big-endian).
|
19241
|
+
*
|
19242
|
+
* @param array - The Uint8Array to write to.
|
19243
|
+
* @param value - The signed 32-bit integer to write.
|
19244
|
+
* @param offset - The offset at which to write.
|
19245
|
+
*/
|
19246
|
+
function writeInt32BE(array, value, offset) {
|
19247
|
+
new DataView(array.buffer, array.byteOffset, array.byteLength).setInt32(offset, value, false);
|
19248
|
+
}
|
19249
|
+
exports.writeInt32BE = writeInt32BE;
|
19250
|
+
/**
|
19251
|
+
* Writes a signed 64-bit integer (BigInt) to a Uint8Array at the specified offset (big-endian).
|
19252
|
+
*
|
19253
|
+
* @param array - The Uint8Array to write to.
|
19254
|
+
* @param value - The signed 64-bit integer (BigInt) to write.
|
19255
|
+
* @param offset - The offset at which to write.
|
19256
|
+
*/
|
19257
|
+
function writeInt64BE(array, value, offset) {
|
19258
|
+
new DataView(array.buffer, array.byteOffset, array.byteLength).setBigInt64(offset, value, false);
|
19259
|
+
}
|
19260
|
+
exports.writeInt64BE = writeInt64BE;
|
20014
19261
|
/**
|
20015
19262
|
* Reads an unsigned, big-endian 16-bit integer from the array at the specified offset.
|
20016
19263
|
* @param array Uint8Array to read
|
@@ -20029,6 +19276,28 @@ function readUInt32BE(array, offset) {
|
|
20029
19276
|
return new DataView(array.buffer).getUint32(offset, false).toString(10);
|
20030
19277
|
}
|
20031
19278
|
exports.readUInt32BE = readUInt32BE;
|
19279
|
+
/**
|
19280
|
+
* Reads a signed 32-bit integer from a Uint8Array at the specified offset (big-endian).
|
19281
|
+
*
|
19282
|
+
* @param array - The Uint8Array to read from.
|
19283
|
+
* @param offset - The offset at which to start reading.
|
19284
|
+
* @returns The signed 32-bit integer.
|
19285
|
+
*/
|
19286
|
+
function readInt32BE(array, offset) {
|
19287
|
+
return new DataView(array.buffer, array.byteOffset, array.byteLength).getInt32(offset, false);
|
19288
|
+
}
|
19289
|
+
exports.readInt32BE = readInt32BE;
|
19290
|
+
/**
|
19291
|
+
* Reads a signed 64-bit integer (BigInt) from a Uint8Array at the specified offset (big-endian).
|
19292
|
+
*
|
19293
|
+
* @param array - The Uint8Array to read from.
|
19294
|
+
* @param offset - The offset at which to start reading.
|
19295
|
+
* @returns The signed 64-bit integer (BigInt).
|
19296
|
+
*/
|
19297
|
+
function readInt64BE(array, offset) {
|
19298
|
+
return new DataView(array.buffer, array.byteOffset, array.byteLength).getBigInt64(offset, false);
|
19299
|
+
}
|
19300
|
+
exports.readInt64BE = readInt64BE;
|
20032
19301
|
/**
|
20033
19302
|
* Compares two Uint8Array or ArrayBuffers
|
20034
19303
|
* @param a first array to compare
|
@@ -21218,7 +20487,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21218
20487
|
};
|
21219
20488
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
21220
20489
|
exports.walletFromSecretNumbers = void 0;
|
21221
|
-
const secret_numbers_1 = __webpack_require__(/*! @xrplf/secret-numbers */ "
|
20490
|
+
const secret_numbers_1 = __webpack_require__(/*! @xrplf/secret-numbers */ "./node_modules/@xrplf/secret-numbers/dist/index.js");
|
21222
20491
|
const ECDSA_1 = __importDefault(__webpack_require__(/*! ../ECDSA */ "./dist/npm/ECDSA.js"));
|
21223
20492
|
const _1 = __webpack_require__(/*! . */ "./dist/npm/Wallet/index.js");
|
21224
20493
|
function walletFromSecretNumbers(secretNumbers, opts) {
|
@@ -21976,18 +21245,12 @@ class Client extends eventemitter3_1.EventEmitter {
|
|
21976
21245
|
if (tx.TransactionType === 'Batch') {
|
21977
21246
|
promises.push((0, autofill_1.autofillBatchTxn)(this, tx));
|
21978
21247
|
}
|
21979
|
-
if (tx.TransactionType === 'Payment') {
|
21248
|
+
if (tx.TransactionType === 'Payment' && tx.DeliverMax != null) {
|
21980
21249
|
(0, autofill_1.handleDeliverMax)(tx);
|
21981
21250
|
}
|
21982
21251
|
return Promise.all(promises).then(() => tx);
|
21983
21252
|
});
|
21984
21253
|
}
|
21985
|
-
submit(transaction, opts) {
|
21986
|
-
return __awaiter(this, void 0, void 0, function* () {
|
21987
|
-
const signedTx = yield (0, sugar_1.getSignedTx)(this, transaction, opts);
|
21988
|
-
return (0, sugar_1.submitRequest)(this, signedTx, opts === null || opts === void 0 ? void 0 : opts.failHard);
|
21989
|
-
});
|
21990
|
-
}
|
21991
21254
|
simulate(transaction, opts) {
|
21992
21255
|
var _a;
|
21993
21256
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -21998,6 +21261,12 @@ class Client extends eventemitter3_1.EventEmitter {
|
|
21998
21261
|
return this.request(request);
|
21999
21262
|
});
|
22000
21263
|
}
|
21264
|
+
submit(transaction, opts) {
|
21265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21266
|
+
const signedTx = yield (0, sugar_1.getSignedTx)(this, transaction, opts);
|
21267
|
+
return (0, sugar_1.submitRequest)(this, signedTx, opts === null || opts === void 0 ? void 0 : opts.failHard);
|
21268
|
+
});
|
21269
|
+
}
|
22001
21270
|
submitAndWait(transaction, opts) {
|
22002
21271
|
return __awaiter(this, void 0, void 0, function* () {
|
22003
21272
|
const signedTx = yield (0, sugar_1.getSignedTx)(this, transaction, opts);
|
@@ -22006,6 +21275,9 @@ class Client extends eventemitter3_1.EventEmitter {
|
|
22006
21275
|
throw new errors_1.ValidationError('Transaction must contain a LastLedgerSequence value for reliable submission.');
|
22007
21276
|
}
|
22008
21277
|
const response = yield (0, sugar_1.submitRequest)(this, signedTx, opts === null || opts === void 0 ? void 0 : opts.failHard);
|
21278
|
+
if (response.result.engine_result.startsWith('tem')) {
|
21279
|
+
throw new errors_1.XrplError(`Transaction failed, ${response.result.engine_result}: ${response.result.engine_result_message}`);
|
21280
|
+
}
|
22009
21281
|
const txHash = utils_1.hashes.hashSignedTx(signedTx);
|
22010
21282
|
return (0, sugar_1.waitForFinalTransactionOutcome)(this, txHash, lastLedger, response.result.engine_result);
|
22011
21283
|
});
|
@@ -22155,7 +21427,7 @@ function amountsEqual(amt1, amt2) {
|
|
22155
21427
|
aValue.isEqualTo(bValue));
|
22156
21428
|
}
|
22157
21429
|
function isPartialPayment(tx, metadata) {
|
22158
|
-
var _a;
|
21430
|
+
var _a, _b;
|
22159
21431
|
if (tx == null || metadata == null || tx.TransactionType !== 'Payment') {
|
22160
21432
|
return false;
|
22161
21433
|
}
|
@@ -22173,7 +21445,7 @@ function isPartialPayment(tx, metadata) {
|
|
22173
21445
|
return false;
|
22174
21446
|
}
|
22175
21447
|
const delivered = meta.delivered_amount;
|
22176
|
-
const amount = tx.DeliverMax;
|
21448
|
+
const amount = (_b = tx.DeliverMax) !== null && _b !== void 0 ? _b : tx.Amount;
|
22177
21449
|
if (delivered === undefined) {
|
22178
21450
|
return false;
|
22179
21451
|
}
|
@@ -22452,6 +21724,7 @@ var AccountRootFlags;
|
|
22452
21724
|
AccountRootFlags[AccountRootFlags["lsfDisallowIncomingPayChan"] = 268435456] = "lsfDisallowIncomingPayChan";
|
22453
21725
|
AccountRootFlags[AccountRootFlags["lsfDisallowIncomingTrustline"] = 536870912] = "lsfDisallowIncomingTrustline";
|
22454
21726
|
AccountRootFlags[AccountRootFlags["lsfAllowTrustLineClawback"] = 2147483648] = "lsfAllowTrustLineClawback";
|
21727
|
+
AccountRootFlags[AccountRootFlags["lsfAllowTrustLineLocking"] = 1073741824] = "lsfAllowTrustLineLocking";
|
22455
21728
|
})(AccountRootFlags || (exports.AccountRootFlags = AccountRootFlags = {}));
|
22456
21729
|
|
22457
21730
|
|
@@ -22516,6 +21789,7 @@ var OfferFlags;
|
|
22516
21789
|
(function (OfferFlags) {
|
22517
21790
|
OfferFlags[OfferFlags["lsfPassive"] = 65536] = "lsfPassive";
|
22518
21791
|
OfferFlags[OfferFlags["lsfSell"] = 131072] = "lsfSell";
|
21792
|
+
OfferFlags[OfferFlags["lsfHybrid"] = 262144] = "lsfHybrid";
|
22519
21793
|
})(OfferFlags || (exports.OfferFlags = OfferFlags = {}));
|
22520
21794
|
|
22521
21795
|
|
@@ -22626,13 +21900,13 @@ function validateAMMBid(tx) {
|
|
22626
21900
|
if (tx.Asset == null) {
|
22627
21901
|
throw new errors_1.ValidationError('AMMBid: missing field Asset');
|
22628
21902
|
}
|
22629
|
-
if (!(0, common_1.
|
21903
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset)) {
|
22630
21904
|
throw new errors_1.ValidationError('AMMBid: Asset must be a Currency');
|
22631
21905
|
}
|
22632
21906
|
if (tx.Asset2 == null) {
|
22633
21907
|
throw new errors_1.ValidationError('AMMBid: missing field Asset2');
|
22634
21908
|
}
|
22635
|
-
if (!(0, common_1.
|
21909
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset2)) {
|
22636
21910
|
throw new errors_1.ValidationError('AMMBid: Asset2 must be a Currency');
|
22637
21911
|
}
|
22638
21912
|
if (tx.BidMin != null && !(0, common_1.isAmount)(tx.BidMin)) {
|
@@ -22642,7 +21916,7 @@ function validateAMMBid(tx) {
|
|
22642
21916
|
throw new errors_1.ValidationError('AMMBid: BidMax must be an Amount');
|
22643
21917
|
}
|
22644
21918
|
if (tx.AuthAccounts != null) {
|
22645
|
-
if (!
|
21919
|
+
if (!(0, common_1.isArray)(tx.AuthAccounts)) {
|
22646
21920
|
throw new errors_1.ValidationError(`AMMBid: AuthAccounts must be an AuthAccount array`);
|
22647
21921
|
}
|
22648
21922
|
if (tx.AuthAccounts.length > MAX_AUTH_ACCOUNTS) {
|
@@ -22654,8 +21928,10 @@ function validateAMMBid(tx) {
|
|
22654
21928
|
exports.validateAMMBid = validateAMMBid;
|
22655
21929
|
function validateAuthAccounts(senderAddress, authAccounts) {
|
22656
21930
|
for (const authAccount of authAccounts) {
|
22657
|
-
if (authAccount
|
22658
|
-
|
21931
|
+
if (!(0, common_1.isRecord)(authAccount)) {
|
21932
|
+
throw new errors_1.ValidationError(`AMMBid: invalid AuthAccounts`);
|
21933
|
+
}
|
21934
|
+
if (!(0, common_1.isRecord)(authAccount.AuthAccount)) {
|
22659
21935
|
throw new errors_1.ValidationError(`AMMBid: invalid AuthAccounts`);
|
22660
21936
|
}
|
22661
21937
|
if (authAccount.AuthAccount.Account == null) {
|
@@ -22693,22 +21969,21 @@ var AMMClawbackFlags;
|
|
22693
21969
|
function validateAMMClawback(tx) {
|
22694
21970
|
(0, common_1.validateBaseTransaction)(tx);
|
22695
21971
|
(0, common_1.validateRequiredField)(tx, 'Holder', common_1.isAccount);
|
22696
|
-
(0, common_1.validateRequiredField)(tx, 'Asset', common_1.
|
21972
|
+
(0, common_1.validateRequiredField)(tx, 'Asset', common_1.isIssuedCurrency);
|
22697
21973
|
const asset = tx.Asset;
|
22698
|
-
const amount = tx.Amount;
|
22699
21974
|
if (tx.Holder === asset.issuer) {
|
22700
21975
|
throw new errors_1.ValidationError('AMMClawback: Holder and Asset.issuer must be distinct');
|
22701
21976
|
}
|
22702
21977
|
if (tx.Account !== asset.issuer) {
|
22703
21978
|
throw new errors_1.ValidationError('AMMClawback: Account must be the same as Asset.issuer');
|
22704
21979
|
}
|
22705
|
-
(0, common_1.validateRequiredField)(tx, 'Asset2', common_1.
|
22706
|
-
(0, common_1.validateOptionalField)(tx, 'Amount', common_1.
|
21980
|
+
(0, common_1.validateRequiredField)(tx, 'Asset2', common_1.isIssuedCurrency);
|
21981
|
+
(0, common_1.validateOptionalField)(tx, 'Amount', common_1.isIssuedCurrencyAmount);
|
22707
21982
|
if (tx.Amount != null) {
|
22708
|
-
if (
|
21983
|
+
if (tx.Amount.currency !== asset.currency) {
|
22709
21984
|
throw new errors_1.ValidationError('AMMClawback: Amount.currency must match Asset.currency');
|
22710
21985
|
}
|
22711
|
-
if (
|
21986
|
+
if (tx.Amount.issuer !== asset.issuer) {
|
22712
21987
|
throw new errors_1.ValidationError('AMMClawback: Amount.issuer must match Amount.issuer');
|
22713
21988
|
}
|
22714
21989
|
}
|
@@ -22777,13 +22052,13 @@ function validateAMMDelete(tx) {
|
|
22777
22052
|
if (tx.Asset == null) {
|
22778
22053
|
throw new errors_1.ValidationError('AMMDelete: missing field Asset');
|
22779
22054
|
}
|
22780
|
-
if (!(0, common_1.
|
22055
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset)) {
|
22781
22056
|
throw new errors_1.ValidationError('AMMDelete: Asset must be a Currency');
|
22782
22057
|
}
|
22783
22058
|
if (tx.Asset2 == null) {
|
22784
22059
|
throw new errors_1.ValidationError('AMMDelete: missing field Asset2');
|
22785
22060
|
}
|
22786
|
-
if (!(0, common_1.
|
22061
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset2)) {
|
22787
22062
|
throw new errors_1.ValidationError('AMMDelete: Asset2 must be a Currency');
|
22788
22063
|
}
|
22789
22064
|
}
|
@@ -22818,13 +22093,13 @@ function validateAMMDeposit(tx) {
|
|
22818
22093
|
if (tx.Asset == null) {
|
22819
22094
|
throw new errors_1.ValidationError('AMMDeposit: missing field Asset');
|
22820
22095
|
}
|
22821
|
-
if (!(0, common_1.
|
22096
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset)) {
|
22822
22097
|
throw new errors_1.ValidationError('AMMDeposit: Asset must be a Currency');
|
22823
22098
|
}
|
22824
22099
|
if (tx.Asset2 == null) {
|
22825
22100
|
throw new errors_1.ValidationError('AMMDeposit: missing field Asset2');
|
22826
22101
|
}
|
22827
|
-
if (!(0, common_1.
|
22102
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset2)) {
|
22828
22103
|
throw new errors_1.ValidationError('AMMDeposit: Asset2 must be a Currency');
|
22829
22104
|
}
|
22830
22105
|
if (tx.Amount2 != null && tx.Amount == null) {
|
@@ -22836,7 +22111,7 @@ function validateAMMDeposit(tx) {
|
|
22836
22111
|
else if (tx.LPTokenOut == null && tx.Amount == null) {
|
22837
22112
|
throw new errors_1.ValidationError('AMMDeposit: must set at least LPTokenOut or Amount');
|
22838
22113
|
}
|
22839
|
-
if (tx.LPTokenOut != null && !(0, common_1.
|
22114
|
+
if (tx.LPTokenOut != null && !(0, common_1.isIssuedCurrencyAmount)(tx.LPTokenOut)) {
|
22840
22115
|
throw new errors_1.ValidationError('AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount');
|
22841
22116
|
}
|
22842
22117
|
if (tx.Amount != null && !(0, common_1.isAmount)(tx.Amount)) {
|
@@ -22872,13 +22147,13 @@ function validateAMMVote(tx) {
|
|
22872
22147
|
if (tx.Asset == null) {
|
22873
22148
|
throw new errors_1.ValidationError('AMMVote: missing field Asset');
|
22874
22149
|
}
|
22875
|
-
if (!(0, common_1.
|
22150
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset)) {
|
22876
22151
|
throw new errors_1.ValidationError('AMMVote: Asset must be a Currency');
|
22877
22152
|
}
|
22878
22153
|
if (tx.Asset2 == null) {
|
22879
22154
|
throw new errors_1.ValidationError('AMMVote: missing field Asset2');
|
22880
22155
|
}
|
22881
|
-
if (!(0, common_1.
|
22156
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset2)) {
|
22882
22157
|
throw new errors_1.ValidationError('AMMVote: Asset2 must be a Currency');
|
22883
22158
|
}
|
22884
22159
|
if (tx.TradingFee == null) {
|
@@ -22923,13 +22198,13 @@ function validateAMMWithdraw(tx) {
|
|
22923
22198
|
if (tx.Asset == null) {
|
22924
22199
|
throw new errors_1.ValidationError('AMMWithdraw: missing field Asset');
|
22925
22200
|
}
|
22926
|
-
if (!(0, common_1.
|
22201
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset)) {
|
22927
22202
|
throw new errors_1.ValidationError('AMMWithdraw: Asset must be a Currency');
|
22928
22203
|
}
|
22929
22204
|
if (tx.Asset2 == null) {
|
22930
22205
|
throw new errors_1.ValidationError('AMMWithdraw: missing field Asset2');
|
22931
22206
|
}
|
22932
|
-
if (!(0, common_1.
|
22207
|
+
if (!(0, common_1.isIssuedCurrency)(tx.Asset2)) {
|
22933
22208
|
throw new errors_1.ValidationError('AMMWithdraw: Asset2 must be a Currency');
|
22934
22209
|
}
|
22935
22210
|
if (tx.Amount2 != null && tx.Amount == null) {
|
@@ -22938,7 +22213,7 @@ function validateAMMWithdraw(tx) {
|
|
22938
22213
|
else if (tx.EPrice != null && tx.Amount == null) {
|
22939
22214
|
throw new errors_1.ValidationError('AMMWithdraw: must set Amount with EPrice');
|
22940
22215
|
}
|
22941
|
-
if (tx.LPTokenIn != null && !(0, common_1.
|
22216
|
+
if (tx.LPTokenIn != null && !(0, common_1.isIssuedCurrencyAmount)(tx.LPTokenIn)) {
|
22942
22217
|
throw new errors_1.ValidationError('AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount');
|
22943
22218
|
}
|
22944
22219
|
if (tx.Amount != null && !(0, common_1.isAmount)(tx.Amount)) {
|
@@ -23146,17 +22421,16 @@ var MPTokenIssuanceCreateFlags;
|
|
23146
22421
|
MPTokenIssuanceCreateFlags[MPTokenIssuanceCreateFlags["tfMPTCanClawback"] = 64] = "tfMPTCanClawback";
|
23147
22422
|
})(MPTokenIssuanceCreateFlags || (exports.MPTokenIssuanceCreateFlags = MPTokenIssuanceCreateFlags = {}));
|
23148
22423
|
function validateMPTokenIssuanceCreate(tx) {
|
23149
|
-
var _a;
|
22424
|
+
var _a, _b;
|
23150
22425
|
(0, common_1.validateBaseTransaction)(tx);
|
23151
22426
|
(0, common_1.validateOptionalField)(tx, 'MaximumAmount', common_1.isString);
|
23152
22427
|
(0, common_1.validateOptionalField)(tx, 'MPTokenMetadata', common_1.isString);
|
23153
22428
|
(0, common_1.validateOptionalField)(tx, 'TransferFee', common_1.isNumber);
|
23154
22429
|
(0, common_1.validateOptionalField)(tx, 'AssetScale', common_1.isNumber);
|
23155
|
-
if (typeof tx.MPTokenMetadata === 'string' &&
|
23156
|
-
|
23157
|
-
|
23158
|
-
|
23159
|
-
throw new errors_1.ValidationError('MPTokenIssuanceCreate: MPTokenMetadata must be in hex format');
|
22430
|
+
if (typeof tx.MPTokenMetadata === 'string' &&
|
22431
|
+
(!(0, utils_1.isHex)(tx.MPTokenMetadata) ||
|
22432
|
+
tx.MPTokenMetadata.length / 2 > common_1.MAX_MPT_META_BYTE_LENGTH)) {
|
22433
|
+
throw new errors_1.ValidationError(`MPTokenIssuanceCreate: MPTokenMetadata (hex format) must be non-empty and no more than ${common_1.MAX_MPT_META_BYTE_LENGTH} bytes.`);
|
23160
22434
|
}
|
23161
22435
|
if (typeof tx.MaximumAmount === 'string') {
|
23162
22436
|
if (!utils_1.INTEGER_SANITY_CHECK.exec(tx.MaximumAmount)) {
|
@@ -23168,10 +22442,10 @@ function validateMPTokenIssuanceCreate(tx) {
|
|
23168
22442
|
}
|
23169
22443
|
}
|
23170
22444
|
if (typeof tx.TransferFee === 'number') {
|
23171
|
-
const flags = tx.Flags;
|
22445
|
+
const flags = ((_a = tx.Flags) !== null && _a !== void 0 ? _a : 0);
|
23172
22446
|
const isTfMPTCanTransfer = typeof flags === 'number'
|
23173
22447
|
? (0, utils_1.isFlagEnabled)(flags, MPTokenIssuanceCreateFlags.tfMPTCanTransfer)
|
23174
|
-
: (
|
22448
|
+
: (_b = flags.tfMPTCanTransfer) !== null && _b !== void 0 ? _b : false;
|
23175
22449
|
if (tx.TransferFee < 0 || tx.TransferFee > MAX_TRANSFER_FEE) {
|
23176
22450
|
throw new errors_1.ValidationError(`MPTokenIssuanceCreate: TransferFee must be between 0 and ${MAX_TRANSFER_FEE}`);
|
23177
22451
|
}
|
@@ -23179,6 +22453,16 @@ function validateMPTokenIssuanceCreate(tx) {
|
|
23179
22453
|
throw new errors_1.ValidationError('MPTokenIssuanceCreate: TransferFee cannot be provided without enabling tfMPTCanTransfer flag');
|
23180
22454
|
}
|
23181
22455
|
}
|
22456
|
+
if (tx.MPTokenMetadata != null) {
|
22457
|
+
const validationMessages = (0, common_1.validateMPTokenMetadata)(tx.MPTokenMetadata);
|
22458
|
+
if (validationMessages.length > 0) {
|
22459
|
+
const message = [
|
22460
|
+
common_1.MPT_META_WARNING_HEADER,
|
22461
|
+
...validationMessages.map((msg) => `- ${msg}`),
|
22462
|
+
].join('\n');
|
22463
|
+
console.warn(message);
|
22464
|
+
}
|
22465
|
+
}
|
23182
22466
|
}
|
23183
22467
|
exports.validateMPTokenIssuanceCreate = validateMPTokenIssuanceCreate;
|
23184
22468
|
|
@@ -23224,17 +22508,17 @@ var MPTokenIssuanceSetFlags;
|
|
23224
22508
|
MPTokenIssuanceSetFlags[MPTokenIssuanceSetFlags["tfMPTUnlock"] = 2] = "tfMPTUnlock";
|
23225
22509
|
})(MPTokenIssuanceSetFlags || (exports.MPTokenIssuanceSetFlags = MPTokenIssuanceSetFlags = {}));
|
23226
22510
|
function validateMPTokenIssuanceSet(tx) {
|
23227
|
-
var _a, _b;
|
22511
|
+
var _a, _b, _c;
|
23228
22512
|
(0, common_1.validateBaseTransaction)(tx);
|
23229
22513
|
(0, common_1.validateRequiredField)(tx, 'MPTokenIssuanceID', common_1.isString);
|
23230
22514
|
(0, common_1.validateOptionalField)(tx, 'Holder', common_1.isAccount);
|
23231
|
-
const flags = tx.Flags;
|
22515
|
+
const flags = ((_a = tx.Flags) !== null && _a !== void 0 ? _a : 0);
|
23232
22516
|
const isTfMPTLock = typeof flags === 'number'
|
23233
22517
|
? (0, utils_1.isFlagEnabled)(flags, MPTokenIssuanceSetFlags.tfMPTLock)
|
23234
|
-
: (
|
22518
|
+
: (_b = flags.tfMPTLock) !== null && _b !== void 0 ? _b : false;
|
23235
22519
|
const isTfMPTUnlock = typeof flags === 'number'
|
23236
22520
|
? (0, utils_1.isFlagEnabled)(flags, MPTokenIssuanceSetFlags.tfMPTUnlock)
|
23237
|
-
: (
|
22521
|
+
: (_c = flags.tfMPTUnlock) !== null && _c !== void 0 ? _c : false;
|
23238
22522
|
if (isTfMPTLock && isTfMPTUnlock) {
|
23239
22523
|
throw new errors_1.ValidationError('MPTokenIssuanceSet: flag conflict');
|
23240
22524
|
}
|
@@ -23317,7 +22601,7 @@ const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js")
|
|
23317
22601
|
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
23318
22602
|
function validateNFTokenCancelOffer(tx) {
|
23319
22603
|
(0, common_1.validateBaseTransaction)(tx);
|
23320
|
-
if (!
|
22604
|
+
if (!(0, common_1.isArray)(tx.NFTokenOffers)) {
|
23321
22605
|
throw new errors_1.ValidationError('NFTokenCancelOffer: missing field NFTokenOffers');
|
23322
22606
|
}
|
23323
22607
|
if (tx.NFTokenOffers.length < 1) {
|
@@ -23360,6 +22644,7 @@ function validateNFTokenBuyOfferCases(tx) {
|
|
23360
22644
|
}
|
23361
22645
|
}
|
23362
22646
|
function validateNFTokenCreateOffer(tx) {
|
22647
|
+
var _a, _b;
|
23363
22648
|
(0, common_1.validateBaseTransaction)(tx);
|
23364
22649
|
if (tx.Account === tx.Owner) {
|
23365
22650
|
throw new errors_1.ValidationError('NFTokenCreateOffer: Owner and Account must not be equal');
|
@@ -23375,8 +22660,11 @@ function validateNFTokenCreateOffer(tx) {
|
|
23375
22660
|
if (!(0, common_1.isAmount)(tx.Amount)) {
|
23376
22661
|
throw new errors_1.ValidationError('NFTokenCreateOffer: invalid Amount');
|
23377
22662
|
}
|
23378
|
-
|
23379
|
-
|
22663
|
+
const flags = ((_a = tx.Flags) !== null && _a !== void 0 ? _a : 0);
|
22664
|
+
const isTfSellNFToken = typeof flags === 'number'
|
22665
|
+
? (0, utils_1.isFlagEnabled)(flags, NFTokenCreateOfferFlags.tfSellNFToken)
|
22666
|
+
: (_b = flags.tfSellNFToken) !== null && _b !== void 0 ? _b : false;
|
22667
|
+
if (isTfSellNFToken) {
|
23380
22668
|
validateNFTokenSellOfferCases(tx);
|
23381
22669
|
}
|
23382
22670
|
else {
|
@@ -23720,6 +23008,7 @@ var AccountSetAsfFlags;
|
|
23720
23008
|
AccountSetAsfFlags[AccountSetAsfFlags["asfDisallowIncomingPayChan"] = 14] = "asfDisallowIncomingPayChan";
|
23721
23009
|
AccountSetAsfFlags[AccountSetAsfFlags["asfDisallowIncomingTrustline"] = 15] = "asfDisallowIncomingTrustline";
|
23722
23010
|
AccountSetAsfFlags[AccountSetAsfFlags["asfAllowTrustLineClawback"] = 16] = "asfAllowTrustLineClawback";
|
23011
|
+
AccountSetAsfFlags[AccountSetAsfFlags["asfAllowTrustLineLocking"] = 17] = "asfAllowTrustLineLocking";
|
23723
23012
|
})(AccountSetAsfFlags || (exports.AccountSetAsfFlags = AccountSetAsfFlags = {}));
|
23724
23013
|
var AccountSetTfFlags;
|
23725
23014
|
(function (AccountSetTfFlags) {
|
@@ -23931,8 +23220,7 @@ function validateCheckCreate(tx) {
|
|
23931
23220
|
}
|
23932
23221
|
(0, common_1.validateRequiredField)(tx, 'Destination', common_1.isAccount);
|
23933
23222
|
(0, common_1.validateOptionalField)(tx, 'DestinationTag', common_1.isNumber);
|
23934
|
-
if (typeof tx.SendMax !== 'string' &&
|
23935
|
-
!(0, common_1.isIssuedCurrency)(tx.SendMax)) {
|
23223
|
+
if (typeof tx.SendMax !== 'string' && !(0, common_1.isIssuedCurrencyAmount)(tx.SendMax)) {
|
23936
23224
|
throw new errors_1.ValidationError('CheckCreate: invalid SendMax');
|
23937
23225
|
}
|
23938
23226
|
if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
|
@@ -23961,20 +23249,18 @@ const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js")
|
|
23961
23249
|
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
23962
23250
|
function validateClawback(tx) {
|
23963
23251
|
(0, common_1.validateBaseTransaction)(tx);
|
23252
|
+
(0, common_1.validateRequiredField)(tx, 'Amount', common_1.isClawbackAmount);
|
23964
23253
|
(0, common_1.validateOptionalField)(tx, 'Holder', common_1.isAccount);
|
23965
|
-
if (tx.Amount
|
23966
|
-
throw new errors_1.ValidationError('Clawback: missing field Amount');
|
23967
|
-
}
|
23968
|
-
if (!(0, common_1.isIssuedCurrency)(tx.Amount) && !(0, common_1.isMPTAmount)(tx.Amount)) {
|
23254
|
+
if (!(0, common_1.isIssuedCurrencyAmount)(tx.Amount) && !(0, common_1.isMPTAmount)(tx.Amount)) {
|
23969
23255
|
throw new errors_1.ValidationError('Clawback: invalid Amount');
|
23970
23256
|
}
|
23971
|
-
if ((0, common_1.
|
23257
|
+
if ((0, common_1.isIssuedCurrencyAmount)(tx.Amount) && tx.Account === tx.Amount.issuer) {
|
23972
23258
|
throw new errors_1.ValidationError('Clawback: invalid holder Account');
|
23973
23259
|
}
|
23974
23260
|
if ((0, common_1.isMPTAmount)(tx.Amount) && tx.Account === tx.Holder) {
|
23975
23261
|
throw new errors_1.ValidationError('Clawback: invalid holder Account');
|
23976
23262
|
}
|
23977
|
-
if ((0, common_1.
|
23263
|
+
if ((0, common_1.isIssuedCurrencyAmount)(tx.Amount) && tx.Holder) {
|
23978
23264
|
throw new errors_1.ValidationError('Clawback: cannot have Holder for currency');
|
23979
23265
|
}
|
23980
23266
|
if ((0, common_1.isMPTAmount)(tx.Amount) && !tx.Holder) {
|
@@ -23995,7 +23281,7 @@ exports.validateClawback = validateClawback;
|
|
23995
23281
|
"use strict";
|
23996
23282
|
|
23997
23283
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
23998
|
-
exports.containsDuplicates = exports.validateCredentialsList = exports.validateCredentialType = exports.parseAmountValue = exports.validateBaseTransaction = exports.GlobalFlags = exports.validateOptionalField = exports.validateRequiredField = exports.isArray = exports.isXChainBridge = exports.isAmount = exports.isAccount = exports.isMPTAmount = exports.isAuthorizeCredential = exports.isIssuedCurrency = exports.isCurrency = exports.isNumber = exports.isString = exports.isRecord = exports.MAX_AUTHORIZED_CREDENTIALS = void 0;
|
23284
|
+
exports.validateMPTokenMetadata = exports.isDomainID = exports.containsDuplicates = exports.validateCredentialsList = exports.validateCredentialType = exports.parseAmountValue = exports.validateBaseTransaction = exports.GlobalFlags = exports.validateOptionalField = exports.validateRequiredField = exports.isArray = exports.isXChainBridge = exports.isAmount = exports.isAccount = exports.isClawbackAmount = exports.isMPTAmount = exports.isAuthorizeCredential = exports.isIssuedCurrencyAmount = exports.isIssuedCurrency = exports.isCurrency = exports.isXRPLNumber = exports.isNumber = exports.isString = exports.isRecord = exports.MPT_META_WARNING_HEADER = exports.VAULT_DATA_MAX_BYTE_LENGTH = exports.MAX_MPT_META_BYTE_LENGTH = exports.MAX_AUTHORIZED_CREDENTIALS = void 0;
|
23999
23285
|
const utils_1 = __webpack_require__(/*! @xrplf/isomorphic/utils */ "../../node_modules/@xrplf/isomorphic/dist/utils/browser.js");
|
24000
23286
|
const ripple_address_codec_1 = __webpack_require__(/*! ripple-address-codec */ "../../node_modules/ripple-address-codec/dist/index.js");
|
24001
23287
|
const ripple_binary_codec_1 = __webpack_require__(/*! ripple-binary-codec */ "../../node_modules/ripple-binary-codec/dist/index.js");
|
@@ -24005,15 +23291,51 @@ const MEMO_SIZE = 3;
|
|
24005
23291
|
exports.MAX_AUTHORIZED_CREDENTIALS = 8;
|
24006
23292
|
const MAX_CREDENTIAL_BYTE_LENGTH = 64;
|
24007
23293
|
const MAX_CREDENTIAL_TYPE_LENGTH = MAX_CREDENTIAL_BYTE_LENGTH * 2;
|
23294
|
+
exports.MAX_MPT_META_BYTE_LENGTH = 1024;
|
23295
|
+
exports.VAULT_DATA_MAX_BYTE_LENGTH = 256;
|
23296
|
+
const TICKER_REGEX = /^[A-Z0-9]{1,6}$/u;
|
23297
|
+
const MAX_MPT_META_TOP_LEVEL_FIELD_COUNT = 9;
|
23298
|
+
const MPT_META_URL_FIELD_COUNT = 3;
|
23299
|
+
const MPT_META_REQUIRED_FIELDS = [
|
23300
|
+
'ticker',
|
23301
|
+
'name',
|
23302
|
+
'icon',
|
23303
|
+
'asset_class',
|
23304
|
+
'issuer_name',
|
23305
|
+
];
|
23306
|
+
const MPT_META_ASSET_CLASSES = [
|
23307
|
+
'rwa',
|
23308
|
+
'memes',
|
23309
|
+
'wrapped',
|
23310
|
+
'gaming',
|
23311
|
+
'defi',
|
23312
|
+
'other',
|
23313
|
+
];
|
23314
|
+
const MPT_META_ASSET_SUB_CLASSES = [
|
23315
|
+
'stablecoin',
|
23316
|
+
'commodity',
|
23317
|
+
'real_estate',
|
23318
|
+
'private_credit',
|
23319
|
+
'equity',
|
23320
|
+
'treasury',
|
23321
|
+
'other',
|
23322
|
+
];
|
23323
|
+
exports.MPT_META_WARNING_HEADER = 'MPTokenMetadata is not properly formatted as JSON as per the XLS-89d standard. ' +
|
23324
|
+
"While adherence to this standard is not mandatory, such non-compliant MPToken's might not be discoverable " +
|
23325
|
+
'by Explorers and Indexers in the XRPL ecosystem.';
|
24008
23326
|
function isMemo(obj) {
|
24009
|
-
if (obj
|
23327
|
+
if (!isRecord(obj)) {
|
24010
23328
|
return false;
|
24011
23329
|
}
|
24012
23330
|
const memo = obj.Memo;
|
23331
|
+
if (!isRecord(memo)) {
|
23332
|
+
return false;
|
23333
|
+
}
|
24013
23334
|
const size = Object.keys(memo).length;
|
24014
|
-
const validData = memo.MemoData == null ||
|
24015
|
-
const validFormat = memo.MemoFormat == null ||
|
24016
|
-
|
23335
|
+
const validData = memo.MemoData == null || (isString(memo.MemoData) && (0, utils_2.isHex)(memo.MemoData));
|
23336
|
+
const validFormat = memo.MemoFormat == null ||
|
23337
|
+
(isString(memo.MemoFormat) && (0, utils_2.isHex)(memo.MemoFormat));
|
23338
|
+
const validType = memo.MemoType == null || (isString(memo.MemoType) && (0, utils_2.isHex)(memo.MemoType));
|
24017
23339
|
return (size >= 1 &&
|
24018
23340
|
size <= MEMO_SIZE &&
|
24019
23341
|
validData &&
|
@@ -24023,15 +23345,17 @@ function isMemo(obj) {
|
|
24023
23345
|
}
|
24024
23346
|
const SIGNER_SIZE = 3;
|
24025
23347
|
function isSigner(obj) {
|
24026
|
-
|
24027
|
-
|
23348
|
+
if (!isRecord(obj)) {
|
23349
|
+
return false;
|
23350
|
+
}
|
23351
|
+
const signer = obj.Signer;
|
23352
|
+
if (!isRecord(signer)) {
|
24028
23353
|
return false;
|
24029
23354
|
}
|
24030
|
-
const signer = signerWrapper.Signer;
|
24031
23355
|
return (Object.keys(signer).length === SIGNER_SIZE &&
|
24032
|
-
|
24033
|
-
|
24034
|
-
|
23356
|
+
isString(signer.Account) &&
|
23357
|
+
isString(signer.TxnSignature) &&
|
23358
|
+
isString(signer.SigningPubKey));
|
24035
23359
|
}
|
24036
23360
|
const XRP_CURRENCY_SIZE = 1;
|
24037
23361
|
const ISSUE_SIZE = 2;
|
@@ -24040,7 +23364,7 @@ const XCHAIN_BRIDGE_SIZE = 4;
|
|
24040
23364
|
const MPTOKEN_SIZE = 2;
|
24041
23365
|
const AUTHORIZE_CREDENTIAL_SIZE = 1;
|
24042
23366
|
function isRecord(value) {
|
24043
|
-
return value !== null && typeof value === 'object';
|
23367
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
24044
23368
|
}
|
24045
23369
|
exports.isRecord = isRecord;
|
24046
23370
|
function isString(str) {
|
@@ -24051,23 +23375,32 @@ function isNumber(num) {
|
|
24051
23375
|
return typeof num === 'number';
|
24052
23376
|
}
|
24053
23377
|
exports.isNumber = isNumber;
|
23378
|
+
function isXRPLNumber(value) {
|
23379
|
+
return (typeof value === 'string' &&
|
23380
|
+
/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/u.test(value.trim()));
|
23381
|
+
}
|
23382
|
+
exports.isXRPLNumber = isXRPLNumber;
|
24054
23383
|
function isCurrency(input) {
|
23384
|
+
return isString(input) || isIssuedCurrency(input);
|
23385
|
+
}
|
23386
|
+
exports.isCurrency = isCurrency;
|
23387
|
+
function isIssuedCurrency(input) {
|
24055
23388
|
return (isRecord(input) &&
|
24056
23389
|
((Object.keys(input).length === ISSUE_SIZE &&
|
24057
|
-
|
24058
|
-
|
23390
|
+
isString(input.issuer) &&
|
23391
|
+
isString(input.currency)) ||
|
24059
23392
|
(Object.keys(input).length === XRP_CURRENCY_SIZE &&
|
24060
23393
|
input.currency === 'XRP')));
|
24061
23394
|
}
|
24062
|
-
exports.
|
24063
|
-
function
|
23395
|
+
exports.isIssuedCurrency = isIssuedCurrency;
|
23396
|
+
function isIssuedCurrencyAmount(input) {
|
24064
23397
|
return (isRecord(input) &&
|
24065
23398
|
Object.keys(input).length === ISSUED_CURRENCY_SIZE &&
|
24066
|
-
|
24067
|
-
|
24068
|
-
|
23399
|
+
isString(input.value) &&
|
23400
|
+
isString(input.issuer) &&
|
23401
|
+
isString(input.currency));
|
24069
23402
|
}
|
24070
|
-
exports.
|
23403
|
+
exports.isIssuedCurrencyAmount = isIssuedCurrencyAmount;
|
24071
23404
|
function isAuthorizeCredential(input) {
|
24072
23405
|
return (isRecord(input) &&
|
24073
23406
|
isRecord(input.Credential) &&
|
@@ -24083,6 +23416,10 @@ function isMPTAmount(input) {
|
|
24083
23416
|
typeof input.mpt_issuance_id === 'string');
|
24084
23417
|
}
|
24085
23418
|
exports.isMPTAmount = isMPTAmount;
|
23419
|
+
function isClawbackAmount(input) {
|
23420
|
+
return isIssuedCurrencyAmount(input) || isMPTAmount(input);
|
23421
|
+
}
|
23422
|
+
exports.isClawbackAmount = isClawbackAmount;
|
24086
23423
|
function isAccount(account) {
|
24087
23424
|
return (typeof account === 'string' &&
|
24088
23425
|
((0, ripple_address_codec_1.isValidClassicAddress)(account) || (0, ripple_address_codec_1.isValidXAddress)(account)));
|
@@ -24090,7 +23427,7 @@ function isAccount(account) {
|
|
24090
23427
|
exports.isAccount = isAccount;
|
24091
23428
|
function isAmount(amount) {
|
24092
23429
|
return (typeof amount === 'string' ||
|
24093
|
-
|
23430
|
+
isIssuedCurrencyAmount(amount) ||
|
24094
23431
|
isMPTAmount(amount));
|
24095
23432
|
}
|
24096
23433
|
exports.isAmount = isAmount;
|
@@ -24098,13 +23435,13 @@ function isXChainBridge(input) {
|
|
24098
23435
|
return (isRecord(input) &&
|
24099
23436
|
Object.keys(input).length === XCHAIN_BRIDGE_SIZE &&
|
24100
23437
|
typeof input.LockingChainDoor === 'string' &&
|
24101
|
-
|
23438
|
+
isIssuedCurrency(input.LockingChainIssue) &&
|
24102
23439
|
typeof input.IssuingChainDoor === 'string' &&
|
24103
|
-
|
23440
|
+
isIssuedCurrency(input.IssuingChainIssue));
|
24104
23441
|
}
|
24105
23442
|
exports.isXChainBridge = isXChainBridge;
|
24106
23443
|
function isArray(input) {
|
24107
|
-
return Array.isArray(input);
|
23444
|
+
return input != null && Array.isArray(input);
|
24108
23445
|
}
|
24109
23446
|
exports.isArray = isArray;
|
24110
23447
|
function validateRequiredField(tx, param, checkValidity, errorOpts = {}) {
|
@@ -24133,6 +23470,9 @@ var GlobalFlags;
|
|
24133
23470
|
GlobalFlags[GlobalFlags["tfInnerBatchTxn"] = 1073741824] = "tfInnerBatchTxn";
|
24134
23471
|
})(GlobalFlags || (exports.GlobalFlags = GlobalFlags = {}));
|
24135
23472
|
function validateBaseTransaction(common) {
|
23473
|
+
if (!isRecord(common)) {
|
23474
|
+
throw new errors_1.ValidationError('BaseTransaction: invalid, expected a valid object');
|
23475
|
+
}
|
24136
23476
|
if (common.TransactionType === undefined) {
|
24137
23477
|
throw new errors_1.ValidationError('BaseTransaction: missing field TransactionType');
|
24138
23478
|
}
|
@@ -24148,12 +23488,12 @@ function validateBaseTransaction(common) {
|
|
24148
23488
|
validateOptionalField(common, 'AccountTxnID', isString);
|
24149
23489
|
validateOptionalField(common, 'LastLedgerSequence', isNumber);
|
24150
23490
|
const memos = common.Memos;
|
24151
|
-
if (memos
|
23491
|
+
if (memos != null && (!isArray(memos) || !memos.every(isMemo))) {
|
24152
23492
|
throw new errors_1.ValidationError('BaseTransaction: invalid Memos');
|
24153
23493
|
}
|
24154
23494
|
const signers = common.Signers;
|
24155
|
-
if (signers
|
24156
|
-
(signers.length === 0 || !signers.every(isSigner))) {
|
23495
|
+
if (signers != null &&
|
23496
|
+
(!isArray(signers) || signers.length === 0 || !signers.every(isSigner))) {
|
24157
23497
|
throw new errors_1.ValidationError('BaseTransaction: invalid Signers');
|
24158
23498
|
}
|
24159
23499
|
validateOptionalField(common, 'SourceTag', isNumber);
|
@@ -24203,7 +23543,7 @@ function validateCredentialsList(credentials, transactionType, isStringID, maxCr
|
|
24203
23543
|
if (credentials == null) {
|
24204
23544
|
return;
|
24205
23545
|
}
|
24206
|
-
if (!
|
23546
|
+
if (!isArray(credentials)) {
|
24207
23547
|
throw new errors_1.ValidationError(`${transactionType}: Credentials must be an array`);
|
24208
23548
|
}
|
24209
23549
|
if (credentials.length > maxCredentials) {
|
@@ -24248,6 +23588,108 @@ function containsDuplicates(objectList) {
|
|
24248
23588
|
return false;
|
24249
23589
|
}
|
24250
23590
|
exports.containsDuplicates = containsDuplicates;
|
23591
|
+
const _DOMAIN_ID_LENGTH = 64;
|
23592
|
+
function isDomainID(domainID) {
|
23593
|
+
return (isString(domainID) &&
|
23594
|
+
domainID.length === _DOMAIN_ID_LENGTH &&
|
23595
|
+
(0, utils_2.isHex)(domainID));
|
23596
|
+
}
|
23597
|
+
exports.isDomainID = isDomainID;
|
23598
|
+
function validateMPTokenMetadata(input) {
|
23599
|
+
const validationMessages = [];
|
23600
|
+
if (!(0, utils_2.isHex)(input)) {
|
23601
|
+
validationMessages.push(`MPTokenMetadata must be in hex format.`);
|
23602
|
+
return validationMessages;
|
23603
|
+
}
|
23604
|
+
if (input.length / 2 > exports.MAX_MPT_META_BYTE_LENGTH) {
|
23605
|
+
validationMessages.push(`MPTokenMetadata must be max ${exports.MAX_MPT_META_BYTE_LENGTH} bytes.`);
|
23606
|
+
return validationMessages;
|
23607
|
+
}
|
23608
|
+
let jsonMetaData;
|
23609
|
+
try {
|
23610
|
+
jsonMetaData = JSON.parse((0, utils_1.hexToString)(input));
|
23611
|
+
}
|
23612
|
+
catch (err) {
|
23613
|
+
validationMessages.push(`MPTokenMetadata is not properly formatted as JSON - ${String(err)}`);
|
23614
|
+
return validationMessages;
|
23615
|
+
}
|
23616
|
+
if (jsonMetaData == null ||
|
23617
|
+
typeof jsonMetaData !== 'object' ||
|
23618
|
+
Array.isArray(jsonMetaData)) {
|
23619
|
+
validationMessages.push('MPTokenMetadata is not properly formatted as per XLS-89d.');
|
23620
|
+
return validationMessages;
|
23621
|
+
}
|
23622
|
+
const obj = jsonMetaData;
|
23623
|
+
const fieldCount = Object.keys(obj).length;
|
23624
|
+
if (fieldCount > MAX_MPT_META_TOP_LEVEL_FIELD_COUNT) {
|
23625
|
+
validationMessages.push(`MPTokenMetadata must not contain more than ${MAX_MPT_META_TOP_LEVEL_FIELD_COUNT} top-level fields (found ${fieldCount}).`);
|
23626
|
+
return validationMessages;
|
23627
|
+
}
|
23628
|
+
const incorrectRequiredFields = MPT_META_REQUIRED_FIELDS.filter((field) => !isString(obj[field]));
|
23629
|
+
if (incorrectRequiredFields.length > 0) {
|
23630
|
+
incorrectRequiredFields.forEach((field) => validationMessages.push(`${field} is required and must be string.`));
|
23631
|
+
return validationMessages;
|
23632
|
+
}
|
23633
|
+
if (obj.desc != null && !isString(obj.desc)) {
|
23634
|
+
validationMessages.push(`desc must be a string.`);
|
23635
|
+
return validationMessages;
|
23636
|
+
}
|
23637
|
+
if (obj.asset_subclass != null && !isString(obj.asset_subclass)) {
|
23638
|
+
validationMessages.push(`asset_subclass must be a string.`);
|
23639
|
+
return validationMessages;
|
23640
|
+
}
|
23641
|
+
if (obj.additional_info != null &&
|
23642
|
+
!isString(obj.additional_info) &&
|
23643
|
+
!isRecord(obj.additional_info)) {
|
23644
|
+
validationMessages.push(`additional_info must be a string or JSON object.`);
|
23645
|
+
return validationMessages;
|
23646
|
+
}
|
23647
|
+
if (obj.urls != null) {
|
23648
|
+
if (!Array.isArray(obj.urls)) {
|
23649
|
+
validationMessages.push('urls must be an array as per XLS-89d.');
|
23650
|
+
return validationMessages;
|
23651
|
+
}
|
23652
|
+
if (!obj.urls.every(isValidMPTokenMetadataUrlStructure)) {
|
23653
|
+
validationMessages.push('One or more urls are not structured per XLS-89d.');
|
23654
|
+
return validationMessages;
|
23655
|
+
}
|
23656
|
+
}
|
23657
|
+
const mptMPTokenMetadata = obj;
|
23658
|
+
if (!TICKER_REGEX.test(mptMPTokenMetadata.ticker)) {
|
23659
|
+
validationMessages.push(`ticker should have uppercase letters (A-Z) and digits (0-9) only. Max 6 characters recommended.`);
|
23660
|
+
}
|
23661
|
+
if (!mptMPTokenMetadata.icon.startsWith('https://')) {
|
23662
|
+
validationMessages.push(`icon should be a valid https url.`);
|
23663
|
+
}
|
23664
|
+
if (!MPT_META_ASSET_CLASSES.includes(mptMPTokenMetadata.asset_class.toLowerCase())) {
|
23665
|
+
validationMessages.push(`asset_class should be one of ${MPT_META_ASSET_CLASSES.join(', ')}.`);
|
23666
|
+
}
|
23667
|
+
if (mptMPTokenMetadata.asset_subclass != null &&
|
23668
|
+
!MPT_META_ASSET_SUB_CLASSES.includes(mptMPTokenMetadata.asset_subclass.toLowerCase())) {
|
23669
|
+
validationMessages.push(`asset_subclass should be one of ${MPT_META_ASSET_SUB_CLASSES.join(', ')}.`);
|
23670
|
+
}
|
23671
|
+
if (mptMPTokenMetadata.asset_class.toLowerCase() === 'rwa' &&
|
23672
|
+
mptMPTokenMetadata.asset_subclass == null) {
|
23673
|
+
validationMessages.push(`asset_subclass is required when asset_class is rwa.`);
|
23674
|
+
}
|
23675
|
+
if (mptMPTokenMetadata.urls != null &&
|
23676
|
+
!mptMPTokenMetadata.urls.every((ele) => ele.url.startsWith('https://'))) {
|
23677
|
+
validationMessages.push(`url should be a valid https url.`);
|
23678
|
+
}
|
23679
|
+
return validationMessages;
|
23680
|
+
}
|
23681
|
+
exports.validateMPTokenMetadata = validateMPTokenMetadata;
|
23682
|
+
function isValidMPTokenMetadataUrlStructure(input) {
|
23683
|
+
if (input == null) {
|
23684
|
+
return false;
|
23685
|
+
}
|
23686
|
+
const obj = input;
|
23687
|
+
return (typeof obj === 'object' &&
|
23688
|
+
isString(obj.url) &&
|
23689
|
+
isString(obj.type) &&
|
23690
|
+
isString(obj.title) &&
|
23691
|
+
Object.keys(obj).length === MPT_META_URL_FIELD_COUNT);
|
23692
|
+
}
|
24251
23693
|
|
24252
23694
|
|
24253
23695
|
/***/ }),
|
@@ -24433,12 +23875,7 @@ const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js")
|
|
24433
23875
|
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24434
23876
|
function validateEscrowCreate(tx) {
|
24435
23877
|
(0, common_1.validateBaseTransaction)(tx);
|
24436
|
-
|
24437
|
-
throw new errors_1.ValidationError('EscrowCreate: missing field Amount');
|
24438
|
-
}
|
24439
|
-
if (typeof tx.Amount !== 'string') {
|
24440
|
-
throw new errors_1.ValidationError('EscrowCreate: Amount must be a string');
|
24441
|
-
}
|
23878
|
+
(0, common_1.validateRequiredField)(tx, 'Amount', common_1.isAmount);
|
24442
23879
|
(0, common_1.validateRequiredField)(tx, 'Destination', common_1.isAccount);
|
24443
23880
|
(0, common_1.validateOptionalField)(tx, 'DestinationTag', common_1.isNumber);
|
24444
23881
|
if (tx.CancelAfter === undefined && tx.FinishAfter === undefined) {
|
@@ -24521,9 +23958,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
24521
23958
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
24522
23959
|
};
|
24523
23960
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
24524
|
-
exports.XChainModifyBridgeFlags = exports.TrustSetFlags = exports.PaymentChannelClaimFlags = exports.PaymentFlags = exports.OfferCreateFlags = exports.validateNFTokenModify = exports.NFTokenMintFlags = exports.NFTokenCreateOfferFlags = exports.MPTokenIssuanceSetFlags = exports.MPTokenIssuanceCreateFlags = exports.MPTokenAuthorizeFlags = exports.EnableAmendmentFlags = exports.AMMWithdrawFlags = exports.AMMDepositFlags = exports.AMMClawbackFlags = exports.AccountSetTfFlags = exports.AccountSetAsfFlags = exports.validate = exports.isMPTAmount = void 0;
|
23961
|
+
exports.XChainModifyBridgeFlags = exports.VaultWithdrawalPolicy = exports.VaultCreateFlags = exports.TrustSetFlags = exports.PaymentChannelClaimFlags = exports.PaymentFlags = exports.OfferCreateFlags = exports.validateNFTokenModify = exports.NFTokenMintFlags = exports.NFTokenCreateOfferFlags = exports.MPTokenIssuanceSetFlags = exports.MPTokenIssuanceCreateFlags = exports.MPTokenAuthorizeFlags = exports.EnableAmendmentFlags = exports.AMMWithdrawFlags = exports.AMMDepositFlags = exports.AMMClawbackFlags = exports.AccountSetTfFlags = exports.AccountSetAsfFlags = exports.validate = exports.validateMPTokenMetadata = exports.isMPTAmount = void 0;
|
24525
23962
|
var common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24526
23963
|
Object.defineProperty(exports, "isMPTAmount", ({ enumerable: true, get: function () { return common_1.isMPTAmount; } }));
|
23964
|
+
Object.defineProperty(exports, "validateMPTokenMetadata", ({ enumerable: true, get: function () { return common_1.validateMPTokenMetadata; } }));
|
24527
23965
|
var transaction_1 = __webpack_require__(/*! ./transaction */ "./dist/npm/models/transactions/transaction.js");
|
24528
23966
|
Object.defineProperty(exports, "validate", ({ enumerable: true, get: function () { return transaction_1.validate; } }));
|
24529
23967
|
__exportStar(__webpack_require__(/*! ./metadata */ "./dist/npm/models/transactions/metadata.js"), exports);
|
@@ -24558,6 +23996,9 @@ var paymentChannelClaim_1 = __webpack_require__(/*! ./paymentChannelClaim */ "./
|
|
24558
23996
|
Object.defineProperty(exports, "PaymentChannelClaimFlags", ({ enumerable: true, get: function () { return paymentChannelClaim_1.PaymentChannelClaimFlags; } }));
|
24559
23997
|
var trustSet_1 = __webpack_require__(/*! ./trustSet */ "./dist/npm/models/transactions/trustSet.js");
|
24560
23998
|
Object.defineProperty(exports, "TrustSetFlags", ({ enumerable: true, get: function () { return trustSet_1.TrustSetFlags; } }));
|
23999
|
+
var vaultCreate_1 = __webpack_require__(/*! ./vaultCreate */ "./dist/npm/models/transactions/vaultCreate.js");
|
24000
|
+
Object.defineProperty(exports, "VaultCreateFlags", ({ enumerable: true, get: function () { return vaultCreate_1.VaultCreateFlags; } }));
|
24001
|
+
Object.defineProperty(exports, "VaultWithdrawalPolicy", ({ enumerable: true, get: function () { return vaultCreate_1.VaultWithdrawalPolicy; } }));
|
24561
24002
|
var XChainModifyBridge_1 = __webpack_require__(/*! ./XChainModifyBridge */ "./dist/npm/models/transactions/XChainModifyBridge.js");
|
24562
24003
|
Object.defineProperty(exports, "XChainModifyBridgeFlags", ({ enumerable: true, get: function () { return XChainModifyBridge_1.XChainModifyBridgeFlags; } }));
|
24563
24004
|
|
@@ -24627,6 +24068,7 @@ exports.validateOfferCancel = validateOfferCancel;
|
|
24627
24068
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
24628
24069
|
exports.validateOfferCreate = exports.OfferCreateFlags = void 0;
|
24629
24070
|
const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js");
|
24071
|
+
const utils_1 = __webpack_require__(/*! ../utils */ "./dist/npm/models/utils/index.js");
|
24630
24072
|
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24631
24073
|
var OfferCreateFlags;
|
24632
24074
|
(function (OfferCreateFlags) {
|
@@ -24634,6 +24076,7 @@ var OfferCreateFlags;
|
|
24634
24076
|
OfferCreateFlags[OfferCreateFlags["tfImmediateOrCancel"] = 131072] = "tfImmediateOrCancel";
|
24635
24077
|
OfferCreateFlags[OfferCreateFlags["tfFillOrKill"] = 262144] = "tfFillOrKill";
|
24636
24078
|
OfferCreateFlags[OfferCreateFlags["tfSell"] = 524288] = "tfSell";
|
24079
|
+
OfferCreateFlags[OfferCreateFlags["tfHybrid"] = 1048576] = "tfHybrid";
|
24637
24080
|
})(OfferCreateFlags || (exports.OfferCreateFlags = OfferCreateFlags = {}));
|
24638
24081
|
function validateOfferCreate(tx) {
|
24639
24082
|
(0, common_1.validateBaseTransaction)(tx);
|
@@ -24655,6 +24098,14 @@ function validateOfferCreate(tx) {
|
|
24655
24098
|
if (tx.OfferSequence !== undefined && typeof tx.OfferSequence !== 'number') {
|
24656
24099
|
throw new errors_1.ValidationError('OfferCreate: invalid OfferSequence');
|
24657
24100
|
}
|
24101
|
+
(0, common_1.validateOptionalField)(tx, 'DomainID', common_1.isDomainID, {
|
24102
|
+
txType: 'OfferCreate',
|
24103
|
+
paramName: 'DomainID',
|
24104
|
+
});
|
24105
|
+
if (tx.DomainID == null &&
|
24106
|
+
(0, utils_1.hasFlag)(tx, OfferCreateFlags.tfHybrid, 'tfHybrid')) {
|
24107
|
+
throw new errors_1.ValidationError('OfferCreate: tfHybrid flag cannot be set if DomainID is not present');
|
24108
|
+
}
|
24658
24109
|
}
|
24659
24110
|
exports.validateOfferCreate = validateOfferCreate;
|
24660
24111
|
|
@@ -24706,54 +24157,55 @@ function validateOracleSet(tx) {
|
|
24706
24157
|
(0, common_1.validateOptionalField)(tx, 'URI', common_1.isString);
|
24707
24158
|
(0, common_1.validateOptionalField)(tx, 'AssetClass', common_1.isString);
|
24708
24159
|
(0, common_1.validateRequiredField)(tx, 'PriceDataSeries', (value) => {
|
24709
|
-
if (!
|
24160
|
+
if (!(0, common_1.isArray)(value)) {
|
24710
24161
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must be an array');
|
24711
24162
|
}
|
24712
24163
|
if (value.length > PRICE_DATA_SERIES_MAX_LENGTH) {
|
24713
24164
|
throw new errors_1.ValidationError(`OracleSet: PriceDataSeries must have at most ${PRICE_DATA_SERIES_MAX_LENGTH} PriceData objects`);
|
24714
24165
|
}
|
24715
24166
|
for (const priceData of value) {
|
24716
|
-
if (
|
24167
|
+
if (!(0, common_1.isRecord)(priceData)) {
|
24717
24168
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must be an array of objects');
|
24718
24169
|
}
|
24719
|
-
|
24170
|
+
const priceDataInner = priceData.PriceData;
|
24171
|
+
if (!(0, common_1.isRecord)(priceDataInner)) {
|
24720
24172
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must have a `PriceData` object');
|
24721
24173
|
}
|
24722
24174
|
if (Object.keys(priceData).length !== 1) {
|
24723
24175
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must only have a single PriceData object');
|
24724
24176
|
}
|
24725
|
-
if (
|
24177
|
+
if (priceDataInner.BaseAsset == null ||
|
24178
|
+
typeof priceDataInner.BaseAsset !== 'string') {
|
24726
24179
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must have a `BaseAsset` string');
|
24727
24180
|
}
|
24728
|
-
if (typeof
|
24181
|
+
if (typeof priceDataInner.QuoteAsset !== 'string') {
|
24729
24182
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must have a `QuoteAsset` string');
|
24730
24183
|
}
|
24731
|
-
if ((
|
24732
|
-
(
|
24184
|
+
if ((priceDataInner.AssetPrice == null) !==
|
24185
|
+
(priceDataInner.Scale == null)) {
|
24733
24186
|
throw new errors_1.ValidationError('OracleSet: PriceDataSeries must have both `AssetPrice` and `Scale` if any are present');
|
24734
24187
|
}
|
24735
|
-
if ('AssetPrice' in
|
24736
|
-
if (!(0, common_1.isNumber)(
|
24737
|
-
if (typeof
|
24188
|
+
if ('AssetPrice' in priceDataInner) {
|
24189
|
+
if (!(0, common_1.isNumber)(priceDataInner.AssetPrice)) {
|
24190
|
+
if (typeof priceDataInner.AssetPrice !== 'string') {
|
24738
24191
|
throw new errors_1.ValidationError('OracleSet: Field AssetPrice must be a string or a number');
|
24739
24192
|
}
|
24740
|
-
if (!(0, utils_1.isHex)(
|
24193
|
+
if (!(0, utils_1.isHex)(priceDataInner.AssetPrice)) {
|
24741
24194
|
throw new errors_1.ValidationError('OracleSet: Field AssetPrice must be a valid hex string');
|
24742
24195
|
}
|
24743
|
-
if (
|
24744
|
-
|
24745
|
-
priceData.PriceData.AssetPrice.length > MAXIMUM_ASSET_PRICE_LENGTH) {
|
24196
|
+
if (priceDataInner.AssetPrice.length < MINIMUM_ASSET_PRICE_LENGTH ||
|
24197
|
+
priceDataInner.AssetPrice.length > MAXIMUM_ASSET_PRICE_LENGTH) {
|
24746
24198
|
throw new errors_1.ValidationError(`OracleSet: Length of AssetPrice field must be between ${MINIMUM_ASSET_PRICE_LENGTH} and ${MAXIMUM_ASSET_PRICE_LENGTH} characters long`);
|
24747
24199
|
}
|
24748
24200
|
}
|
24749
24201
|
}
|
24750
|
-
if ('Scale' in
|
24751
|
-
!(0, common_1.isNumber)(
|
24752
|
-
|
24753
|
-
|
24754
|
-
|
24755
|
-
|
24756
|
-
|
24202
|
+
if ('Scale' in priceDataInner) {
|
24203
|
+
if (!(0, common_1.isNumber)(priceDataInner.Scale)) {
|
24204
|
+
throw new errors_1.ValidationError('OracleSet: invalid field Scale');
|
24205
|
+
}
|
24206
|
+
if (priceDataInner.Scale < 0 || priceDataInner.Scale > SCALE_MAX) {
|
24207
|
+
throw new errors_1.ValidationError(`OracleSet: Scale must be in range 0-${SCALE_MAX}`);
|
24208
|
+
}
|
24757
24209
|
}
|
24758
24210
|
}
|
24759
24211
|
return true;
|
@@ -24797,8 +24249,11 @@ function validatePayment(tx) {
|
|
24797
24249
|
if (tx.InvoiceID !== undefined && typeof tx.InvoiceID !== 'string') {
|
24798
24250
|
throw new errors_1.ValidationError('PaymentTransaction: InvoiceID must be a string');
|
24799
24251
|
}
|
24800
|
-
|
24801
|
-
|
24252
|
+
(0, common_1.validateOptionalField)(tx, 'DomainID', common_1.isDomainID, {
|
24253
|
+
txType: 'PaymentTransaction',
|
24254
|
+
paramName: 'DomainID',
|
24255
|
+
});
|
24256
|
+
if (tx.Paths !== undefined && !isPaths(tx.Paths)) {
|
24802
24257
|
throw new errors_1.ValidationError('PaymentTransaction: invalid Paths');
|
24803
24258
|
}
|
24804
24259
|
if (tx.SendMax !== undefined && !(0, common_1.isAmount)(tx.SendMax)) {
|
@@ -24858,11 +24313,11 @@ function isPath(path) {
|
|
24858
24313
|
return true;
|
24859
24314
|
}
|
24860
24315
|
function isPaths(paths) {
|
24861
|
-
if (!
|
24316
|
+
if (!(0, common_1.isArray)(paths) || paths.length === 0) {
|
24862
24317
|
return false;
|
24863
24318
|
}
|
24864
24319
|
for (const path of paths) {
|
24865
|
-
if (!
|
24320
|
+
if (!(0, common_1.isArray)(path) || path.length === 0) {
|
24866
24321
|
return false;
|
24867
24322
|
}
|
24868
24323
|
if (!isPath(path)) {
|
@@ -25079,21 +24534,11 @@ const MAX_SIGNERS = 32;
|
|
25079
24534
|
const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u;
|
25080
24535
|
function validateSignerListSet(tx) {
|
25081
24536
|
(0, common_1.validateBaseTransaction)(tx);
|
25082
|
-
|
25083
|
-
throw new errors_1.ValidationError('SignerListSet: missing field SignerQuorum');
|
25084
|
-
}
|
25085
|
-
if (typeof tx.SignerQuorum !== 'number') {
|
25086
|
-
throw new errors_1.ValidationError('SignerListSet: invalid SignerQuorum');
|
25087
|
-
}
|
24537
|
+
(0, common_1.validateRequiredField)(tx, 'SignerQuorum', common_1.isNumber);
|
25088
24538
|
if (tx.SignerQuorum === 0) {
|
25089
24539
|
return;
|
25090
24540
|
}
|
25091
|
-
|
25092
|
-
throw new errors_1.ValidationError('SignerListSet: missing field SignerEntries');
|
25093
|
-
}
|
25094
|
-
if (!(0, common_1.isArray)(tx.SignerEntries)) {
|
25095
|
-
throw new errors_1.ValidationError('SignerListSet: invalid SignerEntries');
|
25096
|
-
}
|
24541
|
+
(0, common_1.validateRequiredField)(tx, 'SignerEntries', common_1.isArray);
|
25097
24542
|
if (tx.SignerEntries.length === 0) {
|
25098
24543
|
throw new errors_1.ValidationError('SignerListSet: need at least 1 member in SignerEntries');
|
25099
24544
|
}
|
@@ -25101,10 +24546,14 @@ function validateSignerListSet(tx) {
|
|
25101
24546
|
throw new errors_1.ValidationError(`SignerListSet: maximum of ${MAX_SIGNERS} members allowed in SignerEntries`);
|
25102
24547
|
}
|
25103
24548
|
for (const entry of tx.SignerEntries) {
|
25104
|
-
|
25105
|
-
|
25106
|
-
|
25107
|
-
|
24549
|
+
if (!(0, common_1.isRecord)(entry) || !(0, common_1.isRecord)(entry.SignerEntry)) {
|
24550
|
+
throw new errors_1.ValidationError('SignerListSet: SignerEntries must be an array of SignerEntry objects');
|
24551
|
+
}
|
24552
|
+
const signerEntry = entry.SignerEntry;
|
24553
|
+
const { WalletLocator } = signerEntry;
|
24554
|
+
if (WalletLocator != null &&
|
24555
|
+
(!(0, common_1.isString)(WalletLocator) ||
|
24556
|
+
!HEX_WALLET_LOCATOR_REGEX.test(WalletLocator))) {
|
25108
24557
|
throw new errors_1.ValidationError(`SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value`);
|
25109
24558
|
}
|
25110
24559
|
}
|
@@ -25158,7 +24607,6 @@ exports.validateTicketCreate = validateTicketCreate;
|
|
25158
24607
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
25159
24608
|
exports.validate = void 0;
|
25160
24609
|
const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js");
|
25161
|
-
const utils_1 = __webpack_require__(/*! ../utils */ "./dist/npm/models/utils/index.js");
|
25162
24610
|
const flags_1 = __webpack_require__(/*! ../utils/flags */ "./dist/npm/models/utils/flags.js");
|
25163
24611
|
const accountDelete_1 = __webpack_require__(/*! ./accountDelete */ "./dist/npm/models/transactions/accountDelete.js");
|
25164
24612
|
const accountSet_1 = __webpack_require__(/*! ./accountSet */ "./dist/npm/models/transactions/accountSet.js");
|
@@ -25209,6 +24657,12 @@ const setRegularKey_1 = __webpack_require__(/*! ./setRegularKey */ "./dist/npm/m
|
|
25209
24657
|
const signerListSet_1 = __webpack_require__(/*! ./signerListSet */ "./dist/npm/models/transactions/signerListSet.js");
|
25210
24658
|
const ticketCreate_1 = __webpack_require__(/*! ./ticketCreate */ "./dist/npm/models/transactions/ticketCreate.js");
|
25211
24659
|
const trustSet_1 = __webpack_require__(/*! ./trustSet */ "./dist/npm/models/transactions/trustSet.js");
|
24660
|
+
const vaultClawback_1 = __webpack_require__(/*! ./vaultClawback */ "./dist/npm/models/transactions/vaultClawback.js");
|
24661
|
+
const vaultCreate_1 = __webpack_require__(/*! ./vaultCreate */ "./dist/npm/models/transactions/vaultCreate.js");
|
24662
|
+
const vaultDelete_1 = __webpack_require__(/*! ./vaultDelete */ "./dist/npm/models/transactions/vaultDelete.js");
|
24663
|
+
const vaultDeposit_1 = __webpack_require__(/*! ./vaultDeposit */ "./dist/npm/models/transactions/vaultDeposit.js");
|
24664
|
+
const vaultSet_1 = __webpack_require__(/*! ./vaultSet */ "./dist/npm/models/transactions/vaultSet.js");
|
24665
|
+
const vaultWithdraw_1 = __webpack_require__(/*! ./vaultWithdraw */ "./dist/npm/models/transactions/vaultWithdraw.js");
|
25212
24666
|
const XChainAccountCreateCommit_1 = __webpack_require__(/*! ./XChainAccountCreateCommit */ "./dist/npm/models/transactions/XChainAccountCreateCommit.js");
|
25213
24667
|
const XChainAddAccountCreateAttestation_1 = __webpack_require__(/*! ./XChainAddAccountCreateAttestation */ "./dist/npm/models/transactions/XChainAddAccountCreateAttestation.js");
|
25214
24668
|
const XChainAddClaimAttestation_1 = __webpack_require__(/*! ./XChainAddClaimAttestation */ "./dist/npm/models/transactions/XChainAddClaimAttestation.js");
|
@@ -25219,42 +24673,12 @@ const XChainCreateClaimID_1 = __webpack_require__(/*! ./XChainCreateClaimID */ "
|
|
25219
24673
|
const XChainModifyBridge_1 = __webpack_require__(/*! ./XChainModifyBridge */ "./dist/npm/models/transactions/XChainModifyBridge.js");
|
25220
24674
|
function validate(transaction) {
|
25221
24675
|
const tx = Object.assign({}, transaction);
|
25222
|
-
|
25223
|
-
throw new errors_1.ValidationError('Object does not have a `TransactionType`');
|
25224
|
-
}
|
25225
|
-
if (typeof tx.TransactionType !== 'string') {
|
25226
|
-
throw new errors_1.ValidationError("Object's `TransactionType` is not a string");
|
25227
|
-
}
|
25228
|
-
if (tx.Memos != null && typeof tx.Memos !== 'object') {
|
25229
|
-
throw new errors_1.ValidationError('Memo must be array');
|
25230
|
-
}
|
25231
|
-
if (tx.Memos != null) {
|
25232
|
-
;
|
25233
|
-
tx.Memos.forEach((memo) => {
|
25234
|
-
if ((memo === null || memo === void 0 ? void 0 : memo.Memo) == null) {
|
25235
|
-
throw new errors_1.ValidationError('Memo data must be in a `Memo` field');
|
25236
|
-
}
|
25237
|
-
if (memo.Memo.MemoData) {
|
25238
|
-
if (!(0, utils_1.isHex)(memo.Memo.MemoData)) {
|
25239
|
-
throw new errors_1.ValidationError('MemoData field must be a hex value');
|
25240
|
-
}
|
25241
|
-
}
|
25242
|
-
if (memo.Memo.MemoType) {
|
25243
|
-
if (!(0, utils_1.isHex)(memo.Memo.MemoType)) {
|
25244
|
-
throw new errors_1.ValidationError('MemoType field must be a hex value');
|
25245
|
-
}
|
25246
|
-
}
|
25247
|
-
if (memo.Memo.MemoFormat) {
|
25248
|
-
if (!(0, utils_1.isHex)(memo.Memo.MemoFormat)) {
|
25249
|
-
throw new errors_1.ValidationError('MemoFormat field must be a hex value');
|
25250
|
-
}
|
25251
|
-
}
|
25252
|
-
});
|
25253
|
-
}
|
24676
|
+
(0, common_1.validateBaseTransaction)(tx);
|
25254
24677
|
Object.keys(tx).forEach((key) => {
|
25255
24678
|
const standard_currency_code_len = 3;
|
25256
|
-
|
25257
|
-
|
24679
|
+
const value = tx[key];
|
24680
|
+
if (value && (0, common_1.isIssuedCurrencyAmount)(value)) {
|
24681
|
+
const txCurrency = value.currency;
|
25258
24682
|
if (txCurrency.length === standard_currency_code_len &&
|
25259
24683
|
txCurrency.toUpperCase() === 'XRP') {
|
25260
24684
|
throw new errors_1.ValidationError(`Cannot have an issued currency with a similar standard code to XRP (received '${txCurrency}'). XRP is not an issued currency.`);
|
@@ -25410,6 +24834,24 @@ function validate(transaction) {
|
|
25410
24834
|
case 'TrustSet':
|
25411
24835
|
(0, trustSet_1.validateTrustSet)(tx);
|
25412
24836
|
break;
|
24837
|
+
case 'VaultClawback':
|
24838
|
+
(0, vaultClawback_1.validateVaultClawback)(tx);
|
24839
|
+
break;
|
24840
|
+
case 'VaultCreate':
|
24841
|
+
(0, vaultCreate_1.validateVaultCreate)(tx);
|
24842
|
+
break;
|
24843
|
+
case 'VaultDelete':
|
24844
|
+
(0, vaultDelete_1.validateVaultDelete)(tx);
|
24845
|
+
break;
|
24846
|
+
case 'VaultDeposit':
|
24847
|
+
(0, vaultDeposit_1.validateVaultDeposit)(tx);
|
24848
|
+
break;
|
24849
|
+
case 'VaultSet':
|
24850
|
+
(0, vaultSet_1.validateVaultSet)(tx);
|
24851
|
+
break;
|
24852
|
+
case 'VaultWithdraw':
|
24853
|
+
(0, vaultWithdraw_1.validateVaultWithdraw)(tx);
|
24854
|
+
break;
|
25413
24855
|
case 'XChainAccountCreateCommit':
|
25414
24856
|
(0, XChainAccountCreateCommit_1.validateXChainAccountCreateCommit)(tx);
|
25415
24857
|
break;
|
@@ -25438,50 +24880,240 @@ function validate(transaction) {
|
|
25438
24880
|
throw new errors_1.ValidationError(`Invalid field TransactionType: ${tx.TransactionType}`);
|
25439
24881
|
}
|
25440
24882
|
}
|
25441
|
-
exports.validate = validate;
|
24883
|
+
exports.validate = validate;
|
24884
|
+
|
24885
|
+
|
24886
|
+
/***/ }),
|
24887
|
+
|
24888
|
+
/***/ "./dist/npm/models/transactions/trustSet.js":
|
24889
|
+
/*!**************************************************!*\
|
24890
|
+
!*** ./dist/npm/models/transactions/trustSet.js ***!
|
24891
|
+
\**************************************************/
|
24892
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
24893
|
+
|
24894
|
+
"use strict";
|
24895
|
+
|
24896
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
24897
|
+
exports.validateTrustSet = exports.TrustSetFlags = void 0;
|
24898
|
+
const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js");
|
24899
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24900
|
+
var TrustSetFlags;
|
24901
|
+
(function (TrustSetFlags) {
|
24902
|
+
TrustSetFlags[TrustSetFlags["tfSetfAuth"] = 65536] = "tfSetfAuth";
|
24903
|
+
TrustSetFlags[TrustSetFlags["tfSetNoRipple"] = 131072] = "tfSetNoRipple";
|
24904
|
+
TrustSetFlags[TrustSetFlags["tfClearNoRipple"] = 262144] = "tfClearNoRipple";
|
24905
|
+
TrustSetFlags[TrustSetFlags["tfSetFreeze"] = 1048576] = "tfSetFreeze";
|
24906
|
+
TrustSetFlags[TrustSetFlags["tfClearFreeze"] = 2097152] = "tfClearFreeze";
|
24907
|
+
TrustSetFlags[TrustSetFlags["tfSetDeepFreeze"] = 4194304] = "tfSetDeepFreeze";
|
24908
|
+
TrustSetFlags[TrustSetFlags["tfClearDeepFreeze"] = 8388608] = "tfClearDeepFreeze";
|
24909
|
+
})(TrustSetFlags || (exports.TrustSetFlags = TrustSetFlags = {}));
|
24910
|
+
function validateTrustSet(tx) {
|
24911
|
+
(0, common_1.validateBaseTransaction)(tx);
|
24912
|
+
const { LimitAmount, QualityIn, QualityOut } = tx;
|
24913
|
+
if (LimitAmount === undefined) {
|
24914
|
+
throw new errors_1.ValidationError('TrustSet: missing field LimitAmount');
|
24915
|
+
}
|
24916
|
+
if (!(0, common_1.isAmount)(LimitAmount)) {
|
24917
|
+
throw new errors_1.ValidationError('TrustSet: invalid LimitAmount');
|
24918
|
+
}
|
24919
|
+
if (QualityIn !== undefined && typeof QualityIn !== 'number') {
|
24920
|
+
throw new errors_1.ValidationError('TrustSet: QualityIn must be a number');
|
24921
|
+
}
|
24922
|
+
if (QualityOut !== undefined && typeof QualityOut !== 'number') {
|
24923
|
+
throw new errors_1.ValidationError('TrustSet: QualityOut must be a number');
|
24924
|
+
}
|
24925
|
+
}
|
24926
|
+
exports.validateTrustSet = validateTrustSet;
|
24927
|
+
|
24928
|
+
|
24929
|
+
/***/ }),
|
24930
|
+
|
24931
|
+
/***/ "./dist/npm/models/transactions/vaultClawback.js":
|
24932
|
+
/*!*******************************************************!*\
|
24933
|
+
!*** ./dist/npm/models/transactions/vaultClawback.js ***!
|
24934
|
+
\*******************************************************/
|
24935
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
24936
|
+
|
24937
|
+
"use strict";
|
24938
|
+
|
24939
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
24940
|
+
exports.validateVaultClawback = void 0;
|
24941
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24942
|
+
function validateVaultClawback(tx) {
|
24943
|
+
(0, common_1.validateBaseTransaction)(tx);
|
24944
|
+
(0, common_1.validateRequiredField)(tx, 'VaultID', common_1.isString);
|
24945
|
+
(0, common_1.validateRequiredField)(tx, 'Holder', common_1.isAccount);
|
24946
|
+
(0, common_1.validateOptionalField)(tx, 'Amount', common_1.isClawbackAmount);
|
24947
|
+
}
|
24948
|
+
exports.validateVaultClawback = validateVaultClawback;
|
24949
|
+
|
24950
|
+
|
24951
|
+
/***/ }),
|
24952
|
+
|
24953
|
+
/***/ "./dist/npm/models/transactions/vaultCreate.js":
|
24954
|
+
/*!*****************************************************!*\
|
24955
|
+
!*** ./dist/npm/models/transactions/vaultCreate.js ***!
|
24956
|
+
\*****************************************************/
|
24957
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
24958
|
+
|
24959
|
+
"use strict";
|
24960
|
+
|
24961
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
24962
|
+
exports.validateVaultCreate = exports.VaultCreateFlags = exports.VaultWithdrawalPolicy = void 0;
|
24963
|
+
const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js");
|
24964
|
+
const utils_1 = __webpack_require__(/*! ../utils */ "./dist/npm/models/utils/index.js");
|
24965
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
24966
|
+
var VaultWithdrawalPolicy;
|
24967
|
+
(function (VaultWithdrawalPolicy) {
|
24968
|
+
VaultWithdrawalPolicy[VaultWithdrawalPolicy["vaultStrategyFirstComeFirstServe"] = 1] = "vaultStrategyFirstComeFirstServe";
|
24969
|
+
})(VaultWithdrawalPolicy || (exports.VaultWithdrawalPolicy = VaultWithdrawalPolicy = {}));
|
24970
|
+
var VaultCreateFlags;
|
24971
|
+
(function (VaultCreateFlags) {
|
24972
|
+
VaultCreateFlags[VaultCreateFlags["tfVaultPrivate"] = 65536] = "tfVaultPrivate";
|
24973
|
+
VaultCreateFlags[VaultCreateFlags["tfVaultShareNonTransferable"] = 131072] = "tfVaultShareNonTransferable";
|
24974
|
+
})(VaultCreateFlags || (exports.VaultCreateFlags = VaultCreateFlags = {}));
|
24975
|
+
function validateVaultCreate(tx) {
|
24976
|
+
(0, common_1.validateBaseTransaction)(tx);
|
24977
|
+
(0, common_1.validateRequiredField)(tx, 'Asset', common_1.isCurrency);
|
24978
|
+
(0, common_1.validateOptionalField)(tx, 'Data', common_1.isString);
|
24979
|
+
(0, common_1.validateOptionalField)(tx, 'AssetsMaximum', common_1.isXRPLNumber);
|
24980
|
+
(0, common_1.validateOptionalField)(tx, 'MPTokenMetadata', common_1.isString);
|
24981
|
+
(0, common_1.validateOptionalField)(tx, 'WithdrawalPolicy', common_1.isNumber);
|
24982
|
+
(0, common_1.validateOptionalField)(tx, 'DomainID', common_1.isString);
|
24983
|
+
if (tx.Data !== undefined) {
|
24984
|
+
const dataHex = tx.Data;
|
24985
|
+
if (!(0, utils_1.isHex)(dataHex)) {
|
24986
|
+
throw new errors_1.ValidationError('VaultCreate: Data must be a valid hex string');
|
24987
|
+
}
|
24988
|
+
const dataByteLength = dataHex.length / 2;
|
24989
|
+
if (dataByteLength > common_1.VAULT_DATA_MAX_BYTE_LENGTH) {
|
24990
|
+
throw new errors_1.ValidationError(`VaultCreate: Data exceeds ${common_1.VAULT_DATA_MAX_BYTE_LENGTH} bytes (actual: ${dataByteLength})`);
|
24991
|
+
}
|
24992
|
+
}
|
24993
|
+
if (tx.MPTokenMetadata !== undefined) {
|
24994
|
+
const metaHex = tx.MPTokenMetadata;
|
24995
|
+
if (!(0, utils_1.isHex)(metaHex)) {
|
24996
|
+
throw new errors_1.ValidationError('VaultCreate: MPTokenMetadata must be a valid non-empty hex string');
|
24997
|
+
}
|
24998
|
+
const metaByteLength = metaHex.length / 2;
|
24999
|
+
if (metaByteLength > common_1.MAX_MPT_META_BYTE_LENGTH) {
|
25000
|
+
throw new errors_1.ValidationError(`VaultCreate: MPTokenMetadata exceeds ${common_1.MAX_MPT_META_BYTE_LENGTH} bytes (actual: ${metaByteLength})`);
|
25001
|
+
}
|
25002
|
+
}
|
25003
|
+
if (tx.DomainID !== undefined &&
|
25004
|
+
!(0, utils_1.hasFlag)(tx, VaultCreateFlags.tfVaultPrivate, 'tfVaultPrivate')) {
|
25005
|
+
throw new errors_1.ValidationError('VaultCreate: Cannot set DomainID unless tfVaultPrivate flag is set.');
|
25006
|
+
}
|
25007
|
+
if (tx.MPTokenMetadata != null) {
|
25008
|
+
const validationMessages = (0, common_1.validateMPTokenMetadata)(tx.MPTokenMetadata);
|
25009
|
+
if (validationMessages.length > 0) {
|
25010
|
+
const message = [
|
25011
|
+
common_1.MPT_META_WARNING_HEADER,
|
25012
|
+
...validationMessages.map((msg) => `- ${msg}`),
|
25013
|
+
].join('\n');
|
25014
|
+
console.warn(message);
|
25015
|
+
}
|
25016
|
+
}
|
25017
|
+
}
|
25018
|
+
exports.validateVaultCreate = validateVaultCreate;
|
25019
|
+
|
25020
|
+
|
25021
|
+
/***/ }),
|
25022
|
+
|
25023
|
+
/***/ "./dist/npm/models/transactions/vaultDelete.js":
|
25024
|
+
/*!*****************************************************!*\
|
25025
|
+
!*** ./dist/npm/models/transactions/vaultDelete.js ***!
|
25026
|
+
\*****************************************************/
|
25027
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
25028
|
+
|
25029
|
+
"use strict";
|
25030
|
+
|
25031
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
25032
|
+
exports.validateVaultDelete = void 0;
|
25033
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
25034
|
+
function validateVaultDelete(tx) {
|
25035
|
+
(0, common_1.validateBaseTransaction)(tx);
|
25036
|
+
(0, common_1.validateRequiredField)(tx, 'VaultID', common_1.isString);
|
25037
|
+
}
|
25038
|
+
exports.validateVaultDelete = validateVaultDelete;
|
25442
25039
|
|
25443
25040
|
|
25444
25041
|
/***/ }),
|
25445
25042
|
|
25446
|
-
/***/ "./dist/npm/models/transactions/
|
25043
|
+
/***/ "./dist/npm/models/transactions/vaultDeposit.js":
|
25044
|
+
/*!******************************************************!*\
|
25045
|
+
!*** ./dist/npm/models/transactions/vaultDeposit.js ***!
|
25046
|
+
\******************************************************/
|
25047
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
25048
|
+
|
25049
|
+
"use strict";
|
25050
|
+
|
25051
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
25052
|
+
exports.validateVaultDeposit = void 0;
|
25053
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
25054
|
+
function validateVaultDeposit(tx) {
|
25055
|
+
(0, common_1.validateBaseTransaction)(tx);
|
25056
|
+
(0, common_1.validateRequiredField)(tx, 'VaultID', common_1.isString);
|
25057
|
+
(0, common_1.validateRequiredField)(tx, 'Amount', common_1.isAmount);
|
25058
|
+
}
|
25059
|
+
exports.validateVaultDeposit = validateVaultDeposit;
|
25060
|
+
|
25061
|
+
|
25062
|
+
/***/ }),
|
25063
|
+
|
25064
|
+
/***/ "./dist/npm/models/transactions/vaultSet.js":
|
25447
25065
|
/*!**************************************************!*\
|
25448
|
-
!*** ./dist/npm/models/transactions/
|
25066
|
+
!*** ./dist/npm/models/transactions/vaultSet.js ***!
|
25449
25067
|
\**************************************************/
|
25450
25068
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
25451
25069
|
|
25452
25070
|
"use strict";
|
25453
25071
|
|
25454
25072
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
25455
|
-
exports.
|
25073
|
+
exports.validateVaultSet = void 0;
|
25456
25074
|
const errors_1 = __webpack_require__(/*! ../../errors */ "./dist/npm/errors.js");
|
25075
|
+
const utils_1 = __webpack_require__(/*! ../utils */ "./dist/npm/models/utils/index.js");
|
25457
25076
|
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
25458
|
-
|
25459
|
-
(function (TrustSetFlags) {
|
25460
|
-
TrustSetFlags[TrustSetFlags["tfSetfAuth"] = 65536] = "tfSetfAuth";
|
25461
|
-
TrustSetFlags[TrustSetFlags["tfSetNoRipple"] = 131072] = "tfSetNoRipple";
|
25462
|
-
TrustSetFlags[TrustSetFlags["tfClearNoRipple"] = 262144] = "tfClearNoRipple";
|
25463
|
-
TrustSetFlags[TrustSetFlags["tfSetFreeze"] = 1048576] = "tfSetFreeze";
|
25464
|
-
TrustSetFlags[TrustSetFlags["tfClearFreeze"] = 2097152] = "tfClearFreeze";
|
25465
|
-
TrustSetFlags[TrustSetFlags["tfSetDeepFreeze"] = 4194304] = "tfSetDeepFreeze";
|
25466
|
-
TrustSetFlags[TrustSetFlags["tfClearDeepFreeze"] = 8388608] = "tfClearDeepFreeze";
|
25467
|
-
})(TrustSetFlags || (exports.TrustSetFlags = TrustSetFlags = {}));
|
25468
|
-
function validateTrustSet(tx) {
|
25077
|
+
function validateVaultSet(tx) {
|
25469
25078
|
(0, common_1.validateBaseTransaction)(tx);
|
25470
|
-
|
25471
|
-
|
25472
|
-
|
25473
|
-
|
25474
|
-
if (
|
25475
|
-
|
25476
|
-
|
25477
|
-
|
25478
|
-
|
25479
|
-
|
25480
|
-
|
25481
|
-
|
25079
|
+
(0, common_1.validateRequiredField)(tx, 'VaultID', common_1.isString);
|
25080
|
+
(0, common_1.validateOptionalField)(tx, 'Data', common_1.isString);
|
25081
|
+
(0, common_1.validateOptionalField)(tx, 'AssetsMaximum', common_1.isXRPLNumber);
|
25082
|
+
(0, common_1.validateOptionalField)(tx, 'DomainID', common_1.isString);
|
25083
|
+
if (tx.Data !== undefined) {
|
25084
|
+
const dataHex = tx.Data;
|
25085
|
+
if (!(0, utils_1.isHex)(dataHex)) {
|
25086
|
+
throw new errors_1.ValidationError('VaultSet: Data must be a valid hex string');
|
25087
|
+
}
|
25088
|
+
const dataByteLength = dataHex.length / 2;
|
25089
|
+
if (dataByteLength > common_1.VAULT_DATA_MAX_BYTE_LENGTH) {
|
25090
|
+
throw new errors_1.ValidationError(`VaultSet: Data exceeds ${common_1.VAULT_DATA_MAX_BYTE_LENGTH} bytes (actual: ${dataByteLength})`);
|
25091
|
+
}
|
25482
25092
|
}
|
25483
25093
|
}
|
25484
|
-
exports.
|
25094
|
+
exports.validateVaultSet = validateVaultSet;
|
25095
|
+
|
25096
|
+
|
25097
|
+
/***/ }),
|
25098
|
+
|
25099
|
+
/***/ "./dist/npm/models/transactions/vaultWithdraw.js":
|
25100
|
+
/*!*******************************************************!*\
|
25101
|
+
!*** ./dist/npm/models/transactions/vaultWithdraw.js ***!
|
25102
|
+
\*******************************************************/
|
25103
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
25104
|
+
|
25105
|
+
"use strict";
|
25106
|
+
|
25107
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
25108
|
+
exports.validateVaultWithdraw = void 0;
|
25109
|
+
const common_1 = __webpack_require__(/*! ./common */ "./dist/npm/models/transactions/common.js");
|
25110
|
+
function validateVaultWithdraw(tx) {
|
25111
|
+
(0, common_1.validateBaseTransaction)(tx);
|
25112
|
+
(0, common_1.validateRequiredField)(tx, 'VaultID', common_1.isString);
|
25113
|
+
(0, common_1.validateRequiredField)(tx, 'Amount', common_1.isAmount);
|
25114
|
+
(0, common_1.validateOptionalField)(tx, 'Destination', common_1.isAccount);
|
25115
|
+
}
|
25116
|
+
exports.validateVaultWithdraw = validateVaultWithdraw;
|
25485
25117
|
|
25486
25118
|
|
25487
25119
|
/***/ }),
|
@@ -25513,6 +25145,7 @@ const offerCreate_1 = __webpack_require__(/*! ../transactions/offerCreate */ "./
|
|
25513
25145
|
const payment_1 = __webpack_require__(/*! ../transactions/payment */ "./dist/npm/models/transactions/payment.js");
|
25514
25146
|
const paymentChannelClaim_1 = __webpack_require__(/*! ../transactions/paymentChannelClaim */ "./dist/npm/models/transactions/paymentChannelClaim.js");
|
25515
25147
|
const trustSet_1 = __webpack_require__(/*! ../transactions/trustSet */ "./dist/npm/models/transactions/trustSet.js");
|
25148
|
+
const vaultCreate_1 = __webpack_require__(/*! ../transactions/vaultCreate */ "./dist/npm/models/transactions/vaultCreate.js");
|
25516
25149
|
const XChainModifyBridge_1 = __webpack_require__(/*! ../transactions/XChainModifyBridge */ "./dist/npm/models/transactions/XChainModifyBridge.js");
|
25517
25150
|
const _1 = __webpack_require__(/*! . */ "./dist/npm/models/utils/index.js");
|
25518
25151
|
function parseAccountRootFlags(flags) {
|
@@ -25541,6 +25174,7 @@ const txToFlag = {
|
|
25541
25174
|
PaymentChannelClaim: paymentChannelClaim_1.PaymentChannelClaimFlags,
|
25542
25175
|
Payment: payment_1.PaymentFlags,
|
25543
25176
|
TrustSet: trustSet_1.TrustSetFlags,
|
25177
|
+
VaultCreate: vaultCreate_1.VaultCreateFlags,
|
25544
25178
|
XChainModifyBridge: XChainModifyBridge_1.XChainModifyBridgeFlags,
|
25545
25179
|
};
|
25546
25180
|
function isTxToFlagKey(transactionType) {
|
@@ -26734,7 +26368,8 @@ class LeafNode extends node_1.Node {
|
|
26734
26368
|
}
|
26735
26369
|
addItem(tag, node) {
|
26736
26370
|
throw new errors_1.XrplError('Cannot call addItem on a LeafNode');
|
26737
|
-
|
26371
|
+
// removed by dead control flow
|
26372
|
+
{}
|
26738
26373
|
}
|
26739
26374
|
}
|
26740
26375
|
exports["default"] = LeafNode;
|
@@ -27598,6 +27233,207 @@ function xrpToDrops(xrpToConvert) {
|
|
27598
27233
|
exports.xrpToDrops = xrpToDrops;
|
27599
27234
|
|
27600
27235
|
|
27236
|
+
/***/ }),
|
27237
|
+
|
27238
|
+
/***/ "./node_modules/@xrplf/secret-numbers/dist/index.js":
|
27239
|
+
/*!**********************************************************!*\
|
27240
|
+
!*** ./node_modules/@xrplf/secret-numbers/dist/index.js ***!
|
27241
|
+
\**********************************************************/
|
27242
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
27243
|
+
|
27244
|
+
"use strict";
|
27245
|
+
|
27246
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
27247
|
+
if (k2 === undefined) k2 = k;
|
27248
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
27249
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
27250
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
27251
|
+
}
|
27252
|
+
Object.defineProperty(o, k2, desc);
|
27253
|
+
}) : (function(o, m, k, k2) {
|
27254
|
+
if (k2 === undefined) k2 = k;
|
27255
|
+
o[k2] = m[k];
|
27256
|
+
}));
|
27257
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
27258
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27259
|
+
};
|
27260
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
27261
|
+
__exportStar(__webpack_require__(/*! ./schema/Account */ "./node_modules/@xrplf/secret-numbers/dist/schema/Account.js"), exports);
|
27262
|
+
__exportStar(__webpack_require__(/*! ./utils */ "./node_modules/@xrplf/secret-numbers/dist/utils/index.js"), exports);
|
27263
|
+
|
27264
|
+
|
27265
|
+
/***/ }),
|
27266
|
+
|
27267
|
+
/***/ "./node_modules/@xrplf/secret-numbers/dist/schema/Account.js":
|
27268
|
+
/*!*******************************************************************!*\
|
27269
|
+
!*** ./node_modules/@xrplf/secret-numbers/dist/schema/Account.js ***!
|
27270
|
+
\*******************************************************************/
|
27271
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
27272
|
+
|
27273
|
+
"use strict";
|
27274
|
+
|
27275
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
27276
|
+
exports.Account = void 0;
|
27277
|
+
const ripple_keypairs_1 = __webpack_require__(/*! ripple-keypairs */ "../../node_modules/ripple-keypairs/dist/index.js");
|
27278
|
+
const utils_1 = __webpack_require__(/*! ../utils */ "./node_modules/@xrplf/secret-numbers/dist/utils/index.js");
|
27279
|
+
class Account {
|
27280
|
+
constructor(secretNumbers) {
|
27281
|
+
this._account = {
|
27282
|
+
familySeed: '',
|
27283
|
+
address: '',
|
27284
|
+
keypair: {
|
27285
|
+
publicKey: '',
|
27286
|
+
privateKey: '',
|
27287
|
+
},
|
27288
|
+
};
|
27289
|
+
if (typeof secretNumbers === 'string') {
|
27290
|
+
this._secret = (0, utils_1.parseSecretString)(secretNumbers);
|
27291
|
+
}
|
27292
|
+
else if (Array.isArray(secretNumbers)) {
|
27293
|
+
this._secret = secretNumbers;
|
27294
|
+
}
|
27295
|
+
else if (secretNumbers instanceof Uint8Array) {
|
27296
|
+
this._secret = (0, utils_1.entropyToSecret)(secretNumbers);
|
27297
|
+
}
|
27298
|
+
else {
|
27299
|
+
this._secret = (0, utils_1.randomSecret)();
|
27300
|
+
}
|
27301
|
+
validateLengths(this._secret);
|
27302
|
+
this.derive();
|
27303
|
+
}
|
27304
|
+
getSecret() {
|
27305
|
+
return this._secret;
|
27306
|
+
}
|
27307
|
+
getSecretString() {
|
27308
|
+
return this._secret.join(' ');
|
27309
|
+
}
|
27310
|
+
getAddress() {
|
27311
|
+
return this._account.address;
|
27312
|
+
}
|
27313
|
+
getFamilySeed() {
|
27314
|
+
return this._account.familySeed;
|
27315
|
+
}
|
27316
|
+
getKeypair() {
|
27317
|
+
return this._account.keypair;
|
27318
|
+
}
|
27319
|
+
toString() {
|
27320
|
+
return this.getSecretString();
|
27321
|
+
}
|
27322
|
+
derive() {
|
27323
|
+
try {
|
27324
|
+
const entropy = (0, utils_1.secretToEntropy)(this._secret);
|
27325
|
+
this._account.familySeed = (0, ripple_keypairs_1.generateSeed)({ entropy });
|
27326
|
+
this._account.keypair = (0, ripple_keypairs_1.deriveKeypair)(this._account.familySeed);
|
27327
|
+
this._account.address = (0, ripple_keypairs_1.deriveAddress)(this._account.keypair.publicKey);
|
27328
|
+
}
|
27329
|
+
catch (error) {
|
27330
|
+
let message = 'Unknown Error';
|
27331
|
+
if (error instanceof Error) {
|
27332
|
+
message = error.message;
|
27333
|
+
}
|
27334
|
+
throw new Error(message);
|
27335
|
+
}
|
27336
|
+
}
|
27337
|
+
}
|
27338
|
+
exports.Account = Account;
|
27339
|
+
function validateLengths(secretNumbers) {
|
27340
|
+
if (secretNumbers.length !== 8) {
|
27341
|
+
throw new Error('Secret must have 8 numbers');
|
27342
|
+
}
|
27343
|
+
secretNumbers.forEach((num) => {
|
27344
|
+
if (num.length !== 6) {
|
27345
|
+
throw new Error('Each secret number must be 6 digits');
|
27346
|
+
}
|
27347
|
+
});
|
27348
|
+
}
|
27349
|
+
|
27350
|
+
|
27351
|
+
/***/ }),
|
27352
|
+
|
27353
|
+
/***/ "./node_modules/@xrplf/secret-numbers/dist/utils/index.js":
|
27354
|
+
/*!****************************************************************!*\
|
27355
|
+
!*** ./node_modules/@xrplf/secret-numbers/dist/utils/index.js ***!
|
27356
|
+
\****************************************************************/
|
27357
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
27358
|
+
|
27359
|
+
"use strict";
|
27360
|
+
|
27361
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
27362
|
+
exports.parseSecretString = exports.checkChecksum = exports.calculateChecksum = exports.secretToEntropy = exports.entropyToSecret = exports.randomSecret = exports.randomEntropy = void 0;
|
27363
|
+
const utils_1 = __webpack_require__(/*! @xrplf/isomorphic/utils */ "../../node_modules/@xrplf/isomorphic/dist/utils/browser.js");
|
27364
|
+
function randomEntropy() {
|
27365
|
+
return (0, utils_1.randomBytes)(16);
|
27366
|
+
}
|
27367
|
+
exports.randomEntropy = randomEntropy;
|
27368
|
+
function calculateChecksum(position, value) {
|
27369
|
+
return (value * (position * 2 + 1)) % 9;
|
27370
|
+
}
|
27371
|
+
exports.calculateChecksum = calculateChecksum;
|
27372
|
+
function checkChecksum(position, value, checksum) {
|
27373
|
+
let normalizedChecksum;
|
27374
|
+
let normalizedValue;
|
27375
|
+
if (typeof value === 'string') {
|
27376
|
+
if (value.length !== 6) {
|
27377
|
+
throw new Error('value must have a length of 6');
|
27378
|
+
}
|
27379
|
+
normalizedChecksum = parseInt(value.slice(5), 10);
|
27380
|
+
normalizedValue = parseInt(value.slice(0, 5), 10);
|
27381
|
+
}
|
27382
|
+
else {
|
27383
|
+
if (typeof checksum !== 'number') {
|
27384
|
+
throw new Error('checksum must be a number when value is a number');
|
27385
|
+
}
|
27386
|
+
normalizedChecksum = checksum;
|
27387
|
+
normalizedValue = value;
|
27388
|
+
}
|
27389
|
+
return (normalizedValue * (position * 2 + 1)) % 9 === normalizedChecksum;
|
27390
|
+
}
|
27391
|
+
exports.checkChecksum = checkChecksum;
|
27392
|
+
function entropyToSecret(entropy) {
|
27393
|
+
const len = new Array(Math.ceil(entropy.length / 2));
|
27394
|
+
const chunks = Array.from(len, (_a, chunk) => {
|
27395
|
+
const buffChunk = entropy.slice(chunk * 2, (chunk + 1) * 2);
|
27396
|
+
const no = parseInt((0, utils_1.bytesToHex)(buffChunk), 16);
|
27397
|
+
const fill = '0'.repeat(5 - String(no).length);
|
27398
|
+
return fill + String(no) + String(calculateChecksum(chunk, no));
|
27399
|
+
});
|
27400
|
+
if (chunks.length !== 8) {
|
27401
|
+
throw new Error('Chucks must have 8 digits');
|
27402
|
+
}
|
27403
|
+
return chunks;
|
27404
|
+
}
|
27405
|
+
exports.entropyToSecret = entropyToSecret;
|
27406
|
+
function randomSecret() {
|
27407
|
+
return entropyToSecret(randomEntropy());
|
27408
|
+
}
|
27409
|
+
exports.randomSecret = randomSecret;
|
27410
|
+
function secretToEntropy(secret) {
|
27411
|
+
return (0, utils_1.concat)(secret.map((chunk, i) => {
|
27412
|
+
const no = Number(chunk.slice(0, 5));
|
27413
|
+
const checksum = Number(chunk.slice(5));
|
27414
|
+
if (chunk.length !== 6) {
|
27415
|
+
throw new Error('Invalid secret: number invalid');
|
27416
|
+
}
|
27417
|
+
if (!checkChecksum(i, no, checksum)) {
|
27418
|
+
throw new Error('Invalid secret part: checksum invalid');
|
27419
|
+
}
|
27420
|
+
const hex = `0000${no.toString(16)}`.slice(-4);
|
27421
|
+
return (0, utils_1.hexToBytes)(hex);
|
27422
|
+
}));
|
27423
|
+
}
|
27424
|
+
exports.secretToEntropy = secretToEntropy;
|
27425
|
+
function parseSecretString(secret) {
|
27426
|
+
const normalizedSecret = secret.replace(/[^0-9]/gu, '');
|
27427
|
+
if (normalizedSecret.length !== 48) {
|
27428
|
+
throw new Error('Invalid secret string (should contain 8 blocks of 6 digits');
|
27429
|
+
}
|
27430
|
+
return Array.from(new Array(8), (_a, index) => {
|
27431
|
+
return normalizedSecret.slice(index * 6, (index + 1) * 6);
|
27432
|
+
});
|
27433
|
+
}
|
27434
|
+
exports.parseSecretString = parseSecretString;
|
27435
|
+
|
27436
|
+
|
27601
27437
|
/***/ })
|
27602
27438
|
|
27603
27439
|
/******/ });
|