@xswap-link/sdk 0.11.1 → 0.11.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xswap-link/sdk",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "JavaScript SDK for XSwap platform",
5
5
  "homepage": "https://github.com/xswap-link/xswap-sdk",
6
6
  "repository": {
@@ -59,7 +59,7 @@
59
59
  "react-virtuoso": "^4.7.12",
60
60
  "stream": "npm:stream-browserify@latest",
61
61
  "url": "npm:url-browserify@latest",
62
- "viem": "~2.29.1",
62
+ "viem": "~2.40.0",
63
63
  "wagmi": "^2.14.9",
64
64
  "zlib": "npm:zlib-browserify@latest"
65
65
  },
@@ -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
- return result;
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 = (
@@ -28,8 +28,9 @@ export const openTransactionModal = async ({
28
28
  highlightedDstTokens,
29
29
  }: ModalIntegrationPayload) => {
30
30
  const supportedChains: Chain[] = (await getChains()).filter(
31
- ({ web3Environment, swapSupported }) =>
32
- web3Environment === Web3Environment.MAINNET && swapSupported,
31
+ ({ web3Environment, swapSupported, bridgeSupported }) =>
32
+ web3Environment === Web3Environment.MAINNET &&
33
+ (swapSupported || bridgeSupported),
33
34
  );
34
35
 
35
36
  validateSwapTxData(