@aptos-labs/ts-sdk 1.35.0-zeta.2 → 1.36.0-zeta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-Ce4Cv60D.d.ts → accountAddress-C685VEzA.d.ts} +11 -99
- package/dist/common/chunk-5GUWOXQG.js +4 -0
- package/dist/common/chunk-5GUWOXQG.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -486
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +9105 -8699
- package/dist/common/index.js +436 -18333
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-D4j3_WIS.d.mts → Ed25519Account-6KGApCPu.d.mts} +3 -3
- package/dist/esm/account/AbstractKeylessAccount.d.mts +23 -13
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -75
- package/dist/esm/account/AbstractedAccount.d.mts +10 -10
- package/dist/esm/account/AbstractedAccount.mjs +1 -74
- package/dist/esm/account/Account.d.mts +6 -6
- package/dist/esm/account/Account.mjs +1 -72
- package/dist/esm/account/AccountUtils.d.mts +11 -10
- package/dist/esm/account/AccountUtils.mjs +1 -78
- package/dist/esm/account/Ed25519Account.d.mts +5 -5
- package/dist/esm/account/Ed25519Account.mjs +1 -70
- package/dist/esm/account/EphemeralKeyPair.d.mts +3 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -50
- package/dist/esm/account/FederatedKeylessAccount.d.mts +12 -11
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -72
- package/dist/esm/account/KeylessAccount.d.mts +12 -11
- package/dist/esm/account/KeylessAccount.mjs +1 -72
- package/dist/esm/account/MultiEd25519Account.d.mts +9 -9
- package/dist/esm/account/MultiEd25519Account.mjs +1 -70
- package/dist/esm/account/MultiKeyAccount.d.mts +34 -12
- package/dist/esm/account/MultiKeyAccount.mjs +1 -74
- package/dist/esm/account/SingleKeyAccount.d.mts +5 -5
- package/dist/esm/account/SingleKeyAccount.mjs +1 -72
- package/dist/esm/account/index.d.mts +7 -6
- package/dist/esm/account/index.mjs +1 -119
- package/dist/esm/account/utils.mjs +1 -54
- package/dist/esm/api/account/abstraction.d.mts +9 -9
- package/dist/esm/api/account/abstraction.mjs +1 -101
- package/dist/esm/api/account.d.mts +4 -20
- package/dist/esm/api/account.mjs +1 -105
- package/dist/esm/api/ans.d.mts +13 -13
- package/dist/esm/api/ans.mjs +1 -101
- package/dist/esm/api/aptos.d.mts +6 -5
- package/dist/esm/api/aptos.mjs +1 -139
- package/dist/esm/api/aptosConfig.mjs +1 -9
- package/dist/esm/api/coin.d.mts +9 -9
- package/dist/esm/api/coin.mjs +1 -100
- package/dist/esm/api/digitalAsset.d.mts +5 -5
- package/dist/esm/api/digitalAsset.mjs +1 -101
- package/dist/esm/api/event.mjs +1 -59
- package/dist/esm/api/experimental.d.mts +7 -7
- package/dist/esm/api/experimental.mjs +1 -85
- package/dist/esm/api/faucet.mjs +1 -58
- package/dist/esm/api/fungibleAsset.d.mts +13 -13
- package/dist/esm/api/fungibleAsset.mjs +1 -101
- package/dist/esm/api/general.d.mts +7 -7
- package/dist/esm/api/general.mjs +1 -85
- package/dist/esm/api/index.d.mts +6 -5
- package/dist/esm/api/index.mjs +1 -143
- package/dist/esm/api/keyless.d.mts +20 -19
- package/dist/esm/api/keyless.mjs +1 -102
- package/dist/esm/api/object.mjs +1 -59
- package/dist/esm/api/staking.mjs +1 -59
- package/dist/esm/api/table.mjs +1 -38
- package/dist/esm/api/transaction.d.mts +4 -4
- package/dist/esm/api/transaction.mjs +1 -110
- package/dist/esm/api/transactionSubmission/build.d.mts +9 -9
- package/dist/esm/api/transactionSubmission/build.mjs +1 -99
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/management.mjs +1 -105
- package/dist/esm/api/transactionSubmission/sign.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -218
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -100
- package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -100
- package/dist/esm/api/utils.mjs +1 -36
- package/dist/esm/bcs/consts.mjs +1 -17
- package/dist/esm/bcs/deserializer.mjs +1 -10
- package/dist/esm/bcs/index.mjs +1 -60
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -26
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -22
- package/dist/esm/bcs/serializer.mjs +1 -18
- package/dist/esm/chunk-2V636AYW.mjs +2 -0
- package/dist/esm/{chunk-3IWV2Q3K.mjs.map → chunk-2V636AYW.mjs.map} +1 -1
- package/dist/esm/chunk-35CO4BP4.mjs +2 -0
- package/dist/esm/chunk-35CO4BP4.mjs.map +1 -0
- package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
- package/dist/esm/{chunk-GUA5YTIK.mjs.map → chunk-35DKMW7Q.mjs.map} +1 -1
- package/dist/esm/chunk-3EUHEZND.mjs +2 -0
- package/dist/esm/{chunk-G34CJDST.mjs.map → chunk-3EUHEZND.mjs.map} +1 -1
- package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
- package/dist/esm/{chunk-G4NBRMZ2.mjs.map → chunk-3OLFJ65O.mjs.map} +1 -1
- package/dist/esm/chunk-3RVAGHAA.mjs +2 -0
- package/dist/esm/{chunk-XQFUKBY7.mjs.map → chunk-3RVAGHAA.mjs.map} +1 -1
- package/dist/esm/chunk-4RXKALLC.mjs +2 -0
- package/dist/esm/{chunk-SFLQPB72.mjs.map → chunk-4RXKALLC.mjs.map} +1 -1
- package/dist/esm/chunk-56CNRT2K.mjs +2 -0
- package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
- package/dist/esm/chunk-6KE4JZD6.mjs +2 -0
- package/dist/esm/chunk-6KE4JZD6.mjs.map +1 -0
- package/dist/esm/chunk-7CRQNXR5.mjs +2 -0
- package/dist/esm/{chunk-YU65LNIC.mjs.map → chunk-7CRQNXR5.mjs.map} +1 -1
- package/dist/esm/chunk-7YTGBTWH.mjs +2 -0
- package/dist/esm/chunk-7YTGBTWH.mjs.map +1 -0
- package/dist/esm/chunk-A3VO773Q.mjs +2 -0
- package/dist/esm/{chunk-KLUO6XPE.mjs.map → chunk-A3VO773Q.mjs.map} +1 -1
- package/dist/esm/chunk-A5L76YP7.mjs +2 -0
- package/dist/esm/{chunk-PT2QHUB6.mjs.map → chunk-A5L76YP7.mjs.map} +1 -1
- package/dist/esm/chunk-AEGA5N2W.mjs +2 -0
- package/dist/esm/{chunk-QJ6CGH7N.mjs.map → chunk-AEGA5N2W.mjs.map} +1 -1
- package/dist/esm/chunk-AIPHJFJL.mjs +2 -0
- package/dist/esm/{chunk-6I37A76G.mjs.map → chunk-AIPHJFJL.mjs.map} +1 -1
- package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
- package/dist/esm/{chunk-MWXBQ6HR.mjs.map → chunk-BMPHQ3E7.mjs.map} +1 -1
- package/dist/esm/chunk-C3Q23D22.mjs +2 -0
- package/dist/esm/{chunk-F7W7KS5C.mjs.map → chunk-C3Q23D22.mjs.map} +1 -1
- package/dist/esm/chunk-CWL7ZA3P.mjs +2 -0
- package/dist/esm/{chunk-6T3V5LXK.mjs.map → chunk-CWL7ZA3P.mjs.map} +1 -1
- package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
- package/dist/esm/{chunk-THWEBWUC.mjs.map → chunk-DOVH6HPL.mjs.map} +1 -1
- package/dist/esm/chunk-EODSU3YN.mjs +2 -0
- package/dist/esm/{chunk-WXQUBQK4.mjs.map → chunk-EODSU3YN.mjs.map} +1 -1
- package/dist/esm/chunk-ERLDXTIY.mjs +2 -0
- package/dist/esm/{chunk-6ASWESA2.mjs.map → chunk-ERLDXTIY.mjs.map} +1 -1
- package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
- package/dist/esm/{chunk-APM7OSLS.mjs.map → chunk-GOXRBEIJ.mjs.map} +1 -1
- package/dist/esm/chunk-HHWJHOFZ.mjs +2 -0
- package/dist/esm/{chunk-KSK3XIGF.mjs.map → chunk-HHWJHOFZ.mjs.map} +1 -1
- package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
- package/dist/esm/{chunk-QPT4BSAB.mjs.map → chunk-IF4UU2MT.mjs.map} +1 -1
- package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
- package/dist/esm/{chunk-LJRNGZMY.mjs.map → chunk-IMTC3J2M.mjs.map} +1 -1
- package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
- package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
- package/dist/esm/{chunk-OFUNBTK4.mjs.map → chunk-KSLLV3ZC.mjs.map} +1 -1
- package/dist/esm/chunk-KXVD52Y6.mjs +2 -0
- package/dist/esm/{chunk-YT7V6AVJ.mjs.map → chunk-KXVD52Y6.mjs.map} +1 -1
- package/dist/esm/chunk-LGC2JORV.mjs +2 -0
- package/dist/esm/chunk-LGC2JORV.mjs.map +1 -0
- package/dist/esm/chunk-LQOSHBB7.mjs +4 -0
- package/dist/esm/{chunk-CXLXUSCG.mjs.map → chunk-LQOSHBB7.mjs.map} +1 -1
- package/dist/esm/chunk-LS3IDL2N.mjs +2 -0
- package/dist/esm/{chunk-MYEYZ7PF.mjs.map → chunk-LS3IDL2N.mjs.map} +1 -1
- package/dist/esm/chunk-MIW45ADL.mjs +2 -0
- package/dist/esm/chunk-MIW45ADL.mjs.map +1 -0
- package/dist/esm/chunk-NFPNWY6Z.mjs +4 -0
- package/dist/esm/chunk-NFPNWY6Z.mjs.map +1 -0
- package/dist/esm/chunk-PDAWVDI7.mjs +2 -0
- package/dist/esm/{chunk-MFFBZ43D.mjs.map → chunk-PDAWVDI7.mjs.map} +1 -1
- package/dist/esm/chunk-PSZYS4RG.mjs +2 -0
- package/dist/esm/{chunk-YK66QBML.mjs.map → chunk-PSZYS4RG.mjs.map} +1 -1
- package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
- package/dist/esm/{chunk-SQNS4SFV.mjs.map → chunk-R6QCPXQG.mjs.map} +1 -1
- package/dist/esm/chunk-RIINVEZA.mjs +2 -0
- package/dist/esm/{chunk-Y3ENAKRC.mjs.map → chunk-RIINVEZA.mjs.map} +1 -1
- package/dist/esm/chunk-RJ7F4JDV.mjs +2 -0
- package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
- package/dist/esm/chunk-RXHER6EA.mjs +2 -0
- package/dist/esm/{chunk-C7T6GW5P.mjs.map → chunk-RXHER6EA.mjs.map} +1 -1
- package/dist/esm/chunk-RXMLONF7.mjs +2 -0
- package/dist/esm/{chunk-BU43ZFDJ.mjs.map → chunk-RXMLONF7.mjs.map} +1 -1
- package/dist/esm/chunk-TBY3VMMV.mjs +2 -0
- package/dist/esm/chunk-TBY3VMMV.mjs.map +1 -0
- package/dist/esm/chunk-TKXEVD7A.mjs +2 -0
- package/dist/esm/{chunk-QSYWLSSN.mjs.map → chunk-TKXEVD7A.mjs.map} +1 -1
- package/dist/esm/chunk-TNWABITK.mjs +2 -0
- package/dist/esm/{chunk-FRLS4GRM.mjs.map → chunk-TNWABITK.mjs.map} +1 -1
- package/dist/esm/chunk-TTY5GFMN.mjs +2 -0
- package/dist/esm/{chunk-PKUXOBIV.mjs.map → chunk-TTY5GFMN.mjs.map} +1 -1
- package/dist/esm/chunk-VHNX2NUR.mjs +473 -0
- package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
- package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
- package/dist/esm/{chunk-BDM6FBUO.mjs.map → chunk-VHY6ZATX.mjs.map} +1 -1
- package/dist/esm/chunk-W4BSN6SK.mjs +2 -0
- package/dist/esm/{chunk-ZWCTF3NQ.mjs.map → chunk-W4BSN6SK.mjs.map} +1 -1
- package/dist/esm/chunk-WB26DWOY.mjs +7 -0
- package/dist/esm/chunk-WB26DWOY.mjs.map +1 -0
- package/dist/esm/chunk-X5YB74NB.mjs +2 -0
- package/dist/esm/{chunk-I25AX6PQ.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
- package/dist/esm/chunk-XLDMPCLF.mjs +2 -0
- package/dist/esm/{chunk-WLTQHGIJ.mjs.map → chunk-XLDMPCLF.mjs.map} +1 -1
- package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
- package/dist/esm/{chunk-BEYIOC2H.mjs.map → chunk-YOZBVVKL.mjs.map} +1 -1
- package/dist/esm/chunk-ZD2TY5N3.mjs +2 -0
- package/dist/esm/{chunk-NUT2VOX2.mjs.map → chunk-ZD2TY5N3.mjs.map} +1 -1
- package/dist/esm/chunk-ZELTLAUN.mjs +2 -0
- package/dist/esm/chunk-ZELTLAUN.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -20
- package/dist/esm/cli/localNode.mjs +1 -16
- package/dist/esm/cli/move.mjs +1 -7
- package/dist/esm/client/core.mjs +1 -34
- package/dist/esm/client/get.mjs +1 -41
- package/dist/esm/client/index.mjs +1 -69
- package/dist/esm/client/post.mjs +1 -43
- package/dist/esm/core/account/index.mjs +1 -21
- package/dist/esm/core/account/utils/address.mjs +1 -19
- package/dist/esm/core/account/utils/index.mjs +1 -20
- package/dist/esm/core/accountAddress.mjs +1 -16
- package/dist/esm/core/authenticationKey.d.mts +3 -1
- package/dist/esm/core/authenticationKey.mjs +1 -15
- package/dist/esm/core/common.mjs +1 -7
- package/dist/esm/core/crypto/abstraction.d.mts +4 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -26
- package/dist/esm/core/crypto/ed25519.d.mts +18 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -33
- package/dist/esm/core/crypto/ephemeral.d.mts +8 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -30
- package/dist/esm/core/crypto/federatedKeyless.d.mts +11 -87
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -44
- package/dist/esm/core/crypto/hdKey.mjs +1 -25
- package/dist/esm/core/crypto/index.d.mts +8 -6
- package/dist/esm/core/crypto/index.mjs +1 -173
- package/dist/esm/core/crypto/keyless.d.mts +13 -586
- package/dist/esm/core/crypto/keyless.mjs +1 -83
- package/dist/esm/core/crypto/multiEd25519.d.mts +14 -4
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -50
- package/dist/esm/core/crypto/multiKey.d.mts +39 -3
- package/dist/esm/core/crypto/multiKey.mjs +1 -51
- package/dist/esm/core/crypto/poseidon.mjs +1 -15
- package/dist/esm/core/crypto/privateKey.d.mts +3 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -12
- package/dist/esm/core/crypto/proof.mjs +1 -20
- package/dist/esm/core/crypto/publicKey.d.mts +3 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -22
- package/dist/esm/core/crypto/secp256k1.d.mts +26 -2
- package/dist/esm/core/crypto/secp256k1.mjs +1 -29
- package/dist/esm/core/crypto/signature.mjs +1 -20
- package/dist/esm/core/crypto/singleKey.d.mts +27 -5
- package/dist/esm/core/crypto/singleKey.mjs +1 -48
- package/dist/esm/core/crypto/utils.mjs +1 -9
- package/dist/esm/core/hex.mjs +1 -12
- package/dist/esm/core/index.d.mts +8 -6
- package/dist/esm/core/index.mjs +1 -202
- package/dist/esm/errors/index.d.mts +10 -2
- package/dist/esm/errors/index.mjs +1 -25
- package/dist/esm/federatedKeyless-Qe_j8OqV.d.mts +875 -0
- package/dist/esm/index.d.mts +11 -10
- package/dist/esm/index.mjs +1 -798
- package/dist/esm/internal/abstraction.d.mts +9 -9
- package/dist/esm/internal/abstraction.mjs +1 -103
- package/dist/esm/internal/account.d.mts +7 -24
- package/dist/esm/internal/account.mjs +1 -142
- package/dist/esm/internal/ans.d.mts +13 -13
- package/dist/esm/internal/ans.mjs +1 -138
- package/dist/esm/internal/coin.d.mts +7 -7
- package/dist/esm/internal/coin.mjs +1 -99
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -145
- package/dist/esm/internal/event.mjs +1 -62
- package/dist/esm/internal/experimental.d.mts +7 -7
- package/dist/esm/internal/experimental.mjs +1 -84
- package/dist/esm/internal/faucet.mjs +1 -57
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -105
- package/dist/esm/internal/general.mjs +1 -43
- package/dist/esm/internal/keyless.d.mts +10 -20
- package/dist/esm/internal/keyless.mjs +1 -107
- package/dist/esm/internal/object.mjs +1 -58
- package/dist/esm/internal/staking.mjs +1 -60
- package/dist/esm/internal/table.mjs +1 -38
- package/dist/esm/internal/transaction.mjs +1 -57
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.mjs +1 -118
- package/dist/esm/internal/utils/index.mjs +1 -38
- package/dist/esm/internal/utils/utils.mjs +1 -37
- package/dist/esm/internal/view.d.mts +7 -7
- package/dist/esm/internal/view.mjs +1 -86
- package/dist/esm/{publicKey-BMtGNNLg.d.mts → publicKey-pDHBAZlT.d.mts} +27 -1
- package/dist/esm/transactions/authenticator/account.d.mts +3 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -67
- package/dist/esm/transactions/authenticator/index.d.mts +3 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -82
- package/dist/esm/transactions/authenticator/transaction.d.mts +4 -2
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -66
- package/dist/esm/transactions/index.d.mts +4 -4
- package/dist/esm/transactions/index.mjs +1 -296
- package/dist/esm/transactions/instances/chainId.mjs +1 -11
- package/dist/esm/transactions/instances/identifier.mjs +1 -11
- package/dist/esm/transactions/instances/index.d.mts +4 -2
- package/dist/esm/transactions/instances/index.mjs +1 -114
- package/dist/esm/transactions/instances/moduleId.mjs +1 -55
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -60
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -65
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +3 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -21
- package/dist/esm/transactions/instances/signedTransaction.d.mts +3 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -63
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -60
- package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -73
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -101
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -111
- package/dist/esm/transactions/management/transactionWorker.d.mts +3 -3
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -107
- package/dist/esm/transactions/scriptComposer/index.d.mts +7 -7
- package/dist/esm/transactions/scriptComposer/index.mjs +1 -80
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -92
- package/dist/esm/transactions/transactionBuilder/index.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -166
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +34 -23
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -74
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -7
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -75
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -97
- package/dist/esm/transactions/typeTag/index.d.mts +16 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -91
- package/dist/esm/transactions/typeTag/parser.mjs +1 -60
- package/dist/esm/transactions/types.d.mts +5 -5
- package/dist/esm/transactions/types.mjs +1 -1
- package/dist/esm/types/abstraction.mjs +1 -7
- package/dist/esm/types/generated/operations.d.mts +10 -63
- package/dist/esm/types/generated/queries.d.mts +2 -10
- package/dist/esm/types/generated/queries.mjs +1 -69
- package/dist/esm/types/generated/types.d.mts +1054 -824
- package/dist/esm/types/generated/types.mjs +1 -774
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +2 -2
- package/dist/esm/types/index.mjs +1 -82
- package/dist/esm/types/indexer.d.mts +2 -14
- package/dist/esm/types/indexer.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +1 -1
- package/dist/esm/types/types.d.mts +3 -58
- package/dist/esm/types/types.mjs +1 -77
- package/dist/esm/utils/apiEndpoints.mjs +1 -21
- package/dist/esm/utils/const.d.mts +1 -1
- package/dist/esm/utils/const.mjs +1 -25
- package/dist/esm/utils/helpers.d.mts +2 -1
- package/dist/esm/utils/helpers.mjs +1 -37
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -88
- package/dist/esm/utils/memoize.mjs +1 -9
- package/dist/esm/utils/normalizeBundle.mjs +1 -20
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -7
- package/package.json +3 -3
- package/src/account/AbstractKeylessAccount.ts +33 -49
- package/src/account/MultiKeyAccount.ts +23 -16
- package/src/api/account.ts +2 -56
- package/src/cli/localNode.ts +6 -15
- package/src/core/crypto/abstraction.ts +6 -1
- package/src/core/crypto/ed25519.ts +19 -1
- package/src/core/crypto/ephemeral.ts +9 -0
- package/src/core/crypto/federatedKeyless.ts +40 -4
- package/src/core/crypto/index.ts +4 -3
- package/src/core/crypto/keyless.ts +577 -17
- package/src/core/crypto/multiEd25519.ts +11 -3
- package/src/core/crypto/multiKey.ts +74 -4
- package/src/core/crypto/publicKey.ts +28 -0
- package/src/core/crypto/secp256k1.ts +25 -2
- package/src/core/crypto/singleKey.ts +32 -7
- package/src/errors/index.ts +50 -0
- package/src/internal/account.ts +2 -395
- package/src/internal/keyless.ts +9 -17
- package/src/transactions/scriptComposer/index.ts +19 -6
- package/src/transactions/transactionBuilder/remoteAbi.ts +107 -35
- package/src/transactions/typeTag/index.ts +22 -0
- package/src/types/codegen.yaml +1 -1
- package/src/types/generated/operations.ts +8 -69
- package/src/types/generated/queries.ts +0 -111
- package/src/types/generated/types.ts +1159 -951
- package/src/types/indexer.ts +0 -16
- package/src/types/keyless.ts +1 -1
- package/src/types/types.ts +3 -62
- package/src/utils/const.ts +1 -1
- package/src/utils/helpers.ts +11 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-JMOQXLED.js +0 -1305
- package/dist/common/chunk-JMOQXLED.js.map +0 -1
- package/dist/esm/chunk-2FTF6J7F.mjs +0 -97
- package/dist/esm/chunk-2FTF6J7F.mjs.map +0 -1
- package/dist/esm/chunk-2HL7JEFC.mjs +0 -829
- package/dist/esm/chunk-2HL7JEFC.mjs.map +0 -1
- package/dist/esm/chunk-2WBJAKBO.mjs +0 -53
- package/dist/esm/chunk-2WBJAKBO.mjs.map +0 -1
- package/dist/esm/chunk-32UQAST6.mjs +0 -296
- package/dist/esm/chunk-32UQAST6.mjs.map +0 -1
- package/dist/esm/chunk-3DAVHDK4.mjs +0 -195
- package/dist/esm/chunk-3DAVHDK4.mjs.map +0 -1
- package/dist/esm/chunk-3IWV2Q3K.mjs +0 -12
- package/dist/esm/chunk-3TUV6YMI.mjs +0 -305
- package/dist/esm/chunk-3TUV6YMI.mjs.map +0 -1
- package/dist/esm/chunk-4NMDYPUD.mjs +0 -1
- package/dist/esm/chunk-56UCIGTO.mjs +0 -21
- package/dist/esm/chunk-56UCIGTO.mjs.map +0 -1
- package/dist/esm/chunk-5ORUQZAR.mjs +0 -100
- package/dist/esm/chunk-5ORUQZAR.mjs.map +0 -1
- package/dist/esm/chunk-5QHMFYVL.mjs +0 -42
- package/dist/esm/chunk-5QHMFYVL.mjs.map +0 -1
- package/dist/esm/chunk-62LC4PPC.mjs +0 -128
- package/dist/esm/chunk-62LC4PPC.mjs.map +0 -1
- package/dist/esm/chunk-6ASWESA2.mjs +0 -77
- package/dist/esm/chunk-6I37A76G.mjs +0 -29
- package/dist/esm/chunk-6OFCIXWS.mjs +0 -379
- package/dist/esm/chunk-6OFCIXWS.mjs.map +0 -1
- package/dist/esm/chunk-6SNGKTWE.mjs +0 -91
- package/dist/esm/chunk-6SNGKTWE.mjs.map +0 -1
- package/dist/esm/chunk-6T3V5LXK.mjs +0 -119
- package/dist/esm/chunk-7F32C225.mjs +0 -219
- package/dist/esm/chunk-7F32C225.mjs.map +0 -1
- package/dist/esm/chunk-7WW735TU.mjs +0 -276
- package/dist/esm/chunk-7WW735TU.mjs.map +0 -1
- package/dist/esm/chunk-A33OBGVN.mjs +0 -1014
- package/dist/esm/chunk-A33OBGVN.mjs.map +0 -1
- package/dist/esm/chunk-A7LYGPFL.mjs +0 -208
- package/dist/esm/chunk-A7LYGPFL.mjs.map +0 -1
- package/dist/esm/chunk-AGKEC2IM.mjs +0 -250
- package/dist/esm/chunk-AGKEC2IM.mjs.map +0 -1
- package/dist/esm/chunk-AKXCFBYF.mjs +0 -49
- package/dist/esm/chunk-AKXCFBYF.mjs.map +0 -1
- package/dist/esm/chunk-APM7OSLS.mjs +0 -122
- package/dist/esm/chunk-BDM6FBUO.mjs +0 -198
- package/dist/esm/chunk-BEYIOC2H.mjs +0 -34
- package/dist/esm/chunk-BMM72IIP.mjs +0 -250
- package/dist/esm/chunk-BMM72IIP.mjs.map +0 -1
- package/dist/esm/chunk-BSCOVLWS.mjs +0 -1
- package/dist/esm/chunk-BSCOVLWS.mjs.map +0 -1
- package/dist/esm/chunk-BU43ZFDJ.mjs +0 -281
- package/dist/esm/chunk-C7EEG6SW.mjs +0 -689
- package/dist/esm/chunk-C7EEG6SW.mjs.map +0 -1
- package/dist/esm/chunk-C7T6GW5P.mjs +0 -376
- package/dist/esm/chunk-CXLXUSCG.mjs +0 -417
- package/dist/esm/chunk-D4MW64RH.mjs +0 -188
- package/dist/esm/chunk-D4MW64RH.mjs.map +0 -1
- package/dist/esm/chunk-D6RXVCE3.mjs +0 -86
- package/dist/esm/chunk-D6RXVCE3.mjs.map +0 -1
- package/dist/esm/chunk-DDZGHA66.mjs +0 -495
- package/dist/esm/chunk-DDZGHA66.mjs.map +0 -1
- package/dist/esm/chunk-DGDZNHUJ.mjs +0 -72
- package/dist/esm/chunk-DGDZNHUJ.mjs.map +0 -1
- package/dist/esm/chunk-DMFRIING.mjs +0 -286
- package/dist/esm/chunk-DMFRIING.mjs.map +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs.map +0 -1
- package/dist/esm/chunk-EBFKT35C.mjs +0 -66
- package/dist/esm/chunk-EBFKT35C.mjs.map +0 -1
- package/dist/esm/chunk-ECTX2FGD.mjs +0 -355
- package/dist/esm/chunk-ECTX2FGD.mjs.map +0 -1
- package/dist/esm/chunk-EPTUAWRA.mjs +0 -895
- package/dist/esm/chunk-EPTUAWRA.mjs.map +0 -1
- package/dist/esm/chunk-F4VI7BNX.mjs +0 -58
- package/dist/esm/chunk-F4VI7BNX.mjs.map +0 -1
- package/dist/esm/chunk-F7W7KS5C.mjs +0 -52
- package/dist/esm/chunk-FDMI4BUL.mjs +0 -611
- package/dist/esm/chunk-FDMI4BUL.mjs.map +0 -1
- package/dist/esm/chunk-FMNMYKYH.mjs +0 -71
- package/dist/esm/chunk-FMNMYKYH.mjs.map +0 -1
- package/dist/esm/chunk-FRLS4GRM.mjs +0 -62
- package/dist/esm/chunk-G34CJDST.mjs +0 -139
- package/dist/esm/chunk-G4NBRMZ2.mjs +0 -7
- package/dist/esm/chunk-G6R77JKO.mjs +0 -121
- package/dist/esm/chunk-G6R77JKO.mjs.map +0 -1
- package/dist/esm/chunk-G7BB6K4B.mjs +0 -167
- package/dist/esm/chunk-G7BB6K4B.mjs.map +0 -1
- package/dist/esm/chunk-GCQK2S5Q.mjs +0 -43
- package/dist/esm/chunk-GCQK2S5Q.mjs.map +0 -1
- package/dist/esm/chunk-GFPEB22G.mjs +0 -1
- package/dist/esm/chunk-GFPEB22G.mjs.map +0 -1
- package/dist/esm/chunk-GUA5YTIK.mjs +0 -362
- package/dist/esm/chunk-HBXBODME.mjs +0 -84
- package/dist/esm/chunk-HBXBODME.mjs.map +0 -1
- package/dist/esm/chunk-HEZ2ZYZA.mjs +0 -1
- package/dist/esm/chunk-HEZ2ZYZA.mjs.map +0 -1
- package/dist/esm/chunk-HKQY5GXT.mjs +0 -231
- package/dist/esm/chunk-HKQY5GXT.mjs.map +0 -1
- package/dist/esm/chunk-HL337SEM.mjs +0 -219
- package/dist/esm/chunk-HL337SEM.mjs.map +0 -1
- package/dist/esm/chunk-HQDHSKVS.mjs +0 -74
- package/dist/esm/chunk-HQDHSKVS.mjs.map +0 -1
- package/dist/esm/chunk-I25AX6PQ.mjs +0 -7
- package/dist/esm/chunk-I5G7XFGT.mjs +0 -86
- package/dist/esm/chunk-I5G7XFGT.mjs.map +0 -1
- package/dist/esm/chunk-IHYTP2EW.mjs +0 -1
- package/dist/esm/chunk-IHYTP2EW.mjs.map +0 -1
- package/dist/esm/chunk-IJ7XCPP3.mjs +0 -480
- package/dist/esm/chunk-IJ7XCPP3.mjs.map +0 -1
- package/dist/esm/chunk-ILTEOGFF.mjs +0 -407
- package/dist/esm/chunk-ILTEOGFF.mjs.map +0 -1
- package/dist/esm/chunk-IP7GATDH.mjs +0 -322
- package/dist/esm/chunk-IP7GATDH.mjs.map +0 -1
- package/dist/esm/chunk-IPUAVRGL.mjs +0 -248
- package/dist/esm/chunk-IPUAVRGL.mjs.map +0 -1
- package/dist/esm/chunk-IQVHXOD3.mjs +0 -192
- package/dist/esm/chunk-IQVHXOD3.mjs.map +0 -1
- package/dist/esm/chunk-JAZJE3OR.mjs +0 -45
- package/dist/esm/chunk-JAZJE3OR.mjs.map +0 -1
- package/dist/esm/chunk-JEVGHYEP.mjs +0 -162
- package/dist/esm/chunk-JEVGHYEP.mjs.map +0 -1
- package/dist/esm/chunk-JFMFZ2IL.mjs +0 -147
- package/dist/esm/chunk-JFMFZ2IL.mjs.map +0 -1
- package/dist/esm/chunk-JQIRRM7G.mjs +0 -195
- package/dist/esm/chunk-JQIRRM7G.mjs.map +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
- package/dist/esm/chunk-K5OCDM3W.mjs +0 -207
- package/dist/esm/chunk-K5OCDM3W.mjs.map +0 -1
- package/dist/esm/chunk-KLUO6XPE.mjs +0 -33
- package/dist/esm/chunk-KSK3XIGF.mjs +0 -502
- package/dist/esm/chunk-KW64NP2F.mjs +0 -71
- package/dist/esm/chunk-KW64NP2F.mjs.map +0 -1
- package/dist/esm/chunk-LJRNGZMY.mjs +0 -10
- package/dist/esm/chunk-MFFBZ43D.mjs +0 -45
- package/dist/esm/chunk-MWXBQ6HR.mjs +0 -15
- package/dist/esm/chunk-MYEYZ7PF.mjs +0 -46
- package/dist/esm/chunk-NUT2VOX2.mjs +0 -317
- package/dist/esm/chunk-OFUNBTK4.mjs +0 -169
- package/dist/esm/chunk-ORCQEMJL.mjs +0 -51
- package/dist/esm/chunk-ORCQEMJL.mjs.map +0 -1
- package/dist/esm/chunk-PGFEUN7K.mjs +0 -129
- package/dist/esm/chunk-PGFEUN7K.mjs.map +0 -1
- package/dist/esm/chunk-PKUXOBIV.mjs +0 -138
- package/dist/esm/chunk-PT2QHUB6.mjs +0 -96
- package/dist/esm/chunk-QJ6CGH7N.mjs +0 -71
- package/dist/esm/chunk-QPT4BSAB.mjs +0 -20
- package/dist/esm/chunk-QSYWLSSN.mjs +0 -216
- package/dist/esm/chunk-QYNYDQE3.mjs +0 -288
- package/dist/esm/chunk-QYNYDQE3.mjs.map +0 -1
- package/dist/esm/chunk-R45SPK6Q.mjs +0 -61
- package/dist/esm/chunk-R45SPK6Q.mjs.map +0 -1
- package/dist/esm/chunk-R4JTQQBX.mjs +0 -37
- package/dist/esm/chunk-R4JTQQBX.mjs.map +0 -1
- package/dist/esm/chunk-RCXGTN36.mjs +0 -58
- package/dist/esm/chunk-RCXGTN36.mjs.map +0 -1
- package/dist/esm/chunk-RMMOF53Q.mjs +0 -1
- package/dist/esm/chunk-RMMOF53Q.mjs.map +0 -1
- package/dist/esm/chunk-RQS33JAS.mjs +0 -77
- package/dist/esm/chunk-RQS33JAS.mjs.map +0 -1
- package/dist/esm/chunk-SAWN7RJP.mjs +0 -15
- package/dist/esm/chunk-SAWN7RJP.mjs.map +0 -1
- package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
- package/dist/esm/chunk-SFLQPB72.mjs +0 -63
- package/dist/esm/chunk-SPI2HO3E.mjs +0 -177
- package/dist/esm/chunk-SPI2HO3E.mjs.map +0 -1
- package/dist/esm/chunk-SPVJXZL5.mjs +0 -865
- package/dist/esm/chunk-SPVJXZL5.mjs.map +0 -1
- package/dist/esm/chunk-SQNS4SFV.mjs +0 -232
- package/dist/esm/chunk-SRXIHVZE.mjs +0 -50
- package/dist/esm/chunk-SRXIHVZE.mjs.map +0 -1
- package/dist/esm/chunk-T4BFWV46.mjs +0 -63
- package/dist/esm/chunk-T4BFWV46.mjs.map +0 -1
- package/dist/esm/chunk-T573PCIR.mjs +0 -700
- package/dist/esm/chunk-T573PCIR.mjs.map +0 -1
- package/dist/esm/chunk-TDLL7QX5.mjs +0 -239
- package/dist/esm/chunk-TDLL7QX5.mjs.map +0 -1
- package/dist/esm/chunk-TFW6N66T.mjs +0 -415
- package/dist/esm/chunk-TFW6N66T.mjs.map +0 -1
- package/dist/esm/chunk-THWEBWUC.mjs +0 -20
- package/dist/esm/chunk-TJDF4CXI.mjs +0 -513
- package/dist/esm/chunk-TJDF4CXI.mjs.map +0 -1
- package/dist/esm/chunk-TL4Z4KHK.mjs +0 -70
- package/dist/esm/chunk-TL4Z4KHK.mjs.map +0 -1
- package/dist/esm/chunk-UGFIWCJQ.mjs +0 -130
- package/dist/esm/chunk-UGFIWCJQ.mjs.map +0 -1
- package/dist/esm/chunk-UGKZQUGE.mjs +0 -367
- package/dist/esm/chunk-UGKZQUGE.mjs.map +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs.map +0 -1
- package/dist/esm/chunk-UK7SPHIE.mjs +0 -420
- package/dist/esm/chunk-UK7SPHIE.mjs.map +0 -1
- package/dist/esm/chunk-UOHCJOXI.mjs +0 -150
- package/dist/esm/chunk-UOHCJOXI.mjs.map +0 -1
- package/dist/esm/chunk-WHSS6I7T.mjs +0 -90
- package/dist/esm/chunk-WHSS6I7T.mjs.map +0 -1
- package/dist/esm/chunk-WLTQHGIJ.mjs +0 -177
- package/dist/esm/chunk-WUM247HF.mjs +0 -125
- package/dist/esm/chunk-WUM247HF.mjs.map +0 -1
- package/dist/esm/chunk-WXQUBQK4.mjs +0 -19
- package/dist/esm/chunk-X4N5BN3S.mjs +0 -40
- package/dist/esm/chunk-X4N5BN3S.mjs.map +0 -1
- package/dist/esm/chunk-XIBOO3WF.mjs +0 -168
- package/dist/esm/chunk-XIBOO3WF.mjs.map +0 -1
- package/dist/esm/chunk-XQFUKBY7.mjs +0 -136
- package/dist/esm/chunk-XX6C2QGI.mjs +0 -160
- package/dist/esm/chunk-XX6C2QGI.mjs.map +0 -1
- package/dist/esm/chunk-Y3ENAKRC.mjs +0 -73
- package/dist/esm/chunk-Y3M32DIB.mjs +0 -79
- package/dist/esm/chunk-Y3M32DIB.mjs.map +0 -1
- package/dist/esm/chunk-YK66QBML.mjs +0 -89
- package/dist/esm/chunk-YT7V6AVJ.mjs +0 -66
- package/dist/esm/chunk-YU65LNIC.mjs +0 -72
- package/dist/esm/chunk-ZRBUAZZD.mjs +0 -36
- package/dist/esm/chunk-ZRBUAZZD.mjs.map +0 -1
- package/dist/esm/chunk-ZWCTF3NQ.mjs +0 -25
- package/src/internal/queries/getAccountAddressForAuthKey.graphql +0 -8
- package/src/internal/queries/getAuthKeysForPublicKey.graphql +0 -9
- package/src/internal/queries/getMultiKeyForAuthKey.graphql +0 -9
- package/src/internal/queries/getSignatures.graphql +0 -13
- /package/dist/esm/{chunk-4NMDYPUD.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule, EphemeralKeyPair } from \"../account\";\nimport {\n AccountAddress,\n PrivateKey,\n AccountAddressInput,\n createObjectAddress,\n AccountPublicKey,\n PublicKey,\n} from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n MoveValue,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountsForPublicKey,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getPublicKeyFromAccountAddress,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, APTOS_FA, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { view } from \"../internal/view\";\nimport { isEncodedStruct, parseEncodedStruct } from \"../utils\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { AccountAbstraction } from \"./account/abstraction\";\nimport { DeriveKeylessAccountParams } from \"../internal/keyless\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n * @group Account\n */\nexport class Account {\n abstraction: AccountAbstraction;\n\n /**\n * Creates an instance of the Aptos client with the provided configuration.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Initialize the Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n constructor(readonly config: AptosConfig) {\n this.abstraction = new AccountAbstraction(config);\n }\n\n /**\n * Queries the current state for an Aptos account given its account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.accountAddress - The Aptos account address to query.\n * @returns The account data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve account information for a specific address\n * const accountInfo = await aptos.getAccountInfo({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(accountInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query modules for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.\n *\n * @returns - The account modules associated with the specified address.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account modules for a specific account\n * const accountModules = await aptos.getAccountModules({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first module\n * limit: 10, // limiting to 10 modules\n * },\n * });\n *\n * console.log(accountModules);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given an account address and module name.\n *\n * @param args.accountAddress - The Aptos account address.\n * @param args.moduleName - The name of the module.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns The account module associated with the specified account address and module name.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account module for a specific account address and module name\n * const module = await aptos.getAccountModule({\n * accountAddress: \"0x1\", // replace with a real account address\n * moduleName: \"MyModule\" // specify the module name\n * });\n *\n * console.log(module);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address.\n * This function may call the API multiple times to auto paginate and retrieve all account transactions.\n *\n * @param args.accountAddress - The Aptos account address to query transactions for.\n * @param args.options - Optional pagination arguments.\n * @param args.options.offset - The number of transactions to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n *\n * @returns The account transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch transactions for a specific account\n * const transactions = await aptos.getAccountTransactions({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first transaction\n * limit: 10, // limiting to 10 transactions\n * },\n * });\n *\n * console.log(transactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query resources for.\n * @param args.options.offset - The cursor to start returning results from. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Account resources.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account resources for a specific account address\n * const resources = await aptos.getAccountResources({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(resources);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given an account address and resource type.\n *\n * @template T - The typed output of the resource.\n * @param args.accountAddress - The Aptos account address to query.\n * @param args.resourceType - The string representation of an on-chain Move struct type, e.g., \"0x1::aptos_coin::AptosCoin\".\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns The account resource of the specified type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account resource for a specific account address and resource type\n * const resource = await aptos.getAccountResource({\n * accountAddress: \"0x1\", // replace with a real account address\n * resourceType: \"0x1::aptos_coin::AptosCoin\"\n * });\n *\n * console.log(resource);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.\n *\n * @param args.authenticationKey - The authentication key for which to look up the account address.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Promise<AccountAddress> - The account address associated with the authentication key.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Look up the original account address for a given authentication key\n * const accountAddress = await aptos.lookupOriginalAccountAddress({\n * authenticationKey: \"0x1\", // replace with a real authentication key\n * });\n *\n * console.log(\"Original Account Address:\", accountAddress);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by a specified account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address to query the token count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The current count of tokens owned by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of tokens owned by the account\n * const tokensCount = await aptos.getAccountTokensCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(`Tokens Count: ${tokensCount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the tokens currently owned by a specified account, including NFTs and fungible tokens.\n * If desired, you can filter the results by a specific token standard.\n *\n * @param args.accountAddress The account address for which to retrieve owned tokens.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard Optional filter for the NFT standard to query for.\n * @param args.options.offset Optional number to start returning results from.\n * @param args.options.limit Optional number of results to return.\n * @param args.options.orderBy Optional order to sort the tokens by.\n * @returns An array of tokens with their respective data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the tokens owned by a specific account\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify how many tokens to return\n * orderBy: \"created_at\", // specify the order of the results\n * },\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address.\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the tokens for.\n * @param args.collectionAddress - The address of the collection being queried.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number token to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Tokens array with the token data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get tokens owned by a specific account in a specific collection\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({\n * accountAddress: \"0x1\", // replace with a real account address\n * collectionAddress: \"0x2\", // replace with a real collection address\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens.\n * If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the collections for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number of the collection to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Collections array with the collections data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get account collections with owned tokens for a specific account\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * tokenStandard: \"NFT\", // specify the token standard if needed\n * limit: 10, // specify the number of results to return\n * },\n * });\n *\n * console.log(accountCollectionsWithOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address we want to get the total count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns Current count of transactions made by an account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of transactions for a specific account\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * });\n *\n * console.log(accountTransactionsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the coins data for a specified account.\n *\n * @param args.accountAddress - The account address for which to retrieve the coin's data.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.offset - Optional. The number of coins to start returning results from.\n * @param args.options.limit - Optional. The number of results to return.\n * @param args.options.orderBy - Optional. The order to sort the coins by.\n * @param args.options.where - Optional. Filter the results by specific criteria.\n * @returns An array containing the coins data for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching coins data for a specific account\n * const accountCoinsData = await aptos.getAccountCoinsData({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify the number of results to return\n * orderBy: { asset_type: \"asc\" }, // specify the order of results\n * },\n * });\n *\n * console.log(accountCoinsData);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the current count of an account's coins aggregated across all types.\n *\n * @param args The parameters for the account coins count query.\n * @param args.accountAddress The account address we want to get the total count for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current count of the aggregated coins for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the account coins count for a specific account\n * const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account Coins Count:\", accountCoinsCount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieves the current amount of APT for a specified account. If the account does not exist, it will return 0.\n *\n * @param args The arguments for the account query.\n * @param args.accountAddress The account address for which to retrieve the APT amount.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current amount of APT for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the APT amount for a specific account\n * const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account APT Amount:\", accountAPTAmount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });\n }\n\n /**\n * Queries the current amount of a specified coin held by an account.\n *\n * @param args The parameters for querying the account's coin amount.\n * @param args.accountAddress The account address to query for the coin amount.\n * @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress`\n * is specified.\n * @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically\n * populated if `coinType` is specified.\n * @param args.minimumLedgerVersion Not used anymore, here for backward compatibility\n * see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, will be removed in the near future.\n * Optional ledger version to sync up to before querying.\n * @returns The current amount of the specified coin held by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Query the account's coin amount for a specific coin type\n * const accountCoinAmount = await aptos.getAccountCoinAmount({\n * accountAddress: \"0x1\", // replace with a real account address\n * coinType: \"0x1::aptos_coin::AptosCoin\" // specify the coin type\n * });\n *\n * console.log(`Account coin amount: ${accountCoinAmount}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n const { accountAddress, coinType, faMetadataAddress, minimumLedgerVersion } = args;\n\n if (minimumLedgerVersion) {\n // eslint-disable-next-line no-console\n console.warn(\n `minimumLedgerVersion is not used anymore, here for backward \n compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, \n will be removed in the near future`,\n );\n }\n // Attempt to populate the CoinType field if the FA address is provided.\n // We cannot do this internally due to dependency cycles issue.\n let coinAssetType: MoveStructId | undefined = coinType;\n if (coinType === undefined && faMetadataAddress !== undefined) {\n coinAssetType = await memoizeAsync(\n async () => {\n try {\n const pairedCoinTypeStruct = (\n await view({\n aptosConfig: this.config,\n payload: { function: \"0x1::coin::paired_coin\", functionArguments: [faMetadataAddress] },\n })\n ).at(0) as { vec: MoveValue[] };\n\n // Check if the Option has a value, and if so, parse the struct\n if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {\n return parseEncodedStruct(pairedCoinTypeStruct.vec[0]) as MoveStructId;\n }\n } catch (error) {\n /* No paired coin type found */\n }\n return undefined;\n },\n `coin-mapping-${faMetadataAddress.toString()}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n }\n\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, faMetadataAddress, or both must be provided\");\n }\n\n // When there is a coin mapping, use that first, otherwise use the fungible asset address\n // TODO: This function's signature at the top, returns number, but it could be greater than can be represented\n if (coinAssetType !== undefined) {\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::coin::balance\",\n typeArguments: [coinAssetType],\n functionArguments: [accountAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::primary_fungible_store::balance\",\n typeArguments: [\"0x1::object::ObjectCore\"],\n functionArguments: [accountAddress, faAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n\n /**\n * Queries an account's owned objects.\n *\n * @param args.accountAddress The account address we want to get the objects for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.offset The starting position to start returning results from.\n * @param args.options.limit The number of results to return.\n * @param args.options.orderBy The order to sort the objects by.\n * @returns Objects array with the object data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the objects owned by the specified account\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // optional, specify if needed\n * options: {\n * offset: 0, // optional, specify if needed\n * limit: 10, // optional, specify if needed\n * orderBy: \"created_at\", // optional, specify if needed\n * },\n * });\n *\n * console.log(accountOwnedObjects);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key. This function resolves the provided private key type and derives the public\n * key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey\n * scheme locally.\n * If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519\n * key or a Unified ED25519 key, and then derives the account based on that.\n *\n * @param args - The arguments for deriving the account.\n * @param args.privateKey - An account private key.\n * @returns The derived Account type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Deriving an account from a private key\n * const account = await aptos.deriveAccountFromPrivateKey({\n * privateKey: new Ed25519PrivateKey(\"0x123\") // replace with a real private key\n * });\n *\n * console.log(account);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Account\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n\n async getPublicKeyFromAccountAddress(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<PublicKey> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getPublicKeyFromAccountAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n async getAccountsForPublicKey(args: {\n publicKey: AccountPublicKey;\n minimumLedgerVersion?: AnyNumber;\n options?: { verified?: boolean };\n }): Promise<\n {\n accountAddress: AccountAddress;\n publicKey: PublicKey;\n verified: boolean;\n lastTransactionVersion: number;\n }[]\n > {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountsForPublicKey({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n // deriveAccount(args: AccountDerivationParams | AccountDerivationParams[]): Promise<Account> {\n // return deriveAccount({ aptosConfig: this.config, ...args });\n // }\n}\n\n// type AccountDerivationParams = { privateKey: PrivateKey } | DeriveKeylessAccountParams;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEO,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBnB,YAAqB,QAAqB;AAArB;AACnB,SAAK,cAAc,IAAI,mBAAmB,MAAM;AAAA,EAClD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAM,eAAe,MAAqE;AACxF,WAAO,QAAQ,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoCA,MAAM,kBAAkB,MAGU;AAChC,WAAO,WAAW,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+BA,MAAM,iBAAiB,MAIS;AAC9B,WAAO,UAAU,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAA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AAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAKF;","names":["balanceStr"]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
queryIndexer
|
|
3
|
-
} from "./chunk-YK66QBML.mjs";
|
|
4
|
-
import {
|
|
5
|
-
GetDelegatedStakingActivities,
|
|
6
|
-
GetNumberOfDelegators
|
|
7
|
-
} from "./chunk-EPTUAWRA.mjs";
|
|
8
|
-
import {
|
|
9
|
-
AccountAddress
|
|
10
|
-
} from "./chunk-CXLXUSCG.mjs";
|
|
11
|
-
|
|
12
|
-
// src/internal/staking.ts
|
|
13
|
-
async function getNumberOfDelegators(args) {
|
|
14
|
-
const { aptosConfig, poolAddress } = args;
|
|
15
|
-
const address = AccountAddress.from(poolAddress).toStringLong();
|
|
16
|
-
const query = {
|
|
17
|
-
query: GetNumberOfDelegators,
|
|
18
|
-
variables: { where_condition: { pool_address: { _eq: address } } }
|
|
19
|
-
};
|
|
20
|
-
const data = await queryIndexer({ aptosConfig, query });
|
|
21
|
-
return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;
|
|
22
|
-
}
|
|
23
|
-
async function getNumberOfDelegatorsForAllPools(args) {
|
|
24
|
-
const { aptosConfig, options } = args;
|
|
25
|
-
const query = {
|
|
26
|
-
query: GetNumberOfDelegators,
|
|
27
|
-
variables: { order_by: options?.orderBy }
|
|
28
|
-
};
|
|
29
|
-
const data = await queryIndexer({
|
|
30
|
-
aptosConfig,
|
|
31
|
-
query
|
|
32
|
-
});
|
|
33
|
-
return data.num_active_delegator_per_pool;
|
|
34
|
-
}
|
|
35
|
-
async function getDelegatedStakingActivities(args) {
|
|
36
|
-
const { aptosConfig, delegatorAddress, poolAddress } = args;
|
|
37
|
-
const query = {
|
|
38
|
-
query: GetDelegatedStakingActivities,
|
|
39
|
-
variables: {
|
|
40
|
-
delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),
|
|
41
|
-
poolAddress: AccountAddress.from(poolAddress).toStringLong()
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const data = await queryIndexer({ aptosConfig, query });
|
|
45
|
-
return data.delegated_staking_activities;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
getNumberOfDelegators,
|
|
50
|
-
getNumberOfDelegatorsForAllPools,
|
|
51
|
-
getDelegatedStakingActivities
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=chunk-2WBJAKBO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/staking.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/staking}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * staking namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the number of active delegators for a specified pool address.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.poolAddress - The address of the pool for which to retrieve the number of delegators.\n * @returns The number of active delegators for the specified pool address.\n * @group Implementation\n */\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.from(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;\n}\n\n/**\n * Retrieves the number of active delegators for all pools.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param [args.options] - Optional parameters for ordering the results.\n * @param args.options.orderBy - Specifies the order in which to return the results.\n * @returns The number of active delegators per pool.\n * @group Implementation\n */\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { order_by: options?.orderBy },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\n/**\n * Retrieves the delegated staking activities for a specified delegator and pool.\n *\n * @param args - The parameters for the query.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.delegatorAddress - The address of the delegator whose activities are being queried.\n * @param args.poolAddress - The address of the pool associated with the delegated staking activities.\n * @returns The delegated staking activities for the specified delegator and pool.\n * @group Implementation\n */\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.from(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,eAAsB,sBAAsB,MAGxB;AAClB,QAAM,EAAE,aAAa,YAAY,IAAI;AACrC,QAAM,UAAU,eAAe,KAAK,WAAW,EAAE,aAAa;AAC9D,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,IACP,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,EAAE;AAAA,EACnE;AACA,QAAM,OAAO,MAAM,aAAyC,EAAE,aAAa,MAAM,CAAC;AAIlF,SAAO,KAAK,8BAA8B,CAAC,IAAI,KAAK,8BAA8B,CAAC,EAAE,uBAAuB;AAC9G;AAYA,eAAsB,iCAAiC,MAGZ;AACzC,QAAM,EAAE,aAAa,QAAQ,IAAI;AACjC,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,IACP,WAAW,EAAE,UAAU,SAAS,QAAQ;AAAA,EAC1C;AACA,QAAM,OAAO,MAAM,aAAyC;AAAA,IAC1D;AAAA,IACA;AAAA,EACF,CAAC;AACD,SAAO,KAAK;AACd;AAYA,eAAsB,8BAA8B,MAID;AACjD,QAAM,EAAE,aAAa,kBAAkB,YAAY,IAAI;AACvD,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,IACP,WAAW;AAAA,MACT,kBAAkB,eAAe,KAAK,gBAAgB,EAAE,aAAa;AAAA,MACrE,aAAa,eAAe,KAAK,WAAW,EAAE,aAAa;AAAA,IAC7D;AAAA,EACF;AACA,QAAM,OAAO,MAAM,aAAiD,EAAE,aAAa,MAAM,CAAC;AAC1F,SAAO,KAAK;AACd;","names":[]}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getErrorMessage
|
|
3
|
-
} from "./chunk-RQS33JAS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/errors/index.ts
|
|
6
|
-
var KeylessErrorCategory = /* @__PURE__ */ ((KeylessErrorCategory2) => {
|
|
7
|
-
KeylessErrorCategory2[KeylessErrorCategory2["API_ERROR"] = 0] = "API_ERROR";
|
|
8
|
-
KeylessErrorCategory2[KeylessErrorCategory2["EXTERNAL_API_ERROR"] = 1] = "EXTERNAL_API_ERROR";
|
|
9
|
-
KeylessErrorCategory2[KeylessErrorCategory2["SESSION_EXPIRED"] = 2] = "SESSION_EXPIRED";
|
|
10
|
-
KeylessErrorCategory2[KeylessErrorCategory2["INVALID_STATE"] = 3] = "INVALID_STATE";
|
|
11
|
-
KeylessErrorCategory2[KeylessErrorCategory2["UNKNOWN"] = 4] = "UNKNOWN";
|
|
12
|
-
return KeylessErrorCategory2;
|
|
13
|
-
})(KeylessErrorCategory || {});
|
|
14
|
-
var KeylessErrorResolutionTip = /* @__PURE__ */ ((KeylessErrorResolutionTip2) => {
|
|
15
|
-
KeylessErrorResolutionTip2["REAUTHENTICATE"] = "Re-authentiate to continue using your keyless account";
|
|
16
|
-
KeylessErrorResolutionTip2["REAUTHENTICATE_UNSURE"] = "Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support";
|
|
17
|
-
KeylessErrorResolutionTip2["UPDATE_REQUEST_PARAMS"] = "Update the invalid request parameters and reauthenticate.";
|
|
18
|
-
KeylessErrorResolutionTip2["RATE_LIMIT_EXCEEDED"] = "Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.";
|
|
19
|
-
KeylessErrorResolutionTip2["SERVER_ERROR"] = "Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx";
|
|
20
|
-
KeylessErrorResolutionTip2["CALL_PRECHECK"] = "Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.";
|
|
21
|
-
KeylessErrorResolutionTip2["REINSTANTIATE"] = "Try instantiating the account again. Avoid manipulating the account object directly";
|
|
22
|
-
KeylessErrorResolutionTip2["JOIN_SUPPORT_GROUP"] = "For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx";
|
|
23
|
-
KeylessErrorResolutionTip2["UNKNOWN"] = "Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx";
|
|
24
|
-
return KeylessErrorResolutionTip2;
|
|
25
|
-
})(KeylessErrorResolutionTip || {});
|
|
26
|
-
var KeylessErrorType = /* @__PURE__ */ ((KeylessErrorType2) => {
|
|
27
|
-
KeylessErrorType2[KeylessErrorType2["EPHEMERAL_KEY_PAIR_EXPIRED"] = 0] = "EPHEMERAL_KEY_PAIR_EXPIRED";
|
|
28
|
-
KeylessErrorType2[KeylessErrorType2["PROOF_NOT_FOUND"] = 1] = "PROOF_NOT_FOUND";
|
|
29
|
-
KeylessErrorType2[KeylessErrorType2["ASYNC_PROOF_FETCH_FAILED"] = 2] = "ASYNC_PROOF_FETCH_FAILED";
|
|
30
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_PROOF_VERIFICATION_FAILED"] = 3] = "INVALID_PROOF_VERIFICATION_FAILED";
|
|
31
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND"] = 4] = "INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND";
|
|
32
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_JWT_SIG"] = 5] = "INVALID_JWT_SIG";
|
|
33
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_JWT_JWK_NOT_FOUND"] = 6] = "INVALID_JWT_JWK_NOT_FOUND";
|
|
34
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_JWT_ISS_NOT_RECOGNIZED"] = 7] = "INVALID_JWT_ISS_NOT_RECOGNIZED";
|
|
35
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED"] = 8] = "INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED";
|
|
36
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_TW_SIG_VERIFICATION_FAILED"] = 9] = "INVALID_TW_SIG_VERIFICATION_FAILED";
|
|
37
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND"] = 10] = "INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND";
|
|
38
|
-
KeylessErrorType2[KeylessErrorType2["INVALID_EXPIRY_HORIZON"] = 11] = "INVALID_EXPIRY_HORIZON";
|
|
39
|
-
KeylessErrorType2[KeylessErrorType2["JWT_PARSING_ERROR"] = 12] = "JWT_PARSING_ERROR";
|
|
40
|
-
KeylessErrorType2[KeylessErrorType2["JWK_FETCH_FAILED"] = 13] = "JWK_FETCH_FAILED";
|
|
41
|
-
KeylessErrorType2[KeylessErrorType2["JWK_FETCH_FAILED_FEDERATED"] = 14] = "JWK_FETCH_FAILED_FEDERATED";
|
|
42
|
-
KeylessErrorType2[KeylessErrorType2["RATE_LIMIT_EXCEEDED"] = 15] = "RATE_LIMIT_EXCEEDED";
|
|
43
|
-
KeylessErrorType2[KeylessErrorType2["PEPPER_SERVICE_INTERNAL_ERROR"] = 16] = "PEPPER_SERVICE_INTERNAL_ERROR";
|
|
44
|
-
KeylessErrorType2[KeylessErrorType2["PEPPER_SERVICE_BAD_REQUEST"] = 17] = "PEPPER_SERVICE_BAD_REQUEST";
|
|
45
|
-
KeylessErrorType2[KeylessErrorType2["PEPPER_SERVICE_OTHER"] = 18] = "PEPPER_SERVICE_OTHER";
|
|
46
|
-
KeylessErrorType2[KeylessErrorType2["PROVER_SERVICE_INTERNAL_ERROR"] = 19] = "PROVER_SERVICE_INTERNAL_ERROR";
|
|
47
|
-
KeylessErrorType2[KeylessErrorType2["PROVER_SERVICE_BAD_REQUEST"] = 20] = "PROVER_SERVICE_BAD_REQUEST";
|
|
48
|
-
KeylessErrorType2[KeylessErrorType2["PROVER_SERVICE_OTHER"] = 21] = "PROVER_SERVICE_OTHER";
|
|
49
|
-
KeylessErrorType2[KeylessErrorType2["FULL_NODE_CONFIG_LOOKUP_ERROR"] = 22] = "FULL_NODE_CONFIG_LOOKUP_ERROR";
|
|
50
|
-
KeylessErrorType2[KeylessErrorType2["FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR"] = 23] = "FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR";
|
|
51
|
-
KeylessErrorType2[KeylessErrorType2["FULL_NODE_JWKS_LOOKUP_ERROR"] = 24] = "FULL_NODE_JWKS_LOOKUP_ERROR";
|
|
52
|
-
KeylessErrorType2[KeylessErrorType2["FULL_NODE_OTHER"] = 25] = "FULL_NODE_OTHER";
|
|
53
|
-
KeylessErrorType2[KeylessErrorType2["UNKNOWN"] = 26] = "UNKNOWN";
|
|
54
|
-
return KeylessErrorType2;
|
|
55
|
-
})(KeylessErrorType || {});
|
|
56
|
-
var KeylessErrors = {
|
|
57
|
-
[0 /* EPHEMERAL_KEY_PAIR_EXPIRED */]: [
|
|
58
|
-
"The ephemeral keypair has expired.",
|
|
59
|
-
2 /* SESSION_EXPIRED */,
|
|
60
|
-
"Re-authentiate to continue using your keyless account" /* REAUTHENTICATE */
|
|
61
|
-
],
|
|
62
|
-
[1 /* PROOF_NOT_FOUND */]: [
|
|
63
|
-
"The required proof could not be found.",
|
|
64
|
-
3 /* INVALID_STATE */,
|
|
65
|
-
"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing." /* CALL_PRECHECK */
|
|
66
|
-
],
|
|
67
|
-
[2 /* ASYNC_PROOF_FETCH_FAILED */]: [
|
|
68
|
-
"The required proof failed to fetch.",
|
|
69
|
-
3 /* INVALID_STATE */,
|
|
70
|
-
"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support" /* REAUTHENTICATE_UNSURE */
|
|
71
|
-
],
|
|
72
|
-
[3 /* INVALID_PROOF_VERIFICATION_FAILED */]: [
|
|
73
|
-
"The provided proof is invalid.",
|
|
74
|
-
3 /* INVALID_STATE */,
|
|
75
|
-
"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support" /* REAUTHENTICATE_UNSURE */
|
|
76
|
-
],
|
|
77
|
-
[4 /* INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND */]: [
|
|
78
|
-
"The verification key used to authenticate was updated.",
|
|
79
|
-
2 /* SESSION_EXPIRED */,
|
|
80
|
-
"Re-authentiate to continue using your keyless account" /* REAUTHENTICATE */
|
|
81
|
-
],
|
|
82
|
-
[5 /* INVALID_JWT_SIG */]: [
|
|
83
|
-
"The JWK was found, but JWT failed verification",
|
|
84
|
-
3 /* INVALID_STATE */,
|
|
85
|
-
"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support" /* REAUTHENTICATE_UNSURE */
|
|
86
|
-
],
|
|
87
|
-
[6 /* INVALID_JWT_JWK_NOT_FOUND */]: [
|
|
88
|
-
"The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",
|
|
89
|
-
2 /* SESSION_EXPIRED */,
|
|
90
|
-
"Re-authentiate to continue using your keyless account" /* REAUTHENTICATE */
|
|
91
|
-
],
|
|
92
|
-
[7 /* INVALID_JWT_ISS_NOT_RECOGNIZED */]: [
|
|
93
|
-
"The JWT issuer is not recognized.",
|
|
94
|
-
3 /* INVALID_STATE */,
|
|
95
|
-
"Update the invalid request parameters and reauthenticate." /* UPDATE_REQUEST_PARAMS */
|
|
96
|
-
],
|
|
97
|
-
[8 /* INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED */]: [
|
|
98
|
-
"The JWT issuer is not supported by the Federated Keyless ",
|
|
99
|
-
0 /* API_ERROR */,
|
|
100
|
-
"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support" /* REAUTHENTICATE_UNSURE */
|
|
101
|
-
],
|
|
102
|
-
[9 /* INVALID_TW_SIG_VERIFICATION_FAILED */]: [
|
|
103
|
-
"The training wheels signature is invalid.",
|
|
104
|
-
3 /* INVALID_STATE */,
|
|
105
|
-
"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support" /* REAUTHENTICATE_UNSURE */
|
|
106
|
-
],
|
|
107
|
-
[10 /* INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND */]: [
|
|
108
|
-
"The public key used to verify the training wheels signature was not found.",
|
|
109
|
-
2 /* SESSION_EXPIRED */,
|
|
110
|
-
"Re-authentiate to continue using your keyless account" /* REAUTHENTICATE */
|
|
111
|
-
],
|
|
112
|
-
[11 /* INVALID_EXPIRY_HORIZON */]: [
|
|
113
|
-
"The expiry horizon is invalid.",
|
|
114
|
-
2 /* SESSION_EXPIRED */,
|
|
115
|
-
"Re-authentiate to continue using your keyless account" /* REAUTHENTICATE */
|
|
116
|
-
],
|
|
117
|
-
[13 /* JWK_FETCH_FAILED */]: [
|
|
118
|
-
"Failed to fetch JWKS.",
|
|
119
|
-
1 /* EXTERNAL_API_ERROR */,
|
|
120
|
-
"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* JOIN_SUPPORT_GROUP */
|
|
121
|
-
],
|
|
122
|
-
[14 /* JWK_FETCH_FAILED_FEDERATED */]: [
|
|
123
|
-
"Failed to fetch JWKS for Federated Keyless provider.",
|
|
124
|
-
1 /* EXTERNAL_API_ERROR */,
|
|
125
|
-
"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* JOIN_SUPPORT_GROUP */
|
|
126
|
-
],
|
|
127
|
-
[15 /* RATE_LIMIT_EXCEEDED */]: [
|
|
128
|
-
"Rate limit exceeded. Too many requests in a short period.",
|
|
129
|
-
0 /* API_ERROR */,
|
|
130
|
-
"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest." /* RATE_LIMIT_EXCEEDED */
|
|
131
|
-
],
|
|
132
|
-
[16 /* PEPPER_SERVICE_INTERNAL_ERROR */]: [
|
|
133
|
-
"Internal error from Pepper service.",
|
|
134
|
-
0 /* API_ERROR */,
|
|
135
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
136
|
-
],
|
|
137
|
-
[17 /* PEPPER_SERVICE_BAD_REQUEST */]: [
|
|
138
|
-
"Bad request sent to Pepper service.",
|
|
139
|
-
0 /* API_ERROR */,
|
|
140
|
-
"Update the invalid request parameters and reauthenticate." /* UPDATE_REQUEST_PARAMS */
|
|
141
|
-
],
|
|
142
|
-
[18 /* PEPPER_SERVICE_OTHER */]: [
|
|
143
|
-
"Unknown error from Pepper service.",
|
|
144
|
-
0 /* API_ERROR */,
|
|
145
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
146
|
-
],
|
|
147
|
-
[19 /* PROVER_SERVICE_INTERNAL_ERROR */]: [
|
|
148
|
-
"Internal error from Prover service.",
|
|
149
|
-
0 /* API_ERROR */,
|
|
150
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
151
|
-
],
|
|
152
|
-
[20 /* PROVER_SERVICE_BAD_REQUEST */]: [
|
|
153
|
-
"Bad request sent to Prover service.",
|
|
154
|
-
0 /* API_ERROR */,
|
|
155
|
-
"Update the invalid request parameters and reauthenticate." /* UPDATE_REQUEST_PARAMS */
|
|
156
|
-
],
|
|
157
|
-
[21 /* PROVER_SERVICE_OTHER */]: [
|
|
158
|
-
"Unknown error from Prover service.",
|
|
159
|
-
0 /* API_ERROR */,
|
|
160
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
161
|
-
],
|
|
162
|
-
[12 /* JWT_PARSING_ERROR */]: [
|
|
163
|
-
"Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",
|
|
164
|
-
3 /* INVALID_STATE */,
|
|
165
|
-
"Try instantiating the account again. Avoid manipulating the account object directly" /* REINSTANTIATE */
|
|
166
|
-
],
|
|
167
|
-
[22 /* FULL_NODE_CONFIG_LOOKUP_ERROR */]: [
|
|
168
|
-
"Error when looking up on-chain keyless configuration.",
|
|
169
|
-
0 /* API_ERROR */,
|
|
170
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
171
|
-
],
|
|
172
|
-
[23 /* FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR */]: [
|
|
173
|
-
"Error when looking up on-chain verification key.",
|
|
174
|
-
0 /* API_ERROR */,
|
|
175
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
176
|
-
],
|
|
177
|
-
[24 /* FULL_NODE_JWKS_LOOKUP_ERROR */]: [
|
|
178
|
-
"Error when looking up on-chain JWKS.",
|
|
179
|
-
0 /* API_ERROR */,
|
|
180
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
181
|
-
],
|
|
182
|
-
[25 /* FULL_NODE_OTHER */]: [
|
|
183
|
-
"Unknown error from full node.",
|
|
184
|
-
0 /* API_ERROR */,
|
|
185
|
-
"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* SERVER_ERROR */
|
|
186
|
-
],
|
|
187
|
-
[26 /* UNKNOWN */]: [
|
|
188
|
-
"An unknown error has occurred.",
|
|
189
|
-
4 /* UNKNOWN */,
|
|
190
|
-
"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" /* UNKNOWN */
|
|
191
|
-
]
|
|
192
|
-
};
|
|
193
|
-
var KeylessError = class _KeylessError extends Error {
|
|
194
|
-
/** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */
|
|
195
|
-
constructor(args) {
|
|
196
|
-
const { innerError, category, resolutionTip, type, message = KeylessErrors[type][0], details } = args;
|
|
197
|
-
super(message);
|
|
198
|
-
this.name = "KeylessError";
|
|
199
|
-
this.innerError = innerError;
|
|
200
|
-
this.category = category;
|
|
201
|
-
this.resolutionTip = resolutionTip;
|
|
202
|
-
this.type = type;
|
|
203
|
-
this.details = details;
|
|
204
|
-
this.message = _KeylessError.constructMessage(message, resolutionTip, innerError, details);
|
|
205
|
-
}
|
|
206
|
-
static constructMessage(message, tip, innerError, details) {
|
|
207
|
-
let result = `
|
|
208
|
-
Message: ${message}`;
|
|
209
|
-
if (details) {
|
|
210
|
-
result += `
|
|
211
|
-
Details: ${details}`;
|
|
212
|
-
}
|
|
213
|
-
if (innerError instanceof AptosApiError) {
|
|
214
|
-
result += `
|
|
215
|
-
AptosApiError: ${innerError.message}`;
|
|
216
|
-
} else if (innerError !== void 0) {
|
|
217
|
-
result += `
|
|
218
|
-
Error: ${getErrorMessage(innerError)}`;
|
|
219
|
-
}
|
|
220
|
-
result += `
|
|
221
|
-
KeylessErrorResolutionTip: ${tip}`;
|
|
222
|
-
return result;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Static constructor that creates a KeylessError instance using the KeylessErrors constant
|
|
226
|
-
* @param args.type The type of KeylessError
|
|
227
|
-
* @param args.aptosApiError optional AptosApiError supplied for api errors
|
|
228
|
-
* @param args.details optional details to include in the error message
|
|
229
|
-
* @returns A new KeylessError instance
|
|
230
|
-
*/
|
|
231
|
-
static fromErrorType(args) {
|
|
232
|
-
const { error, type, details } = args;
|
|
233
|
-
const [message, category, resolutionTip] = KeylessErrors[type];
|
|
234
|
-
return new _KeylessError({
|
|
235
|
-
message,
|
|
236
|
-
details,
|
|
237
|
-
innerError: error,
|
|
238
|
-
category,
|
|
239
|
-
resolutionTip,
|
|
240
|
-
type
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
var AptosApiError = class extends Error {
|
|
245
|
-
/**
|
|
246
|
-
* Constructs an instance of AptosApiError with relevant error details.
|
|
247
|
-
*
|
|
248
|
-
* @param opts - The options for creating the AptosApiError.
|
|
249
|
-
* @param opts.apiType - The type of API that generated the error.
|
|
250
|
-
* @param opts.aptosRequest - The request object that caused the error.
|
|
251
|
-
* @param opts.aptosResponse - The response object containing error details.
|
|
252
|
-
*
|
|
253
|
-
* @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase.
|
|
254
|
-
*/
|
|
255
|
-
constructor({ apiType, aptosRequest, aptosResponse }) {
|
|
256
|
-
super(deriveErrorMessage({ apiType, aptosRequest, aptosResponse }));
|
|
257
|
-
this.name = "AptosApiError";
|
|
258
|
-
this.url = aptosResponse.url;
|
|
259
|
-
this.status = aptosResponse.status;
|
|
260
|
-
this.statusText = aptosResponse.statusText;
|
|
261
|
-
this.data = aptosResponse.data;
|
|
262
|
-
this.request = aptosRequest;
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
function deriveErrorMessage({ apiType, aptosRequest, aptosResponse }) {
|
|
266
|
-
const traceId = aptosResponse.headers?.traceparent?.split("-")[1];
|
|
267
|
-
const traceIdString = traceId ? `(trace_id:${traceId}) ` : "";
|
|
268
|
-
const errorPrelude = `Request to [${apiType}]: ${aptosRequest.method} ${aptosResponse.url ?? aptosRequest.url} ${traceIdString}failed with`;
|
|
269
|
-
if (apiType === "Indexer" /* INDEXER */ && aptosResponse.data?.errors?.[0]?.message != null) {
|
|
270
|
-
return `${errorPrelude}: ${aptosResponse.data.errors[0].message}`;
|
|
271
|
-
}
|
|
272
|
-
if (aptosResponse.data?.message != null && aptosResponse.data?.error_code != null) {
|
|
273
|
-
return `${errorPrelude}: ${JSON.stringify(aptosResponse.data)}`;
|
|
274
|
-
}
|
|
275
|
-
return `${errorPrelude} status: ${aptosResponse.statusText}(code:${aptosResponse.status}) and response body: ${serializeAnyPayloadForErrorMessage(aptosResponse.data)}`;
|
|
276
|
-
}
|
|
277
|
-
var SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH = 400;
|
|
278
|
-
function serializeAnyPayloadForErrorMessage(payload) {
|
|
279
|
-
const serializedPayload = JSON.stringify(payload);
|
|
280
|
-
if (serializedPayload.length <= SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH) {
|
|
281
|
-
return serializedPayload;
|
|
282
|
-
}
|
|
283
|
-
return `truncated(original_size:${serializedPayload.length}): ${serializedPayload.slice(
|
|
284
|
-
0,
|
|
285
|
-
SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2
|
|
286
|
-
)}...${serializedPayload.slice(-SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2)}`;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export {
|
|
290
|
-
KeylessErrorCategory,
|
|
291
|
-
KeylessErrorResolutionTip,
|
|
292
|
-
KeylessErrorType,
|
|
293
|
-
KeylessError,
|
|
294
|
-
AptosApiError
|
|
295
|
-
};
|
|
296
|
-
//# sourceMappingURL=chunk-32UQAST6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/errors/index.ts"],"sourcesContent":["import { AptosApiType } from \"../utils/const\";\nimport { getErrorMessage } from \"../utils/helpers\";\nimport { AptosRequest, AptosResponse } from \"../types\";\n\nexport enum KeylessErrorCategory {\n API_ERROR,\n EXTERNAL_API_ERROR,\n SESSION_EXPIRED,\n INVALID_STATE,\n UNKNOWN,\n}\n\nexport enum KeylessErrorResolutionTip {\n REAUTHENTICATE = \"Re-authentiate to continue using your keyless account\",\n // eslint-disable-next-line max-len\n REAUTHENTICATE_UNSURE = \"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support\",\n UPDATE_REQUEST_PARAMS = \"Update the invalid request parameters and reauthenticate.\",\n // eslint-disable-next-line max-len\n RATE_LIMIT_EXCEEDED = \"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.\",\n // eslint-disable-next-line max-len\n SERVER_ERROR = \"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n // eslint-disable-next-line max-len\n CALL_PRECHECK = \"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.\",\n REINSTANTIATE = \"Try instantiating the account again. Avoid manipulating the account object directly\",\n JOIN_SUPPORT_GROUP = \"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n UNKNOWN = \"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n}\n\nexport enum KeylessErrorType {\n EPHEMERAL_KEY_PAIR_EXPIRED,\n\n PROOF_NOT_FOUND,\n\n ASYNC_PROOF_FETCH_FAILED,\n\n INVALID_PROOF_VERIFICATION_FAILED,\n\n INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND,\n\n INVALID_JWT_SIG,\n\n INVALID_JWT_JWK_NOT_FOUND,\n\n INVALID_JWT_ISS_NOT_RECOGNIZED,\n\n INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED,\n\n INVALID_TW_SIG_VERIFICATION_FAILED,\n\n INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND,\n\n INVALID_EXPIRY_HORIZON,\n\n JWT_PARSING_ERROR,\n\n JWK_FETCH_FAILED,\n\n JWK_FETCH_FAILED_FEDERATED,\n\n RATE_LIMIT_EXCEEDED,\n\n PEPPER_SERVICE_INTERNAL_ERROR,\n\n PEPPER_SERVICE_BAD_REQUEST,\n\n PEPPER_SERVICE_OTHER,\n\n PROVER_SERVICE_INTERNAL_ERROR,\n\n PROVER_SERVICE_BAD_REQUEST,\n\n PROVER_SERVICE_OTHER,\n\n FULL_NODE_CONFIG_LOOKUP_ERROR,\n\n FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,\n\n FULL_NODE_JWKS_LOOKUP_ERROR,\n\n FULL_NODE_OTHER,\n\n UNKNOWN,\n}\n\nconst KeylessErrors: { [key in KeylessErrorType]: [string, KeylessErrorCategory, KeylessErrorResolutionTip] } = {\n [KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED]: [\n \"The ephemeral keypair has expired.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_NOT_FOUND]: [\n \"The required proof could not be found.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.CALL_PRECHECK,\n ],\n [KeylessErrorType.ASYNC_PROOF_FETCH_FAILED]: [\n \"The required proof failed to fetch.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_FAILED]: [\n \"The provided proof is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND]: [\n \"The verification key used to authenticate was updated.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_SIG]: [\n \"The JWK was found, but JWT failed verification\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND]: [\n \"The JWK required to verify the JWT could not be found. The JWK may have been rotated out.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED]: [\n \"The JWT issuer is not recognized.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED]: [\n \"The JWT issuer is not supported by the Federated Keyless \",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_VERIFICATION_FAILED]: [\n \"The training wheels signature is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND]: [\n \"The public key used to verify the training wheels signature was not found.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_EXPIRY_HORIZON]: [\n \"The expiry horizon is invalid.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED]: [\n \"Failed to fetch JWKS.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED_FEDERATED]: [\n \"Failed to fetch JWKS for Federated Keyless provider.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.RATE_LIMIT_EXCEEDED]: [\n \"Rate limit exceeded. Too many requests in a short period.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.RATE_LIMIT_EXCEEDED,\n ],\n [KeylessErrorType.PEPPER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PEPPER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PEPPER_SERVICE_OTHER]: [\n \"Unknown error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PROVER_SERVICE_OTHER]: [\n \"Unknown error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.JWT_PARSING_ERROR]: [\n \"Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REINSTANTIATE,\n ],\n [KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR]: [\n \"Error when looking up on-chain keyless configuration.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR]: [\n \"Error when looking up on-chain verification key.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR]: [\n \"Error when looking up on-chain JWKS.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_OTHER]: [\n \"Unknown error from full node.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.UNKNOWN]: [\n \"An unknown error has occurred.\",\n KeylessErrorCategory.UNKNOWN,\n KeylessErrorResolutionTip.UNKNOWN,\n ],\n};\n\nexport class KeylessError extends Error {\n readonly innerError?: unknown;\n\n readonly category: KeylessErrorCategory;\n\n readonly resolutionTip: KeylessErrorResolutionTip;\n\n readonly type: KeylessErrorType;\n\n readonly details?: string;\n\n /** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */\n constructor(args: {\n innerError?: unknown;\n category: KeylessErrorCategory;\n resolutionTip: KeylessErrorResolutionTip;\n type: KeylessErrorType;\n message?: string;\n details?: string;\n }) {\n const { innerError, category, resolutionTip, type, message = KeylessErrors[type][0], details } = args;\n super(message);\n this.name = \"KeylessError\";\n this.innerError = innerError;\n this.category = category;\n this.resolutionTip = resolutionTip;\n this.type = type;\n this.details = details;\n this.message = KeylessError.constructMessage(message, resolutionTip, innerError, details);\n }\n\n static constructMessage(\n message: string,\n tip: KeylessErrorResolutionTip,\n innerError?: unknown,\n details?: string,\n ): string {\n let result = `\\nMessage: ${message}`;\n if (details) {\n result += `\\nDetails: ${details}`;\n }\n if (innerError instanceof AptosApiError) {\n result += `\\nAptosApiError: ${innerError.message}`;\n } else if (innerError !== undefined) {\n result += `\\nError: ${getErrorMessage(innerError)}`;\n }\n result += `\\nKeylessErrorResolutionTip: ${tip}`;\n return result;\n }\n\n /**\n * Static constructor that creates a KeylessError instance using the KeylessErrors constant\n * @param args.type The type of KeylessError\n * @param args.aptosApiError optional AptosApiError supplied for api errors\n * @param args.details optional details to include in the error message\n * @returns A new KeylessError instance\n */\n static fromErrorType(args: { type: KeylessErrorType; error?: unknown; details?: string }): KeylessError {\n const { error, type, details } = args;\n\n const [message, category, resolutionTip] = KeylessErrors[type];\n return new KeylessError({\n message,\n details,\n innerError: error,\n category,\n resolutionTip,\n type,\n });\n }\n}\n\n/**\n * Options for handling errors in the Aptos API.\n */\ntype AptosApiErrorOpts = {\n apiType: AptosApiType;\n aptosRequest: AptosRequest;\n aptosResponse: AptosResponse<any, any>;\n};\n\n/**\n * Represents an error returned from the Aptos API.\n * This class encapsulates the details of the error, including the request URL, response status, and additional data.\n *\n * @param name - The name of the error, which is always \"AptosApiError\".\n * @param url - The URL to which the request was made.\n * @param status - The HTTP response status code (e.g., 400).\n * @param statusText - The message associated with the response status.\n * @param data - The response data returned from the API.\n * @param request - The original AptosRequest that triggered the error.\n */\nexport class AptosApiError extends Error {\n readonly url: string;\n\n readonly status: number;\n\n readonly statusText: string;\n\n readonly data: any;\n\n readonly request: AptosRequest;\n\n /**\n * Constructs an instance of AptosApiError with relevant error details.\n *\n * @param opts - The options for creating the AptosApiError.\n * @param opts.apiType - The type of API that generated the error.\n * @param opts.aptosRequest - The request object that caused the error.\n * @param opts.aptosResponse - The response object containing error details.\n *\n * @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase.\n */\n constructor({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts) {\n super(deriveErrorMessage({ apiType, aptosRequest, aptosResponse }));\n\n this.name = \"AptosApiError\";\n this.url = aptosResponse.url;\n this.status = aptosResponse.status;\n this.statusText = aptosResponse.statusText;\n this.data = aptosResponse.data;\n this.request = aptosRequest;\n }\n}\n\n/**\n * Derives an error message from the Aptos API response, providing context for debugging.\n * This function helps in understanding the nature of the error encountered during an API request.\n *\n * @param {AptosApiErrorOpts} opts - The options for deriving the error message.\n * @param {AptosApiType} opts.apiType - The type of API being called.\n * @param {AptosRequest} opts.aptosRequest - The original request made to the Aptos API.\n * @param {AptosResponse} opts.aptosResponse - The response received from the Aptos API.\n */\nfunction deriveErrorMessage({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts): string {\n // eslint-disable-next-line max-len\n // extract the W3C trace_id from the response headers if it exists. Some services set this in the response, and it's useful for debugging.\n // See https://www.w3.org/TR/trace-context/#relationship-between-the-headers .\n const traceId = aptosResponse.headers?.traceparent?.split(\"-\")[1];\n const traceIdString = traceId ? `(trace_id:${traceId}) ` : \"\";\n\n const errorPrelude: string = `Request to [${apiType}]: ${aptosRequest.method} ${\n aptosResponse.url ?? aptosRequest.url\n } ${traceIdString}failed with`;\n\n // handle graphql responses from indexer api and extract the error message of the first error\n if (apiType === AptosApiType.INDEXER && aptosResponse.data?.errors?.[0]?.message != null) {\n return `${errorPrelude}: ${aptosResponse.data.errors[0].message}`;\n }\n\n // Received well-known structured error response body - simply serialize and return it.\n // We don't need http status codes etc. in this case.\n if (aptosResponse.data?.message != null && aptosResponse.data?.error_code != null) {\n return `${errorPrelude}: ${JSON.stringify(aptosResponse.data)}`;\n }\n\n // This is the generic/catch-all case. We received some response from the API, but it doesn't appear to be a well-known structure.\n // We print http status codes and the response body (after some trimming),\n // in the hope that this gives enough context what went wrong without printing overly huge messages.\n return `${errorPrelude} status: ${aptosResponse.statusText}(code:${\n aptosResponse.status\n }) and response body: ${serializeAnyPayloadForErrorMessage(aptosResponse.data)}`;\n}\n\nconst SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH = 400;\n\n/**\n * This function accepts a payload of any type (probably an object) and serializes it to a string\n * Since we don't know the type or size of the payload, and we don't want to add a huge object in full to the error message\n * we limit the to the first 200 and last 200 characters of the serialized payload and put a \"...\" in the middle.\n * @param payload - The payload to serialize, which can be of any type.\n *\n * @returns A string representation of the serialized payload, potentially truncated.\n */\nfunction serializeAnyPayloadForErrorMessage(payload: any): string {\n const serializedPayload = JSON.stringify(payload);\n if (serializedPayload.length <= SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH) {\n return serializedPayload;\n }\n return `truncated(original_size:${serializedPayload.length}): ${serializedPayload.slice(\n 0,\n SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2,\n )}...${serializedPayload.slice(-SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2)}`;\n}\n"],"mappings":";;;;;AAIO,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,4CAAA;AACA,EAAAA,4CAAA;AACA,EAAAA,4CAAA;AACA,EAAAA,4CAAA;AACA,EAAAA,4CAAA;AALU,SAAAA;AAAA,GAAA;AAQL,IAAK,4BAAL,kBAAKC,+BAAL;AACL,EAAAA,2BAAA,oBAAiB;AAEjB,E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