@xswap-link/sdk 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.global.js +62 -62
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/config/wagmiConfig.ts +34 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chain } from "@src/models";
|
|
2
2
|
import { isServer } from "@src/utils";
|
|
3
|
-
import { Transport } from "viem";
|
|
3
|
+
import { defineChain, Transport } from "viem";
|
|
4
4
|
import * as WagmiChains from "viem/chains";
|
|
5
5
|
import { mainnet } from "viem/chains";
|
|
6
6
|
import { Config, createConfig, createStorage, http } from "@wagmi/core";
|
|
@@ -38,7 +38,39 @@ const mapChains = (
|
|
|
38
38
|
supportedChains.some(({ chainId }) => chainId === chain.id.toString()),
|
|
39
39
|
),
|
|
40
40
|
);
|
|
41
|
-
|
|
41
|
+
for (const s of supportedChains) {
|
|
42
|
+
if (s.ecosystem !== "evm") continue;
|
|
43
|
+
const id = Number(s.chainId);
|
|
44
|
+
const exists = result.some((c) => c.id === id);
|
|
45
|
+
if (!exists) {
|
|
46
|
+
const custom = defineChain({
|
|
47
|
+
id,
|
|
48
|
+
name: s.name,
|
|
49
|
+
nativeCurrency: {
|
|
50
|
+
name: s.tokenSymbol,
|
|
51
|
+
symbol: s.tokenSymbol,
|
|
52
|
+
decimals: 18,
|
|
53
|
+
},
|
|
54
|
+
rpcUrls: {
|
|
55
|
+
default: { http: s.publicRpcUrls },
|
|
56
|
+
},
|
|
57
|
+
blockExplorers: {
|
|
58
|
+
default: {
|
|
59
|
+
name: s.transactionExplorer.match(/\/\/([^.]*)\./)?.[1] || "",
|
|
60
|
+
url: s.transactionExplorer,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
result.push(custom);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const seen = new Set<number>();
|
|
68
|
+
const deduped = result.filter((c) => {
|
|
69
|
+
if (seen.has(c.id)) return false;
|
|
70
|
+
seen.add(c.id);
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
return deduped as [WagmiChains.Chain, ...WagmiChains.Chain[]];
|
|
42
74
|
};
|
|
43
75
|
|
|
44
76
|
const mapTransports = (
|