@aptos-labs/ts-sdk 1.23.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/index.d.ts +13 -8
- package/dist/common/index.js +7 -7
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/{chunk-QLKTSSVC.mjs → chunk-25ZFJIIK.mjs} +2 -2
- package/dist/esm/{chunk-J6NLU6QX.mjs → chunk-375GMLWG.mjs} +2 -2
- package/dist/esm/{chunk-QUMSKIYX.mjs → chunk-3A6HUKXW.mjs} +2 -2
- package/dist/esm/{chunk-FAFN34ZH.mjs → chunk-3XFAQ6KR.mjs} +2 -2
- package/dist/esm/chunk-4GETVCGY.mjs +2 -0
- package/dist/esm/chunk-4GETVCGY.mjs.map +1 -0
- package/dist/esm/chunk-4LQKLXHW.mjs +2 -0
- package/dist/esm/chunk-4LQKLXHW.mjs.map +1 -0
- package/dist/esm/{chunk-NJ2IXXY2.mjs → chunk-4TXG2LSP.mjs} +2 -2
- package/dist/esm/{chunk-D6QSRB4J.mjs → chunk-4YR6QO63.mjs} +2 -2
- package/dist/esm/{chunk-4R7FL2G2.mjs → chunk-5JTED2JJ.mjs} +2 -2
- package/dist/esm/chunk-75U3LEBF.mjs +2 -0
- package/dist/esm/chunk-75U3LEBF.mjs.map +1 -0
- package/dist/esm/{chunk-ZE2TCKUL.mjs → chunk-7X67Z6NJ.mjs} +2 -2
- package/dist/esm/{chunk-IR6L77JS.mjs → chunk-ALRQRVDX.mjs} +2 -2
- package/dist/esm/{chunk-Y5AY3QBY.mjs → chunk-AVNNYI7R.mjs} +2 -2
- package/dist/esm/{chunk-ZHNCJSXO.mjs → chunk-BSAYHZ2R.mjs} +2 -2
- package/dist/esm/{chunk-MG3T24A3.mjs → chunk-BTLHVOIC.mjs} +2 -2
- package/dist/esm/chunk-C6VIBT2D.mjs +2 -0
- package/dist/esm/{chunk-2M45ESQN.mjs.map → chunk-C6VIBT2D.mjs.map} +1 -1
- package/dist/esm/chunk-CDLMUY5H.mjs +2 -0
- package/dist/esm/chunk-CDLMUY5H.mjs.map +1 -0
- package/dist/esm/{chunk-MA7TL5VN.mjs → chunk-CNNDK6OL.mjs} +2 -2
- package/dist/esm/{chunk-PF54PEHF.mjs → chunk-CQPJZUKQ.mjs} +2 -2
- package/dist/esm/{chunk-V3NKDUY5.mjs → chunk-CSW2QEVU.mjs} +2 -2
- package/dist/esm/{chunk-7F7AIMGB.mjs → chunk-D3PBEHCP.mjs} +2 -2
- package/dist/esm/{chunk-OBKVMO7I.mjs → chunk-DAZTLM55.mjs} +2 -2
- package/dist/esm/{chunk-4FMAPHUM.mjs → chunk-ETWZV5XK.mjs} +2 -2
- package/dist/esm/{chunk-243IMA3Y.mjs → chunk-FAHN3AZI.mjs} +2 -2
- package/dist/esm/{chunk-BQIT7TKM.mjs → chunk-FFF7M7E4.mjs} +2 -2
- package/dist/esm/{chunk-BQ7OOQRE.mjs → chunk-G23ZPQCJ.mjs} +2 -2
- package/dist/esm/{chunk-WPYVWZQS.mjs → chunk-G5MGSV7Y.mjs} +2 -2
- package/dist/esm/{chunk-3JFX3XDA.mjs → chunk-GJWCKVN5.mjs} +2 -2
- package/dist/esm/{chunk-RZKLIZ2D.mjs → chunk-GK7TQDBN.mjs} +2 -2
- package/dist/esm/{chunk-4ZDOOSRJ.mjs → chunk-GLUCMQZK.mjs} +2 -2
- package/dist/esm/{chunk-BDD6OBUV.mjs → chunk-GYIYUBYT.mjs} +2 -2
- package/dist/esm/{chunk-T7WBGP37.mjs → chunk-HBECYNQ6.mjs} +2 -2
- package/dist/esm/{chunk-PIUICROW.mjs → chunk-HKMG3LZX.mjs} +2 -2
- package/dist/esm/{chunk-F435LQUS.mjs → chunk-HLXD3KWO.mjs} +2 -2
- package/dist/esm/{chunk-J26STL4T.mjs → chunk-HWYAQTV3.mjs} +2 -2
- package/dist/esm/{chunk-IUAAMX5V.mjs → chunk-IG7R65TF.mjs} +2 -2
- package/dist/esm/{chunk-GP3RTNYN.mjs → chunk-INZXND6M.mjs} +2 -2
- package/dist/esm/{chunk-UY4EIN3P.mjs → chunk-ISUHNAU4.mjs} +2 -2
- package/dist/esm/{chunk-ME2PENQD.mjs → chunk-J2YQTDZL.mjs} +2 -2
- package/dist/esm/{chunk-BEXHZ5XT.mjs → chunk-JDTU6Z6C.mjs} +2 -2
- package/dist/esm/{chunk-YEISKUKC.mjs → chunk-LKLHNQF5.mjs} +2 -2
- package/dist/esm/{chunk-PDOQLTXA.mjs → chunk-MULJ2GLJ.mjs} +2 -2
- package/dist/esm/{chunk-IZ7OGJBY.mjs → chunk-NV5YQZ3R.mjs} +2 -2
- package/dist/esm/{chunk-J4KAYDPB.mjs → chunk-NWOMSL6K.mjs} +2 -2
- package/dist/esm/{chunk-ES5Z33UX.mjs → chunk-O2M3QKKS.mjs} +2 -2
- package/dist/esm/{chunk-WSE653RS.mjs → chunk-OHRL766V.mjs} +2 -2
- package/dist/esm/{chunk-WSE653RS.mjs.map → chunk-OHRL766V.mjs.map} +1 -1
- package/dist/esm/{chunk-EMFVGL2Y.mjs → chunk-PR6363Y6.mjs} +2 -2
- package/dist/esm/{chunk-K7OBPPSF.mjs → chunk-PSCDBITI.mjs} +2 -2
- package/dist/esm/{chunk-T52HPGL5.mjs → chunk-QFORDQCU.mjs} +2 -2
- package/dist/esm/{chunk-B4ROOQE3.mjs → chunk-QITCB4PW.mjs} +2 -2
- package/dist/esm/{chunk-RBIJJSGB.mjs → chunk-QNTQPWLK.mjs} +2 -2
- package/dist/esm/{chunk-2SGICMXB.mjs → chunk-QQWBR4SK.mjs} +2 -2
- package/dist/esm/{chunk-VA4HKHNV.mjs → chunk-QVJV46XS.mjs} +2 -2
- package/dist/esm/{chunk-ODYVU346.mjs → chunk-RP5444TL.mjs} +2 -2
- package/dist/esm/{chunk-5OR2POPO.mjs → chunk-S36XP4IE.mjs} +2 -2
- package/dist/esm/{chunk-GBZOWPC6.mjs → chunk-SUJLWCRN.mjs} +2 -2
- package/dist/esm/{chunk-FE6CYBDF.mjs → chunk-TBJ7W5NC.mjs} +2 -2
- package/dist/esm/{chunk-OUAQKVIC.mjs → chunk-TX2IYMFV.mjs} +2 -2
- package/dist/esm/chunk-UC5BZJ23.mjs +2 -0
- package/dist/esm/chunk-UC5BZJ23.mjs.map +1 -0
- package/dist/esm/{chunk-3CB53WTP.mjs → chunk-URCQOJ55.mjs} +2 -2
- package/dist/esm/{chunk-FRUEQTCC.mjs → chunk-V3OYNKY5.mjs} +2 -2
- package/dist/esm/chunk-VTPF7AYM.mjs +2 -0
- package/dist/esm/chunk-VTPF7AYM.mjs.map +1 -0
- package/dist/esm/{chunk-DAEUQBVZ.mjs → chunk-VTTT2G7F.mjs} +2 -2
- package/dist/esm/{chunk-ZMFVKUFD.mjs → chunk-WMHYIP3S.mjs} +2 -2
- package/dist/esm/{chunk-FZ3HMVKE.mjs → chunk-WRRQ7L5K.mjs} +2 -2
- package/dist/esm/{chunk-D6DCZULX.mjs → chunk-WUJ7XNQD.mjs} +2 -2
- package/dist/esm/{chunk-X2QSDREG.mjs → chunk-X27JKATG.mjs} +2 -2
- package/dist/esm/{chunk-L7FA4ISG.mjs → chunk-XVJI5XXW.mjs} +2 -2
- package/dist/esm/{chunk-BFRFAX5I.mjs → chunk-YDZBU2DJ.mjs} +2 -2
- package/dist/esm/{chunk-NC3KKAAK.mjs → chunk-YMVD7Z7Z.mjs} +2 -2
- package/dist/esm/{chunk-T7MGIHWV.mjs → chunk-ZW2R6VQE.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +10 -9
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +1 -0
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +2 -0
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.d.mts +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/api/faucet.ts +6 -1
- package/src/core/accountAddress.ts +6 -6
- package/src/core/crypto/ed25519.ts +28 -28
- package/src/core/crypto/keyless.ts +9 -0
- package/src/core/crypto/secp256k1.ts +4 -3
- package/src/core/crypto/singleKey.ts +20 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +17 -27
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2M45ESQN.mjs +0 -2
- package/dist/esm/chunk-6WAXFWLH.mjs +0 -2
- package/dist/esm/chunk-6WAXFWLH.mjs.map +0 -1
- package/dist/esm/chunk-72QKG5N2.mjs +0 -2
- package/dist/esm/chunk-72QKG5N2.mjs.map +0 -1
- package/dist/esm/chunk-FSTRZMCK.mjs +0 -2
- package/dist/esm/chunk-FSTRZMCK.mjs.map +0 -1
- package/dist/esm/chunk-OID45FCB.mjs +0 -2
- package/dist/esm/chunk-OID45FCB.mjs.map +0 -1
- package/dist/esm/chunk-XWVMFCW3.mjs +0 -2
- package/dist/esm/chunk-XWVMFCW3.mjs.map +0 -1
- package/dist/esm/chunk-ZKCSQAGW.mjs +0 -2
- package/dist/esm/chunk-ZKCSQAGW.mjs.map +0 -1
- /package/dist/esm/{chunk-QLKTSSVC.mjs.map → chunk-25ZFJIIK.mjs.map} +0 -0
- /package/dist/esm/{chunk-J6NLU6QX.mjs.map → chunk-375GMLWG.mjs.map} +0 -0
- /package/dist/esm/{chunk-QUMSKIYX.mjs.map → chunk-3A6HUKXW.mjs.map} +0 -0
- /package/dist/esm/{chunk-FAFN34ZH.mjs.map → chunk-3XFAQ6KR.mjs.map} +0 -0
- /package/dist/esm/{chunk-NJ2IXXY2.mjs.map → chunk-4TXG2LSP.mjs.map} +0 -0
- /package/dist/esm/{chunk-D6QSRB4J.mjs.map → chunk-4YR6QO63.mjs.map} +0 -0
- /package/dist/esm/{chunk-4R7FL2G2.mjs.map → chunk-5JTED2JJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZE2TCKUL.mjs.map → chunk-7X67Z6NJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IR6L77JS.mjs.map → chunk-ALRQRVDX.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5AY3QBY.mjs.map → chunk-AVNNYI7R.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZHNCJSXO.mjs.map → chunk-BSAYHZ2R.mjs.map} +0 -0
- /package/dist/esm/{chunk-MG3T24A3.mjs.map → chunk-BTLHVOIC.mjs.map} +0 -0
- /package/dist/esm/{chunk-MA7TL5VN.mjs.map → chunk-CNNDK6OL.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF54PEHF.mjs.map → chunk-CQPJZUKQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-V3NKDUY5.mjs.map → chunk-CSW2QEVU.mjs.map} +0 -0
- /package/dist/esm/{chunk-7F7AIMGB.mjs.map → chunk-D3PBEHCP.mjs.map} +0 -0
- /package/dist/esm/{chunk-OBKVMO7I.mjs.map → chunk-DAZTLM55.mjs.map} +0 -0
- /package/dist/esm/{chunk-4FMAPHUM.mjs.map → chunk-ETWZV5XK.mjs.map} +0 -0
- /package/dist/esm/{chunk-243IMA3Y.mjs.map → chunk-FAHN3AZI.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQIT7TKM.mjs.map → chunk-FFF7M7E4.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQ7OOQRE.mjs.map → chunk-G23ZPQCJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-WPYVWZQS.mjs.map → chunk-G5MGSV7Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-3JFX3XDA.mjs.map → chunk-GJWCKVN5.mjs.map} +0 -0
- /package/dist/esm/{chunk-RZKLIZ2D.mjs.map → chunk-GK7TQDBN.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ZDOOSRJ.mjs.map → chunk-GLUCMQZK.mjs.map} +0 -0
- /package/dist/esm/{chunk-BDD6OBUV.mjs.map → chunk-GYIYUBYT.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7WBGP37.mjs.map → chunk-HBECYNQ6.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIUICROW.mjs.map → chunk-HKMG3LZX.mjs.map} +0 -0
- /package/dist/esm/{chunk-F435LQUS.mjs.map → chunk-HLXD3KWO.mjs.map} +0 -0
- /package/dist/esm/{chunk-J26STL4T.mjs.map → chunk-HWYAQTV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-IUAAMX5V.mjs.map → chunk-IG7R65TF.mjs.map} +0 -0
- /package/dist/esm/{chunk-GP3RTNYN.mjs.map → chunk-INZXND6M.mjs.map} +0 -0
- /package/dist/esm/{chunk-UY4EIN3P.mjs.map → chunk-ISUHNAU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-ME2PENQD.mjs.map → chunk-J2YQTDZL.mjs.map} +0 -0
- /package/dist/esm/{chunk-BEXHZ5XT.mjs.map → chunk-JDTU6Z6C.mjs.map} +0 -0
- /package/dist/esm/{chunk-YEISKUKC.mjs.map → chunk-LKLHNQF5.mjs.map} +0 -0
- /package/dist/esm/{chunk-PDOQLTXA.mjs.map → chunk-MULJ2GLJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IZ7OGJBY.mjs.map → chunk-NV5YQZ3R.mjs.map} +0 -0
- /package/dist/esm/{chunk-J4KAYDPB.mjs.map → chunk-NWOMSL6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-ES5Z33UX.mjs.map → chunk-O2M3QKKS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMFVGL2Y.mjs.map → chunk-PR6363Y6.mjs.map} +0 -0
- /package/dist/esm/{chunk-K7OBPPSF.mjs.map → chunk-PSCDBITI.mjs.map} +0 -0
- /package/dist/esm/{chunk-T52HPGL5.mjs.map → chunk-QFORDQCU.mjs.map} +0 -0
- /package/dist/esm/{chunk-B4ROOQE3.mjs.map → chunk-QITCB4PW.mjs.map} +0 -0
- /package/dist/esm/{chunk-RBIJJSGB.mjs.map → chunk-QNTQPWLK.mjs.map} +0 -0
- /package/dist/esm/{chunk-2SGICMXB.mjs.map → chunk-QQWBR4SK.mjs.map} +0 -0
- /package/dist/esm/{chunk-VA4HKHNV.mjs.map → chunk-QVJV46XS.mjs.map} +0 -0
- /package/dist/esm/{chunk-ODYVU346.mjs.map → chunk-RP5444TL.mjs.map} +0 -0
- /package/dist/esm/{chunk-5OR2POPO.mjs.map → chunk-S36XP4IE.mjs.map} +0 -0
- /package/dist/esm/{chunk-GBZOWPC6.mjs.map → chunk-SUJLWCRN.mjs.map} +0 -0
- /package/dist/esm/{chunk-FE6CYBDF.mjs.map → chunk-TBJ7W5NC.mjs.map} +0 -0
- /package/dist/esm/{chunk-OUAQKVIC.mjs.map → chunk-TX2IYMFV.mjs.map} +0 -0
- /package/dist/esm/{chunk-3CB53WTP.mjs.map → chunk-URCQOJ55.mjs.map} +0 -0
- /package/dist/esm/{chunk-FRUEQTCC.mjs.map → chunk-V3OYNKY5.mjs.map} +0 -0
- /package/dist/esm/{chunk-DAEUQBVZ.mjs.map → chunk-VTTT2G7F.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZMFVKUFD.mjs.map → chunk-WMHYIP3S.mjs.map} +0 -0
- /package/dist/esm/{chunk-FZ3HMVKE.mjs.map → chunk-WRRQ7L5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-D6DCZULX.mjs.map → chunk-WUJ7XNQD.mjs.map} +0 -0
- /package/dist/esm/{chunk-X2QSDREG.mjs.map → chunk-X27JKATG.mjs.map} +0 -0
- /package/dist/esm/{chunk-L7FA4ISG.mjs.map → chunk-XVJI5XXW.mjs.map} +0 -0
- /package/dist/esm/{chunk-BFRFAX5I.mjs.map → chunk-YDZBU2DJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC3KKAAK.mjs.map → chunk-YMVD7Z7Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7MGIHWV.mjs.map → chunk-ZW2R6VQE.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n */\n private readonly key: Hex;\n\n /**\n * Create a new PublicKey instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed data with a public key\n * @param args.message a signed message as a Hex string or Uint8Array\n * @param args.signature the signature of the message\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n */\n private readonly signingKey: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * @param hexInput HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const privateKeyHex = Hex.fromHexInput(hexInput);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase.\n *\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism,\n * so non-hardened derivation cannot work)\n *\n * @param path the BIP44 path\n * @param mnemonics the mnemonic seed phrase\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path the BIP44 path\n * @param seed the seed phrase created by the mnemonics\n * @param offset the offset used for key derivation, defaults to 0x80000000\n * @returns\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n *\n * @param message a message as a string or Uint8Array\n * @returns Signature\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key\n */\n toString(): string {\n return this.signingKey.toString();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Ed25519PrivateKey` instead.\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * A signature of a message signed using an Ed25519 private key\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"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","names":["ed25519","L","isCanonicalEd25519Signature","signature","s","i","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","messageToVerify","convertSigningMessage","messageBytes","signatureBytes","publicKeyBytes","ed25519","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","privateKeyHex","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","messageToSign","Ed25519Signature","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-OHRL766V.mjs";import{c as n}from"./chunk-QVJV46XS.mjs";import{o as g,t as d}from"./chunk-VHNX2NUR.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
|
|
2
|
+
//# sourceMappingURL=chunk-CNNDK6OL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as i}from"./chunk-OHRL766V.mjs";import{c as d}from"./chunk-QVJV46XS.mjs";import{p as c}from"./chunk-VHNX2NUR.mjs";var a=300,u=t=>{if(t&&t.length>a)throw new Error(`Event type length exceeds the maximum length of ${a}`)};async function m(t){let{aptosConfig:o,eventType:e,options:n}=t;return p({aptosConfig:o,options:{...n,where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}}}})}async function f(t){let{accountAddress:o,aptosConfig:e,creationNumber:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function _(t){let{accountAddress:o,aptosConfig:e,eventType:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},indexed_type:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function p(t){let{aptosConfig:o,options:e}=t;u(e?.where?.indexed_type?._eq);let n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:o,query:n,originMethod:"getEvents"})).events}export{m as a,f as b,_ as c,p as d};
|
|
2
|
+
//# sourceMappingURL=chunk-CQPJZUKQ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-QNTQPWLK.mjs";import{a as b,b as g}from"./chunk-PR6363Y6.mjs";import{b as h,d as p}from"./chunk-CDLMUY5H.mjs";import{b as a}from"./chunk-OHRL766V.mjs";import{a as y}from"./chunk-A63SMUOU.mjs";var n=class extends y{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return o.load(e);case 1:return d.load(e);case 2:return u.load(e);case 3:return l.load(e);case 4:return A.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${r}`)}}},o=class s extends n{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=h.deserialize(e),t=p.deserialize(e);return new s(r,t)}},d=class s extends n{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=b.deserialize(e),t=g.deserialize(e);return new s(r,t)}},u=class s extends n{constructor(e,r,t){super(),this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=t}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=i.deserialize(e),t=e.deserializeVector(a),c=e.deserializeVector(i);return new s(r,t,c)}},l=class s extends n{constructor(e,r,t,c){super(),this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=t,this.fee_payer=c}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=i.deserialize(e),t=e.deserializeVector(a),c=e.deserializeVector(i),_=a.deserialize(e),z=i.deserialize(e),S={address:_,authenticator:z};return new s(r,t,c,S)}},A=class s extends n{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=i.deserialize(e);return new s(r)}};export{n as a,o as b,d as c,u as d,l as e,A as f};
|
|
2
|
+
//# sourceMappingURL=chunk-CSW2QEVU.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-RP5444TL.mjs";import{a as o,b as r,c as s}from"./chunk-NV5YQZ3R.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-D3PBEHCP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-HWYAQTV3.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DAZTLM55.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as y}from"./chunk-3XFAQ6KR.mjs";import{a as d}from"./chunk-25ZFJIIK.mjs";import{a as A}from"./chunk-DAZTLM55.mjs";import{a as T}from"./chunk-TX2IYMFV.mjs";import{d as g,e as a,h as m,i as p,j as f}from"./chunk-HWYAQTV3.mjs";import{a as i,b as s,c as r,d as e,e as c,g as u}from"./chunk-O2M3QKKS.mjs";var h=class{constructor(n){this.config=n,this.build=new y(this.config),this.simulate=new A(this.config),this.submit=new T(this.config),this.batch=new d(this.config)}async getTransactions(n){return i({aptosConfig:this.config,...n})}async getTransactionByVersion(n){return r({aptosConfig:this.config,...n})}async getTransactionByHash(n){return e({aptosConfig:this.config,...n})}async isPendingTransaction(n){return c({aptosConfig:this.config,...n})}async waitForTransaction(n){return u({aptosConfig:this.config,...n})}async getGasPriceEstimation(){return s({aptosConfig:this.config})}getSigningMessage(n){return g(n)}async publishPackageTransaction(n){return p({aptosConfig:this.config,...n})}async rotateAuthKey(n){return f({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:P}=n;this.batch.forSingleAccount({sender:t,data:o,options:P})}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{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ETWZV5XK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-GLUCMQZK.mjs";import{a as r}from"./chunk-RP5444TL.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FAHN3AZI.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-WUJ7XNQD.mjs";import{a as e}from"./chunk-RP5444TL.mjs";import{b as s}from"./chunk-OHRL766V.mjs";var L=class{constructor(t){this.config=t}async getCollectionData(t){await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:N,collectionName:_,options:n}=t,w=s.from(N),r={collection_name:{_eq:_},creator_address:{_eq:w.toStringLong()}};return n?.tokenStandard&&(r.token_standard={_eq:n?.tokenStandard??"v2"}),d({aptosConfig:this.config,options:{where:r}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),u({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),A({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),y({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),o({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return p({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return m({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return l({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return T({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return f({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return C({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return I({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return O({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return P({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return V({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return S({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return h({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return R({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return G({aptosConfig:this.config,...t})}};export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FFF7M7E4.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as i,c as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r,b as i,c as s}from"./chunk-CNNDK6OL.mjs";import{a as o}from"./chunk-RP5444TL.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),s({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-G23ZPQCJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-OHRL766V.mjs";import{a as o}from"./chunk-A63SMUOU.mjs";import{b as n}from"./chunk-BCUSI3N6.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-G5MGSV7Y.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-X27JKATG.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-GJWCKVN5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-LKLHNQF5.mjs";import{a as n}from"./chunk-QQWBR4SK.mjs";import{c as i}from"./chunk-CDLMUY5H.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GK7TQDBN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-OHRL766V.mjs";import{c as a}from"./chunk-QVJV46XS.mjs";import{u as n}from"./chunk-VHNX2NUR.mjs";async function d(e){let{aptosConfig:o,options:t}=e,r={query:n,variables:{where_condition:t?.where,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await a({aptosConfig:o,query:r,originMethod:"getObjectData"})).current_objects}async function f(e){let{aptosConfig:o,objectAddress:t,options:r}=e,c={object_address:{_eq:s.from(t).toStringLong()}};return(await d({aptosConfig:o,options:{...r,where:c}}))[0]}export{d as a,f as b};
|
|
2
|
+
//# sourceMappingURL=chunk-GLUCMQZK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as h}from"./chunk-UC5BZJ23.mjs";import{b as m}from"./chunk-76OH2Z4Q.mjs";import{a as g}from"./chunk-MLDQ2TY2.mjs";import{a as b}from"./chunk-G5MGSV7Y.mjs";function d(l){let e=l;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var f=class l extends m{constructor(e){super();let{publicKeys:r,signaturesRequired:t}=e;if(t<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<t)throw new Error(`Provided ${r.length} public keys is smaller than the ${t} required signatures`);this.publicKeys=r.map(i=>i instanceof o?i:new o(i)),this.signaturesRequired=t}verifySignature(e){throw new Error("not implemented")}authKey(){return b.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(o),t=e.deserializeU8();return new l({publicKeys:r,signaturesRequired:t})}createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach((n,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(a.has(n))throw new Error(`Duplicate bit ${n} detected.`);a.add(n);let c=Math.floor(n/8),y=i[c];y|=t>>n%8,i[c]=y}),i}getIndex(e){let r=e instanceof o?e:new o(e),t=this.publicKeys.findIndex(i=>i.toString()===r.toString());if(t!==-1)return t;throw new Error("Public key not found in MultiKey")}},s=class s extends g{constructor(e){super();let{signatures:r,bitmap:t}=e;if(r.length>s.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${s.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(a=>a instanceof h?a:new h(a)),!(t instanceof Uint8Array))this.bitmap=s.createBitmap({bits:t});else{if(t.length!==s.BITMAP_LEN)throw new Error(`"bitmap" length should be ${s.BITMAP_LEN}`);this.bitmap=t}let i=this.bitmap.reduce((a,n)=>a+d(n),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach(n=>{if(n>=s.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${s.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(n))throw new Error("Duplicate bits detected.");a.add(n);let u=Math.floor(n/8),c=i[u];c|=t>>n%8,i[u]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(h),t=e.deserializeBytes();return new s({signatures:r,bitmap:t})}};s.BITMAP_LEN=4,s.MAX_SIGNATURES_SUPPORTED=s.BITMAP_LEN*8;var p=s;export{f as a,p as b};
|
|
2
|
+
//# sourceMappingURL=chunk-GYIYUBYT.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-RP5444TL.mjs";import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-ALRQRVDX.mjs";import{e as o}from"./chunk-L36ZHC7J.mjs";var l=class{constructor(e){this.config=e}async getAccountInfo(e){return s({aptosConfig:this.config,...e})}async getAccountModules(e){return t({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return i({aptosConfig:this.config,...e})}async getAccountResources(e){return c({aptosConfig:this.config,...e})}async getAccountResource(e){return u({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),A({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),m({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),p({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),y({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),C({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:o,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),f({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),T({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return O({aptosConfig:this.config,...e})}};export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HBECYNQ6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-OHRL766V.mjs";import{a as u,b as r}from"./chunk-KMJ6TF6Y.mjs";import{e as t}from"./chunk-YPHH6CAO.mjs";import{a as i}from"./chunk-A63SMUOU.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HKMG3LZX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c,b as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c,b as g}from"./chunk-S36XP4IE.mjs";import{k as i,l as a}from"./chunk-O2M3QKKS.mjs";import{a as e,b as n,c as s,e as r,f as t}from"./chunk-QVJV46XS.mjs";var p=class{constructor(o){this.config=o}async getLedgerInfo(){return e({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(o){return i({aptosConfig:this.config,...o})}async getBlockByHeight(o){return a({aptosConfig:this.config,...o})}async view(o){return c({aptosConfig:this.config,...o})}async viewJson(o){return g({aptosConfig:this.config,...o})}async getChainTopUserTransactions(o){return n({aptosConfig:this.config,...o})}async queryIndexer(o){return s({aptosConfig:this.config,...o})}async getIndexerLastSuccessVersion(){return r({aptosConfig:this.config})}async getProcessorStatus(o){return t({aptosConfig:this.config,processorType:o})}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HLXD3KWO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g,f as d,g as b,i as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g,f as d,g as b,i as S}from"./chunk-4LQKLXHW.mjs";import{a as C}from"./chunk-ALRQRVDX.mjs";import{a as w}from"./chunk-AVNNYI7R.mjs";import{a as I}from"./chunk-QITCB4PW.mjs";import{a as P}from"./chunk-GK7TQDBN.mjs";import{d as l}from"./chunk-5JTED2JJ.mjs";import{a as T}from"./chunk-HKMG3LZX.mjs";import{c as f,m as s}from"./chunk-SUJLWCRN.mjs";import{b as p}from"./chunk-OHRL766V.mjs";import{b as A}from"./chunk-IG7R65TF.mjs";import{a as r}from"./chunk-KMJ6TF6Y.mjs";import{b as y}from"./chunk-YPHH6CAO.mjs";async function h(t){let a=await D(t);return G(t,a)}async function D(t){let{aptosConfig:a,data:n}=t,e,o;return"bytecode"in n?o=await g(n):"multisigAddress"in n?(e={aptosConfig:a,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)):(e={aptosConfig:a,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)),o}async function G(t,a){let{aptosConfig:n,sender:e,options:o}=t,i;if(K(t)&&(i=p.ZERO.toString()),U(t)){let{secondarySignerAddresses:c}=t;return d({aptosConfig:n,sender:e,payload:a,options:o,secondarySignerAddresses:c,feePayerAddress:i})}return d({aptosConfig:n,sender:e,payload:a,options:o,feePayerAddress:i})}function K(t){return t.withFeePayer===!0}function U(t){return"secondarySignerAddresses"in t}function Y(t){let{transaction:a}=t;return l(a)}function _(t){let{signer:a,transaction:n}=t;return a.signTransactionWithAuthenticator(n)}async function $(t){let{aptosConfig:a,transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}=t,u=b({transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}),{data:m}=await A({aptosConfig:a,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:t.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:t.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:t.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return m}async function B(t){let{aptosConfig:a}=t,n=S({...t}),{data:e}=await A({aptosConfig:a,body:n,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return e}async function M(t){let{aptosConfig:a,signer:n,transaction:e}=t;(n instanceof I||n instanceof w)&&await n.waitForProofFetch();let o=_({signer:n,transaction:e});return B({aptosConfig:a,transaction:e,senderAuthenticator:o})}var N={typeParameters:[],parameters:[s.u8(),new s(s.u8())]};async function nn(t){let{aptosConfig:a,account:n,metadataBytes:e,moduleBytecode:o,options:i}=t,c=o.map(u=>r.U8(u));return h({aptosConfig:a,sender:p.from(n),data:{function:"0x1::code::publish_package_txn",functionArguments:[r.U8(e),new r(c)],abi:N},options:i})}var F={typeParameters:[],parameters:[new f,s.u8(),new f,s.u8(),s.u8(),s.u8()]};async function tn(t){let{aptosConfig:a,fromAccount:n,toNewPrivateKey:e}=t,o=await C({aptosConfig:a,accountAddress:n.accountAddress}),i=P.fromPrivateKey({privateKey:e,legacy:!0}),u=new T({sequenceNumber:BigInt(o.sequence_number),originator:n.accountAddress,currentAuthKey:p.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),m=n.sign(u),R=i.sign(u),x=await h({aptosConfig:a,sender:n.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new y(n.signingScheme),r.U8(n.publicKey.toUint8Array()),new y(i.signingScheme),r.U8(i.publicKey.toUint8Array()),r.U8(m.toUint8Array()),r.U8(R.toUint8Array())],abi:F}});return M({aptosConfig:a,signer:n,transaction:x})}export{h as a,D as b,G as c,Y as d,_ as e,$ as f,B as g,M as h,nn as i,tn as j};
|
|
2
|
+
//# sourceMappingURL=chunk-HWYAQTV3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-4YR6QO63.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
|
|
2
|
+
//# sourceMappingURL=chunk-IG7R65TF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-SUJLWCRN.mjs";import{a as g}from"./chunk-YDZBU2DJ.mjs";import{a as p}from"./chunk-YUNDX5I7.mjs";import{b as y}from"./chunk-OHRL766V.mjs";import{a as v}from"./chunk-KMJ6TF6Y.mjs";import{a as S}from"./chunk-P5V7OZNN.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-YPHH6CAO.mjs";import{a as u}from"./chunk-A63SMUOU.mjs";function D(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
|
|
2
|
+
//# sourceMappingURL=chunk-INZXND6M.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-WMHYIP3S.mjs";import{b as i}from"./chunk-OHRL766V.mjs";import{a as d}from"./chunk-A63SMUOU.mjs";var o=class t extends d{constructor(e,s,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ISUHNAU4.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-HWYAQTV3.mjs";import{c as p}from"./chunk-NWOMSL6K.mjs";import{f as a,i as r}from"./chunk-SUJLWCRN.mjs";import{c as o}from"./chunk-QVJV46XS.mjs";import{n as u,q as g,r as A}from"./chunk-VHNX2NUR.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:g,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[{constraints:[]}],parameters:[p("0x1::object::Object"),new r,new a]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return c({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
|
|
2
|
+
//# sourceMappingURL=chunk-J2YQTDZL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b,c as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as h,c as d,e as m}from"./chunk-IVVWQKCF.mjs";import{a as c,b as u}from"./chunk-QFORDQCU.mjs";import{c as s}from"./chunk-CDLMUY5H.mjs";import{b,c as K}from"./chunk-YTQVMLFD.mjs";import{a as l}from"./chunk-DZXM2MQY.mjs";import{a as y}from"./chunk-A63SMUOU.mjs";import{b as p}from"./chunk-BCUSI3N6.mjs";import{randomBytes as E}from"@noble/hashes/utils";var S=1209600,i=class i extends y{constructor(e){super();let{privateKey:r,expiryDateSecs:a,blinder:n}=e;this.privateKey=r,this.publicKey=new c(r.publicKey()),this.expiryDateSecs=a||K(b()+S),this.blinder=n!==void 0?p.fromHexInput(n).toUint8Array():v();let t=h(this.publicKey.bcsToBytes(),93);t.push(BigInt(this.expiryDateSecs)),t.push(d(this.blinder));let x=m(t);this.nonce=x.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),a;switch(r){case 0:a=s.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let n=e.deserializeU64(),t=e.deserializeFixedBytes(31);return new i({privateKey:a,expiryDateSecs:Number(n),blinder:t})}static fromBytes(e){return i.deserialize(new l(e))}static generate(e){let r;switch(e?.scheme){case 0:default:r=s.generate()}return new i({privateKey:r,expiryDateSecs:e?.expiryDateSecs})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new u(this.privateKey.sign(e))}};i.BLINDER_LENGTH=31;var o=i;function v(){return E(o.BLINDER_LENGTH)}export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JDTU6Z6C.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as p}from"./chunk-5JTED2JJ.mjs";import{d as s}from"./chunk-QNTQPWLK.mjs";import{a as u,b as y}from"./chunk-UC5BZJ23.mjs";import{b as a}from"./chunk-4GETVCGY.mjs";import{c as i}from"./chunk-CDLMUY5H.mjs";import{b as g}from"./chunk-OHRL766V.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LKLHNQF5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-WMHYIP3S.mjs";import{b as a}from"./chunk-OHRL766V.mjs";import{a as i}from"./chunk-A63SMUOU.mjs";var o=class t extends i{constructor(e,r){super(),this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MULJ2GLJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as s}from"./chunk-QVJV46XS.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-IG7R65TF.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
|
|
2
|
+
//# sourceMappingURL=chunk-NV5YQZ3R.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as y,c as f,d as x,e as v,f as A,g as C,h as U,i as b,j as I,k as M,l as P,m as E,n as G,o as N}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as y,c as f,d as x,e as v,f as A,g as C,h as U,i as b,j as I,k as M,l as P,m as E,n as G,o as N}from"./chunk-SUJLWCRN.mjs";import{a as l}from"./chunk-YUNDX5I7.mjs";import{b as w}from"./chunk-OHRL766V.mjs";function V(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function W(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e){return!!e.match(/^&.+$/)}function k(e){switch(e){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function L(e,i){let c=i;for(;c<e.length;c+=1){let s=e[c];if(!W(s))break}return c}var R=(a=>(a.InvalidTypeTag="unknown type",a.UnexpectedGenericType="unexpected generic type",a.UnexpectedTypeArgumentClose="unexpected '>'",a.UnexpectedWhitespaceCharacter="unexpected whitespace character",a.UnexpectedComma="unexpected ','",a.TypeArgumentCountMismatch="type argument count doesn't match expected amount",a.MissingTypeArgumentClose="no matching '>' for '<'",a.MissingTypeArgument="no type argument before ','",a.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",a.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",a.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",a.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",a.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",a.InvalidAddress="struct address must be valid",a))(R||{}),t=class extends Error{constructor(i,c){super(`Failed to parse typeTag '${i}', ${c}`)}};function j(e,i){let c=i?.allowGenerics??!1,s=[],u=[],n=[],o=0,r="",T=1;for(;o<e.length;){let d=e[o];if(d==="<")s.push({savedExpectedTypes:T,savedStr:r,savedTypes:n}),r="",n=[],T=1;else if(d===">"){if(r!==""){let a=g(r,u,c);n.push(a)}let p=s.pop();if(p===void 0)throw new t(e,"unexpected '>'");if(T!==n.length)throw new t(e,"type argument count doesn't match expected amount");let{savedStr:m,savedTypes:h,savedExpectedTypes:_}=p;u=n,n=h,r=m,T=_}else if(d===","){if(s.length===0)throw new t(e,"unexpected ','");if(r.length===0)throw new t(e,"no type argument before ','");let p=g(r,u,c);u=[],n.push(p),r="",T+=1}else if(W(d)){let p=!1;if(r.length!==0){let h=g(r,u,c);u=[],n.push(h),r="",p=!0}o=L(e,o);let m=e[o];if(o<e.length&&p&&m!==","&&m!==">")throw new t(e,"unexpected whitespace character");continue}else r+=d;o+=1}if(s.length>0)throw new t(e,"no matching '>' for '<'");switch(n.length){case 0:return g(r,u,c);case 1:if(r==="")return n[0];throw new t(e,"unexpected ','");default:throw new t(e,"unexpected whitespace character")}}function g(e,i,c){let s=e.trim(),u=s.toLowerCase();if(k(u)&&i.length>0)throw new t(e,"primitive types not expected to have type arguments");switch(s.toLowerCase()){case"signer":return new I;case"bool":return new y;case"address":return new b;case"u8":return new f;case"u16":return new x;case"u32":return new v;case"u64":return new A;case"u128":return new C;case"u256":return new U;case"vector":if(i.length!==1)throw new t(e,"vector type expected to have exactly one type argument");return new E(i[0]);default:if(F(s)){let r=s.substring(1);return new M(g(r,i,c))}if($(s)){if(c)return new P(Number(s.split("T")[1]));throw new t(e,"unexpected generic type")}if(!s.match(/:/))throw new t(e,"unknown type");let n=s.split("::");if(n.length!==3)throw new t(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let o;try{o=w.fromString(n[0])}catch{throw new t(e,"struct address must be valid")}if(!V(n[1]))throw new t(e,"module name must only contain alphanumeric or '_' characters");if(!V(n[2]))throw new t(e,"struct name must only contain alphanumeric or '_' characters");return new G(new N(o,new l(n[1]),new l(n[2]),i))}}export{R as a,t as b,j as c};
|
|
2
|
+
//# sourceMappingURL=chunk-NWOMSL6K.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-YTQVMLFD.mjs";import{e as x,f as B}from"./chunk-QVJV46XS.mjs";import{a as k}from"./chunk-AH44UPM4.mjs";import{b as f,d as A}from"./chunk-BSAYHZ2R.mjs";import{a as b}from"./chunk-TDGQGILY.mjs";import{d as C}from"./chunk-L36ZHC7J.mjs";async function H(o){let{aptosConfig:n,options:t}=o;return A({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function G(o){let{aptosConfig:n}=o;return k(async()=>{let{data:t}=await f({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function W(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await f({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function y(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function O(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await y({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function R(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return s}async function q(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??20,u=s?.checkSuccess??!0,e=!0,p=0,i,g,l=200,h=1.5;function c(a){if(!(a instanceof b)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}try{i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(a){c(a)}if(e){let a=Date.now();try{i=await R({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(w){c(w)}p=(Date.now()-a)/1e3}for(;e&&!(p>=r);){try{if(i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction",!e)break}catch(a){c(a)}await d(l),p+=l/1e3,l*=h}if(i===void 0)throw g||new m(`Fetching transaction ${t} failed and timed out after ${r} seconds`,i);if(i.type==="pending_transaction")throw new m(`Transaction ${t} timed out in pending state after ${r} seconds`,i);if(!u)return i;if(!i.success)throw new T(`Transaction ${t} failed with an error: ${i.vm_status}`,i);return i}async function z(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,u=new Date().getTime(),e=BigInt(-1);for(;e<s;){if(new Date().getTime()-u>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?e=await x({aptosConfig:n}):e=(await B({aptosConfig:n,processorType:t})).last_success_version,e>=s)break;await d(200)}}var m=class extends Error{constructor(n,t){super(n),this.lastSubmittedTransaction=t}},T=class extends Error{constructor(n,t){super(n),this.transaction=t}};async function U(o){let{aptosConfig:n,ledgerVersion:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function X(o){let{aptosConfig:n,blockHeight:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function P(o){let{aptosConfig:n,block:t,options:s}=o;if(s?.withTransactions){t.transactions=t.transactions??[];let r=t.transactions[t.transactions.length-1],u=BigInt(t.first_version),e=BigInt(t.last_version),p=r?.version,i;if(p===void 0?i=u-1n:i=BigInt(p),i===e)return t;let g=[],l=100n;for(let c=i+1n;c<e;c+=BigInt(100))g.push(H({aptosConfig:n,options:{offset:c,limit:Math.min(Number(l),Number(e-c+1n))}}));let h=await Promise.all(g);for(let c of h)t.transactions.push(...c)}return t}export{H as a,G as b,W as c,y as d,O as e,R as f,q as g,z as h,m as i,T as j,U as k,X as l};
|
|
2
|
+
//# sourceMappingURL=chunk-O2M3QKKS.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-A63SMUOU.mjs";import{a as i}from"./chunk-LG7RJQ57.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-A63SMUOU.mjs";import{a as i}from"./chunk-LG7RJQ57.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var g=(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))(g||{}),r=class r extends a{constructor(t){if(super(),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(c){throw new i(`Hex characters are invalid: ${c?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return typeof t=="string"?r.fromString(t):t instanceof Uint8Array?new r(t):t}static fromStrict(t){return typeof t=="string"?r.fromStringStrict(t):t instanceof Uint8Array?new r(t):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"),r.A=r.from("0xA");var d=r;export{g as a,d as b};
|
|
2
|
+
//# sourceMappingURL=chunk-OHRL766V.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromString(input);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromStringStrict(input);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"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","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromString(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromStringStrict(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"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","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as h,d as l}from"./chunk-CDLMUY5H.mjs";import{b as E}from"./chunk-76OH2Z4Q.mjs";import{a as p}from"./chunk-MLDQ2TY2.mjs";import{a as g}from"./chunk-G5MGSV7Y.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
|
|
2
|
+
//# sourceMappingURL=chunk-PR6363Y6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t,b as n,c as o,d as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t,b as n,c as o,d as r}from"./chunk-J2YQTDZL.mjs";import{a as s}from"./chunk-RP5444TL.mjs";import{b as i}from"./chunk-OHRL766V.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-PSCDBITI.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as t,d as n}from"./chunk-CDLMUY5H.mjs";import{a as u}from"./chunk-76OH2Z4Q.mjs";import{a as l}from"./chunk-MLDQ2TY2.mjs";import{a as s}from"./chunk-DZXM2MQY.mjs";import{b as o}from"./chunk-BCUSI3N6.mjs";var c=class i extends u{constructor(e){super();let r=e.constructor.name;switch(r){case t.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:a}=e;return this.publicKey.verifySignature({message:r,signature:a.signature})}serialize(e){if(this.publicKey instanceof t)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(t.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof i}},p=class i extends l{constructor(e){super();let r=e.constructor.name;switch(r){case n.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=o.fromHexInput(e),a=new s(r.toUint8Array());return i.deserialize(a)}serialize(e){if(this.signature instanceof n)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(n.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};export{c as a,p as b};
|
|
2
|
+
//# sourceMappingURL=chunk-QFORDQCU.mjs.map
|