@rhinestone/deposit-modal 0.14.0 → 0.14.1
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 +6 -12
- package/dist/{ClaimModal-SEKNWRMA.mjs → ClaimModal-GDFENSLV.mjs} +5 -5
- package/dist/ClaimModal-L3FUBI5U.cjs +13 -0
- package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-2EVV64OA.mjs} +29 -27
- package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-GAD45GIC.cjs} +76 -74
- package/dist/WithdrawModal-FAQH35NG.cjs +12 -0
- package/dist/{WithdrawModal-5ICGD4HJ.mjs → WithdrawModal-IKUHF5CF.mjs} +4 -4
- package/dist/{chunk-7ICSHJFE.cjs → chunk-4J5ADVIN.cjs} +71 -67
- package/dist/{chunk-KTUVSKR4.mjs → chunk-5Q5CSVKF.mjs} +74 -32
- package/dist/{chunk-LZFRL2AL.cjs → chunk-62UCV2LG.cjs} +3 -3
- package/dist/{chunk-X2IPAPXU.cjs → chunk-7AZFT2MV.cjs} +8 -8
- package/dist/{chunk-MTFJSE52.cjs → chunk-A6JPBMYY.cjs} +65 -65
- package/dist/{chunk-6KG642KH.cjs → chunk-AQVJUXSG.cjs} +1 -1
- package/dist/{chunk-PKML3XVS.mjs → chunk-GZ4GQ5MC.mjs} +2 -2
- package/dist/{chunk-V2OBGLJD.cjs → chunk-HAQOFI3D.cjs} +90 -60
- package/dist/{chunk-K4H6TGBE.mjs → chunk-LMG46EP2.mjs} +1 -1
- package/dist/{chunk-YCQZJQO6.cjs → chunk-NQMC5VKQ.cjs} +343 -301
- package/dist/{chunk-CFKC77SV.mjs → chunk-QACOOLOE.mjs} +3 -3
- package/dist/{chunk-WUJIKCFU.mjs → chunk-R5UQ3TN4.mjs} +1 -1
- package/dist/{chunk-IN77XSWO.mjs → chunk-UX35GYLM.mjs} +59 -29
- package/dist/{chunk-ZEO6ADM3.mjs → chunk-VALXN5IO.mjs} +2 -2
- package/dist/{chunk-7SR7ENVJ.mjs → chunk-XCTRKCNM.mjs} +6 -2
- package/dist/{chunk-YWMWI7PZ.cjs → chunk-YP7QVKQ6.cjs} +53 -53
- package/dist/claim.cjs +6 -6
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +18 -18
- package/dist/embed.mjs +8 -8
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +8 -8
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.mjs +4 -4
- package/package.json +7 -6
- package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
- package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
runAccountSetupDeduped,
|
|
20
20
|
txRefsMatch,
|
|
21
21
|
warnRemovedProps
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XCTRKCNM.mjs";
|
|
23
23
|
import {
|
|
24
24
|
ListRow
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-R5UQ3TN4.mjs";
|
|
26
26
|
import {
|
|
27
27
|
AlertTriangleIcon,
|
|
28
28
|
AnalyticsSession,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
useLatestRef,
|
|
89
89
|
useRpcUrls,
|
|
90
90
|
useStableRpcUrls
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-UX35GYLM.mjs";
|
|
92
92
|
import {
|
|
93
93
|
MULTICALL3_ADDRESS,
|
|
94
94
|
POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
|
|
@@ -133,6 +133,34 @@ import {
|
|
|
133
133
|
toEvmCaip2
|
|
134
134
|
} from "./chunk-VUATPOWJ.mjs";
|
|
135
135
|
|
|
136
|
+
// src/core/reown-dependencies.ts
|
|
137
|
+
var dependencies;
|
|
138
|
+
var dependenciesPromise;
|
|
139
|
+
function loadReownDependencies() {
|
|
140
|
+
dependenciesPromise ?? (dependenciesPromise = Promise.all([
|
|
141
|
+
import("@reown/appkit/react"),
|
|
142
|
+
import("@reown/appkit/networks"),
|
|
143
|
+
import("@reown/appkit-adapter-wagmi"),
|
|
144
|
+
import("@reown/appkit-adapter-solana"),
|
|
145
|
+
import("@reown/appkit-adapter-solana/react")
|
|
146
|
+
]).then((modules) => dependencies = modules).catch((cause) => {
|
|
147
|
+
const error = new Error(
|
|
148
|
+
"[rhinestone] reownAppId requires @reown/appkit, @reown/appkit-adapter-wagmi, @reown/appkit-adapter-solana, @solana/web3.js, and @solana/spl-token."
|
|
149
|
+
);
|
|
150
|
+
error.cause = cause;
|
|
151
|
+
throw error;
|
|
152
|
+
}));
|
|
153
|
+
return dependenciesPromise;
|
|
154
|
+
}
|
|
155
|
+
function getReownDependencies() {
|
|
156
|
+
if (!dependencies) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
"[rhinestone] Reown dependencies were accessed before initialization."
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return dependencies;
|
|
162
|
+
}
|
|
163
|
+
|
|
136
164
|
// src/DepositModal.tsx
|
|
137
165
|
import {
|
|
138
166
|
useMemo as useMemo10,
|
|
@@ -4680,40 +4708,41 @@ import { useState as useState12 } from "react";
|
|
|
4680
4708
|
import { parseUnits as parseUnits5 } from "viem";
|
|
4681
4709
|
|
|
4682
4710
|
// src/core/solana.ts
|
|
4683
|
-
import {
|
|
4684
|
-
Connection,
|
|
4685
|
-
PublicKey,
|
|
4686
|
-
SystemProgram,
|
|
4687
|
-
Transaction
|
|
4688
|
-
} from "@solana/web3.js";
|
|
4689
|
-
import {
|
|
4690
|
-
getAssociatedTokenAddress,
|
|
4691
|
-
createAssociatedTokenAccountInstruction,
|
|
4692
|
-
createTransferInstruction
|
|
4693
|
-
} from "@solana/spl-token";
|
|
4694
4711
|
var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
4695
4712
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
4713
|
+
var dependenciesPromise2;
|
|
4714
|
+
function loadSolanaDependencies() {
|
|
4715
|
+
dependenciesPromise2 ?? (dependenciesPromise2 = Promise.all([
|
|
4716
|
+
import("@solana/web3.js"),
|
|
4717
|
+
import("@solana/spl-token")
|
|
4718
|
+
]));
|
|
4719
|
+
return dependenciesPromise2;
|
|
4720
|
+
}
|
|
4696
4721
|
function getSolanaRpcUrl(rpcUrls) {
|
|
4697
4722
|
return rpcUrlFor(rpcUrls, "solana") ?? DEFAULT_SOLANA_RPC_URL;
|
|
4698
4723
|
}
|
|
4699
4724
|
function hasConfiguredSolanaRpcUrl(rpcUrls) {
|
|
4700
4725
|
return rpcUrlFor(rpcUrls, "solana") !== void 0;
|
|
4701
4726
|
}
|
|
4702
|
-
function getSolanaConnection(rpcUrls) {
|
|
4727
|
+
async function getSolanaConnection(rpcUrls) {
|
|
4703
4728
|
const rpcUrl = getSolanaRpcUrl(rpcUrls);
|
|
4704
4729
|
const cached = cachedConnections.get(rpcUrl);
|
|
4705
4730
|
if (cached) {
|
|
4706
4731
|
return cached;
|
|
4707
4732
|
}
|
|
4708
|
-
const
|
|
4733
|
+
const [web3] = await loadSolanaDependencies();
|
|
4734
|
+
const initialized = cachedConnections.get(rpcUrl);
|
|
4735
|
+
if (initialized) return initialized;
|
|
4736
|
+
const next = new web3.Connection(rpcUrl, "confirmed");
|
|
4709
4737
|
cachedConnections.set(rpcUrl, next);
|
|
4710
4738
|
return next;
|
|
4711
4739
|
}
|
|
4712
4740
|
async function buildSolTransferTransaction(connection, from, to, lamports) {
|
|
4713
|
-
const
|
|
4714
|
-
const
|
|
4715
|
-
const
|
|
4716
|
-
|
|
4741
|
+
const [web3] = await loadSolanaDependencies();
|
|
4742
|
+
const fromPubkey = new web3.PublicKey(from);
|
|
4743
|
+
const toPubkey = new web3.PublicKey(to);
|
|
4744
|
+
const tx = new web3.Transaction().add(
|
|
4745
|
+
web3.SystemProgram.transfer({
|
|
4717
4746
|
fromPubkey,
|
|
4718
4747
|
toPubkey,
|
|
4719
4748
|
lamports
|
|
@@ -4726,16 +4755,24 @@ async function buildSolTransferTransaction(connection, from, to, lamports) {
|
|
|
4726
4755
|
return tx;
|
|
4727
4756
|
}
|
|
4728
4757
|
async function buildSplTransferTransaction(connection, from, to, mint, amount) {
|
|
4729
|
-
const
|
|
4730
|
-
const
|
|
4731
|
-
const
|
|
4732
|
-
const
|
|
4733
|
-
const
|
|
4734
|
-
|
|
4758
|
+
const [web3, splToken] = await loadSolanaDependencies();
|
|
4759
|
+
const fromPubkey = new web3.PublicKey(from);
|
|
4760
|
+
const toPubkey = new web3.PublicKey(to);
|
|
4761
|
+
const mintPubkey = new web3.PublicKey(mint);
|
|
4762
|
+
const fromAta = await splToken.getAssociatedTokenAddress(
|
|
4763
|
+
mintPubkey,
|
|
4764
|
+
fromPubkey
|
|
4765
|
+
);
|
|
4766
|
+
const toAta = await splToken.getAssociatedTokenAddress(
|
|
4767
|
+
mintPubkey,
|
|
4768
|
+
toPubkey,
|
|
4769
|
+
true
|
|
4770
|
+
);
|
|
4771
|
+
const tx = new web3.Transaction();
|
|
4735
4772
|
const toAtaInfo = await connection.getAccountInfo(toAta);
|
|
4736
4773
|
if (!toAtaInfo) {
|
|
4737
4774
|
tx.add(
|
|
4738
|
-
createAssociatedTokenAccountInstruction(
|
|
4775
|
+
splToken.createAssociatedTokenAccountInstruction(
|
|
4739
4776
|
fromPubkey,
|
|
4740
4777
|
toAta,
|
|
4741
4778
|
toPubkey,
|
|
@@ -4743,7 +4780,9 @@ async function buildSplTransferTransaction(connection, from, to, mint, amount) {
|
|
|
4743
4780
|
)
|
|
4744
4781
|
);
|
|
4745
4782
|
}
|
|
4746
|
-
tx.add(
|
|
4783
|
+
tx.add(
|
|
4784
|
+
splToken.createTransferInstruction(fromAta, toAta, fromPubkey, amount)
|
|
4785
|
+
);
|
|
4747
4786
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
4748
4787
|
tx.recentBlockhash = blockhash;
|
|
4749
4788
|
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
@@ -4867,7 +4906,7 @@ function SolanaConfirmStep({
|
|
|
4867
4906
|
"Deposit account is not registered yet. Please restart setup and try again."
|
|
4868
4907
|
);
|
|
4869
4908
|
}
|
|
4870
|
-
const connection = hasConfiguredSolanaRpcUrl(rpcUrls) ? getSolanaConnection(rpcUrls) : solanaConnection ?? getSolanaConnection(rpcUrls);
|
|
4909
|
+
const connection = await (hasConfiguredSolanaRpcUrl(rpcUrls) ? getSolanaConnection(rpcUrls) : solanaConnection ?? getSolanaConnection(rpcUrls));
|
|
4871
4910
|
const amountUnits = parseUnits5(sourceAmount, token.decimals);
|
|
4872
4911
|
debugLog(debug, "solana-confirm", "tx:build:start", {
|
|
4873
4912
|
token: token.symbol,
|
|
@@ -9858,9 +9897,11 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
9858
9897
|
|
|
9859
9898
|
// src/DepositModal.tsx
|
|
9860
9899
|
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9861
|
-
var ReownDepositInner = lazy2(
|
|
9862
|
-
|
|
9863
|
-
);
|
|
9900
|
+
var ReownDepositInner = lazy2(async () => {
|
|
9901
|
+
await loadReownDependencies();
|
|
9902
|
+
const module = await import("./DepositModalReown-2EVV64OA.mjs");
|
|
9903
|
+
return { default: module.DepositModalReown };
|
|
9904
|
+
});
|
|
9864
9905
|
function sortByCreatedAtDesc(items) {
|
|
9865
9906
|
return [...items].sort((a, b) => {
|
|
9866
9907
|
const at = a.createdAt ? Date.parse(a.createdAt) : 0;
|
|
@@ -10340,6 +10381,7 @@ function DepositModalInner({
|
|
|
10340
10381
|
}
|
|
10341
10382
|
|
|
10342
10383
|
export {
|
|
10384
|
+
getReownDependencies,
|
|
10343
10385
|
DepositModal,
|
|
10344
10386
|
DepositModalInner
|
|
10345
10387
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHAQOFI3Dcjs = require('./chunk-HAQOFI3D.cjs');
|
|
5
5
|
|
|
6
6
|
// src/components/ui/ListRow.tsx
|
|
7
7
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -19,7 +19,7 @@ function ListRow({
|
|
|
19
19
|
...props
|
|
20
20
|
}) {
|
|
21
21
|
const inner = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
22
|
-
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
22
|
+
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHAQOFI3Dcjs.CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
23
23
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-body", children: [
|
|
24
24
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-text", children: [
|
|
25
25
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-title", children: title }),
|
|
@@ -39,7 +39,7 @@ function ListRow({
|
|
|
39
39
|
}
|
|
40
40
|
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
41
41
|
] }),
|
|
42
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
42
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHAQOFI3Dcjs.ChevronRightIcon, {})))) })
|
|
43
43
|
] });
|
|
44
44
|
if (action) {
|
|
45
45
|
const handleKey = (e) => {
|
|
@@ -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(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHAQOFI3Dcjs = require('./chunk-HAQOFI3D.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkAQVJUXSGcjs = require('./chunk-AQVJUXSG.cjs');
|
|
8
8
|
|
|
9
9
|
// src/core/recovery.ts
|
|
10
10
|
var RECOVER_DOMAIN = {
|
|
@@ -91,7 +91,7 @@ async function submitSignedRecovery(params) {
|
|
|
91
91
|
destination
|
|
92
92
|
});
|
|
93
93
|
} catch (error) {
|
|
94
|
-
|
|
94
|
+
_chunkHAQOFI3Dcjs.debugError.call(void 0, debug, scope, "signRecovery:failed", error);
|
|
95
95
|
throw new RecoveryError(
|
|
96
96
|
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
97
97
|
0,
|
|
@@ -110,7 +110,7 @@ async function submitSignedRecovery(params) {
|
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
|
|
113
|
-
|
|
113
|
+
_chunkHAQOFI3Dcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:request", {
|
|
114
114
|
url,
|
|
115
115
|
depositId,
|
|
116
116
|
signer
|
|
@@ -122,19 +122,19 @@ async function submitSignedRecovery(params) {
|
|
|
122
122
|
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
123
123
|
// every other backend call. Without it this path would be invisible in the
|
|
124
124
|
// per-client version telemetry the processor records.
|
|
125
|
-
headers:
|
|
125
|
+
headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
|
|
126
126
|
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
127
127
|
// precision well before that range.
|
|
128
128
|
body: JSON.stringify({ depositId, destination, signature })
|
|
129
129
|
});
|
|
130
130
|
} catch (error) {
|
|
131
|
-
|
|
131
|
+
_chunkHAQOFI3Dcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:network", error);
|
|
132
132
|
const { message, retryable } = formatRecoveryError(0);
|
|
133
133
|
throw new RecoveryError(message, 0, void 0, retryable, "request");
|
|
134
134
|
}
|
|
135
135
|
if (!response.ok) {
|
|
136
136
|
const body = await response.json().catch(() => ({}));
|
|
137
|
-
|
|
137
|
+
_chunkHAQOFI3Dcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:failed", body, {
|
|
138
138
|
status: response.status
|
|
139
139
|
});
|
|
140
140
|
const { message, retryable } = formatRecoveryError(
|
|
@@ -151,7 +151,7 @@ async function submitSignedRecovery(params) {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
const result = await response.json();
|
|
154
|
-
|
|
154
|
+
_chunkHAQOFI3Dcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:success", {
|
|
155
155
|
transactionHash: result.transactionHash
|
|
156
156
|
});
|
|
157
157
|
return result;
|