@rhinestone/deposit-modal 0.1.22 → 0.1.24
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 +5 -1
- package/dist/{chunk-J7UK4L5T.mjs → chunk-35DWLO33.mjs} +36 -41
- package/dist/{chunk-W7ZYJB2X.cjs → chunk-A2PDOYYE.cjs} +81 -89
- package/dist/{chunk-BO745KAB.cjs → chunk-ANQQMGNN.cjs} +116 -197
- package/dist/{chunk-V6HZJZOL.cjs → chunk-O3I5KVXA.cjs} +72 -77
- package/dist/{chunk-JBT2ZV3Q.mjs → chunk-P7SQQAAF.mjs} +89 -170
- package/dist/{chunk-N2LJOFT2.mjs → chunk-ZMVCDFXM.mjs} +40 -48
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +197 -0
- package/dist/reown.d.cts +14 -0
- package/dist/reown.d.ts +14 -0
- package/dist/reown.mjs +197 -0
- package/dist/{types-D_xeOU8G.d.cts → types-CUww05xT.d.cts} +14 -1
- package/dist/{types-DnGF9RJJ.d.ts → types-Z6GjVWFR.d.ts} +14 -1
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +33 -11
- package/dist/DepositModalReown-324WTBDE.cjs +0 -33
- package/dist/DepositModalReown-YTWIR7A4.mjs +0 -33
- package/dist/WithdrawModalReown-ICP3DH6Q.mjs +0 -33
- package/dist/WithdrawModalReown-ZNTE2G6W.cjs +0 -33
- package/dist/chunk-6VJ2ZTNQ.cjs +0 -90
- package/dist/chunk-LBEP3A2Z.mjs +0 -90
|
@@ -21,11 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _chunkBO745KABcjs = require('./chunk-BO745KAB.cjs');
|
|
24
|
+
var _chunkANQQMGNNcjs = require('./chunk-ANQQMGNN.cjs');
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
|
|
@@ -50,8 +46,6 @@ var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
|
50
46
|
|
|
51
47
|
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
49
|
var _react = require('react');
|
|
56
50
|
|
|
57
51
|
// src/DepositFlow.tsx
|
|
@@ -59,18 +53,17 @@ var _react = require('react');
|
|
|
59
53
|
|
|
60
54
|
// src/components/steps/SetupStep.tsx
|
|
61
55
|
|
|
62
|
-
var _sdk = require('@rhinestone/sdk');
|
|
63
56
|
var _jsxruntime = require('react/jsx-runtime');
|
|
64
57
|
async function resolveSessionOwner(eoaAddress) {
|
|
65
|
-
const localOwner =
|
|
58
|
+
const localOwner = _chunkANQQMGNNcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
66
59
|
if (localOwner) {
|
|
67
60
|
return {
|
|
68
|
-
account:
|
|
61
|
+
account: _chunkANQQMGNNcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
69
62
|
address: localOwner.address
|
|
70
63
|
};
|
|
71
64
|
}
|
|
72
|
-
const created =
|
|
73
|
-
|
|
65
|
+
const created = _chunkANQQMGNNcjs.createSessionOwnerKey.call(void 0, );
|
|
66
|
+
_chunkANQQMGNNcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
74
67
|
return {
|
|
75
68
|
account: created.account,
|
|
76
69
|
address: created.address
|
|
@@ -80,9 +73,7 @@ function SetupStep({
|
|
|
80
73
|
walletClient,
|
|
81
74
|
address,
|
|
82
75
|
targetChain,
|
|
83
|
-
targetChainObj,
|
|
84
76
|
targetToken,
|
|
85
|
-
rhinestoneApiKey,
|
|
86
77
|
signerAddress,
|
|
87
78
|
sessionChainIds,
|
|
88
79
|
recipient,
|
|
@@ -94,8 +85,18 @@ function SetupStep({
|
|
|
94
85
|
}) {
|
|
95
86
|
const [state, setState] = _react.useState.call(void 0, { type: "idle" });
|
|
96
87
|
const setupInitiatedRef = _react.useRef.call(void 0, false);
|
|
88
|
+
const signSessionDetails = _react.useCallback.call(void 0,
|
|
89
|
+
async (sessionOwner, typedData) => {
|
|
90
|
+
const signer = sessionOwner.account;
|
|
91
|
+
if (!signer.signTypedData) {
|
|
92
|
+
throw new Error("Session owner cannot sign typed data");
|
|
93
|
+
}
|
|
94
|
+
return await signer.signTypedData(typedData);
|
|
95
|
+
},
|
|
96
|
+
[]
|
|
97
|
+
);
|
|
97
98
|
const runSetup = _react.useCallback.call(void 0, async () => {
|
|
98
|
-
if (!address
|
|
99
|
+
if (!address) {
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
if (walletClient && !walletClient.account) {
|
|
@@ -103,14 +104,16 @@ function SetupStep({
|
|
|
103
104
|
}
|
|
104
105
|
try {
|
|
105
106
|
setState({ type: "creating-account" });
|
|
106
|
-
const signerAccount = walletClient ? _sdk.walletClientToAccount.call(void 0, walletClient) : _chunkBO745KABcjs.createViewOnlyAccount.call(void 0, address);
|
|
107
107
|
const sessionOwner = await resolveSessionOwner(address);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
sessionOwner.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
const prepared = await service.prepareAccount({
|
|
109
|
+
ownerAddress: address,
|
|
110
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
111
|
+
targetChain,
|
|
112
|
+
targetToken,
|
|
113
|
+
signerAddress,
|
|
114
|
+
sessionChainIds
|
|
115
|
+
});
|
|
116
|
+
const smartAccount = prepared.smartAccount;
|
|
114
117
|
setState({ type: "checking" });
|
|
115
118
|
const checkResult = await service.checkAccount(smartAccount);
|
|
116
119
|
if (checkResult.isRegistered && !forceRegister) {
|
|
@@ -123,21 +126,20 @@ function SetupStep({
|
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
setState({ type: "signing-session" });
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
sessionChainIds
|
|
129
|
+
const signature = await signSessionDetails(
|
|
130
|
+
sessionOwner,
|
|
131
|
+
prepared.sessionDetailsUnsigned.data
|
|
132
|
+
);
|
|
133
|
+
const sessionDetails = _chunkANQQMGNNcjs.buildSessionDetails.call(void 0,
|
|
134
|
+
prepared.sessionDetailsUnsigned,
|
|
135
|
+
signature
|
|
134
136
|
);
|
|
135
137
|
setState({ type: "registering" });
|
|
136
138
|
await service.registerAccount({
|
|
137
139
|
address: smartAccount,
|
|
138
140
|
accountParams: {
|
|
139
|
-
factory:
|
|
140
|
-
factoryData:
|
|
141
|
+
factory: prepared.accountParams.factory,
|
|
142
|
+
factoryData: prepared.accountParams.factoryData,
|
|
141
143
|
sessionDetails
|
|
142
144
|
},
|
|
143
145
|
eoaAddress: address,
|
|
@@ -159,10 +161,8 @@ function SetupStep({
|
|
|
159
161
|
}, [
|
|
160
162
|
address,
|
|
161
163
|
walletClient,
|
|
162
|
-
targetChainObj,
|
|
163
164
|
targetChain,
|
|
164
165
|
targetToken,
|
|
165
|
-
rhinestoneApiKey,
|
|
166
166
|
signerAddress,
|
|
167
167
|
sessionChainIds,
|
|
168
168
|
recipient,
|
|
@@ -170,15 +170,16 @@ function SetupStep({
|
|
|
170
170
|
service,
|
|
171
171
|
onSetupComplete,
|
|
172
172
|
onError,
|
|
173
|
-
onConnected
|
|
173
|
+
onConnected,
|
|
174
|
+
signSessionDetails
|
|
174
175
|
]);
|
|
175
176
|
_react.useEffect.call(void 0, () => {
|
|
176
177
|
const hasWallet = walletClient ? Boolean(walletClient.account) : true;
|
|
177
|
-
if (address && hasWallet &&
|
|
178
|
+
if (address && hasWallet && !setupInitiatedRef.current && state.type === "idle") {
|
|
178
179
|
setupInitiatedRef.current = true;
|
|
179
180
|
runSetup();
|
|
180
181
|
}
|
|
181
|
-
}, [address, walletClient,
|
|
182
|
+
}, [address, walletClient, state.type, runSetup]);
|
|
182
183
|
const handleRetry = () => {
|
|
183
184
|
setupInitiatedRef.current = false;
|
|
184
185
|
setState({ type: "idle" });
|
|
@@ -206,7 +207,7 @@ function SetupStep({
|
|
|
206
207
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
207
208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
208
209
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
209
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
210
211
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
211
212
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
212
213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -243,7 +244,7 @@ function SetupStep({
|
|
|
243
244
|
] })
|
|
244
245
|
] })
|
|
245
246
|
] }),
|
|
246
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
247
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
247
248
|
] });
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -266,7 +267,7 @@ function AssetSelectStep({
|
|
|
266
267
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
267
268
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
268
269
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
269
|
-
return
|
|
270
|
+
return _chunkANQQMGNNcjs.getAssetId.call(void 0, {
|
|
270
271
|
chainId: defaultSourceChain,
|
|
271
272
|
token: defaultSourceToken
|
|
272
273
|
});
|
|
@@ -283,7 +284,7 @@ function AssetSelectStep({
|
|
|
283
284
|
try {
|
|
284
285
|
const portfolio = await service.fetchPortfolio(address);
|
|
285
286
|
if (!active) return;
|
|
286
|
-
const portfolioAssets =
|
|
287
|
+
const portfolioAssets = _chunkANQQMGNNcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
287
288
|
setAssets(portfolioAssets);
|
|
288
289
|
const hasNative = portfolioAssets.some(
|
|
289
290
|
(asset) => asset.token.toLowerCase() === _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS
|
|
@@ -351,7 +352,7 @@ function AssetSelectStep({
|
|
|
351
352
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
352
353
|
const numeric = Number(raw);
|
|
353
354
|
if (!Number.isFinite(numeric)) return raw;
|
|
354
|
-
return
|
|
355
|
+
return _chunkANQQMGNNcjs.tokenFormatter.format(numeric);
|
|
355
356
|
} catch (e3) {
|
|
356
357
|
return asset.balance;
|
|
357
358
|
}
|
|
@@ -365,7 +366,7 @@ function AssetSelectStep({
|
|
|
365
366
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
366
367
|
children: [
|
|
367
368
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
369
370
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
370
371
|
] }),
|
|
371
372
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
@@ -455,7 +456,7 @@ function AssetSelectStep({
|
|
|
455
456
|
] })
|
|
456
457
|
] })
|
|
457
458
|
] }),
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ?
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ? _chunkANQQMGNNcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
459
460
|
]
|
|
460
461
|
},
|
|
461
462
|
asset.id
|
|
@@ -465,7 +466,7 @@ function AssetSelectStep({
|
|
|
465
466
|
}
|
|
466
467
|
),
|
|
467
468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
-
|
|
469
|
+
_chunkANQQMGNNcjs.Button,
|
|
469
470
|
{
|
|
470
471
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
471
472
|
disabled: !selectedAsset,
|
|
@@ -473,7 +474,7 @@ function AssetSelectStep({
|
|
|
473
474
|
children: "Continue"
|
|
474
475
|
}
|
|
475
476
|
) }),
|
|
476
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.PoweredBy, {})
|
|
477
478
|
] });
|
|
478
479
|
}
|
|
479
480
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
@@ -481,7 +482,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
481
482
|
const connectedChainId = _optionalChain([publicClient, 'access', _8 => _8.chain, 'optionalAccess', _9 => _9.id]);
|
|
482
483
|
if (!connectedChainId) return [];
|
|
483
484
|
if (!_chunkCEIWN53Ncjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
484
|
-
const id =
|
|
485
|
+
const id = _chunkANQQMGNNcjs.getAssetId.call(void 0, {
|
|
485
486
|
chainId: connectedChainId,
|
|
486
487
|
token: _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS
|
|
487
488
|
});
|
|
@@ -561,7 +562,7 @@ function AmountStep({
|
|
|
561
562
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
562
563
|
if (!balanceTarget || !publicClient) return;
|
|
563
564
|
try {
|
|
564
|
-
const bal =
|
|
565
|
+
const bal = _chunkANQQMGNNcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
565
566
|
address: asset.token,
|
|
566
567
|
abi: _viem.erc20Abi,
|
|
567
568
|
functionName: "balanceOf",
|
|
@@ -622,7 +623,7 @@ function AmountStep({
|
|
|
622
623
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
623
624
|
const numeric = Number(raw);
|
|
624
625
|
if (!Number.isFinite(numeric)) return raw;
|
|
625
|
-
return
|
|
626
|
+
return _chunkANQQMGNNcjs.tokenFormatter.format(numeric);
|
|
626
627
|
} catch (e8) {
|
|
627
628
|
return "...";
|
|
628
629
|
}
|
|
@@ -636,7 +637,7 @@ function AmountStep({
|
|
|
636
637
|
}, [amountUsd, tokenPriceUsd]);
|
|
637
638
|
const formattedTokenAmount = _react.useMemo.call(void 0, () => {
|
|
638
639
|
if (tokenAmount === null) return "0.00";
|
|
639
|
-
return
|
|
640
|
+
return _chunkANQQMGNNcjs.tokenFormatter.format(tokenAmount);
|
|
640
641
|
}, [tokenAmount]);
|
|
641
642
|
const targetSymbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
642
643
|
const handlePresetClick = (percentage) => {
|
|
@@ -653,13 +654,13 @@ function AmountStep({
|
|
|
653
654
|
}
|
|
654
655
|
if (_optionalChain([uiConfig, 'optionalAccess', _13 => _13.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
655
656
|
setError(
|
|
656
|
-
`Maximum deposit is ${
|
|
657
|
+
`Maximum deposit is ${_chunkANQQMGNNcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
657
658
|
);
|
|
658
659
|
return;
|
|
659
660
|
}
|
|
660
661
|
if (_optionalChain([uiConfig, 'optionalAccess', _14 => _14.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
661
662
|
setError(
|
|
662
|
-
`Minimum deposit is ${
|
|
663
|
+
`Minimum deposit is ${_chunkANQQMGNNcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
663
664
|
);
|
|
664
665
|
return;
|
|
665
666
|
}
|
|
@@ -729,7 +730,7 @@ function AmountStep({
|
|
|
729
730
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
730
731
|
" ",
|
|
731
732
|
"(",
|
|
732
|
-
|
|
733
|
+
_chunkANQQMGNNcjs.currencyFormatter.format(balanceUsd),
|
|
733
734
|
")"
|
|
734
735
|
] })
|
|
735
736
|
] }) })
|
|
@@ -872,7 +873,7 @@ function AmountStep({
|
|
|
872
873
|
" to continue."
|
|
873
874
|
] }),
|
|
874
875
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
875
|
-
|
|
876
|
+
_chunkANQQMGNNcjs.Button,
|
|
876
877
|
{
|
|
877
878
|
variant: "outline",
|
|
878
879
|
size: "small",
|
|
@@ -905,7 +906,7 @@ function AmountStep({
|
|
|
905
906
|
] })
|
|
906
907
|
] }),
|
|
907
908
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
908
|
-
|
|
909
|
+
_chunkANQQMGNNcjs.Button,
|
|
909
910
|
{
|
|
910
911
|
onClick: handleContinue,
|
|
911
912
|
fullWidth: true,
|
|
@@ -913,7 +914,7 @@ function AmountStep({
|
|
|
913
914
|
children: "Continue"
|
|
914
915
|
}
|
|
915
916
|
) }),
|
|
916
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
917
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.PoweredBy, {})
|
|
917
918
|
] });
|
|
918
919
|
}
|
|
919
920
|
|
|
@@ -1023,7 +1024,7 @@ function ConfirmStep({
|
|
|
1023
1024
|
throw new Error("Wallet not properly connected");
|
|
1024
1025
|
}
|
|
1025
1026
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1026
|
-
const hash =
|
|
1027
|
+
const hash = _chunkANQQMGNNcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1027
1028
|
account,
|
|
1028
1029
|
chain,
|
|
1029
1030
|
to: transferTo,
|
|
@@ -1040,7 +1041,7 @@ function ConfirmStep({
|
|
|
1040
1041
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1041
1042
|
} catch (err) {
|
|
1042
1043
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1043
|
-
const message =
|
|
1044
|
+
const message = _chunkANQQMGNNcjs.formatUserError.call(void 0, raw);
|
|
1044
1045
|
setError(message);
|
|
1045
1046
|
_optionalChain([onError, 'optionalCall', _18 => _18(message, "TRANSFER_ERROR")]);
|
|
1046
1047
|
} finally {
|
|
@@ -1054,7 +1055,7 @@ function ConfirmStep({
|
|
|
1054
1055
|
await switchChain(asset.chainId);
|
|
1055
1056
|
} catch (err) {
|
|
1056
1057
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1057
|
-
setError(
|
|
1058
|
+
setError(_chunkANQQMGNNcjs.formatUserError.call(void 0, raw));
|
|
1058
1059
|
} finally {
|
|
1059
1060
|
setIsSwitching(false);
|
|
1060
1061
|
}
|
|
@@ -1159,7 +1160,7 @@ function ConfirmStep({
|
|
|
1159
1160
|
] }),
|
|
1160
1161
|
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1161
1162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
|
|
1162
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children:
|
|
1163
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkANQQMGNNcjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1163
1164
|
] })
|
|
1164
1165
|
] }),
|
|
1165
1166
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
@@ -1169,7 +1170,7 @@ function ConfirmStep({
|
|
|
1169
1170
|
" to sign."
|
|
1170
1171
|
] }),
|
|
1171
1172
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1172
|
-
|
|
1173
|
+
_chunkANQQMGNNcjs.Button,
|
|
1173
1174
|
{
|
|
1174
1175
|
variant: "outline",
|
|
1175
1176
|
size: "small",
|
|
@@ -1202,7 +1203,7 @@ function ConfirmStep({
|
|
|
1202
1203
|
] })
|
|
1203
1204
|
] }),
|
|
1204
1205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1205
|
-
|
|
1206
|
+
_chunkANQQMGNNcjs.Button,
|
|
1206
1207
|
{
|
|
1207
1208
|
onClick: handleConfirm,
|
|
1208
1209
|
loading: isSubmitting,
|
|
@@ -1211,7 +1212,7 @@ function ConfirmStep({
|
|
|
1211
1212
|
children: "Confirm Order"
|
|
1212
1213
|
}
|
|
1213
1214
|
) }),
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.PoweredBy, {})
|
|
1215
1216
|
] });
|
|
1216
1217
|
}
|
|
1217
1218
|
|
|
@@ -1416,7 +1417,7 @@ function DepositAddressStep({
|
|
|
1416
1417
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1417
1418
|
if (cancelled || depositHandledRef.current) return;
|
|
1418
1419
|
const event = status.lastEvent;
|
|
1419
|
-
const eventTxHash =
|
|
1420
|
+
const eventTxHash = _chunkANQQMGNNcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkANQQMGNNcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _22 => _22.toLowerCase, 'call', _23 => _23()]), () => ( null)) : null;
|
|
1420
1421
|
if (baselineTxHash === void 0) {
|
|
1421
1422
|
baselineTxHash = eventTxHash;
|
|
1422
1423
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1629,7 +1630,7 @@ function DepositAddressStep({
|
|
|
1629
1630
|
] }),
|
|
1630
1631
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1631
1632
|
] }) }),
|
|
1632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.PoweredBy, {})
|
|
1633
1634
|
] });
|
|
1634
1635
|
}
|
|
1635
1636
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1650,7 +1651,6 @@ function DepositFlow({
|
|
|
1650
1651
|
sourceToken: defaultSourceToken,
|
|
1651
1652
|
amount: defaultAmount,
|
|
1652
1653
|
recipient,
|
|
1653
|
-
rhinestoneApiKey,
|
|
1654
1654
|
signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
|
|
1655
1655
|
sessionChainIds,
|
|
1656
1656
|
forceRegister = false,
|
|
@@ -1716,7 +1716,7 @@ function DepositFlow({
|
|
|
1716
1716
|
return {
|
|
1717
1717
|
ownerAddress: dappAddress,
|
|
1718
1718
|
walletClient: void 0,
|
|
1719
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1719
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, targetChain))),
|
|
1720
1720
|
switchChain: void 0
|
|
1721
1721
|
};
|
|
1722
1722
|
}
|
|
@@ -1725,7 +1725,7 @@ function DepositFlow({
|
|
|
1725
1725
|
return {
|
|
1726
1726
|
ownerAddress: dappWalletClient.account.address,
|
|
1727
1727
|
walletClient: dappWalletClient,
|
|
1728
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1728
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1729
1729
|
switchChain: dappSwitchChain
|
|
1730
1730
|
};
|
|
1731
1731
|
}
|
|
@@ -1735,7 +1735,7 @@ function DepositFlow({
|
|
|
1735
1735
|
return {
|
|
1736
1736
|
ownerAddress: dappWalletClient.account.address,
|
|
1737
1737
|
walletClient: dappWalletClient,
|
|
1738
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1738
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1739
1739
|
switchChain: dappSwitchChain
|
|
1740
1740
|
};
|
|
1741
1741
|
}
|
|
@@ -1943,7 +1943,7 @@ function DepositFlow({
|
|
|
1943
1943
|
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
1944
1944
|
if (showConnectStep) {
|
|
1945
1945
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1946
|
-
|
|
1946
|
+
_chunkANQQMGNNcjs.ConnectStep,
|
|
1947
1947
|
{
|
|
1948
1948
|
walletOptions,
|
|
1949
1949
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1973,9 +1973,7 @@ function DepositFlow({
|
|
|
1973
1973
|
{
|
|
1974
1974
|
address: sessionKeyAddress,
|
|
1975
1975
|
targetChain,
|
|
1976
|
-
targetChainObj,
|
|
1977
1976
|
targetToken,
|
|
1978
|
-
rhinestoneApiKey,
|
|
1979
1977
|
signerAddress,
|
|
1980
1978
|
sessionChainIds,
|
|
1981
1979
|
recipient,
|
|
@@ -1996,7 +1994,7 @@ function DepositFlow({
|
|
|
1996
1994
|
}
|
|
1997
1995
|
),
|
|
1998
1996
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1999
|
-
|
|
1997
|
+
_chunkANQQMGNNcjs.ProcessingStep,
|
|
2000
1998
|
{
|
|
2001
1999
|
smartAccount: step.smartAccount,
|
|
2002
2000
|
txHash: step.txHash,
|
|
@@ -2027,7 +2025,7 @@ function DepositFlow({
|
|
|
2027
2025
|
if (_optionalChain([signerContext, 'access', _58 => _58.publicClient, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]) === chainId) {
|
|
2028
2026
|
return signerContext.publicClient;
|
|
2029
2027
|
}
|
|
2030
|
-
return
|
|
2028
|
+
return _chunkANQQMGNNcjs.getPublicClient.call(void 0, chainId);
|
|
2031
2029
|
};
|
|
2032
2030
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2033
2031
|
step.type === "setup" && targetChainObj && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2036,9 +2034,7 @@ function DepositFlow({
|
|
|
2036
2034
|
walletClient: signerContext.walletClient,
|
|
2037
2035
|
address: ownerAddress,
|
|
2038
2036
|
targetChain,
|
|
2039
|
-
targetChainObj,
|
|
2040
2037
|
targetToken,
|
|
2041
|
-
rhinestoneApiKey,
|
|
2042
2038
|
signerAddress,
|
|
2043
2039
|
sessionChainIds,
|
|
2044
2040
|
recipient,
|
|
@@ -2095,7 +2091,7 @@ function DepositFlow({
|
|
|
2095
2091
|
}
|
|
2096
2092
|
),
|
|
2097
2093
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2098
|
-
|
|
2094
|
+
_chunkANQQMGNNcjs.ProcessingStep,
|
|
2099
2095
|
{
|
|
2100
2096
|
smartAccount: step.smartAccount,
|
|
2101
2097
|
txHash: step.txHash,
|
|
@@ -2119,13 +2115,11 @@ function DepositFlow({
|
|
|
2119
2115
|
|
|
2120
2116
|
// src/DepositModal.tsx
|
|
2121
2117
|
|
|
2122
|
-
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2123
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-324WTBDE.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2124
|
-
);
|
|
2125
2118
|
function DepositModal(props) {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2119
|
+
if (props.reownAppId) {
|
|
2120
|
+
throw new Error(
|
|
2121
|
+
'Reown support moved to "@rhinestone/deposit-modal/reown". Use that entrypoint when passing reownAppId.'
|
|
2122
|
+
);
|
|
2129
2123
|
}
|
|
2130
2124
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalInner, { ...props });
|
|
2131
2125
|
}
|
|
@@ -2144,7 +2138,6 @@ function DepositModalInner({
|
|
|
2144
2138
|
defaultAmount,
|
|
2145
2139
|
recipient,
|
|
2146
2140
|
backendUrl = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL,
|
|
2147
|
-
rhinestoneApiKey,
|
|
2148
2141
|
signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
|
|
2149
2142
|
sessionChainIds,
|
|
2150
2143
|
forceRegister = false,
|
|
@@ -2171,10 +2164,10 @@ function DepositModalInner({
|
|
|
2171
2164
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2172
2165
|
const targetChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, targetChainProp);
|
|
2173
2166
|
const sourceChain = sourceChainProp ? _chunkCEIWN53Ncjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2174
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2167
|
+
const service = _react.useMemo.call(void 0, () => _chunkANQQMGNNcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2175
2168
|
_react.useEffect.call(void 0, () => {
|
|
2176
2169
|
if (isOpen && modalRef.current) {
|
|
2177
|
-
|
|
2170
|
+
_chunkANQQMGNNcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2178
2171
|
}
|
|
2179
2172
|
}, [isOpen, theme]);
|
|
2180
2173
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
@@ -2210,7 +2203,7 @@ function DepositModalInner({
|
|
|
2210
2203
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _69 => _69.title]), () => ( "Deposit"));
|
|
2211
2204
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2212
2205
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2213
|
-
|
|
2206
|
+
_chunkANQQMGNNcjs.Modal,
|
|
2214
2207
|
{
|
|
2215
2208
|
isOpen,
|
|
2216
2209
|
onClose,
|
|
@@ -2271,7 +2264,7 @@ function DepositModalInner({
|
|
|
2271
2264
|
balanceTitle,
|
|
2272
2265
|
":"
|
|
2273
2266
|
] }),
|
|
2274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
2267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkANQQMGNNcjs.currencyFormatter.format(totalBalanceUsd) })
|
|
2275
2268
|
] })
|
|
2276
2269
|
] }),
|
|
2277
2270
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2314,7 +2307,6 @@ function DepositModalInner({
|
|
|
2314
2307
|
sourceToken,
|
|
2315
2308
|
amount: defaultAmount,
|
|
2316
2309
|
recipient,
|
|
2317
|
-
rhinestoneApiKey,
|
|
2318
2310
|
signerAddress,
|
|
2319
2311
|
sessionChainIds,
|
|
2320
2312
|
forceRegister,
|