From 4be0b28f68bf9ef0ae284aad5a6b19f0dda10632 Mon Sep 17 00:00:00 2001 From: maayan Date: Thu, 8 Dec 2022 16:37:23 -0800 Subject: [PATCH] [TS SDK] option to pass optional args to token client functions --- ecosystem/typescript/sdk/src/token_client.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ecosystem/typescript/sdk/src/token_client.ts b/ecosystem/typescript/sdk/src/token_client.ts index 6acecf4b7749a..ee296c9b28d99 100644 --- a/ecosystem/typescript/sdk/src/token_client.ts +++ b/ecosystem/typescript/sdk/src/token_client.ts @@ -350,10 +350,10 @@ export class TokenClient { * @param optIn boolean value indicates user want to opt-in or out of direct transfer * @returns The hash of the transaction submitted to the API */ - async optInTokenTransfer(sender: AptosAccount, optIn: boolean): Promise { + async optInTokenTransfer(sender: AptosAccount, optIn: boolean, extraArgs?: OptionalTransactionArgs): Promise { const payload = this.transactionBuilder.buildTransactionPayload("0x3::token::opt_in_direct_transfer", [], [optIn]); - return this.aptosClient.generateSignSubmitTransaction(sender, payload); + return this.aptosClient.generateSignSubmitTransaction(sender, payload, extraArgs); } /** @@ -375,6 +375,7 @@ export class TokenClient { propertyVersion: AnyNumber, receiver: MaybeHexString, amount: AnyNumber, + extraArgs?: OptionalTransactionArgs, ): Promise { // compile script to invoke public transfer function const payload = new TransactionPayloadScript( @@ -392,7 +393,7 @@ export class TokenClient { ), ); - return this.aptosClient.generateSignSubmitTransaction(sender, payload); + return this.aptosClient.generateSignSubmitTransaction(sender, payload, extraArgs); } /** @@ -413,6 +414,7 @@ export class TokenClient { name: String, PropertyVersion: AnyNumber, amount: AnyNumber, + extraArgs?: OptionalTransactionArgs, ): Promise { const payload = this.transactionBuilder.buildTransactionPayload( "0x3::token::burn_by_creator", @@ -420,7 +422,7 @@ export class TokenClient { [ownerAddress, collection, name, PropertyVersion, amount], ); - return this.aptosClient.generateSignSubmitTransaction(creator, payload); + return this.aptosClient.generateSignSubmitTransaction(creator, payload, extraArgs); } /** @@ -441,6 +443,7 @@ export class TokenClient { name: String, PropertyVersion: AnyNumber, amount: AnyNumber, + extraArgs?: OptionalTransactionArgs, ): Promise { const payload = this.transactionBuilder.buildTransactionPayload( "0x3::token::burn", @@ -448,7 +451,7 @@ export class TokenClient { [creatorAddress, collection, name, PropertyVersion, amount], ); - return this.aptosClient.generateSignSubmitTransaction(owner, payload); + return this.aptosClient.generateSignSubmitTransaction(owner, payload, extraArgs); } /** @@ -475,6 +478,7 @@ export class TokenClient { keys: Array, values: Array, types: Array, + extraArgs?: OptionalTransactionArgs, ): Promise { const payload = this.transactionBuilder.buildTransactionPayload( "0x3::token::mutate_token_properties", @@ -482,7 +486,7 @@ export class TokenClient { [tokenOwner, creator, collection_name, tokenName, propertyVersion, amount, keys, values, types], ); - return this.aptosClient.generateSignSubmitTransaction(account, payload); + return this.aptosClient.generateSignSubmitTransaction(account, payload, extraArgs); } /**