forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseLifi.ts
45 lines (43 loc) · 1.82 KB
/
baseLifi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { createConfig, type ExtendedChain, type SDKConfig } from "@lifi/sdk";
import { getChainConfigs, WalletProvider } from "../providers/wallet";
export class BaseLifiAction {
protected config: SDKConfig;
constructor(protected walletProvider: WalletProvider) {
this.config = createConfig({
integrator: "eliza",
chains: Object.values(
getChainConfigs(this.walletProvider.runtime)
).map((config) => ({
id: config.chainId,
name: config.name,
key: config.name.toLowerCase(),
chainType: "EVM" as const,
nativeToken: {
...config.nativeCurrency,
chainId: config.chainId,
address: "0x0000000000000000000000000000000000000000",
coinKey: config.nativeCurrency.symbol,
priceUSD: "0",
logoURI: "",
symbol: config.nativeCurrency.symbol,
decimals: config.nativeCurrency.decimals,
name: config.nativeCurrency.name,
},
rpcUrls: {
public: { http: [config.rpcUrl] },
},
blockExplorerUrls: [config.blockExplorerUrl],
metamask: {
chainId: `0x${config.chainId.toString(16)}`,
chainName: config.name,
nativeCurrency: config.nativeCurrency,
rpcUrls: [config.rpcUrl],
blockExplorerUrls: [config.blockExplorerUrl],
},
coin: config.nativeCurrency.symbol,
mainnet: true,
diamondAddress: "0x0000000000000000000000000000000000000000",
})) as ExtendedChain[],
});
}
}