@rhinestone/deposit-modal 0.14.0 → 0.15.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/README.md +12 -12
- package/bridge-transcript.json +14 -0
- package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
- package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
- package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-KOJ7VEY7.mjs} +30 -29
- package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-R37SSHUF.cjs} +79 -78
- package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
- package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-V2OBGLJD.cjs → chunk-3OOY67VJ.cjs} +1103 -253
- package/dist/{chunk-6KG642KH.cjs → chunk-5P2PVLS4.cjs} +1 -1
- package/dist/{chunk-IN77XSWO.mjs → chunk-5VONFVQN.mjs} +976 -126
- package/dist/chunk-6HUHVXCY.cjs +704 -0
- package/dist/{chunk-PKML3XVS.mjs → chunk-7UQ6OUEE.mjs} +166 -45
- package/dist/{chunk-K4H6TGBE.mjs → chunk-CXBMIZUF.mjs} +1 -1
- package/dist/{chunk-MTFJSE52.cjs → chunk-DTVZUBHI.cjs} +236 -115
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/{chunk-KTUVSKR4.mjs → chunk-IKUYZA7A.mjs} +265 -523
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/chunk-QJ7RCCU7.mjs +704 -0
- package/dist/chunk-UCBUCX2W.mjs +3169 -0
- package/dist/{chunk-YCQZJQO6.cjs → chunk-VPDCGD2D.cjs} +622 -880
- package/dist/{chunk-7ICSHJFE.cjs → chunk-X4D52IZK.cjs} +1501 -176
- package/dist/claim.cjs +5 -7
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +4 -6
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +7 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +6 -7
- package/dist/embed.cjs +135 -44
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.mjs +116 -25
- package/dist/index.cjs +13 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +12 -10
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/styles.css +132 -100
- package/dist/{types-Bho4OA03.d.ts → types-CQ0NHqCy.d.ts} +146 -11
- package/dist/{types-DP_3KwlD.d.cts → types-CxiLX5sv.d.cts} +146 -11
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +5 -5
- package/package.json +7 -6
- package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
- package/dist/ClaimModal-SEKNWRMA.mjs +0 -13
- package/dist/WithdrawModal-5ICGD4HJ.mjs +0 -12
- package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
- package/dist/chunk-7SR7ENVJ.mjs +0 -1844
- package/dist/chunk-CFKC77SV.mjs +0 -1062
- package/dist/chunk-LZFRL2AL.cjs +0 -81
- package/dist/chunk-WUJIKCFU.mjs +0 -81
- package/dist/chunk-X2IPAPXU.cjs +0 -163
- package/dist/chunk-YWMWI7PZ.cjs +0 -1062
- package/dist/chunk-ZEO6ADM3.mjs +0 -163
|
@@ -7,6 +7,7 @@ function toEvmCaip2(chainId) {
|
|
|
7
7
|
function targetChainToCaip2(targetChain) {
|
|
8
8
|
if (targetChain === "solana") return SOLANA_MAINNET_CAIP2;
|
|
9
9
|
if (isHyperCoreDestination(targetChain)) return HYPERCORE_SPOT_CAIP2;
|
|
10
|
+
if (typeof targetChain === "string") return targetChain;
|
|
10
11
|
return toEvmCaip2(targetChain);
|
|
11
12
|
}
|
|
12
13
|
function parseEvmChainId(value) {
|
|
@@ -22,13 +23,31 @@ function parseEvmChainId(value) {
|
|
|
22
23
|
function isSolanaCaip2(value) {
|
|
23
24
|
return typeof value === "string" && value.startsWith("solana:");
|
|
24
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
|
+
}
|
|
25
35
|
function isHyperCoreCaip2(value) {
|
|
26
36
|
return typeof value === "string" && value.startsWith("hypercore:");
|
|
27
37
|
}
|
|
28
38
|
var HYPERCORE_CHAIN_ID = 1337;
|
|
29
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
|
+
}
|
|
30
46
|
function targetChainToChainId(targetChain) {
|
|
31
|
-
|
|
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;
|
|
32
51
|
}
|
|
33
52
|
function isHyperCoreDestination(targetChain) {
|
|
34
53
|
return targetChain === HYPERCORE_SPOT_CAIP2 || targetChain === HYPERCORE_CHAIN_ID;
|
|
@@ -41,7 +60,7 @@ var HYPERCORE_SOURCE_TOKENS = [
|
|
|
41
60
|
];
|
|
42
61
|
var HYPERCORE_MIN_DEPOSIT_USD = 1;
|
|
43
62
|
function isVirtualDestination(targetChain) {
|
|
44
|
-
return targetChain
|
|
63
|
+
return typeof targetChain !== "number" || isHyperCoreDestination(targetChain);
|
|
45
64
|
}
|
|
46
65
|
|
|
47
66
|
// src/core/solana-tokens.ts
|
|
@@ -78,7 +97,9 @@ function setRuntimeChainMeta(entries) {
|
|
|
78
97
|
name: entry.name,
|
|
79
98
|
iconUrl: entry.iconUrl,
|
|
80
99
|
nativeSymbol: entry.nativeSymbol,
|
|
81
|
-
explorerUrl: entry.explorerUrl
|
|
100
|
+
explorerUrl: entry.explorerUrl,
|
|
101
|
+
explorerTxPath: entry.explorerTxPath,
|
|
102
|
+
explorerAddressPath: entry.explorerAddressPath
|
|
82
103
|
});
|
|
83
104
|
}
|
|
84
105
|
}
|
|
@@ -94,9 +115,14 @@ function getRuntimeChainIconUrl(chainId) {
|
|
|
94
115
|
function getRuntimeChainExplorerUrl(chainId) {
|
|
95
116
|
return byChainId.get(chainId)?.explorerUrl;
|
|
96
117
|
}
|
|
118
|
+
function getRuntimeChainExplorerTxPath(chainId) {
|
|
119
|
+
return byChainId.get(chainId)?.explorerTxPath;
|
|
120
|
+
}
|
|
97
121
|
function getRuntimeChainExplorerName(chainId) {
|
|
98
122
|
const url = byChainId.get(chainId)?.explorerUrl;
|
|
99
|
-
|
|
123
|
+
return url ? explorerNameFromUrl(url) : void 0;
|
|
124
|
+
}
|
|
125
|
+
function explorerNameFromUrl(url) {
|
|
100
126
|
let host;
|
|
101
127
|
try {
|
|
102
128
|
host = new URL(url).hostname;
|
|
@@ -144,6 +170,7 @@ function getChainIcon(chainId) {
|
|
|
144
170
|
if (chainId === "hypercore" || chainId === HYPERCORE_CHAIN_ID) {
|
|
145
171
|
return CHAIN_ICONS[HYPEREVM_CHAIN_ID];
|
|
146
172
|
}
|
|
173
|
+
if (typeof chainId === "string") return getRuntimeChainIconUrl(chainId);
|
|
147
174
|
return CHAIN_ICONS[chainId] ?? getRuntimeChainIconUrl(chainId);
|
|
148
175
|
}
|
|
149
176
|
var ICON_SLUG_ALIASES = {
|
|
@@ -174,7 +201,8 @@ function symbolKey(chainId, symbol) {
|
|
|
174
201
|
return `${chainId}:${symbol.trim().toUpperCase()}`;
|
|
175
202
|
}
|
|
176
203
|
function addressKey(chainId, address) {
|
|
177
|
-
|
|
204
|
+
const key = address.startsWith("0x") ? address.toLowerCase() : address;
|
|
205
|
+
return `${chainId}:${key}`;
|
|
178
206
|
}
|
|
179
207
|
function setRuntimeTokens(tokens) {
|
|
180
208
|
for (const token of tokens) {
|
|
@@ -609,7 +637,8 @@ function getTokenFromRegistry(chainId, symbol) {
|
|
|
609
637
|
}
|
|
610
638
|
function runtimeToken(chainId, symbol) {
|
|
611
639
|
const token = getRuntimeToken(chainId, symbol);
|
|
612
|
-
|
|
640
|
+
if (!token || !token.address.startsWith("0x")) return void 0;
|
|
641
|
+
return { address: token.address, decimals: token.decimals };
|
|
613
642
|
}
|
|
614
643
|
function getUsdcAddress(chainId) {
|
|
615
644
|
const token = getTokenFromRegistry(chainId, "USDC");
|
|
@@ -769,7 +798,11 @@ function getTargetTokenSymbol(token, chain) {
|
|
|
769
798
|
if (chain === "solana") {
|
|
770
799
|
return getSolanaTokenByMint(String(token))?.symbol ?? "Token";
|
|
771
800
|
}
|
|
772
|
-
|
|
801
|
+
const id = resolveDisplayChainId(chain);
|
|
802
|
+
if (typeof id === "string") {
|
|
803
|
+
return getRuntimeTokenByAddress(id, String(token))?.symbol ?? "Token";
|
|
804
|
+
}
|
|
805
|
+
return getTokenSymbol(token, id);
|
|
773
806
|
}
|
|
774
807
|
function isStablecoinSymbol(symbol) {
|
|
775
808
|
return /^(usdc|usdt|usdt0|dai|usd)$/i.test(symbol);
|
|
@@ -798,10 +831,22 @@ var CHAIN_BADGES = {
|
|
|
798
831
|
function resolveDisplayChainId(chainId) {
|
|
799
832
|
return chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
|
|
800
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
|
+
};
|
|
801
844
|
var HYPERCORE_EXPLORER_URL = "https://app.hyperliquid.xyz/explorer";
|
|
802
845
|
function getChainName(chainId) {
|
|
803
|
-
if (chainId === "solana") return "Solana";
|
|
804
846
|
const id = resolveDisplayChainId(chainId);
|
|
847
|
+
if (typeof id === "string") {
|
|
848
|
+
return getRuntimeChainName(id) ?? NON_EVM_CHAIN_FALLBACKS[id].name;
|
|
849
|
+
}
|
|
805
850
|
const chainEntry = chainRegistry[String(id)];
|
|
806
851
|
if (chainEntry) return chainEntry.name;
|
|
807
852
|
const runtimeName = getRuntimeChainName(id);
|
|
@@ -809,10 +854,12 @@ function getChainName(chainId) {
|
|
|
809
854
|
return `Chain ${id}`;
|
|
810
855
|
}
|
|
811
856
|
function getChainBadge(chainId) {
|
|
812
|
-
if (chainId === "solana") {
|
|
813
|
-
return { shortLabel: "SOL", color: "#9945FF", bg: "#F3EEFF" };
|
|
814
|
-
}
|
|
815
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
|
+
}
|
|
816
863
|
const curated = CHAIN_BADGES[id];
|
|
817
864
|
if (curated) return curated;
|
|
818
865
|
const name = getRuntimeChainName(id);
|
|
@@ -830,21 +877,26 @@ function badgeColorsFor(name) {
|
|
|
830
877
|
return { color: `hsl(${hue} 55% 38%)`, bg: `hsl(${hue} 70% 95%)` };
|
|
831
878
|
}
|
|
832
879
|
function getExplorerUrl(chainId) {
|
|
833
|
-
if (chainId === "solana") return "https://solscan.io";
|
|
834
880
|
if (chainId === "hypercore") return HYPERCORE_EXPLORER_URL;
|
|
835
|
-
|
|
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;
|
|
836
885
|
}
|
|
837
886
|
function getExplorerTxUrl(chainId, txHash) {
|
|
838
|
-
if (chainId === "solana") return `https://solscan.io/tx/${txHash}`;
|
|
839
887
|
if (chainId === "hypercore" && !txHash.startsWith("0x")) return void 0;
|
|
840
888
|
const url = getExplorerUrl(chainId);
|
|
841
889
|
if (!url) return void 0;
|
|
842
|
-
|
|
890
|
+
const path = getRuntimeChainExplorerTxPath(resolveDisplayChainId(chainId));
|
|
891
|
+
return `${url}${path ?? "/tx/"}${txHash}`;
|
|
843
892
|
}
|
|
844
893
|
function getExplorerName(chainId) {
|
|
845
|
-
if (chainId === "solana") return "Solscan";
|
|
846
894
|
if (chainId === "hypercore") return "Hyperliquid Explorer";
|
|
847
|
-
|
|
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";
|
|
848
900
|
}
|
|
849
901
|
|
|
850
902
|
export {
|
|
@@ -853,9 +905,13 @@ export {
|
|
|
853
905
|
targetChainToCaip2,
|
|
854
906
|
parseEvmChainId,
|
|
855
907
|
isSolanaCaip2,
|
|
908
|
+
displayChainIdForCaip2,
|
|
856
909
|
isHyperCoreCaip2,
|
|
857
910
|
HYPERCORE_CHAIN_ID,
|
|
858
911
|
HYPERCORE_SPOT_CAIP2,
|
|
912
|
+
TRON_MAINNET_CAIP2,
|
|
913
|
+
STELLAR_PUBNET_CAIP2,
|
|
914
|
+
isTargetChain,
|
|
859
915
|
targetChainToChainId,
|
|
860
916
|
isHyperCoreDestination,
|
|
861
917
|
HYPERCORE_USDC_ADDRESS,
|
|
@@ -870,6 +926,7 @@ export {
|
|
|
870
926
|
setRuntimeChainMeta,
|
|
871
927
|
setRuntimeTokens,
|
|
872
928
|
publishShortlistTokens,
|
|
929
|
+
getRuntimeTokenByAddress,
|
|
873
930
|
ICON_CDN,
|
|
874
931
|
cdnIconUrl,
|
|
875
932
|
getChainIcon,
|