@swapkit/helpers 2.6.0 → 3.0.0-beta.1

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.
Files changed (167) hide show
  1. package/dist/api/index.cjs +3 -0
  2. package/dist/api/index.cjs.map +16 -0
  3. package/dist/api/index.js +3 -0
  4. package/dist/api/index.js.map +16 -0
  5. package/dist/chunk-1gwdyyeh.js +4 -0
  6. package/dist/chunk-1gwdyyeh.js.map +10 -0
  7. package/dist/chunk-2bhvezjh.js +4 -0
  8. package/dist/chunk-2bhvezjh.js.map +10 -0
  9. package/dist/chunk-3ptwhtpd.js +3 -0
  10. package/dist/chunk-3ptwhtpd.js.map +10 -0
  11. package/dist/chunk-3wnfcm30.js +4 -0
  12. package/dist/chunk-3wnfcm30.js.map +9 -0
  13. package/dist/chunk-40epvqbm.js +3 -0
  14. package/dist/chunk-40epvqbm.js.map +10 -0
  15. package/dist/chunk-49nsjaay.js +3 -0
  16. package/dist/chunk-49nsjaay.js.map +10 -0
  17. package/dist/chunk-4b66tryh.js +4 -0
  18. package/dist/chunk-4b66tryh.js.map +10 -0
  19. package/dist/chunk-4kzjrrjv.js +3 -0
  20. package/dist/chunk-4kzjrrjv.js.map +10 -0
  21. package/dist/chunk-5m49s8z8.js +4 -0
  22. package/dist/chunk-5m49s8z8.js.map +10 -0
  23. package/dist/chunk-9b6y7r75.js +4 -0
  24. package/dist/chunk-9b6y7r75.js.map +10 -0
  25. package/dist/chunk-9zcbvqq2.js +3 -0
  26. package/dist/chunk-9zcbvqq2.js.map +10 -0
  27. package/dist/chunk-a0bpx1q3.js +4 -0
  28. package/dist/chunk-a0bpx1q3.js.map +10 -0
  29. package/dist/chunk-a0fxkkfh.js +4 -0
  30. package/dist/chunk-a0fxkkfh.js.map +10 -0
  31. package/dist/chunk-a6bjd9ar.js +3 -0
  32. package/dist/chunk-a6bjd9ar.js.map +10 -0
  33. package/dist/chunk-bg6pz5qh.js +3 -0
  34. package/dist/chunk-bg6pz5qh.js.map +10 -0
  35. package/dist/chunk-cpdcnp2x.js +4 -0
  36. package/dist/chunk-cpdcnp2x.js.map +10 -0
  37. package/dist/chunk-fazw0jvt.js +3 -0
  38. package/dist/chunk-fazw0jvt.js.map +9 -0
  39. package/dist/chunk-fr86y3rx.js +4 -0
  40. package/dist/chunk-fr86y3rx.js.map +10 -0
  41. package/dist/chunk-ftdtdkhk.js +3 -0
  42. package/dist/chunk-ftdtdkhk.js.map +10 -0
  43. package/dist/chunk-gjeaw024.js +4 -0
  44. package/dist/chunk-gjeaw024.js.map +10 -0
  45. package/dist/chunk-hdcdd2cf.js +4 -0
  46. package/dist/chunk-hdcdd2cf.js.map +10 -0
  47. package/dist/chunk-q2pb6ggs.js +3 -0
  48. package/dist/chunk-q2pb6ggs.js.map +10 -0
  49. package/dist/chunk-t9s9811k.js +3 -0
  50. package/dist/chunk-t9s9811k.js.map +10 -0
  51. package/dist/chunk-v4dvhh90.js +4 -0
  52. package/dist/chunk-v4dvhh90.js.map +10 -0
  53. package/dist/chunk-vzptz52h.js +4 -0
  54. package/dist/chunk-vzptz52h.js.map +10 -0
  55. package/dist/chunk-wyr5d8ad.js +3 -0
  56. package/dist/chunk-wyr5d8ad.js.map +10 -0
  57. package/dist/chunk-x0jsq6ag.js +3 -0
  58. package/dist/chunk-x0jsq6ag.js.map +10 -0
  59. package/dist/chunk-x2fe9scs.js +3 -0
  60. package/dist/chunk-x2fe9scs.js.map +10 -0
  61. package/dist/chunk-xm5jkehh.js +4 -0
  62. package/dist/chunk-xm5jkehh.js.map +10 -0
  63. package/dist/chunk-xzb1nshn.js +3 -0
  64. package/dist/chunk-xzb1nshn.js.map +10 -0
  65. package/dist/contracts/index.cjs +3 -0
  66. package/dist/contracts/index.cjs.map +38 -0
  67. package/dist/contracts/index.js +3 -0
  68. package/dist/contracts/index.js.map +38 -0
  69. package/dist/index.cjs +6 -0
  70. package/dist/index.cjs.map +30 -0
  71. package/dist/index.js +3 -3
  72. package/dist/index.js.map +23 -23
  73. package/dist/tokens/index.cjs +3 -0
  74. package/dist/tokens/index.cjs.map +10 -0
  75. package/dist/tokens/index.js +3 -0
  76. package/dist/tokens/index.js.map +10 -0
  77. package/package.json +35 -16
  78. package/src/api/index.ts +19 -0
  79. package/src/api/microgard/endpoints.ts +83 -0
  80. package/src/api/microgard/types.ts +60 -0
  81. package/src/api/midgard/endpoints.ts +154 -0
  82. package/src/api/midgard/types.ts +155 -0
  83. package/src/api/swapkitApi/endpoints.ts +161 -0
  84. package/src/api/swapkitApi/types.ts +576 -0
  85. package/src/api/thornode/endpoints.ts +78 -0
  86. package/src/api/thornode/types.ts +241 -0
  87. package/src/api/thorswapStatic/endpoints.ts +46 -0
  88. package/src/api/thorswapStatic/types.ts +18 -0
  89. package/src/contracts/abis/avaxGeneric.ts +92 -0
  90. package/src/contracts/abis/avaxWoofi.ts +145 -0
  91. package/src/contracts/abis/bscGeneric.ts +106 -0
  92. package/src/contracts/abis/chainflipGateway.ts +330 -0
  93. package/src/contracts/abis/erc20.ts +99 -0
  94. package/src/contracts/abis/ethGeneric.ts +92 -0
  95. package/src/contracts/abis/mayaEvmVaults.ts +331 -0
  96. package/src/contracts/abis/pancakeV2.ts +145 -0
  97. package/src/contracts/abis/pangolin.ts +120 -0
  98. package/src/contracts/abis/sushiswap.ts +120 -0
  99. package/src/contracts/abis/tcEthVault.ts +650 -0
  100. package/src/contracts/abis/traderJoe.ts +120 -0
  101. package/src/contracts/abis/uniswapV2.ts +120 -0
  102. package/src/contracts/abis/uniswapV2Leg.ts +128 -0
  103. package/src/contracts/abis/uniswapV3_100.ts +128 -0
  104. package/src/contracts/abis/uniswapV3_10000.ts +128 -0
  105. package/src/contracts/abis/uniswapV3_3000.ts +128 -0
  106. package/src/contracts/abis/uniswapV3_500.ts +128 -0
  107. package/src/contracts/index.ts +95 -0
  108. package/src/contracts/routers/index.ts +58 -0
  109. package/src/contracts/routers/kyber.ts +402 -0
  110. package/src/contracts/routers/oneinch.ts +2188 -0
  111. package/src/contracts/routers/pancakeswap.ts +340 -0
  112. package/src/contracts/routers/pangolin.ts +340 -0
  113. package/src/contracts/routers/sushiswap.ts +340 -0
  114. package/src/contracts/routers/traderJoe.ts +340 -0
  115. package/src/contracts/routers/uniswapv2.ts +340 -0
  116. package/src/contracts/routers/uniswapv3.ts +254 -0
  117. package/src/contracts/routers/woofi.ts +171 -0
  118. package/src/index.ts +19 -15
  119. package/src/modules/__tests__/assetValue.test.ts +50 -24
  120. package/src/modules/__tests__/swapKitConfig.test.ts +37 -0
  121. package/src/modules/assetValue.ts +82 -141
  122. package/src/modules/bigIntArithmetics.ts +6 -2
  123. package/src/modules/requestClient.ts +53 -65
  124. package/src/modules/swapKitConfig.ts +134 -0
  125. package/src/modules/swapKitError.ts +19 -14
  126. package/src/tokens/index.ts +15 -0
  127. package/src/tokens/lists/camelot_v3.ts +15920 -0
  128. package/src/tokens/lists/caviar_v1.ts +1694 -0
  129. package/src/tokens/lists/chainflip.ts +104 -0
  130. package/src/tokens/lists/index.ts +14 -0
  131. package/src/tokens/lists/jupiter.ts +29606 -0
  132. package/src/tokens/lists/mayachain.ts +513 -0
  133. package/src/tokens/lists/oneinch.ts +14238 -0
  134. package/src/tokens/lists/openocean_v2.ts +11514 -0
  135. package/src/tokens/lists/pancakeswap.ts +4296 -0
  136. package/src/tokens/lists/pangolin_v1.ts +175 -0
  137. package/src/tokens/lists/sushiswap_v2.ts +965 -0
  138. package/src/tokens/lists/thorchain.ts +669 -0
  139. package/src/tokens/lists/traderjoe_v2.ts +1384 -0
  140. package/src/tokens/lists/uniswap_v2.ts +5596 -0
  141. package/src/tokens/lists/uniswap_v3.ts +5946 -0
  142. package/src/types/chains.ts +48 -51
  143. package/src/types/commonTypes.ts +3 -90
  144. package/src/types/derivationPath.ts +11 -24
  145. package/src/types/index.ts +3 -4
  146. package/src/types/quotes.ts +0 -1
  147. package/src/types/radix.ts +2 -2
  148. package/src/types/sdk.ts +0 -40
  149. package/src/types/tokens.ts +14 -17
  150. package/src/types/wallet.ts +70 -33
  151. package/src/{helpers → utils}/__tests__/asset.test.ts +0 -27
  152. package/src/utils/asset.ts +235 -0
  153. package/src/{helpers → utils}/derivationPath.ts +31 -9
  154. package/src/{helpers → utils}/memo.ts +0 -82
  155. package/src/{helpers → utils}/others.ts +12 -5
  156. package/src/utils/plugin.ts +13 -0
  157. package/src/utils/tokens.ts +73 -0
  158. package/src/{helpers → utils}/validators.ts +7 -5
  159. package/src/{helpers/web3wallets.ts → utils/wallets.ts} +189 -145
  160. package/src/helpers/asset.ts +0 -324
  161. package/src/modules/walletUtils.ts +0 -30
  162. package/src/types/network.ts +0 -49
  163. /package/src/{helpers/__tests__/derivationPath.ts → utils/__tests__/derivationPath.test.ts} +0 -0
  164. /package/src/{helpers → utils}/__tests__/memo.test.ts +0 -0
  165. /package/src/{helpers → utils}/__tests__/others.test.ts +0 -0
  166. /package/src/{helpers → utils}/__tests__/validators.test.ts +0 -0
  167. /package/src/{helpers → utils}/liquidity.ts +0 -0
@@ -1,324 +0,0 @@
1
- import { AssetValue, TRADE_OR_SYNTH_ASSET_SEPERATOR } from "../modules/assetValue";
2
- import { RequestClient } from "../modules/requestClient";
3
- import { BaseDecimal, Chain, ChainToRPC, type EVMChain, EVMChains } from "../types/chains";
4
- import type { RadixCoreStateResourceDTO } from "../types/radix";
5
- import type { TokenNames } from "../types/tokens";
6
-
7
- const getDecimalMethodHex = "0x313ce567";
8
-
9
- export type CommonAssetString = (typeof CommonAssetStrings)[number] | Chain;
10
-
11
- export type ConditionalAssetValueReturn<T extends boolean> = T extends true
12
- ? Promise<AssetValue[]>
13
- : AssetValue[];
14
-
15
- export const CommonAssetStrings = [
16
- `${Chain.Maya}.MAYA`,
17
- `${Chain.Ethereum}.THOR`,
18
- `${Chain.Ethereum}.vTHOR`,
19
- `${Chain.Kujira}.USK`,
20
- ] as const;
21
-
22
- const getContractDecimals = async ({ chain, to }: { chain: EVMChain; to: string }) => {
23
- try {
24
- const { result } = await RequestClient.post<{ result: string }>(ChainToRPC[chain], {
25
- headers: {
26
- accept: "*/*",
27
- "content-type": "application/json",
28
- "cache-control": "no-cache",
29
- },
30
- body: JSON.stringify({
31
- id: 44,
32
- jsonrpc: "2.0",
33
- method: "eth_call",
34
- params: [{ to: to.toLowerCase(), data: getDecimalMethodHex }, "latest"],
35
- }),
36
- });
37
-
38
- return Number.parseInt(BigInt(result || BaseDecimal[chain]).toString());
39
- } catch (error) {
40
- console.error(error);
41
- return BaseDecimal[chain];
42
- }
43
- };
44
-
45
- const getRadixResourceDecimals = async ({ symbol }: { symbol: string }) => {
46
- try {
47
- const resourceAddress = symbol.split("-")[1]?.toLowerCase();
48
-
49
- const { manager } = await RequestClient.post<RadixCoreStateResourceDTO>(
50
- `${ChainToRPC[Chain.Radix]}/state/resource`,
51
- {
52
- headers: {
53
- Accept: "*/*",
54
- "Content-Type": "application/json",
55
- },
56
- body: JSON.stringify({
57
- network: "mainnet",
58
- resource_address: resourceAddress,
59
- }),
60
- },
61
- );
62
-
63
- return manager.divisibility.value.divisibility;
64
- } catch (error) {
65
- console.error(error);
66
- return BaseDecimal[Chain.Radix];
67
- }
68
- };
69
-
70
- const getETHAssetDecimal = (symbol: string) => {
71
- if (symbol === Chain.Ethereum) return BaseDecimal.ETH;
72
- const splitSymbol = symbol.split("-");
73
- const address =
74
- splitSymbol.length === 1 ? undefined : splitSymbol[splitSymbol.length - 1]?.toLowerCase();
75
-
76
- return address?.startsWith("0x")
77
- ? getContractDecimals({ chain: Chain.Ethereum, to: address })
78
- : BaseDecimal.ETH;
79
- };
80
-
81
- const getAVAXAssetDecimal = (symbol: string) => {
82
- const splitSymbol = symbol.split("-");
83
- const address = splitSymbol.length === 1 ? undefined : splitSymbol[splitSymbol.length - 1];
84
-
85
- return address?.startsWith("0x")
86
- ? getContractDecimals({ chain: Chain.Avalanche, to: address.toLowerCase() })
87
- : BaseDecimal.AVAX;
88
- };
89
-
90
- const getBSCAssetDecimal = (symbol: string) => {
91
- if (symbol === Chain.BinanceSmartChain) return BaseDecimal.BSC;
92
-
93
- return BaseDecimal.BSC;
94
- };
95
-
96
- const getRadixAssetDecimal = (symbol: string) => {
97
- if (symbol === Chain.Radix) return BaseDecimal.XRD;
98
-
99
- return getRadixResourceDecimals({ symbol });
100
- };
101
-
102
- export const getDecimal = ({ chain, symbol }: { chain: Chain; symbol: string }) => {
103
- switch (chain) {
104
- case Chain.Ethereum:
105
- return getETHAssetDecimal(symbol);
106
- case Chain.Avalanche:
107
- return getAVAXAssetDecimal(symbol);
108
- case Chain.BinanceSmartChain:
109
- return getBSCAssetDecimal(symbol);
110
- case Chain.Radix:
111
- return getRadixAssetDecimal(symbol);
112
- default:
113
- return BaseDecimal[chain];
114
- }
115
- };
116
-
117
- export const getGasAsset = ({ chain }: { chain: Chain }) => {
118
- switch (chain) {
119
- case Chain.Arbitrum:
120
- case Chain.Base:
121
- case Chain.Optimism:
122
- return AssetValue.from({ asset: `${chain}.ETH` });
123
- case Chain.Maya:
124
- return AssetValue.from({ asset: `${chain}.CACAO` });
125
- case Chain.Cosmos:
126
- return AssetValue.from({ asset: `${chain}.ATOM` });
127
- case Chain.BinanceSmartChain:
128
- return AssetValue.from({ asset: `${chain}.BNB` });
129
- case Chain.THORChain:
130
- return AssetValue.from({ asset: `${chain}.RUNE` });
131
-
132
- default:
133
- return AssetValue.from({ asset: `${chain}.${chain}` });
134
- }
135
- };
136
-
137
- export const isGasAsset = ({ chain, symbol }: { chain: Chain; symbol: string }) => {
138
- switch (chain) {
139
- case Chain.Arbitrum:
140
- case Chain.Base:
141
- case Chain.Optimism:
142
- return symbol === "ETH";
143
- case Chain.Maya:
144
- return symbol === "CACAO";
145
- case Chain.Cosmos:
146
- return symbol === "ATOM";
147
- case Chain.BinanceSmartChain:
148
- return symbol === "BNB";
149
- case Chain.THORChain:
150
- return symbol === "RUNE";
151
-
152
- default:
153
- return symbol === chain;
154
- }
155
- };
156
-
157
- export const getCommonAssetInfo = (assetString: CommonAssetString) => {
158
- switch (assetString) {
159
- case Chain.Arbitrum:
160
- case Chain.Base:
161
- case Chain.Optimism:
162
- return { identifier: `${assetString}.ETH`, decimal: BaseDecimal[assetString] };
163
-
164
- case `${Chain.Ethereum}.THOR`:
165
- return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
166
- case `${Chain.Ethereum}.vTHOR`:
167
- return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
168
- case Chain.Cosmos:
169
- return { identifier: `${assetString}.ATOM`, decimal: BaseDecimal[assetString] };
170
- case Chain.THORChain:
171
- return { identifier: `${assetString}.RUNE`, decimal: BaseDecimal[assetString] };
172
- case Chain.BinanceSmartChain:
173
- return { identifier: `${assetString}.BNB`, decimal: BaseDecimal[assetString] };
174
- case Chain.Maya:
175
- return { identifier: `${assetString}.CACAO`, decimal: 10 };
176
- case Chain.Radix:
177
- return { identifier: `${Chain.Radix}.XRD`, decimal: BaseDecimal[assetString] };
178
-
179
- case `${Chain.Maya}.MAYA`:
180
- return { identifier: assetString, decimal: 4 };
181
- case `${Chain.Kujira}.USK`:
182
- return { identifier: assetString, decimal: 6 };
183
-
184
- default:
185
- return { identifier: `${assetString}.${assetString}`, decimal: BaseDecimal[assetString] };
186
- }
187
- };
188
-
189
- export const getAssetType = ({ chain, symbol }: { chain: Chain; symbol: string }) => {
190
- if (symbol.includes("/")) return "Synth";
191
- if (symbol.includes("~")) return "Trade";
192
-
193
- switch (chain) {
194
- case Chain.Arbitrum:
195
- case Chain.Optimism:
196
- case Chain.Base:
197
- return symbol === Chain.Ethereum ? "Native" : chain;
198
-
199
- case Chain.Cosmos:
200
- return symbol === "ATOM" ? "Native" : chain;
201
- case Chain.BinanceSmartChain:
202
- return symbol === "BNB" ? "Native" : chain;
203
- case Chain.Maya:
204
- return symbol === "CACAO" ? "Native" : chain;
205
- case Chain.THORChain:
206
- return symbol === "RUNE" ? "Native" : chain;
207
-
208
- default:
209
- return symbol === chain ? "Native" : chain;
210
- }
211
- };
212
-
213
- export const assetFromString = (assetString: string) => {
214
- const synth = assetString.includes("/");
215
- const trade = assetString.includes("~");
216
- const isTradeOrSynth = synth || trade;
217
- const [chain, ...symbolArray] = assetString.split(".") as [Chain, ...(string | undefined)[]];
218
- const symbol = symbolArray.join(".");
219
- const splitSymbol = symbol?.split("-");
220
- const ticker = splitSymbol?.length
221
- ? splitSymbol.length === 1
222
- ? splitSymbol[0]
223
- : splitSymbol.slice(0, -1).join("-")
224
- : undefined;
225
-
226
- if (isTradeOrSynth) {
227
- const tradeOrSynthSymbol = chain.concat(symbol);
228
- const tradeOrSynthSplitSymbol = tradeOrSynthSymbol?.split("-");
229
- const tradeOrSynthTicker = tradeOrSynthSplitSymbol?.length
230
- ? tradeOrSynthSplitSymbol.length === 1
231
- ? tradeOrSynthSplitSymbol[0]
232
- : tradeOrSynthSplitSymbol.slice(0, -1).join("-")
233
- : undefined;
234
- return {
235
- chain: Chain.THORChain,
236
- symbol: tradeOrSynthSymbol,
237
- ticker: tradeOrSynthTicker?.split(TRADE_OR_SYNTH_ASSET_SEPERATOR)?.[1],
238
- synth,
239
- trade,
240
- };
241
- }
242
-
243
- return { chain, symbol, ticker, synth, trade };
244
- };
245
-
246
- const potentialScamRegex = new RegExp(
247
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
248
- "gmi",
249
- );
250
-
251
- const evmAssetHasAddress = (assetString: string) => {
252
- const [chain, symbol] = assetString.split(".") as [EVMChain, string];
253
- if (!EVMChains.includes(chain as EVMChain)) return true;
254
- const splitSymbol = symbol.split("-");
255
- const address = splitSymbol.length === 1 ? undefined : splitSymbol[splitSymbol.length - 1];
256
-
257
- return isGasAsset({ chain: chain as Chain, symbol }) || !!address;
258
- };
259
-
260
- export const filterAssets = (
261
- tokens: {
262
- value: string;
263
- decimal: number;
264
- chain: Chain;
265
- symbol: string;
266
- }[],
267
- ) =>
268
- tokens.filter(({ chain, value, symbol }) => {
269
- const assetString = `${chain}.${symbol}`;
270
-
271
- return (
272
- !potentialScamRegex.test(assetString) && evmAssetHasAddress(assetString) && value !== "0"
273
- );
274
- });
275
-
276
- export async function findAssetBy(
277
- params:
278
- | { chain: EVMChain | Chain.Radix | Chain.Solana; contract: string }
279
- | { identifier: `${Chain}.${string}` },
280
- ) {
281
- const { tokenLists } = await import("@swapkit/tokens");
282
-
283
- for (const tokenList of Object.values(tokenLists)) {
284
- for (const { identifier, chain: tokenChain, ...rest } of tokenList.tokens) {
285
- if ("identifier" in params && identifier === params.identifier) {
286
- return identifier as TokenNames;
287
- }
288
-
289
- if (
290
- "address" in rest &&
291
- "chain" in params &&
292
- tokenChain === params.chain &&
293
- rest.address.toLowerCase() === params.contract.toLowerCase()
294
- )
295
- return identifier as TokenNames;
296
- }
297
- }
298
-
299
- return;
300
- }
301
-
302
- export const blockTimes = {
303
- [Chain.Arbitrum]: 1,
304
- [Chain.Avalanche]: 3,
305
- [Chain.Base]: 1,
306
- [Chain.BinanceSmartChain]: 3,
307
- [Chain.Bitcoin]: 600,
308
- [Chain.BitcoinCash]: 600,
309
- [Chain.Chainflip]: 5,
310
- [Chain.Cosmos]: 1.5,
311
- [Chain.Dash]: 150,
312
- [Chain.Dogecoin]: 600,
313
- [Chain.Ethereum]: 12.5,
314
- [Chain.Fiat]: 60,
315
- [Chain.Kujira]: 2.2,
316
- [Chain.Litecoin]: 150,
317
- [Chain.Maya]: 6,
318
- [Chain.Optimism]: 1,
319
- [Chain.Polkadot]: 6,
320
- [Chain.Polygon]: 2.1,
321
- [Chain.Radix]: 5,
322
- [Chain.Solana]: 1,
323
- [Chain.THORChain]: 6,
324
- };
@@ -1,30 +0,0 @@
1
- import type { Chain } from "../types/chains";
2
- import type { WalletOption } from "../types/wallet";
3
- import { SwapKitError } from "./swapKitError";
4
-
5
- export function filterSupportedChains<T extends Chain>(
6
- chains: Chain[],
7
- supportedChains: readonly T[],
8
- walletOption: WalletOption,
9
- ) {
10
- const supported = chains.filter((chain): chain is T => supportedChains.includes(chain as T));
11
-
12
- if (supported.length === 0) {
13
- throw new SwapKitError("wallet_chain_not_supported", {
14
- wallet: walletOption,
15
- chain: chains.join(", "),
16
- });
17
- }
18
-
19
- const unsupported = chains.filter((chain) => !supportedChains.includes(chain as T));
20
-
21
- if (unsupported.length > 0) {
22
- console.warn(
23
- `${walletOption} wallet does not support the following chains: ${unsupported.join(
24
- ", ",
25
- )}. These chains will be ignored.`,
26
- );
27
- }
28
-
29
- return supported;
30
- }
@@ -1,49 +0,0 @@
1
- /** @deprecated Use getRPCUrl or RPC_URLS instead */
2
- export enum RPCUrl {
3
- Arbitrum = "https://arb1.arbitrum.io/rpc",
4
- Avalanche = "https://avalanche-c-chain-rpc.publicnode.com",
5
- Base = "https://base.llamarpc.com",
6
- BinanceSmartChain = "https://bsc-dataseed.binance.org",
7
- Bitcoin = "https://bitcoin-rpc.publicnode.com",
8
- BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash",
9
- Chainflip = "wss://mainnet-archive.chainflip.io",
10
- Cosmos = "https://node-router.thorswap.net/cosmos/rpc",
11
- Dash = "https://dash-rpc.publicnode.com",
12
- Dogecoin = "https://node-router.thorswap.net/dogecoin",
13
- Ethereum = "https://ethereum-rpc.publicnode.com",
14
- Kujira = "https://rpc-kujira.synergynodes.com/",
15
- Litecoin = "https://node-router.thorswap.net/litecoin",
16
- Maya = "https://tendermint.mayachain.info",
17
- MayaStagenet = "https://stagenet.tendermint.mayachain.info",
18
- Optimism = "https://mainnet.optimism.io",
19
- Polkadot = "wss://rpc.polkadot.io",
20
- Polygon = "https://polygon-rpc.com",
21
- Radix = "https://radix-mainnet.rpc.grove.city/v1/326002fc/core",
22
- THORChain = "https://rpc.thorswap.net",
23
- THORChainStagenet = "https://stagenet-rpc.ninerealms.com",
24
- Solana = "https://solana-rpc.publicnode.com",
25
- }
26
-
27
- /** @deprecated Use EXPLORER_URLS instead */
28
- export enum ExplorerUrl {
29
- Arbitrum = "https://arbiscan.io",
30
- Avalanche = "https://snowtrace.io",
31
- Base = "https://basescan.org",
32
- BinanceSmartChain = "https://bscscan.com",
33
- Bitcoin = "https://blockchair.com/bitcoin",
34
- BitcoinCash = "https://www.blockchair.com/bitcoin-cash",
35
- Chainflip = "https://explorer.polkascan.io/polkadot",
36
- Cosmos = "https://www.mintscan.io/cosmos",
37
- Dash = "https://blockchair.com/dash",
38
- Dogecoin = "https://blockchair.com/dogecoin",
39
- Ethereum = "https://etherscan.io",
40
- Kujira = "https://finder.kujira.network/kaiyo-1",
41
- Litecoin = "https://blockchair.com/litecoin",
42
- Maya = "https://www.mayascan.org",
43
- Optimism = "https://optimistic.etherscan.io",
44
- Polkadot = "https://polkadot.subscan.io",
45
- Polygon = "https://polygonscan.com",
46
- Radix = "https://dashboard.radixdlt.com",
47
- THORChain = "https://runescan.io",
48
- Solana = "https://solscan.io",
49
- }
File without changes
File without changes
File without changes