Skip to content

Commit

Permalink
Merge pull request #138 from wottpal/master
Browse files Browse the repository at this point in the history
Allow to pass address as signer for web3 extension compatibility
  • Loading branch information
o-tsaruk authored Mar 13, 2024
2 parents b0bed1b + 97769af commit 40e7bac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/typechain-types/src/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export type {
export async function txSignAndSend(
nativeAPI: ApiPromise,
nativeContract : ContractPromise,
keyringPair : KeyringPair,
signer : KeyringPair | string,
title : string,
eventHandler : (event: EventRecord[]) => {
[index: string]: any;
Expand All @@ -72,9 +72,9 @@ export async function txSignAndSend(
const _realGasLimit = gasLimitAndValue || {gasLimit: undefined, value: undefined};

// estimate gas limit

const signerAddress = typeof signer === 'string' ? signer : signer.address;
const estimatedGasLimit = (await nativeContract.query[title](
keyringPair.address,
signerAddress,
_gasLimitAndValue, ...args
)).gasRequired;

Expand All @@ -87,7 +87,7 @@ export async function txSignAndSend(
nativeAPI, nativeContract,
title, args, estimatedGasLimitAndValue,
);
return _signAndSend(nativeAPI.registry, submittableExtrinsic, keyringPair, eventHandler);
return _signAndSend(nativeAPI.registry, submittableExtrinsic, signer, eventHandler);
}

export function buildSubmittableExtrinsic(
Expand Down Expand Up @@ -123,12 +123,12 @@ export function buildSubmittableExtrinsic(
export async function _signAndSend(
registry: Registry,
extrinsic: SubmittableExtrinsic<'promise'>,
signer: KeyringPair,
signer: KeyringPair | string,
eventHandler : (event: EventRecord[]) => {
[index: string]: any;
},
): Promise<SignAndSendSuccessResponse> {
const signerAddress = signer.address;
const signerAddress = typeof signer === 'string' ? signer : signer.address;

return new Promise((resolve, reject) => {
const actionStatus = {
Expand Down

0 comments on commit 40e7bac

Please sign in to comment.