@aptos-labs/ts-sdk 1.0.0 → 1.2.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/README.md +3 -3
- package/dist/browser/index.d.ts +516 -219
- package/dist/browser/index.global.js +53 -29
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +516 -219
- package/dist/common/index.js +24 -24
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +9 -9
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +4 -11
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +3 -3
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +300 -76
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +3 -3
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +0 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +118 -13
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +25 -4
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +4 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +23 -2
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +21 -2
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +1 -1
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-NMFS5KAE.mjs → chunk-3R3RC6HA.mjs} +2 -2
- package/dist/esm/{chunk-KVJ2KGMW.mjs → chunk-3TCHSIX5.mjs} +2 -2
- package/dist/esm/{chunk-UR5E2UDO.mjs → chunk-47UUK4Y5.mjs} +2 -2
- package/dist/esm/{chunk-3RMXGSHK.mjs → chunk-4DI53MOX.mjs} +2 -2
- package/dist/esm/{chunk-6DYNAFAP.mjs → chunk-4SUSQ6FW.mjs} +2 -2
- package/dist/esm/chunk-4TMEKWN2.mjs +2 -0
- package/dist/esm/chunk-4TMEKWN2.mjs.map +1 -0
- package/dist/esm/chunk-6EMN3BOV.mjs +2 -0
- package/dist/esm/chunk-6EMN3BOV.mjs.map +1 -0
- package/dist/esm/{chunk-IU5JZNH4.mjs → chunk-6GSEQAP3.mjs} +2 -2
- package/dist/esm/{chunk-32A35CPU.mjs → chunk-6P75FCI4.mjs} +2 -2
- package/dist/esm/{chunk-32A35CPU.mjs.map → chunk-6P75FCI4.mjs.map} +1 -1
- package/dist/esm/chunk-6ZC3SZE6.mjs +2 -0
- package/dist/esm/{chunk-W4JEP5GW.mjs.map → chunk-6ZC3SZE6.mjs.map} +1 -1
- package/dist/esm/{chunk-BDTDWLGO.mjs → chunk-7QI27CQO.mjs} +2 -2
- package/dist/esm/{chunk-5HZKDT5C.mjs → chunk-7SMTJUHH.mjs} +2 -2
- package/dist/esm/chunk-7YRPYQ7C.mjs +2 -0
- package/dist/esm/chunk-7YRPYQ7C.mjs.map +1 -0
- package/dist/esm/{chunk-GQI3HWOB.mjs → chunk-7YT7GFC2.mjs} +2 -2
- package/dist/esm/chunk-AEGZ42XG.mjs +2 -0
- package/dist/esm/chunk-AEGZ42XG.mjs.map +1 -0
- package/dist/esm/{chunk-2AMFCGJ3.mjs → chunk-AWEUIMRQ.mjs} +2 -2
- package/dist/esm/chunk-AWEUIMRQ.mjs.map +1 -0
- package/dist/esm/{chunk-5SRMD5C6.mjs → chunk-B5DL5P23.mjs} +2 -2
- package/dist/esm/{chunk-OXO3Z2MF.mjs → chunk-BCTD22UJ.mjs} +2 -2
- package/dist/esm/{chunk-MNFGMNYS.mjs → chunk-CFOIMAJF.mjs} +2 -2
- package/dist/esm/chunk-CFOIMAJF.mjs.map +1 -0
- package/dist/esm/{chunk-7QJYTQSU.mjs → chunk-D3U253BW.mjs} +2 -2
- package/dist/esm/{chunk-XKINEFAA.mjs → chunk-DIXTONIO.mjs} +2 -2
- package/dist/esm/chunk-DIXTONIO.mjs.map +1 -0
- package/dist/esm/{chunk-X7QBDRQR.mjs → chunk-DV6TMIRK.mjs} +2 -2
- package/dist/esm/{chunk-X7QBDRQR.mjs.map → chunk-DV6TMIRK.mjs.map} +1 -1
- package/dist/esm/{chunk-ELWWME6B.mjs → chunk-EX2EBRNH.mjs} +2 -2
- package/dist/esm/chunk-EX2EBRNH.mjs.map +1 -0
- package/dist/esm/{chunk-OWP2MKTX.mjs → chunk-EZGQODGD.mjs} +2 -2
- package/dist/esm/{chunk-ZWH2ESXT.mjs → chunk-FVA2OPG4.mjs} +1 -1
- package/dist/esm/{chunk-7IY2Y73Q.mjs → chunk-GSBXTPCS.mjs} +2 -2
- package/dist/esm/chunk-GSBXTPCS.mjs.map +1 -0
- package/dist/esm/{chunk-FGTQT7Q5.mjs → chunk-GTZAXATL.mjs} +2 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs +2 -0
- package/dist/esm/{chunk-EOC4UI5B.mjs.map → chunk-HHJBCGAQ.mjs.map} +1 -1
- package/dist/esm/{chunk-C3Y52GHM.mjs → chunk-HXJHVTIU.mjs} +2 -2
- package/dist/esm/{chunk-F52GIFKT.mjs → chunk-I62T5OCN.mjs} +2 -2
- package/dist/esm/{chunk-ZKFDLJ2F.mjs → chunk-I77JNEEH.mjs} +2 -2
- package/dist/esm/{chunk-6F4ACCCZ.mjs → chunk-I7EF66RZ.mjs} +2 -2
- package/dist/esm/{chunk-PANYJULW.mjs → chunk-IA2CIVWP.mjs} +2 -2
- package/dist/esm/{chunk-NLONZHYT.mjs → chunk-J733CDF2.mjs} +2 -2
- package/dist/esm/chunk-J7VKEBBQ.mjs +2 -0
- package/dist/esm/chunk-J7VKEBBQ.mjs.map +1 -0
- package/dist/esm/chunk-JJDQALR6.mjs +2 -0
- package/dist/esm/chunk-JJDQALR6.mjs.map +1 -0
- package/dist/esm/{chunk-KR5JAN32.mjs → chunk-JXVSO6IA.mjs} +2 -2
- package/dist/esm/{chunk-Y5RQOXZH.mjs → chunk-K2LNHGV5.mjs} +2 -2
- package/dist/esm/chunk-KBWYFDSS.mjs +2 -0
- package/dist/esm/{chunk-5IVRKK5V.mjs → chunk-KEOLTOML.mjs} +2 -2
- package/dist/esm/{chunk-5IVRKK5V.mjs.map → chunk-KEOLTOML.mjs.map} +1 -1
- package/dist/esm/chunk-L6DJOGKE.mjs +2 -0
- package/dist/esm/chunk-L6DJOGKE.mjs.map +1 -0
- package/dist/esm/{chunk-VMCFN5CT.mjs → chunk-NANOXAUV.mjs} +2 -2
- package/dist/esm/{chunk-NFGAZSSK.mjs → chunk-NHB2SPSA.mjs} +2 -2
- package/dist/esm/{chunk-PRKZ2KJ4.mjs → chunk-NRGN7EFM.mjs} +2 -2
- package/dist/esm/chunk-NWEQD6JS.mjs +2 -0
- package/dist/esm/chunk-NWEQD6JS.mjs.map +1 -0
- package/dist/esm/{chunk-7B3VSBCX.mjs → chunk-O7HXE2B5.mjs} +2 -2
- package/dist/esm/chunk-OT6XSVB2.mjs +2 -0
- package/dist/esm/chunk-OT6XSVB2.mjs.map +1 -0
- package/dist/esm/{chunk-HQ4DGB7L.mjs → chunk-QJPQWNVJ.mjs} +2 -2
- package/dist/esm/chunk-QW2MOIZP.mjs +2 -0
- package/dist/esm/chunk-QW2MOIZP.mjs.map +1 -0
- package/dist/esm/chunk-R2PCVD75.mjs +2 -0
- package/dist/esm/chunk-R2PCVD75.mjs.map +1 -0
- package/dist/esm/{chunk-RCYWJZR4.mjs → chunk-RFYP3V47.mjs} +2 -2
- package/dist/esm/{chunk-PZ5JKQSP.mjs → chunk-SBIT6S4D.mjs} +2 -2
- package/dist/esm/chunk-SBIT6S4D.mjs.map +1 -0
- package/dist/esm/chunk-SGRMOG3X.mjs +2 -0
- package/dist/esm/chunk-SGRMOG3X.mjs.map +1 -0
- package/dist/esm/{chunk-N25GOEVL.mjs → chunk-SS7YTDGF.mjs} +2 -2
- package/dist/esm/chunk-TQ3QAVBU.mjs +2 -0
- package/dist/esm/chunk-TQ3QAVBU.mjs.map +1 -0
- package/dist/esm/chunk-ULKNPUPO.mjs +2 -0
- package/dist/esm/chunk-ULKNPUPO.mjs.map +1 -0
- package/dist/esm/chunk-UPQSJD25.mjs +2 -0
- package/dist/esm/chunk-UPQSJD25.mjs.map +1 -0
- package/dist/esm/{chunk-DBJTMCAG.mjs → chunk-UVAYKM6H.mjs} +2 -2
- package/dist/esm/{chunk-3QS3MFWJ.mjs → chunk-VJ3ZN43A.mjs} +2 -2
- package/dist/esm/chunk-WAUU2XNO.mjs +2 -0
- package/dist/esm/chunk-WAUU2XNO.mjs.map +1 -0
- package/dist/esm/{chunk-CBAVJ5EN.mjs → chunk-XE5NXBGH.mjs} +2 -2
- package/dist/esm/{chunk-F2GFSFPW.mjs → chunk-XWWW2V74.mjs} +2 -2
- package/dist/esm/chunk-YR3ZVJBF.mjs +2 -0
- package/dist/esm/chunk-YR3ZVJBF.mjs.map +1 -0
- package/dist/esm/{chunk-DYJVDOBH.mjs → chunk-ZOFYHCU4.mjs} +2 -2
- package/dist/esm/chunk-ZOFYHCU4.mjs.map +1 -0
- package/dist/esm/{chunk-4K252UDE.mjs → chunk-ZTNSWIML.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +1 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account.d.mts +2 -2
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.d.mts +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.d.mts +1 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.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/secp256k1.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +1 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +6 -6
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +2 -2
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +144 -27
- 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.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.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.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.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/transactionArgument.d.mts +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/asyncQueue.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- 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/transactionBuilder.d.mts +2 -2
- 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 +4 -4
- package/dist/esm/types/generated/operations.d.mts +1 -1
- package/dist/esm/types/generated/queries.d.mts +1 -1
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.d.mts +1 -1
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/index.d.mts +2 -2
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +1 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +0 -2
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +32 -30
- package/src/api/account.ts +10 -21
- package/src/api/ans.ts +9 -9
- package/src/api/aptos.ts +3 -28
- package/src/api/coin.ts +3 -3
- package/src/api/digitalAsset.ts +372 -115
- package/src/api/event.ts +3 -3
- package/src/api/fungibleAsset.ts +7 -7
- package/src/api/general.ts +1 -1
- package/src/api/staking.ts +3 -3
- package/src/api/transaction.ts +172 -2
- package/src/api/transactionSubmission/build.ts +25 -4
- package/src/api/transactionSubmission/helpers.ts +31 -0
- package/src/api/transactionSubmission/simulate.ts +26 -20
- package/src/api/transactionSubmission/submit.ts +24 -20
- package/src/api/utils.ts +6 -19
- package/src/client/core.ts +1 -1
- package/src/core/account.ts +2 -2
- package/src/internal/ans.ts +5 -5
- package/src/internal/coin.ts +2 -2
- package/src/internal/digitalAsset.ts +461 -61
- package/src/internal/fungibleAsset.ts +2 -2
- package/src/internal/general.ts +2 -2
- package/src/internal/transaction.ts +1 -1
- package/src/internal/transactionSubmission.ts +6 -6
- package/src/transactions/management/transactionWorker.ts +2 -9
- package/src/transactions/transactionBuilder/remoteAbi.ts +9 -7
- package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -4
- package/src/transactions/types.ts +3 -2
- package/src/utils/const.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/esm/api/transactionSubmission.d.mts +0 -113
- package/dist/esm/api/transactionSubmission.mjs +0 -2
- package/dist/esm/chunk-26GRNGPL.mjs +0 -2
- package/dist/esm/chunk-26GRNGPL.mjs.map +0 -1
- package/dist/esm/chunk-2AMFCGJ3.mjs.map +0 -1
- package/dist/esm/chunk-2X3FRUKX.mjs +0 -2
- package/dist/esm/chunk-2X3FRUKX.mjs.map +0 -1
- package/dist/esm/chunk-4FDIPWVB.mjs +0 -2
- package/dist/esm/chunk-4FDIPWVB.mjs.map +0 -1
- package/dist/esm/chunk-4XQ5IV6C.mjs +0 -2
- package/dist/esm/chunk-4XQ5IV6C.mjs.map +0 -1
- package/dist/esm/chunk-5X46HDCI.mjs +0 -2
- package/dist/esm/chunk-5X46HDCI.mjs.map +0 -1
- package/dist/esm/chunk-7IY2Y73Q.mjs.map +0 -1
- package/dist/esm/chunk-BA4TDBYB.mjs +0 -2
- package/dist/esm/chunk-BA4TDBYB.mjs.map +0 -1
- package/dist/esm/chunk-DYJVDOBH.mjs.map +0 -1
- package/dist/esm/chunk-EHJEK7FU.mjs +0 -2
- package/dist/esm/chunk-ELWWME6B.mjs.map +0 -1
- package/dist/esm/chunk-EOC4UI5B.mjs +0 -2
- package/dist/esm/chunk-GMOHGD73.mjs +0 -2
- package/dist/esm/chunk-GMOHGD73.mjs.map +0 -1
- package/dist/esm/chunk-LBNMY7EM.mjs +0 -2
- package/dist/esm/chunk-LBNMY7EM.mjs.map +0 -1
- package/dist/esm/chunk-MNFGMNYS.mjs.map +0 -1
- package/dist/esm/chunk-NBSXZKMQ.mjs +0 -2
- package/dist/esm/chunk-NBSXZKMQ.mjs.map +0 -1
- package/dist/esm/chunk-NZ36UN4C.mjs +0 -2
- package/dist/esm/chunk-NZ36UN4C.mjs.map +0 -1
- package/dist/esm/chunk-PEBXSNMJ.mjs +0 -2
- package/dist/esm/chunk-PEBXSNMJ.mjs.map +0 -1
- package/dist/esm/chunk-PLY7MQKE.mjs +0 -2
- package/dist/esm/chunk-PLY7MQKE.mjs.map +0 -1
- package/dist/esm/chunk-PZ5JKQSP.mjs.map +0 -1
- package/dist/esm/chunk-Q3R3KKKP.mjs +0 -2
- package/dist/esm/chunk-Q3R3KKKP.mjs.map +0 -1
- package/dist/esm/chunk-TNUGIBLO.mjs +0 -2
- package/dist/esm/chunk-TNUGIBLO.mjs.map +0 -1
- package/dist/esm/chunk-TTICPGX6.mjs +0 -2
- package/dist/esm/chunk-TTICPGX6.mjs.map +0 -1
- package/dist/esm/chunk-UES76WF2.mjs +0 -2
- package/dist/esm/chunk-UES76WF2.mjs.map +0 -1
- package/dist/esm/chunk-W44E6YAW.mjs +0 -2
- package/dist/esm/chunk-W44E6YAW.mjs.map +0 -1
- package/dist/esm/chunk-W4JEP5GW.mjs +0 -2
- package/dist/esm/chunk-WXISFVRU.mjs +0 -2
- package/dist/esm/chunk-WXISFVRU.mjs.map +0 -1
- package/dist/esm/chunk-XKINEFAA.mjs.map +0 -1
- package/src/api/transactionSubmission.ts +0 -121
- /package/dist/esm/api/{transactionSubmission.mjs.map → transactionSubmission/helpers.mjs.map} +0 -0
- /package/dist/esm/{chunk-NMFS5KAE.mjs.map → chunk-3R3RC6HA.mjs.map} +0 -0
- /package/dist/esm/{chunk-KVJ2KGMW.mjs.map → chunk-3TCHSIX5.mjs.map} +0 -0
- /package/dist/esm/{chunk-UR5E2UDO.mjs.map → chunk-47UUK4Y5.mjs.map} +0 -0
- /package/dist/esm/{chunk-3RMXGSHK.mjs.map → chunk-4DI53MOX.mjs.map} +0 -0
- /package/dist/esm/{chunk-6DYNAFAP.mjs.map → chunk-4SUSQ6FW.mjs.map} +0 -0
- /package/dist/esm/{chunk-IU5JZNH4.mjs.map → chunk-6GSEQAP3.mjs.map} +0 -0
- /package/dist/esm/{chunk-BDTDWLGO.mjs.map → chunk-7QI27CQO.mjs.map} +0 -0
- /package/dist/esm/{chunk-5HZKDT5C.mjs.map → chunk-7SMTJUHH.mjs.map} +0 -0
- /package/dist/esm/{chunk-GQI3HWOB.mjs.map → chunk-7YT7GFC2.mjs.map} +0 -0
- /package/dist/esm/{chunk-5SRMD5C6.mjs.map → chunk-B5DL5P23.mjs.map} +0 -0
- /package/dist/esm/{chunk-OXO3Z2MF.mjs.map → chunk-BCTD22UJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-7QJYTQSU.mjs.map → chunk-D3U253BW.mjs.map} +0 -0
- /package/dist/esm/{chunk-OWP2MKTX.mjs.map → chunk-EZGQODGD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZWH2ESXT.mjs.map → chunk-FVA2OPG4.mjs.map} +0 -0
- /package/dist/esm/{chunk-FGTQT7Q5.mjs.map → chunk-GTZAXATL.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3Y52GHM.mjs.map → chunk-HXJHVTIU.mjs.map} +0 -0
- /package/dist/esm/{chunk-F52GIFKT.mjs.map → chunk-I62T5OCN.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZKFDLJ2F.mjs.map → chunk-I77JNEEH.mjs.map} +0 -0
- /package/dist/esm/{chunk-6F4ACCCZ.mjs.map → chunk-I7EF66RZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-PANYJULW.mjs.map → chunk-IA2CIVWP.mjs.map} +0 -0
- /package/dist/esm/{chunk-NLONZHYT.mjs.map → chunk-J733CDF2.mjs.map} +0 -0
- /package/dist/esm/{chunk-KR5JAN32.mjs.map → chunk-JXVSO6IA.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5RQOXZH.mjs.map → chunk-K2LNHGV5.mjs.map} +0 -0
- /package/dist/esm/{chunk-EHJEK7FU.mjs.map → chunk-KBWYFDSS.mjs.map} +0 -0
- /package/dist/esm/{chunk-VMCFN5CT.mjs.map → chunk-NANOXAUV.mjs.map} +0 -0
- /package/dist/esm/{chunk-NFGAZSSK.mjs.map → chunk-NHB2SPSA.mjs.map} +0 -0
- /package/dist/esm/{chunk-PRKZ2KJ4.mjs.map → chunk-NRGN7EFM.mjs.map} +0 -0
- /package/dist/esm/{chunk-7B3VSBCX.mjs.map → chunk-O7HXE2B5.mjs.map} +0 -0
- /package/dist/esm/{chunk-HQ4DGB7L.mjs.map → chunk-QJPQWNVJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-RCYWJZR4.mjs.map → chunk-RFYP3V47.mjs.map} +0 -0
- /package/dist/esm/{chunk-N25GOEVL.mjs.map → chunk-SS7YTDGF.mjs.map} +0 -0
- /package/dist/esm/{chunk-DBJTMCAG.mjs.map → chunk-UVAYKM6H.mjs.map} +0 -0
- /package/dist/esm/{chunk-3QS3MFWJ.mjs.map → chunk-VJ3ZN43A.mjs.map} +0 -0
- /package/dist/esm/{chunk-CBAVJ5EN.mjs.map → chunk-XE5NXBGH.mjs.map} +0 -0
- /package/dist/esm/{chunk-F2GFSFPW.mjs.map → chunk-XWWW2V74.mjs.map} +0 -0
- /package/dist/esm/{chunk-4K252UDE.mjs.map → chunk-ZTNSWIML.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-4SUSQ6FW.mjs";import"../../chunk-XWWW2V74.mjs";import"../../chunk-6GSEQAP3.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-DNDWTM7A.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as EntryFunctionBytes};
|
|
2
2
|
//# sourceMappingURL=entryFunctionBytes.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-XWWW2V74.mjs";import"../../chunk-6GSEQAP3.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-DNDWTM7A.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as FixedBytes};
|
|
2
2
|
//# sourceMappingURL=fixedBytes.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../../chunk-NANOXAUV.mjs";import"../../chunk-6GSEQAP3.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-DNDWTM7A.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-ALFESCPU.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as Bool,f as U128,c as U16,g as U256,d as U32,e as U64,b as U8};
|
|
2
2
|
//# sourceMappingURL=movePrimitives.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"../../chunk-
|
|
1
|
+
import{a,b,c}from"../../chunk-O7HXE2B5.mjs";import"../../chunk-NANOXAUV.mjs";import"../../chunk-6GSEQAP3.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-DNDWTM7A.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-ALFESCPU.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FVA2OPG4.mjs";export{c as MoveOption,b as MoveString,a as MoveVector};
|
|
2
2
|
//# sourceMappingURL=moveStructs.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-6GSEQAP3.mjs";import"../chunk-NL72WE3E.mjs";import"../chunk-DNDWTM7A.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-FVA2OPG4.mjs";export{a as Serializable,b as Serializer,c as ensureBoolean,d as outOfRangeErrorMessage,e as validateNumberInRange};
|
|
2
2
|
//# sourceMappingURL=serializer.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-EZGQODGD.mjs";import{a as y}from"./chunk-KBWYFDSS.mjs";import{b as l}from"./chunk-NL72WE3E.mjs";var p=class h extends y{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater then 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);let i=[];t.forEach(s=>{s instanceof o?i.push(s):i.push(new o(s))}),this.publicKeys=i,this.signaturesRequired=r}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),s=new Set;return t.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(s.has(n))throw new Error(`Duplicate bit ${n} detected.`);s.add(n);let a=Math.floor(n/8),c=i[a];c|=r>>n%8,i[a]=c}),i}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(o),r=e.deserializeU8();return new h({publicKeys:t,signaturesRequired:r})}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3R3RC6HA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as i}from"./chunk-RFYP3V47.mjs";import{c as e}from"./chunk-7SMTJUHH.mjs";import{c as a}from"./chunk-KBWYFDSS.mjs";var s=class t extends a{constructor(r){super();this.signature=r}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(r){if(this.signature instanceof e)r.serializeU32AsUleb128(0),this.signature.serialize(r);else if(this.signature instanceof i)r.serializeU32AsUleb128(1),this.signature.serialize(r);else throw new Error("Unknown signature type")}static deserialize(r){let n=r.deserializeUleb128AsU32();switch(n){case 0:return new t(e.load(r));case 1:return new t(i.load(r));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3TCHSIX5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-6GSEQAP3.mjs";import{a as i}from"./chunk-FBPNHF54.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var h=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s))(h||{}),r=class r extends a{constructor(t){super();if(t.length!==r.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=o(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return o(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let e=this.bcsToBytes();t.serializeBytes(e)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r(e)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let e=r.fromString(t);if(t.length!==r.LONG_STRING_LENGTH+2)if(e.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return e}static fromString(t){let e=t;if(t.startsWith("0x")&&(e=t.slice(2)),e.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(e.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=l(e.padStart(64,"0"))}catch(d){throw new i(`Hex characters are invalid: ${d?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromString(t)}static fromStrict(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromStringStrict(t)}static isValid(t){try{return t.strict?r.fromStrict(t.input):r.from(t.input),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};r.LENGTH=32,r.LONG_STRING_LENGTH=64,r.ZERO=r.from("0x0"),r.ONE=r.from("0x1"),r.TWO=r.from("0x2"),r.THREE=r.from("0x3"),r.FOUR=r.from("0x4");var c=r;export{h as a,c as b};
|
|
2
|
+
//# sourceMappingURL=chunk-47UUK4Y5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as n}from"./chunk-HHJBCGAQ.mjs";import{a as r,b as t,c as o}from"./chunk-LV33NV4J.mjs";import l from"@aptos-labs/aptos-client";var i=class{constructor(e){this.network=e?.network??n,this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.indexer=e?.indexer,this.client=e?.client??{provider:l},this.clientConfig=e?.clientConfig??{}}getRequestUrl(e){switch(e){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return t[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return o[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return r[this.network];default:throw Error(`apiType ${e} is not supported`)}}isIndexerRequest(e){return r[this.network]===e}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4DI53MOX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-XWWW2V74.mjs";import{a as r}from"./chunk-6GSEQAP3.mjs";var t=class l extends r{constructor(e){super();this.value=new i(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,s){let a=i.deserialize(e,s);return new l(a.value)}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4SUSQ6FW.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-GSBXTPCS.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4TMEKWN2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submit a simple transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submit a multi agent transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.additionalSignersAuthenticators An array of the secondary signers account authenticators\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAYO,IAAMA,EAAN,KAAa,CAGlB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAYA,MAAM,OAAOC,EAI2B,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CAaA,MAAM,WAAWA,EAKuB,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CACF,EA3BQE,EAAA,CADLC,GAhBUL,EAiBL,sBAmBAI,EAAA,CADLC,GAnCUL,EAoCL","names":["Submit","config","args","submitTransaction","__decorateClass","ValidateFeePayerDataOnSubmission"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function o(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,t)},e}function u(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,t)},e}export{o as a,u as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6EMN3BOV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/transactionSubmission/helpers.ts"],"sourcesContent":["export function ValidateFeePayerDataOnSubmission(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerAuthenticator) {\n throw new Error(\"You are submitting a Fee Payer transaction but missing the feePayerAuthenticator\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n\nexport function ValidateFeePayerDataOnSimulation(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerPublicKey) {\n throw new Error(\"You are simulating a Fee Payer transaction but missing the feePayerPublicKey\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n"],"mappings":"AAAO,SAASA,EAAiCC,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,sBACxD,MAAM,IAAI,MAAM,kFAAkF,EAGpG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT,CAEO,SAASI,EAAiCN,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,kBACxD,MAAM,IAAI,MAAM,8EAA8E,EAGhG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT","names":["ValidateFeePayerDataOnSubmission","target","propertyKey","descriptor","originalMethod","args","methodArgs","ValidateFeePayerDataOnSimulation"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as c}from"./chunk-NL72WE3E.mjs";import{a as U,b,c as f,d as u,e as h,f as y}from"./chunk-DNDWTM7A.mjs";import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as c}from"./chunk-NL72WE3E.mjs";import{a as U,b,c as f,d as u,e as h,f as y}from"./chunk-DNDWTM7A.mjs";import{a as s}from"./chunk-FVA2OPG4.mjs";var B=class{bcsToBytes(){let e=new n;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return c.fromHexInput(e)}},n=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,i){this.ensureBufferWillHandleSize(t);let a=new DataView(this.buffer,this.offset);e.apply(a,[0,i,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){A(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(f),i=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(i))}serializeU128(e){let t=BigInt(e)&u,i=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(i)}serializeU256(e){let t=BigInt(e)&h,i=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(i)}serializeU32AsUleb128(e){let t=e,i=[];for(;t>>>7;)i.push(t&127|128),t>>>=7;i.push(t),this.appendToBuffer(new Uint8Array(i))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}};s([o(0,U)],n.prototype,"serializeU8",1),s([o(0,b)],n.prototype,"serializeU16",1),s([o(0,f)],n.prototype,"serializeU32",1),s([o(BigInt(0),u)],n.prototype,"serializeU64",1),s([o(BigInt(0),h)],n.prototype,"serializeU128",1),s([o(BigInt(0),y)],n.prototype,"serializeU256",1),s([o(0,f)],n.prototype,"serializeU32AsUleb128",1);function A(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var g=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function w(r,e,t){let i=BigInt(r);if(i>BigInt(t)||i<BigInt(e))throw new Error(g(r,e,t))}function o(r,e){return(t,i,a)=>{let p=a.value;return a.value=function(l){return w(l,r,e),p.apply(this,[l])},a}}export{B as a,n as b,A as c,g as d,w as e};
|
|
2
|
+
//# sourceMappingURL=chunk-6GSEQAP3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as s,c as t,d as r,e as n,f as i,g as a,i as g,j as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as s,c as t,d as r,e as n,f as i,g as a,i as g,j as c}from"./chunk-KEOLTOML.mjs";var u=class{constructor(e){this.config=e}async getLedgerInfo(){return o({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return s({aptosConfig:this.config,...e})}async getBlockByHeight(e){return t({aptosConfig:this.config,...e})}async getTableItem(e){return r({aptosConfig:this.config,...e})}async view(e){return n({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return i({aptosConfig:this.config,...e})}async queryIndexer(e){return a({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return g({aptosConfig:this.config})}async getProcessorStatus(e){return c({aptosConfig:this.config,processorType:e})}};export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6P75FCI4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getBlockByHeight,\n getBlockByVersion,\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n getTableItem,\n queryIndexer,\n view,\n} from \"../internal/general\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n TableItemRequest,\n InputViewRequestData,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\n\n/**\n * A class to query all `General` Aptos related queries\n */\nexport class General {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger info\n *\n * @returns Aptos Ledger Info\n *\n * @example An example of the returned data\n * ```\n * {\n * \"chain_id\": 4,\n * \"epoch\": \"8\",\n * \"ledger_version\": \"714\",\n * \"oldest_ledger_version\": \"0\",\n * \"ledger_timestamp\": \"1694695496521775\",\n * \"node_role\": \"validator\",\n * \"oldest_block_height\": \"0\",\n * \"block_height\": \"359\",\n * \"git_hash\": \"c82193f36f4e185fed9f68c4ad21f6c6dd390c6e\"\n * }\n * ```\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Queries for the chain id\n *\n * @returns The chain id\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Queries for block by transaction version\n *\n * @param args.ledgerVersion Ledger version to lookup block information for\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block information with optional transactions\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Get block by block height\n *\n * @param args.blockHeight Block height to lookup. Starts at 0\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block with optional transactions\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a table item for a table identified by the handle and the key for the item.\n * Key and value types need to be passed in to help with key serialization and value deserialization.\n * @param args.handle A pointer to where that table is stored\n * @param args.data Object that describes table item\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example https://fullnode.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E\n * {\n * data.key_type = \"address\" // Move type of table key\n * data.value_type = \"u128\" // Move type of table value\n * data.key = \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * }\n *\n * @returns Table item value rendered in JSON\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @example\n * `\n * const payload: ViewRequest = {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * };\n * `\n *\n * @returns an array of Move values\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewRequestData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries top user transactions\n *\n * @param args.limit The number of transactions to return\n * @returns GetChainTopUserTransactionsResponse\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * A generic function for retrieving data from Aptos Indexer.\n * For more detailed queries specification see\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql}\n *\n * @param args.query.query A GraphQL query\n * @param args.query.variables The variables for the query\n * @example\n * ```\n * {\n * query: `query MyQuery {\n ledger_infos {\n chain_id\n }\n }`;\n * }\n * ```\n *\n * @return The provided T type\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version\n *\n * This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.\n */\n async getIndexerLastSuccessVersion(): Promise<
|
|
1
|
+
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getBlockByHeight,\n getBlockByVersion,\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n getTableItem,\n queryIndexer,\n view,\n} from \"../internal/general\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n TableItemRequest,\n InputViewRequestData,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\n\n/**\n * A class to query all `General` Aptos related queries\n */\nexport class General {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger info\n *\n * @returns Aptos Ledger Info\n *\n * @example An example of the returned data\n * ```\n * {\n * \"chain_id\": 4,\n * \"epoch\": \"8\",\n * \"ledger_version\": \"714\",\n * \"oldest_ledger_version\": \"0\",\n * \"ledger_timestamp\": \"1694695496521775\",\n * \"node_role\": \"validator\",\n * \"oldest_block_height\": \"0\",\n * \"block_height\": \"359\",\n * \"git_hash\": \"c82193f36f4e185fed9f68c4ad21f6c6dd390c6e\"\n * }\n * ```\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Queries for the chain id\n *\n * @returns The chain id\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Queries for block by transaction version\n *\n * @param args.ledgerVersion Ledger version to lookup block information for\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block information with optional transactions\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Get block by block height\n *\n * @param args.blockHeight Block height to lookup. Starts at 0\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block with optional transactions\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a table item for a table identified by the handle and the key for the item.\n * Key and value types need to be passed in to help with key serialization and value deserialization.\n * @param args.handle A pointer to where that table is stored\n * @param args.data Object that describes table item\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example https://fullnode.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E\n * {\n * data.key_type = \"address\" // Move type of table key\n * data.value_type = \"u128\" // Move type of table value\n * data.key = \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * }\n *\n * @returns Table item value rendered in JSON\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @example\n * `\n * const payload: ViewRequest = {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * };\n * `\n *\n * @returns an array of Move values\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewRequestData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries top user transactions\n *\n * @param args.limit The number of transactions to return\n * @returns GetChainTopUserTransactionsResponse\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * A generic function for retrieving data from Aptos Indexer.\n * For more detailed queries specification see\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql}\n *\n * @param args.query.query A GraphQL query\n * @param args.query.variables The variables for the query\n * @example\n * ```\n * {\n * query: `query MyQuery {\n ledger_infos {\n chain_id\n }\n }`;\n * }\n * ```\n *\n * @return The provided T type\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version\n *\n * This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.\n */\n async getIndexerLastSuccessVersion(): Promise<bigint> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n\n /**\n * Query the processor status for a specific processor type.\n *\n * @param processorType The processor type to query\n * @returns\n */\n async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {\n return getProcessorStatus({ aptosConfig: this.config, processorType });\n }\n}\n"],"mappings":"iGAgCO,IAAMA,EAAN,KAAc,CAGnB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAsBA,MAAM,eAAqC,CACzC,OAAOC,EAAc,CAAE,YAAa,KAAK,MAAO,CAAC,CACnD,CAOA,MAAM,YAA8B,CAElC,OADe,MAAM,KAAK,cAAc,GAC1B,QAChB,CAUA,MAAM,kBAAkBC,EAGL,CACjB,OAAOC,EAAkB,CACvB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CAUA,MAAM,iBAAiBA,EAA4F,CACjH,OAAOE,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC/D,CAkBA,MAAM,aAAgBA,EAA0F,CAC9G,OAAOG,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC9D,CAiBA,MAAM,KAAiCA,EAGxB,CACb,OAAOI,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACtD,CAQA,MAAM,4BAA4BA,EAAuE,CACvG,OAAOK,EAA4B,CACjC,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAsBA,MAAM,aAA2BA,EAA2C,CAC1E,OAAOM,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGN,CACL,CAAC,CACH,CAOA,MAAM,8BAAgD,CACpD,OAAOO,EAA6B,CAAE,YAAa,KAAK,MAAO,CAAC,CAClE,CAQA,MAAM,mBAAmBC,EAAsE,CAC7F,OAAOC,EAAmB,CAAE,YAAa,KAAK,OAAQ,cAAAD,CAAc,CAAC,CACvE,CACF","names":["General","config","getLedgerInfo","args","getBlockByVersion","getBlockByHeight","getTableItem","view","getChainTopUserTransactions","queryIndexer","getIndexerLastSuccessVersion","processorType","getProcessorStatus"]}
|
|
@@ -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.2.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-K2LNHGV5.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7QI27CQO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as E,f as H,g as K,h as P,i as S,j as f}from"./chunk-LR65XHSF.mjs";import{a as h,b as p,c as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as E,f as H,g as K,h as P,i as S,j as f}from"./chunk-LR65XHSF.mjs";import{a as h,b as p,c as m}from"./chunk-KBWYFDSS.mjs";import{b as s}from"./chunk-NL72WE3E.mjs";import o from"tweetnacl";var i=class i extends h{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==i.LENGTH)throw new Error(`PublicKey length should be ${i.LENGTH}`);this.key=t}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:t,signature:a}=e,y=s.fromHexInput(t).toUint8Array(),c=a.toUint8Array();return o.sign.detached.verify(y,c,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static load(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}};i.LENGTH=32;var l=i,r=class r extends p{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKeyPair=o.sign.keyPair.fromSeed(t.toUint8Array().slice(0,r.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,r.LENGTH)}toString(){return s.fromHexInput(this.toUint8Array()).toString()}sign(e){let t=s.fromHexInput(e),a=o.sign.detached(t.toUint8Array(),this.signingKeyPair.secretKey);return new d(a)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static generate(){let e=o.sign.keyPair();return new r(e.secretKey.slice(0,r.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new l(e)}static fromDerivationPath(e,t){if(!H(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,f(t))}static fromDerivationPathInner(e,t,a=E){let{key:y,chainCode:c}=K(r.SLIP_0010_SEED,t),x=S(e).map(u=>parseInt(u,10)),{key:z}=x.reduce((u,A)=>P(u,A+a),{key:y,chainCode:c});return new r(z)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";var v=r,n=class n extends m{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`Signature length should be ${n.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static load(e){let t=e.deserializeBytes();return new n(t)}static isSignature(e){return e instanceof n}};n.LENGTH=64;var d=n;export{l as a,v as b,d as c};
|
|
2
|
+
//# sourceMappingURL=chunk-7SMTJUHH.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as d}from"./chunk-6FBKUTGF.mjs";import{a as R}from"./chunk-6ZC3SZE6.mjs";var p={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(n,a){let{url:o,method:u,body:i,contentType:s,params:e,overrides:t}=n,r={...t?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":s??"application/json"};return t?.AUTH_TOKEN&&o.includes("faucet")&&(r.Authorization=`Bearer ${t?.AUTH_TOKEN}`),t?.API_KEY&&!o.includes("faucet")&&(r.Authorization=`Bearer ${t?.API_KEY}`),a.provider({url:o,method:u,body:i,params:e,headers:r,overrides:t})}async function T(n,a){let{url:o,path:u}=n,i=`${o}/${u??""}`,s=await c({...n,url:i},a.client),e={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:i};if(a.isIndexerRequest(o)){let r=e.data;if(r.errors)throw new d(n,e,r.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;let t;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?t=JSON.stringify(e.data):e.status in p?t=p[e.status]:t=`Unhandled Error ${e.status} : ${e.statusText}`,new d(n,e,t)}export{c as a,T as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7YRPYQ7C.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AptosRequest, MimeType, ClientRequest, ClientResponse, Client, AnyNumber } from \"../types\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n };\n\n // TODO - auth token is being used only for faucet, it breaks full node requests.\n // Find a more sophisticated way than that but without the need to add the\n // auth_token on every `aptos.fundAccount()` call\n if (overrides?.AUTH_TOKEN && url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY && !url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = `${url}/${path ?? \"\"}`;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (aptosConfig.isIndexerRequest(url)) {\n const indexerResponse = result.data as any;\n // errors from indexer\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n indexerResponse.errors[0].message ?? `Unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n }\n\n if (result.status >= 200 && result.status < 300) {\n return result;\n }\n\n let errorMessage: string;\n\n if (result && result.data && \"message\" in result.data && \"error_code\" in result.data) {\n errorMessage = JSON.stringify(result.data);\n } else if (result.status in errors) {\n // If it's not an API type, it must come form infra, these are prehandled\n errorMessage = errors[result.status];\n } else {\n // Everything else is unhandled\n errorMessage = `Unhandled Error ${result.status} : ${result.statusText}`;\n }\n\n throw new AptosApiError(options, result, errorMessage);\n}\n"],"mappings":"kFAWA,IAAMA,EAAiC,CACrC,IAAK,cACL,IAAK,eACL,IAAK,YACL,IAAK,YACL,IAAK,oBACL,IAAK,wBACL,IAAK,cACL,IAAK,qBACP,EAMA,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,GAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,CAAU,EAAIP,EACxDQ,EAAoE,CACxE,GAAGD,GAAW,QACd,iBAAkB,wBAAwBE,CAAO,GACjD,eAAgBJ,qBAClB,EAKA,OAAIE,GAAW,YAAcL,EAAI,SAAS,QAAQ,IAChDM,EAAQ,cAAgB,UAAUD,GAAW,UAAU,IAErDA,GAAW,SAAW,CAACL,EAAI,SAAS,QAAQ,IAC9CM,EAAQ,cAAgB,UAAUD,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAE,EACA,UAAAD,CACF,CAAC,CACH,CASA,eAAsBG,EACpBV,EACAW,EACkC,CAClC,GAAM,CAAE,IAAAT,EAAK,KAAAU,CAAK,EAAIZ,EAChBa,EAAU,GAAGX,CAAG,IAAIU,GAAQ,EAAE,GAC9BE,EAAW,MAAMf,EAAkB,CAAE,GAAGC,EAAS,IAAKa,CAAQ,EAAGF,EAAY,MAAM,EAEnFI,EAAkC,CACtC,OAAQD,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMA,EAAS,KACf,QAASA,EAAS,QAClB,OAAQA,EAAS,OACjB,QAASA,EAAS,QAClB,IAAKD,CACP,EAIA,GAAIF,EAAY,iBAAiBT,CAAG,EAAG,CACrC,IAAMc,EAAkBD,EAAO,KAE/B,GAAIC,EAAgB,OAClB,MAAM,IAAIC,EACRjB,EACAe,EACAC,EAAgB,OAAO,CAAC,EAAE,SAAW,mBAAmBF,EAAS,MAAM,MAAMA,EAAS,UAAU,EAClG,EAEFC,EAAO,KAAOC,EAAgB,IAChC,CAEA,GAAID,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAOA,EAGT,IAAIG,EAEJ,MAAIH,GAAUA,EAAO,MAAQ,YAAaA,EAAO,MAAQ,eAAgBA,EAAO,KAC9EG,EAAe,KAAK,UAAUH,EAAO,IAAI,EAChCA,EAAO,UAAUjB,EAE1BoB,EAAepB,EAAOiB,EAAO,MAAM,EAGnCG,EAAe,mBAAmBH,EAAO,MAAM,MAAMA,EAAO,UAAU,GAGlE,IAAIE,EAAcjB,EAASe,EAAQG,CAAY,CACvD","names":["errors","request","options","client","url","method","body","contentType","params","overrides","headers","VERSION","aptosRequest","aptosConfig","path","fullUrl","response","result","indexerResponse","AptosApiError","errorMessage"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-I7EF66RZ.mjs";import{a as g,b as _}from"./chunk-ZTNSWIML.mjs";import{a as p,c as b}from"./chunk-7SMTJUHH.mjs";import{b as o}from"./chunk-47UUK4Y5.mjs";import{a as h}from"./chunk-6GSEQAP3.mjs";var c=class extends h{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return A.load(t);case 4:return y.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},d=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=p.deserialize(e),s=b.deserialize(e);return new i(r,s)}},u=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=g.deserialize(e),s=_.deserialize(e);return new i(r,s)}},l=class i extends c{constructor(e,r,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n);return new i(r,s,a)}},A=class i extends c{constructor(e,r,s,a){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s,this.fee_payer=a}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n),z=o.deserialize(e),S=n.deserialize(e),E={address:z,authenticator:S};return new i(r,s,a,E)}},y=class i extends c{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=n.deserialize(e);return new i(r)}};export{c as a,d as b,u as c,l as d,A as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-7YT7GFC2.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A}from"./chunk-ZOFYHCU4.mjs";import{a as T}from"./chunk-JJDQALR6.mjs";import{a as d}from"./chunk-ULKNPUPO.mjs";import{a as h}from"./chunk-4TMEKWN2.mjs";import{d as p,e as a,h as m,i as f,j as y}from"./chunk-GSBXTPCS.mjs";import{a as s,b as r,c as e,d as c,e as u,f as g}from"./chunk-DV6TMIRK.mjs";var P=class{constructor(n){this.config=n,this.build=new T(this.config),this.simulate=new d(this.config),this.submit=new h(this.config)}async getTransactions(n){return s({aptosConfig:this.config,...n})}async getTransactionByVersion(n){return e({aptosConfig:this.config,...n})}async getTransactionByHash(n){return c({aptosConfig:this.config,...n})}async isPendingTransaction(n){return u({aptosConfig:this.config,...n})}async waitForTransaction(n){return g({aptosConfig:this.config,...n})}async getGasPriceEstimation(){return r({aptosConfig:this.config})}getSigningMessage(n){return p(n)}async publishPackageTransaction(n){return f({aptosConfig:this.config,...n})}async rotateAuthKey(n){return y({aptosConfig:this.config,...n})}sign(n){return a({...n})}signAsFeePayer(n){let{signer:t,transaction:o}=n;if(!o.feePayerAddress)throw new Error(`Transaction ${o} is not a Fee Payer transaction`);return o.feePayerAddress=t.accountAddress,a({signer:t,transaction:o})}async batchTransactionsForSingleAccount(n){try{let{sender:t,data:o,options:l}=n,i=new A(this.config,t);i.start();for(let w of o)await i.push(w,l)}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(n){let{signer:t,transaction:o}=n;return m({aptosConfig:this.config,signer:t,transaction:o})}};export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AEGZ42XG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n CommittedTransactionResponse,\n GasEstimation,\n HexInput,\n PaginationArgs,\n PendingTransactionResponse,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\nimport {\n getSigningMessage,\n publicPackageTransaction,\n rotateAuthKey,\n signAndSubmitTransaction,\n signTransaction,\n} from \"../internal/transactionSubmission\";\nimport {\n AccountAuthenticator,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadData,\n SimpleTransaction,\n} from \"../transactions\";\nimport { AccountAddressInput, Account, PrivateKey } from \"../core\";\nimport { TransactionWorker } from \"../transactions/management\";\nimport { Build } from \"./transactionSubmission/build\";\nimport { Simulate } from \"./transactionSubmission/simulate\";\nimport { Submit } from \"./transactionSubmission/submit\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n readonly build: Build;\n\n readonly simulate: Simulate;\n\n readonly submit: Submit;\n\n constructor(config: AptosConfig) {\n this.config = config;\n this.build = new Build(this.config);\n this.simulate = new Simulate(this.config);\n this.submit = new Submit(this.config);\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<CommittedTransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://fullnode.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n * @example\n * ```\n * {\n * gas_estimate: number;\n * deprioritized_gas_estimate?: number;\n * prioritized_gas_estimate?: number;\n * }\n * ```\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n\n /**\n * Returns a signing message for a transaction.\n *\n * This allows a user to sign a transaction using their own preferred signing method, and\n * then submit it to the network.\n * @param args.transaction A raw transaction for signing elsewhere\n */\n // eslint-disable-next-line class-methods-use-this\n getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n return getSigningMessage(args);\n }\n\n /**\n * Generates a transaction to publish a move package to chain.\n *\n * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command\n * `aptos move compile --save-metadata ...`,\n * For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}\n *\n * @param args.account The publisher account\n * @param args.metadataBytes The package metadata bytes\n * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async publishPackageTransaction(args: {\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return publicPackageTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for\n * the account.\n * Note: Only legacy Ed25519 scheme is supported for now.\n * More info: {@link https://aptos.dev/guides/account-management/key-rotation/}\n * @param args.fromAccount The account to rotate the auth key for\n * @param args.toNewPrivateKey The new private key to rotate to\n *\n * @returns PendingTransactionResponse\n */\n async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {\n return rotateAuthKey({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n return signTransaction({\n ...args,\n });\n }\n\n /**\n * Sign a transaction as a fee payer that can later be submitted to chain\n *\n * @param args.signer The fee payer signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesnt hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n }\n\n // TRANSACTION SUBMISSION //\n\n /**\n * Batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n async batchTransactionsForSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): Promise<void> {\n try {\n const { sender, data, options } = args;\n const transactionWorker = new TransactionWorker(this.config, sender);\n\n transactionWorker.start();\n\n for (const d of data) {\n /* eslint-disable no-await-in-loop */\n await transactionWorker.push(d, options);\n }\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n\n /**\n * Sign and submit a single signer transaction to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n *\n * @return PendingTransactionResponse\n */\n async signAndSubmitTransaction(args: {\n signer: Account;\n transaction: AnyRawTransaction;\n }): Promise<PendingTransactionResponse> {\n const { signer, transaction } = args;\n return signAndSubmitTransaction({\n aptosConfig: this.config,\n signer,\n transaction,\n });\n }\n}\n"],"mappings":"qTA0CO,IAAMA,EAAN,KAAkB,CASvB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,EACd,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,SAAW,IAAIC,EAAS,KAAK,MAAM,EACxC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,CACtC,CAWA,MAAM,gBAAgBC,EAAqE,CACzF,OAAOC,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CASA,MAAM,wBAAwBA,EAAkE,CAC9F,OAAOE,EAAwB,CAC7B,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CAOA,MAAM,qBAAqBA,EAAmE,CAC5F,OAAOG,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGH,CACL,CAAC,CACH,CAcA,MAAM,qBAAqBA,EAAuD,CAChF,OAAOI,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAwBA,MAAM,mBAAmBA,EAGiB,CACxC,OAAOK,EAAmB,CACxB,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAiBA,MAAM,uBAAgD,CACpD,OAAOM,EAAsB,CAC3B,YAAa,KAAK,MACpB,CAAC,CACH,CAUA,kBAAkBN,EAAsD,CACtE,OAAOO,EAAkBP,CAAI,CAC/B,CAeA,MAAM,0BAA0BA,EAKD,CAC7B,OAAOQ,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGR,CAAK,CAAC,CACvE,CAYA,MAAM,cAAcA,EAA2F,CAC7G,OAAOS,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGT,CAAK,CAAC,CAC5D,CAWA,KAAKA,EAAiF,CACpF,OAAOU,EAAgB,CACrB,GAAGV,CACL,CAAC,CACH,CAWA,eAAeA,EAAiF,CAC9F,GAAM,CAAE,OAAAW,EAAQ,YAAAC,CAAY,EAAIZ,EAIhC,GAAI,CAACY,EAAY,gBACf,MAAM,IAAI,MAAM,eAAeA,CAAW,iCAAiC,EAI7E,OAAAA,EAAY,gBAAkBD,EAAO,eAE9BD,EAAgB,CACrB,OAAAC,EACA,YAAAC,CACF,CAAC,CACH,CAoBA,MAAM,kCAAkCZ,EAItB,CAChB,GAAI,CACF,GAAM,CAAE,OAAAa,EAAQ,KAAAC,EAAM,QAAAC,CAAQ,EAAIf,EAC5BgB,EAAoB,IAAIC,EAAkB,KAAK,OAAQJ,CAAM,EAEnEG,EAAkB,MAAM,EAExB,QAAWE,KAAKJ,EAEd,MAAME,EAAkB,KAAKE,EAAGH,CAAO,CAE3C,OAASI,EAAY,CACnB,MAAM,IAAI,MAAM,6CAA6CA,CAAK,EAAE,CACtE,CACF,CAiBA,MAAM,yBAAyBnB,EAGS,CACtC,GAAM,CAAE,OAAAW,EAAQ,YAAAC,CAAY,EAAIZ,EAChC,OAAOoB,EAAyB,CAC9B,YAAa,KAAK,OAClB,OAAAT,EACA,YAAAC,CACF,CAAC,CACH,CACF","names":["Transaction","config","Build","Simulate","Submit","args","getTransactions","getTransactionByVersion","getTransactionByHash","isTransactionPending","waitForTransaction","getGasPriceEstimation","getSigningMessage","publicPackageTransaction","rotateAuthKey","signTransaction","signer","transaction","sender","data","options","transactionWorker","TransactionWorker","d","error","signAndSubmitTransaction"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-EX2EBRNH.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AWEUIMRQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/coin.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, AccountAddressInput } from \"../core\";\nimport { transferCoinTransaction } from \"../internal/coin\";\nimport { SimpleTransaction, InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to handle all `Coin` operations\n */\nexport class Coin {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Generate a transfer coin transaction that can be simulated and/or signed and submitted\n *\n * @param args.sender The sender account\n * @param args.recipient The recipient address\n * @param args.amount The amount to transfer\n * @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin\n *\n * @returns SimpleTransaction\n */\n async transferCoinTransaction(args: {\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferCoinTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAYO,IAAMA,EAAN,KAAW,CAChB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAY3C,MAAM,wBAAwBC,EAMC,CAC7B,OAAOC,EAAwB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtE,CACF","names":["Coin","config","args","transferCoinTransaction"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-UVAYKM6H.mjs";import{g as t}from"./chunk-DV6TMIRK.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-B5DL5P23.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-7YT7GFC2.mjs";import{a as e}from"./chunk-VJ3ZN43A.mjs";import{a as r}from"./chunk-6GSEQAP3.mjs";var n=class o extends r{constructor(t,a){super();this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=e.deserialize(t),s=i.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BCTD22UJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as V,b as Y,c as Z}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as V,b as Y,c as Z}from"./chunk-UPQSJD25.mjs";import{q as F,t as M}from"./chunk-D3U253BW.mjs";import{a as u}from"./chunk-BCTD22UJ.mjs";import{b as E,d as _,e as R,f as B}from"./chunk-7YT7GFC2.mjs";import{b as f,d as y,e as O}from"./chunk-I7EF66RZ.mjs";import{a as l,c as g,d as m}from"./chunk-VJ3ZN43A.mjs";import{c as L,d as H,e as X,f as z,g as j,h as J,i as Q}from"./chunk-IA2CIVWP.mjs";import{a as q}from"./chunk-GTZAXATL.mjs";import{a as k}from"./chunk-K2LNHGV5.mjs";import{a as h}from"./chunk-3TCHSIX5.mjs";import{a as x}from"./chunk-EZGQODGD.mjs";import{a as C,c as N}from"./chunk-RFYP3V47.mjs";import{a as w,c as T}from"./chunk-7SMTJUHH.mjs";import{b as A}from"./chunk-47UUK4Y5.mjs";import{b as $}from"./chunk-NL72WE3E.mjs";import{b as v}from"./chunk-DV6TMIRK.mjs";import{a as K}from"./chunk-AH44UPM4.mjs";import{a as W}from"./chunk-KEOLTOML.mjs";import{c as D,d as U,g as G,h as b}from"./chunk-HHJBCGAQ.mjs";import{e as I}from"./chunk-LV33NV4J.mjs";import{sha3_256 as an}from"@noble/hashes/sha3";async function Un(n){if(F(n))return nn(n);let{moduleAddress:e,moduleName:t,functionName:o}=M(n.function),r=await K(async()=>Y(e,t,o,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${e}-${t}-${o}`,1e3*60*5)();return on(n,r)}function on(n,e){if(F(n))return nn(n);let{moduleAddress:t,moduleName:o,functionName:r}=M(n.function),a=V(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n.functionArguments.map((s,d)=>Z(n.function,e,s,d,a));if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);let c=z.build(`${t}::${o}`,r,a,i);if("multisigAddress"in n){let s=A.from(n.multisigAddress);return new X(new J(s,new Q(c)))}return new H(c)}function nn(n){return new L(new j($.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function sn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=r?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:r.accountSequenceNumber}):k({aptosConfig:e,accountAddress:t}),i=I[e.network]?Promise.resolve({chain_id:I[e.network]}):W({aptosConfig:e}),c=r?.gasUnitPrice?Promise.resolve({gas_estimate:r.gasUnitPrice}):v({aptosConfig:e}),[{sequence_number:s},{chain_id:d},{gas_estimate:p}]=await Promise.all([a,i,c]),{maxGasAmount:S,gasUnitPrice:en,expireTimestamp:rn}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(D),gasUnitPrice:BigInt(p),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+U),...r};return new l(A.from(t),BigInt(s),o,BigInt(S),BigInt(en),BigInt(rn),new q(d))}async function Gn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=await sn({aptosConfig:e,sender:t,payload:o,options:r});if("secondarySignerAddresses"in n){let i=n.secondarySignerAddresses?.map(c=>A.from(c))??[];return{rawTransaction:a,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}return{rawTransaction:a,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}function $n(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:o,feePayerPublicKey:r}=n,a=P(e);if(t.feePayerAddress){let c=new m(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];o&&(s=o.map(S=>P(S)));let d=P(r),p=new R(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new u(c.raw_txn,p).bcsToBytes()}if(t.secondarySignerAddresses){let c=new g(t.rawTransaction,t.secondarySignerAddresses),s=[];s=o.map(p=>P(p));let d=new _(a,t.secondarySignerAddresses,s);return new u(c.raw_txn,d).bcsToBytes()}let i;if(a instanceof f)i=new E(a.public_key,a.signature);else if(a instanceof y)i=new B(a);else throw new Error("Invalid public key");return new u(t.rawTransaction,i).bcsToBytes()}function P(n){if(n instanceof x){if(n.publicKey instanceof w)return new y(n,new h(new T(new Uint8Array(64))));if(n.publicKey instanceof C)return new y(n,new h(new N(new Uint8Array(64))))}return new f(new w(n.toUint8Array()),new T(new Uint8Array(64)))}function Cn(n){let{signer:e,transaction:t}=n,o=un(t),r=e.sign(o);switch(e.signingScheme){case 0:return new f(new w(e.publicKey.toUint8Array()),new T(r.toUint8Array()));case 2:if(!x.isPublicKey(e.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${e.signingScheme}`);return new y(e.publicKey,new h(r));default:throw new Error(`Cannot sign transaction, signing scheme ${e.signingScheme} not supported`)}}function Nn(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:o,additionalSignersAuthenticators:r}=n,a=tn(e);if((o||r)&&(a instanceof g||a instanceof m))return cn(a,t,o,r);if(t instanceof f&&a instanceof l){let i=new E(t.public_key,t.signature);return new u(a,i).bcsToBytes()}if((t instanceof y||t instanceof O)&&a instanceof l){let i=new B(t);return new u(a,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function tn(n){return n.feePayerAddress?new m(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new g(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function cn(n,e,t,o){if(n instanceof m){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let r=new R(e,n.secondary_signer_addresses,o??[],{address:n.fee_payer_address,authenticator:t});return new u(n.raw_txn,r).bcsToBytes()}if(n instanceof g){if(!o)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let r=new _(e,n.secondary_signer_addresses,o??[]);return new u(n.raw_txn,r).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function un(n){let e=tn(n),t=an.create();if(e instanceof l)t.update(G);else if(e instanceof g)t.update(b);else if(e instanceof m)t.update(b);else throw new Error(`Unknown transaction type to sign on: ${e}`);let o=t.digest(),r=e.bcsToBytes(),a=new Uint8Array(o.length+r.length);return a.set(o),a.set(r,o.length),a}export{Un as a,on as b,sn as c,Gn as d,$n as e,P as f,Cn as g,Nn as h,tn as i,cn as j,un as k};
|
|
2
|
+
//# sourceMappingURL=chunk-CFOIMAJF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport { Account } from \"../../core/account\";\nimport { AnyPublicKey } from \"../../core/crypto/anyPublicKey\";\nimport { AnySignature } from \"../../core/crypto/anySignature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"../../core/crypto/secp256k1\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport {\n DEFAULT_MAX_GAS_AMOUNT,\n DEFAULT_TXN_EXP_SEC_FROM_NOW,\n RAW_TRANSACTION_SALT,\n RAW_TRANSACTION_WITH_DATA_SALT,\n} from \"../../utils/const\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultisigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultisig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n AnyRawTransactionInstance,\n EntryFunctionArgumentTypes,\n EntryFunctionABI,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n SimpleTransaction,\n InputGenerateTransactionOptions,\n MultiAgentTransaction,\n InputScriptData,\n InputSimulateTransactionData,\n InputGenerateTransactionPayloadData,\n InputEntryFunctionData,\n InputMultiSigData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { SigningScheme } from \"../../types\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransactionPayload` function.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultisig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultisig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n const functionAbi = await memoizeAsync(\n async () => fetchEntryFunctionAbi(moduleAddress, moduleName, functionName, args.aptosConfig),\n `entry-function-${args.aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n\n return generateTransactionPayloadWithABI(args, functionAbi);\n}\n\nexport function generateTransactionPayloadWithABI(\n args: InputEntryFunctionData,\n functionAbi: EntryFunctionABI,\n): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(\n args: InputMultiSigData,\n functionAbi: EntryFunctionABI,\n): TransactionPayloadMultisig;\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadData,\n functionAbi: EntryFunctionABI,\n): AnyTransactionPayloadInstance {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultisig(\n new MultiSig(multisigAddress, new MultisigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(Hex.fromHexInput(args.bytecode).toUint8Array(), args.typeArguments ?? [], args.functionArguments),\n );\n}\n\n/**\n * Generates a raw transaction\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n *\n * @returns RawTransaction\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options } = args;\n\n const getSequenceNumber =\n options?.accountSequenceNumber !== undefined\n ? Promise.resolve({ sequence_number: options.accountSequenceNumber })\n : getInfo({ aptosConfig, accountAddress: sender });\n\n const getChainId = NetworkToChainId[aptosConfig.network]\n ? Promise.resolve({ chain_id: NetworkToChainId[aptosConfig.network] })\n : getLedgerInfo({ aptosConfig });\n\n const getGasUnitPrice = options?.gasUnitPrice\n ? Promise.resolve({ gas_estimate: options.gasUnitPrice })\n : getGasPriceEstimation({ aptosConfig });\n\n const [{ sequence_number: sequenceNumber }, { chain_id: chainId }, { gas_estimate: gasEstimate }] = await Promise.all(\n [getSequenceNumber, getChainId, getGasUnitPrice],\n );\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: BigInt(gasEstimate),\n expireTimestamp: BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n ...options,\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransaction` function.\n * When we call our `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return {\n rawTransaction: rawTxn,\n secondarySignerAddresses: signers,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n }\n // return the raw transaction\n return {\n rawTransaction: rawTxn,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n}\n\n/**\n * Simulate a transaction before signing and submit to chain\n *\n * @param args.transaction A aptos transaction type to sign\n * @param args.signerPublicKey The signer public key\n * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction\n * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction\n * @param args.options optional. SimulateTransactionOptions\n *\n * @returns A signed serialized transaction that can be simulated\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey!);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys!.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (accountAuthenticator instanceof AccountAuthenticatorSingleKey) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\n // TODO add support for AnyMultiKey\n if (publicKey instanceof AnyPublicKey) {\n if (publicKey.publicKey instanceof Ed25519PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));\n }\n if (publicKey.publicKey instanceof Secp256k1PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));\n }\n }\n\n // legacy code\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(publicKey.toUint8Array()),\n new Ed25519Signature(new Uint8Array(64)),\n );\n}\n\n/**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction A aptos transaction type to sign\n *\n * @return The signer AccountAuthenticator\n */\nexport function sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // get the signing message\n const message = generateSigningMessage(transaction);\n\n // account.signMessage\n const signerSignature = signer.sign(message);\n\n // return account authentication\n switch (signer.signingScheme) {\n case SigningScheme.Ed25519:\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(signer.publicKey.toUint8Array()),\n new Ed25519Signature(signerSignature.toUint8Array()),\n );\n case SigningScheme.SingleKey:\n if (!AnyPublicKey.isPublicKey(signer.publicKey)) {\n throw new Error(`Cannot sign transaction, public key does not match ${signer.signingScheme}`);\n }\n return new AccountAuthenticatorSingleKey(signer.publicKey, new AnySignature(signerSignature));\n // TODO support MultiEd25519\n default:\n throw new Error(`Cannot sign transaction, signing scheme ${signer.signingScheme} not supported`);\n }\n}\n\n/**\n * Prepare a transaction to be submitted to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @returns A SignedTransaction\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, senderAuthenticator, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n\n const transactionToSubmit = deriveTransactionType(transaction);\n\n if (\n (feePayerAuthenticator || additionalSignersAuthenticators) &&\n (transactionToSubmit instanceof MultiAgentRawTransaction || transactionToSubmit instanceof FeePayerRawTransaction)\n ) {\n return generateMultiSignersSignedTransaction(\n transactionToSubmit,\n senderAuthenticator,\n feePayerAuthenticator,\n additionalSignersAuthenticators,\n );\n }\n\n // submit single signer transaction\n\n // check what instance is accountAuthenticator\n if (senderAuthenticator instanceof AccountAuthenticatorEd25519 && transactionToSubmit instanceof RawTransaction) {\n const transactionAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n if (\n (senderAuthenticator instanceof AccountAuthenticatorSingleKey ||\n senderAuthenticator instanceof AccountAuthenticatorMultiKey) &&\n transactionToSubmit instanceof RawTransaction\n ) {\n const transactionAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot generate a signed transaction, ${senderAuthenticator} is not a supported account authentication scheme`,\n );\n}\n\n/**\n * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction\n *\n * @param transaction A aptos transaction type\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generate a multi signers signed transaction that can be submitted to chain\n *\n * @param transaction MultiAgentRawTransaction | FeePayerRawTransaction\n * @param senderAuthenticator The account authenticator of the transaction sender\n * @param secondarySignerAuthenticators The extra signers account Authenticators\n *\n * @returns A SignedTransaction\n */\nexport function generateMultiSignersSignedTransaction(\n transaction: MultiAgentRawTransaction | FeePayerRawTransaction,\n senderAuthenticator: AccountAuthenticator,\n feePayerAuthenticator?: AccountAuthenticator,\n additionalSignersAuthenticators?: Array<AccountAuthenticator>,\n) {\n if (transaction instanceof FeePayerRawTransaction) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n const txAuthenticatorFeePayer = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.fee_payer_address,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transaction.raw_txn, txAuthenticatorFeePayer).bcsToBytes();\n }\n if (transaction instanceof MultiAgentRawTransaction) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n const multiAgentAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n );\n return new SignedTransaction(transaction.raw_txn, multiAgentAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot prepare multi signers transaction to submission, ${typeof transaction} transaction is not supported`,\n );\n}\n\nexport function generateSigningMessage(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n const hash = sha3Hash.create();\n\n if (rawTxn instanceof RawTransaction) {\n hash.update(RAW_TRANSACTION_SALT);\n } else if (rawTxn instanceof MultiAgentRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else if (rawTxn instanceof FeePayerRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else {\n throw new Error(`Unknown transaction type to sign on: ${rawTxn}`);\n }\n\n const prefix = hash.digest();\n\n const body = rawTxn.bcsToBytes();\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n"],"mappings":"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","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","memoizeAsync","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultisig","MultiSig","MultisigTransactionPayload","TransactionPayloadEntryFunction","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","getSequenceNumber","getInfo","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","sequenceNumber","chainId","gasEstimate","maxGasAmount","gasUnitPrice","expireTimestamp","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","TransactionAuthenticatorSingleSender","AnyPublicKey","Ed25519PublicKey","AnySignature","Ed25519Signature","Secp256k1PublicKey","Secp256k1Signature","sign","message","generateSigningMessage","signerSignature","generateSignedTransaction","senderAuthenticator","additionalSignersAuthenticators","transactionToSubmit","deriveTransactionType","generateMultiSignersSignedTransaction","AccountAuthenticatorMultiKey","txAuthenticatorFeePayer","multiAgentAuthenticator","hash","sha3Hash","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","prefix","body","mergedArray"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-XWWW2V74.mjs";import{a,b as g,c as f}from"./chunk-O7HXE2B5.mjs";import{a as o,b as u,c as s,d as c,e as p,f as y,g as m}from"./chunk-NANOXAUV.mjs";import{b as r}from"./chunk-47UUK4Y5.mjs";function M(n){return typeof n=="boolean"}function D(n){return typeof n=="string"}function N(n){return typeof n=="number"}function P(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function w(n){return n==null}function G(n){return A(n)||x(n)||S(n)||B(n)||U(n)||I(n)||b(n)||T(n)||E(n)||d(n)||n instanceof a||n instanceof f}function A(n){return n instanceof o}function T(n){return n instanceof r}function E(n){return n instanceof g}function d(n){return n instanceof i}function x(n){return n instanceof u}function S(n){return n instanceof s}function B(n){return n instanceof c}function U(n){return n instanceof p}function I(n){return n instanceof y}function b(n){return n instanceof m}function $(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],l=t[2];return{moduleAddress:e,moduleName:F,functionName:l}}export{M as a,D as b,N as c,P as d,w as e,G as f,A as g,T as h,E as i,d as j,x as k,S as l,B as m,U as n,I as o,b as p,$ as q,R as r,W as s,L as t};
|
|
2
|
+
//# sourceMappingURL=chunk-D3U253BW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-GSBXTPCS.mjs";import{g as o}from"./chunk-KEOLTOML.mjs";import{o as a,r,s as u}from"./chunk-BQSE5HHW.mjs";async function b(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:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function m(t){let{aptosConfig:s,options:e}=t,n={query:r,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 F(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:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function y(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:A,options:c}=t;return await g({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,A]},options:c})}export{b as a,m as b,F as c,y as d};
|
|
2
|
+
//# sourceMappingURL=chunk-DIXTONIO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/fungibleAsset.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/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { Account, AccountAddress } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { generateTransaction } from \"./transactionSubmission\";\n\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function transferFungibleAsset(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddress;\n recipient: AccountAddress;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::primary_fungible_store::transfer\",\n typeArguments: [\"0x1::fungible_asset::Metadata\"],\n functionArguments: [fungibleAssetMetadataAddress, recipient, amount],\n },\n options,\n });\n return transaction;\n}\n"],"mappings":"oIAuCA,eAAsBA,EAAyBC,EAGD,CAC5C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA4C,CAC7D,YAAAJ,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAEA,eAAsBG,EAA2BN,EAGD,CAC9C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBL,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA8C,CAC/D,YAAAJ,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAEA,eAAsBK,EAAgCR,EAGD,CACnD,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOM,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAAmD,CACpE,YAAAJ,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd,CAEA,eAAsBO,EAAsBV,EAOb,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAU,EAAQ,6BAAAC,EAA8B,UAAAC,EAAW,OAAAC,EAAQ,QAAAZ,CAAQ,EAAIF,EAW1F,OAVoB,MAAMe,EAAoB,CAC5C,YAAAd,EACA,OAAQU,EAAO,eACf,KAAM,CACJ,SAAU,wCACV,cAAe,CAAC,+BAA+B,EAC/C,kBAAmB,CAACC,EAA8BC,EAAWC,CAAM,CACrE,EACA,QAAAZ,CACF,CAAC,CAEH","names":["getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","GetFungibleAssetMetadata","queryIndexer","getFungibleAssetActivities","GetFungibleAssetActivities","getCurrentFungibleAssetBalances","GetCurrentFungibleAssetBalances","transferFungibleAsset","sender","fungibleAssetMetadataAddress","recipient","amount","generateTransaction"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-3JPVQHOR.mjs";import{a as A}from"./chunk-AH44UPM4.mjs";import{i as w,j as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-3JPVQHOR.mjs";import{a as A}from"./chunk-AH44UPM4.mjs";import{i as w,j as C}from"./chunk-KEOLTOML.mjs";import{b as c,c as l}from"./chunk-NHB2SPSA.mjs";import{a as h}from"./chunk-6FBKUTGF.mjs";import{e as y}from"./chunk-HHJBCGAQ.mjs";async function F(o){let{aptosConfig:n,options:t}=o;return l({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function L(o){let{aptosConfig:n}=o;return A(async()=>{let{data:t}=await c({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function v(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await c({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function x(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await c({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function N(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await x({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function G(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??y,f=s?.checkSuccess??!0,i=!0,u=0,e,g,m=200,P=1.5;for(;i&&!(u>=r);){try{if(e=await x({aptosConfig:n,transactionHash:t}),i=e.type==="pending_transaction",!i)break}catch(a){if(!(a instanceof h)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}await d(m),u+=m/1e3,m*=P}if(e===void 0)throw g||new p(`Fetching transaction ${t} failed and timed out after ${r} seconds`,e);if(e.type==="pending_transaction")throw new p(`Transaction ${t} timed out in pending state after ${r} seconds`,e);if(!f)return e;if(!e.success)throw new T(`Transaction ${t} failed with an error: ${e.vm_status}`,e);return e}async function D(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,f=new Date().getTime(),i=BigInt(-1);for(;i<s;){if(new Date().getTime()-f>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?i=await w({aptosConfig:n}):i=(await C({aptosConfig:n,processorType:t})).last_success_version,i>=s)break;await d(200)}}var p=class extends Error{constructor(t,s){super(t);this.lastSubmittedTransaction=s}},T=class extends Error{constructor(t,s){super(t);this.transaction=s}};export{F as a,L as b,v as c,x as d,N as e,G as f,D as g,p as h,T as i};
|
|
2
|
+
//# sourceMappingURL=chunk-DV6TMIRK.mjs.map
|