Skip to content

Commit 7c3540c

Browse files
committed
fix: tested axelar chains working except cfg
1 parent 1fd490f commit 7c3540c

File tree

3 files changed

+50
-51
lines changed

3 files changed

+50
-51
lines changed

src/adapters/axelar/index.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeA
22
import { constructTransferParams } from "../../helpers/eventParams";
33
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";
44
import { BigNumber } from "ethers";
5-
import { fetchAssets, getTokenAddress } from "../squid/utils";
6-
import { getItsTokens } from "./utils";
5+
import { getTokenAddress } from "../squid/utils";
6+
import { getAssets, getItsTokens } from "./utils";
77

88

99

@@ -242,7 +242,7 @@ const constructParams = (chain: SupportedChains) => {
242242

243243
return async (fromBlock: number, toBlock: number) => {
244244

245-
const assets = await fetchAssets();
245+
const assets = await getAssets();
246246
const itsAssets = await getItsTokens();
247247

248248

@@ -348,24 +348,24 @@ const constructParams = (chain: SupportedChains) => {
348348
};
349349
const adapter: BridgeAdapter = {
350350
arbitrum: constructParams("arbitrum"),
351-
// avalanche: constructParams("avax"),
352-
// base: constructParams("base"),
353-
// blast: constructParams("blast"),
354-
// bsc: constructParams("bsc"),
355-
// celo: constructParams("celo"),
356-
// cfg: constructParams("cfg"), //centrifuge
357-
// ethereum: constructParams("ethereum"),
358-
// fantom: constructParams("fantom"),
359-
// filecoin: constructParams("filecoin"),
360-
// fraxtal: constructParams("fraxtal"),
361-
// // imx: constructParams("imx"), //immutable >>> TODO we call it immutable they call it imx
362-
// kava: constructParams("kava"),
363-
// linea: constructParams("linea"),
364-
// mantle: constructParams("mantle"),
365-
// moonbeam: constructParams("moonbeam"),
366-
// optimism: constructParams("optimism"),
367-
// polygon: constructParams("polygon"),
368-
// scroll: constructParams("scroll"),
351+
avalanche: constructParams("avax"),
352+
base: constructParams("base"),
353+
blast: constructParams("blast"),
354+
bsc: constructParams("bsc"),
355+
celo: constructParams("celo"),
356+
cfg: constructParams("cfg"), //cfg
357+
ethereum: constructParams("ethereum"),
358+
fantom: constructParams("fantom"),
359+
filecoin: constructParams("filecoin"),
360+
fraxtal: constructParams("fraxtal"),
361+
imx: constructParams("imx"),
362+
kava: constructParams("kava"),
363+
linea: constructParams("linea"),
364+
mantle: constructParams("mantle"),
365+
moonbeam: constructParams("moonbeam"),
366+
optimism: constructParams("optimism"),
367+
polygon: constructParams("polygon"),
368+
scroll: constructParams("scroll"),
369369
};
370370

371371
export default adapter;

src/adapters/axelar/utils.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ export const getItsTokens = () =>
66
fetch("https://api.axelarscan.io/api/getITSAssets", {
77
method: "GET",
88
headers: { "Content-Type": "application/json" },
9-
}).then((res) => res.json())
9+
}).then((res: any) => res.json())
1010
);
1111

1212

13-
// TODO
14-
// custom tokens dont seem to be getting queried for example token from this tx
15-
// https://axelarscan.io/gmp/0x83d2af2f18c63349d755ce2f3fd3ff4a7990ebd0e61458200f60504e198c843d
13+
export const getAssets = () =>
14+
retry(() =>
15+
fetch("https://api.axelarscan.io/api/getAssets", {
16+
method: "GET",
17+
headers: { "Content-Type": "application/json" },
18+
}).then((res: any) => res.json())
19+
);
20+
21+
// TODO
22+
// custom tokens dont seem to be getting queried for example token from this tx
23+
// https://axelarscan.io/gmp/0x83d2af2f18c63349d755ce2f3fd3ff4a7990ebd0e61458200f60504e198c843d

src/adapters/squid/utils.ts

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const getTokenAddress = (symbol: string, chain: string, assets: any[]) =>
7272
symbol = getSymbol(symbol);
7373
chain = getChain(chain);
7474
let tokenAddress = assets.find((asset) => asset.symbol === symbol
75-
)?.addresses?.[chain]?.address
75+
)?.addresses?.[chain == 'imx' ? 'immutable' : chain]?.address
7676
if (tokenAddress == undefined) tokenAddress = "0x000000000000000000000000000000000000dEaD"
7777

7878
return tokenAddress;
@@ -119,31 +119,22 @@ const getSymbol = (rawSymbol: string) => {
119119
return symbol.charAt(0) === symbol.toUpperCase().charAt(0) ? symbol.toUpperCase() : symbol;
120120
}
121121

122-
// export const fetchAssets = () => {
123-
// return retry(() =>
124-
// fetch("https://api.axelarscan.io/", {
125-
// method: "POST",
126-
// headers: {
127-
// "Content-Type": "application/json",
128-
// },
129-
// body: JSON.stringify({
130-
// method: "getAssets",
131-
// }),
132-
// }).then((res: any) => {
133-
// console.log(res, 'the res')
134-
// res.json()
135-
// })
136-
// );
137-
// }
138-
139-
export const fetchAssets = () =>
140-
retry(() =>
141-
fetch("https://api.axelarscan.io/api/getAssets", {
142-
method: "GET",
143-
headers: { "Content-Type": "application/json" },
144-
}).then((res) => res.json())
145-
);
146-
122+
export const fetchAssets = () => {
123+
return retry(() =>
124+
fetch("https://api.axelarscan.io/", {
125+
method: "POST",
126+
headers: {
127+
"Content-Type": "application/json",
128+
},
129+
body: JSON.stringify({
130+
method: "getAssets",
131+
}),
132+
}).then((res: any) => {
133+
console.log(res, 'the res')
134+
res.json()
135+
})
136+
);
137+
}
147138

148139
export const isStablecoin = (tokenAddress: string, chain: string) => {
149140
// If it's the native token address, it's not a stablecoin

0 commit comments

Comments
 (0)