@aptos-labs/ts-sdk 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/common/{account-DvGDel4s.d.ts → account-Dxsj5MIn.d.ts} +219 -6
- package/dist/common/chunk-3KK6QRXD.js +4 -0
- package/dist/common/chunk-3KK6QRXD.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +33 -3
- package/dist/common/index.js +34 -34
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-C25CwEJi.d.mts → Ed25519Account-DIIE2Drw.d.mts} +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.d.mts +2 -2
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.d.mts +3 -3
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
- package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +3 -3
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +3 -3
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.d.mts +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/{account-Bwu9vUe3.d.mts → account-CMR8C31P.d.mts} +219 -6
- package/dist/esm/api/account/abstraction.d.mts +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -2
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +3 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +3 -3
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +3 -3
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.d.mts +1 -1
- package/dist/esm/bcs/deserializer.d.mts +1 -1
- package/dist/esm/bcs/index.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -1
- package/dist/esm/{chunk-K2TQQFRV.mjs → chunk-3GNYDMRA.mjs} +2 -2
- package/dist/esm/chunk-54C2P534.mjs +2 -0
- package/dist/esm/chunk-54C2P534.mjs.map +1 -0
- package/dist/esm/{chunk-IKTH33UN.mjs → chunk-56IXVVXX.mjs} +2 -2
- package/dist/esm/{chunk-J426EZGD.mjs → chunk-C622NWP7.mjs} +2 -2
- package/dist/esm/{chunk-TRIYATBI.mjs → chunk-DLD62OFZ.mjs} +2 -2
- package/dist/esm/{chunk-UXUMXAUZ.mjs → chunk-EIQBQ62N.mjs} +2 -2
- package/dist/esm/{chunk-52PWWLJJ.mjs → chunk-GRF3NBRO.mjs} +2 -2
- package/dist/esm/chunk-K3Q5EONX.mjs +2 -0
- package/dist/esm/{chunk-AEXYYFIZ.mjs.map → chunk-K3Q5EONX.mjs.map} +1 -1
- package/dist/esm/{chunk-IFWE34P5.mjs → chunk-KY4GDJA6.mjs} +2 -2
- package/dist/esm/chunk-NK3Y3PV3.mjs +2 -0
- package/dist/esm/{chunk-5ABS6RDR.mjs.map → chunk-NK3Y3PV3.mjs.map} +1 -1
- package/dist/esm/chunk-QEHKRR3I.mjs +2 -0
- package/dist/esm/chunk-QEHKRR3I.mjs.map +1 -0
- package/dist/esm/{chunk-LND3GTJ3.mjs → chunk-QITAALVJ.mjs} +2 -2
- package/dist/esm/{chunk-G2VFBYHG.mjs → chunk-TBOR2W2F.mjs} +2 -2
- package/dist/esm/{chunk-2LCPW76G.mjs → chunk-VO3JD6U6.mjs} +2 -2
- package/dist/esm/{chunk-HIAEKFG6.mjs → chunk-WBG25H7H.mjs} +2 -2
- package/dist/esm/{chunk-A2G3V23K.mjs → chunk-Z6PXP6MJ.mjs} +2 -2
- package/dist/esm/chunk-ZSO5R7FV.mjs +4 -0
- package/dist/esm/chunk-ZSO5R7FV.mjs.map +1 -0
- package/dist/esm/cli/index.d.mts +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +1 -1
- package/dist/esm/client/core.d.mts +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.d.mts +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -1
- package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +2 -2
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/secp256r1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256r1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/types.d.mts +1 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +1 -1
- package/dist/esm/core/index.d.mts +2 -2
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/{federatedKeyless-BfOrG2BM.d.mts → federatedKeyless-DE7i_6s_.d.mts} +1 -1
- package/dist/esm/index.d.mts +4 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.d.mts +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +3 -3
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/utils/index.d.mts +1 -1
- package/dist/esm/internal/utils/index.mjs +1 -1
- package/dist/esm/internal/utils/utils.d.mts +1 -1
- package/dist/esm/internal/utils/utils.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -2
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +32 -2
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/types.d.mts +1 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +1 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/bcs/serializable/movePrimitives.ts +12 -14
- package/src/bcs/serializable/moveStructs.ts +205 -1
- package/src/transactions/instances/transactionPayload.ts +27 -1
- package/src/transactions/transactionBuilder/helpers.ts +67 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +124 -1
- package/src/transactions/types.ts +19 -1
- package/src/types/types.ts +58 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-JQCMXTY7.js +0 -4
- package/dist/common/chunk-JQCMXTY7.js.map +0 -1
- package/dist/esm/chunk-5ABS6RDR.mjs +0 -2
- package/dist/esm/chunk-6XLLQB5P.mjs +0 -2
- package/dist/esm/chunk-6XLLQB5P.mjs.map +0 -1
- package/dist/esm/chunk-76PXED26.mjs +0 -4
- package/dist/esm/chunk-76PXED26.mjs.map +0 -1
- package/dist/esm/chunk-AEXYYFIZ.mjs +0 -2
- package/dist/esm/chunk-BIQOJ3OK.mjs +0 -2
- package/dist/esm/chunk-BIQOJ3OK.mjs.map +0 -1
- /package/dist/esm/{chunk-K2TQQFRV.mjs.map → chunk-3GNYDMRA.mjs.map} +0 -0
- /package/dist/esm/{chunk-IKTH33UN.mjs.map → chunk-56IXVVXX.mjs.map} +0 -0
- /package/dist/esm/{chunk-J426EZGD.mjs.map → chunk-C622NWP7.mjs.map} +0 -0
- /package/dist/esm/{chunk-TRIYATBI.mjs.map → chunk-DLD62OFZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UXUMXAUZ.mjs.map → chunk-EIQBQ62N.mjs.map} +0 -0
- /package/dist/esm/{chunk-52PWWLJJ.mjs.map → chunk-GRF3NBRO.mjs.map} +0 -0
- /package/dist/esm/{chunk-IFWE34P5.mjs.map → chunk-KY4GDJA6.mjs.map} +0 -0
- /package/dist/esm/{chunk-LND3GTJ3.mjs.map → chunk-QITAALVJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-G2VFBYHG.mjs.map → chunk-TBOR2W2F.mjs.map} +0 -0
- /package/dist/esm/{chunk-2LCPW76G.mjs.map → chunk-VO3JD6U6.mjs.map} +0 -0
- /package/dist/esm/{chunk-HIAEKFG6.mjs.map → chunk-WBG25H7H.mjs.map} +0 -0
- /package/dist/esm/{chunk-A2G3V23K.mjs.map → chunk-Z6PXP6MJ.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -25,6 +25,14 @@ Install with your favorite package manager such as npm, yarn, or pnpm:
|
|
|
25
25
|
pnpm install @aptos-labs/ts-sdk
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
### For use with Bun
|
|
29
|
+
|
|
30
|
+
The SDK is compatible with the [Bun](https://bun.sh/) runtime. Install the SDK using Bun's package manager:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bun add @aptos-labs/ts-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
28
36
|
### For use in a browser (<= version 1.9.1 only)
|
|
29
37
|
|
|
30
38
|
You can add the SDK to your web application using a script tag:
|
|
@@ -48,6 +56,16 @@ const config = new AptosConfig({ network: Network.TESTNET });
|
|
|
48
56
|
const aptos = new Aptos(config);
|
|
49
57
|
```
|
|
50
58
|
|
|
59
|
+
#### For Bun users
|
|
60
|
+
|
|
61
|
+
Bun's HTTP/2 support is not fully mature yet. You need to disable HTTP/2 to ensure the SDK works properly:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
65
|
+
|
|
66
|
+
const aptos = new Aptos(new AptosConfig({ network: Network.TESTNET, clientConfig: { http2: false } }));
|
|
67
|
+
```
|
|
68
|
+
|
|
51
69
|
### Reading Data From Onchain ([Guide](https://aptos.dev/en/build/sdks/ts-sdk/fetch-data-via-sdk))
|
|
52
70
|
|
|
53
71
|
---
|
|
@@ -5060,6 +5060,90 @@ declare class MoveVector<T extends Serializable & EntryFunctionArgument> extends
|
|
|
5060
5060
|
* @category BCS
|
|
5061
5061
|
*/
|
|
5062
5062
|
static Bool(values: Array<boolean>): MoveVector<Bool>;
|
|
5063
|
+
/**
|
|
5064
|
+
* Factory method to generate a MoveVector<I8> from an array of numbers.
|
|
5065
|
+
*
|
|
5066
|
+
* @param values - The values used to fill the MoveVector.
|
|
5067
|
+
* @returns A MoveVector<I8> with the inner values.
|
|
5068
|
+
*
|
|
5069
|
+
* @example
|
|
5070
|
+
* ```typescript
|
|
5071
|
+
* const v = MoveVector.I8([-1, 0, 1, 127]);
|
|
5072
|
+
* ```
|
|
5073
|
+
* @group Implementation
|
|
5074
|
+
* @category BCS
|
|
5075
|
+
*/
|
|
5076
|
+
static I8(values: Array<number>): MoveVector<I8>;
|
|
5077
|
+
/**
|
|
5078
|
+
* Factory method to generate a MoveVector<I16> from an array of numbers.
|
|
5079
|
+
*
|
|
5080
|
+
* @param values - The values used to fill the MoveVector.
|
|
5081
|
+
* @returns A MoveVector<I16> with the inner values.
|
|
5082
|
+
*
|
|
5083
|
+
* @example
|
|
5084
|
+
* ```typescript
|
|
5085
|
+
* const v = MoveVector.I16([-1, 0, 1, 32767]);
|
|
5086
|
+
* ```
|
|
5087
|
+
* @group Implementation
|
|
5088
|
+
* @category BCS
|
|
5089
|
+
*/
|
|
5090
|
+
static I16(values: Array<number>): MoveVector<I16>;
|
|
5091
|
+
/**
|
|
5092
|
+
* Factory method to generate a MoveVector<I32> from an array of numbers.
|
|
5093
|
+
*
|
|
5094
|
+
* @param values - The values used to fill the MoveVector.
|
|
5095
|
+
* @returns A MoveVector<I32> with the inner values.
|
|
5096
|
+
*
|
|
5097
|
+
* @example
|
|
5098
|
+
* ```typescript
|
|
5099
|
+
* const v = MoveVector.I32([-1, 0, 1, 2147483647]);
|
|
5100
|
+
* ```
|
|
5101
|
+
* @group Implementation
|
|
5102
|
+
* @category BCS
|
|
5103
|
+
*/
|
|
5104
|
+
static I32(values: Array<number>): MoveVector<I32>;
|
|
5105
|
+
/**
|
|
5106
|
+
* Factory method to generate a MoveVector<I64> from an array of numbers or bigints.
|
|
5107
|
+
*
|
|
5108
|
+
* @param values - The values used to fill the MoveVector.
|
|
5109
|
+
* @returns A MoveVector<I64> with the inner values.
|
|
5110
|
+
*
|
|
5111
|
+
* @example
|
|
5112
|
+
* ```typescript
|
|
5113
|
+
* const v = MoveVector.I64([-1n, 0n, 1n, 9223372036854775807n]);
|
|
5114
|
+
* ```
|
|
5115
|
+
* @group Implementation
|
|
5116
|
+
* @category BCS
|
|
5117
|
+
*/
|
|
5118
|
+
static I64(values: Array<AnyNumber>): MoveVector<I64>;
|
|
5119
|
+
/**
|
|
5120
|
+
* Factory method to generate a MoveVector<I128> from an array of numbers or bigints.
|
|
5121
|
+
*
|
|
5122
|
+
* @param values - The values used to fill the MoveVector.
|
|
5123
|
+
* @returns A MoveVector<I128> with the inner values.
|
|
5124
|
+
*
|
|
5125
|
+
* @example
|
|
5126
|
+
* ```typescript
|
|
5127
|
+
* const v = MoveVector.I128([-1n, 0n, 1n]);
|
|
5128
|
+
* ```
|
|
5129
|
+
* @group Implementation
|
|
5130
|
+
* @category BCS
|
|
5131
|
+
*/
|
|
5132
|
+
static I128(values: Array<AnyNumber>): MoveVector<I128>;
|
|
5133
|
+
/**
|
|
5134
|
+
* Factory method to generate a MoveVector<I256> from an array of numbers or bigints.
|
|
5135
|
+
*
|
|
5136
|
+
* @param values - The values used to fill the MoveVector.
|
|
5137
|
+
* @returns A MoveVector<I256> with the inner values.
|
|
5138
|
+
*
|
|
5139
|
+
* @example
|
|
5140
|
+
* ```typescript
|
|
5141
|
+
* const v = MoveVector.I256([-1n, 0n, 1n]);
|
|
5142
|
+
* ```
|
|
5143
|
+
* @group Implementation
|
|
5144
|
+
* @category BCS
|
|
5145
|
+
*/
|
|
5146
|
+
static I256(values: Array<AnyNumber>): MoveVector<I256>;
|
|
5063
5147
|
/**
|
|
5064
5148
|
* Factory method to generate a MoveVector<MoveString> from a `string` or `undefined`.
|
|
5065
5149
|
* This function creates a MoveVector that encapsulates a MoveString if the provided value is not null or undefined.
|
|
@@ -5277,6 +5361,90 @@ declare class MoveOption<T extends Serializable & EntryFunctionArgument> extends
|
|
|
5277
5361
|
* @category BCS
|
|
5278
5362
|
*/
|
|
5279
5363
|
static Bool(value?: boolean | null): MoveOption<Bool>;
|
|
5364
|
+
/**
|
|
5365
|
+
* Factory method to generate a MoveOption<I8> from a `number` or `undefined`.
|
|
5366
|
+
*
|
|
5367
|
+
* @example
|
|
5368
|
+
* MoveOption.I8(1).isSome() === true;
|
|
5369
|
+
* MoveOption.I8().isSome() === false;
|
|
5370
|
+
* MoveOption.I8(undefined).isSome() === false;
|
|
5371
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5372
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5373
|
+
* @returns a MoveOption<I8> with an inner value `value`
|
|
5374
|
+
* @group Implementation
|
|
5375
|
+
* @category BCS
|
|
5376
|
+
*/
|
|
5377
|
+
static I8(value?: number | null): MoveOption<I8>;
|
|
5378
|
+
/**
|
|
5379
|
+
* Factory method to generate a MoveOption<I16> from a `number` or `undefined`.
|
|
5380
|
+
*
|
|
5381
|
+
* @example
|
|
5382
|
+
* MoveOption.I16(1).isSome() === true;
|
|
5383
|
+
* MoveOption.I16().isSome() === false;
|
|
5384
|
+
* MoveOption.I16(undefined).isSome() === false;
|
|
5385
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5386
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5387
|
+
* @returns a MoveOption<I16> with an inner value `value`
|
|
5388
|
+
* @group Implementation
|
|
5389
|
+
* @category BCS
|
|
5390
|
+
*/
|
|
5391
|
+
static I16(value?: number | null): MoveOption<I16>;
|
|
5392
|
+
/**
|
|
5393
|
+
* Factory method to generate a MoveOption<I32> from a `number` or `undefined`.
|
|
5394
|
+
*
|
|
5395
|
+
* @example
|
|
5396
|
+
* MoveOption.I32(1).isSome() === true;
|
|
5397
|
+
* MoveOption.I32().isSome() === false;
|
|
5398
|
+
* MoveOption.I32(undefined).isSome() === false;
|
|
5399
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5400
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5401
|
+
* @returns a MoveOption<I32> with an inner value `value`
|
|
5402
|
+
* @group Implementation
|
|
5403
|
+
* @category BCS
|
|
5404
|
+
*/
|
|
5405
|
+
static I32(value?: number | null): MoveOption<I32>;
|
|
5406
|
+
/**
|
|
5407
|
+
* Factory method to generate a MoveOption<I64> from a `number` or a `bigint` or `undefined`.
|
|
5408
|
+
*
|
|
5409
|
+
* @example
|
|
5410
|
+
* MoveOption.I64(1).isSome() === true;
|
|
5411
|
+
* MoveOption.I64().isSome() === false;
|
|
5412
|
+
* MoveOption.I64(undefined).isSome() === false;
|
|
5413
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5414
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5415
|
+
* @returns a MoveOption<I64> with an inner value `value`
|
|
5416
|
+
* @group Implementation
|
|
5417
|
+
* @category BCS
|
|
5418
|
+
*/
|
|
5419
|
+
static I64(value?: AnyNumber | null): MoveOption<I64>;
|
|
5420
|
+
/**
|
|
5421
|
+
* Factory method to generate a MoveOption<I128> from a `number` or a `bigint` or `undefined`.
|
|
5422
|
+
*
|
|
5423
|
+
* @example
|
|
5424
|
+
* MoveOption.I128(1).isSome() === true;
|
|
5425
|
+
* MoveOption.I128().isSome() === false;
|
|
5426
|
+
* MoveOption.I128(undefined).isSome() === false;
|
|
5427
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5428
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5429
|
+
* @returns a MoveOption<I128> with an inner value `value`
|
|
5430
|
+
* @group Implementation
|
|
5431
|
+
* @category BCS
|
|
5432
|
+
*/
|
|
5433
|
+
static I128(value?: AnyNumber | null): MoveOption<I128>;
|
|
5434
|
+
/**
|
|
5435
|
+
* Factory method to generate a MoveOption<I256> from a `number` or a `bigint` or `undefined`.
|
|
5436
|
+
*
|
|
5437
|
+
* @example
|
|
5438
|
+
* MoveOption.I256(1).isSome() === true;
|
|
5439
|
+
* MoveOption.I256().isSome() === false;
|
|
5440
|
+
* MoveOption.I256(undefined).isSome() === false;
|
|
5441
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
5442
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
5443
|
+
* @returns a MoveOption<I256> with an inner value `value`
|
|
5444
|
+
* @group Implementation
|
|
5445
|
+
* @category BCS
|
|
5446
|
+
*/
|
|
5447
|
+
static I256(value?: AnyNumber | null): MoveOption<I256>;
|
|
5280
5448
|
/**
|
|
5281
5449
|
* Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.
|
|
5282
5450
|
*
|
|
@@ -5388,13 +5556,13 @@ type SimpleEntryFunctionArgumentTypes = boolean | number | bigint | string | nul
|
|
|
5388
5556
|
* @group Implementation
|
|
5389
5557
|
* @category Transactions
|
|
5390
5558
|
*/
|
|
5391
|
-
type EntryFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveVector<EntryFunctionArgumentTypes> | MoveOption<EntryFunctionArgumentTypes> | MoveString | FixedBytes;
|
|
5559
|
+
type EntryFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | I8 | I16 | I32 | I64 | I128 | I256 | AccountAddress | MoveVector<EntryFunctionArgumentTypes> | MoveOption<EntryFunctionArgumentTypes> | MoveString | FixedBytes;
|
|
5392
5560
|
/**
|
|
5393
5561
|
* Script function arguments for building raw transactions using BCS serialized arguments.
|
|
5394
5562
|
* @group Implementation
|
|
5395
5563
|
* @category Transactions
|
|
5396
5564
|
*/
|
|
5397
|
-
type ScriptFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveVector<ScriptFunctionArgumentTypes> | MoveString | FixedBytes | Serialized;
|
|
5565
|
+
type ScriptFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | I8 | I16 | I32 | I64 | I128 | I256 | AccountAddress | MoveVector<ScriptFunctionArgumentTypes> | MoveString | FixedBytes | Serialized;
|
|
5398
5566
|
/**
|
|
5399
5567
|
* Inputs for Entry functions, view functions, and scripts, which can be a string representation of various types including
|
|
5400
5568
|
* primitive types, vectors, and structured types.
|
|
@@ -5407,6 +5575,12 @@ type ScriptFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | A
|
|
|
5407
5575
|
* - u64
|
|
5408
5576
|
* - u128
|
|
5409
5577
|
* - u256
|
|
5578
|
+
* - i8
|
|
5579
|
+
* - i16
|
|
5580
|
+
* - i32
|
|
5581
|
+
* - i64
|
|
5582
|
+
* - i128
|
|
5583
|
+
* - i256
|
|
5410
5584
|
* - bool
|
|
5411
5585
|
* - address
|
|
5412
5586
|
* - signer
|
|
@@ -5840,7 +6014,13 @@ declare enum ScriptTransactionArgumentVariants {
|
|
|
5840
6014
|
U16 = 6,
|
|
5841
6015
|
U32 = 7,
|
|
5842
6016
|
U256 = 8,
|
|
5843
|
-
Serialized = 9
|
|
6017
|
+
Serialized = 9,
|
|
6018
|
+
I8 = 10,
|
|
6019
|
+
I16 = 11,
|
|
6020
|
+
I32 = 12,
|
|
6021
|
+
I64 = 13,
|
|
6022
|
+
I128 = 14,
|
|
6023
|
+
I256 = 15
|
|
5844
6024
|
}
|
|
5845
6025
|
/**
|
|
5846
6026
|
* The payload for various transaction types in the system.
|
|
@@ -6931,6 +7111,30 @@ type MoveUint128Type = string;
|
|
|
6931
7111
|
* A string representation of a 256-bit unsigned integer used in Move programming.
|
|
6932
7112
|
*/
|
|
6933
7113
|
type MoveUint256Type = string;
|
|
7114
|
+
/**
|
|
7115
|
+
* A number representing a Move int8 type.
|
|
7116
|
+
*/
|
|
7117
|
+
type MoveInt8Type = number;
|
|
7118
|
+
/**
|
|
7119
|
+
* A 16-bit signed integer used in the Move programming language.
|
|
7120
|
+
*/
|
|
7121
|
+
type MoveInt16Type = number;
|
|
7122
|
+
/**
|
|
7123
|
+
* A 32-bit signed integer type used in Move programming.
|
|
7124
|
+
*/
|
|
7125
|
+
type MoveInt32Type = number;
|
|
7126
|
+
/**
|
|
7127
|
+
* A string representation of a 64-bit signed integer used in Move programming.
|
|
7128
|
+
*/
|
|
7129
|
+
type MoveInt64Type = string;
|
|
7130
|
+
/**
|
|
7131
|
+
* A string representing a 128-bit signed integer in the Move programming language.
|
|
7132
|
+
*/
|
|
7133
|
+
type MoveInt128Type = string;
|
|
7134
|
+
/**
|
|
7135
|
+
* A string representation of a 256-bit signed integer used in Move programming.
|
|
7136
|
+
*/
|
|
7137
|
+
type MoveInt256Type = string;
|
|
6934
7138
|
/**
|
|
6935
7139
|
* A string representing a Move address.
|
|
6936
7140
|
*/
|
|
@@ -6956,7 +7160,7 @@ type MoveStructType = {};
|
|
|
6956
7160
|
* A union type that encompasses various data types used in Move, including primitive types, address types, object types, and
|
|
6957
7161
|
* arrays of MoveType.
|
|
6958
7162
|
*/
|
|
6959
|
-
type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructType | Array<MoveType>;
|
|
7163
|
+
type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveInt8Type | MoveInt16Type | MoveInt32Type | MoveInt64Type | MoveInt128Type | MoveInt256Type | MoveAddressType | MoveObjectType | MoveStructType | Array<MoveType>;
|
|
6960
7164
|
/**
|
|
6961
7165
|
* Possible Move values acceptable by move functions (entry, view)
|
|
6962
7166
|
*
|
|
@@ -6968,6 +7172,10 @@ type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Ty
|
|
|
6968
7172
|
*
|
|
6969
7173
|
* `u64, u128, u256 -> string`
|
|
6970
7174
|
*
|
|
7175
|
+
* `i8, i16, i32 -> number`
|
|
7176
|
+
*
|
|
7177
|
+
* `i64, i128, i256 -> string`
|
|
7178
|
+
*
|
|
6971
7179
|
* `String -> string`
|
|
6972
7180
|
*
|
|
6973
7181
|
* `Address -> 0x${string}`
|
|
@@ -6980,7 +7188,7 @@ type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Ty
|
|
|
6980
7188
|
*
|
|
6981
7189
|
* `Option -> MoveValue | null | undefined`
|
|
6982
7190
|
*/
|
|
6983
|
-
type MoveValue = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructId | MoveOptionType | Array<MoveValue>;
|
|
7191
|
+
type MoveValue = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveInt8Type | MoveInt16Type | MoveInt32Type | MoveInt64Type | MoveInt128Type | MoveInt256Type | MoveAddressType | MoveObjectType | MoveStructId | MoveOptionType | Array<MoveValue>;
|
|
6984
7192
|
/**
|
|
6985
7193
|
* A string representation of a Move module, formatted as `module_name::function_name`.
|
|
6986
7194
|
* Module names are case-sensitive.
|
|
@@ -7050,6 +7258,11 @@ type MoveStruct = {
|
|
|
7050
7258
|
* the Move source code. This attribute is only relevant for v2 events.
|
|
7051
7259
|
*/
|
|
7052
7260
|
is_event: boolean;
|
|
7261
|
+
/**
|
|
7262
|
+
* True if the struct is an enum (e.g. enum MyEnum { A, B, C }), false if it is a
|
|
7263
|
+
* regular struct (e.g. struct MyStruct { a: u8, b: u8 }).
|
|
7264
|
+
*/
|
|
7265
|
+
is_enum: boolean;
|
|
7053
7266
|
/**
|
|
7054
7267
|
* Abilities associated with the struct
|
|
7055
7268
|
*/
|
|
@@ -7768,4 +7981,4 @@ declare class AccountAbstractionMessage extends Serializable {
|
|
|
7768
7981
|
static deserialize(deserializer: Deserializer): AccountAbstractionMessage;
|
|
7769
7982
|
}
|
|
7770
7983
|
|
|
7771
|
-
export { type InputViewFunctionDataWithABI as $, AccountAddress as A, Bool as B, type InputGenerateTransactionPayloadData as C, Deserializer as D, EphemeralPublicKeyVariant as E, FixedBytes as F, type InputScriptData as G, type HexInput as H, type InputGenerateTransactionPayloadDataWithRemoteABI as I, type MoveFunction as J, type InputEntryFunctionDataWithRemoteABI as K, type LedgerVersionArg as L, MultiKey as M, TransactionPayloadEntryFunction as N, type InputMultiSigDataWithRemoteABI as O, PublicKey as P, TransactionPayloadMultiSig as Q, RawTransaction as R, Serializer as S, TransactionPayloadScript as T, U8 as U, type VerifySignatureArgs as V, type InputEntryFunctionDataWithABI as W, type InputMultiSigDataWithABI as X, type InputViewFunctionDataWithRemoteABI as Y, ZkpVariant as Z, EntryFunction as _, AccountPublicKey as a, type GasEstimation as a$, type AnyTransactionPayloadInstance as a0, type InputGenerateTransactionOptions as a1, TransactionInnerPayload as a2, type InputGenerateSingleSignerRawTransactionArgs as a3, SimpleTransaction as a4, type InputGenerateMultiAgentRawTransactionArgs as a5, MultiAgentTransaction as a6, type InputSimulateTransactionData as a7, AccountAuthenticatorNoAccountAuthenticator as a8, AccountAuthenticatorEd25519 as a9, type PrivateKeyInput as aA, type GetCollectionDataResponse as aB, type GetTokenDataResponse as aC, type GetCurrentTokenOwnershipResponse as aD, type GetOwnedTokensResponse as aE, type GetTokenActivityResponse as aF, type WaitForTransactionOptions as aG, type UserTransactionResponse as aH, type GetFungibleAssetMetadataResponse as aI, type GetFungibleAssetActivitiesResponse as aJ, type GetCurrentFungibleAssetBalancesResponse as aK, type LedgerInfo as aL, type Block as aM, type MoveValue as aN, type InputViewFunctionData as aO, type InputViewFunctionJsonData as aP, type GetChainTopUserTransactionsResponse as aQ, type GraphqlQuery as aR, ProcessorType as aS, type GetProcessorStatusResponse as aT, type GetANSNameResponse as aU, type GetNumberOfDelegatorsResponse as aV, type GetDelegatedStakingActivitiesResponse as aW, type InputSimulateTransactionOptions as aX, type InputTransactionPluginData as aY, type PendingTransactionResponse as aZ, type CommittedTransactionResponse as a_, AccountAuthenticatorSingleKey as aa, AccountAuthenticatorMultiKey as ab, type InputSubmitTransactionData as ac, type TypeArgument as ad, TypeTag as ae, type MoveModule as af, type FunctionABI as ag, type EntryFunctionABI as ah, type ViewFunctionABI as ai, type AnyRawTransaction as aj, type AnyRawTransactionInstance as ak, type AccountData as al, type MoveModuleBytecode as am, type CursorPaginationArgs as an, type PaginationArgs as ao, type TransactionResponse as ap, type MoveResource as aq, type MoveStructId as ar, type TokenStandardArg as as, type OrderByArg as at, type GetAccountOwnedTokensQueryResponse as au, type GetAccountOwnedTokensFromCollectionResponse as av, type GetAccountCollectionsWithOwnedTokenResponse as aw, type GetAccountCoinsDataResponse as ax, type WhereArg as ay, type GetObjectDataQueryResponse as az, AuthenticationKey as b, TypeTagBool as b$, Ed25519PrivateKey as b0, type TableItemRequest as b1, type GetTableItemsDataResponse as b2, type GetTableItemsMetadataResponse as b3, SigningScheme as b4, SigningSchemeInput as b5, AnySignature as b6, type EntryFunctionArgument as b7, MultiKeySignature as b8, AccountAuthenticatorMultiEd25519 as b9, AbstractMultiKey as bA, Secp256k1PublicKey as bB, Secp256k1PrivateKey as bC, Secp256k1Signature as bD, HexInvalidReason as bE, hexToAsciiString as bF, AccountAbstractionMessage as bG, ChainId as bH, Identifier as bI, ModuleId as bJ, RawTransactionWithData as bK, MultiAgentRawTransaction as bL, FeePayerRawTransaction as bM, type TransactionArgument as bN, type ScriptFunctionArgument as bO, deserializeFromScriptArgument as bP, TransactionPayload as bQ, Script as bR, MultiSig as bS, MultiSigTransactionPayload as bT, TransactionInnerPayloadV1 as bU, TransactionExecutable as bV, TransactionExecutableScript as bW, TransactionExecutableEntryFunction as bX, TransactionExecutableEmpty as bY, TransactionExtraConfig as bZ, TransactionExtraConfigV1 as b_, AccountAuthenticatorAbstraction as ba, type MoveFunctionId as bb, type ClientRequest as bc, type Client as bd, type ClientResponse as be, type AptosRequest as bf, AptosApiType as bg, type AptosResponse as bh, MimeType as bi, type ClientConfig as bj, type Deserializable as bk, ensureBoolean as bl, outOfRangeErrorMessage as bm, validateNumberInRange as bn, I8 as bo, I16 as bp, I32 as bq, I64 as br, I128 as bs, I256 as bt, Serialized as bu, MoveOption as bv, AddressInvalidReason as bw, ParsingError as bx, type ParsingResult as by, isCanonicalEd25519Signature as bz, type VerifySignatureAsyncArgs as c, type Int128 as c$, TypeTagU8 as c0, TypeTagI8 as c1, TypeTagU16 as c2, TypeTagI16 as c3, TypeTagU32 as c4, TypeTagI32 as c5, TypeTagU64 as c6, TypeTagI64 as c7, TypeTagU128 as c8, TypeTagI128 as c9, type OrderBy as cA, type OrderByValue as cB, type TokenStandard as cC, TypeTagVariants as cD, ScriptTransactionArgumentVariants as cE, TransactionPayloadVariants as cF, TransactionInnerPayloadVariants as cG, TransactionExecutableVariants as cH, TransactionExtraConfigVariants as cI, TransactionVariants as cJ, TransactionAuthenticatorVariant as cK, AccountAuthenticatorVariant as cL, PrivateKeyVariants as cM, AnyPublicKeyVariant as cN, anyPublicKeyVariantToString as cO, AnySignatureVariant as cP, EphemeralSignatureVariant as cQ, type Uint8 as cR, type Uint16 as cS, type Uint32 as cT, type Uint64 as cU, type Uint128 as cV, type Uint256 as cW, type Int8 as cX, type Int16 as cY, type Int32 as cZ, type Int64 as c_, TypeTagU256 as ca, TypeTagI256 as cb, TypeTagAddress as cc, TypeTagSigner as cd, TypeTagReference as ce, TypeTagGeneric as cf, TypeTagVector as cg, TypeTagStruct as ch, StructTag as ci, aptosCoinStructTag as cj, stringStructTag as ck, optionStructTag as cl, objectStructTag as cm, type ScriptFunctionArgumentTypes as cn, type InputGenerateSequenceNumberTransactionOptions as co, type InputGenerateOrderlessTransactionOptions as cp, type InputEntryFunctionData as cq, type InputGenerateTransactionPayloadDataWithABI as cr, type InputMultiSigData as cs, type ViewFunctionJsonPayload as ct, type InputGenerateRawTransactionArgs as cu, type InputGenerateSingleSignerRawTransactionData as cv, type InputGenerateMultiAgentRawTransactionData as cw, type InputGenerateTransactionData as cx, type GetAccountAddressesForAuthKeyResponse as cy, type GetEventsResponse as cz, Signature as d, type MoveUint128Type as d$, type Int256 as d0, type AptosSettings as d1, type FullNodeConfig as d2, type IndexerConfig as d3, type FaucetConfig as d4, type TransactionGenerationConfig as d5, type ClientHeadersType as d6, type PluginConfig as d7, type PluginSettings as d8, type TransactionSubmitter as d9, type ScriptPayloadResponse as dA, type MultisigPayloadResponse as dB, type GenesisPayload as dC, type MoveScriptBytecode as dD, type TransactionSignature as dE, isEd25519Signature as dF, isSecp256k1Signature as dG, isMultiAgentSignature as dH, isFeePayerSignature as dI, isMultiEd25519Signature as dJ, isSingleSenderSignature as dK, type TransactionEd25519Signature as dL, type TransactionSecp256k1Signature as dM, type TransactionSingleSenderSignature as dN, type TransactionMultiEd25519Signature as dO, type TransactionMultiAgentSignature as dP, type TransactionFeePayerSignature as dQ, type AccountSignature as dR, type WriteSet as dS, type ScriptWriteSet as dT, type DirectWriteSet as dU, type EventGuid as dV, type Event as dW, type MoveUint8Type as dX, type MoveUint16Type as dY, type MoveUint32Type as dZ, type MoveUint64Type as d_, TransactionResponseType as da, isPendingTransactionResponse as db, isUserTransactionResponse as dc, isGenesisTransactionResponse as dd, isBlockMetadataTransactionResponse as de, isStateCheckpointTransactionResponse as df, isValidatorTransactionResponse as dg, isBlockEpilogueTransactionResponse as dh, type GenesisTransactionResponse as di, type BlockMetadataTransactionResponse as dj, type StateCheckpointTransactionResponse as dk, type ValidatorTransactionResponse as dl, type BlockEndInfo as dm, type BlockEpilogueTransactionResponse as dn, type WriteSetChange as dp, type WriteSetChangeDeleteModule as dq, type WriteSetChangeDeleteResource as dr, type WriteSetChangeDeleteTableItem as ds, type WriteSetChangeWriteModule as dt, type WriteSetChangeWriteResource as du, type WriteSetChangeWriteTableItem as dv, type DecodedTableData as dw, type DeletedTableData as dx, type TransactionPayloadResponse as dy, type EntryFunctionPayloadResponse as dz, AptosConfig as e, type MoveUint256Type as e0, type MoveAddressType as e1, type MoveObjectType as e2, type MoveOptionType as e3, type MoveStructType as e4, type MoveType as e5, type MoveModuleId as e6, MoveFunctionVisibility as e7, MoveAbility as e8, type MoveFunctionGenericTypeParam as e9, type MoveStructField as ea, type MoveStruct as eb, RoleType as ec, type AuthenticationKeyScheme as ed, DeriveScheme as ee, type GenerateAccountWithEd25519 as ef, type GenerateAccountWithSingleSignerSecp256k1Key as eg, type GenerateAccount as eh, NetworkToIndexerAPI as ei, NetworkToNodeAPI as ej, NetworkToFaucetAPI as ek, NetworkToPepperAPI as el, NetworkToProverAPI as em, Network as en, NetworkToChainId as eo, NetworkToNetworkName as ep, DEFAULT_MAX_GAS_AMOUNT as eq, DEFAULT_TXN_EXP_SEC_FROM_NOW as er, DEFAULT_TXN_TIMEOUT_SEC as es, APTOS_COIN as et, APTOS_FA as eu, RAW_TRANSACTION_SALT as ev, RAW_TRANSACTION_WITH_DATA_SALT as ew, ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT as ex, FIREBASE_AUTH_ISS_PATTERN as ey, Serializable as f, EphemeralCertificateVariant as g, type AccountAddressInput as h, PrivateKey as i, Hex as j, Ed25519PublicKey as k, AnyPublicKey as l, MultiEd25519PublicKey as m, Ed25519Signature as n, MultiEd25519Signature as o, AccountAuthenticator as p, MoveString as q, MoveVector as r, U64 as s, type AnyNumber as t, type SimpleEntryFunctionArgumentTypes as u, type EntryFunctionArgumentTypes as v, U16 as w, U32 as x, U128 as y, U256 as z };
|
|
7984
|
+
export { type InputMultiSigDataWithRemoteABI as $, AccountAddress as A, Bool as B, I16 as C, Deserializer as D, EphemeralPublicKeyVariant as E, FixedBytes as F, I32 as G, type HexInput as H, I8 as I, I64 as J, I128 as K, type LedgerVersionArg as L, MultiKey as M, I256 as N, type InputGenerateTransactionPayloadDataWithRemoteABI as O, PublicKey as P, type InputGenerateTransactionPayloadData as Q, RawTransaction as R, Serializer as S, type InputScriptData as T, U8 as U, type VerifySignatureArgs as V, type MoveFunction as W, TransactionPayloadScript as X, type InputEntryFunctionDataWithRemoteABI as Y, ZkpVariant as Z, TransactionPayloadEntryFunction as _, AccountPublicKey as a, type GetNumberOfDelegatorsResponse as a$, TransactionPayloadMultiSig as a0, type InputEntryFunctionDataWithABI as a1, type InputMultiSigDataWithABI as a2, type InputViewFunctionDataWithRemoteABI as a3, EntryFunction as a4, type InputViewFunctionDataWithABI as a5, type AnyTransactionPayloadInstance as a6, type InputGenerateTransactionOptions as a7, TransactionInnerPayload as a8, type InputGenerateSingleSignerRawTransactionArgs as a9, type GetAccountOwnedTokensQueryResponse as aA, type GetAccountOwnedTokensFromCollectionResponse as aB, type GetAccountCollectionsWithOwnedTokenResponse as aC, type GetAccountCoinsDataResponse as aD, type WhereArg as aE, type GetObjectDataQueryResponse as aF, type PrivateKeyInput as aG, type GetCollectionDataResponse as aH, type GetTokenDataResponse as aI, type GetCurrentTokenOwnershipResponse as aJ, type GetOwnedTokensResponse as aK, type GetTokenActivityResponse as aL, type WaitForTransactionOptions as aM, type UserTransactionResponse as aN, type GetFungibleAssetMetadataResponse as aO, type GetFungibleAssetActivitiesResponse as aP, type GetCurrentFungibleAssetBalancesResponse as aQ, type LedgerInfo as aR, type Block as aS, type MoveValue as aT, type InputViewFunctionData as aU, type InputViewFunctionJsonData as aV, type GetChainTopUserTransactionsResponse as aW, type GraphqlQuery as aX, ProcessorType as aY, type GetProcessorStatusResponse as aZ, type GetANSNameResponse as a_, SimpleTransaction as aa, type InputGenerateMultiAgentRawTransactionArgs as ab, MultiAgentTransaction as ac, type InputSimulateTransactionData as ad, AccountAuthenticatorNoAccountAuthenticator as ae, AccountAuthenticatorEd25519 as af, AccountAuthenticatorSingleKey as ag, AccountAuthenticatorMultiKey as ah, type InputSubmitTransactionData as ai, type TypeArgument as aj, TypeTag as ak, type MoveModule as al, type FunctionABI as am, type EntryFunctionABI as an, type ViewFunctionABI as ao, type AnyRawTransaction as ap, type AnyRawTransactionInstance as aq, type AccountData as ar, type MoveModuleBytecode as as, type CursorPaginationArgs as at, type PaginationArgs as au, type TransactionResponse as av, type MoveResource as aw, type MoveStructId as ax, type TokenStandardArg as ay, type OrderByArg as az, AuthenticationKey as b, TypeTagBool as b$, type GetDelegatedStakingActivitiesResponse as b0, type InputSimulateTransactionOptions as b1, type InputTransactionPluginData as b2, type PendingTransactionResponse as b3, type CommittedTransactionResponse as b4, type GasEstimation as b5, Ed25519PrivateKey as b6, type TableItemRequest as b7, type GetTableItemsDataResponse as b8, type GetTableItemsMetadataResponse as b9, AbstractMultiKey as bA, Secp256k1PublicKey as bB, Secp256k1PrivateKey as bC, Secp256k1Signature as bD, HexInvalidReason as bE, hexToAsciiString as bF, AccountAbstractionMessage as bG, ChainId as bH, Identifier as bI, ModuleId as bJ, RawTransactionWithData as bK, MultiAgentRawTransaction as bL, FeePayerRawTransaction as bM, type TransactionArgument as bN, type ScriptFunctionArgument as bO, deserializeFromScriptArgument as bP, TransactionPayload as bQ, Script as bR, MultiSig as bS, MultiSigTransactionPayload as bT, TransactionInnerPayloadV1 as bU, TransactionExecutable as bV, TransactionExecutableScript as bW, TransactionExecutableEntryFunction as bX, TransactionExecutableEmpty as bY, TransactionExtraConfig as bZ, TransactionExtraConfigV1 as b_, SigningScheme as ba, SigningSchemeInput as bb, AnySignature as bc, type EntryFunctionArgument as bd, MultiKeySignature as be, AccountAuthenticatorMultiEd25519 as bf, AccountAuthenticatorAbstraction as bg, type MoveFunctionId as bh, type ClientRequest as bi, type Client as bj, type ClientResponse as bk, type AptosRequest as bl, AptosApiType as bm, type AptosResponse as bn, MimeType as bo, type ClientConfig as bp, type Deserializable as bq, ensureBoolean as br, outOfRangeErrorMessage as bs, validateNumberInRange as bt, Serialized as bu, MoveOption as bv, AddressInvalidReason as bw, ParsingError as bx, type ParsingResult as by, isCanonicalEd25519Signature as bz, type VerifySignatureAsyncArgs as c, type Int128 as c$, TypeTagU8 as c0, TypeTagI8 as c1, TypeTagU16 as c2, TypeTagI16 as c3, TypeTagU32 as c4, TypeTagI32 as c5, TypeTagU64 as c6, TypeTagI64 as c7, TypeTagU128 as c8, TypeTagI128 as c9, type OrderBy as cA, type OrderByValue as cB, type TokenStandard as cC, TypeTagVariants as cD, ScriptTransactionArgumentVariants as cE, TransactionPayloadVariants as cF, TransactionInnerPayloadVariants as cG, TransactionExecutableVariants as cH, TransactionExtraConfigVariants as cI, TransactionVariants as cJ, TransactionAuthenticatorVariant as cK, AccountAuthenticatorVariant as cL, PrivateKeyVariants as cM, AnyPublicKeyVariant as cN, anyPublicKeyVariantToString as cO, AnySignatureVariant as cP, EphemeralSignatureVariant as cQ, type Uint8 as cR, type Uint16 as cS, type Uint32 as cT, type Uint64 as cU, type Uint128 as cV, type Uint256 as cW, type Int8 as cX, type Int16 as cY, type Int32 as cZ, type Int64 as c_, TypeTagU256 as ca, TypeTagI256 as cb, TypeTagAddress as cc, TypeTagSigner as cd, TypeTagReference as ce, TypeTagGeneric as cf, TypeTagVector as cg, TypeTagStruct as ch, StructTag as ci, aptosCoinStructTag as cj, stringStructTag as ck, optionStructTag as cl, objectStructTag as cm, type ScriptFunctionArgumentTypes as cn, type InputGenerateSequenceNumberTransactionOptions as co, type InputGenerateOrderlessTransactionOptions as cp, type InputEntryFunctionData as cq, type InputGenerateTransactionPayloadDataWithABI as cr, type InputMultiSigData as cs, type ViewFunctionJsonPayload as ct, type InputGenerateRawTransactionArgs as cu, type InputGenerateSingleSignerRawTransactionData as cv, type InputGenerateMultiAgentRawTransactionData as cw, type InputGenerateTransactionData as cx, type GetAccountAddressesForAuthKeyResponse as cy, type GetEventsResponse as cz, Signature as d, type MoveUint128Type as d$, type Int256 as d0, type AptosSettings as d1, type FullNodeConfig as d2, type IndexerConfig as d3, type FaucetConfig as d4, type TransactionGenerationConfig as d5, type ClientHeadersType as d6, type PluginConfig as d7, type PluginSettings as d8, type TransactionSubmitter as d9, type ScriptPayloadResponse as dA, type MultisigPayloadResponse as dB, type GenesisPayload as dC, type MoveScriptBytecode as dD, type TransactionSignature as dE, isEd25519Signature as dF, isSecp256k1Signature as dG, isMultiAgentSignature as dH, isFeePayerSignature as dI, isMultiEd25519Signature as dJ, isSingleSenderSignature as dK, type TransactionEd25519Signature as dL, type TransactionSecp256k1Signature as dM, type TransactionSingleSenderSignature as dN, type TransactionMultiEd25519Signature as dO, type TransactionMultiAgentSignature as dP, type TransactionFeePayerSignature as dQ, type AccountSignature as dR, type WriteSet as dS, type ScriptWriteSet as dT, type DirectWriteSet as dU, type EventGuid as dV, type Event as dW, type MoveUint8Type as dX, type MoveUint16Type as dY, type MoveUint32Type as dZ, type MoveUint64Type as d_, TransactionResponseType as da, isPendingTransactionResponse as db, isUserTransactionResponse as dc, isGenesisTransactionResponse as dd, isBlockMetadataTransactionResponse as de, isStateCheckpointTransactionResponse as df, isValidatorTransactionResponse as dg, isBlockEpilogueTransactionResponse as dh, type GenesisTransactionResponse as di, type BlockMetadataTransactionResponse as dj, type StateCheckpointTransactionResponse as dk, type ValidatorTransactionResponse as dl, type BlockEndInfo as dm, type BlockEpilogueTransactionResponse as dn, type WriteSetChange as dp, type WriteSetChangeDeleteModule as dq, type WriteSetChangeDeleteResource as dr, type WriteSetChangeDeleteTableItem as ds, type WriteSetChangeWriteModule as dt, type WriteSetChangeWriteResource as du, type WriteSetChangeWriteTableItem as dv, type DecodedTableData as dw, type DeletedTableData as dx, type TransactionPayloadResponse as dy, type EntryFunctionPayloadResponse as dz, AptosConfig as e, type MoveUint256Type as e0, type MoveInt8Type as e1, type MoveInt16Type as e2, type MoveInt32Type as e3, type MoveInt64Type as e4, type MoveInt128Type as e5, type MoveInt256Type as e6, type MoveAddressType as e7, type MoveObjectType as e8, type MoveOptionType as e9, APTOS_FA as eA, RAW_TRANSACTION_SALT as eB, RAW_TRANSACTION_WITH_DATA_SALT as eC, ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT as eD, FIREBASE_AUTH_ISS_PATTERN as eE, type MoveStructType as ea, type MoveType as eb, type MoveModuleId as ec, MoveFunctionVisibility as ed, MoveAbility as ee, type MoveFunctionGenericTypeParam as ef, type MoveStructField as eg, type MoveStruct as eh, RoleType as ei, type AuthenticationKeyScheme as ej, DeriveScheme as ek, type GenerateAccountWithEd25519 as el, type GenerateAccountWithSingleSignerSecp256k1Key as em, type GenerateAccount as en, NetworkToIndexerAPI as eo, NetworkToNodeAPI as ep, NetworkToFaucetAPI as eq, NetworkToPepperAPI as er, NetworkToProverAPI as es, Network as et, NetworkToChainId as eu, NetworkToNetworkName as ev, DEFAULT_MAX_GAS_AMOUNT as ew, DEFAULT_TXN_EXP_SEC_FROM_NOW as ex, DEFAULT_TXN_TIMEOUT_SEC as ey, APTOS_COIN as ez, Serializable as f, EphemeralCertificateVariant as g, type AccountAddressInput as h, PrivateKey as i, Hex as j, Ed25519PublicKey as k, AnyPublicKey as l, MultiEd25519PublicKey as m, Ed25519Signature as n, MultiEd25519Signature as o, AccountAuthenticator as p, MoveString as q, MoveVector as r, U64 as s, type AnyNumber as t, type SimpleEntryFunctionArgumentTypes as u, type EntryFunctionArgumentTypes as v, U16 as w, U32 as x, U128 as y, U256 as z };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var L=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var g=(n,e,t,r)=>{for(var s=r>1?void 0:r?$(e,t):e,o=n.length-1,c;o>=0;o--)(c=n[o])&&(s=(r?c(e,t,s):c(s))||s);return r&&s&&L(e,t,s),s};var u=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var _utils = require('@noble/hashes/utils');var j=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(j||{}),x= exports.v =class n{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new u("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new u("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new u(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static hexInputToUint8Array(e){return e instanceof Uint8Array?e:n.fromHexString(e).toUint8Array()}static hexInputToString(e){return n.fromHexInput(e).toString()}static hexInputToStringWithoutPrefix(e){return n.fromHexInput(e).toStringWithoutPrefix()}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}},Be= exports.w =n=>new TextDecoder().decode(x.fromHexInput(n).toUint8Array());var R=255,U= exports.c =65535,f= exports.d =4294967295,m= exports.e =18446744073709551615n,I= exports.f =340282366920938463463374607431768211455n,v= exports.g =115792089237316195423570985008687907853269984665640564039457584007913129639935n,T= exports.h =-128,B= exports.i =127,N= exports.j =-32768,E= exports.k =32767,C= exports.l =-2147483648,w= exports.m =2147483647,k= exports.n =-9223372036854775808n,O= exports.o =9223372036854775807n,G= exports.p =-170141183460469231731687303715884105728n,D= exports.q =170141183460469231731687303715884105727n,z= exports.r =-57896044618658097711785492504343953926634992332820282019728792003956564819968n,F= exports.s =57896044618658097711785492504343953926634992332820282019728792003956564819967n;var b=class{bcsToBytes(){let e=new d;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return x.fromHexInput(e)}toStringWithoutPrefix(){return this.bcsToHex().toStringWithoutPrefix()}toString(){return`0x${this.toStringWithoutPrefix()}`}},d= exports.y =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,r){this.ensureBufferWillHandleSize(t);let s=new DataView(this.buffer,this.offset);e.apply(s,[0,r,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){K(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(f),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&m,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&I,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeI8(e){this.serializeWithFunction(DataView.prototype.setInt8,1,e)}serializeI16(e){this.serializeWithFunction(DataView.prototype.setInt16,2,e)}serializeI32(e){this.serializeWithFunction(DataView.prototype.setInt32,4,e)}serializeI64(e){let t=BigInt(e),r=t<0?(BigInt(1)<<BigInt(64))+t:t,s=r&BigInt(f),o=r>>BigInt(32);this.serializeU32(Number(s)),this.serializeU32(Number(o))}serializeI128(e){let t=BigInt(e),r=t<0?(BigInt(1)<<BigInt(128))+t:t,s=r&m,o=r>>BigInt(64);this.serializeU64(s),this.serializeU64(o)}serializeI256(e){let t=BigInt(e),r=t<0?(BigInt(1)<<BigInt(256))+t:t,s=r&I,o=r>>BigInt(128);this.serializeU128(s),this.serializeU128(o)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e,t){let r=e!==void 0;this.serializeBool(r),r&&(typeof e=="string"?this.serializeStr(e):e instanceof Uint8Array?t!==void 0?this.serializeFixedBytes(e):this.serializeBytes(e):e.serialize(this))}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};g([l(0,R)],d.prototype,"serializeU8",1),g([l(0,U)],d.prototype,"serializeU16",1),g([l(0,f)],d.prototype,"serializeU32",1),g([l(BigInt(0),m)],d.prototype,"serializeU64",1),g([l(BigInt(0),I)],d.prototype,"serializeU128",1),g([l(BigInt(0),v)],d.prototype,"serializeU256",1),g([l(T,B)],d.prototype,"serializeI8",1),g([l(N,E)],d.prototype,"serializeI16",1),g([l(C,w)],d.prototype,"serializeI32",1),g([l(k,O)],d.prototype,"serializeI64",1),g([l(G,D)],d.prototype,"serializeI128",1),g([l(z,F)],d.prototype,"serializeI256",1),g([l(0,f)],d.prototype,"serializeU32AsUleb128",1);function K(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Y=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Z(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(Y(n,e,t))}function l(n,e){return(t,r,s)=>{let o=s.value;return s.value=function(_){return Z(_,n,e),o.apply(this,[_])},s}}var Q=(s=>(s.JSON="application/json",s.BCS="application/x-bcs",s.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",s.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",s))(Q||{}),J= exports.D =(i=>(i[i.Bool=0]="Bool",i[i.U8=1]="U8",i[i.U64=2]="U64",i[i.U128=3]="U128",i[i.Address=4]="Address",i[i.Signer=5]="Signer",i[i.Vector=6]="Vector",i[i.Struct=7]="Struct",i[i.U16=8]="U16",i[i.U32=9]="U32",i[i.U256=10]="U256",i[i.I8=11]="I8",i[i.I16=12]="I16",i[i.I32=13]="I32",i[i.I64=14]="I64",i[i.I128=15]="I128",i[i.I256=16]="I256",i[i.Reference=254]="Reference",i[i.Generic=255]="Generic",i))(J||{}),H= exports.E =(a=>(a[a.U8=0]="U8",a[a.U64=1]="U64",a[a.U128=2]="U128",a[a.Address=3]="Address",a[a.U8Vector=4]="U8Vector",a[a.Bool=5]="Bool",a[a.U16=6]="U16",a[a.U32=7]="U32",a[a.U256=8]="U256",a[a.Serialized=9]="Serialized",a[a.I8=10]="I8",a[a.I16=11]="I16",a[a.I32=12]="I32",a[a.I64=13]="I64",a[a.I128=14]="I128",a[a.I256=15]="I256",a))(H||{}),V= exports.F =(s=>(s[s.Script=0]="Script",s[s.EntryFunction=2]="EntryFunction",s[s.Multisig=3]="Multisig",s[s.Payload=4]="Payload",s))(V||{}),ee= exports.G =(e=>(e[e.V1=0]="V1",e))(ee||{}),te= exports.H =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=1]="EntryFunction",r[r.Empty=2]="Empty",r))(te||{}),ne= exports.I =(e=>(e[e.V1=0]="V1",e))(ne||{}),re= exports.J =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(re||{}),se= exports.K =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(se||{}),oe= exports.L =(c=>(c[c.Ed25519=0]="Ed25519",c[c.MultiEd25519=1]="MultiEd25519",c[c.SingleKey=2]="SingleKey",c[c.MultiKey=3]="MultiKey",c[c.NoAccountAuthenticator=4]="NoAccountAuthenticator",c[c.Abstraction=5]="Abstraction",c))(oe||{}),ie= exports.M =(r=>(r.Ed25519="ed25519",r.Secp256k1="secp256k1",r.Secp256r1="secp256r1",r))(ie||{}),ae= exports.N =(o=>(o[o.Ed25519=0]="Ed25519",o[o.Secp256k1=1]="Secp256k1",o[o.Secp256r1=2]="Secp256r1",o[o.Keyless=3]="Keyless",o[o.FederatedKeyless=4]="FederatedKeyless",o))(ae||{});function Ge(n){switch(n){case 0:return"ed25519";case 1:return"secp256k1";case 2:return"secp256r1";case 3:return"keyless";case 4:return"federated_keyless";default:throw new Error("Unknown public key variant")}}var pe=(s=>(s[s.Ed25519=0]="Ed25519",s[s.Secp256k1=1]="Secp256k1",s[s.WebAuthn=2]="WebAuthn",s[s.Keyless=3]="Keyless",s))(pe||{}),ce= exports.Q =(e=>(e[e.Ed25519=0]="Ed25519",e))(ce||{}),ue= exports.R =(e=>(e[e.Ed25519=0]="Ed25519",e))(ue||{}),de= exports.S =(e=>(e[e.ZkProof=0]="ZkProof",e))(de||{}),ge= exports.T =(e=>(e[e.Groth16=0]="Groth16",e))(ge||{}),le= exports.U =(_=>(_.Pending="pending_transaction",_.User="user_transaction",_.Genesis="genesis_transaction",_.BlockMetadata="block_metadata_transaction",_.StateCheckpoint="state_checkpoint_transaction",_.Validator="validator_transaction",_.BlockEpilogue="block_epilogue_transaction",_))(le||{});function De(n){return n.type==="pending_transaction"}function ze(n){return n.type==="user_transaction"}function Fe(n){return n.type==="genesis_transaction"}function He(n){return n.type==="block_metadata_transaction"}function We(n){return n.type==="state_checkpoint_transaction"}function Pe(n){return n.type==="validator_transaction"}function Le(n){return n.type==="block_epilogue_transaction"}function $e(n){return"signature"in n&&n.type==="ed25519_signature"}function Xe(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function qe(n){return n.type==="multi_agent_signature"}function je(n){return n.type==="fee_payer_signature"}function Ke(n){return n.type==="multi_ed25519_signature"}function Ye(n){return n.type==="single_sender"}var ye=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ye||{}),_e= exports.ha =(s=>(s.STORE="store",s.DROP="drop",s.KEY="key",s.COPY="copy",s))(_e||{}),he= exports.ia =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(he||{}),xe= exports.ja =(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.SingleKey=2]="SingleKey",s[s.MultiKey=3]="MultiKey",s))(xe||{}),fe= exports.ka =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(fe||{}),W= exports.la =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(W||{});var Ie=(h=>(h.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",h.INVALID_HEX_CHARS="invalid_hex_chars",h.TOO_SHORT="too_short",h.TOO_LONG="too_long",h.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",h.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",h.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",h.INVALID_PADDING_STRICTNESS="INVALID_PADDING_STRICTNESS",h))(Ie||{}),p=class p extends b{constructor(e){if(super(),e.length!==p.LENGTH)throw new u("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toStringShort(){return`0x${this.toStringShortWithoutPrefix()}`}toStringShortWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data).replace(/^0+/,"");return e===""?"0":e}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(p.LENGTH);return new p(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new u("Hex string must start with a leading 0x.","leading_zero_x_required");let t=p.fromString(e);if(e.length!==p.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new u(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new u(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e,{maxMissingChars:t=4}={}){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new u("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new u("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");if(t>63||t<0)throw new u(`maxMissingChars must be between or equal to 0 and 63. Received ${t}`,"INVALID_PADDING_STRICTNESS");let s;try{s=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(c){throw new u(`Hex characters are invalid: ${_optionalChain([c, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}let o=new p(s);if(r.length<64-t&&!o.isSpecial())throw new u(`Hex string is too short, must be ${64-t} to 64 chars long, excluding the leading 0x. You may need to fix
|
|
2
|
+
the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
|
|
3
|
+
Received ${e}`,"too_short");return o}static from(e,{maxMissingChars:t=4}={}){return typeof e=="string"?p.fromString(e,{maxMissingChars:t}):e instanceof Uint8Array?new p(e):e}static fromStrict(e){return typeof e=="string"?p.fromStringStrict(e):e instanceof Uint8Array?new p(e):e}static isValid(e){try{return e.strict?p.fromStrict(e.input):p.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};p.LENGTH=32,p.LONG_STRING_LENGTH=64,p.ZERO=p.from("0x0"),p.ONE=p.from("0x1"),p.TWO=p.from("0x2"),p.THREE=p.from("0x3"),p.FOUR=p.from("0x4"),p.A=p.from("0xA");var y=p;var _sha3 = require('@noble/hashes/sha3');var M=(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,s=new Uint8Array([...t,...r,254]);return new y(_sha3.sha3_256.call(void 0, s))},dt= exports.pa =(n,e)=>{let t=n.bcsToBytes(),r=typeof e=="string"?Buffer.from(e,"utf8"):e,s=new Uint8Array([...t,...r,255]);return new y(_sha3.sha3_256.call(void 0, s))},gt= exports.qa =(n,e)=>{let t=n.bcsToBytes(),r=e.bcsToBytes(),s=new Uint8Array([...t,...r,252]);return new y(_sha3.sha3_256.call(void 0, s))},lt= exports.ra =(n,e,t)=>{let r=`${e}::${t}`;return M(n,r)};var _jsbase64 = require('js-base64');async function ft(n){return new Promise(e=>{setTimeout(e,n)})}function mt(n){return n instanceof Error?n.message:String(n)}var It=()=>Math.floor(Date.now()/1e3);function bt(n){let e=new Date(n*1e3);return e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),Math.floor(e.getTime()/1e3)}function At(n){let e=n.replace(/-/g,"+").replace(/_/g,"/"),t=e+"==".substring(0,(3-e.length%3)%3);return _jsbase64.decode.call(void 0, t)}function St(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4!==0;)e+="=";return new Uint8Array(Buffer.from(e,"base64"))}var Mt=(n,e)=>n*10**e,Rt= exports.za =(n,e)=>n/10**e,P=n=>{let e="";for(let t=2;t<n.length;t+=2)e+=String.fromCharCode(parseInt(n.substring(t,t+2),16));return e},Ut= exports.Aa =n=>{let{account_address:e,module_name:t,struct_name:r}=n,s=P(t),o=P(r);return`${e}::${s}::${o}`},vt= exports.Ba =n=>typeof n=="object"&&!Array.isArray(n)&&n!==null&&"account_address"in n&&"module_name"in n&&"struct_name"in n&&typeof n.account_address=="string"&&typeof n.module_name=="string"&&typeof n.struct_name=="string";function Tt(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],s=e[2];return{moduleAddress:t,moduleName:r,functionName:s}}function Bt(n){let e=n.split("::");return e.length===3&&y.isValid({input:e[0]}).valid}function Nt(n,e=6,t=5){return`${n.slice(0,e)}...${n.slice(-t)}`}var Ae="0x1::aptos_coin::AptosCoin",Et=y.A.toStringLong();function Se(n){let e=/0x[0-9a-fA-F]+/g;return n.replace(e,t=>y.from(t,{maxMissingChars:63}).toStringShort())}function Ct(n){let e=Se(n);return e===Ae?y.A:M(y.A,e)}exports.a = g; exports.b = R; exports.c = U; exports.d = f; exports.e = m; exports.f = I; exports.g = v; exports.h = T; exports.i = B; exports.j = N; exports.k = E; exports.l = C; exports.m = w; exports.n = k; exports.o = O; exports.p = G; exports.q = D; exports.r = z; exports.s = F; exports.t = u; exports.u = j; exports.v = x; exports.w = Be; exports.x = b; exports.y = d; exports.z = K; exports.A = Y; exports.B = Z; exports.C = Q; exports.D = J; exports.E = H; exports.F = V; exports.G = ee; exports.H = te; exports.I = ne; exports.J = re; exports.K = se; exports.L = oe; exports.M = ie; exports.N = ae; exports.O = Ge; exports.P = pe; exports.Q = ce; exports.R = ue; exports.S = de; exports.T = ge; exports.U = le; exports.V = De; exports.W = ze; exports.X = Fe; exports.Y = He; exports.Z = We; exports._ = Pe; exports.$ = Le; exports.aa = $e; exports.ba = Xe; exports.ca = qe; exports.da = je; exports.ea = Ke; exports.fa = Ye; exports.ga = ye; exports.ha = _e; exports.ia = he; exports.ja = xe; exports.ka = fe; exports.la = W; exports.ma = Ie; exports.na = y; exports.oa = M; exports.pa = dt; exports.qa = gt; exports.ra = lt; exports.sa = ft; exports.ta = mt; exports.ua = It; exports.va = bt; exports.wa = At; exports.xa = St; exports.ya = Mt; exports.za = Rt; exports.Aa = Ut; exports.Ba = vt; exports.Ca = Tt; exports.Da = Bt; exports.Ea = Nt; exports.Fa = Ct;
|
|
4
|
+
//# sourceMappingURL=chunk-3KK6QRXD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kent/aptos-ts-sdk/dist/common/chunk-3KK6QRXD.js","../../src/core/common.ts","../../src/core/hex.ts","../../src/core/accountAddress.ts"],"names":["ParsingError","message","invalidReason","HexInvalidReason","Hex","_Hex","data","bytesToHex"],"mappings":"AAAA,ilBAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CCQhM,IAAMA,CAAAA,CAAN,MAAA,QAA8B,KAAM,CAkBzC,WAAA,CAAYC,CAAAA,CAAiBC,CAAAA,CAAkB,CAC7C,KAAA,CAAMD,CAAO,CAAA,CACb,IAAA,CAAK,aAAA,CAAgBC,CACvB,CACF,CAAA,CC3BA,4CAAuC,IAS3BC,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,iBAAA,CAAoB,mBAAA,CAHVA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAgCCC,CAAAA,aAAN,MAAMC,CAAI,CAUf,WAAA,CAAYC,CAAAA,CAAkB,CAC5B,IAAA,CAAK,IAAA,CAAOA,CACd,CAaA,YAAA,CAAA,CAA2B,CACzB,OAAO,IAAA,CAAK,IACd,CASA,qBAAA,CAAA,CAAgC,CAC9B,OAAOC,+BAAAA,IAAW,CAAK,IAAI,CAC7B,CASA,QAAA,CAAA,CAAmB,CACjB,MAAO,CAAA,EAAA,EAAK,IAAA,CAAK,qBAAA,CAAsB,CAAC,CAAA,CAAA;ACkVsB;AAnWV,SAAA","file":"/Users/kent/aptos-ts-sdk/dist/common/chunk-3KK6QRXD.js","sourcesContent":[null,"// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This error is used to explain why parsing failed.\n * @group Implementation\n * @category Serialization\n */\nexport class ParsingError<T> extends Error {\n /**\n * This provides a programmatic way to access why parsing failed. Downstream devs\n * might want to use this to build their own error messages if the default error\n * messages are not suitable for their use case. This should be an enum.\n * @group Implementation\n * @category Serialization\n */\n public invalidReason: T;\n\n /**\n * Creates an instance of the error with a specified message and invalid reason.\n *\n * @param message The error message that describes the issue.\n * @param invalidReason The reason why the input is considered invalid.\n * @group Implementation\n * @category Serialization\n */\n constructor(message: string, invalidReason: T) {\n super(message);\n this.invalidReason = invalidReason;\n }\n}\n\n/**\n * Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,\n * this type is returned from \"defensive\" functions like isValid.\n * @group Implementation\n * @category Serialization\n */\nexport type ParsingResult<T> = {\n /**\n * True if valid, false otherwise.\n * @group Implementation\n * @category Serialization\n */\n valid: boolean;\n\n /**\n * If valid is false, this will be a code explaining why parsing failed.\n * @group Implementation\n * @category Serialization\n */\n invalidReason?: T;\n\n /**\n * If valid is false, this will be a string explaining why parsing failed.\n * @group Implementation\n * @category Serialization\n */\n invalidReasonMessage?: string;\n};\n","// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * Provides reasons for parsing failures related to hexadecimal values.\n * @group Implementation\n * @category Serialization\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses; use AccountAddress instead.\n * When accepting hex data as input to a function, prefer to accept HexInput and\n *\n * A helper class for working with hex data. Hex data, when represented as a string,\n * generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Example usage:\n * ```typescript\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * Other ways to chain the functions together:\n * - `Hex.fromHexString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n * @group Implementation\n * @category Serialization\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data - The Uint8Array containing the data to initialize the Hex instance.\n * @group Implementation\n * @category Serialization\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data as a Uint8Array. The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Converts a hex string into a Hex instance, allowing for both prefixed and non-prefixed formats.\n *\n * @param str - A hex string, with or without the 0x prefix.\n *\n * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.\n *\n * @returns Hex - The resulting Hex instance created from the provided string.\n * @group Implementation\n * @category Serialization\n */\n static fromHexString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (error: any) {\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error?.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance.\n * This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Hex instance created from the provided hexInput.\n * @group Implementation\n * @category Serialization\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromHexString(hexInput);\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Uint8Array created from the provided hexInput.\n */\n static hexInputToUint8Array(hexInput: HexInput): Uint8Array {\n if (hexInput instanceof Uint8Array) return hexInput;\n return Hex.fromHexString(hexInput).toUint8Array();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string with '0x' prefix (e.g., \"0x1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToString(\"1234\") // returns \"0x1234\"\n * Hex.hexInputToString(\"0x1234\") // returns \"0x1234\"\n * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns \"0x1234\"\n * ```\n */\n static hexInputToString(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toString();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string without '0x' prefix (e.g., \"1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToStringWithoutPrefix(\"1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(\"0x1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns \"1234\"\n * ```\n */\n static hexInputToStringWithoutPrefix(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toStringWithoutPrefix();\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided string is a valid hexadecimal representation.\n *\n * @param str - A hex string representing byte data.\n *\n * @returns An object containing:\n * - valid: A boolean indicating whether the string is valid.\n * - invalidReason: The reason for invalidity if the string is not valid.\n * - invalidReasonMessage: A message explaining why the string is invalid.\n * @group Implementation\n * @category Serialization\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromHexString(str);\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two Hex instances are equal by comparing their underlying byte data.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n * @group Implementation\n * @category Serialization\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n\nexport const hexToAsciiString = (hex: string) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());\n","// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * Provides reasons for an address was invalid.\n * @group Implementation\n * @category Serialization\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n INVALID_PADDING_STRICTNESS = \"INVALID_PADDING_STRICTNESS\",\n}\n\n/**\n * The input for an account address, which can be either a hexadecimal string or a standard account address.\n * @group Implementation\n * @category Serialization\n */\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n * @group Implementation\n * @category Serialization\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n * @group Implementation\n * @category Serialization\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n * @group Implementation\n * @category Serialization\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.\n *\n * @param input A Uint8Array representing an account address.\n * @throws ParsingError if the input length is not equal to 32 bytes.\n * @group Implementation\n * @category Serialization\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive.\n * In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined, see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false otherwise.\n * @group Implementation\n * @category Serialization\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n * This representation returns special addresses in SHORT form (0xf)\n * and other addresses in LONG form (0x + 64 characters).\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n * @group Implementation\n * @category Serialization\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * Return the AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n *\n * NOTE: Prefer to use `toString` where possible.\n *\n * @returns AccountAddress as a string without the leading 0x.\n * @group Implementation\n * @category Serialization\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns AccountAddress as a string in LONG form.\n * @group Implementation\n * @category Serialization\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * Returns the account address as a string in LONG form without a leading 0x.\n * This function will include leading zeroes and will produce a string of 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns {string} The account address in LONG form.\n * @group Implementation\n * @category Serialization\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Convert the account address to a string in SHORT format, which is 0x followed by the shortest\n * possible representation (no leading zeros).\n *\n * @returns AccountAddress as a string in SHORT form.\n * @group Implementation\n * @category Serialization\n */\n toStringShort(): `0x${string}` {\n return `0x${this.toStringShortWithoutPrefix()}`;\n }\n\n /**\n * Returns a lossless short string representation of the address by trimming leading zeros.\n * If the address consists of all zeros, returns \"0\".\n *\n * @returns A string representation of the address without leading zeros\n * @group Implementation\n * @category Serialization\n */\n toStringShortWithoutPrefix(): string {\n const hex = bytesToHex(this.data).replace(/^0+/, \"\");\n return hex === \"\" ? \"0\" : hex;\n }\n\n /**\n * Get the inner data as a Uint8Array.\n * The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n /**\n * Serializes the current instance into a byte sequence suitable for entry functions.\n * This allows for the proper encoding of data when interacting with entry functions in the blockchain.\n *\n * @param serializer - The serializer instance used to convert the data into bytes.\n * @group Implementation\n * @category Serialization\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Serializes the current instance for use in a script function by encoding it into a byte sequence.\n * This process involves serializing the variant index and the instance data, making it suitable for transmission.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * @param input - A hex string representing an account address.\n *\n * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.\n *\n * @remarks\n *\n * This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.\n *\n * @see AIP-40 documentation for more details on address formats:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns An instance of AccountAddress.\n * @group Implementation\n * @category Serialization\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString`.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT*, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT* is 1 to 63 hex characters inclusive. The address can have missing values up to `maxMissingChars` before it is padded.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n *\n * @returns An instance of AccountAddress.\n *\n * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.\n * @group Implementation\n * @category Serialization\n */\n static fromString(input: string, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n // Ensure that the maxMissingChars is between or equal to 0 and 63.\n if (maxMissingChars > 63 || maxMissingChars < 0) {\n throw new ParsingError(\n `maxMissingChars must be between or equal to 0 and 63. Received ${maxMissingChars}`,\n AddressInvalidReason.INVALID_PADDING_STRICTNESS,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n const address = new AccountAddress(addressBytes);\n\n // Cannot pad the address if it has more than maxMissingChars missing.\n if (parsedInput.length < 64 - maxMissingChars) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `Hex string is too short, must be ${64 - maxMissingChars} to 64 chars long, excluding the leading 0x. You may need to fix \nthe addresss by padding it with 0s before passing it to \\`fromString\\` (e.g. <addressString>.padStart(64, '0')). \nReceived ${input}`,\n AddressInvalidReason.TOO_SHORT,\n );\n }\n }\n\n return address;\n }\n\n /**\n * Convenience method for creating an AccountAddress from various input types.\n * This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding\n * AccountAddress.\n *\n * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,\n * or an existing AccountAddress.\n * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n * @group Implementation\n * @category Serialization\n */\n static from(input: AccountAddressInput, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromString(input, { maxMissingChars });\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n /**\n * Create an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.\n *\n * @param input - The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.\n * @group Implementation\n * @category Serialization\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromStringStrict(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided input is a valid AccountAddress.\n *\n * @param args - The arguments for validation.\n * @param args.input - A hex string representing an account address.\n * @param args.strict - If true, use strict parsing behavior; if false, use relaxed parsing behavior.\n *\n * @returns An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details.\n * If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.\n * @group Implementation\n * @category Serialization\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two AccountAddresses are equal based on their underlying byte data.\n *\n * @param other - The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n * @group Implementation\n * @category Serialization\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { et as Network, A as AccountAddress } from '../account-Dxsj5MIn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a local node for running a localnet environment.
|
package/dist/common/cli/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk3KK6QRXDjs = require('../chunk-3KK6QRXD.js');var _child_process = require('child_process');var _treekill = require('tree-kill'); var _treekill2 = _interopRequireDefault(_treekill);var _os = require('os');var u=class{constructor(s){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.extraArgs=[];this.showStdout=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _ => _.showStdout]), () => (!0)),this.extraArgs=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _2 => _2.extraArgs]), () => ([]))}async stop(){await new Promise((s,e)=>{_optionalChain([this, 'access', _3 => _3.process, 'optionalAccess', _4 => _4.pid])&&_treekill2.default.call(void 0, this.process.pid,r=>{r?e(r):s(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let s="npx",e=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api",...this.extraArgs],r=_os.platform.call(void 0, ),o={env:{...process.env,ENABLE_KEYLESS_DEFAULT:"1"},...r==="win32"&&{shell:!0}};this.process=_child_process.spawn.call(void 0, s,e,o),_optionalChain([this, 'access', _5 => _5.process, 'access', _6 => _6.stdout, 'optionalAccess', _7 => _7.on, 'call', _8 => _8("data",a=>{let t=a.toString();this.showStdout&&console.log(t)})])}async waitUntilProcessIsUp(){let s=await this.checkIfProcessIsUp(),e=Date.now()/1e3,r=e;for(;!s&&e+this.MAXIMUM_WAIT_TIME_SEC>r;)await _chunk3KK6QRXDjs.sa.call(void 0, 1e3),s=await this.checkIfProcessIsUp(),r=Date.now()/1e3;if(!s)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch (e2){return!1}}};var l=class{async init(s){let{network:e,profile:r,extraArguments:o,showStdout:a}=s,t=["aptos","init",`--network=${_nullishCoalesce(e, () => ("local"))}`,`--profile=${_nullishCoalesce(r, () => ("default"))}`];return o&&t.push(...o),this.runCommand(t,a)}async compile(s){let{packageDirectoryPath:e,namedAddresses:r,extraArguments:o,showStdout:a}=s,t=["aptos","move","compile","--package-dir",e],n=this.parseNamedAddresses(r);return t.push(...this.prepareNamedAddresses(n)),o&&t.push(...o),this.runCommand(t,a)}async test(s){let{packageDirectoryPath:e,namedAddresses:r,extraArguments:o,showStdout:a}=s,t=["aptos","move","test","--package-dir",e],n=this.parseNamedAddresses(r);return t.push(...this.prepareNamedAddresses(n)),o&&t.push(...o),this.runCommand(t,a)}async publish(s){let{packageDirectoryPath:e,namedAddresses:r,profile:o,extraArguments:a,showStdout:t}=s,n=["aptos","move","publish","--package-dir",e,`--profile=${_nullishCoalesce(o, () => ("default"))}`],i=this.parseNamedAddresses(r);return n.push(...this.prepareNamedAddresses(i)),a&&n.push(...a),this.runCommand(n,t)}async createObjectAndPublishPackage(s){let{packageDirectoryPath:e,addressName:r,namedAddresses:o,profile:a,extraArguments:t,showStdout:n}=s,i=["aptos","move","create-object-and-publish-package","--package-dir",e,"--address-name",r,`--profile=${_nullishCoalesce(a, () => ("default"))}`],d=this.parseNamedAddresses(o);i.push(...this.prepareNamedAddresses(d)),t&&i.push(...t);let{output:c}=await this.runCommand(i,n);return{objectAddress:this.extractAddressFromOutput(c)}}async upgradeObjectPackage(s){let{packageDirectoryPath:e,objectAddress:r,namedAddresses:o,profile:a,extraArguments:t,showStdout:n}=s,i=["aptos","move","upgrade-object-package","--package-dir",e,"--object-address",r,`--profile=${_nullishCoalesce(a, () => ("default"))}`],d=this.parseNamedAddresses(o);return i.push(...this.prepareNamedAddresses(d)),t&&i.push(...t),this.runCommand(i,n)}async buildPublishPayload(s){let{outputFile:e,packageDirectoryPath:r,namedAddresses:o,extraArguments:a,showStdout:t}=s,n=["aptos","move","build-publish-payload","--json-output-file",e,"--package-dir",r],i=this.parseNamedAddresses(o);return n.push(...this.prepareNamedAddresses(i)),a&&n.push(...a),this.runCommand(n,t)}async runScript(s){let{compiledScriptPath:e,profile:r,extraArguments:o,showStdout:a}=s,t=["aptos","move","run-script","--compiled-script-path",e,`--profile=${_nullishCoalesce(r, () => ("default"))}`];return o&&t.push(...o),this.runCommand(t,a)}async gasProfile(s){let{network:e,transactionId:r,extraArguments:o,showStdout:a}=s,t=["aptos","move","replay","--profile-gas","--network",e,"--txn-id",r];return o&&t.push(...o),this.runCommand(t,a)}async runCommand(s,e=!0){return new Promise((r,o)=>{let a=_os.platform.call(void 0, ),t,n="",i="";a==="win32"?t=_child_process.spawn.call(void 0, "npx",s,{shell:!0}):t=_child_process.spawn.call(void 0, "npx",s),t.stdout.on("data",d=>{i=d.toString(),n+=d.toString()}),e&&(t.stdout.pipe(process.stdout),t.stderr.pipe(process.stderr)),process.stdin.pipe(t.stdin),t.on("close",d=>{if(d===0)try{let c=JSON.parse(i);c.Error?o(new Error(`Error: ${c.Error}`)):c.Result&&r({result:c.Result,output:n})}catch (e3){r({output:n})}else o(new Error(`Child process exited with code ${d}`))})})}prepareNamedAddresses(s){let e=s.size,r=[];if(e===0)return r;r.push("--named-addresses");let o=[];return s.forEach((a,t)=>{let n=`${t}=${a.toString()}`;o.push(n)}),r.push(o.join(",")),r}parseNamedAddresses(s){let e=new Map;return Object.keys(s).forEach(r=>{let o=s[r];e.set(r,o)}),e}extractAddressFromOutput(s){let e=s.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");if(e)return e[1];throw new Error("Failed to extract object address from output")}};exports.LocalNode = u; exports.Move = l;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|