@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bcs/serializable/moveStructs.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Bool, U128, U16, U256, U32, U64, U8 } from \"./movePrimitives\";\nimport { Serializable, Serializer } from \"../serializer\";\nimport { Deserializable, Deserializer } from \"../deserializer\";\nimport { AnyNumber, HexInput, ScriptTransactionArgumentVariants } from \"../../types\";\nimport { Hex } from \"../../core/hex\";\nimport { EntryFunctionArgument, TransactionArgument } from \"../../transactions/instances/transactionArgument\";\n\n/**\n * This class is the Aptos Typescript SDK representation of a Move `vector<T>`,\n * where `T` represents either a primitive type (`bool`, `u8`, `u64`, ...)\n * or a BCS-serializable struct itself.\n *\n * It is a BCS-serializable, array-like type that contains an array of values of type `T`,\n * where `T` is a class that implements `Serializable`.\n *\n * The purpose of this class is to facilitate easy construction of BCS-serializable\n * Move `vector<T>` types.\n *\n * @example\n * // in Move: `vector<u8> [1, 2, 3, 4];`\n * const vecOfU8s = new MoveVector<U8>([new U8(1), new U8(2), new U8(3), new U8(4)]);\n * // in Move: `std::bcs::to_bytes(vector<u8> [1, 2, 3, 4]);`\n * const bcsBytes = vecOfU8s.toUint8Array();\n *\n * // vector<vector<u8>> [ vector<u8> [1], vector<u8> [1, 2, 3, 4], vector<u8> [5, 6, 7, 8] ];\n * const vecOfVecs = new MoveVector<MoveVector<U8>>([\n * new MoveVector<U8>([new U8(1)]),\n * MoveVector.U8([1, 2, 3, 4]),\n * MoveVector.U8([5, 6, 7, 8]),\n * ]);\n *\n * // vector<Option<u8>> [ std::option::some<u8>(1), std::option::some<u8>(2) ];\n * const vecOfOptionU8s = new MoveVector<MoveOption<U8>>([\n * MoveOption.U8(1),\n * MoveOption.U8(2),\n * ]);\n *\n * // vector<MoveString> [ std::string::utf8(b\"hello\"), std::string::utf8(b\"world\") ];\n * const vecOfStrings = new MoveVector([new MoveString(\"hello\"), new MoveString(\"world\")]);\n * const vecOfStrings2 = MoveVector.MoveString([\"hello\", \"world\"]);\n *\n * @params\n * values: an Array<T> of values where T is a class that implements Serializable\n * @returns a `MoveVector<T>` with the values `values`\n */\nexport class MoveVector<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements TransactionArgument\n{\n public values: Array<T>;\n\n constructor(values: Array<T>) {\n super();\n this.values = values;\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * NOTE: This function will only work when the inner values in the `MoveVector` are `U8`s.\n * @param serializer\n */\n serializeForScriptFunction(serializer: Serializer): void {\n // This checks if the type of a non-empty vector is of type other than U8. If so, we use the Serialized\n // transaction argument type to serialize the argument.\n if (this.values[0] !== undefined && !(this.values[0] instanceof U8)) {\n const serialized = new Serialized(this.bcsToBytes());\n serialized.serializeForScriptFunction(serializer);\n return;\n }\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8Vector);\n serializer.serialize(this);\n }\n\n /**\n * Factory method to generate a MoveVector of U8s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U8([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U8s\n * @returns a `MoveVector<U8>`\n */\n static U8(values: Array<number> | HexInput): MoveVector<U8> {\n let numbers: Array<number>;\n\n if (Array.isArray(values) && values.length === 0) {\n // Handle empty array, since it won't have a \"first value\"\n numbers = [];\n } else if (Array.isArray(values) && typeof values[0] === \"number\") {\n numbers = values;\n } else if (typeof values === \"string\") {\n const hex = Hex.fromHexInput(values);\n numbers = Array.from(hex.toUint8Array());\n } else if (values instanceof Uint8Array) {\n numbers = Array.from(values);\n } else {\n throw new Error(\"Invalid input type, must be an number[], Uint8Array, or hex string\");\n }\n\n return new MoveVector<U8>(numbers.map((v) => new U8(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U16s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U16([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U16s\n * @returns a `MoveVector<U16>`\n */\n static U16(values: Array<number>): MoveVector<U16> {\n return new MoveVector<U16>(values.map((v) => new U16(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U32s from an array of numbers.\n *\n * @example\n * const v = MoveVector.U32([1, 2, 3, 4]);\n * @params values: an array of `numbers` to convert to U32s\n * @returns a `MoveVector<U32>`\n */\n static U32(values: Array<number>): MoveVector<U32> {\n return new MoveVector<U32>(values.map((v) => new U32(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U64s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U64([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U64s\n * @returns a `MoveVector<U64>`\n */\n static U64(values: Array<AnyNumber>): MoveVector<U64> {\n return new MoveVector<U64>(values.map((v) => new U64(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U128s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U128([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U128s\n * @returns a `MoveVector<U128>`\n */\n static U128(values: Array<AnyNumber>): MoveVector<U128> {\n return new MoveVector<U128>(values.map((v) => new U128(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of U256s from an array of numbers or bigints.\n *\n * @example\n * const v = MoveVector.U256([1, 2, 3, 4]);\n * @params values: an array of numbers of type `number | bigint` to convert to U256s\n * @returns a `MoveVector<U256>`\n */\n static U256(values: Array<AnyNumber>): MoveVector<U256> {\n return new MoveVector<U256>(values.map((v) => new U256(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of Bools from an array of booleans.\n *\n * @example\n * const v = MoveVector.Bool([true, false, true, false]);\n * @params values: an array of `bools` to convert to Bools\n * @returns a `MoveVector<Bool>`\n */\n static Bool(values: Array<boolean>): MoveVector<Bool> {\n return new MoveVector<Bool>(values.map((v) => new Bool(v)));\n }\n\n /**\n * Factory method to generate a MoveVector of MoveStrings from an array of strings.\n *\n * @example\n * const v = MoveVector.MoveString([\"hello\", \"world\"]);\n * @params values: an array of `strings` to convert to MoveStrings\n * @returns a `MoveVector<MoveString>`\n */\n static MoveString(values: Array<string>): MoveVector<MoveString> {\n return new MoveVector<MoveString>(values.map((v) => new MoveString(v)));\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeVector(this.values);\n }\n\n /**\n * Deserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.\n *\n * NOTE: This only works with a depth of one. Generics will not work.\n *\n * NOTE: This will not work with types that aren't of the Serializable class.\n *\n * If you're looking for a more flexible deserialization function, you can use the deserializeVector function\n * in the Deserializer class.\n *\n * @example\n * const vec = MoveVector.deserialize(deserializer, U64);\n * @params deserializer: the Deserializer instance to use, with bytes loaded into it already.\n * cls: the class to typecast the input values to, must be a Serializable and Deserializable type.\n * @returns a MoveVector of the corresponding class T\n * *\n */\n static deserialize<T extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<T>,\n ): MoveVector<T> {\n const length = deserializer.deserializeUleb128AsU32();\n const values = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n values.push(cls.deserialize(deserializer));\n }\n return new MoveVector(values);\n }\n}\n\nexport class Serialized extends Serializable implements TransactionArgument {\n public readonly value: Uint8Array;\n\n constructor(value: HexInput) {\n super();\n this.value = Hex.fromHexInput(value).toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n this.serialize(serializer);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Serialized);\n this.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): Serialized {\n return new Serialized(deserializer.deserializeBytes());\n }\n\n toMoveVector<T extends Serializable & EntryFunctionArgument>(cls: Deserializable<T>): MoveVector<T> {\n const deserializer = new Deserializer(this.bcsToBytes());\n deserializer.deserializeUleb128AsU32();\n const vec = deserializer.deserializeVector(cls);\n return new MoveVector(vec);\n }\n}\n\nexport class MoveString extends Serializable implements TransactionArgument {\n public value: string;\n\n constructor(value: string) {\n super();\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n // Serialize the string as a fixed byte string, i.e., without the length prefix\n const textEncoder = new TextEncoder();\n const fixedStringBytes = textEncoder.encode(this.value);\n // Put those bytes into a vector<u8> and serialize it as a script function argument\n const vectorU8 = MoveVector.U8(fixedStringBytes);\n vectorU8.serializeForScriptFunction(serializer);\n }\n\n static deserialize(deserializer: Deserializer): MoveString {\n return new MoveString(deserializer.deserializeStr());\n }\n}\n\nexport class MoveOption<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements EntryFunctionArgument\n{\n private vec: MoveVector<T>;\n\n public readonly value?: T;\n\n constructor(value?: T | null) {\n super();\n if (typeof value !== \"undefined\" && value !== null) {\n this.vec = new MoveVector([value]);\n } else {\n this.vec = new MoveVector([]);\n }\n\n [this.value] = this.vec.values;\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Retrieves the inner value of the MoveOption.\n *\n * This method is inspired by Rust's `Option<T>.unwrap()`.\n * In Rust, attempting to unwrap a `None` value results in a panic.\n *\n * Similarly, this method will throw an error if the value is not present.\n *\n * @example\n * const option = new MoveOption<Bool>(new Bool(true));\n * const value = option.unwrap(); // Returns the Bool instance\n *\n * @throws {Error} Throws an error if the MoveOption does not contain a value.\n *\n * @returns {T} The contained value if present.\n */\n unwrap(): T {\n if (!this.isSome()) {\n throw new Error(\"Called unwrap on a MoveOption with no value\");\n } else {\n return this.vec.values[0];\n }\n }\n\n // Check if the MoveOption has a value.\n isSome(): boolean {\n return this.vec.values.length === 1;\n }\n\n serialize(serializer: Serializer): void {\n // serialize 0 or 1\n // if 1, serialize the value\n this.vec.serialize(serializer);\n }\n\n /**\n * Factory method to generate a MoveOption<U8> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U8(1).isSome() === true;\n * MoveOption.U8().isSome() === false;\n * MoveOption.U8(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U8> with an inner value `value`\n */\n static U8(value?: number | null): MoveOption<U8> {\n return new MoveOption<U8>(value !== null && value !== undefined ? new U8(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U16> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U16(1).isSome() === true;\n * MoveOption.U16().isSome() === false;\n * MoveOption.U16(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U16> with an inner value `value`\n */\n static U16(value?: number | null): MoveOption<U16> {\n return new MoveOption<U16>(value !== null && value !== undefined ? new U16(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U32> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U32(1).isSome() === true;\n * MoveOption.U32().isSome() === false;\n * MoveOption.U32(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U32> with an inner value `value`\n */\n static U32(value?: number | null): MoveOption<U32> {\n return new MoveOption<U32>(value !== null && value !== undefined ? new U32(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U64> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U64(1).isSome() === true;\n * MoveOption.U64().isSome() === false;\n * MoveOption.U64(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U64> with an inner value `value`\n */\n static U64(value?: AnyNumber | null): MoveOption<U64> {\n return new MoveOption<U64>(value !== null && value !== undefined ? new U64(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U128> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U128(1).isSome() === true;\n * MoveOption.U128().isSome() === false;\n * MoveOption.U128(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U128> with an inner value `value`\n */\n static U128(value?: AnyNumber | null): MoveOption<U128> {\n return new MoveOption<U128>(value !== null && value !== undefined ? new U128(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U256> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U256(1).isSome() === true;\n * MoveOption.U256().isSome() === false;\n * MoveOption.U256(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U256> with an inner value `value`\n */\n static U256(value?: AnyNumber | null): MoveOption<U256> {\n return new MoveOption<U256>(value !== null && value !== undefined ? new U256(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<Bool> from a `boolean` or `undefined`.\n *\n * @example\n * MoveOption.Bool(true).isSome() === true;\n * MoveOption.Bool().isSome() === false;\n * MoveOption.Bool(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<Bool> with an inner value `value`\n */\n static Bool(value?: boolean | null): MoveOption<Bool> {\n return new MoveOption<Bool>(value !== null && value !== undefined ? new Bool(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.\n *\n * @example\n * MoveOption.MoveString(\"hello\").isSome() === true;\n * MoveOption.MoveString(\"\").isSome() === true;\n * MoveOption.MoveString().isSome() === false;\n * MoveOption.MoveString(undefined).isSome() === false;\n * @params value: the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<MoveString> with an inner value `value`\n */\n static MoveString(value?: string | null): MoveOption<MoveString> {\n return new MoveOption<MoveString>(value !== null && value !== undefined ? new MoveString(value) : undefined);\n }\n\n static deserialize<U extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<U>,\n ): MoveOption<U> {\n const vector = MoveVector.deserialize(deserializer, cls);\n return new MoveOption(vector.values[0]);\n }\n}\n"],"mappings":"8MAgDO,IAAMA,EAAN,MAAMC,UACHC,CAEV,CAGE,YAAYC,EAAkB,CAC5B,MAAM,EACN,KAAK,OAASA,CAChB,CAEA,0BAA0BC,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAMA,2BAA2BD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C/F,CAaA,OAAO,IAAIA,EAA2C,CACpD,OAAO,IAAIM,EAAgBN,GAAU,KAA8B,IAAIV,EAAIU,CAAK,EAAI,MAAS,CAC/F,CAaA,OAAO,KAAKA,EAA4C,CACtD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIT,EAAKS,CAAK,EAAI,MAAS,CACjG,CAaA,OAAO,KAAKA,EAA4C,CACtD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIR,EAAKQ,CAAK,EAAI,MAAS,CACjG,CAaA,OAAO,KAAKA,EAA0C,CACpD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIP,EAAKO,CAAK,EAAI,MAAS,CACjG,CAcA,OAAO,WAAWA,EAA+C,CAC/D,OAAO,IAAIM,EAAuBN,GAAU,KAA8B,IAAIN,EAAWM,CAAK,EAAI,MAAS,CAC7G,CAEA,OAAO,YACLL,EACAC,EACe,CACf,IAAMW,EAAS/B,EAAW,YAAYmB,EAAcC,CAAG,EACvD,OAAO,IAAIU,EAAWC,EAAO,OAAO,CAAC,CAAC,CACxC,CACF","names":["MoveVector","_MoveVector","Serializable","values","serializer","bcsBytes","U8","Serialized","numbers","hex","Hex","v","U16","U32","U64","U128","U256","Bool","MoveString","deserializer","cls","length","i","_Serialized","value","Deserializer","vec","_MoveString","fixedStringBytes","MoveOption","_MoveOption","vector"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as o,c as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r,b as o,c as t}from"./chunk-LJZPPBTH.mjs";var i=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return o({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return t({aptosConfig:this.config,...e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SCYGW3VV.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as T,d as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as T,d as c}from"./chunk-MNVDBUF3.mjs";import{g as A,h as a}from"./chunk-EXP5STXZ.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
|
|
2
|
+
//# sourceMappingURL=chunk-SUAA25UP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as T,c as en,d as an,e as R}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as T,c as en,d as an,e as R}from"./chunk-DVIRUFCY.mjs";import{r as tn,u as f}from"./chunk-3HTSCV3R.mjs";import{a as Y}from"./chunk-XSTCHOUI.mjs";import{b as nn}from"./chunk-F5PNGH44.mjs";import{a as Q}from"./chunk-OTNGLTKS.mjs";import{a as y}from"./chunk-GKERWKMB.mjs";import{a as j}from"./chunk-HBQLX5QF.mjs";import{b as E,d as B,e as F,f as D}from"./chunk-GR4PHW7K.mjs";import{a as J}from"./chunk-53DBMWMU.mjs";import{a as z,c as L,d as Z}from"./chunk-MNVDBUF3.mjs";import{c as K,d as O,e as V,f as x,g as q,h as H,i as X}from"./chunk-Z2AJWV6D.mjs";import{a as v}from"./chunk-BOYYQAB4.mjs";import{a as k,b as l,d as A}from"./chunk-2XYA7NOU.mjs";import{a as b,b as p}from"./chunk-ZWX3NHGU.mjs";import{a as N}from"./chunk-O4BBULNE.mjs";import{i as S,j as _}from"./chunk-VYXS7TLB.mjs";import{b as $,d as M}from"./chunk-Q7MD4V7H.mjs";import{b as u}from"./chunk-OHRL766V.mjs";import{a as C}from"./chunk-AH44UPM4.mjs";import{a as U}from"./chunk-BSUYPXRD.mjs";import{b as I}from"./chunk-BCUSI3N6.mjs";import{g as P}from"./chunk-SCHZ67F3.mjs";import{b as W,c as G}from"./chunk-EXP5STXZ.mjs";import{sha3_256 as dn}from"@noble/hashes/sha3";async function vn(n){if(tn(n))return yn(n);let{moduleAddress:t,moduleName:e,functionName:i}=f(n.function),a=await on({key:"entry-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:en});return mn({...n,abi:a})}function mn(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(n.function),r=T(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n.functionArguments.map((s,d)=>R(n.function,t,s,d,r));if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);let c=x.build(`${e}::${i}`,a,r,o);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new V(new H(s,new X(c)))}return new O(c)}async function Kn(n){let{moduleAddress:t,moduleName:e,functionName:i}=f(n.function),a=await on({key:"view-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:an});return An({abi:a,...n})}function An(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(n.function),r=T(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n?.functionArguments?.map((c,s)=>R(n.function,t,c,s,r))??[];if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);return x.build(`${e}::${i}`,a,r,o)}function yn(n){return new K(new q(I.fromHexInput(n.bytecode).toUint8Array(),T(n.typeArguments),n.functionArguments))}async function fn(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=async()=>P[t.network]?{chainId:P[t.network]}:{chainId:(await Q({aptosConfig:t})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await nn({aptosConfig:t})).gas_estimate},s=async()=>{let g=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:(await Y({aptosConfig:t,accountAddress:e})).sequence_number;if(r&&u.from(r).equals(u.ZERO))try{return await g()}catch{return 0}else return g()},[{chainId:d},{gasEstimate:m},w]=await Promise.all([o(),c(),s()]),{maxGasAmount:sn,gasUnitPrice:cn,expireTimestamp:un}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(2e5),gasUnitPrice:a?.gasUnitPrice??BigInt(m),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new z(u.from(e),BigInt(w),i,BigInt(sn),BigInt(cn),BigInt(un),new v(d))}async function On(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=await fn({aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new J(o,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new j(o,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Vn(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:i,feePayerPublicKey:a}=n,r=h(t);if(e.feePayerAddress){let c=new Z(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),s=[];i&&(s=i.map(w=>h(w)));let d=h(a),m=new F(r,e.secondarySignerAddresses??[],s,{address:e.feePayerAddress,authenticator:d});return new y(c.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let c=new L(e.rawTransaction,e.secondarySignerAddresses),s=[];s=i.map(m=>h(m));let d=new B(r,e.secondarySignerAddresses,s);return new y(c.raw_txn,d).bcsToBytes()}let o;if(r instanceof l)o=new E(r.public_key,r.signature);else if(r instanceof A)o=new D(r);else throw new Error("Invalid public key");return new y(e.rawTransaction,o).bcsToBytes()}function h(n){let t=new M(new Uint8Array(64));if($.isInstance(n))return new l(n,t);if(b.isInstance(n))return S.isInstance(n.publicKey)?new A(n,new p(_.getSimulationSignature())):new A(n,new p(t));if(S.isInstance(n)||N.isInstance(n))return console.warn("Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey."),new A(new b(n),new p(t));throw new Error("Unsupported public key")}function gn(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:i}=n,a=U(k,n.senderAuthenticator),r;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new F(a,t.secondarySignerAddresses??[],i??[],{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new B(a,t.secondarySignerAddresses,i)}else a instanceof l?r=new E(a.public_key,a.signature):r=new D(a);return new y(t.rawTransaction,r).bcsToBytes()}function rn(n){let t=dn.create();for(let e of n)t.update(e);return t.digest()}var pn=rn(["APTOS::Transaction"]);function qn(n){let t=gn(n);return new I(rn([pn,new Uint8Array([0]),t])).toString()}async function on({key:n,moduleAddress:t,moduleName:e,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:C(async()=>o(t,e,i,a),`${n}-${a.network}-${t}-${e}-${i}`,1e3*60*5)()}export{vn as a,mn as b,Kn as c,An as d,fn as e,On as f,Vn as g,h,gn as i,rn as j,qn as k};
|
|
2
|
+
//# sourceMappingURL=chunk-T53MZO2U.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{decode as c}from"js-base64";async function m(e){return new Promise(n=>{setTimeout(n,e)})}var u=()=>Math.floor(Date.now()/1e3);function i(e){let n=new Date(e*1e3);return n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),Math.floor(n.getTime()/1e3)}function l(e){let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n+"==".substring(0,(3-n.length%3)%3);return c(t)}var g=(e,n)=>e*10**n,p=(e,n)=>e/10**n,r=e=>{let n="";for(let t=2;t<e.length;t+=2)n+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return n},_=e=>{let{account_address:n,module_name:t,struct_name:o}=e,s=r(t),a=r(o);return`${n}::${s}::${a}`},f=e=>typeof e=="object"&&!Array.isArray(e)&&e!==null&&"account_address"in e&&"module_name"in e&&"struct_name"in e&&typeof e.account_address=="string"&&typeof e.module_name=="string"&&typeof e.struct_name=="string";export{m as a,u as b,i as c,l as d,g as e,p as f,_ as g,f as h};
|
|
2
|
+
//# sourceMappingURL=chunk-UAL27G6B.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\nimport { MoveStructId } from \"../types\";\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\n/**\n * Convert a hex string to an ascii string with the `0x` prefix.\n *\n * `0x6170746f735f636f696e` --> `aptos_coin`\n *\n * @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)\n * @returns The ascii string\n */\nconst hexToAscii = (hex: string) => {\n let str = \"\";\n for (let n = 2; n < hex.length; n += 2) {\n str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));\n }\n return str;\n};\n\n/**\n * Convert an encoded struct to a MoveStructId.\n *\n * @example\n * const structObj = {\n * account_address: \"0x1\",\n * module_name: \"0x6170746f735f636f696e\",\n * struct_name: \"0x4170746f73436f696e\",\n * };\n * // structId is \"0x1::aptos_coin::AptosCoin\"\n * const structId = parseEncodedStruct(structObj);\n *\n * @param structObj The struct with account_address, module_name, and struct_name properties\n * @returns The MoveStructId\n */\nexport const parseEncodedStruct = (structObj: {\n account_address: string;\n module_name: string;\n struct_name: string;\n}): MoveStructId => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { account_address, module_name, struct_name } = structObj;\n const moduleName = hexToAscii(module_name);\n const structName = hexToAscii(struct_name);\n return `${account_address}::${moduleName}::${structName}`;\n};\n\n/**\n * Determines whether the given object is an encoded struct type with the following properties:\n * - account_address: string\n * - module_name: string\n * - struct_name: string\n *\n * @param structObj The object to check\n * @returns Whether the object is an encoded struct type\n */\nexport const isEncodedStruct = (\n structObj: any,\n): structObj is {\n account_address: string;\n module_name: string;\n struct_name: string;\n} =>\n typeof structObj === \"object\" &&\n !Array.isArray(structObj) &&\n structObj !== null &&\n \"account_address\" in structObj &&\n \"module_name\" in structObj &&\n \"struct_name\" in structObj &&\n typeof structObj.account_address === \"string\" &&\n typeof structObj.module_name === \"string\" &&\n typeof structObj.struct_name === \"string\";\n"],"mappings":"AAGA,OAAS,UAAAA,MAAc,YAOvB,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,EAUnGE,EAAcC,GAAgB,CAClC,IAAIC,EAAM,GACV,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,GAAK,EACnCD,GAAO,OAAO,aAAa,SAASD,EAAI,UAAUE,EAAGA,EAAI,CAAC,EAAG,EAAE,CAAC,EAElE,OAAOD,CACT,EAiBaE,EAAsBC,GAIf,CAElB,GAAM,CAAE,gBAAAC,EAAiB,YAAAC,EAAa,YAAAC,CAAY,EAAIH,EAChDI,EAAaT,EAAWO,CAAW,EACnCG,EAAaV,EAAWQ,CAAW,EACzC,MAAO,GAAGF,CAAe,KAAKG,CAAU,KAAKC,CAAU,EACzD,EAWaC,EACXN,GAMA,OAAOA,GAAc,UACrB,CAAC,MAAM,QAAQA,CAAS,GACxBA,IAAc,MACd,oBAAqBA,GACrB,gBAAiBA,GACjB,gBAAiBA,GACjB,OAAOA,EAAU,iBAAoB,UACrC,OAAOA,EAAU,aAAgB,UACjC,OAAOA,EAAU,aAAgB","names":["decode","sleep","timeMs","resolve","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable","hexToAscii","hex","str","n","parseEncodedStruct","structObj","account_address","module_name","struct_name","moduleName","structName","isEncodedStruct"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as s}from"./chunk-OTNGLTKS.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-LS6G4DZV.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
|
|
2
|
+
//# sourceMappingURL=chunk-VQVNUN5Y.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-EQSON7Y5.mjs";import{c as p}from"./chunk-NWOMSL6K.mjs";import{c as o}from"./chunk-OTNGLTKS.mjs";import{n as u,q as g,r as A}from"./chunk-VHNX2NUR.mjs";import{f as a,i as r}from"./chunk-SUJLWCRN.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:g,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[{constraints:[]}],parameters:[p("0x1::object::Object"),new r,new a]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return c({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
|
|
2
|
+
//# sourceMappingURL=chunk-VTEZ6TBO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as r,c as s}from"./chunk-VQVNUN5Y.mjs";import{a as t}from"./chunk-5P7MXLZA.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-VYXJ7FUF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as B}from"./chunk-MQGW234H.mjs";import{a as b,b as y}from"./chunk-ZXYTLPP6.mjs";import{b as C,d as I}from"./chunk-Q7MD4V7H.mjs";import{b as U}from"./chunk-76OH2Z4Q.mjs";import{a as d}from"./chunk-MLDQ2TY2.mjs";import{a as m,c as P,d as V,e as v}from"./chunk-IVVWQKCF.mjs";import{a as H}from"./chunk-G5MGSV7Y.mjs";import{b as x}from"./chunk-OHRL766V.mjs";import{a as T}from"./chunk-AH44UPM4.mjs";import{b as w}from"./chunk-54QUDAAC.mjs";import{a as G}from"./chunk-KEYAPEAX.mjs";import{a as p,b as E}from"./chunk-A63SMUOU.mjs";import{b as u}from"./chunk-BCUSI3N6.mjs";import{jwtDecode as k}from"jwt-decode";var he=1e7,F=120,L=30,N=330,ge=120,fe=350,Se=300,xe=93,o=class o extends U{constructor(e,t){super();let i=u.fromHexInput(t).toUint8Array();if(i.length!==o.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${o.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new E;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),H.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return u.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static load(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static isPublicKey(e){return e instanceof o}static create(e){return _(e),new o(e.iss,_(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:i,uidKey:a="sub"}=e,n=k(t),s=n.iss;if(typeof n.aud!="string")throw new Error("aud was not found or an array of values");let M=n.aud,R=n[a];return o.create({iss:s,uidKey:a,uidVal:R,aud:M,pepper:i})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};o.ID_COMMITMENT_LENGTH=32;var A=o;function _(r){let{uidKey:e,uidVal:t,aud:i,pepper:a}=r,n=[P(u.fromHexInput(a).toUint8Array()),m(i,F),m(t,N),m(e,L)];return V(v(n),A.ID_COMMITMENT_LENGTH)}var D=class r extends d{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:i,expiryDateSecs:a,ephemeralPublicKey:n,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=i,this.expiryDateSecs=a,this.ephemeralPublicKey=n,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=h.deserialize(e),i=e.deserializeStr(),a=e.deserializeU64(),n=b.deserialize(e),s=y.deserialize(e);return new r({jwtHeader:i,expiryDateSecs:Number(a),ephemeralCertificate:t,ephemeralPublicKey:n,ephemeralSignature:s})}static getSimulationSignature(){return new r({jwtHeader:"{}",ephemeralCertificate:new h(new S({proof:new f(new g({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new b(new C(new Uint8Array(32))),ephemeralSignature:new y(new I(new Uint8Array(64)))})}static isSignature(e){return e instanceof r}},h=class r extends d{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(S.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},c=class r extends p{constructor(e){if(super(),this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new r(t)}},l=class r extends p{constructor(e){if(super(),this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new r(t)}},g=class r extends B{constructor(e){super();let{a:t,b:i,c:a}=e;this.a=new c(t),this.b=new l(i),this.c=new c(a)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=c.deserialize(e).bcsToBytes(),i=l.deserialize(e).bcsToBytes(),a=c.deserialize(e).bcsToBytes();return new r({a:t,b:i,c:a})}},f=class r extends p{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new r(g.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},S=class r extends d{constructor(e){super();let{proof:t,expHorizonSecs:i,trainingWheelsSignature:a,extraField:n,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=i,this.trainingWheelsSignature=a,this.extraField=n,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return r.deserialize(new G(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=f.deserialize(e),i=Number(e.deserializeU64()),a=e.deserializeOptionStr(),n=e.deserializeOptionStr(),s=e.deserializeOption(y);return new r({proof:t,expHorizonSecs:i,trainingWheelsSignature:s,extraField:a,overrideAudVal:n})}},z=class r{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new r(new K({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},K=class r{constructor(e){let{alphaG1:t,betaG2:i,deltaG2:a,gammaAbcG1:n,gammaG2:s}=e;this.alphaG1=new c(t),this.betaG2=new l(i),this.deltaG2=new l(a),this.gammaAbcG1=[new c(n[0]),new c(n[1])],this.gammaG2=new l(s)}static fromGroth16VerificationKeyResponse(e){return new r({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function be(r){let{aptosConfig:e}=r;return T(async()=>{let t=await O(r),i=await j(r);return z.create(i,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function O(r){let{aptosConfig:e,options:t}=r,i="0x1::keyless_account::Configuration",{data:a}=await w({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${x.from("0x1").toString()}/resource/${i}`,params:{ledger_version:t?.ledgerVersion}});return a.data}async function j(r){let{aptosConfig:e,options:t}=r,i="0x1::keyless_account::Groth16VerificationKey",{data:a}=await w({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${x.from("0x1").toString()}/resource/${i}`,params:{ledger_version:t?.ledgerVersion}});return a.data}export{he as a,F as b,L as c,N as d,ge as e,fe as f,Se as g,xe as h,A as i,D as j,h as k,g as l,f as m,S as n,z as o,be as p};
|
|
2
|
+
//# sourceMappingURL=chunk-VYXS7TLB.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-OHRL766V.mjs";import{a as u,
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-OHRL766V.mjs";import{a as u,c as r}from"./chunk-QQU4IQ27.mjs";import{e as t}from"./chunk-YPHH6CAO.mjs";import{a as i}from"./chunk-A63SMUOU.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WLZYSLHP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as h}from"./chunk-ZWX3NHGU.mjs";import{b as m}from"./chunk-76OH2Z4Q.mjs";import{a as g}from"./chunk-MLDQ2TY2.mjs";import{a as b}from"./chunk-G5MGSV7Y.mjs";function d(l){let e=l;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var f=class l extends m{constructor(e){super();let{publicKeys:r,signaturesRequired:t}=e;if(t<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<t)throw new Error(`Provided ${r.length} public keys is smaller than the ${t} required signatures`);this.publicKeys=r.map(i=>i instanceof o?i:new o(i)),this.signaturesRequired=t}verifySignature(e){throw new Error("not implemented")}authKey(){return b.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(o),t=e.deserializeU8();return new l({publicKeys:r,signaturesRequired:t})}createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach((n,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(a.has(n))throw new Error(`Duplicate bit ${n} detected.`);a.add(n);let c=Math.floor(n/8),y=i[c];y|=t>>n%8,i[c]=y}),i}getIndex(e){let r=e instanceof o?e:new o(e),t=this.publicKeys.findIndex(i=>i.toString()===r.toString());if(t!==-1)return t;throw new Error("Public key not found in MultiKey")}},s=class s extends g{constructor(e){super();let{signatures:r,bitmap:t}=e;if(r.length>s.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${s.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(a=>a instanceof h?a:new h(a)),!(t instanceof Uint8Array))this.bitmap=s.createBitmap({bits:t});else{if(t.length!==s.BITMAP_LEN)throw new Error(`"bitmap" length should be ${s.BITMAP_LEN}`);this.bitmap=t}let i=this.bitmap.reduce((a,n)=>a+d(n),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach(n=>{if(n>=s.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${s.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(n))throw new Error("Duplicate bits detected.");a.add(n);let u=Math.floor(n/8),c=i[u];c|=t>>n%8,i[u]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(h),t=e.deserializeBytes();return new s({signatures:r,bitmap:t})}};s.BITMAP_LEN=4,s.MAX_SIGNATURES_SUPPORTED=s.BITMAP_LEN*8;var p=s;export{f as a,p as b};
|
|
2
|
+
//# sourceMappingURL=chunk-WX6P3Q4I.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-JOROI7FE.mjs";import{a as r}from"./chunk-5P7MXLZA.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WYQLUB4H.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as K}from"./chunk-VQVNUN5Y.mjs";import{c as d}from"./chunk-OTNGLTKS.mjs";import{d as b,e as v,f as q,g as O,i as P,j as S,k as M,u as G}from"./chunk-VHNX2NUR.mjs";import{a as f}from"./chunk-3GOJQ5JD.mjs";import{a as k}from"./chunk-WRRQ7L5K.mjs";import{a as T}from"./chunk-ZWX3NHGU.mjs";import{b as C}from"./chunk-O4BBULNE.mjs";import{c as _}from"./chunk-Q7MD4V7H.mjs";import{a as g}from"./chunk-G5MGSV7Y.mjs";import{b as i}from"./chunk-OHRL766V.mjs";import{a as w}from"./chunk-AH44UPM4.mjs";import{b as A,d as p}from"./chunk-54QUDAAC.mjs";import{a as h}from"./chunk-TDGQGILY.mjs";import{e as y}from"./chunk-EXP5STXZ.mjs";async function R(o){let{aptosConfig:n,accountAddress:t}=o,{data:e}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return e}async function Y(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??1e3}})}async function Z(o){return o.options?.ledgerVersion!==void 0?Q(o):w(async()=>Q(o),`module-${o.accountAddress}-${o.moduleName}`,1e3*60*5)()}async function Q(o){let{aptosConfig:n,accountAddress:t,moduleName:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${e}`,params:{ledger_version:r?.ledgerVersion}});return s}async function ee(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:e?.offset,limit:e?.limit}})}async function oe(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??999}})}async function x(o){let{aptosConfig:n,accountAddress:t,resourceType:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${e}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function L(o){let{aptosConfig:n,authenticationKey:t,options:e}=o,r=await x({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:e}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await K({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:e});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function te(o){let{aptosConfig:n,accountAddress:t}=o,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:S,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function ne(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard});let c={query:O,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function re(o){let{aptosConfig:n,accountAddress:t,collectionAddress:e,options:r}=o,s=i.from(t).toStringLong(),c=i.from(e).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:P,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function se(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}};e?.tokenStandard&&(s.current_collection={token_standard:{_eq:e?.tokenStandard}});let c={query:q,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ce(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:M,variables:{address:e}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function ie(o){let{aptosConfig:n,accountAddress:t,coinType:e,faMetadataAddress:r}=o,s=e,c;if(e!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(e!==void 0&&r===void 0)e===y?c=i.A.toStringLong():c=k(i.A,e).toStringLong();else if(e===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=y)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let l=await B({aptosConfig:n,accountAddress:a,options:{where:u}});return l[0]?l[0].amount:0}async function B(o){let{aptosConfig:n,accountAddress:t,options:e}=o,r=i.from(t).toStringLong(),s={...e?.where,owner_address:{_eq:r}},c={query:v,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ae(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:b,variables:{address:e}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function de(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:G,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function ue(o){let{aptosConfig:n,privateKey:t}=o,e=new T(t.publicKey());if(t instanceof C){let s=g.fromPublicKey({publicKey:e}).derivedAddress();return f.fromPrivateKey({privateKey:t,address:s})}if(t instanceof _){let r=g.fromPublicKey({publicKey:e});if(await I({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:e.publicKey});if(await I({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function I(o){let{aptosConfig:n,authKey:t}=o,e=await L({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await R({aptosConfig:n,accountAddress:e}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${e.toString()}`)}}export{R as a,Y as b,Z as c,ee as d,oe as e,x as f,L as g,te as h,ne as i,re as j,se as k,ce as l,ie as m,B as n,ae as o,de as p,ue as q,I as r};
|
|
2
|
+
//# sourceMappingURL=chunk-XSTCHOUI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../account\";\nimport { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport {\n AccountData,\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 GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\nimport { APTOS_COIN } from \"../utils\";\n\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given account address and module name\n *\n * @param args.accountAddress Hex-encoded 32 byte Aptos account address\n * @param args.moduleName The name of the module\n * @param args.query.ledgerVersion Specifies ledger version of transactions. By default, latest version will be used\n * @returns The move module.\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;\n\n let coinAssetType: string | undefined = coinType;\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, fungibleAssetAddress, or both must be provided\");\n }\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n // Search by fungible asset address, unless it has a coin it migrated from\n let where: any = { asset_type: { _eq: faAddress } };\n if (coinAssetType !== undefined) {\n where = { asset_type: { _in: [coinAssetType, faAddress] } };\n }\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where,\n },\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * NOTE: There is a potential issue once unified single signer scheme will be adopted\n * by the community.\n *\n * Becuase on could create 2 accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we lookup the accounts. First unified\n * scheme and then legacy scheme vs first legacy scheme and then unified scheme.\n *\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"snBA2DA,eAAsBA,EAAQC,EAGL,CACvB,GAAM,CAAE,YAAAC,EAAa,eAAAC,CAAe,EAAIF,EAClC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAkC,CACvD,YAAAH,EACA,aAAc,UACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,EAClE,CAAC,EACD,OAAOC,CACT,CAEA,eAAsBG,EAAWN,EAIC,CAChC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,QAAAK,CAAQ,EAAIP,EACjD,OAAOQ,EAA6C,CAClD,YAAAP,EACA,aAAc,aACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,WAChE,OAAQ,CACN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CAAC,CACrE,CACF,CAGA,MAAM,IAAI,MAAM,yCAAyCkB,CAAU,EAAE,CACvE,CAEA,eAAsBQ,EAAenE,EAAkF,CACrH,GAAM,CAAE,YAAAC,EAAa,QAAAoE,CAAQ,EAAIrE,EAC3BE,EAAiB,MAAMe,EAA6B,CACxD,YAAAhB,EACA,kBAAmBoE,EAAQ,eAAe,CAC5C,CAAC,EAED,GAAI,CACF,aAAMtE,EAAQ,CACZ,YAAAE,EACA,eAAAC,CACF,CAAC,EACM,EACT,OAASoE,EAAY,CAEnB,GAAIA,EAAM,SAAW,IACnB,MAAO,GAET,MAAM,IAAI,MAAM,2CAA2CpE,EAAe,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinAmount","coinType","faMetadataAddress","coinAssetType","faAddress","APTOS_COIN","createObjectAddress","addr","where","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetObjectData","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as p}from"./chunk-SUAA25UP.mjs";import{d as s}from"./chunk-2XYA7NOU.mjs";import{a as u,b as y}from"./chunk-ZWX3NHGU.mjs";import{b as a}from"./chunk-O4BBULNE.mjs";import{c as i}from"./chunk-Q7MD4V7H.mjs";import{b as g}from"./chunk-OHRL766V.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YFMFXRJX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-AVSM2BJR.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YPQZJ72F.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m}from"./chunk-SUJLWCRN.mjs";import{a as g}from"./chunk-YDZBU2DJ.mjs";import{a as p}from"./chunk-YUNDX5I7.mjs";import{b as y}from"./chunk-OHRL766V.mjs";import{a as S}from"./chunk-P5V7OZNN.mjs";import{a as v,b as M}from"./chunk-QQU4IQ27.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-YPHH6CAO.mjs";import{a as u}from"./chunk-A63SMUOU.mjs";function I(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);case 9:return M.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let B=e.deserializeUleb128AsU32(),D=S.deserialize(e,B);s.push(D)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=I(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{I as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
|
|
2
|
+
//# sourceMappingURL=chunk-Z2AJWV6D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/instances/transactionPayload.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { EntryFunctionBytes } from \"../../bcs/serializable/entryFunctionBytes\";\nimport { Bool, U128, U16, U256, U32, U64, U8 } from \"../../bcs/serializable/movePrimitives\";\nimport { MoveVector, Serialized } from \"../../bcs/serializable/moveStructs\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"./identifier\";\nimport { ModuleId } from \"./moduleId\";\nimport type { EntryFunctionArgument, ScriptFunctionArgument, TransactionArgument } from \"./transactionArgument\";\nimport { MoveModuleId, ScriptTransactionArgumentVariants, TransactionPayloadVariants } from \"../../types\";\nimport { TypeTag } from \"../typeTag\";\n\n/**\n * Deserialize a Script Transaction Argument\n */\nexport function deserializeFromScriptArgument(deserializer: Deserializer): TransactionArgument {\n // index enum variant\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case ScriptTransactionArgumentVariants.U8:\n return U8.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U64:\n return U64.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U128:\n return U128.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.Address:\n return AccountAddress.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U8Vector:\n return MoveVector.deserialize(deserializer, U8);\n case ScriptTransactionArgumentVariants.Bool:\n return Bool.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U16:\n return U16.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U32:\n return U32.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.U256:\n return U256.deserialize(deserializer);\n case ScriptTransactionArgumentVariants.Serialized:\n return Serialized.deserialize(deserializer);\n default:\n throw new Error(`Unknown variant index for ScriptTransactionArgument: ${index}`);\n }\n}\n\n/**\n * Representation of the supported Transaction Payload\n * that can serialized and deserialized\n */\nexport abstract class TransactionPayload extends Serializable {\n /**\n * Serialize a Transaction Payload\n */\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserialize a Transaction Payload\n */\n static deserialize(deserializer: Deserializer): TransactionPayload {\n // index enum variant\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case TransactionPayloadVariants.Script:\n return TransactionPayloadScript.load(deserializer);\n case TransactionPayloadVariants.EntryFunction:\n return TransactionPayloadEntryFunction.load(deserializer);\n case TransactionPayloadVariants.Multisig:\n return TransactionPayloadMultiSig.load(deserializer);\n default:\n throw new Error(`Unknown variant index for TransactionPayload: ${index}`);\n }\n }\n}\n\n/**\n * Representation of a Transaction Payload Script that can serialized and deserialized\n */\nexport class TransactionPayloadScript extends TransactionPayload {\n public readonly script: Script;\n\n constructor(script: Script) {\n super();\n this.script = script;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.Script);\n this.script.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionPayloadScript {\n const script = Script.deserialize(deserializer);\n return new TransactionPayloadScript(script);\n }\n}\n\n/**\n * Representation of a Transaction Payload Entry Function that can serialized and deserialized\n */\nexport class TransactionPayloadEntryFunction extends TransactionPayload {\n public readonly entryFunction: EntryFunction;\n\n constructor(entryFunction: EntryFunction) {\n super();\n this.entryFunction = entryFunction;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.EntryFunction);\n this.entryFunction.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionPayloadEntryFunction {\n const entryFunction = EntryFunction.deserialize(deserializer);\n return new TransactionPayloadEntryFunction(entryFunction);\n }\n}\n\n/**\n * Representation of a Transaction Payload Multi-sig that can serialized and deserialized\n */\nexport class TransactionPayloadMultiSig extends TransactionPayload {\n public readonly multiSig: MultiSig;\n\n constructor(multiSig: MultiSig) {\n super();\n this.multiSig = multiSig;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionPayloadVariants.Multisig);\n this.multiSig.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionPayloadMultiSig {\n const value = MultiSig.deserialize(deserializer);\n return new TransactionPayloadMultiSig(value);\n }\n}\n\n/**\n * Representation of a EntryFunction that can serialized and deserialized\n */\nexport class EntryFunction {\n public readonly module_name: ModuleId;\n\n public readonly function_name: Identifier;\n\n public readonly type_args: Array<TypeTag>;\n\n public readonly args: Array<EntryFunctionArgument>;\n\n /**\n * Contains the payload to run a function within a module.\n * @param module_name Fully qualified module name in format \"account_address::module_name\" e.g. \"0x1::coin\"\n * @param function_name The function name. e.g \"transfer\"\n * @param type_args Type arguments that move function requires.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n * @param args arguments to the move function.\n *\n * @example\n * A coin transfer function has three arguments \"from\", \"to\" and \"amount\".\n * ```\n * public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)\n * ```\n */\n constructor(\n module_name: ModuleId,\n function_name: Identifier,\n type_args: Array<TypeTag>,\n args: Array<EntryFunctionArgument>,\n ) {\n this.module_name = module_name;\n this.function_name = function_name;\n this.type_args = type_args;\n this.args = args;\n }\n\n /**\n * A helper function to build a EntryFunction payload from raw primitive values\n *\n * @param module_id Fully qualified module name in format \"AccountAddress::module_id\" e.g. \"0x1::coin\"\n * @param function_name Function name\n * @param type_args Type arguments that move function requires.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)\n * ```\n * @param args Arguments to the move function.\n *\n * @example\n * A coin transfer function has three arguments \"from\", \"to\" and \"amount\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)\n * ```\n * @returns EntryFunction\n */\n static build(\n module_id: MoveModuleId,\n function_name: string,\n type_args: Array<TypeTag>,\n args: Array<EntryFunctionArgument>,\n ): EntryFunction {\n return new EntryFunction(ModuleId.fromStr(module_id), new Identifier(function_name), type_args, args);\n }\n\n serialize(serializer: Serializer): void {\n this.module_name.serialize(serializer);\n this.function_name.serialize(serializer);\n serializer.serializeVector<TypeTag>(this.type_args);\n serializer.serializeU32AsUleb128(this.args.length);\n this.args.forEach((item: EntryFunctionArgument) => {\n item.serializeForEntryFunction(serializer);\n });\n }\n\n /**\n * Deserializes an entry function payload with the arguments represented as EntryFunctionBytes instances.\n * @see EntryFunctionBytes\n *\n * NOTE: When you deserialize an EntryFunction payload with this method, the entry function\n * arguments are populated into the deserialized instance as type-agnostic, raw fixed bytes\n * in the form of the EntryFunctionBytes class.\n *\n * In order to correctly deserialize these arguments as their actual type representations, you\n * must know the types of the arguments beforehand and deserialize them yourself individually.\n *\n * One way you could achieve this is by using the ABIs for an entry function and deserializing each\n * argument as its given, corresponding type.\n *\n * @param deserializer\n * @returns A deserialized EntryFunction payload for a transaction.\n *\n */\n static deserialize(deserializer: Deserializer): EntryFunction {\n const module_name = ModuleId.deserialize(deserializer);\n const function_name = Identifier.deserialize(deserializer);\n const type_args = deserializer.deserializeVector(TypeTag);\n\n const length = deserializer.deserializeUleb128AsU32();\n const args: Array<EntryFunctionArgument> = new Array<EntryFunctionBytes>();\n\n for (let i = 0; i < length; i += 1) {\n const fixedBytesLength = deserializer.deserializeUleb128AsU32();\n const fixedBytes = EntryFunctionBytes.deserialize(deserializer, fixedBytesLength);\n args.push(fixedBytes);\n }\n\n return new EntryFunction(module_name, function_name, type_args, args);\n }\n}\n\n/**\n * Representation of a Script that can serialized and deserialized\n */\nexport class Script {\n /**\n * The move module bytecode\n */\n public readonly bytecode: Uint8Array;\n\n /**\n * The type arguments that the bytecode function requires.\n */\n public readonly type_args: Array<TypeTag>;\n\n /**\n * The arguments that the bytecode function requires.\n */\n public readonly args: Array<ScriptFunctionArgument>;\n\n /**\n * Scripts contain the Move bytecodes payload that can be submitted to Aptos chain for execution.\n *\n * @param bytecode The move module bytecode\n * @param type_args The type arguments that the bytecode function requires.\n *\n * @example\n * A coin transfer function has one type argument \"CoinType\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)\n * ```\n * @param args The arguments that the bytecode function requires.\n *\n * @example\n * A coin transfer function has three arguments \"from\", \"to\" and \"amount\".\n * ```\n * public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64,)\n * ```\n */\n constructor(bytecode: Uint8Array, type_args: Array<TypeTag>, args: Array<ScriptFunctionArgument>) {\n this.bytecode = bytecode;\n this.type_args = type_args;\n this.args = args;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.bytecode);\n serializer.serializeVector<TypeTag>(this.type_args);\n serializer.serializeU32AsUleb128(this.args.length);\n this.args.forEach((item: ScriptFunctionArgument) => {\n item.serializeForScriptFunction(serializer);\n });\n }\n\n static deserialize(deserializer: Deserializer): Script {\n const bytecode = deserializer.deserializeBytes();\n const type_args = deserializer.deserializeVector(TypeTag);\n const length = deserializer.deserializeUleb128AsU32();\n const args = new Array<ScriptFunctionArgument>();\n for (let i = 0; i < length; i += 1) {\n // Note that we deserialize directly to the Move value, not its Script argument representation.\n // We are abstracting away the Script argument representation because knowing about it is\n // functionally useless.\n const scriptArgument = deserializeFromScriptArgument(deserializer);\n args.push(scriptArgument);\n }\n return new Script(bytecode, type_args, args);\n }\n}\n\n/**\n * Representation of a MultiSig that can serialized and deserialized\n */\nexport class MultiSig {\n public readonly multisig_address: AccountAddress;\n\n public readonly transaction_payload?: MultiSigTransactionPayload;\n\n /**\n * Contains the payload to run a multi-sig account transaction.\n *\n * @param multisig_address The multi-sig account address the transaction will be executed as.\n *\n * @param transaction_payload The payload of the multi-sig transaction. This is optional when executing a multi-sig\n * transaction whose payload is already stored on chain.\n */\n constructor(multisig_address: AccountAddress, transaction_payload?: MultiSigTransactionPayload) {\n this.multisig_address = multisig_address;\n this.transaction_payload = transaction_payload;\n }\n\n serialize(serializer: Serializer): void {\n this.multisig_address.serialize(serializer);\n // Options are encoded with an extra u8 field before the value - 0x0 is none and 0x1 is present.\n // We use serializeBool below to create this prefix value.\n if (this.transaction_payload === undefined) {\n serializer.serializeBool(false);\n } else {\n serializer.serializeBool(true);\n this.transaction_payload.serialize(serializer);\n }\n }\n\n static deserialize(deserializer: Deserializer): MultiSig {\n const multisig_address = AccountAddress.deserialize(deserializer);\n const payloadPresent = deserializer.deserializeBool();\n let transaction_payload;\n if (payloadPresent) {\n transaction_payload = MultiSigTransactionPayload.deserialize(deserializer);\n }\n return new MultiSig(multisig_address, transaction_payload);\n }\n}\n\n/**\n * Representation of a MultiSig Transaction Payload from `multisig_account.move`\n * that can be serialized and deserialized\n\n * This class exists right now to represent an extensible transaction payload class for\n * transactions used in `multisig_account.move`. Eventually, this class will be able to\n * support script payloads when the `multisig_account.move` module supports them.\n */\nexport class MultiSigTransactionPayload extends Serializable {\n public readonly transaction_payload: EntryFunction;\n\n /**\n * Contains the payload to run a multi-sig account transaction.\n *\n * @param transaction_payload The payload of the multi-sig transaction.\n * This can only be EntryFunction for now but,\n * Script might be supported in the future.\n */\n constructor(transaction_payload: EntryFunction) {\n super();\n this.transaction_payload = transaction_payload;\n }\n\n serialize(serializer: Serializer): void {\n /**\n * We can support multiple types of inner transaction payload in the future.\n * For now, it's only EntryFunction but if we support more types,\n * we need to serialize with the right enum values here\n */\n serializer.serializeU32AsUleb128(0);\n this.transaction_payload.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): MultiSigTransactionPayload {\n // TODO: Support other types of payload beside EntryFunction.\n // This is the enum value indicating which type of payload the multisig tx contains.\n deserializer.deserializeUleb128AsU32();\n return new MultiSigTransactionPayload(EntryFunction.deserialize(deserializer));\n }\n}\n"],"mappings":"yXAoBO,SAASA,EAA8BC,EAAiD,CAE7F,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAAG,YAAYF,CAAY,EACpC,OACE,OAAOG,EAAI,YAAYH,CAAY,EAC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AmCtC,CAAa,CAU3D,YAAYmC,EAAoC,CAC9C,MAAM,EACN,KAAK,oBAAsBA,CAC7B,CAEA,UAAU7B,EAA8B,CAMtCA,EAAW,sBAAsB,CAAC,EAClC,KAAK,oBAAoB,UAAUA,CAAU,CAC/C,CAEA,OAAO,YAAYnB,EAAwD,CAGzE,OAAAA,EAAa,wBAAwB,EAC9B,IAAImD,EAA2B5B,EAAc,YAAYvB,CAAY,CAAC,CAC/E,CACF","names":["deserializeFromScriptArgument","deserializer","index","U8","U64","U128","AccountAddress","MoveVector","Bool","U16","U32","U256","Serialized","TransactionPayload","Serializable","TransactionPayloadScript","TransactionPayloadEntryFunction","TransactionPayloadMultiSig","_TransactionPayloadScript","script","serializer","Script","_TransactionPayloadEntryFunction","entryFunction","EntryFunction","_TransactionPayloadMultiSig","multiSig","value","MultiSig","_EntryFunction","module_name","function_name","type_args","args","module_id","ModuleId","Identifier","item","TypeTag","length","i","fixedBytesLength","fixedBytes","EntryFunctionBytes","_Script","bytecode","scriptArgument","_MultiSig","multisig_address","transaction_payload","payloadPresent","MultiSigTransactionPayload","_MultiSigTransactionPayload"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-NDJKEFNU.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,h as d}from"./chunk-EQSON7Y5.mjs";import{g as u}from"./chunk-F5PNGH44.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
|
|
2
|
+
//# sourceMappingURL=chunk-ZNC3FRSK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,c}from"./chunk-O4BBULNE.mjs";import{i as u,j as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a,c}from"./chunk-O4BBULNE.mjs";import{i as u,j as o}from"./chunk-VYXS7TLB.mjs";import{b as n,d as s}from"./chunk-Q7MD4V7H.mjs";import{b}from"./chunk-76OH2Z4Q.mjs";import{a as p}from"./chunk-MLDQ2TY2.mjs";import{a as y}from"./chunk-G5MGSV7Y.mjs";var f=class r extends b{constructor(e){if(super(),this.publicKey=e,e instanceof n)this.variant=0;else if(e instanceof a)this.variant=1;else if(e instanceof u)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:i}=e;return l.isInstance(i)?this.publicKey.verifySignature({message:t,signature:i.signature}):!1}authKey(){return y.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),i;switch(t){case 0:i=n.deserialize(e);break;case 1:i=a.deserialize(e);break;case 3:i=u.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new r(i)}static isPublicKey(e){return e instanceof r}isEd25519(){return this.publicKey instanceof n}isSecp256k1PublicKey(){return this.publicKey instanceof a}static isInstance(e){return"publicKey"in e&&"variant"in e}},l=class r extends p{constructor(e){if(super(),this.signature=e,e instanceof s)this.variant=0;else if(e instanceof c)this.variant=1;else if(e instanceof o)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),i;switch(t){case 0:i=s.deserialize(e);break;case 1:i=c.deserialize(e);break;case 3:i=o.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new r(i)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};export{f as a,l as b};
|
|
2
|
+
//# sourceMappingURL=chunk-ZWX3NHGU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.
|
|
1
|
+
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.28.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as r}from"../chunk-HAT5S2XX.mjs";import{a as o}from"../chunk-B5NYEWNM.mjs";import"../chunk-UAL27G6B.mjs";import"../chunk-FVA2OPG4.mjs";export{o as LocalNode,r as Move};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-B5NYEWNM.mjs";import"../chunk-UAL27G6B.mjs";import"../chunk-FVA2OPG4.mjs";export{a as LocalNode};
|
|
2
2
|
//# sourceMappingURL=localNode.mjs.map
|
package/dist/esm/cli/move.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-HAT5S2XX.mjs";import"../chunk-FVA2OPG4.mjs";export{a as Move};
|
|
2
2
|
//# sourceMappingURL=move.mjs.map
|
package/dist/esm/client/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-EXMQBH3I.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-BSUYPXRD.mjs";import"../chunk-TDGQGILY.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-UAL27G6B.mjs";import"../chunk-SCHZ67F3.mjs";import"../chunk-EXP5STXZ.mjs";import"../chunk-ZXVQ2OBJ.mjs";import"../chunk-FVA2OPG4.mjs";export{b as aptosRequest,a as request};
|
|
2
2
|
//# sourceMappingURL=core.mjs.map
|
package/dist/esm/client/get.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-54QUDAAC.mjs";import"../chunk-EXMQBH3I.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-BSUYPXRD.mjs";import"../chunk-TDGQGILY.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-UAL27G6B.mjs";import"../chunk-SCHZ67F3.mjs";import"../chunk-EXP5STXZ.mjs";import"../chunk-ZXVQ2OBJ.mjs";import"../chunk-FVA2OPG4.mjs";export{a as get,b as getAptosFullNode,c as getAptosPepperService,d as paginateWithCursor};
|
|
2
2
|
//# sourceMappingURL=get.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-N2FKVZ4D.mjs";import{a as d,b as e,c as f,d as g}from"../chunk-
|
|
1
|
+
import"../chunk-N2FKVZ4D.mjs";import{a as d,b as e,c as f,d as g}from"../chunk-54QUDAAC.mjs";import{a as h,b as i,c as j,d as k,e as l,f as m}from"../chunk-LS6G4DZV.mjs";import{a as b,b as c}from"../chunk-EXMQBH3I.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-BSUYPXRD.mjs";import{a}from"../chunk-TDGQGILY.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-UAL27G6B.mjs";import"../chunk-SCHZ67F3.mjs";import"../chunk-EXP5STXZ.mjs";import"../chunk-ZXVQ2OBJ.mjs";import"../chunk-FVA2OPG4.mjs";export{a as AptosApiError,c as aptosRequest,d as get,e as getAptosFullNode,f as getAptosPepperService,g as paginateWithCursor,h as post,k as postAptosFaucet,i as postAptosFullNode,j as postAptosIndexer,l as postAptosPepperService,m as postAptosProvingService,b as request};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/client/post.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-LS6G4DZV.mjs";import"../chunk-EXMQBH3I.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-BSUYPXRD.mjs";import"../chunk-TDGQGILY.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-UAL27G6B.mjs";import"../chunk-SCHZ67F3.mjs";import"../chunk-EXP5STXZ.mjs";import"../chunk-ZXVQ2OBJ.mjs";import"../chunk-FVA2OPG4.mjs";export{a as post,d as postAptosFaucet,b as postAptosFullNode,c as postAptosIndexer,e as postAptosPepperService,f as postAptosProvingService};
|
|
2
2
|
//# sourceMappingURL=post.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-TDGQGILY.mjs";import"../chunk-
|
|
1
|
+
import{a}from"../chunk-TDGQGILY.mjs";import"../chunk-EXP5STXZ.mjs";import"../chunk-FVA2OPG4.mjs";export{a as AptosApiError};
|
|
2
2
|
//# sourceMappingURL=types.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import{a,b,c}from"../../chunk-WRRQ7L5K.mjs";import"../../chunk-OHRL766V.mjs";import"../../chunk-
|
|
1
|
+
import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import{a,b,c}from"../../chunk-WRRQ7L5K.mjs";import"../../chunk-OHRL766V.mjs";import"../../chunk-G773HST5.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-A63SMUOU.mjs";import"../../chunk-BCUSI3N6.mjs";import"../../chunk-LG7RJQ57.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as createObjectAddress,b as createResourceAddress,c as createTokenAddress};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"../../../chunk-WRRQ7L5K.mjs";import"../../../chunk-OHRL766V.mjs";import"../../../chunk-
|
|
1
|
+
import{a,b,c}from"../../../chunk-WRRQ7L5K.mjs";import"../../../chunk-OHRL766V.mjs";import"../../../chunk-G773HST5.mjs";import"../../../chunk-4WPQQPUF.mjs";import"../../../chunk-A63SMUOU.mjs";import"../../../chunk-BCUSI3N6.mjs";import"../../../chunk-LG7RJQ57.mjs";import"../../../chunk-56CNRT2K.mjs";import"../../../chunk-FVA2OPG4.mjs";export{a as createObjectAddress,b as createResourceAddress,c as createTokenAddress};
|
|
2
2
|
//# sourceMappingURL=address.mjs.map
|