Skip to content

Commit

Permalink
Allow to pass address as signer for web3 extension compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
wottpal committed Jan 23, 2024
1 parent c241c49 commit 3362c0f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/typechain-types/src/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ type SignAndSendSuccessResponse = {
};

export type {
SignAndSendSuccessResponse,
SignAndSendSuccessResponse
};

Check warning on line 58 in packages/typechain-types/src/tx.ts

View workflow job for this annotation

GitHub Actions / eslint

Missing trailing comma

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 3362c0f

Please sign in to comment.