cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
635 stars 328 forks source link

Support of `ExtensionOptions` in `SigningStargateCilent` signing #1544

Open whalelephant opened 6 months ago

whalelephant commented 6 months ago

Currently the sign function does not have argument for ExtensionOptions data and therefore users requiring such field to be non null must write their own functions such as SendTokens etc.

It would be good to have an optional field to propagate ExtensionOptions for transactions.

ANSHTYAGI7 commented 6 months ago

can you please assign this issue to me

ANSHTYAGI7 commented 6 months ago

import { ExtensionOptions } from 'The liabrary of extensions'

public async sign( signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData, timeoutHeight?: bigint, extensionOptions?: ExtensionOptions, // Add an optional parameter for ExtensionOptions ): Promise { let signerData: SignerData; if (explicitSignerData) { signerData = explicitSignerData; } else { const { accountNumber, sequence } = await this.getSequence(signerAddress); const chainId = await this.getChainId(); signerData = { accountNumber: accountNumber, sequence: sequence, chainId: chainId, }; }

return isOfflineDirectSigner(this.signer)
    ? this.signDirect(signerAddress, messages, fee, memo, signerData, timeoutHeight, extensionOptions)
    : this.signAmino(signerAddress, messages, fee, memo, signerData, timeoutHeight, extensionOptions);

}

ANSHTYAGI7 commented 6 months ago

you can tell me enhancements to do Thank you