@rhinestone/deposit-modal 0.3.0-alpha.9 → 0.3.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 (39) hide show
  1. package/README.md +76 -0
  2. package/dist/{DepositModalReown-I7I3KLD2.mjs → DepositModalReown-6SUEC5IU.mjs} +4 -4
  3. package/dist/{DepositModalReown-XUA47RYZ.cjs → DepositModalReown-DNW4GH6L.cjs} +7 -7
  4. package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
  5. package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
  6. package/dist/{WithdrawModalReown-KN2DGOXR.mjs → WithdrawModalReown-7UAGSOSU.mjs} +4 -4
  7. package/dist/{WithdrawModalReown-JATYMQYP.cjs → WithdrawModalReown-OUWBSKSM.cjs} +7 -7
  8. package/dist/{constants-DqVn968d.d.ts → caip-CrQ2KKU-.d.cts} +11 -1
  9. package/dist/{constants-DqVn968d.d.cts → caip-CrQ2KKU-.d.ts} +11 -1
  10. package/dist/{chunk-G5Q4QBWX.cjs → chunk-2SMS542Q.cjs} +109 -102
  11. package/dist/{chunk-KIPKYPNF.cjs → chunk-33H6O5UU.cjs} +6 -16
  12. package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
  13. package/dist/{chunk-OISMGA2L.mjs → chunk-GPSBM66J.mjs} +2 -12
  14. package/dist/{chunk-TJG2AFPS.mjs → chunk-KAWJABTW.mjs} +1048 -540
  15. package/dist/{chunk-4BUMVXPS.mjs → chunk-KJ2RR2D4.mjs} +1829 -584
  16. package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
  17. package/dist/{chunk-MMXUBBGK.cjs → chunk-RABZINV3.cjs} +1032 -524
  18. package/dist/{chunk-KE4MRCFN.mjs → chunk-TKQYTBU6.mjs} +21 -14
  19. package/dist/{chunk-ZVG4JDKZ.cjs → chunk-VVJAIMKB.cjs} +1881 -636
  20. package/dist/constants.cjs +6 -2
  21. package/dist/constants.d.cts +1 -1
  22. package/dist/constants.d.ts +1 -1
  23. package/dist/constants.mjs +5 -1
  24. package/dist/deposit.cjs +4 -4
  25. package/dist/deposit.d.cts +2 -2
  26. package/dist/deposit.d.ts +2 -2
  27. package/dist/deposit.mjs +3 -3
  28. package/dist/index.cjs +19 -6
  29. package/dist/index.d.cts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.mjs +20 -7
  32. package/dist/styles.css +685 -75
  33. package/dist/{types-D8Q4TMk7.d.cts → types-BMcGO5k_.d.cts} +56 -2
  34. package/dist/{types-D8Q4TMk7.d.ts → types-BMcGO5k_.d.ts} +56 -2
  35. package/dist/withdraw.cjs +4 -4
  36. package/dist/withdraw.d.cts +2 -2
  37. package/dist/withdraw.d.ts +2 -2
  38. package/dist/withdraw.mjs +3 -3
  39. package/package.json +41 -17
@@ -1,10 +1,10 @@
1
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; }
2
2
 
3
- var _chunkMMXUBBGKcjs = require('./chunk-MMXUBBGK.cjs');
3
+ var _chunkRABZINV3cjs = require('./chunk-RABZINV3.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunk7JIDIX27cjs = require('./chunk-7JIDIX27.cjs');
7
+ var _chunkMILJQWPTcjs = require('./chunk-MILJQWPT.cjs');
8
8
 
9
9
  // src/core/reown.tsx
10
10
  var _react = require('react');
@@ -45,7 +45,7 @@ var APPKIT_NETWORK_BY_ID = {
45
45
  [_networks.soneium.id]: _networks.soneium,
46
46
  [_networks.plasma.id]: _networks.plasma
47
47
  };
48
- var EVM_NETWORKS = _chunk7JIDIX27cjs.SUPPORTED_CHAINS.map((chain) => {
48
+ var EVM_NETWORKS = _chunkMILJQWPTcjs.SUPPORTED_CHAINS.map((chain) => {
49
49
  const network = APPKIT_NETWORK_BY_ID[chain.id];
50
50
  if (!network) {
51
51
  throw new Error(
@@ -107,15 +107,6 @@ function ReownWalletProvider({
107
107
  const config = adapter.wagmiConfig;
108
108
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
109
109
  }
110
- async function disconnectWallet() {
111
- if (!_react3.modal) {
112
- console.warn(
113
- "[rhinestone] disconnectWallet called before the modal provider mounted; no-op."
114
- );
115
- return;
116
- }
117
- await _react3.modal.disconnect();
118
- }
119
110
  function useReownWallet() {
120
111
  const { open } = _react3.useAppKit.call(void 0, );
121
112
  const { address, isConnected, caipAddress } = _react3.useAppKitAccount.call(void 0, );
@@ -154,9 +145,9 @@ function useReownWallet() {
154
145
  await switchChainAsync({ chainId });
155
146
  }
156
147
  } catch (err) {
157
- if (_chunkMMXUBBGKcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
148
+ if (_chunkRABZINV3cjs.isUnsupportedChainSwitchError.call(void 0, err)) {
158
149
  throw new Error(
159
- `Switch to ${_chunk7JIDIX27cjs.getChainName.call(void 0, chainId)} in your wallet to continue`
150
+ `Switch to ${_chunkMILJQWPTcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
160
151
  );
161
152
  }
162
153
  throw err;
@@ -168,5 +159,4 @@ function useReownWallet() {
168
159
 
169
160
 
170
161
 
171
-
172
- exports.ReownWalletProvider = ReownWalletProvider; exports.disconnectWallet = disconnectWallet; exports.useReownWallet = useReownWallet;
162
+ exports.ReownWalletProvider = ReownWalletProvider; exports.useReownWallet = useReownWallet;
@@ -1,3 +1,37 @@
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
+ return targetChain === "solana" ? SOLANA_MAINNET_CAIP2 : toEvmCaip2(targetChain);
9
+ }
10
+ function parseEvmChainId(value) {
11
+ if (typeof value === "number" && Number.isFinite(value)) {
12
+ return value;
13
+ }
14
+ if (typeof value !== "string") return null;
15
+ const match = value.match(/^eip155:(\d+)$/);
16
+ if (!match?.[1]) return null;
17
+ const parsed = Number.parseInt(match[1], 10);
18
+ return Number.isFinite(parsed) ? parsed : null;
19
+ }
20
+ function isSolanaCaip2(value) {
21
+ return typeof value === "string" && value.startsWith("solana:");
22
+ }
23
+ var HYPERCORE_CHAIN_ID = 1337;
24
+ var HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
25
+ var HYPERCORE_MIN_DEPOSIT_USD = 1;
26
+ function isVirtualDestination(targetChain) {
27
+ return targetChain === "solana" || targetChain === HYPERCORE_CHAIN_ID;
28
+ }
29
+ function isContractBytecode(code) {
30
+ if (!code || code === "0x") return false;
31
+ if (code.toLowerCase().startsWith("0xef0100")) return false;
32
+ return true;
33
+ }
34
+
1
35
  // src/core/solana-tokens.ts
2
36
  var SOLANA_TOKENS = [
3
37
  { symbol: "SOL", mint: "native", decimals: 9 },
@@ -67,6 +101,7 @@ var SOLANA_CHAIN_ICON = SOL_BADGE_SVG;
67
101
  var SOLANA_TOKEN_ICON = SOL_BADGE_SVG;
68
102
  function getChainIcon(chainId) {
69
103
  if (chainId === "solana") return SOLANA_CHAIN_ICON;
104
+ if (chainId === HYPERCORE_CHAIN_ID) return CHAIN_ICONS[hyperliquid.id];
70
105
  return CHAIN_ICONS[chainId];
71
106
  }
72
107
  function getTokenIcon(symbol) {
@@ -303,6 +338,13 @@ var chainRegistry = {
303
338
  decimals: 6
304
339
  }
305
340
  ]
341
+ },
342
+ // HyperCore (virtual chain 1337) is a USDC-only deposit *destination*. It has
343
+ // no viem chain / RPC, so it lives only here for name + token resolution —
344
+ // deliberately absent from the source-chain matrices above.
345
+ [HYPERCORE_CHAIN_ID]: {
346
+ name: "HyperCore",
347
+ tokens: [{ symbol: "USDC", address: HYPERCORE_USDC_ADDRESS, decimals: 6 }]
306
348
  }
307
349
  };
308
350
  function getChainId(chain) {
@@ -403,7 +445,7 @@ function getSupportedTargetTokens(chainId) {
403
445
  }
404
446
  return options;
405
447
  }
406
- function getTokenDecimalsByAddress(token, chainId) {
448
+ function findTokenDecimals(token, chainId) {
407
449
  const normalized = token.toLowerCase();
408
450
  if (normalized === NATIVE_TOKEN_ADDRESS) {
409
451
  return 18;
@@ -423,7 +465,10 @@ function getTokenDecimalsByAddress(token, chainId) {
423
465
  );
424
466
  if (found) return found.decimals;
425
467
  }
426
- return 18;
468
+ return void 0;
469
+ }
470
+ function getTokenDecimalsByAddress(token, chainId) {
471
+ return findTokenDecimals(token, chainId) ?? 18;
427
472
  }
428
473
  function findChainIdForToken(address) {
429
474
  const normalized = address.toLowerCase();
@@ -479,7 +524,12 @@ var CHAIN_BADGES = {
479
524
  [sonic2.id]: { shortLabel: "Sonic", color: "#5B6DEF", bg: "#EDEFFE" },
480
525
  [gnosis2.id]: { shortLabel: "Gnosis", color: "#3E6957", bg: "#E5F0EB" },
481
526
  [hyperliquid2.id]: { shortLabel: "Hyper", color: "#5BE7C4", bg: "#E5FFF8" },
482
- [monad2.id]: { shortLabel: "Monad", color: "#6E54FF", bg: "#EEEBFF" }
527
+ [monad2.id]: { shortLabel: "Monad", color: "#6E54FF", bg: "#EEEBFF" },
528
+ [HYPERCORE_CHAIN_ID]: {
529
+ shortLabel: "HyperCore",
530
+ color: "#5BE7C4",
531
+ bg: "#E5FFF8"
532
+ }
483
533
  };
484
534
  function getChainName(chainId) {
485
535
  if (chainId === "solana") return "Solana";
@@ -517,6 +567,15 @@ function getExplorerName(chainId) {
517
567
  }
518
568
 
519
569
  export {
570
+ toEvmCaip2,
571
+ targetChainToCaip2,
572
+ parseEvmChainId,
573
+ isSolanaCaip2,
574
+ HYPERCORE_CHAIN_ID,
575
+ HYPERCORE_USDC_ADDRESS,
576
+ HYPERCORE_MIN_DEPOSIT_USD,
577
+ isVirtualDestination,
578
+ isContractBytecode,
520
579
  SOLANA_TOKENS,
521
580
  getSolanaTokenBySymbol,
522
581
  getSolanaTokenByMint,
@@ -541,6 +600,7 @@ export {
541
600
  getSupportedChainIds,
542
601
  isSupportedTokenAddressForChain,
543
602
  getSupportedTargetTokens,
603
+ findTokenDecimals,
544
604
  getTokenDecimalsByAddress,
545
605
  findChainIdForToken,
546
606
  getTokenSymbol,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isUnsupportedChainSwitchError
3
- } from "./chunk-TJG2AFPS.mjs";
3
+ } from "./chunk-KAWJABTW.mjs";
4
4
  import {
5
5
  SUPPORTED_CHAINS,
6
6
  getChainName
7
- } from "./chunk-SZIYS42B.mjs";
7
+ } from "./chunk-6YRDD462.mjs";
8
8
 
9
9
  // src/core/reown.tsx
10
10
  import { useState } from "react";
@@ -107,15 +107,6 @@ function ReownWalletProvider({
107
107
  const config = adapter.wagmiConfig;
108
108
  return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
109
109
  }
110
- async function disconnectWallet() {
111
- if (!modal) {
112
- console.warn(
113
- "[rhinestone] disconnectWallet called before the modal provider mounted; no-op."
114
- );
115
- return;
116
- }
117
- await modal.disconnect();
118
- }
119
110
  function useReownWallet() {
120
111
  const { open } = useAppKit();
121
112
  const { address, isConnected, caipAddress } = useAppKitAccount();
@@ -167,6 +158,5 @@ function useReownWallet() {
167
158
 
168
159
  export {
169
160
  ReownWalletProvider,
170
- disconnectWallet,
171
161
  useReownWallet
172
162
  };