@rhinestone/deposit-modal 0.19.0 → 0.20.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 (83) hide show
  1. package/README.md +154 -61
  2. package/dist/BankOnrampStep-3SNUX6V2.cjs +435 -0
  3. package/dist/BankOnrampStep-4D24HVHV.mjs +435 -0
  4. package/dist/{DepositModalReown-UITYXJ6W.cjs → DepositModalReown-7EHOJTFW.cjs} +21 -20
  5. package/dist/{DepositModalReown-XBNY6QCI.mjs → DepositModalReown-SYQ2SCHC.mjs} +6 -5
  6. package/dist/WithdrawModal-LLJLEYXZ.cjs +12 -0
  7. package/dist/WithdrawModal-LXDIT4UV.mjs +12 -0
  8. package/dist/{bearer-transport-CVHNBgoV.d.cts → bearer-transport-DZyeDG64.d.cts} +5 -1
  9. package/dist/{bearer-transport-CVHNBgoV.d.ts → bearer-transport-DZyeDG64.d.ts} +5 -1
  10. package/dist/{caip-BMi-9t09.d.cts → caip-nwFFL46o.d.cts} +2 -2
  11. package/dist/{caip-BMi-9t09.d.ts → caip-nwFFL46o.d.ts} +2 -2
  12. package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
  13. package/dist/{chunk-EG4H7OMC.cjs → chunk-CIVFT5KR.cjs} +171 -130
  14. package/dist/{chunk-PYOC6K24.cjs → chunk-D3R3O4CY.cjs} +1 -1
  15. package/dist/chunk-E7IMWVMN.mjs +346 -0
  16. package/dist/chunk-EJDBIWNH.mjs +113 -0
  17. package/dist/chunk-FKJ6EJHH.cjs +346 -0
  18. package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
  19. package/dist/{chunk-NITKDXHR.mjs → chunk-FW7ZMXQS.mjs} +849 -674
  20. package/dist/chunk-G264OM23.cjs +224 -0
  21. package/dist/chunk-IPHKBBUV.cjs +113 -0
  22. package/dist/{chunk-BIL4ENC3.mjs → chunk-IPKT3FU6.mjs} +73 -32
  23. package/dist/chunk-JPX4MEHV.mjs +19 -0
  24. package/dist/{chunk-HMUGY66O.cjs → chunk-KXSU24RU.cjs} +1569 -1019
  25. package/dist/{chunk-ISLVD5HQ.cjs → chunk-LVMNNMOZ.cjs} +10 -5
  26. package/dist/chunk-O5OW4S7L.cjs +19 -0
  27. package/dist/{chunk-5NWLS5BQ.mjs → chunk-OZPMRTW3.mjs} +1511 -961
  28. package/dist/{chunk-OCWSMLOP.cjs → chunk-PVFEZ3UG.cjs} +1164 -989
  29. package/dist/{chunk-ZGHVJ2XM.mjs → chunk-YQCRXJIL.mjs} +8 -3
  30. package/dist/chunk-YY4ZOAH5.mjs +224 -0
  31. package/dist/{chunk-X6N2XPTO.mjs → chunk-ZOJMB5TZ.mjs} +1 -1
  32. package/dist/compliance.cjs +4 -7
  33. package/dist/compliance.d.cts +26 -3
  34. package/dist/compliance.d.ts +26 -3
  35. package/dist/compliance.mjs +6 -9
  36. package/dist/constants-BQDxVNgr.d.cts +29 -0
  37. package/dist/constants-DjGQW5N5.d.ts +29 -0
  38. package/dist/constants.cjs +3 -37
  39. package/dist/constants.d.cts +4 -20
  40. package/dist/constants.d.ts +4 -20
  41. package/dist/constants.mjs +4 -38
  42. package/dist/deposit.cjs +7 -6
  43. package/dist/deposit.d.cts +5 -3
  44. package/dist/deposit.d.ts +5 -3
  45. package/dist/deposit.mjs +6 -5
  46. package/dist/embed.cjs +21 -20
  47. package/dist/embed.d.cts +3 -2
  48. package/dist/embed.d.ts +3 -2
  49. package/dist/embed.mjs +7 -6
  50. package/dist/index.cjs +8 -35
  51. package/dist/index.d.cts +5 -3
  52. package/dist/index.d.ts +5 -3
  53. package/dist/index.mjs +9 -36
  54. package/dist/onramp.cjs +4 -33
  55. package/dist/onramp.d.cts +51 -33
  56. package/dist/onramp.d.ts +51 -33
  57. package/dist/onramp.mjs +5 -34
  58. package/dist/polymarket.cjs +6 -6
  59. package/dist/polymarket.mjs +2 -2
  60. package/dist/ramp-types-HYWd7CW0.d.cts +108 -0
  61. package/dist/ramp-types-HYWd7CW0.d.ts +108 -0
  62. package/dist/styles.css +255 -0
  63. package/dist/{types-BOxa1DE-.d.ts → types-BEEMfNi2.d.cts} +24 -4
  64. package/dist/{types-BShYNpvO.d.cts → types-DQDUqzsZ.d.ts} +24 -4
  65. package/dist/withdraw.cjs +6 -5
  66. package/dist/withdraw.d.cts +4 -3
  67. package/dist/withdraw.d.ts +4 -3
  68. package/dist/withdraw.mjs +5 -4
  69. package/package.json +9 -17
  70. package/dist/WithdrawModal-DY6A55OA.mjs +0 -11
  71. package/dist/WithdrawModal-V42OK7L3.cjs +0 -11
  72. package/dist/chunk-ADEWTBSN.cjs +0 -19
  73. package/dist/chunk-EAGMY3QE.mjs +0 -962
  74. package/dist/chunk-OY5N3E6L.cjs +0 -962
  75. package/dist/chunk-PP4QE32S.mjs +0 -19
  76. package/dist/constants-BT4ctuHo.d.cts +0 -64
  77. package/dist/constants-D21ZdNOP.d.ts +0 -64
  78. package/dist/offramp.cjs +0 -25
  79. package/dist/offramp.d.cts +0 -28
  80. package/dist/offramp.d.ts +0 -28
  81. package/dist/offramp.mjs +0 -25
  82. package/dist/ramp-types-C6aUz4SZ.d.cts +0 -43
  83. package/dist/ramp-types-C6aUz4SZ.d.ts +0 -43
@@ -1,962 +0,0 @@
1
- // src/core/caip.ts
2
- var SOLANA_MAINNET_GENESIS = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
3
- var SOLANA_MAINNET_CAIP2 = `solana:${SOLANA_MAINNET_GENESIS}`;
4
- function toEvmCaip2(chainId) {
5
- return `eip155:${chainId}`;
6
- }
7
- function targetChainToCaip2(targetChain) {
8
- if (targetChain === "solana") return SOLANA_MAINNET_CAIP2;
9
- if (isHyperCoreDestination(targetChain)) return HYPERCORE_SPOT_CAIP2;
10
- if (typeof targetChain === "string") return targetChain;
11
- return toEvmCaip2(targetChain);
12
- }
13
- function parseEvmChainId(value) {
14
- if (typeof value === "number" && Number.isFinite(value)) {
15
- return value;
16
- }
17
- if (typeof value !== "string") return null;
18
- const match = value.match(/^eip155:(\d+)$/);
19
- if (!match?.[1]) return null;
20
- const parsed = Number.parseInt(match[1], 10);
21
- return Number.isFinite(parsed) ? parsed : null;
22
- }
23
- function isSolanaCaip2(value) {
24
- return typeof value === "string" && value.startsWith("solana:");
25
- }
26
- function displayChainIdForCaip2(caip2) {
27
- const evm = parseEvmChainId(caip2);
28
- if (evm !== null) return evm;
29
- if (isSolanaCaip2(caip2)) return "solana";
30
- if (isHyperCoreCaip2(caip2)) return "hypercore";
31
- if (caip2 === TRON_MAINNET_CAIP2) return "tron";
32
- if (caip2 === STELLAR_PUBNET_CAIP2) return "stellar";
33
- return null;
34
- }
35
- function isHyperCoreCaip2(value) {
36
- return typeof value === "string" && value.startsWith("hypercore:");
37
- }
38
- var HYPERCORE_CHAIN_ID = 1337;
39
- var HYPERCORE_SPOT_CAIP2 = "hypercore:spot";
40
- var TRON_MAINNET_CAIP2 = "tron:mainnet";
41
- var STELLAR_PUBNET_CAIP2 = "stellar:pubnet";
42
- function isTargetChain(value) {
43
- if (typeof value === "number") return Number.isInteger(value) && value > 0;
44
- return value === "solana" || value === HYPERCORE_SPOT_CAIP2 || value === TRON_MAINNET_CAIP2 || value === STELLAR_PUBNET_CAIP2;
45
- }
46
- function targetChainToChainId(targetChain) {
47
- if (isHyperCoreDestination(targetChain)) return "hypercore";
48
- if (targetChain === TRON_MAINNET_CAIP2) return "tron";
49
- if (targetChain === STELLAR_PUBNET_CAIP2) return "stellar";
50
- return targetChain;
51
- }
52
- function isHyperCoreDestination(targetChain) {
53
- return targetChain === HYPERCORE_SPOT_CAIP2 || targetChain === HYPERCORE_CHAIN_ID;
54
- }
55
- var HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
56
- var HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
57
- var HYPERCORE_SOURCE_TOKENS = [
58
- { symbol: "USDC", address: HYPERCORE_USDC_ADDRESS, decimals: 6 },
59
- { symbol: "USDT0", address: HYPERCORE_USDT0_ADDRESS, decimals: 6 }
60
- ];
61
- var HYPERCORE_MIN_DEPOSIT_USD = 1;
62
- function isVirtualDestination(targetChain) {
63
- return typeof targetChain !== "number" || isHyperCoreDestination(targetChain);
64
- }
65
-
66
- // src/core/solana-tokens.ts
67
- var SOLANA_TOKENS = [
68
- { symbol: "SOL", mint: "native", decimals: 9 },
69
- {
70
- symbol: "USDC",
71
- mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
72
- decimals: 6
73
- },
74
- {
75
- symbol: "USDT",
76
- mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
77
- decimals: 6
78
- }
79
- ];
80
- function getSolanaTokenBySymbol(symbol) {
81
- return SOLANA_TOKENS.find(
82
- (t) => t.symbol.toUpperCase() === symbol.toUpperCase()
83
- );
84
- }
85
- function getSolanaTokenByMint(mint) {
86
- return SOLANA_TOKENS.find((t) => t.mint === mint);
87
- }
88
- function isNativeSol(token) {
89
- return token.mint === "native";
90
- }
91
-
92
- // src/core/runtime-chain-meta.ts
93
- var byChainId = /* @__PURE__ */ new Map();
94
- function setRuntimeChainMeta(entries) {
95
- for (const entry of entries) {
96
- byChainId.set(entry.chainId, {
97
- name: entry.name,
98
- iconUrl: entry.iconUrl,
99
- nativeSymbol: entry.nativeSymbol,
100
- explorerUrl: entry.explorerUrl,
101
- explorerTxPath: entry.explorerTxPath,
102
- explorerAddressPath: entry.explorerAddressPath
103
- });
104
- }
105
- }
106
- function getRuntimeNativeSymbol(chainId) {
107
- return byChainId.get(chainId)?.nativeSymbol;
108
- }
109
- function getRuntimeChainName(chainId) {
110
- return byChainId.get(chainId)?.name;
111
- }
112
- function getRuntimeChainIconUrl(chainId) {
113
- return byChainId.get(chainId)?.iconUrl;
114
- }
115
- function getRuntimeChainExplorerUrl(chainId) {
116
- return byChainId.get(chainId)?.explorerUrl;
117
- }
118
- function getRuntimeChainExplorerTxPath(chainId) {
119
- return byChainId.get(chainId)?.explorerTxPath;
120
- }
121
- function getRuntimeChainExplorerName(chainId) {
122
- const url = byChainId.get(chainId)?.explorerUrl;
123
- return url ? explorerNameFromUrl(url) : void 0;
124
- }
125
- function explorerNameFromUrl(url) {
126
- let host;
127
- try {
128
- host = new URL(url).hostname;
129
- } catch {
130
- return void 0;
131
- }
132
- const label = host.replace(/^www\./, "").split(".")[0];
133
- if (!label) return void 0;
134
- return label.charAt(0).toUpperCase() + label.slice(1);
135
- }
136
-
137
- // src/core/icons.ts
138
- var ICON_CDN = "https://s3.rhinestone.dev";
139
- var CHAIN_ICON_SLUGS = {
140
- 1: "mainnet",
141
- 10: "optimism",
142
- 56: "bsc",
143
- 100: "gnosis",
144
- 130: "unichain",
145
- 137: "polygon",
146
- 143: "monad",
147
- 146: "sonic",
148
- 999: "hypeevm",
149
- 1868: "soneium",
150
- 4663: "robinhood",
151
- 8453: "base",
152
- 9745: "plasma",
153
- 42161: "arbitrum",
154
- 43114: "avalanche",
155
- 747474: "katana"
156
- };
157
- function cdnIconUrl(dir, slug) {
158
- return `${ICON_CDN}/${dir}/${slug}.svg`;
159
- }
160
- var CHAIN_ICONS = Object.fromEntries(
161
- Object.entries(CHAIN_ICON_SLUGS).map(([id, slug]) => [
162
- Number(id),
163
- cdnIconUrl("chains", slug)
164
- ])
165
- );
166
- var SOLANA_CHAIN_ICON = cdnIconUrl("chains", "solana");
167
- var HYPEREVM_CHAIN_ID = 999;
168
- function getChainIcon(chainId) {
169
- if (chainId === "solana") return SOLANA_CHAIN_ICON;
170
- if (chainId === "hypercore" || chainId === HYPERCORE_CHAIN_ID) {
171
- return CHAIN_ICONS[HYPEREVM_CHAIN_ID];
172
- }
173
- if (typeof chainId === "string") return getRuntimeChainIconUrl(chainId);
174
- return CHAIN_ICONS[chainId] ?? getRuntimeChainIconUrl(chainId);
175
- }
176
- var ICON_SLUG_ALIASES = {
177
- "usdc.e": "usdc",
178
- wsol: "sol",
179
- xdai: "dai",
180
- // A wrapped token is the same asset and the CDN hosts only the underlying
181
- // mark, so these fall back to it rather than to a text badge. `weth` is the
182
- // one the deposit flow offers on nearly every chain, and it has been showing
183
- // as text since the icons moved to the CDN.
184
- weth: "eth",
185
- wavax: "avax"
186
- };
187
- function tokenIconUrl(symbol) {
188
- const key = symbol.toLowerCase().replace(/₮/g, "t");
189
- const slug = ICON_SLUG_ALIASES[key] ?? key;
190
- return `https://s3.rhinestone.dev/tokens/${slug}.svg`;
191
- }
192
- function getTokenIcon(symbol) {
193
- return tokenIconUrl(symbol);
194
- }
195
-
196
- // src/core/runtime-token-meta.ts
197
- var bySymbol = /* @__PURE__ */ new Map();
198
- var byAddress = /* @__PURE__ */ new Map();
199
- var symbolsByChain = /* @__PURE__ */ new Map();
200
- function symbolKey(chainId, symbol) {
201
- return `${chainId}:${symbol.trim().toUpperCase()}`;
202
- }
203
- function addressKey(chainId, address) {
204
- const key = address.startsWith("0x") ? address.toLowerCase() : address;
205
- return `${chainId}:${key}`;
206
- }
207
- function setRuntimeTokens(tokens) {
208
- for (const token of tokens) {
209
- const sKey = symbolKey(token.chainId, token.symbol);
210
- if (!bySymbol.has(sKey)) {
211
- bySymbol.set(sKey, token);
212
- const list = symbolsByChain.get(token.chainId);
213
- if (list) list.push(token.symbol);
214
- else symbolsByChain.set(token.chainId, [token.symbol]);
215
- }
216
- byAddress.set(addressKey(token.chainId, token.address), token);
217
- }
218
- }
219
- function publishShortlistTokens(shortlist) {
220
- const tokens = [];
221
- for (const [chainKey, entries] of Object.entries(shortlist)) {
222
- const chainId = Number(chainKey);
223
- if (!Number.isInteger(chainId)) continue;
224
- for (const entry of entries) {
225
- if (!/^0x[a-fA-F0-9]{40}$/.test(entry.address)) continue;
226
- tokens.push({
227
- chainId,
228
- symbol: entry.symbol,
229
- address: entry.address,
230
- decimals: entry.decimals
231
- });
232
- }
233
- }
234
- setRuntimeTokens(tokens);
235
- }
236
- function getRuntimeToken(chainId, symbol) {
237
- return bySymbol.get(symbolKey(chainId, symbol));
238
- }
239
- function getRuntimeTokenByAddress(chainId, address) {
240
- return byAddress.get(addressKey(chainId, address));
241
- }
242
- function getRuntimeTokenSymbols(chainId) {
243
- return symbolsByChain.get(chainId) ?? [];
244
- }
245
- function findRuntimeDecimalsByAddress(address) {
246
- return findByAddress(address)?.decimals;
247
- }
248
- function findRuntimeSymbolByAddress(address) {
249
- return findByAddress(address)?.symbol;
250
- }
251
- function findByAddress(address) {
252
- const suffix = `:${address.toLowerCase()}`;
253
- for (const [key, token] of byAddress) {
254
- if (key.endsWith(suffix)) return token;
255
- }
256
- return void 0;
257
- }
258
-
259
- // src/core/constants.ts
260
- var CHAIN_ID = {
261
- mainnet: 1,
262
- optimism: 10,
263
- bsc: 56,
264
- gnosis: 100,
265
- unichain: 130,
266
- polygon: 137,
267
- monad: 143,
268
- sonic: 146,
269
- hyperliquid: 999,
270
- soneium: 1868,
271
- base: 8453,
272
- plasma: 9745,
273
- arbitrum: 42161,
274
- katana: 747474
275
- };
276
- var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
277
- var SUPPORTED_TOKEN_MATRIX = {
278
- ETH: [
279
- CHAIN_ID.mainnet,
280
- CHAIN_ID.base,
281
- CHAIN_ID.arbitrum,
282
- CHAIN_ID.optimism,
283
- CHAIN_ID.soneium,
284
- CHAIN_ID.unichain,
285
- CHAIN_ID.katana
286
- ],
287
- // Polygon's native gas token is POL, not ETH (address 0x0 on 137 is POL).
288
- POL: [CHAIN_ID.polygon],
289
- WETH: [
290
- CHAIN_ID.mainnet,
291
- CHAIN_ID.base,
292
- CHAIN_ID.arbitrum,
293
- CHAIN_ID.optimism,
294
- CHAIN_ID.polygon,
295
- CHAIN_ID.soneium,
296
- CHAIN_ID.unichain,
297
- CHAIN_ID.katana
298
- ],
299
- USDC: [
300
- CHAIN_ID.mainnet,
301
- CHAIN_ID.base,
302
- CHAIN_ID.arbitrum,
303
- CHAIN_ID.optimism,
304
- CHAIN_ID.polygon,
305
- CHAIN_ID.soneium,
306
- CHAIN_ID.gnosis,
307
- CHAIN_ID.sonic,
308
- CHAIN_ID.monad,
309
- CHAIN_ID.unichain,
310
- CHAIN_ID.katana,
311
- CHAIN_ID.hyperliquid
312
- ],
313
- USDT: [CHAIN_ID.mainnet, CHAIN_ID.bsc, CHAIN_ID.soneium, CHAIN_ID.katana],
314
- USDT0: [CHAIN_ID.arbitrum, CHAIN_ID.optimism, CHAIN_ID.polygon, CHAIN_ID.plasma, CHAIN_ID.monad, CHAIN_ID.unichain]
315
- };
316
- var CHAIN_DISPLAY_ORDER = [
317
- CHAIN_ID.mainnet,
318
- CHAIN_ID.base,
319
- CHAIN_ID.arbitrum,
320
- CHAIN_ID.optimism,
321
- CHAIN_ID.polygon,
322
- CHAIN_ID.bsc,
323
- CHAIN_ID.plasma,
324
- CHAIN_ID.soneium,
325
- CHAIN_ID.gnosis,
326
- CHAIN_ID.sonic,
327
- CHAIN_ID.monad,
328
- CHAIN_ID.unichain,
329
- CHAIN_ID.katana,
330
- CHAIN_ID.hyperliquid
331
- ];
332
- var supportedChainSet = /* @__PURE__ */ new Set();
333
- for (const chainIds of Object.values(SUPPORTED_TOKEN_MATRIX)) {
334
- for (const chainId of chainIds) {
335
- supportedChainSet.add(chainId);
336
- }
337
- }
338
- var SUPPORTED_CHAIN_IDS = CHAIN_DISPLAY_ORDER.filter(
339
- (chainId) => supportedChainSet.has(chainId)
340
- );
341
- var SUPPORTED_TOKENS_BY_CHAIN = Object.fromEntries(
342
- SUPPORTED_CHAIN_IDS.map((chainId) => {
343
- const symbols = Object.entries(SUPPORTED_TOKEN_MATRIX).filter(([, chainIds]) => chainIds.includes(chainId)).map(([symbol]) => symbol);
344
- return [chainId, symbols];
345
- })
346
- );
347
- var chainRegistry = {
348
- [CHAIN_ID.mainnet]: {
349
- name: "Ethereum",
350
- tokens: [
351
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
352
- {
353
- symbol: "USDC",
354
- address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
355
- decimals: 6
356
- },
357
- {
358
- symbol: "WETH",
359
- address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
360
- decimals: 18
361
- },
362
- {
363
- symbol: "USDT",
364
- address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
365
- decimals: 6
366
- }
367
- ]
368
- },
369
- [CHAIN_ID.hyperliquid]: {
370
- name: "HyperEVM",
371
- tokens: [
372
- { symbol: "HYPE", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
373
- {
374
- symbol: "USDC",
375
- address: HYPERCORE_USDC_ADDRESS,
376
- decimals: 6
377
- }
378
- ]
379
- },
380
- [CHAIN_ID.base]: {
381
- name: "Base",
382
- tokens: [
383
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
384
- {
385
- symbol: "USDC",
386
- address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
387
- decimals: 6
388
- },
389
- {
390
- symbol: "WETH",
391
- address: "0x4200000000000000000000000000000000000006",
392
- decimals: 18
393
- }
394
- ]
395
- },
396
- [CHAIN_ID.arbitrum]: {
397
- name: "Arbitrum One",
398
- tokens: [
399
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
400
- {
401
- symbol: "USDC",
402
- address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
403
- decimals: 6
404
- },
405
- {
406
- symbol: "WETH",
407
- address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
408
- decimals: 18
409
- },
410
- {
411
- symbol: "USDT0",
412
- address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
413
- decimals: 6
414
- }
415
- ]
416
- },
417
- [CHAIN_ID.optimism]: {
418
- name: "OP Mainnet",
419
- tokens: [
420
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
421
- {
422
- symbol: "USDC",
423
- address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
424
- decimals: 6
425
- },
426
- {
427
- symbol: "WETH",
428
- address: "0x4200000000000000000000000000000000000006",
429
- decimals: 18
430
- },
431
- {
432
- symbol: "USDT0",
433
- address: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
434
- decimals: 6
435
- }
436
- ]
437
- },
438
- [CHAIN_ID.polygon]: {
439
- name: "Polygon",
440
- tokens: [
441
- // Polygon's native gas token is POL (0x0 on 137), not ETH.
442
- { symbol: "POL", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
443
- {
444
- symbol: "USDC",
445
- address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
446
- decimals: 6
447
- },
448
- // Bridged USDC.e — what Polymarket withdrawals arrive as. Mapped to the
449
- // USDC symbol/icon for display and 6 decimals so history rows resolve
450
- // correctly. Listed after native USDC so symbol→address lookups (and
451
- // the selectable token list, which is driven separately by
452
- // SUPPORTED_TOKENS_BY_CHAIN) keep resolving USDC to the native address.
453
- {
454
- symbol: "USDC",
455
- address: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
456
- decimals: 6
457
- },
458
- {
459
- symbol: "WETH",
460
- address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
461
- decimals: 18
462
- },
463
- {
464
- symbol: "USDT0",
465
- address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
466
- decimals: 6
467
- }
468
- ]
469
- },
470
- [CHAIN_ID.bsc]: {
471
- name: "BNB Smart Chain",
472
- tokens: [
473
- {
474
- symbol: "USDC",
475
- address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
476
- decimals: 18
477
- },
478
- {
479
- symbol: "WETH",
480
- address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
481
- decimals: 18
482
- },
483
- {
484
- symbol: "USDT",
485
- address: "0x55d398326f99059fF775485246999027B3197955",
486
- decimals: 18
487
- }
488
- ]
489
- },
490
- [CHAIN_ID.plasma]: {
491
- name: "Plasma",
492
- tokens: [
493
- {
494
- symbol: "USDT0",
495
- address: "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
496
- decimals: 6
497
- }
498
- ]
499
- },
500
- [CHAIN_ID.soneium]: {
501
- name: "Soneium Mainnet",
502
- tokens: [
503
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
504
- {
505
- symbol: "USDC",
506
- address: "0xbA9986D2381edf1DA03B0B9c1f8b00dc4AacC369",
507
- decimals: 6
508
- },
509
- {
510
- symbol: "WETH",
511
- address: "0x4200000000000000000000000000000000000006",
512
- decimals: 18
513
- },
514
- {
515
- symbol: "USDT",
516
- address: "0x3A337a6adA9d885b6Ad95ec48F9b75f197b5AE35",
517
- decimals: 6
518
- }
519
- ]
520
- },
521
- [CHAIN_ID.gnosis]: {
522
- name: "Gnosis",
523
- tokens: [
524
- {
525
- symbol: "USDC",
526
- address: "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
527
- decimals: 6
528
- }
529
- ]
530
- },
531
- [CHAIN_ID.sonic]: {
532
- name: "Sonic",
533
- tokens: [
534
- {
535
- symbol: "USDC",
536
- address: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894",
537
- decimals: 6
538
- }
539
- ]
540
- },
541
- [CHAIN_ID.monad]: {
542
- name: "Monad",
543
- tokens: [
544
- {
545
- symbol: "USDC",
546
- address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
547
- decimals: 6
548
- },
549
- {
550
- symbol: "USDT0",
551
- address: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
552
- decimals: 6
553
- }
554
- ]
555
- },
556
- [CHAIN_ID.unichain]: {
557
- name: "Unichain",
558
- tokens: [
559
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
560
- {
561
- symbol: "USDC",
562
- address: "0x078d782b760474a361dda0af3839290b0ef57ad6",
563
- decimals: 6
564
- },
565
- {
566
- symbol: "WETH",
567
- address: "0x4200000000000000000000000000000000000006",
568
- decimals: 18
569
- },
570
- {
571
- symbol: "USDT0",
572
- address: "0x9151434b16b9763660705744891fA906F660EcC5",
573
- decimals: 6
574
- }
575
- ]
576
- },
577
- [CHAIN_ID.katana]: {
578
- name: "Katana",
579
- tokens: [
580
- { symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
581
- {
582
- symbol: "USDC",
583
- address: "0x203a662b0bd271a6ed5a60edfbd04bfce608fd36",
584
- decimals: 6
585
- },
586
- {
587
- symbol: "USDT",
588
- address: "0x2dca96907fde857dd3d816880a0df407eeb2d2f2",
589
- decimals: 6
590
- },
591
- {
592
- symbol: "WETH",
593
- address: "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62",
594
- decimals: 18
595
- }
596
- ]
597
- },
598
- // HyperCore (virtual chain 1337) is a USDC-only deposit *destination*. It has
599
- // no viem chain / RPC, so it lives only here for name + token resolution —
600
- // deliberately absent from the source-chain matrices above.
601
- [HYPERCORE_CHAIN_ID]: {
602
- name: "HyperCore",
603
- // Destination truth: HyperCore delivery is USDC-only. The source path accepts
604
- // USDT0 too, but that lives in HYPERCORE_SOURCE_TOKENS (caip.ts) so it can't
605
- // leak into destination registration/display via this shared registry.
606
- tokens: [{ symbol: "USDC", address: HYPERCORE_USDC_ADDRESS, decimals: 6 }]
607
- }
608
- };
609
- function getChainId(chain) {
610
- return typeof chain === "number" ? chain : chain.id;
611
- }
612
- function normalizeTokenSymbol(symbol) {
613
- const trimmed = symbol.trim();
614
- const wrapped = trimmed.match(/\(([^)]+)\)/);
615
- if (wrapped?.[1]) {
616
- return wrapped[1].trim().toUpperCase();
617
- }
618
- return trimmed.toUpperCase();
619
- }
620
- function isSymbolSupportedOnChain(symbol, chainId) {
621
- const normalized = normalizeTokenSymbol(symbol);
622
- const symbols = SUPPORTED_TOKENS_BY_CHAIN[chainId];
623
- if (symbols?.includes(normalized)) return true;
624
- return getRuntimeToken(chainId, normalized) !== void 0;
625
- }
626
- function getTokenFromRegistry(chainId, symbol) {
627
- const chainEntry = chainRegistry[String(chainId)];
628
- if (!chainEntry) return runtimeToken(chainId, normalizeTokenSymbol(symbol));
629
- const normalized = normalizeTokenSymbol(symbol);
630
- const token = chainEntry.tokens.find(
631
- (t) => t.symbol.toUpperCase() === normalized
632
- );
633
- if (token) {
634
- return { address: token.address, decimals: token.decimals };
635
- }
636
- return runtimeToken(chainId, normalized);
637
- }
638
- function runtimeToken(chainId, symbol) {
639
- const token = getRuntimeToken(chainId, symbol);
640
- if (!token || !token.address.startsWith("0x")) return void 0;
641
- return { address: token.address, decimals: token.decimals };
642
- }
643
- function getUsdcAddress(chainId) {
644
- const token = getTokenFromRegistry(chainId, "USDC");
645
- return token?.address;
646
- }
647
- function getUsdcDecimals(chainId) {
648
- const token = getTokenFromRegistry(chainId, "USDC");
649
- return token?.decimals ?? 6;
650
- }
651
- function getTokenAddress(symbol, chainId) {
652
- if (symbol.toUpperCase() === "ETH") {
653
- if (!isSymbolSupportedOnChain("ETH", chainId)) {
654
- return void 0;
655
- }
656
- return NATIVE_TOKEN_ADDRESS;
657
- }
658
- if (!isSymbolSupportedOnChain(symbol, chainId)) {
659
- return void 0;
660
- }
661
- const token = getTokenFromRegistry(chainId, symbol);
662
- return token?.address;
663
- }
664
- function getTokenDecimals(symbol, chainId) {
665
- if (symbol.toUpperCase() === "ETH") {
666
- return 18;
667
- }
668
- const token = getTokenFromRegistry(chainId, symbol);
669
- return token?.decimals ?? 18;
670
- }
671
- function getTargetTokenSymbolsForChain(chainId) {
672
- const symbols = SUPPORTED_TOKENS_BY_CHAIN[chainId];
673
- if (symbols?.length) return [...symbols];
674
- return getRuntimeTokenSymbols(chainId);
675
- }
676
- function getSupportedTokenSymbolsForChain(chainId) {
677
- return getTargetTokenSymbolsForChain(chainId);
678
- }
679
- function getSupportedChainIds() {
680
- return [...SUPPORTED_CHAIN_IDS];
681
- }
682
- function isSupportedTokenAddressForChain(token, chainId) {
683
- const normalized = token.toLowerCase();
684
- if (normalized === NATIVE_TOKEN_ADDRESS) {
685
- return Boolean(SUPPORTED_TOKENS_BY_CHAIN[chainId]);
686
- }
687
- const symbol = getTokenSymbol(token, chainId);
688
- if (!symbol || symbol === "Token") return false;
689
- if (!isSymbolSupportedOnChain(symbol, chainId)) return false;
690
- const expected = getTokenFromRegistry(chainId, symbol);
691
- if (!expected) return false;
692
- return expected.address.toLowerCase() === normalized;
693
- }
694
- function getSupportedTargetTokens(chainId) {
695
- return toTokenOptions(getSupportedTokenSymbolsForChain(chainId), chainId);
696
- }
697
- function toTokenOptions(symbols, chainId) {
698
- const options = [];
699
- for (const symbol of symbols) {
700
- const address = getTokenAddress(symbol, chainId);
701
- if (!address) continue;
702
- options.push({
703
- symbol,
704
- address,
705
- decimals: getTokenDecimals(symbol, chainId)
706
- });
707
- }
708
- return options;
709
- }
710
- function findTokenDecimals(token, chainId) {
711
- const normalized = token.toLowerCase();
712
- if (normalized === NATIVE_TOKEN_ADDRESS) {
713
- return 18;
714
- }
715
- if (chainId) {
716
- const chainEntry = chainRegistry[String(chainId)];
717
- if (chainEntry) {
718
- const found = chainEntry.tokens.find(
719
- (t) => t.address.toLowerCase() === normalized
720
- );
721
- if (found) return found.decimals;
722
- }
723
- }
724
- for (const chainEntry of Object.values(chainRegistry)) {
725
- const found = chainEntry.tokens.find(
726
- (t) => t.address.toLowerCase() === normalized
727
- );
728
- if (found) return found.decimals;
729
- }
730
- if (chainId) {
731
- const onChain = getRuntimeTokenByAddress(chainId, normalized);
732
- if (onChain) return onChain.decimals;
733
- }
734
- return findRuntimeDecimalsByAddress(normalized);
735
- }
736
- function getTokenDecimalsByAddress(token, chainId) {
737
- return findTokenDecimals(token, chainId) ?? 18;
738
- }
739
- function findChainIdForToken(address) {
740
- const normalized = address.toLowerCase();
741
- for (const [chainIdStr, chainEntry] of Object.entries(chainRegistry)) {
742
- for (const token of chainEntry.tokens) {
743
- if (token.address.toLowerCase() === normalized) {
744
- return Number(chainIdStr);
745
- }
746
- }
747
- }
748
- return void 0;
749
- }
750
- function isRegistryTokenOnChain(token, chainId) {
751
- const normalized = token.toLowerCase();
752
- if (normalized === NATIVE_TOKEN_ADDRESS) return true;
753
- const chainEntry = chainRegistry[String(chainId)];
754
- return chainEntry ? chainEntry.tokens.some((t) => t.address.toLowerCase() === normalized) : false;
755
- }
756
- var NATIVE_SYMBOL_BY_CHAIN = {
757
- [CHAIN_ID.bsc]: "BNB",
758
- [CHAIN_ID.plasma]: "XPL",
759
- [CHAIN_ID.polygon]: "POL",
760
- [CHAIN_ID.gnosis]: "XDAI",
761
- [CHAIN_ID.sonic]: "S",
762
- [CHAIN_ID.monad]: "MON",
763
- [CHAIN_ID.hyperliquid]: "HYPE"
764
- };
765
- function getNativeSymbol(chainId) {
766
- if (chainId == null) return "ETH";
767
- const bundled = NATIVE_SYMBOL_BY_CHAIN[chainId];
768
- if (bundled) return bundled;
769
- return getRuntimeNativeSymbol(chainId) ?? "ETH";
770
- }
771
- function getTokenSymbol(token, chainId) {
772
- const normalized = token.toLowerCase();
773
- if (normalized === NATIVE_TOKEN_ADDRESS) {
774
- return getNativeSymbol(chainId);
775
- }
776
- if (chainId) {
777
- const chainEntry = chainRegistry[String(chainId)];
778
- if (chainEntry) {
779
- const found = chainEntry.tokens.find(
780
- (t) => t.address.toLowerCase() === normalized
781
- );
782
- if (found) return found.symbol;
783
- }
784
- }
785
- for (const chainEntry of Object.values(chainRegistry)) {
786
- const found = chainEntry.tokens.find(
787
- (t) => t.address.toLowerCase() === normalized
788
- );
789
- if (found) return found.symbol;
790
- }
791
- if (chainId) {
792
- const onChain = getRuntimeTokenByAddress(chainId, normalized);
793
- if (onChain) return onChain.symbol;
794
- }
795
- return findRuntimeSymbolByAddress(normalized) ?? "Token";
796
- }
797
- function getTargetTokenSymbol(token, chain) {
798
- if (chain === "solana") {
799
- return getSolanaTokenByMint(String(token))?.symbol ?? "Token";
800
- }
801
- const id = resolveDisplayChainId(chain);
802
- if (typeof id === "string") {
803
- return getRuntimeTokenByAddress(id, String(token))?.symbol ?? "Token";
804
- }
805
- return getTokenSymbol(token, id);
806
- }
807
- function isStablecoinSymbol(symbol) {
808
- return /^(usdc|usdt|usdt0|dai|usd)$/i.test(symbol);
809
- }
810
- var CHAIN_BADGES = {
811
- [CHAIN_ID.mainnet]: { shortLabel: "ETH", color: "#627EEA", bg: "#EEF2FF" },
812
- [CHAIN_ID.base]: { shortLabel: "Base", color: "#0052FF", bg: "#E7F0FF" },
813
- [CHAIN_ID.optimism]: { shortLabel: "OP", color: "#FF0420", bg: "#FFE9EC" },
814
- [CHAIN_ID.arbitrum]: { shortLabel: "Arb", color: "#28A0F0", bg: "#E6F6FF" },
815
- [CHAIN_ID.polygon]: { shortLabel: "Matic", color: "#8247E5", bg: "#EFE7FF" },
816
- [CHAIN_ID.bsc]: { shortLabel: "BSC", color: "#F3BA2F", bg: "#FFF8E0" },
817
- [CHAIN_ID.plasma]: { shortLabel: "Plasma", color: "#6C47FF", bg: "#EDE7FF" },
818
- [CHAIN_ID.soneium]: { shortLabel: "Soneium", color: "#0D0D0D", bg: "#E8E8E8" },
819
- [CHAIN_ID.sonic]: { shortLabel: "Sonic", color: "#5B6DEF", bg: "#EDEFFE" },
820
- [CHAIN_ID.gnosis]: { shortLabel: "Gnosis", color: "#3E6957", bg: "#E5F0EB" },
821
- [CHAIN_ID.hyperliquid]: { shortLabel: "Hyper", color: "#5BE7C4", bg: "#E5FFF8" },
822
- [CHAIN_ID.monad]: { shortLabel: "Monad", color: "#6E54FF", bg: "#EEEBFF" },
823
- [CHAIN_ID.unichain]: { shortLabel: "Uni", color: "#F50DB4", bg: "#FFE5F5" },
824
- [CHAIN_ID.katana]: { shortLabel: "Katana", color: "#0441B2", bg: "#E5EEFC" },
825
- [HYPERCORE_CHAIN_ID]: {
826
- shortLabel: "HyperCore",
827
- color: "#5BE7C4",
828
- bg: "#E5FFF8"
829
- }
830
- };
831
- function resolveDisplayChainId(chainId) {
832
- return chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
833
- }
834
- var NON_EVM_CHAIN_FALLBACKS = {
835
- solana: { name: "Solana", explorerUrl: "https://solscan.io" },
836
- tron: { name: "Tron", explorerUrl: "https://tronscan.org" },
837
- stellar: { name: "Stellar", explorerUrl: "https://stellar.expert" }
838
- };
839
- var SOLANA_BADGE = {
840
- shortLabel: "SOL",
841
- color: "#9945FF",
842
- bg: "#F3EEFF"
843
- };
844
- var HYPERCORE_EXPLORER_URL = "https://app.hyperliquid.xyz/explorer";
845
- function getChainName(chainId) {
846
- const id = resolveDisplayChainId(chainId);
847
- if (typeof id === "string") {
848
- return getRuntimeChainName(id) ?? NON_EVM_CHAIN_FALLBACKS[id].name;
849
- }
850
- const chainEntry = chainRegistry[String(id)];
851
- if (chainEntry) return chainEntry.name;
852
- const runtimeName = getRuntimeChainName(id);
853
- if (runtimeName) return runtimeName;
854
- return `Chain ${id}`;
855
- }
856
- function getChainBadge(chainId) {
857
- const id = resolveDisplayChainId(chainId);
858
- if (id === "solana") return SOLANA_BADGE;
859
- if (typeof id === "string") {
860
- const name2 = getChainName(id);
861
- return { shortLabel: name2, ...badgeColorsFor(name2) };
862
- }
863
- const curated = CHAIN_BADGES[id];
864
- if (curated) return curated;
865
- const name = getRuntimeChainName(id);
866
- if (!name) {
867
- return { shortLabel: "Net", color: "#64748B", bg: "#F1F5F9" };
868
- }
869
- return { shortLabel: name, ...badgeColorsFor(name) };
870
- }
871
- function badgeColorsFor(name) {
872
- let hash = 0;
873
- for (let i = 0; i < name.length; i++) {
874
- hash = hash * 31 + name.charCodeAt(i) | 0;
875
- }
876
- const hue = Math.abs(hash) % 360;
877
- return { color: `hsl(${hue} 55% 38%)`, bg: `hsl(${hue} 70% 95%)` };
878
- }
879
- function getExplorerUrl(chainId) {
880
- if (chainId === "hypercore") return HYPERCORE_EXPLORER_URL;
881
- const id = resolveDisplayChainId(chainId);
882
- const published = getRuntimeChainExplorerUrl(id);
883
- if (published) return published;
884
- return typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
885
- }
886
- function getExplorerTxUrl(chainId, txHash) {
887
- if (chainId === "hypercore" && !txHash.startsWith("0x")) return void 0;
888
- const url = getExplorerUrl(chainId);
889
- if (!url) return void 0;
890
- const path = getRuntimeChainExplorerTxPath(resolveDisplayChainId(chainId));
891
- return `${url}${path ?? "/tx/"}${txHash}`;
892
- }
893
- function getExplorerName(chainId) {
894
- if (chainId === "hypercore") return "Hyperliquid Explorer";
895
- const id = resolveDisplayChainId(chainId);
896
- const derived = getRuntimeChainExplorerName(id);
897
- if (derived) return derived;
898
- const url = typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
899
- return url && explorerNameFromUrl(url) || "Explorer";
900
- }
901
-
902
- export {
903
- SOLANA_MAINNET_CAIP2,
904
- toEvmCaip2,
905
- targetChainToCaip2,
906
- parseEvmChainId,
907
- isSolanaCaip2,
908
- displayChainIdForCaip2,
909
- isHyperCoreCaip2,
910
- HYPERCORE_CHAIN_ID,
911
- HYPERCORE_SPOT_CAIP2,
912
- TRON_MAINNET_CAIP2,
913
- STELLAR_PUBNET_CAIP2,
914
- isTargetChain,
915
- targetChainToChainId,
916
- isHyperCoreDestination,
917
- HYPERCORE_USDC_ADDRESS,
918
- HYPERCORE_USDT0_ADDRESS,
919
- HYPERCORE_SOURCE_TOKENS,
920
- HYPERCORE_MIN_DEPOSIT_USD,
921
- isVirtualDestination,
922
- SOLANA_TOKENS,
923
- getSolanaTokenBySymbol,
924
- getSolanaTokenByMint,
925
- isNativeSol,
926
- setRuntimeChainMeta,
927
- setRuntimeTokens,
928
- publishShortlistTokens,
929
- getRuntimeTokenByAddress,
930
- ICON_CDN,
931
- cdnIconUrl,
932
- getChainIcon,
933
- tokenIconUrl,
934
- getTokenIcon,
935
- NATIVE_TOKEN_ADDRESS,
936
- CHAIN_DISPLAY_ORDER,
937
- SUPPORTED_CHAIN_IDS,
938
- chainRegistry,
939
- getChainId,
940
- getUsdcAddress,
941
- getUsdcDecimals,
942
- getTokenAddress,
943
- getTokenDecimals,
944
- getTargetTokenSymbolsForChain,
945
- getSupportedTokenSymbolsForChain,
946
- getSupportedChainIds,
947
- isSupportedTokenAddressForChain,
948
- getSupportedTargetTokens,
949
- findTokenDecimals,
950
- getTokenDecimalsByAddress,
951
- findChainIdForToken,
952
- isRegistryTokenOnChain,
953
- getNativeSymbol,
954
- getTokenSymbol,
955
- getTargetTokenSymbol,
956
- isStablecoinSymbol,
957
- getChainName,
958
- getChainBadge,
959
- getExplorerUrl,
960
- getExplorerTxUrl,
961
- getExplorerName
962
- };