@aptos-labs/ts-sdk 1.27.1 → 1.28.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-LOYE4_sG.d.ts → accountAddress-OVl7-qVN.d.ts} +2 -1
- package/dist/common/chunk-HBPH2AD3.js +2 -0
- package/dist/common/chunk-HBPH2AD3.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +51 -5
- package/dist/common/index.js +27 -27
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +2 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +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.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- 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.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +10 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-NCWD4NA3.mjs → chunk-2CAGPXCX.mjs} +2 -2
- package/dist/esm/{chunk-Q67DUNMI.mjs → chunk-2XYA7NOU.mjs} +2 -2
- package/dist/esm/{chunk-2N2VEGT6.mjs → chunk-3F3FCWT5.mjs} +2 -2
- package/dist/esm/{chunk-3SPU4V2B.mjs → chunk-3GOJQ5JD.mjs} +2 -2
- package/dist/esm/{chunk-G7UNU5GI.mjs → chunk-3HTSCV3R.mjs} +2 -2
- package/dist/esm/{chunk-H33YIMTU.mjs → chunk-4ENUSVZB.mjs} +2 -2
- package/dist/esm/chunk-52HZTDBB.mjs +2 -0
- package/dist/esm/chunk-52HZTDBB.mjs.map +1 -0
- package/dist/esm/{chunk-76HTG7Z7.mjs → chunk-53DBMWMU.mjs} +2 -2
- package/dist/esm/{chunk-I5XQKNOK.mjs → chunk-54QUDAAC.mjs} +2 -2
- package/dist/esm/{chunk-7AIKM3UF.mjs → chunk-56F7EYFE.mjs} +2 -2
- package/dist/esm/{chunk-JKNTGRSQ.mjs → chunk-5L3UXSQI.mjs} +2 -2
- package/dist/esm/{chunk-PY4TS34X.mjs → chunk-5P7MXLZA.mjs} +2 -2
- package/dist/esm/{chunk-6BYVG7H4.mjs → chunk-5TBIWC7N.mjs} +2 -2
- package/dist/esm/{chunk-ZQFFRZJ4.mjs → chunk-6CHBLB3V.mjs} +2 -2
- package/dist/esm/{chunk-NRRADUK4.mjs → chunk-AVSM2BJR.mjs} +2 -2
- package/dist/esm/{chunk-52KPINA4.mjs → chunk-B5NYEWNM.mjs} +2 -2
- package/dist/esm/{chunk-74YFNJ7A.mjs → chunk-BIGX2RJL.mjs} +2 -2
- package/dist/esm/chunk-DCNBMUKN.mjs +2 -0
- package/dist/esm/chunk-DCNBMUKN.mjs.map +1 -0
- package/dist/esm/{chunk-AYX5JMB4.mjs → chunk-DVIRUFCY.mjs} +2 -2
- package/dist/esm/{chunk-UV7M72QD.mjs → chunk-EJMPY5MF.mjs} +2 -2
- package/dist/esm/{chunk-F7NVDHR2.mjs → chunk-EQSON7Y5.mjs} +2 -2
- package/dist/esm/{chunk-GNFEBKFV.mjs → chunk-EXMQBH3I.mjs} +2 -2
- package/dist/esm/chunk-EXP5STXZ.mjs +2 -0
- package/dist/esm/chunk-EXP5STXZ.mjs.map +1 -0
- package/dist/esm/{chunk-UO52TECC.mjs → chunk-F5PNGH44.mjs} +2 -2
- package/dist/esm/chunk-G773HST5.mjs +2 -0
- package/dist/esm/chunk-G773HST5.mjs.map +1 -0
- package/dist/esm/{chunk-FOHGSNYZ.mjs → chunk-GGPA6QTN.mjs} +2 -2
- package/dist/esm/{chunk-QV6EZL2G.mjs → chunk-GKERWKMB.mjs} +2 -2
- package/dist/esm/{chunk-Y3HLYCF3.mjs → chunk-GR4PHW7K.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs → chunk-HAT5S2XX.mjs} +2 -2
- package/dist/esm/{chunk-MLL54PYO.mjs.map → chunk-HAT5S2XX.mjs.map} +1 -1
- package/dist/esm/{chunk-ZXPBRVOA.mjs → chunk-HBQLX5QF.mjs} +2 -2
- package/dist/esm/{chunk-RA3YPQG2.mjs → chunk-IVOEXGOG.mjs} +2 -2
- package/dist/esm/{chunk-5L3PLK3W.mjs → chunk-JOROI7FE.mjs} +2 -2
- package/dist/esm/chunk-JUNVPIW4.mjs +2 -0
- package/dist/esm/chunk-JUNVPIW4.mjs.map +1 -0
- package/dist/esm/{chunk-T2NJUIOQ.mjs → chunk-KRIIRH5L.mjs} +2 -2
- package/dist/esm/{chunk-7Y3MRBG6.mjs → chunk-LFUBUXHD.mjs} +2 -2
- package/dist/esm/{chunk-YXITAP46.mjs → chunk-LJZPPBTH.mjs} +2 -2
- package/dist/esm/{chunk-5IUXBOS5.mjs → chunk-LS6G4DZV.mjs} +2 -2
- package/dist/esm/{chunk-GXTEJ7NO.mjs → chunk-MNVDBUF3.mjs} +2 -2
- package/dist/esm/{chunk-ORXEFE6X.mjs → chunk-NBO2BDDZ.mjs} +2 -2
- package/dist/esm/{chunk-2CC67KW5.mjs → chunk-NDJKEFNU.mjs} +2 -2
- package/dist/esm/{chunk-A4T373F3.mjs → chunk-NKDHR2DA.mjs} +2 -2
- package/dist/esm/{chunk-FNT3VLRD.mjs → chunk-NPFW6ZFY.mjs} +2 -2
- package/dist/esm/{chunk-KEN2VRIM.mjs → chunk-OPTI3MH2.mjs} +2 -2
- package/dist/esm/{chunk-QE5OL6KN.mjs → chunk-ORGMRM5K.mjs} +2 -2
- package/dist/esm/{chunk-SONTIUAM.mjs → chunk-OTNGLTKS.mjs} +2 -2
- package/dist/esm/{chunk-CTJX4CUF.mjs → chunk-P2EKDA7R.mjs} +2 -2
- package/dist/esm/{chunk-GHKMF253.mjs → chunk-PDNA4H34.mjs} +2 -2
- package/dist/esm/{chunk-ECKJI2TV.mjs → chunk-QQHA2Y46.mjs} +2 -2
- package/dist/esm/chunk-QQU4IQ27.mjs +2 -0
- package/dist/esm/chunk-QQU4IQ27.mjs.map +1 -0
- package/dist/esm/{chunk-WHW4Z7TK.mjs → chunk-SCYGW3VV.mjs} +2 -2
- package/dist/esm/{chunk-3NRBTP3S.mjs → chunk-SUAA25UP.mjs} +2 -2
- package/dist/esm/{chunk-YY2XW5R4.mjs → chunk-T53MZO2U.mjs} +2 -2
- package/dist/esm/chunk-UAL27G6B.mjs +2 -0
- package/dist/esm/chunk-UAL27G6B.mjs.map +1 -0
- package/dist/esm/{chunk-MEKXPGK7.mjs → chunk-VQVNUN5Y.mjs} +2 -2
- package/dist/esm/{chunk-WFOYGJS5.mjs → chunk-VTEZ6TBO.mjs} +2 -2
- package/dist/esm/{chunk-OEOUZFHD.mjs → chunk-VYXJ7FUF.mjs} +2 -2
- package/dist/esm/{chunk-4ZMI5G5L.mjs → chunk-VYXS7TLB.mjs} +2 -2
- package/dist/esm/{chunk-HKMG3LZX.mjs → chunk-WLZYSLHP.mjs} +2 -2
- package/dist/esm/{chunk-6ERHGCK2.mjs → chunk-WX6P3Q4I.mjs} +2 -2
- package/dist/esm/{chunk-USOIC4HO.mjs → chunk-WYQLUB4H.mjs} +2 -2
- package/dist/esm/{chunk-HHU7UCFI.mjs → chunk-XSTCHOUI.mjs} +2 -2
- package/dist/esm/chunk-XSTCHOUI.mjs.map +1 -0
- package/dist/esm/{chunk-ZZRSKHWS.mjs → chunk-YFMFXRJX.mjs} +2 -2
- package/dist/esm/{chunk-PO33LVUF.mjs → chunk-YPQZJ72F.mjs} +2 -2
- package/dist/esm/chunk-Z2AJWV6D.mjs +2 -0
- package/dist/esm/chunk-Z2AJWV6D.mjs.map +1 -0
- package/dist/esm/{chunk-HRIYZBXY.mjs → chunk-ZNC3FRSK.mjs} +2 -2
- package/dist/esm/{chunk-NU55IEL4.mjs → chunk-ZWX3NHGU.mjs} +2 -2
- package/dist/esm/chunk-ZXVQ2OBJ.mjs +2 -0
- package/dist/esm/{chunk-ZEYOFDIO.mjs.map → chunk-ZXVQ2OBJ.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.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.mjs +1 -1
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +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.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- 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 +2 -2
- package/dist/esm/types/index.d.mts +2 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/const.d.mts +2 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +41 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -2
- 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 +1 -1
- package/src/account/MultiKeyAccount.ts +4 -4
- package/src/api/account.ts +31 -4
- package/src/bcs/serializable/moveStructs.ts +41 -8
- package/src/cli/move.ts +1 -1
- package/src/internal/account.ts +6 -5
- package/src/internal/event.ts +10 -3
- package/src/transactions/instances/transactionPayload.ts +3 -1
- package/src/transactions/types.ts +4 -2
- package/src/types/index.ts +1 -0
- package/src/utils/const.ts +1 -0
- package/src/utils/helpers.ts +70 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-J4IUXT5W.js +0 -2
- package/dist/common/chunk-J4IUXT5W.js.map +0 -1
- package/dist/esm/chunk-4SDUQ7AS.mjs +0 -2
- package/dist/esm/chunk-4SDUQ7AS.mjs.map +0 -1
- package/dist/esm/chunk-EZIF26UH.mjs +0 -2
- package/dist/esm/chunk-EZIF26UH.mjs.map +0 -1
- package/dist/esm/chunk-HHU7UCFI.mjs.map +0 -1
- package/dist/esm/chunk-KMJ6TF6Y.mjs +0 -2
- package/dist/esm/chunk-KMJ6TF6Y.mjs.map +0 -1
- package/dist/esm/chunk-L36ZHC7J.mjs +0 -2
- package/dist/esm/chunk-L36ZHC7J.mjs.map +0 -1
- package/dist/esm/chunk-LDTF3ABK.mjs +0 -2
- package/dist/esm/chunk-LDTF3ABK.mjs.map +0 -1
- package/dist/esm/chunk-THRXIXIO.mjs +0 -2
- package/dist/esm/chunk-THRXIXIO.mjs.map +0 -1
- package/dist/esm/chunk-WABFFJGI.mjs +0 -2
- package/dist/esm/chunk-WABFFJGI.mjs.map +0 -1
- package/dist/esm/chunk-ZEYOFDIO.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs +0 -2
- package/dist/esm/chunk-ZOMXBB6Z.mjs.map +0 -1
- /package/dist/esm/{chunk-NCWD4NA3.mjs.map → chunk-2CAGPXCX.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q67DUNMI.mjs.map → chunk-2XYA7NOU.mjs.map} +0 -0
- /package/dist/esm/{chunk-2N2VEGT6.mjs.map → chunk-3F3FCWT5.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SPU4V2B.mjs.map → chunk-3GOJQ5JD.mjs.map} +0 -0
- /package/dist/esm/{chunk-G7UNU5GI.mjs.map → chunk-3HTSCV3R.mjs.map} +0 -0
- /package/dist/esm/{chunk-H33YIMTU.mjs.map → chunk-4ENUSVZB.mjs.map} +0 -0
- /package/dist/esm/{chunk-76HTG7Z7.mjs.map → chunk-53DBMWMU.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5XQKNOK.mjs.map → chunk-54QUDAAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-7AIKM3UF.mjs.map → chunk-56F7EYFE.mjs.map} +0 -0
- /package/dist/esm/{chunk-JKNTGRSQ.mjs.map → chunk-5L3UXSQI.mjs.map} +0 -0
- /package/dist/esm/{chunk-PY4TS34X.mjs.map → chunk-5P7MXLZA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6BYVG7H4.mjs.map → chunk-5TBIWC7N.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZQFFRZJ4.mjs.map → chunk-6CHBLB3V.mjs.map} +0 -0
- /package/dist/esm/{chunk-NRRADUK4.mjs.map → chunk-AVSM2BJR.mjs.map} +0 -0
- /package/dist/esm/{chunk-52KPINA4.mjs.map → chunk-B5NYEWNM.mjs.map} +0 -0
- /package/dist/esm/{chunk-74YFNJ7A.mjs.map → chunk-BIGX2RJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-AYX5JMB4.mjs.map → chunk-DVIRUFCY.mjs.map} +0 -0
- /package/dist/esm/{chunk-UV7M72QD.mjs.map → chunk-EJMPY5MF.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7NVDHR2.mjs.map → chunk-EQSON7Y5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GNFEBKFV.mjs.map → chunk-EXMQBH3I.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO52TECC.mjs.map → chunk-F5PNGH44.mjs.map} +0 -0
- /package/dist/esm/{chunk-FOHGSNYZ.mjs.map → chunk-GGPA6QTN.mjs.map} +0 -0
- /package/dist/esm/{chunk-QV6EZL2G.mjs.map → chunk-GKERWKMB.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3HLYCF3.mjs.map → chunk-GR4PHW7K.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZXPBRVOA.mjs.map → chunk-HBQLX5QF.mjs.map} +0 -0
- /package/dist/esm/{chunk-RA3YPQG2.mjs.map → chunk-IVOEXGOG.mjs.map} +0 -0
- /package/dist/esm/{chunk-5L3PLK3W.mjs.map → chunk-JOROI7FE.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2NJUIOQ.mjs.map → chunk-KRIIRH5L.mjs.map} +0 -0
- /package/dist/esm/{chunk-7Y3MRBG6.mjs.map → chunk-LFUBUXHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-YXITAP46.mjs.map → chunk-LJZPPBTH.mjs.map} +0 -0
- /package/dist/esm/{chunk-5IUXBOS5.mjs.map → chunk-LS6G4DZV.mjs.map} +0 -0
- /package/dist/esm/{chunk-GXTEJ7NO.mjs.map → chunk-MNVDBUF3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORXEFE6X.mjs.map → chunk-NBO2BDDZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2CC67KW5.mjs.map → chunk-NDJKEFNU.mjs.map} +0 -0
- /package/dist/esm/{chunk-A4T373F3.mjs.map → chunk-NKDHR2DA.mjs.map} +0 -0
- /package/dist/esm/{chunk-FNT3VLRD.mjs.map → chunk-NPFW6ZFY.mjs.map} +0 -0
- /package/dist/esm/{chunk-KEN2VRIM.mjs.map → chunk-OPTI3MH2.mjs.map} +0 -0
- /package/dist/esm/{chunk-QE5OL6KN.mjs.map → chunk-ORGMRM5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-SONTIUAM.mjs.map → chunk-OTNGLTKS.mjs.map} +0 -0
- /package/dist/esm/{chunk-CTJX4CUF.mjs.map → chunk-P2EKDA7R.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHKMF253.mjs.map → chunk-PDNA4H34.mjs.map} +0 -0
- /package/dist/esm/{chunk-ECKJI2TV.mjs.map → chunk-QQHA2Y46.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHW4Z7TK.mjs.map → chunk-SCYGW3VV.mjs.map} +0 -0
- /package/dist/esm/{chunk-3NRBTP3S.mjs.map → chunk-SUAA25UP.mjs.map} +0 -0
- /package/dist/esm/{chunk-YY2XW5R4.mjs.map → chunk-T53MZO2U.mjs.map} +0 -0
- /package/dist/esm/{chunk-MEKXPGK7.mjs.map → chunk-VQVNUN5Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFOYGJS5.mjs.map → chunk-VTEZ6TBO.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEOUZFHD.mjs.map → chunk-VYXJ7FUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ZMI5G5L.mjs.map → chunk-VYXS7TLB.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKMG3LZX.mjs.map → chunk-WLZYSLHP.mjs.map} +0 -0
- /package/dist/esm/{chunk-6ERHGCK2.mjs.map → chunk-WX6P3Q4I.mjs.map} +0 -0
- /package/dist/esm/{chunk-USOIC4HO.mjs.map → chunk-WYQLUB4H.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZZRSKHWS.mjs.map → chunk-YFMFXRJX.mjs.map} +0 -0
- /package/dist/esm/{chunk-PO33LVUF.mjs.map → chunk-YPQZJ72F.mjs.map} +0 -0
- /package/dist/esm/{chunk-HRIYZBXY.mjs.map → chunk-ZNC3FRSK.mjs.map} +0 -0
- /package/dist/esm/{chunk-NU55IEL4.mjs.map → chunk-ZWX3NHGU.mjs.map} +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { MoveStructId } from '../types/index.mjs';
|
|
2
|
+
import './apiEndpoints.mjs';
|
|
3
|
+
import '../types/indexer.mjs';
|
|
4
|
+
import '../types/generated/operations.mjs';
|
|
5
|
+
import '../types/generated/types.mjs';
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Sleep the current thread for the given amount of time
|
|
3
9
|
* @param timeMs time in milliseconds to sleep
|
|
@@ -30,5 +36,39 @@ declare const convertAmountFromHumanReadableToOnChain: (value: number, decimal:
|
|
|
30
36
|
* @returns The value is smallest units
|
|
31
37
|
*/
|
|
32
38
|
declare const convertAmountFromOnChainToHumanReadable: (value: number, decimal: number) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Convert an encoded struct to a MoveStructId.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const structObj = {
|
|
44
|
+
* account_address: "0x1",
|
|
45
|
+
* module_name: "0x6170746f735f636f696e",
|
|
46
|
+
* struct_name: "0x4170746f73436f696e",
|
|
47
|
+
* };
|
|
48
|
+
* // structId is "0x1::aptos_coin::AptosCoin"
|
|
49
|
+
* const structId = parseEncodedStruct(structObj);
|
|
50
|
+
*
|
|
51
|
+
* @param structObj The struct with account_address, module_name, and struct_name properties
|
|
52
|
+
* @returns The MoveStructId
|
|
53
|
+
*/
|
|
54
|
+
declare const parseEncodedStruct: (structObj: {
|
|
55
|
+
account_address: string;
|
|
56
|
+
module_name: string;
|
|
57
|
+
struct_name: string;
|
|
58
|
+
}) => MoveStructId;
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether the given object is an encoded struct type with the following properties:
|
|
61
|
+
* - account_address: string
|
|
62
|
+
* - module_name: string
|
|
63
|
+
* - struct_name: string
|
|
64
|
+
*
|
|
65
|
+
* @param structObj The object to check
|
|
66
|
+
* @returns Whether the object is an encoded struct type
|
|
67
|
+
*/
|
|
68
|
+
declare const isEncodedStruct: (structObj: any) => structObj is {
|
|
69
|
+
account_address: string;
|
|
70
|
+
module_name: string;
|
|
71
|
+
struct_name: string;
|
|
72
|
+
};
|
|
33
73
|
|
|
34
|
-
export { base64UrlDecode, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, floorToWholeHour, nowInSeconds, sleep };
|
|
74
|
+
export { base64UrlDecode, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, floorToWholeHour, isEncodedStruct, nowInSeconds, parseEncodedStruct, sleep };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"../chunk-UAL27G6B.mjs";import"../chunk-FVA2OPG4.mjs";export{d as base64UrlDecode,e as convertAmountFromHumanReadableToOnChain,f as convertAmountFromOnChainToHumanReadable,c as floorToWholeHour,h as isEncodedStruct,b as nowInSeconds,g as parseEncodedStruct,a as sleep};
|
|
2
2
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI, NetworkToPepperAPI, NetworkToProverAPI } from './apiEndpoints.mjs';
|
|
2
|
-
export { APTOS_COIN, AptosApiType, DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW, DEFAULT_TXN_TIMEOUT_SEC, ProcessorType, RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from './const.mjs';
|
|
2
|
+
export { APTOS_COIN, APTOS_FA, AptosApiType, DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW, DEFAULT_TXN_TIMEOUT_SEC, ProcessorType, RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from './const.mjs';
|
|
3
3
|
export { DeserializableClass, normalizeBundle } from './normalizeBundle.mjs';
|
|
4
|
-
export { base64UrlDecode, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, floorToWholeHour, nowInSeconds, sleep } from './helpers.mjs';
|
|
4
|
+
export { base64UrlDecode, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, floorToWholeHour, isEncodedStruct, nowInSeconds, parseEncodedStruct, sleep } from './helpers.mjs';
|
|
5
5
|
import '../bcs/deserializer.mjs';
|
|
6
6
|
import '../types/index.mjs';
|
|
7
7
|
import '../types/indexer.mjs';
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-HGLO5LDS.mjs";import{a as
|
|
1
|
+
import"../chunk-HGLO5LDS.mjs";import{a as r}from"../chunk-BSUYPXRD.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-P5V7OZNN.mjs";import"../chunk-H6YNXJNF.mjs";import"../chunk-QQU4IQ27.mjs";import"../chunk-YPHH6CAO.mjs";import"../chunk-G773HST5.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-KEYAPEAX.mjs";import"../chunk-A63SMUOU.mjs";import"../chunk-BCUSI3N6.mjs";import"../chunk-LG7RJQ57.mjs";import"../chunk-56CNRT2K.mjs";import{a as s,b as t,c as u,d as v,e as w,f as x,g as y,h as z}from"../chunk-UAL27G6B.mjs";import{a as j,b as k,c as l,d as m,e as n,f as o,g as p,h as q}from"../chunk-SCHZ67F3.mjs";import{a,b,c,d,e,f,g,h,i}from"../chunk-EXP5STXZ.mjs";import"../chunk-FVA2OPG4.mjs";export{e as APTOS_COIN,f as APTOS_FA,a as AptosApiType,b as DEFAULT_MAX_GAS_AMOUNT,c as DEFAULT_TXN_EXP_SEC_FROM_NOW,d as DEFAULT_TXN_TIMEOUT_SEC,o as Network,p as NetworkToChainId,l as NetworkToFaucetAPI,j as NetworkToIndexerAPI,q as NetworkToNetworkName,k as NetworkToNodeAPI,m as NetworkToPepperAPI,n as NetworkToProverAPI,i as ProcessorType,g as RAW_TRANSACTION_SALT,h as RAW_TRANSACTION_WITH_DATA_SALT,v as base64UrlDecode,w as convertAmountFromHumanReadableToOnChain,x as convertAmountFromOnChainToHumanReadable,u as floorToWholeHour,z as isEncodedStruct,r as normalizeBundle,t as nowInSeconds,y as parseEncodedStruct,s as sleep};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-BSUYPXRD.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-P5V7OZNN.mjs";import"../chunk-H6YNXJNF.mjs";import"../chunk-
|
|
1
|
+
import{a}from"../chunk-BSUYPXRD.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-P5V7OZNN.mjs";import"../chunk-H6YNXJNF.mjs";import"../chunk-QQU4IQ27.mjs";import"../chunk-YPHH6CAO.mjs";import"../chunk-G773HST5.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-KEYAPEAX.mjs";import"../chunk-A63SMUOU.mjs";import"../chunk-BCUSI3N6.mjs";import"../chunk-LG7RJQ57.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as normalizeBundle};
|
|
2
2
|
//# sourceMappingURL=normalizeBundle.mjs.map
|
package/dist/esm/version.d.mts
CHANGED
package/dist/esm/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-ZXVQ2OBJ.mjs";import"./chunk-FVA2OPG4.mjs";export{a as VERSION};
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { Account } from "./Account";
|
|
5
5
|
import { MultiKey, MultiKeySignature, PublicKey } from "../core/crypto";
|
|
6
|
-
import { AccountAddress } from "../core/accountAddress";
|
|
6
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
7
7
|
import { HexInput, SigningScheme } from "../types";
|
|
8
8
|
import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
|
|
9
9
|
import { AnyRawTransaction } from "../transactions/types";
|
|
@@ -61,13 +61,13 @@ export class MultiKeyAccount implements Account {
|
|
|
61
61
|
* @param args.signers an array of M signers that will be used to sign the transaction
|
|
62
62
|
* @returns MultiKeyAccount
|
|
63
63
|
*/
|
|
64
|
-
constructor(args: { multiKey: MultiKey; signers: Account[] }) {
|
|
65
|
-
const { multiKey, signers } = args;
|
|
64
|
+
constructor(args: { multiKey: MultiKey; signers: Account[]; address?: AccountAddressInput }) {
|
|
65
|
+
const { multiKey, signers, address } = args;
|
|
66
66
|
|
|
67
67
|
this.publicKey = multiKey;
|
|
68
68
|
this.signingScheme = SigningScheme.MultiKey;
|
|
69
69
|
|
|
70
|
-
this.accountAddress = this.publicKey.authKey().derivedAddress();
|
|
70
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
71
71
|
|
|
72
72
|
// Get the index of each respective signer in the bitmap
|
|
73
73
|
const bitPositions: number[] = [];
|
package/src/api/account.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
MoveModuleBytecode,
|
|
16
16
|
MoveResource,
|
|
17
17
|
MoveStructId,
|
|
18
|
+
MoveValue,
|
|
18
19
|
OrderByArg,
|
|
19
20
|
PaginationArgs,
|
|
20
21
|
TokenStandardArg,
|
|
@@ -40,10 +41,12 @@ import {
|
|
|
40
41
|
getTransactions,
|
|
41
42
|
lookupOriginalAccountAddress,
|
|
42
43
|
} from "../internal/account";
|
|
43
|
-
import { APTOS_COIN, ProcessorType } from "../utils/const";
|
|
44
|
+
import { APTOS_COIN, APTOS_FA, ProcessorType } from "../utils/const";
|
|
44
45
|
import { AptosConfig } from "./aptosConfig";
|
|
45
46
|
import { waitForIndexerOnVersion } from "./utils";
|
|
46
47
|
import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
|
|
48
|
+
import { view } from "../internal/view";
|
|
49
|
+
import { isEncodedStruct, parseEncodedStruct } from "../utils";
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* A class to query all `Account` related queries on Aptos.
|
|
@@ -428,7 +431,7 @@ export class Account {
|
|
|
428
431
|
accountAddress: AccountAddressInput;
|
|
429
432
|
minimumLedgerVersion?: AnyNumber;
|
|
430
433
|
}): Promise<number> {
|
|
431
|
-
return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });
|
|
434
|
+
return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });
|
|
432
435
|
}
|
|
433
436
|
|
|
434
437
|
/**
|
|
@@ -438,7 +441,8 @@ export class Account {
|
|
|
438
441
|
* const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:"0x123", coinType:"0x1::aptos_coin::AptosCoin"})
|
|
439
442
|
*
|
|
440
443
|
* @param args.accountAddress The account address we want to get the total count for
|
|
441
|
-
* @param args.coinType The coin type to query
|
|
444
|
+
* @param args.coinType The coin type to query.
|
|
445
|
+
* Note: faMetadataAddress will automatically fill this in if not provided when migrated to fungible assets
|
|
442
446
|
* @param args.faMetadataAddress The fungible asset metadata address to query.
|
|
443
447
|
* Note: coinType will automatically fill this in if not provided when migrated to fungible assets
|
|
444
448
|
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
@@ -450,12 +454,35 @@ export class Account {
|
|
|
450
454
|
faMetadataAddress?: AccountAddressInput;
|
|
451
455
|
minimumLedgerVersion?: AnyNumber;
|
|
452
456
|
}): Promise<number> {
|
|
457
|
+
const { coinType, faMetadataAddress } = args;
|
|
453
458
|
await waitForIndexerOnVersion({
|
|
454
459
|
config: this.config,
|
|
455
460
|
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
456
461
|
processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,
|
|
457
462
|
});
|
|
458
|
-
|
|
463
|
+
|
|
464
|
+
// Attempt to populate the CoinType field if the FA address is provided.
|
|
465
|
+
// We cannot do this internally due to dependency cycles issue.
|
|
466
|
+
let coinAssetType: MoveStructId | undefined = coinType;
|
|
467
|
+
if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
468
|
+
try {
|
|
469
|
+
const pairedCoinTypeStruct = (
|
|
470
|
+
await view({
|
|
471
|
+
aptosConfig: this.config,
|
|
472
|
+
payload: { function: "0x1::coin::paired_coin", functionArguments: [faMetadataAddress] },
|
|
473
|
+
})
|
|
474
|
+
).at(0) as { vec: MoveValue[] };
|
|
475
|
+
|
|
476
|
+
// Check if the Option has a value, and if so, parse the struct
|
|
477
|
+
if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {
|
|
478
|
+
coinAssetType = parseEncodedStruct(pairedCoinTypeStruct.vec[0]);
|
|
479
|
+
}
|
|
480
|
+
} catch (error) {
|
|
481
|
+
/* No paired coin type found */
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return getAccountCoinAmount({ aptosConfig: this.config, ...args, coinType: coinAssetType });
|
|
459
486
|
}
|
|
460
487
|
|
|
461
488
|
/**
|
|
@@ -67,13 +67,12 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
|
|
|
67
67
|
* @param serializer
|
|
68
68
|
*/
|
|
69
69
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error("Script function arguments only accept u8 vectors");
|
|
70
|
+
// This checks if the type of a non-empty vector is of type other than U8. If so, we use the Serialized
|
|
71
|
+
// transaction argument type to serialize the argument.
|
|
72
|
+
if (this.values[0] !== undefined && !(this.values[0] instanceof U8)) {
|
|
73
|
+
const serialized = new Serialized(this.bcsToBytes());
|
|
74
|
+
serialized.serializeForScriptFunction(serializer);
|
|
75
|
+
return;
|
|
77
76
|
}
|
|
78
77
|
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8Vector);
|
|
79
78
|
serializer.serialize(this);
|
|
@@ -225,6 +224,39 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
|
|
|
225
224
|
}
|
|
226
225
|
}
|
|
227
226
|
|
|
227
|
+
export class Serialized extends Serializable implements TransactionArgument {
|
|
228
|
+
public readonly value: Uint8Array;
|
|
229
|
+
|
|
230
|
+
constructor(value: HexInput) {
|
|
231
|
+
super();
|
|
232
|
+
this.value = Hex.fromHexInput(value).toUint8Array();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
serialize(serializer: Serializer): void {
|
|
236
|
+
serializer.serializeBytes(this.value);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
serializeForEntryFunction(serializer: Serializer): void {
|
|
240
|
+
this.serialize(serializer);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
serializeForScriptFunction(serializer: Serializer): void {
|
|
244
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Serialized);
|
|
245
|
+
this.serialize(serializer);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static deserialize(deserializer: Deserializer): Serialized {
|
|
249
|
+
return new Serialized(deserializer.deserializeBytes());
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
toMoveVector<T extends Serializable & EntryFunctionArgument>(cls: Deserializable<T>): MoveVector<T> {
|
|
253
|
+
const deserializer = new Deserializer(this.bcsToBytes());
|
|
254
|
+
deserializer.deserializeUleb128AsU32();
|
|
255
|
+
const vec = deserializer.deserializeVector(cls);
|
|
256
|
+
return new MoveVector(vec);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
228
260
|
export class MoveString extends Serializable implements TransactionArgument {
|
|
229
261
|
public value: string;
|
|
230
262
|
|
|
@@ -244,7 +276,8 @@ export class MoveString extends Serializable implements TransactionArgument {
|
|
|
244
276
|
|
|
245
277
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
246
278
|
// Serialize the string as a fixed byte string, i.e., without the length prefix
|
|
247
|
-
const
|
|
279
|
+
const textEncoder = new TextEncoder();
|
|
280
|
+
const fixedStringBytes = textEncoder.encode(this.value);
|
|
248
281
|
// Put those bytes into a vector<u8> and serialize it as a script function argument
|
|
249
282
|
const vectorU8 = MoveVector.U8(fixedStringBytes);
|
|
250
283
|
vectorU8.serializeForScriptFunction(serializer);
|
package/src/cli/move.ts
CHANGED
|
@@ -425,7 +425,7 @@ export class Move {
|
|
|
425
425
|
*/
|
|
426
426
|
// eslint-disable-next-line class-methods-use-this
|
|
427
427
|
private extractAddressFromOutput(output: string): string {
|
|
428
|
-
const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)
|
|
428
|
+
const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");
|
|
429
429
|
if (match) {
|
|
430
430
|
return match[1];
|
|
431
431
|
}
|
package/src/internal/account.ts
CHANGED
|
@@ -409,26 +409,27 @@ export async function getAccountCoinAmount(args: {
|
|
|
409
409
|
faMetadataAddress?: AccountAddressInput;
|
|
410
410
|
}): Promise<number> {
|
|
411
411
|
const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;
|
|
412
|
-
|
|
412
|
+
|
|
413
|
+
let coinAssetType: string | undefined = coinType;
|
|
413
414
|
let faAddress: string;
|
|
414
415
|
|
|
415
416
|
if (coinType !== undefined && faMetadataAddress !== undefined) {
|
|
416
417
|
faAddress = AccountAddress.from(faMetadataAddress).toStringLong();
|
|
417
418
|
} else if (coinType !== undefined && faMetadataAddress === undefined) {
|
|
418
|
-
coinAssetType = coinType;
|
|
419
419
|
// TODO Move to a separate function as defined in the AIP for coin migration
|
|
420
|
-
if (
|
|
420
|
+
if (coinType === APTOS_COIN) {
|
|
421
421
|
faAddress = AccountAddress.A.toStringLong();
|
|
422
422
|
} else {
|
|
423
423
|
faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();
|
|
424
424
|
}
|
|
425
425
|
} else if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
426
|
-
// TODO: add a view function lookup for non-APT migrated coins
|
|
427
426
|
const addr = AccountAddress.from(faMetadataAddress);
|
|
428
427
|
faAddress = addr.toStringLong();
|
|
429
428
|
if (addr === AccountAddress.A) {
|
|
430
429
|
coinAssetType = APTOS_COIN;
|
|
431
430
|
}
|
|
431
|
+
// The paired CoinType should be populated outside of this function in another
|
|
432
|
+
// async call. We cannot do this internally due to dependency cycles issue.
|
|
432
433
|
} else {
|
|
433
434
|
throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");
|
|
434
435
|
}
|
|
@@ -436,7 +437,7 @@ export async function getAccountCoinAmount(args: {
|
|
|
436
437
|
|
|
437
438
|
// Search by fungible asset address, unless it has a coin it migrated from
|
|
438
439
|
let where: any = { asset_type: { _eq: faAddress } };
|
|
439
|
-
if (
|
|
440
|
+
if (coinAssetType !== undefined) {
|
|
440
441
|
where = { asset_type: { _in: [coinAssetType, faAddress] } };
|
|
441
442
|
}
|
|
442
443
|
|
package/src/internal/event.ts
CHANGED
|
@@ -31,9 +31,16 @@ export async function getModuleEventsByEventType(args: {
|
|
|
31
31
|
const { aptosConfig, eventType, options } = args;
|
|
32
32
|
|
|
33
33
|
const whereCondition: EventsBoolExp = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
_or: [
|
|
35
|
+
// EventHandle events
|
|
36
|
+
{ account_address: { _eq: eventType.split("::")[0] } },
|
|
37
|
+
// Module events
|
|
38
|
+
{
|
|
39
|
+
account_address: { _eq: "0x0000000000000000000000000000000000000000000000000000000000000000" },
|
|
40
|
+
sequence_number: { _eq: 0 },
|
|
41
|
+
creation_number: { _eq: 0 },
|
|
42
|
+
},
|
|
43
|
+
],
|
|
37
44
|
indexed_type: { _eq: eventType },
|
|
38
45
|
};
|
|
39
46
|
|
|
@@ -7,7 +7,7 @@ import { Deserializer } from "../../bcs/deserializer";
|
|
|
7
7
|
import { Serializable, Serializer } from "../../bcs/serializer";
|
|
8
8
|
import { EntryFunctionBytes } from "../../bcs/serializable/entryFunctionBytes";
|
|
9
9
|
import { Bool, U128, U16, U256, U32, U64, U8 } from "../../bcs/serializable/movePrimitives";
|
|
10
|
-
import { MoveVector } from "../../bcs/serializable/moveStructs";
|
|
10
|
+
import { MoveVector, Serialized } from "../../bcs/serializable/moveStructs";
|
|
11
11
|
import { AccountAddress } from "../../core";
|
|
12
12
|
import { Identifier } from "./identifier";
|
|
13
13
|
import { ModuleId } from "./moduleId";
|
|
@@ -40,6 +40,8 @@ export function deserializeFromScriptArgument(deserializer: Deserializer): Trans
|
|
|
40
40
|
return U32.deserialize(deserializer);
|
|
41
41
|
case ScriptTransactionArgumentVariants.U256:
|
|
42
42
|
return U256.deserialize(deserializer);
|
|
43
|
+
case ScriptTransactionArgumentVariants.Serialized:
|
|
44
|
+
return Serialized.deserialize(deserializer);
|
|
43
45
|
default:
|
|
44
46
|
throw new Error(`Unknown variant index for ScriptTransactionArgument: ${index}`);
|
|
45
47
|
}
|
|
@@ -20,6 +20,7 @@ import { TypeTag } from "./typeTag";
|
|
|
20
20
|
import { AccountAuthenticator } from "./authenticator/account";
|
|
21
21
|
import { SimpleTransaction } from "./instances/simpleTransaction";
|
|
22
22
|
import { MultiAgentTransaction } from "./instances/multiAgentTransaction";
|
|
23
|
+
import { Serialized } from "../bcs";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Entry function arguments to be used when building a raw transaction using remote ABI
|
|
@@ -64,9 +65,10 @@ export type ScriptFunctionArgumentTypes =
|
|
|
64
65
|
| U128
|
|
65
66
|
| U256
|
|
66
67
|
| AccountAddress
|
|
67
|
-
| MoveVector<
|
|
68
|
+
| MoveVector<ScriptFunctionArgumentTypes>
|
|
68
69
|
| MoveString
|
|
69
|
-
| FixedBytes
|
|
70
|
+
| FixedBytes
|
|
71
|
+
| Serialized;
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
74
|
* TypeArgument inputs for Entry functions, view functions, and scripts
|
package/src/types/index.ts
CHANGED
package/src/utils/const.ts
CHANGED
|
@@ -44,6 +44,7 @@ export const DEFAULT_TXN_TIMEOUT_SEC = 20;
|
|
|
44
44
|
* The default gas currency for the network.
|
|
45
45
|
*/
|
|
46
46
|
export const APTOS_COIN = "0x1::aptos_coin::AptosCoin";
|
|
47
|
+
export const APTOS_FA = "0x000000000000000000000000000000000000000000000000000000000000000a";
|
|
47
48
|
|
|
48
49
|
export const RAW_TRANSACTION_SALT = "APTOS::RawTransaction";
|
|
49
50
|
export const RAW_TRANSACTION_WITH_DATA_SALT = "APTOS::RawTransactionWithData";
|
package/src/utils/helpers.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { decode } from "js-base64";
|
|
5
|
+
import { MoveStructId } from "../types";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Sleep the current thread for the given amount of time
|
|
@@ -58,3 +59,72 @@ export const convertAmountFromHumanReadableToOnChain = (value: number, decimal:
|
|
|
58
59
|
* @returns The value is smallest units
|
|
59
60
|
*/
|
|
60
61
|
export const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Convert a hex string to an ascii string with the `0x` prefix.
|
|
65
|
+
*
|
|
66
|
+
* `0x6170746f735f636f696e` --> `aptos_coin`
|
|
67
|
+
*
|
|
68
|
+
* @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)
|
|
69
|
+
* @returns The ascii string
|
|
70
|
+
*/
|
|
71
|
+
const hexToAscii = (hex: string) => {
|
|
72
|
+
let str = "";
|
|
73
|
+
for (let n = 2; n < hex.length; n += 2) {
|
|
74
|
+
str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));
|
|
75
|
+
}
|
|
76
|
+
return str;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Convert an encoded struct to a MoveStructId.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const structObj = {
|
|
84
|
+
* account_address: "0x1",
|
|
85
|
+
* module_name: "0x6170746f735f636f696e",
|
|
86
|
+
* struct_name: "0x4170746f73436f696e",
|
|
87
|
+
* };
|
|
88
|
+
* // structId is "0x1::aptos_coin::AptosCoin"
|
|
89
|
+
* const structId = parseEncodedStruct(structObj);
|
|
90
|
+
*
|
|
91
|
+
* @param structObj The struct with account_address, module_name, and struct_name properties
|
|
92
|
+
* @returns The MoveStructId
|
|
93
|
+
*/
|
|
94
|
+
export const parseEncodedStruct = (structObj: {
|
|
95
|
+
account_address: string;
|
|
96
|
+
module_name: string;
|
|
97
|
+
struct_name: string;
|
|
98
|
+
}): MoveStructId => {
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
100
|
+
const { account_address, module_name, struct_name } = structObj;
|
|
101
|
+
const moduleName = hexToAscii(module_name);
|
|
102
|
+
const structName = hexToAscii(struct_name);
|
|
103
|
+
return `${account_address}::${moduleName}::${structName}`;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Determines whether the given object is an encoded struct type with the following properties:
|
|
108
|
+
* - account_address: string
|
|
109
|
+
* - module_name: string
|
|
110
|
+
* - struct_name: string
|
|
111
|
+
*
|
|
112
|
+
* @param structObj The object to check
|
|
113
|
+
* @returns Whether the object is an encoded struct type
|
|
114
|
+
*/
|
|
115
|
+
export const isEncodedStruct = (
|
|
116
|
+
structObj: any,
|
|
117
|
+
): structObj is {
|
|
118
|
+
account_address: string;
|
|
119
|
+
module_name: string;
|
|
120
|
+
struct_name: string;
|
|
121
|
+
} =>
|
|
122
|
+
typeof structObj === "object" &&
|
|
123
|
+
!Array.isArray(structObj) &&
|
|
124
|
+
structObj !== null &&
|
|
125
|
+
"account_address" in structObj &&
|
|
126
|
+
"module_name" in structObj &&
|
|
127
|
+
"struct_name" in structObj &&
|
|
128
|
+
typeof structObj.account_address === "string" &&
|
|
129
|
+
typeof structObj.module_name === "string" &&
|
|
130
|
+
typeof structObj.struct_name === "string";
|
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=(n,e,t,r)=>{for(var o=r>1?void 0:r?a(e,t):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(o=(r?c(e,t,o):c(o))||o);return r&&o&&u(e,t,o),o};var _jsbase64 = require('js-base64');async function b(n){return new Promise(e=>{setTimeout(e,n)})}var p=()=>Math.floor(Date.now()/1e3);function g(n){let e=new Date(n*1e3);return e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),Math.floor(e.getTime()/1e3)}function f(n){let e=n.replace(/-/g,"+").replace(/_/g,"/"),t=e+"==".substring(0,(3-e.length%3)%3);return _jsbase64.decode.call(void 0, t)}var h=(n,e)=>n*10**e,x= exports.g =(n,e)=>n/10**e;exports.a = d; exports.b = b; exports.c = p; exports.d = g; exports.e = f; exports.f = h; exports.g = x;
|
|
2
|
-
//# sourceMappingURL=chunk-J4IUXT5W.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/helpers.ts"],"names":["decode","sleep","timeMs","resolve","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable"],"mappings":"wMAGA,OAAS,UAAAA,MAAc,YAMvB,eAAsBC,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH,CAEO,IAAME,EAAe,IAAM,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EAEvD,SAASC,EAAiBC,EAAoC,CACnE,IAAMC,EAAO,IAAI,KAAKD,EAAqB,GAAI,EAE/C,OAAAC,EAAK,WAAW,CAAC,EACjBA,EAAK,WAAW,CAAC,EACjBA,EAAK,gBAAgB,CAAC,EACf,KAAK,MAAMA,EAAK,QAAQ,EAAI,GAAI,CACzC,CAEO,SAASC,EAAgBC,EAA2B,CAEzD,IAAMC,EAASD,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAEvDE,EAAeD,EAAS,KAAK,UAAU,GAAI,EAAKA,EAAO,OAAS,GAAM,CAAC,EAE7E,OADsBV,EAAOW,CAAY,CAE3C,CAaO,IAAMC,EAA0C,CAACC,EAAeC,IAAoBD,EAAQ,IAAMC,EAa5FC,EAA0C,CAACF,EAAeC,IAAoBD,EAAQ,IAAMC","sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n\nexport const nowInSeconds = () => Math.floor(Date.now() / 1000);\n\nexport function floorToWholeHour(timestampInSeconds: number): number {\n const date = new Date(timestampInSeconds * 1000);\n // Reset minutes and seconds to zero\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n return Math.floor(date.getTime() / 1000);\n}\n\nexport function base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * a human readable amount format to the smallest unit format\n * @example\n * human readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human readable format\n * @param decimal The token decimal\n * @returns The value is smallest units\n */\nexport const convertAmountFromHumanReadableToOnChain = (value: number, decimal: number) => value * 10 ** decimal;\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * the smallest unit format to a human readable amount format\n * @example\n * human readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human readable format\n * @param decimal The token decimal\n * @returns The value is smallest units\n */\nexport const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-PY4TS34X.mjs";import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-HHU7UCFI.mjs";import{e as o}from"./chunk-L36ZHC7J.mjs";var l=class{constructor(e){this.config=e}async getAccountInfo(e){return s({aptosConfig:this.config,...e})}async getAccountModules(e){return t({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return i({aptosConfig:this.config,...e})}async getAccountResources(e){return c({aptosConfig:this.config,...e})}async getAccountResource(e){return u({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),A({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),m({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),p({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),y({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),C({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:o,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),f({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),T({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return O({aptosConfig:this.config,...e})}};export{l as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4SDUQ7AS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinAmount,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n */\nexport class Account {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current state for an Aptos account given its account address\n *\n * @param args.accountAddress Aptos account address\n *\n * @returns The account data\n *\n * @example An example of the returned account\n * ```\n * {\n * sequence_number: \"1\",\n * authentication_key: \"0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69\"\n * }\n * ```\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address\n *\n * Note: In order to get all account modules, this function may call the API\n * multiple times as it auto paginates.\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number module to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account modules\n */\n\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given account address and module name\n *\n * @param args.accountAddress Aptos account address\n * @param args.moduleName The name of the module\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account module\n *\n * @example\n * const module = await aptos.getAccountModule({accountAddress:\"0x456\"})\n * // An example of an account module response\n * ```\n * {\n * bytecode: \"0xa11ceb0b0600000006010002030206050807070f0d081c200\",\n * abi: { address: \"0x1\" }\n * }\n * ```\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address\n *\n * Note: In order to get all account transactions, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const transactions = await aptos.getAccountTransactions({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number transaction to start returning results from\n * @param args.options.limit The number of results to return\n *\n * @returns The account transactions\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address\n *\n * Note: In order to get all account resources, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const resources = await aptos.getAccountResources({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number resource to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Account resources\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given account address and resource type. Note that the default is `any` in order\n * to allow for ease of accessing properties of the object.\n *\n * @type The typed output of the resource\n * @param args.accountAddress Aptos account address\n * @param args.resourceType String representation of an on-chain Move struct type, i.e \"0x1::aptos_coin::AptosCoin\"\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account resource\n *\n * @example\n * const resource = await aptos.getAccountResource({accountAddress:\"0x456\"})\n *\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key\n *\n * This handles both if the account's authentication key has been rotated or not.\n *\n * @example\n * const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})\n *\n * @param args.authenticationKey The authentication key\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Promise<AccountAddress> The accountAddress associated with the authentication key\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by an account\n *\n * @example\n * const tokensCount = await aptos.getAccountTokensCount({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of tokens owned by the account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the account's current owned tokens.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({accountAddress:\"0x123\", collectionAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.collectionAddress The address of the collection being queried\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the collections for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number collection to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Collections array with the collections data\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account\n *\n * @example\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of transactions made by an account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries an account's coins data\n *\n * @example\n * const accountCoinsData = await aptos.getAccountCoinsData({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the coins data for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset optional. The number coin to start returning results from\n * @param args.options.limit optional. The number of results to return\n * @param args.options.orderBy optional. The order to sort the coins by\n * @param args.options.where optional. Filter the results by\n * @returns Array with the coins data\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of an account's coins aggregated\n *\n * @example\n * const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of the aggregated count of all account's coins\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the account's APT amount\n *\n * @example\n * const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's APT\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });\n }\n\n /**\n * Queries the account's coin amount by the coin type\n *\n * @example\n * const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:\"0x123\", coinType:\"0x1::aptos_coin::AptosCoin\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.coinType The coin type to query\n * @param args.faMetadataAddress The fungible asset metadata address to query.\n * Note: coinType will automatically fill this in if not provided when migrated to fungible assets\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's coin\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinAmount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries an account's owned objects\n *\n * @example\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the objects for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset The starting position to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the objects by\n * @returns Objects array with the object data\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key.\n * This functions resolves the provided private key type and derives the public key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and\n * auth key using the SingleKey scheme locally.\n *\n * If the privateKey is a ED25519 type, it looks up the authentication key on chain, and uses it to resolve\n * whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based\n * on that.\n *\n * @example\n * const account = await aptos.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey(\"0x123\")})\n *\n * @param args.privateKey An account private key\n * @returns Account type\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2OAkDO,IAAMA,EAAN,KAAc,CACnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiB3C,MAAM,eAAeC,EAAqE,CACxF,OAAOC,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtD,CAgBA,MAAM,kBAAkBA,EAGU,CAChC,OAAOE,EAAW,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzD,CAqBA,MAAM,iBAAiBA,EAIS,CAC9B,OAAOG,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACxD,CAiBA,MAAM,uBAAuBA,EAGM,CACjC,OAAOI,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAiBA,MAAM,oBAAoBA,EAGE,CAC1B,OAAOK,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC3D,CAiBA,MAAM,mBAAuCA,EAI9B,CACb,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAeA,MAAM,6BAA6BA,EAIP,CAC1B,OAAOO,EAA6B,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3E,CAYA,MAAM,sBAAsBA,EAGR,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,8CACF,CAAC,EACMS,EAAsB,CAC3B,YAAa,KAAK,OAClB,GAAGT,CACL,CAAC,CACH,CAmBA,MAAM,sBAAsBA,EAIoB,CAC9C,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,kCACF,CAAC,EACMU,EAAsB,CAC3B,YAAa,KAAK,OAClB,GAAGV,CACL,CAAC,CACH,CAoBA,MAAM,2CAA2CA,EAKQ,CACvD,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,kCACF,CAAC,EACMW,EAA2C,CAChD,YAAa,KAAK,OAClB,GAAGX,CACL,CAAC,CACH,CAmBA,MAAM,qCAAqCA,EAIc,CACvD,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,kCACF,CAAC,EACMY,EAAqC,CAC1C,YAAa,KAAK,OAClB,GAAGZ,CACL,CAAC,CACH,CAYA,MAAM,4BAA4BA,EAGd,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,8CACF,CAAC,EACMa,EAA4B,CACjC,YAAa,KAAK,OAClB,GAAGb,CACL,CAAC,CACH,CAgBA,MAAM,oBAAoBA,EAMe,CACvC,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,wCACF,CAAC,EACMc,EAAoB,CACzB,YAAa,KAAK,OAClB,GAAGd,CACL,CAAC,CACH,CAYA,MAAM,qBAAqBA,EAGP,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,wCACF,CAAC,EACMe,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGf,CAAK,CAAC,CACnE,CAYA,MAAM,oBAAoBA,EAGN,CAClB,OAAO,KAAK,qBAAqB,CAAE,SAAUgB,EAAY,GAAGhB,CAAK,CAAC,CACpE,CAeA,MAAM,qBAAqBA,EAKP,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,wCACF,CAAC,EACMiB,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGjB,CAAK,CAAC,CACnE,CAeA,MAAM,uBAAuBA,EAIW,CACtC,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,iCACF,CAAC,EACMkB,EAAuB,CAC5B,YAAa,KAAK,OAClB,GAAGlB,CACL,CAAC,CACH,CAmBA,MAAM,4BAA4BA,EAA0D,CAC1F,OAAOmB,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGnB,CAAK,CAAC,CAC1E,CACF","names":["Account","config","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","getAccountCoinAmount","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-RA3YPQG2.mjs";import{e as o}from"./chunk-Q67DUNMI.mjs";import{a as g,b as u}from"./chunk-6ERHGCK2.mjs";var l=class a{constructor(i){let{multiKey:s,signers:e}=i;this.publicKey=s,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let r=[];for(let t of e)r.push(this.publicKey.getIndex(t.publicKey));let n=e.map((t,c)=>[t,r[c]]);n.sort((t,c)=>t[1]-c[1]),this.signers=n.map(t=>t[0]),this.signerIndicies=n.map(t=>t[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:r})}static fromPublicKeysAndSigners(i){let{publicKeys:s,signaturesRequired:e,signers:r}=i,n=new g({publicKeys:s,signaturesRequired:e});return new a({multiKey:n,signers:r})}static isMultiKeySigner(i){return i instanceof a}signWithAuthenticator(i){return new o(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new o(this.publicKey,this.signTransaction(i))}async waitForProofFetch(){let s=this.signers.filter(e=>e instanceof y).map(async e=>e.waitForProofFetch());await Promise.all(s)}sign(i){let s=[];for(let e of this.signers)s.push(e.sign(i));return new u({signatures:s,bitmap:this.signaturesBitmap})}signTransaction(i){let s=[];for(let e of this.signers)s.push(e.signTransaction(i));return new u({signatures:s,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:s,signature:e}=i;if(!this.signerIndicies.every((n,t)=>t===0||n>=this.signerIndicies[t-1]))return!1;for(let n=0;n<e.signatures.length;n+=1){let t=e.signatures[n];if(!this.publicKey.publicKeys[this.signerIndicies[n]].verifySignature({message:s,signature:t}))return!1}return!0}};export{l as a};
|
|
2
|
-
//# sourceMappingURL=chunk-EZIF26UH.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { KeylessAccount } from \"./KeylessAccount\";\n\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}\n * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class MultiKeyAccount implements Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n */\n readonly signers: Account[];\n\n /**\n * An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n */\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * constructor for MultiKeyAccount\n *\n * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is\n * the number of required signatures.\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n constructor(args: { multiKey: MultiKey; signers: Account[] }) {\n const { multiKey, signers } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = this.publicKey.authKey().derivedAddress();\n\n // Get the index of each respective signer in the bitmap\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.publicKey));\n }\n // Zip signers and bit positions and sort signers by bit positions in order\n // to ensure the signature is signed in ascending order according to the bitmap.\n // Authentication on chain will fail otherwise.\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor for MultiKeyAccount\n *\n * @param args.publicKeys the N public keys of the MultiKeyAccount\n * @param args.signaturesRequired the number of signatures required\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers.\n * @param message the signing message, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Waits for any proofs on any KeylessAccount signers to be fetched. If the proof is fetched a syncronously, call this\n * to ensure signing with the KeylessAccount does not fail as the proof must be ready.\n * @return\n */\n async waitForProofFetch() {\n const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];\n const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());\n await Promise.all(promises);\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param message in HexInput format\n * @returns MultiKeySignature\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers\n * @param transaction the transaction to be signed\n * @returns MultiKeySignature\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signatures signed message MultiKeySignature\n * @returns boolean\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndiciesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndiciesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"kIAwBO,IAAMA,EAAN,MAAMC,CAAmC,CAuC9C,YAAYC,EAAkD,CAC5D,GAAM,CAAE,SAAAC,EAAU,QAAAC,CAAQ,EAAIF,EAE9B,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiB,KAAK,UAAU,QAAQ,EAAE,eAAe,EAG9D,IAAME,EAAyB,CAAC,EAChC,QAAWC,KAAUF,EACnBC,EAAa,KAAK,KAAK,UAAU,SAASC,EAAO,SAAS,CAAC,EAK7D,IAAMC,EAA6CH,EAAQ,IAAI,CAACE,EAAQE,IAAU,CAACF,EAAQD,EAAaG,CAAK,CAAC,CAAC,EAC/GD,EAAsB,KAAK,CAACE,EAAGC,IAAMD,EAAE,CAAC,EAAIC,EAAE,CAAC,CAAC,EAChD,KAAK,QAAUH,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EAC5D,KAAK,eAAiBJ,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EACnE,KAAK,iBAAmB,KAAK,UAAU,aAAa,CAAE,KAAMN,CAAa,CAAC,CAC5E,CAUA,OAAO,yBAAyBH,EAIZ,CAClB,GAAM,CAAE,WAAAU,EAAY,mBAAAC,EAAoB,QAAAT,CAAQ,EAAIF,EAC9CC,EAAW,IAAIW,EAAS,CAAE,WAAAF,EAAY,mBAAAC,CAAmB,CAAC,EAChE,OAAO,IAAIZ,EAAgB,CAAE,SAAAE,EAAU,QAAAC,CAAQ,CAAC,CAClD,CAEA,OAAO,iBAAiBW,EAA8C,CACpE,OAAOA,aAAmBd,CAC5B,CAOA,sBAAsBe,EAAiD,CACrE,OAAO,IAAIC,EAA6B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC5E,CAOA,iCAAiCE,EAA8D,CAC7F,OAAO,IAAID,EAA6B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC3F,CAOA,MAAM,mBAAoB,CAExB,IAAMC,EADiB,KAAK,QAAQ,OAAQb,GAAWA,aAAkBc,CAAc,EACvD,IAAI,MAAOd,GAAWA,EAAO,kBAAkB,CAAC,EAChF,MAAM,QAAQ,IAAIa,CAAQ,CAC5B,CAOA,KAAKE,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,KAAKe,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAOA,gBAAgBJ,EAAmD,CACjE,IAAMI,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIK,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBpB,EAA4C,CAC1D,GAAM,CAAE,QAAAc,EAAS,UAAAQ,CAAU,EAAItB,EAI/B,GAAI,CAH2B,KAAK,eAAe,MACjD,CAACS,EAAOc,IAAMA,IAAM,GAAKd,GAAS,KAAK,eAAec,EAAI,CAAC,CAC7D,EAEE,MAAO,GAET,QAASA,EAAI,EAAGA,EAAID,EAAU,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAT,EAAS,UAAWU,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","signers","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","promises","KeylessAccount","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
|