@rhinestone/deposit-modal 0.9.1 → 0.11.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.
- package/dist/{DepositModalReown-JUJI7UHE.mjs → DepositModalReown-6RVLEM3B.mjs} +96 -26
- package/dist/{DepositModalReown-YQSO4SVY.cjs → DepositModalReown-TXTLVZIQ.cjs} +97 -27
- package/dist/caip-D8aRWdEY.d.cts +40 -0
- package/dist/caip-D8aRWdEY.d.ts +40 -0
- package/dist/{chunk-A223BLVC.mjs → chunk-53IFZGSF.mjs} +177 -21
- package/dist/{chunk-VQJHYWAE.cjs → chunk-7RNEYPI4.cjs} +836 -579
- package/dist/{chunk-ITFRTPGF.cjs → chunk-BLJMYCBF.cjs} +92 -90
- package/dist/{chunk-AYWEWI47.mjs → chunk-DYTRG4C7.mjs} +1 -1
- package/dist/{chunk-QGXAAFHU.mjs → chunk-G4FVZQOM.mjs} +23 -21
- package/dist/{chunk-SQOEHQNT.cjs → chunk-GWA6GFTI.cjs} +66 -63
- package/dist/{chunk-EEEQZOTJ.cjs → chunk-HCQWFL3A.cjs} +84 -101
- package/dist/{chunk-WUQZYQRK.mjs → chunk-ITAYM7SB.mjs} +784 -167
- package/dist/{chunk-YEBXUUH3.cjs → chunk-JPRV36DT.cjs} +2 -2
- package/dist/{chunk-EAUF7SGM.cjs → chunk-JYKMR6QI.cjs} +3 -3
- package/dist/{chunk-ILT2PITN.mjs → chunk-MZ53PDIX.mjs} +1 -1
- package/dist/{chunk-6U2H3R3T.cjs → chunk-NPSC5R22.cjs} +862 -245
- package/dist/{chunk-QLZ5RZTA.mjs → chunk-QRR3Y7EK.mjs} +1 -1
- package/dist/{chunk-H577RJN5.cjs → chunk-TENL4H64.cjs} +186 -30
- package/dist/{chunk-N3OHR3T2.mjs → chunk-TRD2FCAR.mjs} +363 -106
- package/dist/{chunk-7OQO6JDC.mjs → chunk-VRNRRN2U.mjs} +12 -9
- package/dist/{chunk-GYEUZSQP.mjs → chunk-WLDTBKRA.mjs} +14 -31
- package/dist/{chunk-XJE5MRY4.cjs → chunk-XVKBCDZI.cjs} +1 -1
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -2
- package/dist/claim.d.ts +3 -2
- package/dist/claim.mjs +5 -5
- package/dist/{caip-523Zrc3r.d.cts → constants-FuzG3h4m.d.cts} +1 -18
- package/dist/{caip-523Zrc3r.d.ts → constants-FuzG3h4m.d.ts} +1 -18
- package/dist/constants.cjs +5 -3
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +4 -2
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +3 -2
- package/dist/deposit.d.ts +3 -2
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +11 -9
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/styles.css +14 -0
- package/dist/{types-C0SGf-21.d.cts → types-C7wag_iL.d.cts} +4 -3
- package/dist/{types-C0SGf-21.d.ts → types-D4b6Cjox.d.ts} +4 -3
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +3 -2
- package/dist/withdraw.d.ts +3 -2
- package/dist/withdraw.mjs +5 -5
- package/package.json +1 -1
|
@@ -6,9 +6,13 @@ function toEvmCaip2(chainId) {
|
|
|
6
6
|
}
|
|
7
7
|
function targetChainToCaip2(targetChain) {
|
|
8
8
|
if (targetChain === "solana") return SOLANA_MAINNET_CAIP2;
|
|
9
|
-
if (targetChain
|
|
9
|
+
if (isHyperCoreDestination(targetChain)) return HYPERCORE_SPOT_CAIP2;
|
|
10
10
|
return toEvmCaip2(targetChain);
|
|
11
11
|
}
|
|
12
|
+
function targetChainToAccountKey(targetChain) {
|
|
13
|
+
if (isHyperCoreDestination(targetChain)) return HYPERCORE_MAINNET_CAIP2;
|
|
14
|
+
return targetChainToCaip2(targetChain);
|
|
15
|
+
}
|
|
12
16
|
function parseEvmChainId(value) {
|
|
13
17
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
14
18
|
return value;
|
|
@@ -27,6 +31,13 @@ function isHyperCoreCaip2(value) {
|
|
|
27
31
|
}
|
|
28
32
|
var HYPERCORE_CHAIN_ID = 1337;
|
|
29
33
|
var HYPERCORE_MAINNET_CAIP2 = "hypercore:mainnet";
|
|
34
|
+
var HYPERCORE_SPOT_CAIP2 = "hypercore:spot";
|
|
35
|
+
function targetChainToChainId(targetChain) {
|
|
36
|
+
return isHyperCoreDestination(targetChain) ? "hypercore" : targetChain;
|
|
37
|
+
}
|
|
38
|
+
function isHyperCoreDestination(targetChain) {
|
|
39
|
+
return targetChain === HYPERCORE_SPOT_CAIP2 || targetChain === HYPERCORE_CHAIN_ID;
|
|
40
|
+
}
|
|
30
41
|
var HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
31
42
|
var HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
32
43
|
var HYPERCORE_SOURCE_TOKENS = [
|
|
@@ -35,7 +46,7 @@ var HYPERCORE_SOURCE_TOKENS = [
|
|
|
35
46
|
];
|
|
36
47
|
var HYPERCORE_MIN_DEPOSIT_USD = 1;
|
|
37
48
|
function isVirtualDestination(targetChain) {
|
|
38
|
-
return targetChain === "solana" || targetChain
|
|
49
|
+
return targetChain === "solana" || isHyperCoreDestination(targetChain);
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
// src/core/solana-tokens.ts
|
|
@@ -81,6 +92,29 @@ function isNativeSol(token) {
|
|
|
81
92
|
|
|
82
93
|
|
|
83
94
|
var _chains = require('viem/chains');
|
|
95
|
+
|
|
96
|
+
// src/core/runtime-chain-meta.ts
|
|
97
|
+
var byChainId = /* @__PURE__ */ new Map();
|
|
98
|
+
function setRuntimeChainMeta(entries) {
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
byChainId.set(entry.chainId, {
|
|
101
|
+
name: entry.name,
|
|
102
|
+
iconUrl: entry.iconUrl,
|
|
103
|
+
nativeSymbol: entry.nativeSymbol
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function getRuntimeNativeSymbol(chainId) {
|
|
108
|
+
return _optionalChain([byChainId, 'access', _2 => _2.get, 'call', _3 => _3(chainId), 'optionalAccess', _4 => _4.nativeSymbol]);
|
|
109
|
+
}
|
|
110
|
+
function getRuntimeChainName(chainId) {
|
|
111
|
+
return _optionalChain([byChainId, 'access', _5 => _5.get, 'call', _6 => _6(chainId), 'optionalAccess', _7 => _7.name]);
|
|
112
|
+
}
|
|
113
|
+
function getRuntimeChainIconUrl(chainId) {
|
|
114
|
+
return _optionalChain([byChainId, 'access', _8 => _8.get, 'call', _9 => _9(chainId), 'optionalAccess', _10 => _10.iconUrl]);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/core/icons.ts
|
|
84
118
|
var ICON_CDN = "https://s3.rhinestone.dev";
|
|
85
119
|
var CHAIN_ICON_SLUGS = {
|
|
86
120
|
[_chains.mainnet.id]: "mainnet",
|
|
@@ -96,7 +130,13 @@ var CHAIN_ICON_SLUGS = {
|
|
|
96
130
|
[_chains.hyperliquid.id]: "hypeevm",
|
|
97
131
|
[_chains.monad.id]: "monad",
|
|
98
132
|
[_chains.unichain.id]: "unichain",
|
|
99
|
-
[_chains.katana.id]: "katana"
|
|
133
|
+
[_chains.katana.id]: "katana",
|
|
134
|
+
// Live deposit sources that predate this map being catalog-backed. Kept as
|
|
135
|
+
// plain ids rather than viem imports: this is the FALLBACK for chains the
|
|
136
|
+
// backend has not annotated with `iconUrl` yet, so it should not grow a
|
|
137
|
+
// build-time dependency on a chain definition to name a file.
|
|
138
|
+
43114: "avalanche",
|
|
139
|
+
4663: "robinhood"
|
|
100
140
|
};
|
|
101
141
|
function cdnIconUrl(dir, slug) {
|
|
102
142
|
return `${ICON_CDN}/${dir}/${slug}.svg`;
|
|
@@ -113,12 +153,18 @@ function getChainIcon(chainId) {
|
|
|
113
153
|
if (chainId === "hypercore" || chainId === HYPERCORE_CHAIN_ID) {
|
|
114
154
|
return CHAIN_ICONS[_chains.hyperliquid.id];
|
|
115
155
|
}
|
|
116
|
-
return CHAIN_ICONS[chainId];
|
|
156
|
+
return _nullishCoalesce(CHAIN_ICONS[chainId], () => ( getRuntimeChainIconUrl(chainId)));
|
|
117
157
|
}
|
|
118
158
|
var ICON_SLUG_ALIASES = {
|
|
119
159
|
"usdc.e": "usdc",
|
|
120
160
|
wsol: "sol",
|
|
121
|
-
xdai: "dai"
|
|
161
|
+
xdai: "dai",
|
|
162
|
+
// A wrapped token is the same asset and the CDN hosts only the underlying
|
|
163
|
+
// mark, so these fall back to it rather than to a text badge. `weth` is the
|
|
164
|
+
// one the deposit flow offers on nearly every chain, and it has been showing
|
|
165
|
+
// as text since the icons moved to the CDN.
|
|
166
|
+
weth: "eth",
|
|
167
|
+
wavax: "avax"
|
|
122
168
|
};
|
|
123
169
|
function tokenIconUrl(symbol) {
|
|
124
170
|
const key = symbol.toLowerCase().replace(/₮/g, "t");
|
|
@@ -146,6 +192,70 @@ function getTokenIcon(symbol) {
|
|
|
146
192
|
|
|
147
193
|
|
|
148
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
|
+
return `${chainId}:${address.toLowerCase()}`;
|
|
205
|
+
}
|
|
206
|
+
function setRuntimeTokens(tokens) {
|
|
207
|
+
for (const token of tokens) {
|
|
208
|
+
const sKey = symbolKey(token.chainId, token.symbol);
|
|
209
|
+
if (!bySymbol.has(sKey)) {
|
|
210
|
+
bySymbol.set(sKey, token);
|
|
211
|
+
const list = symbolsByChain.get(token.chainId);
|
|
212
|
+
if (list) list.push(token.symbol);
|
|
213
|
+
else symbolsByChain.set(token.chainId, [token.symbol]);
|
|
214
|
+
}
|
|
215
|
+
byAddress.set(addressKey(token.chainId, token.address), token);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function publishShortlistTokens(shortlist) {
|
|
219
|
+
const tokens = [];
|
|
220
|
+
for (const [chainKey, entries] of Object.entries(shortlist)) {
|
|
221
|
+
const chainId = Number(chainKey);
|
|
222
|
+
if (!Number.isInteger(chainId)) continue;
|
|
223
|
+
for (const entry of entries) {
|
|
224
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(entry.address)) continue;
|
|
225
|
+
tokens.push({
|
|
226
|
+
chainId,
|
|
227
|
+
symbol: entry.symbol,
|
|
228
|
+
address: entry.address,
|
|
229
|
+
decimals: entry.decimals
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
setRuntimeTokens(tokens);
|
|
234
|
+
}
|
|
235
|
+
function getRuntimeToken(chainId, symbol) {
|
|
236
|
+
return bySymbol.get(symbolKey(chainId, symbol));
|
|
237
|
+
}
|
|
238
|
+
function getRuntimeTokenByAddress(chainId, address) {
|
|
239
|
+
return byAddress.get(addressKey(chainId, address));
|
|
240
|
+
}
|
|
241
|
+
function getRuntimeTokenSymbols(chainId) {
|
|
242
|
+
return _nullishCoalesce(symbolsByChain.get(chainId), () => ( []));
|
|
243
|
+
}
|
|
244
|
+
function findRuntimeDecimalsByAddress(address) {
|
|
245
|
+
return _optionalChain([findByAddress, 'call', _11 => _11(address), 'optionalAccess', _12 => _12.decimals]);
|
|
246
|
+
}
|
|
247
|
+
function findRuntimeSymbolByAddress(address) {
|
|
248
|
+
return _optionalChain([findByAddress, 'call', _13 => _13(address), 'optionalAccess', _14 => _14.symbol]);
|
|
249
|
+
}
|
|
250
|
+
function findByAddress(address) {
|
|
251
|
+
const suffix = `:${address.toLowerCase()}`;
|
|
252
|
+
for (const [key, token] of byAddress) {
|
|
253
|
+
if (key.endsWith(suffix)) return token;
|
|
254
|
+
}
|
|
255
|
+
return void 0;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// src/core/constants.ts
|
|
149
259
|
var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
150
260
|
var ALL_CHAINS_BY_ID = {
|
|
151
261
|
[_chains.mainnet.id]: _chains.mainnet,
|
|
@@ -514,19 +624,20 @@ function getChainObject(chain) {
|
|
|
514
624
|
function normalizeTokenSymbol(symbol) {
|
|
515
625
|
const trimmed = symbol.trim();
|
|
516
626
|
const wrapped = trimmed.match(/\(([^)]+)\)/);
|
|
517
|
-
if (_optionalChain([wrapped, 'optionalAccess',
|
|
627
|
+
if (_optionalChain([wrapped, 'optionalAccess', _15 => _15[1]])) {
|
|
518
628
|
return wrapped[1].trim().toUpperCase();
|
|
519
629
|
}
|
|
520
630
|
return trimmed.toUpperCase();
|
|
521
631
|
}
|
|
522
632
|
function isSymbolSupportedOnChain(symbol, chainId) {
|
|
633
|
+
const normalized = normalizeTokenSymbol(symbol);
|
|
523
634
|
const symbols = SUPPORTED_TOKENS_BY_CHAIN[chainId];
|
|
524
|
-
if (
|
|
525
|
-
return
|
|
635
|
+
if (_optionalChain([symbols, 'optionalAccess', _16 => _16.includes, 'call', _17 => _17(normalized)])) return true;
|
|
636
|
+
return getRuntimeToken(chainId, normalized) !== void 0;
|
|
526
637
|
}
|
|
527
638
|
function getTokenFromRegistry(chainId, symbol) {
|
|
528
639
|
const chainEntry = chainRegistry[String(chainId)];
|
|
529
|
-
if (!chainEntry) return
|
|
640
|
+
if (!chainEntry) return runtimeToken(chainId, normalizeTokenSymbol(symbol));
|
|
530
641
|
const normalized = normalizeTokenSymbol(symbol);
|
|
531
642
|
const token = chainEntry.tokens.find(
|
|
532
643
|
(t) => t.symbol.toUpperCase() === normalized
|
|
@@ -534,15 +645,19 @@ function getTokenFromRegistry(chainId, symbol) {
|
|
|
534
645
|
if (token) {
|
|
535
646
|
return { address: token.address, decimals: token.decimals };
|
|
536
647
|
}
|
|
537
|
-
return
|
|
648
|
+
return runtimeToken(chainId, normalized);
|
|
649
|
+
}
|
|
650
|
+
function runtimeToken(chainId, symbol) {
|
|
651
|
+
const token = getRuntimeToken(chainId, symbol);
|
|
652
|
+
return token ? { address: token.address, decimals: token.decimals } : void 0;
|
|
538
653
|
}
|
|
539
654
|
function getUsdcAddress(chainId) {
|
|
540
655
|
const token = getTokenFromRegistry(chainId, "USDC");
|
|
541
|
-
return _optionalChain([token, 'optionalAccess',
|
|
656
|
+
return _optionalChain([token, 'optionalAccess', _18 => _18.address]);
|
|
542
657
|
}
|
|
543
658
|
function getUsdcDecimals(chainId) {
|
|
544
659
|
const token = getTokenFromRegistry(chainId, "USDC");
|
|
545
|
-
return _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
660
|
+
return _nullishCoalesce(_optionalChain([token, 'optionalAccess', _19 => _19.decimals]), () => ( 6));
|
|
546
661
|
}
|
|
547
662
|
function getTokenAddress(symbol, chainId) {
|
|
548
663
|
if (symbol.toUpperCase() === "ETH") {
|
|
@@ -555,18 +670,19 @@ function getTokenAddress(symbol, chainId) {
|
|
|
555
670
|
return void 0;
|
|
556
671
|
}
|
|
557
672
|
const token = getTokenFromRegistry(chainId, symbol);
|
|
558
|
-
return _optionalChain([token, 'optionalAccess',
|
|
673
|
+
return _optionalChain([token, 'optionalAccess', _20 => _20.address]);
|
|
559
674
|
}
|
|
560
675
|
function getTokenDecimals(symbol, chainId) {
|
|
561
676
|
if (symbol.toUpperCase() === "ETH") {
|
|
562
677
|
return 18;
|
|
563
678
|
}
|
|
564
679
|
const token = getTokenFromRegistry(chainId, symbol);
|
|
565
|
-
return _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
680
|
+
return _nullishCoalesce(_optionalChain([token, 'optionalAccess', _21 => _21.decimals]), () => ( 18));
|
|
566
681
|
}
|
|
567
682
|
function getTargetTokenSymbolsForChain(chainId) {
|
|
568
|
-
const symbols =
|
|
569
|
-
return [...symbols];
|
|
683
|
+
const symbols = SUPPORTED_TOKENS_BY_CHAIN[chainId];
|
|
684
|
+
if (_optionalChain([symbols, 'optionalAccess', _22 => _22.length])) return [...symbols];
|
|
685
|
+
return getRuntimeTokenSymbols(chainId);
|
|
570
686
|
}
|
|
571
687
|
function getSupportedTokenSymbolsForChain(chainId) {
|
|
572
688
|
return getTargetTokenSymbolsForChain(chainId);
|
|
@@ -587,7 +703,13 @@ function isSupportedTokenAddressForChain(token, chainId) {
|
|
|
587
703
|
return expected.address.toLowerCase() === normalized;
|
|
588
704
|
}
|
|
589
705
|
function getSupportedTargetTokens(chainId) {
|
|
590
|
-
|
|
706
|
+
return toTokenOptions(getSupportedTokenSymbolsForChain(chainId), chainId);
|
|
707
|
+
}
|
|
708
|
+
function getBundledTargetTokens(chainId) {
|
|
709
|
+
const symbols = SUPPORTED_TOKENS_BY_CHAIN[chainId];
|
|
710
|
+
return _optionalChain([symbols, 'optionalAccess', _23 => _23.length]) ? toTokenOptions([...symbols], chainId) : [];
|
|
711
|
+
}
|
|
712
|
+
function toTokenOptions(symbols, chainId) {
|
|
591
713
|
const options = [];
|
|
592
714
|
for (const symbol of symbols) {
|
|
593
715
|
const address = getTokenAddress(symbol, chainId);
|
|
@@ -620,7 +742,11 @@ function findTokenDecimals(token, chainId) {
|
|
|
620
742
|
);
|
|
621
743
|
if (found) return found.decimals;
|
|
622
744
|
}
|
|
623
|
-
|
|
745
|
+
if (chainId) {
|
|
746
|
+
const onChain = getRuntimeTokenByAddress(chainId, normalized);
|
|
747
|
+
if (onChain) return onChain.decimals;
|
|
748
|
+
}
|
|
749
|
+
return findRuntimeDecimalsByAddress(normalized);
|
|
624
750
|
}
|
|
625
751
|
function getTokenDecimalsByAddress(token, chainId) {
|
|
626
752
|
return _nullishCoalesce(findTokenDecimals(token, chainId), () => ( 18));
|
|
@@ -652,7 +778,10 @@ var NATIVE_SYMBOL_BY_CHAIN = {
|
|
|
652
778
|
[_chains.hyperliquid.id]: "HYPE"
|
|
653
779
|
};
|
|
654
780
|
function getNativeSymbol(chainId) {
|
|
655
|
-
|
|
781
|
+
if (chainId == null) return "ETH";
|
|
782
|
+
const bundled = NATIVE_SYMBOL_BY_CHAIN[chainId];
|
|
783
|
+
if (bundled) return bundled;
|
|
784
|
+
return _nullishCoalesce(getRuntimeNativeSymbol(chainId), () => ( "ETH"));
|
|
656
785
|
}
|
|
657
786
|
function getTokenSymbol(token, chainId) {
|
|
658
787
|
const normalized = token.toLowerCase();
|
|
@@ -674,13 +803,17 @@ function getTokenSymbol(token, chainId) {
|
|
|
674
803
|
);
|
|
675
804
|
if (found) return found.symbol;
|
|
676
805
|
}
|
|
677
|
-
|
|
806
|
+
if (chainId) {
|
|
807
|
+
const onChain = getRuntimeTokenByAddress(chainId, normalized);
|
|
808
|
+
if (onChain) return onChain.symbol;
|
|
809
|
+
}
|
|
810
|
+
return _nullishCoalesce(findRuntimeSymbolByAddress(normalized), () => ( "Token"));
|
|
678
811
|
}
|
|
679
812
|
function getTargetTokenSymbol(token, chain) {
|
|
680
813
|
if (chain === "solana") {
|
|
681
|
-
return _nullishCoalesce(_optionalChain([getSolanaTokenByMint, 'call',
|
|
814
|
+
return _nullishCoalesce(_optionalChain([getSolanaTokenByMint, 'call', _24 => _24(String(token)), 'optionalAccess', _25 => _25.symbol]), () => ( "Token"));
|
|
682
815
|
}
|
|
683
|
-
return getTokenSymbol(token, chain);
|
|
816
|
+
return getTokenSymbol(token, resolveDisplayChainId(chain));
|
|
684
817
|
}
|
|
685
818
|
function isStablecoinSymbol(symbol) {
|
|
686
819
|
return /^(usdc|usdt|usdt0|dai|usd)$/i.test(symbol);
|
|
@@ -717,22 +850,35 @@ function getChainName(chainId) {
|
|
|
717
850
|
if (chain) return chain.name;
|
|
718
851
|
const chainEntry = chainRegistry[String(id)];
|
|
719
852
|
if (chainEntry) return chainEntry.name;
|
|
853
|
+
const runtimeName = getRuntimeChainName(id);
|
|
854
|
+
if (runtimeName) return runtimeName;
|
|
720
855
|
return `Chain ${id}`;
|
|
721
856
|
}
|
|
722
857
|
function getChainBadge(chainId) {
|
|
723
858
|
if (chainId === "solana") {
|
|
724
859
|
return { shortLabel: "SOL", color: "#9945FF", bg: "#F3EEFF" };
|
|
725
860
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
861
|
+
const id = resolveDisplayChainId(chainId);
|
|
862
|
+
const curated = CHAIN_BADGES[id];
|
|
863
|
+
if (curated) return curated;
|
|
864
|
+
const name = getRuntimeChainName(id);
|
|
865
|
+
if (!name) {
|
|
866
|
+
return { shortLabel: "Net", color: "#64748B", bg: "#F1F5F9" };
|
|
867
|
+
}
|
|
868
|
+
return { shortLabel: name, ...badgeColorsFor(name) };
|
|
869
|
+
}
|
|
870
|
+
function badgeColorsFor(name) {
|
|
871
|
+
let hash = 0;
|
|
872
|
+
for (let i = 0; i < name.length; i++) {
|
|
873
|
+
hash = hash * 31 + name.charCodeAt(i) | 0;
|
|
874
|
+
}
|
|
875
|
+
const hue = Math.abs(hash) % 360;
|
|
876
|
+
return { color: `hsl(${hue} 55% 38%)`, bg: `hsl(${hue} 70% 95%)` };
|
|
731
877
|
}
|
|
732
878
|
function getExplorerUrl(chainId) {
|
|
733
879
|
if (chainId === "solana") return "https://solscan.io";
|
|
734
880
|
if (chainId === "hypercore") return HYPERCORE_EXPLORER_URL;
|
|
735
|
-
return _optionalChain([CHAIN_BY_ID, 'access',
|
|
881
|
+
return _optionalChain([CHAIN_BY_ID, 'access', _26 => _26[chainId], 'optionalAccess', _27 => _27.blockExplorers, 'optionalAccess', _28 => _28.default, 'optionalAccess', _29 => _29.url]);
|
|
736
882
|
}
|
|
737
883
|
function getExplorerTxUrl(chainId, txHash) {
|
|
738
884
|
if (chainId === "solana") return `https://solscan.io/tx/${txHash}`;
|
|
@@ -744,7 +890,7 @@ function getExplorerTxUrl(chainId, txHash) {
|
|
|
744
890
|
function getExplorerName(chainId) {
|
|
745
891
|
if (chainId === "solana") return "Solscan";
|
|
746
892
|
if (chainId === "hypercore") return "Hyperliquid Explorer";
|
|
747
|
-
return _nullishCoalesce(_optionalChain([CHAIN_BY_ID, 'access',
|
|
893
|
+
return _nullishCoalesce(_optionalChain([CHAIN_BY_ID, 'access', _30 => _30[chainId], 'optionalAccess', _31 => _31.blockExplorers, 'optionalAccess', _32 => _32.default, 'optionalAccess', _33 => _33.name]), () => ( "Explorer"));
|
|
748
894
|
}
|
|
749
895
|
|
|
750
896
|
|
|
@@ -798,4 +944,14 @@ function getExplorerName(chainId) {
|
|
|
798
944
|
|
|
799
945
|
|
|
800
946
|
|
|
801
|
-
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
exports.SOLANA_MAINNET_CAIP2 = SOLANA_MAINNET_CAIP2; exports.toEvmCaip2 = toEvmCaip2; exports.targetChainToCaip2 = targetChainToCaip2; exports.targetChainToAccountKey = targetChainToAccountKey; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.isHyperCoreCaip2 = isHyperCoreCaip2; exports.HYPERCORE_CHAIN_ID = HYPERCORE_CHAIN_ID; exports.HYPERCORE_MAINNET_CAIP2 = HYPERCORE_MAINNET_CAIP2; exports.HYPERCORE_SPOT_CAIP2 = HYPERCORE_SPOT_CAIP2; 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.SOLANA_TOKENS = SOLANA_TOKENS; exports.getSolanaTokenBySymbol = getSolanaTokenBySymbol; exports.getSolanaTokenByMint = getSolanaTokenByMint; exports.isNativeSol = isNativeSol; exports.setRuntimeChainMeta = setRuntimeChainMeta; exports.setRuntimeTokens = setRuntimeTokens; exports.publishShortlistTokens = publishShortlistTokens; exports.ICON_CDN = ICON_CDN; exports.cdnIconUrl = cdnIconUrl; exports.getChainIcon = getChainIcon; exports.tokenIconUrl = tokenIconUrl; exports.getTokenIcon = getTokenIcon; exports.NATIVE_TOKEN_ADDRESS = NATIVE_TOKEN_ADDRESS; exports.CHAIN_DISPLAY_ORDER = CHAIN_DISPLAY_ORDER; exports.CHAIN_BY_ID = CHAIN_BY_ID; exports.SOURCE_CHAINS = SOURCE_CHAINS; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.chainRegistry = chainRegistry; exports.getChainId = getChainId; exports.getChainObject = getChainObject; exports.getUsdcAddress = getUsdcAddress; exports.getUsdcDecimals = getUsdcDecimals; exports.getTokenAddress = getTokenAddress; exports.getTokenDecimals = getTokenDecimals; exports.getTargetTokenSymbolsForChain = getTargetTokenSymbolsForChain; exports.getSupportedTokenSymbolsForChain = getSupportedTokenSymbolsForChain; exports.getSupportedChainIds = getSupportedChainIds; exports.isSupportedTokenAddressForChain = isSupportedTokenAddressForChain; exports.getSupportedTargetTokens = getSupportedTargetTokens; exports.getBundledTargetTokens = getBundledTargetTokens; exports.findTokenDecimals = findTokenDecimals; exports.getTokenDecimalsByAddress = getTokenDecimalsByAddress; exports.findChainIdForToken = findChainIdForToken; exports.isRegistryTokenOnChain = isRegistryTokenOnChain; exports.getNativeSymbol = getNativeSymbol; exports.getTokenSymbol = getTokenSymbol; exports.getTargetTokenSymbol = getTargetTokenSymbol; exports.isStablecoinSymbol = isStablecoinSymbol; exports.getChainName = getChainName; exports.getChainBadge = getChainBadge; exports.getExplorerUrl = getExplorerUrl; exports.getExplorerTxUrl = getExplorerTxUrl; exports.getExplorerName = getExplorerName;
|