Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Mar 6, 2024
1 parent d103085 commit 1cd40cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
if (routeDir === RouteDir.COSMOS_TO_EVM) {
return this.recoverCosmosToEvmTx(txHash, _evmWalletDetails, messageId);
} else if (routeDir === RouteDir.EVM_TO_COSMOS) {
return this.recoverEvmToCosmosTx(srcChain, txHash, eventIndex);
return this.recoverEvmToCosmosTx(srcChain, txHash, eventIndex, _evmWalletDetails);
} else {
return this.recoverEvmToEvmTx(
srcChain,
Expand All @@ -495,10 +495,15 @@ export class AxelarGMPRecoveryAPI extends AxelarRecoveryApi {
private async recoverEvmToCosmosTx(
srcChain: string,
txHash: string,
txEventIndex?: number | null
txEventIndex?: number | null,
evmWalletDetails?: EvmWalletDetails
) {
// Check if the tx is confirmed on the source chain
const isConfirmed = await this.doesTxMeetConfirmHt(srcChain, txHash);
const isConfirmed = await this.doesTxMeetConfirmHt(
srcChain,
txHash,
evmWalletDetails?.provider
);
if (!isConfirmed) {
const minConfirmLevel = await this.axelarQueryApi.getConfirmationHeight(srcChain);
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe("AxelarGMPRecoveryAPI", () => {
undefined
);
expect(mockConfirmGatewayTx).toHaveBeenCalledWith(txHash, EvmChain.AVALANCHE);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash, undefined);
expect(response).toBeDefined();
expect(response.infoLogs.length).toBeGreaterThan(0);
expect(response.eventResponse).toBeDefined();
Expand Down Expand Up @@ -166,7 +166,7 @@ describe("AxelarGMPRecoveryAPI", () => {
);

expect(mockConfirmGatewayTx).toBeCalledTimes(0);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash, undefined);
expect(response.success).toBeFalsy();
expect(response.eventResponse).toBeDefined();
expect(response.commandId).toBe("commandId");
Expand Down Expand Up @@ -199,7 +199,7 @@ describe("AxelarGMPRecoveryAPI", () => {
);

expect(mockConfirmGatewayTx).toHaveBeenCalledWith(txHash, EvmChain.AVALANCHE);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash);
expect(mockDoesTxMeetConfirmHt).toHaveBeenCalledWith(EvmChain.AVALANCHE, txHash, undefined);
expect(response.success).toBeFalsy();
expect(response.eventResponse).toBeDefined();
expect(response.commandId).toBe("commandId");
Expand Down

0 comments on commit 1cd40cc

Please sign in to comment.