@rhinestone/deposit-modal 0.14.1 → 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.
Files changed (68) hide show
  1. package/README.md +6 -0
  2. package/bridge-transcript.json +14 -0
  3. package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
  4. package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
  5. package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-KOJ7VEY7.mjs} +6 -7
  6. package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-R37SSHUF.cjs} +21 -22
  7. package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
  8. package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
  9. package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
  10. package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
  11. package/dist/{chunk-HAQOFI3D.cjs → chunk-3OOY67VJ.cjs} +1046 -226
  12. package/dist/{chunk-AQVJUXSG.cjs → chunk-5P2PVLS4.cjs} +1 -1
  13. package/dist/{chunk-UX35GYLM.mjs → chunk-5VONFVQN.mjs} +918 -98
  14. package/dist/chunk-6HUHVXCY.cjs +704 -0
  15. package/dist/{chunk-GZ4GQ5MC.mjs → chunk-7UQ6OUEE.mjs} +166 -45
  16. package/dist/{chunk-LMG46EP2.mjs → chunk-CXBMIZUF.mjs} +1 -1
  17. package/dist/{chunk-A6JPBMYY.cjs → chunk-DTVZUBHI.cjs} +236 -115
  18. package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
  19. package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
  20. package/dist/{chunk-5Q5CSVKF.mjs → chunk-IKUYZA7A.mjs} +195 -495
  21. package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
  22. package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
  23. package/dist/chunk-QJ7RCCU7.mjs +704 -0
  24. package/dist/{chunk-XCTRKCNM.mjs → chunk-UCBUCX2W.mjs} +1515 -194
  25. package/dist/{chunk-NQMC5VKQ.cjs → chunk-VPDCGD2D.cjs} +552 -852
  26. package/dist/{chunk-4J5ADVIN.cjs → chunk-X4D52IZK.cjs} +1496 -175
  27. package/dist/claim.cjs +5 -7
  28. package/dist/claim.d.cts +3 -3
  29. package/dist/claim.d.ts +3 -3
  30. package/dist/claim.mjs +4 -6
  31. package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
  32. package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
  33. package/dist/constants.cjs +3 -3
  34. package/dist/constants.d.cts +3 -3
  35. package/dist/constants.d.ts +3 -3
  36. package/dist/constants.mjs +2 -2
  37. package/dist/deposit.cjs +7 -8
  38. package/dist/deposit.d.cts +3 -3
  39. package/dist/deposit.d.ts +3 -3
  40. package/dist/deposit.mjs +6 -7
  41. package/dist/embed.cjs +135 -44
  42. package/dist/embed.d.cts +2 -2
  43. package/dist/embed.d.ts +2 -2
  44. package/dist/embed.mjs +116 -25
  45. package/dist/index.cjs +13 -11
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.mjs +12 -10
  49. package/dist/polymarket.cjs +6 -6
  50. package/dist/polymarket.mjs +2 -2
  51. package/dist/styles.css +132 -100
  52. package/dist/{types-DP_3KwlD.d.cts → types-CQ0NHqCy.d.ts} +146 -11
  53. package/dist/{types-Bho4OA03.d.ts → types-CxiLX5sv.d.cts} +146 -11
  54. package/dist/withdraw.cjs +6 -6
  55. package/dist/withdraw.d.cts +4 -4
  56. package/dist/withdraw.d.ts +4 -4
  57. package/dist/withdraw.mjs +5 -5
  58. package/package.json +6 -6
  59. package/dist/ClaimModal-GDFENSLV.mjs +0 -13
  60. package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
  61. package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
  62. package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
  63. package/dist/chunk-62UCV2LG.cjs +0 -81
  64. package/dist/chunk-7AZFT2MV.cjs +0 -163
  65. package/dist/chunk-QACOOLOE.mjs +0 -1062
  66. package/dist/chunk-R5UQ3TN4.mjs +0 -81
  67. package/dist/chunk-VALXN5IO.mjs +0 -163
  68. package/dist/chunk-YP7QVKQ6.cjs +0 -1062
@@ -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
- return isHyperCoreDestination(targetChain) ? "hypercore" : 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;
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 === "solana" || isHyperCoreDestination(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
- if (!url) return void 0;
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
- return `${chainId}:${address.toLowerCase()}`;
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
- return token ? { address: token.address, decimals: token.decimals } : void 0;
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
- return getTokenSymbol(token, resolveDisplayChainId(chain));
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
- return getRuntimeChainExplorerUrl(resolveDisplayChainId(chainId));
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
- return `${url}/tx/${txHash}`;
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
- return getRuntimeChainExplorerName(resolveDisplayChainId(chainId)) ?? "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";
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,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cdnIconUrl
3
- } from "./chunk-VUATPOWJ.mjs";
3
+ } from "./chunk-EAGMY3QE.mjs";
4
4
 
5
5
  // src/core/dapp-imports/polymarket/constants.ts
6
6
  var POLYMARKET_POLYGON_CHAIN_ID = 137;