Skip to content

Commit 605bcb3

Browse files
authored
fix critical bug when chainId = 0 (eth) (#420)
1 parent c88560e commit 605bcb3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/adapters/cashmere/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { BridgeAdapter } from "../../helpers/bridgeAdapter.type";
1+
import { ethers } from "ethers";
22
import fetch from "node-fetch";
33
import { EventData } from "../../utils/types";
4-
import { CashmereAPIResponse, CashmereTransaction, domainToChain, chainToDomain, usdcAddresses } from "./types";
5-
import { ethers } from "ethers";
4+
import { CashmereAPIResponse, CashmereTransaction, domainToChain, usdcAddresses } from "./types";
65
const retry = require("async-retry");
76

87
/**
@@ -48,7 +47,7 @@ export const convertTransactionToEvent = (
4847

4948
return {
5049
depositChainId,
51-
deposit: depositChainId && tx.source_tx_hash && depositAmount.gt(0)
50+
deposit: depositChainId !== undefined && tx.source_tx_hash && depositAmount.gt(0)
5251
? {
5352
blockNumber: tx.block || 0,
5453
txHash: tx.source_tx_hash,
@@ -62,7 +61,7 @@ export const convertTransactionToEvent = (
6261
}
6362
: undefined,
6463
withdrawChainId,
65-
withdraw: withdrawChainId && tx.destination_tx_hash && withdrawAmount.gt(0)
64+
withdraw: withdrawChainId !== undefined && tx.destination_tx_hash && withdrawAmount.gt(0)
6665
? {
6766
blockNumber: 0, // Destination block not always available
6867
txHash: tx.destination_tx_hash,

0 commit comments

Comments
 (0)