@aptos-labs/ts-sdk 1.13.3-zeta.1 → 1.14.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/dist/common/accountAddress-csDQ8Gnp.d.ts +2103 -0
- package/dist/common/cli/index.d.ts +94 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +2250 -4805
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-8gJF5t3F.d.mts → Ed25519Account--qjfup2u.d.mts} +12 -10
- package/dist/esm/api/account.d.mts +1 -13
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +8 -14
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +0 -20
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +7 -7
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +5 -5
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +7 -7
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +8 -13
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +0 -2
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-MJGZJL3W.mjs → chunk-2G4ZSGL4.mjs} +2 -2
- package/dist/esm/{chunk-UKJUHLZW.mjs → chunk-3YZGJLW7.mjs} +2 -2
- package/dist/esm/{chunk-TV64AINP.mjs → chunk-4374JPA6.mjs} +2 -2
- package/dist/esm/chunk-4374JPA6.mjs.map +1 -0
- package/dist/esm/{chunk-KFJMLLOA.mjs → chunk-4P5EKAJB.mjs} +2 -2
- package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-52C73T26.mjs} +2 -2
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-52C73T26.mjs.map} +1 -1
- package/dist/esm/{chunk-DIBNAYZ2.mjs → chunk-5HY3DEPF.mjs} +2 -2
- package/dist/esm/chunk-62P5CJAJ.mjs +2 -0
- package/dist/esm/chunk-62P5CJAJ.mjs.map +1 -0
- package/dist/esm/{chunk-NPNAKSCR.mjs → chunk-6OV2PQS5.mjs} +2 -2
- package/dist/esm/chunk-APDALGDD.mjs +2 -0
- package/dist/esm/chunk-APDALGDD.mjs.map +1 -0
- package/dist/esm/chunk-AT2A6UGB.mjs +2 -0
- package/dist/esm/chunk-AT2A6UGB.mjs.map +1 -0
- package/dist/esm/chunk-B3BRR4WP.mjs +2 -0
- package/dist/esm/chunk-B3BRR4WP.mjs.map +1 -0
- package/dist/esm/{chunk-W637YAND.mjs → chunk-BAV4XY7C.mjs} +2 -2
- package/dist/esm/{chunk-3YNRBMPS.mjs → chunk-BE4FOV6X.mjs} +2 -2
- package/dist/esm/{chunk-33WBJV5U.mjs → chunk-BIAEC6FO.mjs} +2 -2
- package/dist/esm/{chunk-MWUJCP27.mjs → chunk-BWFJHFBQ.mjs} +2 -2
- package/dist/esm/{chunk-37CYBCWS.mjs → chunk-CDB34C4N.mjs} +2 -2
- package/dist/esm/chunk-CDB34C4N.mjs.map +1 -0
- package/dist/esm/{chunk-ZGTJMNZG.mjs → chunk-CF5R4HVB.mjs} +2 -2
- package/dist/esm/chunk-CNMQNPNV.mjs +2 -0
- package/dist/esm/chunk-CNMQNPNV.mjs.map +1 -0
- package/dist/esm/chunk-CPBGL37X.mjs +2 -0
- package/dist/esm/{chunk-X7GVXVT4.mjs.map → chunk-CPBGL37X.mjs.map} +1 -1
- package/dist/esm/chunk-CYNQRMO5.mjs +2 -0
- package/dist/esm/chunk-CYNQRMO5.mjs.map +1 -0
- package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-DMKUAQB7.mjs} +2 -2
- package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-DSTKXJMA.mjs} +2 -2
- package/dist/esm/chunk-E7FWVXGX.mjs +1 -0
- package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-FS3NSGBF.mjs} +2 -2
- package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-FXNFWLQC.mjs} +2 -2
- package/dist/esm/{chunk-DOCYCNXV.mjs → chunk-HG4Q4EFG.mjs} +2 -2
- package/dist/esm/chunk-HG4Q4EFG.mjs.map +1 -0
- package/dist/esm/{chunk-GKCO5PQJ.mjs → chunk-HWECUBBA.mjs} +2 -2
- package/dist/esm/chunk-HWECUBBA.mjs.map +1 -0
- package/dist/esm/chunk-HYCGMFC2.mjs +2 -0
- package/dist/esm/chunk-HYCGMFC2.mjs.map +1 -0
- package/dist/esm/{chunk-T23OVRNF.mjs → chunk-IOSQVDZI.mjs} +2 -2
- package/dist/esm/{chunk-YGB7MEH3.mjs → chunk-IR46T46A.mjs} +2 -2
- package/dist/esm/{chunk-RDNPWCZ4.mjs → chunk-JCD72AW7.mjs} +2 -2
- package/dist/esm/{chunk-GI52SX32.mjs → chunk-L5IL2IAB.mjs} +2 -2
- package/dist/esm/chunk-LBGYH45K.mjs +2 -0
- package/dist/esm/chunk-LBGYH45K.mjs.map +1 -0
- package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
- package/dist/esm/chunk-LDQ6JFEF.mjs.map +1 -0
- package/dist/esm/chunk-LR65XHSF.mjs +2 -0
- package/dist/esm/chunk-LR65XHSF.mjs.map +1 -0
- package/dist/esm/chunk-MFL3UCKA.mjs +2 -0
- package/dist/esm/chunk-MFL3UCKA.mjs.map +1 -0
- package/dist/esm/chunk-MLWIHWNH.mjs +1 -0
- package/dist/esm/{chunk-A7L2Z5DW.mjs → chunk-N77VJHW5.mjs} +2 -2
- package/dist/esm/chunk-NBCHJ75L.mjs +2 -0
- package/dist/esm/chunk-NBCHJ75L.mjs.map +1 -0
- package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-NPFNYP75.mjs} +2 -2
- package/dist/esm/{chunk-LV7OW245.mjs → chunk-NWYIE7ZX.mjs} +2 -2
- package/dist/esm/chunk-NZGRLKRG.mjs +2 -0
- package/dist/esm/{chunk-PTIZKRON.mjs → chunk-O4JRPZZM.mjs} +2 -2
- package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-OGHE4AQA.mjs} +2 -2
- package/dist/esm/chunk-OWW6SIDP.mjs +2 -0
- package/dist/esm/chunk-OWW6SIDP.mjs.map +1 -0
- package/dist/esm/{chunk-DX62SMGM.mjs → chunk-P3UFJZY5.mjs} +2 -2
- package/dist/esm/chunk-P3UFJZY5.mjs.map +1 -0
- package/dist/esm/chunk-PJPXC22D.mjs +2 -0
- package/dist/esm/chunk-PJPXC22D.mjs.map +1 -0
- package/dist/esm/{chunk-TFJCMFKE.mjs → chunk-PMUT3HZE.mjs} +2 -2
- package/dist/esm/chunk-PMUT3HZE.mjs.map +1 -0
- package/dist/esm/chunk-PXFIA4BL.mjs +2 -0
- package/dist/esm/{chunk-EKOIHFAW.mjs.map → chunk-PXFIA4BL.mjs.map} +1 -1
- package/dist/esm/{chunk-IM32PZOD.mjs → chunk-PYXJYEAC.mjs} +2 -2
- package/dist/esm/chunk-PYXJYEAC.mjs.map +1 -0
- package/dist/esm/{chunk-OKG6X5TX.mjs → chunk-QD2Y3VK4.mjs} +2 -2
- package/dist/esm/chunk-QD2Y3VK4.mjs.map +1 -0
- package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-QIAHBEEW.mjs} +2 -2
- package/dist/esm/{chunk-ODTNF2YP.mjs → chunk-QIAU5K5Y.mjs} +2 -2
- package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-QTRYMRYK.mjs} +2 -2
- package/dist/esm/{chunk-STYDBDYL.mjs → chunk-R5QUBEH6.mjs} +2 -2
- package/dist/esm/chunk-R7G3CLRI.mjs +1 -0
- package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-RHBCVCOS.mjs} +2 -2
- package/dist/esm/chunk-RR7I2HLA.mjs +2 -0
- package/dist/esm/chunk-RR7I2HLA.mjs.map +1 -0
- package/dist/esm/chunk-RTSWVT2Q.mjs +2 -0
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +1 -0
- package/dist/esm/chunk-RW2A63WK.mjs +2 -0
- package/dist/esm/chunk-RW2A63WK.mjs.map +1 -0
- package/dist/esm/{chunk-T7JIGO3O.mjs → chunk-S2LTZKM4.mjs} +2 -2
- package/dist/esm/{chunk-6CQH7JPF.mjs → chunk-SPU745XV.mjs} +2 -2
- package/dist/esm/{chunk-3FVRXELT.mjs → chunk-TBMAJ6AW.mjs} +2 -2
- package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-TGXZVNR5.mjs} +2 -2
- package/dist/esm/{chunk-PFFAQZHT.mjs → chunk-U43IJHQN.mjs} +2 -2
- package/dist/esm/chunk-UDRSFVAK.mjs +2 -0
- package/dist/esm/{chunk-CHQ6IKE3.mjs.map → chunk-UDRSFVAK.mjs.map} +1 -1
- package/dist/esm/chunk-UF534PKA.mjs +2 -0
- package/dist/esm/chunk-UF534PKA.mjs.map +1 -0
- package/dist/esm/chunk-UMDTVVQC.mjs +2 -0
- package/dist/esm/chunk-UMDTVVQC.mjs.map +1 -0
- package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-UML2VQZT.mjs} +2 -2
- package/dist/esm/chunk-UNU3RVRJ.mjs +2 -0
- package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-UPIN5AIO.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/{chunk-YI7FZPIK.mjs → chunk-WCVUDO5S.mjs} +2 -2
- package/dist/esm/{chunk-COW5IGYC.mjs → chunk-WFZDFFBM.mjs} +2 -2
- package/dist/esm/chunk-XIJHRBDL.mjs +2 -0
- package/dist/esm/chunk-XIJHRBDL.mjs.map +1 -0
- package/dist/esm/{chunk-XHPLLMR5.mjs → chunk-XO3HHRJV.mjs} +2 -2
- package/dist/esm/chunk-ZEHKHKBP.mjs +2 -0
- package/dist/esm/chunk-ZEHKHKBP.mjs.map +1 -0
- package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-ZYYK3UXP.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +12 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +105 -0
- package/dist/esm/cli/move.mjs +2 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -2
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +1 -3
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/Account.d.mts +20 -0
- package/dist/esm/core/account/Account.mjs +2 -0
- package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
- package/dist/esm/core/account/Ed25519Account.mjs +2 -0
- package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/core/account/index.d.mts +14 -5
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +10 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.d.mts +1 -15
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +5 -7
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +3 -4
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.d.mts +7 -6
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +10 -16
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -14
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +7 -7
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +5 -5
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +7 -7
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +4 -3
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -2
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -13
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +25 -13
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +6 -6
- package/dist/esm/types/index.d.mts +3 -17
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/apiEndpoints.d.mts +1 -4
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +1 -3
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -7
- package/src/api/account.ts +1 -2
- package/src/api/ans.ts +1 -2
- package/src/api/aptos.ts +0 -6
- package/src/api/aptosConfig.ts +1 -46
- package/src/api/digitalAsset.ts +1 -2
- package/src/api/fungibleAsset.ts +1 -2
- package/src/api/transaction.ts +1 -2
- package/src/api/transactionSubmission/management.ts +1 -1
- package/src/api/transactionSubmission/sign.ts +1 -1
- package/src/bcs/serializer.ts +0 -18
- package/src/cli/index.ts +1 -0
- package/src/cli/move.ts +183 -0
- package/src/client/core.ts +0 -8
- package/src/client/get.ts +0 -6
- package/src/client/post.ts +0 -12
- package/src/{account → core/account}/Account.ts +16 -12
- package/src/{account → core/account}/Ed25519Account.ts +7 -13
- package/src/{account → core/account}/SingleKeyAccount.ts +8 -13
- package/src/core/account/index.ts +3 -1
- package/src/core/crypto/ed25519.ts +24 -4
- package/src/core/crypto/hdKey.ts +0 -31
- package/src/core/crypto/index.ts +0 -2
- package/src/core/crypto/multiKey.ts +11 -21
- package/src/core/crypto/singleKey.ts +0 -11
- package/src/core/index.ts +1 -0
- package/src/index.ts +0 -1
- package/src/internal/account.ts +1 -1
- package/src/internal/ans.ts +1 -3
- package/src/internal/digitalAsset.ts +1 -2
- package/src/internal/fungibleAsset.ts +2 -3
- package/src/internal/transactionSubmission.ts +7 -8
- package/src/transactions/authenticator/account.ts +11 -6
- package/src/transactions/management/accountSequenceNumber.ts +1 -1
- package/src/transactions/management/transactionWorker.ts +2 -8
- package/src/transactions/transactionBuilder/index.ts +0 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +68 -41
- package/src/types/index.ts +0 -19
- package/src/utils/apiEndpoints.ts +0 -20
- package/src/utils/const.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/esm/account/Account.d.mts +0 -34
- package/dist/esm/account/Account.mjs +0 -2
- package/dist/esm/account/Ed25519Account.d.mts +0 -34
- package/dist/esm/account/Ed25519Account.mjs +0 -2
- package/dist/esm/account/EphemeralKeyPair.d.mts +0 -47
- package/dist/esm/account/EphemeralKeyPair.mjs +0 -2
- package/dist/esm/account/KeylessAccount.d.mts +0 -106
- package/dist/esm/account/KeylessAccount.mjs +0 -2
- package/dist/esm/account/MultiKeyAccount.d.mts +0 -99
- package/dist/esm/account/MultiKeyAccount.mjs +0 -2
- package/dist/esm/account/SingleKeyAccount.d.mts +0 -34
- package/dist/esm/account/SingleKeyAccount.mjs +0 -2
- package/dist/esm/account/index.d.mts +0 -40
- package/dist/esm/account/index.mjs +0 -2
- package/dist/esm/api/keyless.d.mts +0 -67
- package/dist/esm/api/keyless.mjs +0 -2
- package/dist/esm/chunk-2Q6K4CLJ.mjs +0 -2
- package/dist/esm/chunk-2Q6K4CLJ.mjs.map +0 -1
- package/dist/esm/chunk-2YDIOWRJ.mjs +0 -2
- package/dist/esm/chunk-2YDIOWRJ.mjs.map +0 -1
- package/dist/esm/chunk-37CYBCWS.mjs.map +0 -1
- package/dist/esm/chunk-3QHRPREO.mjs +0 -2
- package/dist/esm/chunk-3QHRPREO.mjs.map +0 -1
- package/dist/esm/chunk-4XB3D2ZD.mjs +0 -2
- package/dist/esm/chunk-4XB3D2ZD.mjs.map +0 -1
- package/dist/esm/chunk-5QBTBH64.mjs +0 -2
- package/dist/esm/chunk-5VSMDXZ6.mjs +0 -2
- package/dist/esm/chunk-5VSMDXZ6.mjs.map +0 -1
- package/dist/esm/chunk-6GQAHQGW.mjs +0 -2
- package/dist/esm/chunk-6GQAHQGW.mjs.map +0 -1
- package/dist/esm/chunk-6J3CB3DN.mjs +0 -2
- package/dist/esm/chunk-6J3CB3DN.mjs.map +0 -1
- package/dist/esm/chunk-6M6XXPQQ.mjs +0 -2
- package/dist/esm/chunk-6M6XXPQQ.mjs.map +0 -1
- package/dist/esm/chunk-7JNPSNL6.mjs +0 -2
- package/dist/esm/chunk-7JNPSNL6.mjs.map +0 -1
- package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +0 -1
- package/dist/esm/chunk-CHQ6IKE3.mjs +0 -2
- package/dist/esm/chunk-DMKFITUM.mjs +0 -2
- package/dist/esm/chunk-DMKFITUM.mjs.map +0 -1
- package/dist/esm/chunk-DOCYCNXV.mjs.map +0 -1
- package/dist/esm/chunk-DX62SMGM.mjs.map +0 -1
- package/dist/esm/chunk-EFRNRARV.mjs +0 -2
- package/dist/esm/chunk-EFRNRARV.mjs.map +0 -1
- package/dist/esm/chunk-EKOIHFAW.mjs +0 -2
- package/dist/esm/chunk-FLYEALDB.mjs +0 -2
- package/dist/esm/chunk-FLYEALDB.mjs.map +0 -1
- package/dist/esm/chunk-GKCO5PQJ.mjs.map +0 -1
- package/dist/esm/chunk-HJULFJXF.mjs +0 -2
- package/dist/esm/chunk-HJULFJXF.mjs.map +0 -1
- package/dist/esm/chunk-IM32PZOD.mjs.map +0 -1
- package/dist/esm/chunk-IOVRZ2CA.mjs +0 -2
- package/dist/esm/chunk-IOVRZ2CA.mjs.map +0 -1
- package/dist/esm/chunk-ITEV72BZ.mjs +0 -2
- package/dist/esm/chunk-ITEV72BZ.mjs.map +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
- package/dist/esm/chunk-KGJITNRZ.mjs +0 -2
- package/dist/esm/chunk-KGJITNRZ.mjs.map +0 -1
- package/dist/esm/chunk-KOCKKI4F.mjs +0 -2
- package/dist/esm/chunk-NWLZDI2I.mjs +0 -2
- package/dist/esm/chunk-NWLZDI2I.mjs.map +0 -1
- package/dist/esm/chunk-OKG6X5TX.mjs.map +0 -1
- package/dist/esm/chunk-OKRUEVF3.mjs +0 -2
- package/dist/esm/chunk-OKRUEVF3.mjs.map +0 -1
- package/dist/esm/chunk-OYTLWUQT.mjs +0 -2
- package/dist/esm/chunk-OYTLWUQT.mjs.map +0 -1
- package/dist/esm/chunk-P5VCS2F5.mjs +0 -2
- package/dist/esm/chunk-P5VCS2F5.mjs.map +0 -1
- package/dist/esm/chunk-R4UIPTBH.mjs +0 -2
- package/dist/esm/chunk-R4UIPTBH.mjs.map +0 -1
- package/dist/esm/chunk-R7BAM2G6.mjs +0 -2
- package/dist/esm/chunk-R7BAM2G6.mjs.map +0 -1
- package/dist/esm/chunk-RFSO3JRG.mjs +0 -1
- package/dist/esm/chunk-RFSO3JRG.mjs.map +0 -1
- package/dist/esm/chunk-S5HG2QUD.mjs +0 -2
- package/dist/esm/chunk-S5HG2QUD.mjs.map +0 -1
- package/dist/esm/chunk-SA7MZPM3.mjs +0 -2
- package/dist/esm/chunk-SA7MZPM3.mjs.map +0 -1
- package/dist/esm/chunk-TFJCMFKE.mjs.map +0 -1
- package/dist/esm/chunk-TV64AINP.mjs.map +0 -1
- package/dist/esm/chunk-VTX77UM3.mjs +0 -2
- package/dist/esm/chunk-VTX77UM3.mjs.map +0 -1
- package/dist/esm/chunk-WPVBC4JS.mjs +0 -2
- package/dist/esm/chunk-WPVBC4JS.mjs.map +0 -1
- package/dist/esm/chunk-WTVN3XGK.mjs +0 -2
- package/dist/esm/chunk-WTVN3XGK.mjs.map +0 -1
- package/dist/esm/chunk-X7GVXVT4.mjs +0 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +0 -2
- package/dist/esm/chunk-YE5B2S5L.mjs.map +0 -1
- package/dist/esm/chunk-YH6UKGIX.mjs +0 -2
- package/dist/esm/chunk-YH6UKGIX.mjs.map +0 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +0 -77
- package/dist/esm/core/crypto/ephemeral.mjs +0 -2
- package/dist/esm/core/crypto/ephemeral.mjs.map +0 -1
- package/dist/esm/core/crypto/keyless.d.mts +0 -217
- package/dist/esm/core/crypto/keyless.mjs +0 -2
- package/dist/esm/core/crypto/keyless.mjs.map +0 -1
- package/dist/esm/core/crypto/poseidon.d.mts +0 -7
- package/dist/esm/core/crypto/poseidon.mjs +0 -2
- package/dist/esm/core/crypto/poseidon.mjs.map +0 -1
- package/dist/esm/internal/keyless.d.mts +0 -67
- package/dist/esm/internal/keyless.mjs +0 -2
- package/dist/esm/internal/keyless.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -47
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +0 -1
- package/dist/esm/types/keyless.d.mts +0 -14
- package/dist/esm/types/keyless.mjs +0 -1
- package/dist/esm/types/keyless.mjs.map +0 -1
- package/src/account/EphemeralKeyPair.ts +0 -123
- package/src/account/KeylessAccount.ts +0 -299
- package/src/account/MultiKeyAccount.ts +0 -119
- package/src/account/index.ts +0 -6
- package/src/api/keyless.ts +0 -35
- package/src/core/crypto/ephemeral.ts +0 -149
- package/src/core/crypto/keyless.ts +0 -508
- package/src/core/crypto/poseidon.ts +0 -134
- package/src/internal/keyless.ts +0 -188
- package/src/transactions/transactionBuilder/signingMessage.ts +0 -70
- package/src/types/keyless.ts +0 -6
- /package/dist/esm/{chunk-MJGZJL3W.mjs.map → chunk-2G4ZSGL4.mjs.map} +0 -0
- /package/dist/esm/{chunk-UKJUHLZW.mjs.map → chunk-3YZGJLW7.mjs.map} +0 -0
- /package/dist/esm/{chunk-KFJMLLOA.mjs.map → chunk-4P5EKAJB.mjs.map} +0 -0
- /package/dist/esm/{chunk-DIBNAYZ2.mjs.map → chunk-5HY3DEPF.mjs.map} +0 -0
- /package/dist/esm/{chunk-NPNAKSCR.mjs.map → chunk-6OV2PQS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-BAV4XY7C.mjs.map} +0 -0
- /package/dist/esm/{chunk-3YNRBMPS.mjs.map → chunk-BE4FOV6X.mjs.map} +0 -0
- /package/dist/esm/{chunk-33WBJV5U.mjs.map → chunk-BIAEC6FO.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-BWFJHFBQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZGTJMNZG.mjs.map → chunk-CF5R4HVB.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-DMKUAQB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-DSTKXJMA.mjs.map} +0 -0
- /package/dist/esm/{account/Account.mjs.map → chunk-E7FWVXGX.mjs.map} +0 -0
- /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-FS3NSGBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-FXNFWLQC.mjs.map} +0 -0
- /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-IOSQVDZI.mjs.map} +0 -0
- /package/dist/esm/{chunk-YGB7MEH3.mjs.map → chunk-IR46T46A.mjs.map} +0 -0
- /package/dist/esm/{chunk-RDNPWCZ4.mjs.map → chunk-JCD72AW7.mjs.map} +0 -0
- /package/dist/esm/{chunk-GI52SX32.mjs.map → chunk-L5IL2IAB.mjs.map} +0 -0
- /package/dist/esm/{account/Ed25519Account.mjs.map → chunk-MLWIHWNH.mjs.map} +0 -0
- /package/dist/esm/{chunk-A7L2Z5DW.mjs.map → chunk-N77VJHW5.mjs.map} +0 -0
- /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-NPFNYP75.mjs.map} +0 -0
- /package/dist/esm/{chunk-LV7OW245.mjs.map → chunk-NWYIE7ZX.mjs.map} +0 -0
- /package/dist/esm/{chunk-5QBTBH64.mjs.map → chunk-NZGRLKRG.mjs.map} +0 -0
- /package/dist/esm/{chunk-PTIZKRON.mjs.map → chunk-O4JRPZZM.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-OGHE4AQA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-QIAHBEEW.mjs.map} +0 -0
- /package/dist/esm/{chunk-ODTNF2YP.mjs.map → chunk-QIAU5K5Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-QTRYMRYK.mjs.map} +0 -0
- /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-R5QUBEH6.mjs.map} +0 -0
- /package/dist/esm/{account/EphemeralKeyPair.mjs.map → chunk-R7G3CLRI.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-RHBCVCOS.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7JIGO3O.mjs.map → chunk-S2LTZKM4.mjs.map} +0 -0
- /package/dist/esm/{chunk-6CQH7JPF.mjs.map → chunk-SPU745XV.mjs.map} +0 -0
- /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-TBMAJ6AW.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-TGXZVNR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-PFFAQZHT.mjs.map → chunk-U43IJHQN.mjs.map} +0 -0
- /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-UML2VQZT.mjs.map} +0 -0
- /package/dist/esm/{chunk-KOCKKI4F.mjs.map → chunk-UNU3RVRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-UPIN5AIO.mjs.map} +0 -0
- /package/dist/esm/{account/KeylessAccount.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
- /package/dist/esm/{chunk-YI7FZPIK.mjs.map → chunk-WCVUDO5S.mjs.map} +0 -0
- /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-WFZDFFBM.mjs.map} +0 -0
- /package/dist/esm/{chunk-XHPLLMR5.mjs.map → chunk-XO3HHRJV.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-ZYYK3UXP.mjs.map} +0 -0
- /package/dist/esm/{account/MultiKeyAccount.mjs.map → cli/move.mjs.map} +0 -0
- /package/dist/esm/{account/SingleKeyAccount.mjs.map → core/account/Account.mjs.map} +0 -0
- /package/dist/esm/{account/index.mjs.map → core/account/Ed25519Account.mjs.map} +0 -0
- /package/dist/esm/{api/keyless.mjs.map → core/account/SingleKeyAccount.mjs.map} +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { AccountAuthenticatorSingleKey } from "
|
|
2
|
-
import { type HexInput, SigningScheme, SigningSchemeInput } from "
|
|
3
|
-
import { AccountAddress, AccountAddressInput } from "../
|
|
4
|
-
import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../
|
|
1
|
+
import { AccountAuthenticatorSingleKey } from "../../transactions/authenticator/account";
|
|
2
|
+
import { type HexInput, SigningScheme, SigningSchemeInput } from "../../types";
|
|
3
|
+
import { AccountAddress, AccountAddressInput } from "../accountAddress";
|
|
4
|
+
import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../crypto";
|
|
5
5
|
import type { Account } from "./Account";
|
|
6
|
-
import { generateSigningMessageForTransaction } from "../transactions/transactionBuilder/signingMessage";
|
|
7
|
-
import { AnyRawTransaction } from "../transactions/types";
|
|
8
6
|
|
|
9
7
|
export interface SingleKeySignerConstructorArgs {
|
|
10
8
|
privateKey: PrivateKey;
|
|
@@ -108,17 +106,14 @@ export class SingleKeyAccount implements Account {
|
|
|
108
106
|
return this.publicKey.verifySignature(args);
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
signWithAuthenticator(
|
|
112
|
-
const
|
|
109
|
+
signWithAuthenticator(message: HexInput) {
|
|
110
|
+
const innerSignature = this.privateKey.sign(message);
|
|
111
|
+
const signature = new AnySignature(innerSignature);
|
|
113
112
|
return new AccountAuthenticatorSingleKey(this.publicKey, signature);
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
sign(message: HexInput) {
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
signTransaction(transaction: AnyRawTransaction) {
|
|
121
|
-
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
116
|
+
return this.signWithAuthenticator(message).signature;
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
// endregion
|
|
@@ -7,7 +7,7 @@ import { Serializable, Serializer } from "../../bcs/serializer";
|
|
|
7
7
|
import { AuthenticationKey } from "../authenticationKey";
|
|
8
8
|
import { Hex } from "../hex";
|
|
9
9
|
import { HexInput, SigningScheme as AuthenticationKeyScheme } from "../../types";
|
|
10
|
-
import {
|
|
10
|
+
import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
|
|
11
11
|
import { PrivateKey } from "./privateKey";
|
|
12
12
|
import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
|
|
13
13
|
import { Signature } from "./signature";
|
|
@@ -185,9 +185,29 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
185
185
|
if (!isValidHardenedPath(path)) {
|
|
186
186
|
throw new Error(`Invalid derivation path ${path}`);
|
|
187
187
|
}
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A private inner function so we can separate from the main fromDerivationPath() method
|
|
193
|
+
* to add tests to verify we create the keys correctly.
|
|
194
|
+
*
|
|
195
|
+
* @param path the BIP44 path
|
|
196
|
+
* @param seed the seed phrase created by the mnemonics
|
|
197
|
+
* @param offset the offset used for key derivation, defaults to 0x80000000
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {
|
|
201
|
+
const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);
|
|
202
|
+
|
|
203
|
+
const segments = splitPath(path).map((el) => parseInt(el, 10));
|
|
204
|
+
|
|
205
|
+
// Derive the child key based on the path
|
|
206
|
+
const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
|
|
207
|
+
key,
|
|
208
|
+
chainCode,
|
|
209
|
+
});
|
|
210
|
+
return new Ed25519PrivateKey(privateKey);
|
|
191
211
|
}
|
|
192
212
|
|
|
193
213
|
// endregion
|
package/src/core/crypto/hdKey.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { hmac } from "@noble/hashes/hmac";
|
|
5
5
|
import { sha512 } from "@noble/hashes/sha512";
|
|
6
6
|
import * as bip39 from "@scure/bip39";
|
|
7
|
-
import { HexInput } from "../../types";
|
|
8
7
|
|
|
9
8
|
export type DerivedKeys = {
|
|
10
9
|
key: Uint8Array;
|
|
@@ -16,7 +15,6 @@ export type DerivedKeys = {
|
|
|
16
15
|
*/
|
|
17
16
|
export const APTOS_HARDENED_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/;
|
|
18
17
|
export const APTOS_BIP44_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/;
|
|
19
|
-
export const APTOS_BIP44_DEFAULT_DERIVATION_PATH = "m/44'/637'/0'/0'/0'";
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* A list of supported key types and associated seeds
|
|
@@ -93,35 +91,6 @@ const removeApostrophes = (val: string): string => val.replace("'", "");
|
|
|
93
91
|
*/
|
|
94
92
|
export const splitPath = (path: string): Array<string> => path.split("/").slice(1).map(removeApostrophes);
|
|
95
93
|
|
|
96
|
-
/**
|
|
97
|
-
* @param path the BIP44 path
|
|
98
|
-
* @param seed the seed phrase created by the mnemonics
|
|
99
|
-
* @param offset the offset used for key derivation, defaults to 0x80000000
|
|
100
|
-
* @returns
|
|
101
|
-
*/
|
|
102
|
-
export function fromDerivationPath(
|
|
103
|
-
path: string,
|
|
104
|
-
hashSeed: HexInput,
|
|
105
|
-
seed: Uint8Array,
|
|
106
|
-
offset = HARDENED_OFFSET,
|
|
107
|
-
): Uint8Array {
|
|
108
|
-
if (offset === HARDENED_OFFSET && !isValidHardenedPath(path)) {
|
|
109
|
-
throw new Error(`Invalid hardened derivation path ${path}`);
|
|
110
|
-
} else if (offset !== HARDENED_OFFSET && !isValidBIP44Path(path)) {
|
|
111
|
-
throw new Error(`Invalid derivation path ${path}`);
|
|
112
|
-
}
|
|
113
|
-
const { key, chainCode } = deriveKey(hashSeed, seed);
|
|
114
|
-
|
|
115
|
-
const segments = splitPath(path).map((el) => parseInt(el, 10));
|
|
116
|
-
|
|
117
|
-
// Derive the child key based on the path
|
|
118
|
-
const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
|
|
119
|
-
key,
|
|
120
|
-
chainCode,
|
|
121
|
-
});
|
|
122
|
-
return privateKey;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
94
|
/**
|
|
126
95
|
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
127
96
|
* @param mnemonic the mnemonic seed phrase
|
package/src/core/crypto/index.ts
CHANGED
|
@@ -5,8 +5,6 @@ export * from "./ed25519";
|
|
|
5
5
|
export * from "./hdKey";
|
|
6
6
|
export * from "./multiEd25519";
|
|
7
7
|
export * from "./multiKey";
|
|
8
|
-
export * from "./ephemeral";
|
|
9
|
-
export * from "./keyless";
|
|
10
8
|
export * from "./privateKey";
|
|
11
9
|
export * from "./publicKey";
|
|
12
10
|
export * from "./secp256k1";
|
|
@@ -139,19 +139,9 @@ export class MultiKey extends AccountPublicKey {
|
|
|
139
139
|
|
|
140
140
|
return bitmap;
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
getIndex(publicKey: PublicKey): number {
|
|
144
|
-
const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);
|
|
145
|
-
const index = this.publicKeys.findIndex((pk) => pk.toString() === anyPublicKey.toString());
|
|
146
|
-
|
|
147
|
-
if (index !== -1) {
|
|
148
|
-
return index;
|
|
149
|
-
}
|
|
150
|
-
throw new Error("Public key not found in MultiKey");
|
|
151
|
-
}
|
|
152
142
|
}
|
|
153
143
|
|
|
154
|
-
export class
|
|
144
|
+
export class MultiKeySignature extends Signature {
|
|
155
145
|
/**
|
|
156
146
|
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
157
147
|
*/
|
|
@@ -160,7 +150,7 @@ export class MultiSignature extends Signature {
|
|
|
160
150
|
/**
|
|
161
151
|
* Maximum number of Ed25519 signatures supported
|
|
162
152
|
*/
|
|
163
|
-
static MAX_SIGNATURES_SUPPORTED =
|
|
153
|
+
static MAX_SIGNATURES_SUPPORTED = MultiKeySignature.BITMAP_LEN * 8;
|
|
164
154
|
|
|
165
155
|
/**
|
|
166
156
|
* The list of underlying Ed25519 signatures
|
|
@@ -188,8 +178,8 @@ export class MultiSignature extends Signature {
|
|
|
188
178
|
super();
|
|
189
179
|
const { signatures, bitmap } = args;
|
|
190
180
|
|
|
191
|
-
if (signatures.length >
|
|
192
|
-
throw new Error(`The number of signatures cannot be greater than ${
|
|
181
|
+
if (signatures.length > MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {
|
|
182
|
+
throw new Error(`The number of signatures cannot be greater than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED}`);
|
|
193
183
|
}
|
|
194
184
|
|
|
195
185
|
// Make sure that all signatures are normalized to the SingleKey authentication scheme
|
|
@@ -198,9 +188,9 @@ export class MultiSignature extends Signature {
|
|
|
198
188
|
);
|
|
199
189
|
|
|
200
190
|
if (!(bitmap instanceof Uint8Array)) {
|
|
201
|
-
this.bitmap =
|
|
202
|
-
} else if (bitmap.length !==
|
|
203
|
-
throw new Error(`"bitmap" length should be ${
|
|
191
|
+
this.bitmap = MultiKeySignature.createBitmap({ bits: bitmap });
|
|
192
|
+
} else if (bitmap.length !== MultiKeySignature.BITMAP_LEN) {
|
|
193
|
+
throw new Error(`"bitmap" length should be ${MultiKeySignature.BITMAP_LEN}`);
|
|
204
194
|
} else {
|
|
205
195
|
this.bitmap = bitmap;
|
|
206
196
|
}
|
|
@@ -236,8 +226,8 @@ export class MultiSignature extends Signature {
|
|
|
236
226
|
const dupCheckSet = new Set();
|
|
237
227
|
|
|
238
228
|
bits.forEach((bit: number) => {
|
|
239
|
-
if (bit >=
|
|
240
|
-
throw new Error(`Cannot have a signature larger than ${
|
|
229
|
+
if (bit >= MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {
|
|
230
|
+
throw new Error(`Cannot have a signature larger than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED - 1}.`);
|
|
241
231
|
}
|
|
242
232
|
|
|
243
233
|
if (dupCheckSet.has(bit)) {
|
|
@@ -275,7 +265,7 @@ export class MultiSignature extends Signature {
|
|
|
275
265
|
serializer.serializeBytes(this.bitmap);
|
|
276
266
|
}
|
|
277
267
|
|
|
278
|
-
static deserialize(deserializer: Deserializer):
|
|
268
|
+
static deserialize(deserializer: Deserializer): MultiKeySignature {
|
|
279
269
|
const bitmap = deserializer.deserializeBytes();
|
|
280
270
|
const nSignatures = bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);
|
|
281
271
|
const signatures: AnySignature[] = [];
|
|
@@ -283,7 +273,7 @@ export class MultiSignature extends Signature {
|
|
|
283
273
|
const signature = AnySignature.deserialize(deserializer);
|
|
284
274
|
signatures.push(signature);
|
|
285
275
|
}
|
|
286
|
-
return new
|
|
276
|
+
return new MultiKeySignature({ signatures, bitmap });
|
|
287
277
|
}
|
|
288
278
|
|
|
289
279
|
// endregion
|
|
@@ -4,7 +4,6 @@ import { AuthenticationKey } from "../authenticationKey";
|
|
|
4
4
|
import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
|
|
5
5
|
import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
|
|
6
6
|
import { Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
|
|
7
|
-
import { KeylessPublicKey, KeylessSignature } from "./keyless";
|
|
8
7
|
import { Signature } from "./signature";
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -35,8 +34,6 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
35
34
|
this.variant = AnyPublicKeyVariant.Ed25519;
|
|
36
35
|
} else if (publicKey instanceof Secp256k1PublicKey) {
|
|
37
36
|
this.variant = AnyPublicKeyVariant.Secp256k1;
|
|
38
|
-
} else if (publicKey instanceof KeylessPublicKey) {
|
|
39
|
-
this.variant = AnyPublicKeyVariant.Keyless;
|
|
40
37
|
} else {
|
|
41
38
|
throw new Error("Unsupported public key type");
|
|
42
39
|
}
|
|
@@ -88,9 +85,6 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
88
85
|
case AnyPublicKeyVariant.Secp256k1:
|
|
89
86
|
publicKey = Secp256k1PublicKey.deserialize(deserializer);
|
|
90
87
|
break;
|
|
91
|
-
case AnyPublicKeyVariant.Keyless:
|
|
92
|
-
publicKey = KeylessPublicKey.deserialize(deserializer);
|
|
93
|
-
break;
|
|
94
88
|
default:
|
|
95
89
|
throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
|
|
96
90
|
}
|
|
@@ -144,8 +138,6 @@ export class AnySignature extends Signature {
|
|
|
144
138
|
this.variant = AnySignatureVariant.Ed25519;
|
|
145
139
|
} else if (signature instanceof Secp256k1Signature) {
|
|
146
140
|
this.variant = AnySignatureVariant.Secp256k1;
|
|
147
|
-
} else if (signature instanceof KeylessSignature) {
|
|
148
|
-
this.variant = AnySignatureVariant.Keyless;
|
|
149
141
|
} else {
|
|
150
142
|
throw new Error("Unsupported signature type");
|
|
151
143
|
}
|
|
@@ -178,9 +170,6 @@ export class AnySignature extends Signature {
|
|
|
178
170
|
case AnySignatureVariant.Secp256k1:
|
|
179
171
|
signature = Secp256k1Signature.deserialize(deserializer);
|
|
180
172
|
break;
|
|
181
|
-
case AnySignatureVariant.Keyless:
|
|
182
|
-
signature = KeylessSignature.deserialize(deserializer);
|
|
183
|
-
break;
|
|
184
173
|
default:
|
|
185
174
|
throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);
|
|
186
175
|
}
|
package/src/core/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/internal/account.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { AptosApiError, getAptosFullNode, paginateWithCursor } from "../client";
|
|
13
13
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
14
|
-
import { Account } from "../account";
|
|
14
|
+
import { Account } from "../core/account";
|
|
15
15
|
import { AnyPublicKey, Ed25519PublicKey, PrivateKey } from "../core/crypto";
|
|
16
16
|
import { getTableItem, queryIndexer } from "./general";
|
|
17
17
|
import {
|
package/src/internal/ans.ts
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
|
-
import { Account } from "../
|
|
13
|
-
import { AccountAddress, AccountAddressInput } from "../core";
|
|
12
|
+
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
14
13
|
import { InputGenerateTransactionOptions } from "../transactions/types";
|
|
15
14
|
import { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from "../types";
|
|
16
15
|
import { GetNamesQuery } from "../types/generated/operations";
|
|
@@ -79,7 +78,6 @@ const NetworkToAnsContract: Record<Network, string | null> = {
|
|
|
79
78
|
[Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,
|
|
80
79
|
[Network.CUSTOM]: null,
|
|
81
80
|
[Network.DEVNET]: null,
|
|
82
|
-
[Network.RANDOMNET]: null,
|
|
83
81
|
};
|
|
84
82
|
|
|
85
83
|
function getRouterAddress(aptosConfig: AptosConfig): string {
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { Bool, MoveString, MoveVector, U64 } from "../bcs";
|
|
13
|
-
import { AccountAddress, AccountAddressInput } from "../core";
|
|
14
|
-
import { Account } from "../account";
|
|
13
|
+
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
15
14
|
import { EntryFunctionABI, InputGenerateTransactionOptions } from "../transactions/types";
|
|
16
15
|
import {
|
|
17
16
|
AnyNumber,
|
|
@@ -33,8 +33,7 @@ import {
|
|
|
33
33
|
FungibleAssetActivitiesBoolExp,
|
|
34
34
|
FungibleAssetMetadataBoolExp,
|
|
35
35
|
} from "../types/generated/types";
|
|
36
|
-
import { AccountAddressInput } from "../core";
|
|
37
|
-
import { Account } from "../account";
|
|
36
|
+
import { Account, AccountAddressInput } from "../core";
|
|
38
37
|
import {
|
|
39
38
|
EntryFunctionABI,
|
|
40
39
|
InputGenerateTransactionOptions,
|
|
@@ -118,7 +117,7 @@ export async function getCurrentFungibleAssetBalances(args: {
|
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
const faTransferAbi: EntryFunctionABI = {
|
|
121
|
-
typeParameters: [],
|
|
120
|
+
typeParameters: [{ constraints: [] }],
|
|
122
121
|
parameters: [parseTypeTag("0x1::object::Object"), new TypeTagAddress(), new TypeTagU64()],
|
|
123
122
|
};
|
|
124
123
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AptosConfig } from "../api/aptosConfig";
|
|
9
9
|
import { MoveVector, U8 } from "../bcs";
|
|
10
10
|
import { postAptosFullNode } from "../client";
|
|
11
|
-
import { Account
|
|
11
|
+
import { Account } from "../core/account";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
13
13
|
import { PrivateKey } from "../core/crypto";
|
|
14
14
|
import { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
generateTransactionPayload,
|
|
19
19
|
generateSignedTransactionForSimulation,
|
|
20
20
|
generateSignedTransaction,
|
|
21
|
+
sign,
|
|
22
|
+
generateSigningMessage,
|
|
21
23
|
} from "../transactions/transactionBuilder/transactionBuilder";
|
|
22
24
|
import {
|
|
23
25
|
InputGenerateTransactionData,
|
|
@@ -33,7 +35,7 @@ import {
|
|
|
33
35
|
} from "../transactions/types";
|
|
34
36
|
import { getInfo } from "./account";
|
|
35
37
|
import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from "../types";
|
|
36
|
-
import { TypeTagU8, TypeTagVector
|
|
38
|
+
import { TypeTagU8, TypeTagVector } from "../transactions";
|
|
37
39
|
import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
|
|
38
40
|
import { MultiAgentTransaction } from "../transactions/instances/multiAgentTransaction";
|
|
39
41
|
|
|
@@ -183,7 +185,7 @@ function isMultiAgentTransactionInput(
|
|
|
183
185
|
*/
|
|
184
186
|
export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
|
|
185
187
|
const { transaction } = args;
|
|
186
|
-
return
|
|
188
|
+
return generateSigningMessage(transaction);
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
/**
|
|
@@ -202,8 +204,8 @@ export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uin
|
|
|
202
204
|
* @return The signer AccountAuthenticator
|
|
203
205
|
*/
|
|
204
206
|
export function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
|
|
205
|
-
const {
|
|
206
|
-
return
|
|
207
|
+
const accountAuthenticator = sign({ ...args });
|
|
208
|
+
return accountAuthenticator;
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
/**
|
|
@@ -275,9 +277,6 @@ export async function signAndSubmitTransaction(args: {
|
|
|
275
277
|
transaction: AnyRawTransaction;
|
|
276
278
|
}): Promise<PendingTransactionResponse> {
|
|
277
279
|
const { aptosConfig, signer, transaction } = args;
|
|
278
|
-
if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {
|
|
279
|
-
await signer.waitForProofFetch();
|
|
280
|
-
}
|
|
281
280
|
const authenticator = signTransaction({ signer, transaction });
|
|
282
281
|
return submitTransaction({
|
|
283
282
|
aptosConfig,
|
|
@@ -7,7 +7,7 @@ import { Serializer, Deserializer, Serializable } from "../../bcs";
|
|
|
7
7
|
import { AnyPublicKey, AnySignature } from "../../core/crypto";
|
|
8
8
|
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
9
9
|
import { MultiEd25519PublicKey, MultiEd25519Signature } from "../../core/crypto/multiEd25519";
|
|
10
|
-
import { MultiKey
|
|
10
|
+
import { MultiKey } from "../../core/crypto/multiKey";
|
|
11
11
|
import { AccountAuthenticatorVariant } from "../../types";
|
|
12
12
|
|
|
13
13
|
export abstract class AccountAuthenticator extends Serializable {
|
|
@@ -149,23 +149,28 @@ export class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
|
149
149
|
export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
150
150
|
public readonly public_keys: MultiKey;
|
|
151
151
|
|
|
152
|
-
public readonly signatures:
|
|
152
|
+
public readonly signatures: Array<AnySignature>;
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
public readonly signatures_bitmap: Uint8Array;
|
|
155
|
+
|
|
156
|
+
constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array) {
|
|
155
157
|
super();
|
|
156
158
|
this.public_keys = public_keys;
|
|
157
159
|
this.signatures = signatures;
|
|
160
|
+
this.signatures_bitmap = signatures_bitmap;
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
serialize(serializer: Serializer): void {
|
|
161
164
|
serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);
|
|
162
165
|
this.public_keys.serialize(serializer);
|
|
163
|
-
this.signatures
|
|
166
|
+
serializer.serializeVector<AnySignature>(this.signatures);
|
|
167
|
+
serializer.serializeBytes(this.signatures_bitmap);
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {
|
|
167
171
|
const public_keys = MultiKey.deserialize(deserializer);
|
|
168
|
-
const signatures =
|
|
169
|
-
|
|
172
|
+
const signatures = deserializer.deserializeVector(AnySignature);
|
|
173
|
+
const signatures_bitmap = deserializer.deserializeBytes();
|
|
174
|
+
return new AccountAuthenticatorMultiKey(public_keys, signatures, signatures_bitmap);
|
|
170
175
|
}
|
|
171
176
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import EventEmitter from "eventemitter3";
|
|
4
4
|
import { AptosConfig } from "../../api/aptosConfig";
|
|
5
|
-
import { Account } from "../../
|
|
5
|
+
import { Account } from "../../core";
|
|
6
6
|
import { waitForTransaction } from "../../internal/transaction";
|
|
7
7
|
import { generateTransaction, signAndSubmitTransaction } from "../../internal/transactionSubmission";
|
|
8
8
|
import { PendingTransactionResponse, TransactionResponse } from "../../types";
|
|
@@ -233,13 +233,7 @@ export class TransactionWorker extends EventEmitter<TransactionWorkerEvents> {
|
|
|
233
233
|
async checkTransaction(sentTransaction: PromiseFulfilledResult<PendingTransactionResponse>, sequenceNumber: bigint) {
|
|
234
234
|
try {
|
|
235
235
|
const waitFor: Array<Promise<TransactionResponse>> = [];
|
|
236
|
-
waitFor.push(
|
|
237
|
-
waitForTransaction({
|
|
238
|
-
aptosConfig: this.aptosConfig,
|
|
239
|
-
transactionHash: sentTransaction.value.hash,
|
|
240
|
-
options: { timeoutSecs: 3 },
|
|
241
|
-
}),
|
|
242
|
-
);
|
|
236
|
+
waitFor.push(waitForTransaction({ aptosConfig: this.aptosConfig, transactionHash: sentTransaction.value.hash }));
|
|
243
237
|
const sentTransactions = await Promise.allSettled(waitFor);
|
|
244
238
|
|
|
245
239
|
for (let i = 0; i < sentTransactions.length; i += 1) {
|
|
@@ -9,13 +9,20 @@
|
|
|
9
9
|
import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
|
|
10
10
|
import { AptosConfig } from "../../api/aptosConfig";
|
|
11
11
|
import { AccountAddress, AccountAddressInput, Hex, PublicKey } from "../../core";
|
|
12
|
+
import { Account } from "../../core/account";
|
|
12
13
|
import { AnyPublicKey, AnySignature } from "../../core/crypto";
|
|
13
14
|
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
15
|
+
import { Secp256k1PublicKey, Secp256k1Signature } from "../../core/crypto/secp256k1";
|
|
14
16
|
import { getInfo } from "../../internal/account";
|
|
15
17
|
import { getLedgerInfo } from "../../internal/general";
|
|
16
18
|
import { getGasPriceEstimation } from "../../internal/transaction";
|
|
17
19
|
import { NetworkToChainId } from "../../utils/apiEndpoints";
|
|
18
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_MAX_GAS_AMOUNT,
|
|
22
|
+
DEFAULT_TXN_EXP_SEC_FROM_NOW,
|
|
23
|
+
RAW_TRANSACTION_SALT,
|
|
24
|
+
RAW_TRANSACTION_WITH_DATA_SALT,
|
|
25
|
+
} from "../../utils/const";
|
|
19
26
|
import { normalizeBundle } from "../../utils/normalizeBundle";
|
|
20
27
|
import {
|
|
21
28
|
AccountAuthenticator,
|
|
@@ -46,6 +53,7 @@ import { SignedTransaction } from "../instances/signedTransaction";
|
|
|
46
53
|
import {
|
|
47
54
|
AnyRawTransaction,
|
|
48
55
|
AnyTransactionPayloadInstance,
|
|
56
|
+
AnyRawTransactionInstance,
|
|
49
57
|
EntryFunctionArgumentTypes,
|
|
50
58
|
InputGenerateMultiAgentRawTransactionArgs,
|
|
51
59
|
InputGenerateRawTransactionArgs,
|
|
@@ -443,7 +451,12 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
443
451
|
export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
444
452
|
// TODO add support for AnyMultiKey
|
|
445
453
|
if (publicKey instanceof AnyPublicKey) {
|
|
446
|
-
|
|
454
|
+
if (publicKey.publicKey instanceof Ed25519PublicKey) {
|
|
455
|
+
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));
|
|
456
|
+
}
|
|
457
|
+
if (publicKey.publicKey instanceof Secp256k1PublicKey) {
|
|
458
|
+
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
|
|
459
|
+
}
|
|
447
460
|
}
|
|
448
461
|
|
|
449
462
|
// legacy code
|
|
@@ -453,6 +466,24 @@ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
|
453
466
|
);
|
|
454
467
|
}
|
|
455
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Sign a transaction that can later be submitted to chain
|
|
471
|
+
*
|
|
472
|
+
* @param args.signer The signer account to sign the transaction
|
|
473
|
+
* @param args.transaction A aptos transaction type to sign
|
|
474
|
+
*
|
|
475
|
+
* @return The signer AccountAuthenticator
|
|
476
|
+
*/
|
|
477
|
+
export function sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
|
|
478
|
+
const { signer, transaction } = args;
|
|
479
|
+
|
|
480
|
+
// get the signing message
|
|
481
|
+
const message = generateSigningMessage(transaction);
|
|
482
|
+
|
|
483
|
+
// account.signMessage
|
|
484
|
+
return signer.signWithAuthenticator(message);
|
|
485
|
+
}
|
|
486
|
+
|
|
456
487
|
/**
|
|
457
488
|
* Prepare a transaction to be submitted to chain
|
|
458
489
|
*
|
|
@@ -534,52 +565,48 @@ export function generateUserTransactionHash(args: InputSubmitTransactionData): s
|
|
|
534
565
|
}
|
|
535
566
|
|
|
536
567
|
/**
|
|
537
|
-
*
|
|
568
|
+
* Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
|
|
538
569
|
*
|
|
539
|
-
* @param transaction
|
|
540
|
-
* @param senderAuthenticator The account authenticator of the transaction sender
|
|
541
|
-
* @param secondarySignerAuthenticators The extra signers account Authenticators
|
|
570
|
+
* @param transaction A aptos transaction type
|
|
542
571
|
*
|
|
543
|
-
* @returns
|
|
572
|
+
* @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction
|
|
544
573
|
*/
|
|
545
|
-
export function
|
|
546
|
-
transaction
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
if (transaction instanceof FeePayerRawTransaction) {
|
|
552
|
-
if (!feePayerAuthenticator) {
|
|
553
|
-
throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");
|
|
554
|
-
}
|
|
555
|
-
const txAuthenticatorFeePayer = new TransactionAuthenticatorFeePayer(
|
|
556
|
-
senderAuthenticator,
|
|
557
|
-
transaction.secondary_signer_addresses,
|
|
558
|
-
additionalSignersAuthenticators ?? [],
|
|
559
|
-
{
|
|
560
|
-
address: transaction.fee_payer_address,
|
|
561
|
-
authenticator: feePayerAuthenticator,
|
|
562
|
-
},
|
|
574
|
+
export function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {
|
|
575
|
+
if (transaction.feePayerAddress) {
|
|
576
|
+
return new FeePayerRawTransaction(
|
|
577
|
+
transaction.rawTransaction,
|
|
578
|
+
transaction.secondarySignerAddresses ?? [],
|
|
579
|
+
transaction.feePayerAddress,
|
|
563
580
|
);
|
|
564
|
-
return new SignedTransaction(transaction.raw_txn, txAuthenticatorFeePayer).bcsToBytes();
|
|
565
581
|
}
|
|
566
|
-
if (transaction
|
|
567
|
-
|
|
568
|
-
throw new Error(
|
|
569
|
-
"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction",
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
const multiAgentAuthenticator = new TransactionAuthenticatorMultiAgent(
|
|
573
|
-
senderAuthenticator,
|
|
574
|
-
transaction.secondary_signer_addresses,
|
|
575
|
-
additionalSignersAuthenticators ?? [],
|
|
576
|
-
);
|
|
577
|
-
return new SignedTransaction(transaction.raw_txn, multiAgentAuthenticator).bcsToBytes();
|
|
582
|
+
if (transaction.secondarySignerAddresses) {
|
|
583
|
+
return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);
|
|
578
584
|
}
|
|
579
585
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
586
|
+
return transaction.rawTransaction;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export function generateSigningMessage(transaction: AnyRawTransaction): Uint8Array {
|
|
590
|
+
const hash = sha3Hash.create();
|
|
591
|
+
|
|
592
|
+
if (transaction.feePayerAddress) {
|
|
593
|
+
hash.update(RAW_TRANSACTION_WITH_DATA_SALT);
|
|
594
|
+
} else if (transaction.secondarySignerAddresses) {
|
|
595
|
+
hash.update(RAW_TRANSACTION_WITH_DATA_SALT);
|
|
596
|
+
} else {
|
|
597
|
+
hash.update(RAW_TRANSACTION_SALT);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const prefix = hash.digest();
|
|
601
|
+
|
|
602
|
+
const rawTxn = deriveTransactionType(transaction);
|
|
603
|
+
const body = rawTxn.bcsToBytes();
|
|
604
|
+
|
|
605
|
+
const mergedArray = new Uint8Array(prefix.length + body.length);
|
|
606
|
+
mergedArray.set(prefix);
|
|
607
|
+
mergedArray.set(body, prefix.length);
|
|
608
|
+
|
|
609
|
+
return mergedArray;
|
|
583
610
|
}
|
|
584
611
|
|
|
585
612
|
/**
|