@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
|
@@ -366,10 +366,8 @@ export class I8 extends Serializable implements TransactionArgument {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const bcsBytes = this.bcsToBytes();
|
|
372
|
-
serializer.serializeBytes(bcsBytes);
|
|
369
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I8);
|
|
370
|
+
serializer.serialize(this);
|
|
373
371
|
}
|
|
374
372
|
|
|
375
373
|
static deserialize(deserializer: Deserializer): I8 {
|
|
@@ -405,8 +403,8 @@ export class I16 extends Serializable implements TransactionArgument {
|
|
|
405
403
|
}
|
|
406
404
|
|
|
407
405
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
408
|
-
|
|
409
|
-
serializer.
|
|
406
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I16);
|
|
407
|
+
serializer.serialize(this);
|
|
410
408
|
}
|
|
411
409
|
|
|
412
410
|
static deserialize(deserializer: Deserializer): I16 {
|
|
@@ -441,8 +439,8 @@ export class I32 extends Serializable implements TransactionArgument {
|
|
|
441
439
|
}
|
|
442
440
|
|
|
443
441
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
444
|
-
|
|
445
|
-
serializer.
|
|
442
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I32);
|
|
443
|
+
serializer.serialize(this);
|
|
446
444
|
}
|
|
447
445
|
|
|
448
446
|
static deserialize(deserializer: Deserializer): I32 {
|
|
@@ -480,8 +478,8 @@ export class I64 extends Serializable implements TransactionArgument {
|
|
|
480
478
|
}
|
|
481
479
|
|
|
482
480
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
483
|
-
|
|
484
|
-
serializer.
|
|
481
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I64);
|
|
482
|
+
serializer.serialize(this);
|
|
485
483
|
}
|
|
486
484
|
|
|
487
485
|
static deserialize(deserializer: Deserializer): I64 {
|
|
@@ -517,8 +515,8 @@ export class I128 extends Serializable implements TransactionArgument {
|
|
|
517
515
|
}
|
|
518
516
|
|
|
519
517
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
520
|
-
|
|
521
|
-
serializer.
|
|
518
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I128);
|
|
519
|
+
serializer.serialize(this);
|
|
522
520
|
}
|
|
523
521
|
|
|
524
522
|
static deserialize(deserializer: Deserializer): I128 {
|
|
@@ -554,8 +552,8 @@ export class I256 extends Serializable implements TransactionArgument {
|
|
|
554
552
|
}
|
|
555
553
|
|
|
556
554
|
serializeForScriptFunction(serializer: Serializer): void {
|
|
557
|
-
|
|
558
|
-
serializer.
|
|
555
|
+
serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I256);
|
|
556
|
+
serializer.serialize(this);
|
|
559
557
|
}
|
|
560
558
|
|
|
561
559
|
static deserialize(deserializer: Deserializer): I256 {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { Bool, U128, U16, U256, U32, U64, U8 } from "./movePrimitives";
|
|
4
|
+
import { Bool, U128, U16, U256, U32, U64, U8, I8, I16, I32, I64, I128, I256 } from "./movePrimitives";
|
|
5
5
|
import { Serializable, Serializer } from "../serializer";
|
|
6
6
|
import { Deserializable, Deserializer } from "../deserializer";
|
|
7
7
|
import { AnyNumber, HexInput, ScriptTransactionArgumentVariants } from "../../types";
|
|
@@ -256,6 +256,108 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
|
|
|
256
256
|
return new MoveVector<Bool>(values.map((v) => new Bool(v)));
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Factory method to generate a MoveVector<I8> from an array of numbers.
|
|
261
|
+
*
|
|
262
|
+
* @param values - The values used to fill the MoveVector.
|
|
263
|
+
* @returns A MoveVector<I8> with the inner values.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* const v = MoveVector.I8([-1, 0, 1, 127]);
|
|
268
|
+
* ```
|
|
269
|
+
* @group Implementation
|
|
270
|
+
* @category BCS
|
|
271
|
+
*/
|
|
272
|
+
static I8(values: Array<number>): MoveVector<I8> {
|
|
273
|
+
return new MoveVector<I8>(values.map((v) => new I8(v)));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Factory method to generate a MoveVector<I16> from an array of numbers.
|
|
278
|
+
*
|
|
279
|
+
* @param values - The values used to fill the MoveVector.
|
|
280
|
+
* @returns A MoveVector<I16> with the inner values.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const v = MoveVector.I16([-1, 0, 1, 32767]);
|
|
285
|
+
* ```
|
|
286
|
+
* @group Implementation
|
|
287
|
+
* @category BCS
|
|
288
|
+
*/
|
|
289
|
+
static I16(values: Array<number>): MoveVector<I16> {
|
|
290
|
+
return new MoveVector<I16>(values.map((v) => new I16(v)));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Factory method to generate a MoveVector<I32> from an array of numbers.
|
|
295
|
+
*
|
|
296
|
+
* @param values - The values used to fill the MoveVector.
|
|
297
|
+
* @returns A MoveVector<I32> with the inner values.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const v = MoveVector.I32([-1, 0, 1, 2147483647]);
|
|
302
|
+
* ```
|
|
303
|
+
* @group Implementation
|
|
304
|
+
* @category BCS
|
|
305
|
+
*/
|
|
306
|
+
static I32(values: Array<number>): MoveVector<I32> {
|
|
307
|
+
return new MoveVector<I32>(values.map((v) => new I32(v)));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Factory method to generate a MoveVector<I64> from an array of numbers or bigints.
|
|
312
|
+
*
|
|
313
|
+
* @param values - The values used to fill the MoveVector.
|
|
314
|
+
* @returns A MoveVector<I64> with the inner values.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* const v = MoveVector.I64([-1n, 0n, 1n, 9223372036854775807n]);
|
|
319
|
+
* ```
|
|
320
|
+
* @group Implementation
|
|
321
|
+
* @category BCS
|
|
322
|
+
*/
|
|
323
|
+
static I64(values: Array<AnyNumber>): MoveVector<I64> {
|
|
324
|
+
return new MoveVector<I64>(values.map((v) => new I64(v)));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Factory method to generate a MoveVector<I128> from an array of numbers or bigints.
|
|
329
|
+
*
|
|
330
|
+
* @param values - The values used to fill the MoveVector.
|
|
331
|
+
* @returns A MoveVector<I128> with the inner values.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const v = MoveVector.I128([-1n, 0n, 1n]);
|
|
336
|
+
* ```
|
|
337
|
+
* @group Implementation
|
|
338
|
+
* @category BCS
|
|
339
|
+
*/
|
|
340
|
+
static I128(values: Array<AnyNumber>): MoveVector<I128> {
|
|
341
|
+
return new MoveVector<I128>(values.map((v) => new I128(v)));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Factory method to generate a MoveVector<I256> from an array of numbers or bigints.
|
|
346
|
+
*
|
|
347
|
+
* @param values - The values used to fill the MoveVector.
|
|
348
|
+
* @returns A MoveVector<I256> with the inner values.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* const v = MoveVector.I256([-1n, 0n, 1n]);
|
|
353
|
+
* ```
|
|
354
|
+
* @group Implementation
|
|
355
|
+
* @category BCS
|
|
356
|
+
*/
|
|
357
|
+
static I256(values: Array<AnyNumber>): MoveVector<I256> {
|
|
358
|
+
return new MoveVector<I256>(values.map((v) => new I256(v)));
|
|
359
|
+
}
|
|
360
|
+
|
|
259
361
|
/**
|
|
260
362
|
* Factory method to generate a MoveVector<MoveString> from a `string` or `undefined`.
|
|
261
363
|
* This function creates a MoveVector that encapsulates a MoveString if the provided value is not null or undefined.
|
|
@@ -593,6 +695,108 @@ export class MoveOption<T extends Serializable & EntryFunctionArgument>
|
|
|
593
695
|
return new MoveOption<Bool>(value !== null && value !== undefined ? new Bool(value) : undefined);
|
|
594
696
|
}
|
|
595
697
|
|
|
698
|
+
/**
|
|
699
|
+
* Factory method to generate a MoveOption<I8> from a `number` or `undefined`.
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* MoveOption.I8(1).isSome() === true;
|
|
703
|
+
* MoveOption.I8().isSome() === false;
|
|
704
|
+
* MoveOption.I8(undefined).isSome() === false;
|
|
705
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
706
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
707
|
+
* @returns a MoveOption<I8> with an inner value `value`
|
|
708
|
+
* @group Implementation
|
|
709
|
+
* @category BCS
|
|
710
|
+
*/
|
|
711
|
+
static I8(value?: number | null): MoveOption<I8> {
|
|
712
|
+
return new MoveOption<I8>(value !== null && value !== undefined ? new I8(value) : undefined);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Factory method to generate a MoveOption<I16> from a `number` or `undefined`.
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* MoveOption.I16(1).isSome() === true;
|
|
720
|
+
* MoveOption.I16().isSome() === false;
|
|
721
|
+
* MoveOption.I16(undefined).isSome() === false;
|
|
722
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
723
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
724
|
+
* @returns a MoveOption<I16> with an inner value `value`
|
|
725
|
+
* @group Implementation
|
|
726
|
+
* @category BCS
|
|
727
|
+
*/
|
|
728
|
+
static I16(value?: number | null): MoveOption<I16> {
|
|
729
|
+
return new MoveOption<I16>(value !== null && value !== undefined ? new I16(value) : undefined);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Factory method to generate a MoveOption<I32> from a `number` or `undefined`.
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* MoveOption.I32(1).isSome() === true;
|
|
737
|
+
* MoveOption.I32().isSome() === false;
|
|
738
|
+
* MoveOption.I32(undefined).isSome() === false;
|
|
739
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
740
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
741
|
+
* @returns a MoveOption<I32> with an inner value `value`
|
|
742
|
+
* @group Implementation
|
|
743
|
+
* @category BCS
|
|
744
|
+
*/
|
|
745
|
+
static I32(value?: number | null): MoveOption<I32> {
|
|
746
|
+
return new MoveOption<I32>(value !== null && value !== undefined ? new I32(value) : undefined);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Factory method to generate a MoveOption<I64> from a `number` or a `bigint` or `undefined`.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* MoveOption.I64(1).isSome() === true;
|
|
754
|
+
* MoveOption.I64().isSome() === false;
|
|
755
|
+
* MoveOption.I64(undefined).isSome() === false;
|
|
756
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
757
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
758
|
+
* @returns a MoveOption<I64> with an inner value `value`
|
|
759
|
+
* @group Implementation
|
|
760
|
+
* @category BCS
|
|
761
|
+
*/
|
|
762
|
+
static I64(value?: AnyNumber | null): MoveOption<I64> {
|
|
763
|
+
return new MoveOption<I64>(value !== null && value !== undefined ? new I64(value) : undefined);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Factory method to generate a MoveOption<I128> from a `number` or a `bigint` or `undefined`.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* MoveOption.I128(1).isSome() === true;
|
|
771
|
+
* MoveOption.I128().isSome() === false;
|
|
772
|
+
* MoveOption.I128(undefined).isSome() === false;
|
|
773
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
774
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
775
|
+
* @returns a MoveOption<I128> with an inner value `value`
|
|
776
|
+
* @group Implementation
|
|
777
|
+
* @category BCS
|
|
778
|
+
*/
|
|
779
|
+
static I128(value?: AnyNumber | null): MoveOption<I128> {
|
|
780
|
+
return new MoveOption<I128>(value !== null && value !== undefined ? new I128(value) : undefined);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Factory method to generate a MoveOption<I256> from a `number` or a `bigint` or `undefined`.
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* MoveOption.I256(1).isSome() === true;
|
|
788
|
+
* MoveOption.I256().isSome() === false;
|
|
789
|
+
* MoveOption.I256(undefined).isSome() === false;
|
|
790
|
+
* @param value the value used to fill the MoveOption. If `value` is undefined
|
|
791
|
+
* the resulting MoveOption's .isSome() method will return false.
|
|
792
|
+
* @returns a MoveOption<I256> with an inner value `value`
|
|
793
|
+
* @group Implementation
|
|
794
|
+
* @category BCS
|
|
795
|
+
*/
|
|
796
|
+
static I256(value?: AnyNumber | null): MoveOption<I256> {
|
|
797
|
+
return new MoveOption<I256>(value !== null && value !== undefined ? new I256(value) : undefined);
|
|
798
|
+
}
|
|
799
|
+
|
|
596
800
|
/**
|
|
597
801
|
* Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.
|
|
598
802
|
*
|
|
@@ -6,7 +6,21 @@
|
|
|
6
6
|
import { Deserializer } from "../../bcs/deserializer";
|
|
7
7
|
import { Serializable, Serializer } from "../../bcs/serializer";
|
|
8
8
|
import { EntryFunctionBytes } from "../../bcs/serializable/entryFunctionBytes";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Bool,
|
|
11
|
+
U128,
|
|
12
|
+
U16,
|
|
13
|
+
U256,
|
|
14
|
+
U32,
|
|
15
|
+
U64,
|
|
16
|
+
U8,
|
|
17
|
+
I8,
|
|
18
|
+
I16,
|
|
19
|
+
I32,
|
|
20
|
+
I64,
|
|
21
|
+
I128,
|
|
22
|
+
I256,
|
|
23
|
+
} from "../../bcs/serializable/movePrimitives";
|
|
10
24
|
import { MoveVector, Serialized } from "../../bcs/serializable/moveStructs";
|
|
11
25
|
import { AccountAddress, Hex } from "../../core";
|
|
12
26
|
import { Identifier } from "./identifier";
|
|
@@ -57,6 +71,18 @@ export function deserializeFromScriptArgument(deserializer: Deserializer): Trans
|
|
|
57
71
|
return U256.deserialize(deserializer);
|
|
58
72
|
case ScriptTransactionArgumentVariants.Serialized:
|
|
59
73
|
return Serialized.deserialize(deserializer);
|
|
74
|
+
case ScriptTransactionArgumentVariants.I8:
|
|
75
|
+
return I8.deserialize(deserializer);
|
|
76
|
+
case ScriptTransactionArgumentVariants.I16:
|
|
77
|
+
return I16.deserialize(deserializer);
|
|
78
|
+
case ScriptTransactionArgumentVariants.I32:
|
|
79
|
+
return I32.deserialize(deserializer);
|
|
80
|
+
case ScriptTransactionArgumentVariants.I64:
|
|
81
|
+
return I64.deserialize(deserializer);
|
|
82
|
+
case ScriptTransactionArgumentVariants.I128:
|
|
83
|
+
return I128.deserialize(deserializer);
|
|
84
|
+
case ScriptTransactionArgumentVariants.I256:
|
|
85
|
+
return I256.deserialize(deserializer);
|
|
60
86
|
default:
|
|
61
87
|
throw new Error(`Unknown variant index for ScriptTransactionArgument: ${index}`);
|
|
62
88
|
}
|
|
@@ -8,7 +8,25 @@ import {
|
|
|
8
8
|
InputScriptData,
|
|
9
9
|
SimpleEntryFunctionArgumentTypes,
|
|
10
10
|
} from "../types";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Bool,
|
|
13
|
+
FixedBytes,
|
|
14
|
+
I128,
|
|
15
|
+
I16,
|
|
16
|
+
I256,
|
|
17
|
+
I32,
|
|
18
|
+
I64,
|
|
19
|
+
I8,
|
|
20
|
+
MoveOption,
|
|
21
|
+
MoveString,
|
|
22
|
+
MoveVector,
|
|
23
|
+
U128,
|
|
24
|
+
U16,
|
|
25
|
+
U256,
|
|
26
|
+
U32,
|
|
27
|
+
U64,
|
|
28
|
+
U8,
|
|
29
|
+
} from "../../bcs";
|
|
12
30
|
import { AccountAddress } from "../../core";
|
|
13
31
|
import { MoveFunction } from "../../types";
|
|
14
32
|
|
|
@@ -192,6 +210,12 @@ export function isEncodedEntryFunctionArgument(
|
|
|
192
210
|
* @category Transactions
|
|
193
211
|
*/
|
|
194
212
|
isBcsFixedBytes(arg) ||
|
|
213
|
+
isBcsI8(arg) ||
|
|
214
|
+
isBcsI16(arg) ||
|
|
215
|
+
isBcsI32(arg) ||
|
|
216
|
+
isBcsI64(arg) ||
|
|
217
|
+
isBcsI128(arg) ||
|
|
218
|
+
isBcsI256(arg) ||
|
|
195
219
|
arg instanceof MoveVector ||
|
|
196
220
|
arg instanceof MoveOption
|
|
197
221
|
);
|
|
@@ -268,6 +292,48 @@ export function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionA
|
|
|
268
292
|
export function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256 {
|
|
269
293
|
return arg instanceof U256;
|
|
270
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* @group Implementation
|
|
297
|
+
* @category Transactions
|
|
298
|
+
*/
|
|
299
|
+
export function isBcsI8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I8 {
|
|
300
|
+
return arg instanceof I8;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* @group Implementation
|
|
304
|
+
* @category Transactions
|
|
305
|
+
*/
|
|
306
|
+
export function isBcsI16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I16 {
|
|
307
|
+
return arg instanceof I16;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @group Implementation
|
|
311
|
+
* @category Transactions
|
|
312
|
+
*/
|
|
313
|
+
export function isBcsI32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I32 {
|
|
314
|
+
return arg instanceof I32;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @group Implementation
|
|
318
|
+
* @category Transactions
|
|
319
|
+
*/
|
|
320
|
+
export function isBcsI64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I64 {
|
|
321
|
+
return arg instanceof I64;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @group Implementation
|
|
325
|
+
* @category Transactions
|
|
326
|
+
*/
|
|
327
|
+
export function isBcsI128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I128 {
|
|
328
|
+
return arg instanceof I128;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @group Implementation
|
|
332
|
+
* @category Transactions
|
|
333
|
+
*/
|
|
334
|
+
export function isBcsI256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I256 {
|
|
335
|
+
return arg instanceof I256;
|
|
336
|
+
}
|
|
271
337
|
|
|
272
338
|
/**
|
|
273
339
|
* Determines if the provided argument contains script data input by checking for the presence of bytecode.
|
|
@@ -6,6 +6,12 @@ import {
|
|
|
6
6
|
TypeTag,
|
|
7
7
|
TypeTagAddress,
|
|
8
8
|
TypeTagBool,
|
|
9
|
+
TypeTagI128,
|
|
10
|
+
TypeTagI16,
|
|
11
|
+
TypeTagI256,
|
|
12
|
+
TypeTagI32,
|
|
13
|
+
TypeTagI64,
|
|
14
|
+
TypeTagI8,
|
|
9
15
|
TypeTagStruct,
|
|
10
16
|
TypeTagU128,
|
|
11
17
|
TypeTagU16,
|
|
@@ -23,7 +29,25 @@ import {
|
|
|
23
29
|
FunctionABI,
|
|
24
30
|
TypeArgument,
|
|
25
31
|
} from "../types";
|
|
26
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
Bool,
|
|
34
|
+
FixedBytes,
|
|
35
|
+
I128,
|
|
36
|
+
I16,
|
|
37
|
+
I256,
|
|
38
|
+
I32,
|
|
39
|
+
I64,
|
|
40
|
+
I8,
|
|
41
|
+
MoveOption,
|
|
42
|
+
MoveString,
|
|
43
|
+
MoveVector,
|
|
44
|
+
U128,
|
|
45
|
+
U16,
|
|
46
|
+
U256,
|
|
47
|
+
U32,
|
|
48
|
+
U64,
|
|
49
|
+
U8,
|
|
50
|
+
} from "../../bcs";
|
|
27
51
|
import { AccountAddress } from "../../core";
|
|
28
52
|
import { getModule } from "../../internal/account";
|
|
29
53
|
import {
|
|
@@ -44,6 +68,12 @@ import {
|
|
|
44
68
|
isString,
|
|
45
69
|
throwTypeMismatch,
|
|
46
70
|
convertNumber,
|
|
71
|
+
isBcsI8,
|
|
72
|
+
isBcsI16,
|
|
73
|
+
isBcsI32,
|
|
74
|
+
isBcsI64,
|
|
75
|
+
isBcsI128,
|
|
76
|
+
isBcsI256,
|
|
47
77
|
} from "./helpers";
|
|
48
78
|
import { MoveFunction, MoveModule } from "../../types";
|
|
49
79
|
|
|
@@ -420,6 +450,45 @@ function parseArg(
|
|
|
420
450
|
}
|
|
421
451
|
throwTypeMismatch("bigint | number | string", position);
|
|
422
452
|
}
|
|
453
|
+
if (param.isI8()) {
|
|
454
|
+
const num = convertNumber(arg);
|
|
455
|
+
if (num !== undefined) {
|
|
456
|
+
return new I8(num);
|
|
457
|
+
}
|
|
458
|
+
throwTypeMismatch("number | string", position);
|
|
459
|
+
}
|
|
460
|
+
if (param.isI16()) {
|
|
461
|
+
const num = convertNumber(arg);
|
|
462
|
+
if (num !== undefined) {
|
|
463
|
+
return new I16(num);
|
|
464
|
+
}
|
|
465
|
+
throwTypeMismatch("number | string", position);
|
|
466
|
+
}
|
|
467
|
+
if (param.isI32()) {
|
|
468
|
+
const num = convertNumber(arg);
|
|
469
|
+
if (num !== undefined) {
|
|
470
|
+
return new I32(num);
|
|
471
|
+
}
|
|
472
|
+
throwTypeMismatch("number | string", position);
|
|
473
|
+
}
|
|
474
|
+
if (param.isI64()) {
|
|
475
|
+
if (isLargeNumber(arg)) {
|
|
476
|
+
return new I64(BigInt(arg));
|
|
477
|
+
}
|
|
478
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
479
|
+
}
|
|
480
|
+
if (param.isI128()) {
|
|
481
|
+
if (isLargeNumber(arg)) {
|
|
482
|
+
return new I128(BigInt(arg));
|
|
483
|
+
}
|
|
484
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
485
|
+
}
|
|
486
|
+
if (param.isI256()) {
|
|
487
|
+
if (isLargeNumber(arg)) {
|
|
488
|
+
return new I256(BigInt(arg));
|
|
489
|
+
}
|
|
490
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
491
|
+
}
|
|
423
492
|
|
|
424
493
|
// Generic needs to use the subtype
|
|
425
494
|
if (param.isGeneric()) {
|
|
@@ -522,6 +591,24 @@ function parseArg(
|
|
|
522
591
|
if (innerParam instanceof TypeTagU256) {
|
|
523
592
|
return new MoveOption<U256>(null);
|
|
524
593
|
}
|
|
594
|
+
if (innerParam instanceof TypeTagI8) {
|
|
595
|
+
return new MoveOption<I8>(null);
|
|
596
|
+
}
|
|
597
|
+
if (innerParam instanceof TypeTagI16) {
|
|
598
|
+
return new MoveOption<I16>(null);
|
|
599
|
+
}
|
|
600
|
+
if (innerParam instanceof TypeTagI32) {
|
|
601
|
+
return new MoveOption<I32>(null);
|
|
602
|
+
}
|
|
603
|
+
if (innerParam instanceof TypeTagI64) {
|
|
604
|
+
return new MoveOption<I64>(null);
|
|
605
|
+
}
|
|
606
|
+
if (innerParam instanceof TypeTagI128) {
|
|
607
|
+
return new MoveOption<I128>(null);
|
|
608
|
+
}
|
|
609
|
+
if (innerParam instanceof TypeTagI256) {
|
|
610
|
+
return new MoveOption<I256>(null);
|
|
611
|
+
}
|
|
525
612
|
|
|
526
613
|
// In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious
|
|
527
614
|
// Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed
|
|
@@ -612,6 +699,42 @@ function checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: nu
|
|
|
612
699
|
}
|
|
613
700
|
throwTypeMismatch("U256", position);
|
|
614
701
|
}
|
|
702
|
+
if (param.isI8()) {
|
|
703
|
+
if (isBcsI8(arg)) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
throwTypeMismatch("I8", position);
|
|
707
|
+
}
|
|
708
|
+
if (param.isI16()) {
|
|
709
|
+
if (isBcsI16(arg)) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
throwTypeMismatch("I16", position);
|
|
713
|
+
}
|
|
714
|
+
if (param.isI32()) {
|
|
715
|
+
if (isBcsI32(arg)) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
throwTypeMismatch("I32", position);
|
|
719
|
+
}
|
|
720
|
+
if (param.isI64()) {
|
|
721
|
+
if (isBcsI64(arg)) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
throwTypeMismatch("I64", position);
|
|
725
|
+
}
|
|
726
|
+
if (param.isI128()) {
|
|
727
|
+
if (isBcsI128(arg)) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
throwTypeMismatch("I128", position);
|
|
731
|
+
}
|
|
732
|
+
if (param.isI256()) {
|
|
733
|
+
if (isBcsI256(arg)) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
throwTypeMismatch("I256", position);
|
|
737
|
+
}
|
|
615
738
|
if (param.isVector()) {
|
|
616
739
|
if (arg instanceof MoveVector) {
|
|
617
740
|
// If there's anything in it, check that the inner types match
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { AptosConfig } from "../api/aptosConfig";
|
|
5
5
|
import { MoveOption, MoveString, MoveVector } from "../bcs/serializable/moveStructs";
|
|
6
|
-
import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
|
|
6
|
+
import { Bool, I128, I16, I256, I32, I64, I8, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
|
|
7
7
|
import { FixedBytes } from "../bcs/serializable/fixedBytes";
|
|
8
8
|
import { AccountAddress, AccountAddressInput } from "../core";
|
|
9
9
|
import { PublicKey } from "../core/crypto";
|
|
@@ -60,6 +60,12 @@ export type EntryFunctionArgumentTypes =
|
|
|
60
60
|
| U64
|
|
61
61
|
| U128
|
|
62
62
|
| U256
|
|
63
|
+
| I8
|
|
64
|
+
| I16
|
|
65
|
+
| I32
|
|
66
|
+
| I64
|
|
67
|
+
| I128
|
|
68
|
+
| I256
|
|
63
69
|
| AccountAddress
|
|
64
70
|
| MoveVector<EntryFunctionArgumentTypes>
|
|
65
71
|
| MoveOption<EntryFunctionArgumentTypes>
|
|
@@ -79,6 +85,12 @@ export type ScriptFunctionArgumentTypes =
|
|
|
79
85
|
| U64
|
|
80
86
|
| U128
|
|
81
87
|
| U256
|
|
88
|
+
| I8
|
|
89
|
+
| I16
|
|
90
|
+
| I32
|
|
91
|
+
| I64
|
|
92
|
+
| I128
|
|
93
|
+
| I256
|
|
82
94
|
| AccountAddress
|
|
83
95
|
| MoveVector<ScriptFunctionArgumentTypes>
|
|
84
96
|
| MoveString
|
|
@@ -97,6 +109,12 @@ export type ScriptFunctionArgumentTypes =
|
|
|
97
109
|
* - u64
|
|
98
110
|
* - u128
|
|
99
111
|
* - u256
|
|
112
|
+
* - i8
|
|
113
|
+
* - i16
|
|
114
|
+
* - i32
|
|
115
|
+
* - i64
|
|
116
|
+
* - i128
|
|
117
|
+
* - i256
|
|
100
118
|
* - bool
|
|
101
119
|
* - address
|
|
102
120
|
* - signer
|