Skip to content

Commit

Permalink
fix: not utilized given rpc provider
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Mar 6, 2024
1 parent 1cd40cc commit 831b882
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
return currentBlock - gmpTx.call.blockNumber;
}

console.log(receipt);
return receipt.confirmations;
});

Expand Down Expand Up @@ -221,7 +220,8 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
srcChainId: string,
destChainId: string,
srcTxHash: string,
srcTxEventIndex: number | undefined
srcTxEventIndex: number | undefined,
evmWalletDetails?: EvmWalletDetails
): Promise<{
commandId: string;
eventResponse: EventResponse;
Expand All @@ -231,7 +231,7 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
}> {
const eventIndex =
srcTxEventIndex ??
(await this.getEventIndex(srcChainId, srcTxHash)
(await this.getEventIndex(srcChainId, srcTxHash, evmWalletDetails)
.then((index) => index as number)
.catch(() => -1));

Expand Down Expand Up @@ -324,7 +324,13 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
};
}

const updatedEvent = await this.getEvmEvent(srcChain, destChain, txHash, txEventIndex);
const updatedEvent = await this.getEvmEvent(
srcChain,
destChain,
txHash,
txEventIndex,
evmWalletDetails
);

if (this.isEVMEventCompleted(updatedEvent?.eventResponse)) {
return {
Expand Down Expand Up @@ -808,8 +814,8 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
);
}

public async getEventIndex(chain: string, txHash: string) {
const signer = this.getSigner(chain, { useWindowEthereum: false });
public async getEventIndex(chain: string, txHash: string, evmWalletDetails?: EvmWalletDetails) {
const signer = this.getSigner(chain, evmWalletDetails || { useWindowEthereum: false });
const receipt = await signer.provider.getTransactionReceipt(txHash).catch(() => undefined);

if (!receipt) {
Expand Down

0 comments on commit 831b882

Please sign in to comment.