@rhinestone/deposit-modal 0.18.0 → 0.20.0

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 +179 -48
  2. package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
  3. package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
  4. package/dist/{DepositModalReown-VCY65DJX.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
  5. package/dist/{DepositModalReown-TVO3ZQQK.cjs → DepositModalReown-ALVWADG7.cjs} +21 -20
  6. package/dist/WithdrawModal-5YWFJSYY.cjs +12 -0
  7. package/dist/WithdrawModal-LL4Z5WZP.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-EKC2IRQG.mjs → chunk-247GJH57.mjs} +687 -299
  13. package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
  14. package/dist/{chunk-AIZKGFVA.mjs → chunk-32ERBFMO.mjs} +1499 -978
  15. package/dist/chunk-5QUWEFD4.mjs +19 -0
  16. package/dist/chunk-6CTJFR3T.mjs +113 -0
  17. package/dist/{chunk-3TEVMP76.mjs → chunk-B2LZQIGB.mjs} +1 -1
  18. package/dist/{chunk-34JVJZEZ.cjs → chunk-BTEG2VNZ.cjs} +171 -130
  19. package/dist/{chunk-N3AAT6BS.cjs → chunk-CXRH5MKO.cjs} +1556 -1035
  20. package/dist/chunk-E7IMWVMN.mjs +346 -0
  21. package/dist/{chunk-N6JJG57R.cjs → chunk-EKFXUF5A.cjs} +1 -1
  22. package/dist/chunk-FKJ6EJHH.cjs +346 -0
  23. package/dist/chunk-FMUSY563.cjs +19 -0
  24. package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
  25. package/dist/chunk-G264OM23.cjs +224 -0
  26. package/dist/{chunk-R2B6VD4E.mjs → chunk-HP7S7AD6.mjs} +73 -32
  27. package/dist/{chunk-O4JZKKCZ.cjs → chunk-OPT5EW6L.cjs} +10 -5
  28. package/dist/chunk-PYRXOP2Y.cjs +113 -0
  29. package/dist/{chunk-X4EUXBHJ.mjs → chunk-XBJCZYBX.mjs} +8 -3
  30. package/dist/chunk-YY4ZOAH5.mjs +224 -0
  31. package/dist/{chunk-JV5OGG53.cjs → chunk-Z4RBTNKX.cjs} +1202 -814
  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 -20
  55. package/dist/onramp.d.cts +59 -23
  56. package/dist/onramp.d.ts +59 -23
  57. package/dist/onramp.mjs +5 -21
  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 +280 -0
  63. package/dist/{types-CbUs4boj.d.cts → types-BxSrazbq.d.ts} +56 -3
  64. package/dist/{types-CZYypODQ.d.ts → types-CixUBhrM.d.cts} +56 -3
  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-GR3HLYXU.cjs +0 -11
  71. package/dist/WithdrawModal-RMCYJJ4S.mjs +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
@@ -0,0 +1,346 @@
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/runtime-chain-meta.ts
67
+ var byChainId = /* @__PURE__ */ new Map();
68
+ function setRuntimeChainMeta(entries) {
69
+ for (const entry of entries) {
70
+ byChainId.set(entry.chainId, {
71
+ name: entry.name,
72
+ iconUrl: entry.iconUrl,
73
+ nativeSymbol: entry.nativeSymbol,
74
+ nativeDecimals: entry.nativeDecimals,
75
+ explorerUrl: entry.explorerUrl,
76
+ explorerTxPath: entry.explorerTxPath,
77
+ explorerAddressPath: entry.explorerAddressPath
78
+ });
79
+ }
80
+ }
81
+ function getRuntimeNativeSymbol(chainId) {
82
+ return byChainId.get(chainId)?.nativeSymbol;
83
+ }
84
+ function getRuntimeNativeDecimals(chainId) {
85
+ return byChainId.get(chainId)?.nativeDecimals;
86
+ }
87
+ function getRuntimeChainName(chainId) {
88
+ return byChainId.get(chainId)?.name;
89
+ }
90
+ function getRuntimeChainIconUrl(chainId) {
91
+ return byChainId.get(chainId)?.iconUrl;
92
+ }
93
+ function getRuntimeChainExplorerUrl(chainId) {
94
+ return byChainId.get(chainId)?.explorerUrl;
95
+ }
96
+ function getRuntimeChainExplorerTxPath(chainId) {
97
+ return byChainId.get(chainId)?.explorerTxPath;
98
+ }
99
+ function getRuntimeChainExplorerName(chainId) {
100
+ const url = byChainId.get(chainId)?.explorerUrl;
101
+ return url ? explorerNameFromUrl(url) : void 0;
102
+ }
103
+ function explorerNameFromUrl(url) {
104
+ let host;
105
+ try {
106
+ host = new URL(url).hostname;
107
+ } catch {
108
+ return void 0;
109
+ }
110
+ const label = host.replace(/^www\./, "").split(".")[0];
111
+ if (!label) return void 0;
112
+ return label.charAt(0).toUpperCase() + label.slice(1);
113
+ }
114
+
115
+ // src/core/icons.ts
116
+ var ICON_CDN = "https://s3.rhinestone.dev";
117
+ var CHAIN_ICON_SLUGS = {
118
+ 1: "mainnet",
119
+ 10: "optimism",
120
+ 56: "bsc",
121
+ 100: "gnosis",
122
+ 130: "unichain",
123
+ 137: "polygon",
124
+ 143: "monad",
125
+ 146: "sonic",
126
+ 999: "hypeevm",
127
+ 1868: "soneium",
128
+ 4663: "robinhood",
129
+ 8453: "base",
130
+ 9745: "plasma",
131
+ 42161: "arbitrum",
132
+ 43114: "avalanche",
133
+ 747474: "katana"
134
+ };
135
+ function cdnIconUrl(dir, slug) {
136
+ return `${ICON_CDN}/${dir}/${slug}.svg`;
137
+ }
138
+ var CHAIN_ICONS = Object.fromEntries(
139
+ Object.entries(CHAIN_ICON_SLUGS).map(([id, slug]) => [
140
+ Number(id),
141
+ cdnIconUrl("chains", slug)
142
+ ])
143
+ );
144
+ var SOLANA_CHAIN_ICON = cdnIconUrl("chains", "solana");
145
+ var HYPEREVM_CHAIN_ID = 999;
146
+ function getChainIcon(chainId) {
147
+ if (chainId === "solana") return SOLANA_CHAIN_ICON;
148
+ if (chainId === "hypercore" || chainId === HYPERCORE_CHAIN_ID) {
149
+ return CHAIN_ICONS[HYPEREVM_CHAIN_ID];
150
+ }
151
+ if (typeof chainId === "string") return getRuntimeChainIconUrl(chainId);
152
+ return CHAIN_ICONS[chainId] ?? getRuntimeChainIconUrl(chainId);
153
+ }
154
+
155
+ // src/core/constants.ts
156
+ var CHAIN_ID = {
157
+ mainnet: 1,
158
+ optimism: 10,
159
+ bsc: 56,
160
+ gnosis: 100,
161
+ unichain: 130,
162
+ polygon: 137,
163
+ monad: 143,
164
+ sonic: 146,
165
+ hyperliquid: 999,
166
+ soneium: 1868,
167
+ base: 8453,
168
+ plasma: 9745,
169
+ arbitrum: 42161,
170
+ katana: 747474
171
+ };
172
+ var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
173
+ var CHAIN_DISPLAY_ORDER = [
174
+ CHAIN_ID.mainnet,
175
+ CHAIN_ID.base,
176
+ CHAIN_ID.arbitrum,
177
+ CHAIN_ID.optimism,
178
+ CHAIN_ID.polygon,
179
+ CHAIN_ID.bsc,
180
+ CHAIN_ID.plasma,
181
+ CHAIN_ID.soneium,
182
+ CHAIN_ID.gnosis,
183
+ CHAIN_ID.sonic,
184
+ CHAIN_ID.monad,
185
+ CHAIN_ID.unichain,
186
+ CHAIN_ID.katana,
187
+ CHAIN_ID.hyperliquid
188
+ ];
189
+ var SUPPORTED_CHAIN_IDS = [...CHAIN_DISPLAY_ORDER];
190
+ var CHAIN_NAMES = {
191
+ [CHAIN_ID.mainnet]: "Ethereum",
192
+ [CHAIN_ID.hyperliquid]: "HyperEVM",
193
+ [CHAIN_ID.base]: "Base",
194
+ [CHAIN_ID.arbitrum]: "Arbitrum One",
195
+ [CHAIN_ID.optimism]: "OP Mainnet",
196
+ [CHAIN_ID.polygon]: "Polygon",
197
+ [CHAIN_ID.bsc]: "BNB Smart Chain",
198
+ [CHAIN_ID.plasma]: "Plasma",
199
+ [CHAIN_ID.soneium]: "Soneium Mainnet",
200
+ [CHAIN_ID.gnosis]: "Gnosis",
201
+ [CHAIN_ID.sonic]: "Sonic",
202
+ [CHAIN_ID.monad]: "Monad",
203
+ [CHAIN_ID.unichain]: "Unichain",
204
+ [CHAIN_ID.katana]: "Katana",
205
+ [HYPERCORE_CHAIN_ID]: "HyperCore"
206
+ };
207
+ function getChainId(chain) {
208
+ return typeof chain === "number" ? chain : chain.id;
209
+ }
210
+ function getSupportedChainIds() {
211
+ return [...SUPPORTED_CHAIN_IDS];
212
+ }
213
+ function isStablecoinSymbol(symbol) {
214
+ const normalized = symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
215
+ return /^(USDC|USDT|USDT0|DAI|USD)$/.test(normalized);
216
+ }
217
+ var CHAIN_BADGES = {
218
+ [CHAIN_ID.mainnet]: { shortLabel: "ETH", color: "#627EEA", bg: "#EEF2FF" },
219
+ [CHAIN_ID.base]: { shortLabel: "Base", color: "#0052FF", bg: "#E7F0FF" },
220
+ [CHAIN_ID.optimism]: { shortLabel: "OP", color: "#FF0420", bg: "#FFE9EC" },
221
+ [CHAIN_ID.arbitrum]: { shortLabel: "Arb", color: "#28A0F0", bg: "#E6F6FF" },
222
+ [CHAIN_ID.polygon]: { shortLabel: "Matic", color: "#8247E5", bg: "#EFE7FF" },
223
+ [CHAIN_ID.bsc]: { shortLabel: "BSC", color: "#F3BA2F", bg: "#FFF8E0" },
224
+ [CHAIN_ID.plasma]: { shortLabel: "Plasma", color: "#6C47FF", bg: "#EDE7FF" },
225
+ [CHAIN_ID.soneium]: { shortLabel: "Soneium", color: "#0D0D0D", bg: "#E8E8E8" },
226
+ [CHAIN_ID.sonic]: { shortLabel: "Sonic", color: "#5B6DEF", bg: "#EDEFFE" },
227
+ [CHAIN_ID.gnosis]: { shortLabel: "Gnosis", color: "#3E6957", bg: "#E5F0EB" },
228
+ [CHAIN_ID.hyperliquid]: { shortLabel: "Hyper", color: "#5BE7C4", bg: "#E5FFF8" },
229
+ [CHAIN_ID.monad]: { shortLabel: "Monad", color: "#6E54FF", bg: "#EEEBFF" },
230
+ [CHAIN_ID.unichain]: { shortLabel: "Uni", color: "#F50DB4", bg: "#FFE5F5" },
231
+ [CHAIN_ID.katana]: { shortLabel: "Katana", color: "#0441B2", bg: "#E5EEFC" },
232
+ [HYPERCORE_CHAIN_ID]: {
233
+ shortLabel: "HyperCore",
234
+ color: "#5BE7C4",
235
+ bg: "#E5FFF8"
236
+ }
237
+ };
238
+ function resolveDisplayChainId(chainId) {
239
+ return chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
240
+ }
241
+ var NON_EVM_CHAIN_FALLBACKS = {
242
+ solana: { name: "Solana", explorerUrl: "https://solscan.io" },
243
+ tron: { name: "Tron", explorerUrl: "https://tronscan.org" },
244
+ stellar: { name: "Stellar", explorerUrl: "https://stellar.expert" }
245
+ };
246
+ var SOLANA_BADGE = {
247
+ shortLabel: "SOL",
248
+ color: "#9945FF",
249
+ bg: "#F3EEFF"
250
+ };
251
+ var HYPERCORE_EXPLORER_URL = "https://app.hyperliquid.xyz/explorer";
252
+ function getChainName(chainId) {
253
+ const id = resolveDisplayChainId(chainId);
254
+ if (typeof id === "string") {
255
+ return getRuntimeChainName(id) ?? NON_EVM_CHAIN_FALLBACKS[id].name;
256
+ }
257
+ const curated = CHAIN_NAMES[id];
258
+ if (curated) return curated;
259
+ const runtimeName = getRuntimeChainName(id);
260
+ if (runtimeName) return runtimeName;
261
+ return `Chain ${id}`;
262
+ }
263
+ function getChainBadge(chainId) {
264
+ const id = resolveDisplayChainId(chainId);
265
+ if (id === "solana") return SOLANA_BADGE;
266
+ if (typeof id === "string") {
267
+ const name2 = getChainName(id);
268
+ return { shortLabel: name2, ...badgeColorsFor(name2) };
269
+ }
270
+ const curated = CHAIN_BADGES[id];
271
+ if (curated) return curated;
272
+ const name = getRuntimeChainName(id);
273
+ if (!name) {
274
+ return { shortLabel: "Net", color: "#64748B", bg: "#F1F5F9" };
275
+ }
276
+ return { shortLabel: name, ...badgeColorsFor(name) };
277
+ }
278
+ function badgeColorsFor(name) {
279
+ let hash = 0;
280
+ for (let i = 0; i < name.length; i++) {
281
+ hash = hash * 31 + name.charCodeAt(i) | 0;
282
+ }
283
+ const hue = Math.abs(hash) % 360;
284
+ return { color: `hsl(${hue} 55% 38%)`, bg: `hsl(${hue} 70% 95%)` };
285
+ }
286
+ function getExplorerUrl(chainId) {
287
+ if (chainId === "hypercore") return HYPERCORE_EXPLORER_URL;
288
+ const id = resolveDisplayChainId(chainId);
289
+ const published = getRuntimeChainExplorerUrl(id);
290
+ if (published) return published;
291
+ return typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
292
+ }
293
+ function getExplorerTxUrl(chainId, txHash) {
294
+ if (chainId === "hypercore" && !txHash.startsWith("0x")) return void 0;
295
+ const url = getExplorerUrl(chainId);
296
+ if (!url) return void 0;
297
+ const path = getRuntimeChainExplorerTxPath(resolveDisplayChainId(chainId));
298
+ return `${url}${path ?? "/tx/"}${txHash}`;
299
+ }
300
+ function getExplorerName(chainId) {
301
+ if (chainId === "hypercore") return "Hyperliquid Explorer";
302
+ const id = resolveDisplayChainId(chainId);
303
+ const derived = getRuntimeChainExplorerName(id);
304
+ if (derived) return derived;
305
+ const url = typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
306
+ return url && explorerNameFromUrl(url) || "Explorer";
307
+ }
308
+
309
+ export {
310
+ SOLANA_MAINNET_CAIP2,
311
+ toEvmCaip2,
312
+ targetChainToCaip2,
313
+ parseEvmChainId,
314
+ isSolanaCaip2,
315
+ displayChainIdForCaip2,
316
+ isHyperCoreCaip2,
317
+ HYPERCORE_CHAIN_ID,
318
+ HYPERCORE_SPOT_CAIP2,
319
+ TRON_MAINNET_CAIP2,
320
+ STELLAR_PUBNET_CAIP2,
321
+ isTargetChain,
322
+ targetChainToChainId,
323
+ isHyperCoreDestination,
324
+ HYPERCORE_USDC_ADDRESS,
325
+ HYPERCORE_USDT0_ADDRESS,
326
+ HYPERCORE_SOURCE_TOKENS,
327
+ HYPERCORE_MIN_DEPOSIT_USD,
328
+ isVirtualDestination,
329
+ setRuntimeChainMeta,
330
+ getRuntimeNativeSymbol,
331
+ getRuntimeNativeDecimals,
332
+ ICON_CDN,
333
+ cdnIconUrl,
334
+ getChainIcon,
335
+ NATIVE_TOKEN_ADDRESS,
336
+ CHAIN_DISPLAY_ORDER,
337
+ SUPPORTED_CHAIN_IDS,
338
+ getChainId,
339
+ getSupportedChainIds,
340
+ isStablecoinSymbol,
341
+ getChainName,
342
+ getChainBadge,
343
+ getExplorerUrl,
344
+ getExplorerTxUrl,
345
+ getExplorerName
346
+ };
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/core/version.ts
2
- var MODAL_VERSION = "0.18.0";
2
+ var MODAL_VERSION = "0.20.0";
3
3
  var SERVICE_HEADERS = {
4
4
  "Content-Type": "application/json",
5
5
  "x-deposit-modal-version": MODAL_VERSION
@@ -0,0 +1,346 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// 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 (!_optionalChain([match, 'optionalAccess', _ => _[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/runtime-chain-meta.ts
67
+ var byChainId = /* @__PURE__ */ new Map();
68
+ function setRuntimeChainMeta(entries) {
69
+ for (const entry of entries) {
70
+ byChainId.set(entry.chainId, {
71
+ name: entry.name,
72
+ iconUrl: entry.iconUrl,
73
+ nativeSymbol: entry.nativeSymbol,
74
+ nativeDecimals: entry.nativeDecimals,
75
+ explorerUrl: entry.explorerUrl,
76
+ explorerTxPath: entry.explorerTxPath,
77
+ explorerAddressPath: entry.explorerAddressPath
78
+ });
79
+ }
80
+ }
81
+ function getRuntimeNativeSymbol(chainId) {
82
+ return _optionalChain([byChainId, 'access', _2 => _2.get, 'call', _3 => _3(chainId), 'optionalAccess', _4 => _4.nativeSymbol]);
83
+ }
84
+ function getRuntimeNativeDecimals(chainId) {
85
+ return _optionalChain([byChainId, 'access', _5 => _5.get, 'call', _6 => _6(chainId), 'optionalAccess', _7 => _7.nativeDecimals]);
86
+ }
87
+ function getRuntimeChainName(chainId) {
88
+ return _optionalChain([byChainId, 'access', _8 => _8.get, 'call', _9 => _9(chainId), 'optionalAccess', _10 => _10.name]);
89
+ }
90
+ function getRuntimeChainIconUrl(chainId) {
91
+ return _optionalChain([byChainId, 'access', _11 => _11.get, 'call', _12 => _12(chainId), 'optionalAccess', _13 => _13.iconUrl]);
92
+ }
93
+ function getRuntimeChainExplorerUrl(chainId) {
94
+ return _optionalChain([byChainId, 'access', _14 => _14.get, 'call', _15 => _15(chainId), 'optionalAccess', _16 => _16.explorerUrl]);
95
+ }
96
+ function getRuntimeChainExplorerTxPath(chainId) {
97
+ return _optionalChain([byChainId, 'access', _17 => _17.get, 'call', _18 => _18(chainId), 'optionalAccess', _19 => _19.explorerTxPath]);
98
+ }
99
+ function getRuntimeChainExplorerName(chainId) {
100
+ const url = _optionalChain([byChainId, 'access', _20 => _20.get, 'call', _21 => _21(chainId), 'optionalAccess', _22 => _22.explorerUrl]);
101
+ return url ? explorerNameFromUrl(url) : void 0;
102
+ }
103
+ function explorerNameFromUrl(url) {
104
+ let host;
105
+ try {
106
+ host = new URL(url).hostname;
107
+ } catch (e) {
108
+ return void 0;
109
+ }
110
+ const label = host.replace(/^www\./, "").split(".")[0];
111
+ if (!label) return void 0;
112
+ return label.charAt(0).toUpperCase() + label.slice(1);
113
+ }
114
+
115
+ // src/core/icons.ts
116
+ var ICON_CDN = "https://s3.rhinestone.dev";
117
+ var CHAIN_ICON_SLUGS = {
118
+ 1: "mainnet",
119
+ 10: "optimism",
120
+ 56: "bsc",
121
+ 100: "gnosis",
122
+ 130: "unichain",
123
+ 137: "polygon",
124
+ 143: "monad",
125
+ 146: "sonic",
126
+ 999: "hypeevm",
127
+ 1868: "soneium",
128
+ 4663: "robinhood",
129
+ 8453: "base",
130
+ 9745: "plasma",
131
+ 42161: "arbitrum",
132
+ 43114: "avalanche",
133
+ 747474: "katana"
134
+ };
135
+ function cdnIconUrl(dir, slug) {
136
+ return `${ICON_CDN}/${dir}/${slug}.svg`;
137
+ }
138
+ var CHAIN_ICONS = Object.fromEntries(
139
+ Object.entries(CHAIN_ICON_SLUGS).map(([id, slug]) => [
140
+ Number(id),
141
+ cdnIconUrl("chains", slug)
142
+ ])
143
+ );
144
+ var SOLANA_CHAIN_ICON = cdnIconUrl("chains", "solana");
145
+ var HYPEREVM_CHAIN_ID = 999;
146
+ function getChainIcon(chainId) {
147
+ if (chainId === "solana") return SOLANA_CHAIN_ICON;
148
+ if (chainId === "hypercore" || chainId === HYPERCORE_CHAIN_ID) {
149
+ return CHAIN_ICONS[HYPEREVM_CHAIN_ID];
150
+ }
151
+ if (typeof chainId === "string") return getRuntimeChainIconUrl(chainId);
152
+ return _nullishCoalesce(CHAIN_ICONS[chainId], () => ( getRuntimeChainIconUrl(chainId)));
153
+ }
154
+
155
+ // src/core/constants.ts
156
+ var CHAIN_ID = {
157
+ mainnet: 1,
158
+ optimism: 10,
159
+ bsc: 56,
160
+ gnosis: 100,
161
+ unichain: 130,
162
+ polygon: 137,
163
+ monad: 143,
164
+ sonic: 146,
165
+ hyperliquid: 999,
166
+ soneium: 1868,
167
+ base: 8453,
168
+ plasma: 9745,
169
+ arbitrum: 42161,
170
+ katana: 747474
171
+ };
172
+ var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
173
+ var CHAIN_DISPLAY_ORDER = [
174
+ CHAIN_ID.mainnet,
175
+ CHAIN_ID.base,
176
+ CHAIN_ID.arbitrum,
177
+ CHAIN_ID.optimism,
178
+ CHAIN_ID.polygon,
179
+ CHAIN_ID.bsc,
180
+ CHAIN_ID.plasma,
181
+ CHAIN_ID.soneium,
182
+ CHAIN_ID.gnosis,
183
+ CHAIN_ID.sonic,
184
+ CHAIN_ID.monad,
185
+ CHAIN_ID.unichain,
186
+ CHAIN_ID.katana,
187
+ CHAIN_ID.hyperliquid
188
+ ];
189
+ var SUPPORTED_CHAIN_IDS = [...CHAIN_DISPLAY_ORDER];
190
+ var CHAIN_NAMES = {
191
+ [CHAIN_ID.mainnet]: "Ethereum",
192
+ [CHAIN_ID.hyperliquid]: "HyperEVM",
193
+ [CHAIN_ID.base]: "Base",
194
+ [CHAIN_ID.arbitrum]: "Arbitrum One",
195
+ [CHAIN_ID.optimism]: "OP Mainnet",
196
+ [CHAIN_ID.polygon]: "Polygon",
197
+ [CHAIN_ID.bsc]: "BNB Smart Chain",
198
+ [CHAIN_ID.plasma]: "Plasma",
199
+ [CHAIN_ID.soneium]: "Soneium Mainnet",
200
+ [CHAIN_ID.gnosis]: "Gnosis",
201
+ [CHAIN_ID.sonic]: "Sonic",
202
+ [CHAIN_ID.monad]: "Monad",
203
+ [CHAIN_ID.unichain]: "Unichain",
204
+ [CHAIN_ID.katana]: "Katana",
205
+ [HYPERCORE_CHAIN_ID]: "HyperCore"
206
+ };
207
+ function getChainId(chain) {
208
+ return typeof chain === "number" ? chain : chain.id;
209
+ }
210
+ function getSupportedChainIds() {
211
+ return [...SUPPORTED_CHAIN_IDS];
212
+ }
213
+ function isStablecoinSymbol(symbol) {
214
+ const normalized = symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
215
+ return /^(USDC|USDT|USDT0|DAI|USD)$/.test(normalized);
216
+ }
217
+ var CHAIN_BADGES = {
218
+ [CHAIN_ID.mainnet]: { shortLabel: "ETH", color: "#627EEA", bg: "#EEF2FF" },
219
+ [CHAIN_ID.base]: { shortLabel: "Base", color: "#0052FF", bg: "#E7F0FF" },
220
+ [CHAIN_ID.optimism]: { shortLabel: "OP", color: "#FF0420", bg: "#FFE9EC" },
221
+ [CHAIN_ID.arbitrum]: { shortLabel: "Arb", color: "#28A0F0", bg: "#E6F6FF" },
222
+ [CHAIN_ID.polygon]: { shortLabel: "Matic", color: "#8247E5", bg: "#EFE7FF" },
223
+ [CHAIN_ID.bsc]: { shortLabel: "BSC", color: "#F3BA2F", bg: "#FFF8E0" },
224
+ [CHAIN_ID.plasma]: { shortLabel: "Plasma", color: "#6C47FF", bg: "#EDE7FF" },
225
+ [CHAIN_ID.soneium]: { shortLabel: "Soneium", color: "#0D0D0D", bg: "#E8E8E8" },
226
+ [CHAIN_ID.sonic]: { shortLabel: "Sonic", color: "#5B6DEF", bg: "#EDEFFE" },
227
+ [CHAIN_ID.gnosis]: { shortLabel: "Gnosis", color: "#3E6957", bg: "#E5F0EB" },
228
+ [CHAIN_ID.hyperliquid]: { shortLabel: "Hyper", color: "#5BE7C4", bg: "#E5FFF8" },
229
+ [CHAIN_ID.monad]: { shortLabel: "Monad", color: "#6E54FF", bg: "#EEEBFF" },
230
+ [CHAIN_ID.unichain]: { shortLabel: "Uni", color: "#F50DB4", bg: "#FFE5F5" },
231
+ [CHAIN_ID.katana]: { shortLabel: "Katana", color: "#0441B2", bg: "#E5EEFC" },
232
+ [HYPERCORE_CHAIN_ID]: {
233
+ shortLabel: "HyperCore",
234
+ color: "#5BE7C4",
235
+ bg: "#E5FFF8"
236
+ }
237
+ };
238
+ function resolveDisplayChainId(chainId) {
239
+ return chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
240
+ }
241
+ var NON_EVM_CHAIN_FALLBACKS = {
242
+ solana: { name: "Solana", explorerUrl: "https://solscan.io" },
243
+ tron: { name: "Tron", explorerUrl: "https://tronscan.org" },
244
+ stellar: { name: "Stellar", explorerUrl: "https://stellar.expert" }
245
+ };
246
+ var SOLANA_BADGE = {
247
+ shortLabel: "SOL",
248
+ color: "#9945FF",
249
+ bg: "#F3EEFF"
250
+ };
251
+ var HYPERCORE_EXPLORER_URL = "https://app.hyperliquid.xyz/explorer";
252
+ function getChainName(chainId) {
253
+ const id = resolveDisplayChainId(chainId);
254
+ if (typeof id === "string") {
255
+ return _nullishCoalesce(getRuntimeChainName(id), () => ( NON_EVM_CHAIN_FALLBACKS[id].name));
256
+ }
257
+ const curated = CHAIN_NAMES[id];
258
+ if (curated) return curated;
259
+ const runtimeName = getRuntimeChainName(id);
260
+ if (runtimeName) return runtimeName;
261
+ return `Chain ${id}`;
262
+ }
263
+ function getChainBadge(chainId) {
264
+ const id = resolveDisplayChainId(chainId);
265
+ if (id === "solana") return SOLANA_BADGE;
266
+ if (typeof id === "string") {
267
+ const name2 = getChainName(id);
268
+ return { shortLabel: name2, ...badgeColorsFor(name2) };
269
+ }
270
+ const curated = CHAIN_BADGES[id];
271
+ if (curated) return curated;
272
+ const name = getRuntimeChainName(id);
273
+ if (!name) {
274
+ return { shortLabel: "Net", color: "#64748B", bg: "#F1F5F9" };
275
+ }
276
+ return { shortLabel: name, ...badgeColorsFor(name) };
277
+ }
278
+ function badgeColorsFor(name) {
279
+ let hash = 0;
280
+ for (let i = 0; i < name.length; i++) {
281
+ hash = hash * 31 + name.charCodeAt(i) | 0;
282
+ }
283
+ const hue = Math.abs(hash) % 360;
284
+ return { color: `hsl(${hue} 55% 38%)`, bg: `hsl(${hue} 70% 95%)` };
285
+ }
286
+ function getExplorerUrl(chainId) {
287
+ if (chainId === "hypercore") return HYPERCORE_EXPLORER_URL;
288
+ const id = resolveDisplayChainId(chainId);
289
+ const published = getRuntimeChainExplorerUrl(id);
290
+ if (published) return published;
291
+ return typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
292
+ }
293
+ function getExplorerTxUrl(chainId, txHash) {
294
+ if (chainId === "hypercore" && !txHash.startsWith("0x")) return void 0;
295
+ const url = getExplorerUrl(chainId);
296
+ if (!url) return void 0;
297
+ const path = getRuntimeChainExplorerTxPath(resolveDisplayChainId(chainId));
298
+ return `${url}${_nullishCoalesce(path, () => ( "/tx/"))}${txHash}`;
299
+ }
300
+ function getExplorerName(chainId) {
301
+ if (chainId === "hypercore") return "Hyperliquid Explorer";
302
+ const id = resolveDisplayChainId(chainId);
303
+ const derived = getRuntimeChainExplorerName(id);
304
+ if (derived) return derived;
305
+ const url = typeof id === "string" ? NON_EVM_CHAIN_FALLBACKS[id].explorerUrl : void 0;
306
+ return url && explorerNameFromUrl(url) || "Explorer";
307
+ }
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+ exports.SOLANA_MAINNET_CAIP2 = SOLANA_MAINNET_CAIP2; exports.toEvmCaip2 = toEvmCaip2; exports.targetChainToCaip2 = targetChainToCaip2; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.displayChainIdForCaip2 = displayChainIdForCaip2; exports.isHyperCoreCaip2 = isHyperCoreCaip2; exports.HYPERCORE_CHAIN_ID = HYPERCORE_CHAIN_ID; exports.HYPERCORE_SPOT_CAIP2 = HYPERCORE_SPOT_CAIP2; exports.TRON_MAINNET_CAIP2 = TRON_MAINNET_CAIP2; exports.STELLAR_PUBNET_CAIP2 = STELLAR_PUBNET_CAIP2; exports.isTargetChain = isTargetChain; exports.targetChainToChainId = targetChainToChainId; exports.isHyperCoreDestination = isHyperCoreDestination; exports.HYPERCORE_USDC_ADDRESS = HYPERCORE_USDC_ADDRESS; exports.HYPERCORE_USDT0_ADDRESS = HYPERCORE_USDT0_ADDRESS; exports.HYPERCORE_SOURCE_TOKENS = HYPERCORE_SOURCE_TOKENS; exports.HYPERCORE_MIN_DEPOSIT_USD = HYPERCORE_MIN_DEPOSIT_USD; exports.isVirtualDestination = isVirtualDestination; exports.setRuntimeChainMeta = setRuntimeChainMeta; exports.getRuntimeNativeSymbol = getRuntimeNativeSymbol; exports.getRuntimeNativeDecimals = getRuntimeNativeDecimals; exports.ICON_CDN = ICON_CDN; exports.cdnIconUrl = cdnIconUrl; exports.getChainIcon = getChainIcon; exports.NATIVE_TOKEN_ADDRESS = NATIVE_TOKEN_ADDRESS; exports.CHAIN_DISPLAY_ORDER = CHAIN_DISPLAY_ORDER; exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS; exports.getChainId = getChainId; exports.getSupportedChainIds = getSupportedChainIds; exports.isStablecoinSymbol = isStablecoinSymbol; exports.getChainName = getChainName; exports.getChainBadge = getChainBadge; exports.getExplorerUrl = getExplorerUrl; exports.getExplorerTxUrl = getExplorerTxUrl; exports.getExplorerName = getExplorerName;