@rhinestone/deposit-modal 0.1.26 → 0.1.28
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/dist/{DepositModalReown-NKDYLTKD.cjs → DepositModalReown-6IXFIXR6.cjs} +3 -3
- package/dist/{DepositModalReown-4WZF2HMJ.mjs → DepositModalReown-FF4YU5VV.mjs} +2 -2
- package/dist/{WithdrawModalReown-GL4TM22D.cjs → WithdrawModalReown-GMIE6AWA.cjs} +3 -3
- package/dist/{WithdrawModalReown-244RQ5FZ.mjs → WithdrawModalReown-LIYQG2BW.mjs} +2 -2
- package/dist/{chunk-4WULBRUA.cjs → chunk-LP6DQCKV.cjs} +67 -76
- package/dist/{chunk-3FK5FAUL.mjs → chunk-RQSAANC3.mjs} +74 -224
- package/dist/{chunk-4Q6QCALP.cjs → chunk-VW3QQWEL.cjs} +96 -246
- package/dist/{chunk-DJAUNNEW.mjs → chunk-XF7M4TTT.mjs} +32 -41
- package/dist/{chunk-7QCFFKB5.cjs → chunk-XJ4G6RO6.cjs} +122 -141
- package/dist/{chunk-W42B54IA.mjs → chunk-YXTWMYHK.mjs} +34 -53
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -2
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _chunk4Q6QCALPcjs = require('./chunk-4Q6QCALP.cjs');
|
|
27
|
-
|
|
24
|
+
var _chunkVW3QQWELcjs = require('./chunk-VW3QQWEL.cjs');
|
|
28
25
|
|
|
29
26
|
|
|
30
27
|
|
|
@@ -57,18 +54,17 @@ var _react = require('react');
|
|
|
57
54
|
|
|
58
55
|
// src/components/steps/SetupStep.tsx
|
|
59
56
|
|
|
60
|
-
var _sdk = require('@rhinestone/sdk');
|
|
61
57
|
var _jsxruntime = require('react/jsx-runtime');
|
|
62
58
|
async function resolveSessionOwner(eoaAddress) {
|
|
63
|
-
const localOwner =
|
|
59
|
+
const localOwner = _chunkVW3QQWELcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
64
60
|
if (localOwner) {
|
|
65
61
|
return {
|
|
66
|
-
account:
|
|
62
|
+
account: _chunkVW3QQWELcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
67
63
|
address: localOwner.address
|
|
68
64
|
};
|
|
69
65
|
}
|
|
70
|
-
const created =
|
|
71
|
-
|
|
66
|
+
const created = _chunkVW3QQWELcjs.createSessionOwnerKey.call(void 0, );
|
|
67
|
+
_chunkVW3QQWELcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
72
68
|
return {
|
|
73
69
|
account: created.account,
|
|
74
70
|
address: created.address
|
|
@@ -78,9 +74,7 @@ function SetupStep({
|
|
|
78
74
|
walletClient,
|
|
79
75
|
address,
|
|
80
76
|
targetChain,
|
|
81
|
-
targetChainObj,
|
|
82
77
|
targetToken,
|
|
83
|
-
rhinestoneApiKey,
|
|
84
78
|
signerAddress,
|
|
85
79
|
sessionChainIds,
|
|
86
80
|
recipient,
|
|
@@ -93,7 +87,7 @@ function SetupStep({
|
|
|
93
87
|
const [state, setState] = _react.useState.call(void 0, { type: "idle" });
|
|
94
88
|
const setupInitiatedRef = _react.useRef.call(void 0, false);
|
|
95
89
|
const runSetup = _react.useCallback.call(void 0, async () => {
|
|
96
|
-
if (!address
|
|
90
|
+
if (!address) {
|
|
97
91
|
return;
|
|
98
92
|
}
|
|
99
93
|
if (walletClient && !walletClient.account) {
|
|
@@ -102,44 +96,43 @@ function SetupStep({
|
|
|
102
96
|
try {
|
|
103
97
|
setState({ type: "creating-account" });
|
|
104
98
|
const sessionOwner = await resolveSessionOwner(address);
|
|
105
|
-
const
|
|
99
|
+
const setup = await service.setupAccount({
|
|
106
100
|
ownerAddress: address,
|
|
107
101
|
sessionOwnerAddress: sessionOwner.address,
|
|
108
102
|
targetChain,
|
|
109
103
|
targetToken,
|
|
110
104
|
signerAddress,
|
|
111
|
-
sessionChainIds
|
|
105
|
+
sessionChainIds,
|
|
106
|
+
forceRegister
|
|
112
107
|
});
|
|
113
|
-
const smartAccount =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
setState({ type: "ready", smartAccount });
|
|
120
|
-
_optionalChain([onConnected, 'optionalCall', _4 => _4(address, smartAccount)]);
|
|
121
|
-
onSetupComplete(smartAccount);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
108
|
+
const smartAccount = setup.smartAccount;
|
|
109
|
+
if (!setup.needsRegistration) {
|
|
110
|
+
setState({ type: "ready", smartAccount });
|
|
111
|
+
_optionalChain([onConnected, 'optionalCall', _ => _(address, smartAccount)]);
|
|
112
|
+
onSetupComplete(smartAccount);
|
|
113
|
+
return;
|
|
124
114
|
}
|
|
125
115
|
setState({ type: "signing-session" });
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
117
|
+
throw new Error("Missing registration payload from setup-account");
|
|
118
|
+
}
|
|
119
|
+
if (!sessionOwner.account.signTypedData) {
|
|
120
|
+
throw new Error("Session owner account does not support signTypedData");
|
|
121
|
+
}
|
|
122
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
123
|
+
const signature = await sessionOwner.account.signTypedData({
|
|
124
|
+
domain: typedData.domain,
|
|
125
|
+
types: typedData.types,
|
|
126
|
+
primaryType: typedData.primaryType,
|
|
127
|
+
message: typedData.message
|
|
128
|
+
});
|
|
129
|
+
const sessionDetails = _chunkVW3QQWELcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
137
130
|
setState({ type: "registering" });
|
|
138
131
|
await service.registerAccount({
|
|
139
132
|
address: smartAccount,
|
|
140
133
|
accountParams: {
|
|
141
|
-
factory:
|
|
142
|
-
factoryData:
|
|
134
|
+
factory: setup.accountParams.factory,
|
|
135
|
+
factoryData: setup.accountParams.factoryData,
|
|
143
136
|
sessionDetails
|
|
144
137
|
},
|
|
145
138
|
eoaAddress: address,
|
|
@@ -151,20 +144,18 @@ function SetupStep({
|
|
|
151
144
|
}
|
|
152
145
|
});
|
|
153
146
|
setState({ type: "ready", smartAccount });
|
|
154
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
147
|
+
_optionalChain([onConnected, 'optionalCall', _2 => _2(address, smartAccount)]);
|
|
155
148
|
onSetupComplete(smartAccount);
|
|
156
149
|
} catch (error) {
|
|
157
150
|
const message = error instanceof Error ? error.message : "Setup failed";
|
|
158
151
|
setState({ type: "error", message });
|
|
159
|
-
_optionalChain([onError, 'optionalCall',
|
|
152
|
+
_optionalChain([onError, 'optionalCall', _3 => _3(message, "SETUP_ERROR")]);
|
|
160
153
|
}
|
|
161
154
|
}, [
|
|
162
155
|
address,
|
|
163
156
|
walletClient,
|
|
164
|
-
targetChainObj,
|
|
165
157
|
targetChain,
|
|
166
158
|
targetToken,
|
|
167
|
-
rhinestoneApiKey,
|
|
168
159
|
signerAddress,
|
|
169
160
|
sessionChainIds,
|
|
170
161
|
recipient,
|
|
@@ -176,11 +167,11 @@ function SetupStep({
|
|
|
176
167
|
]);
|
|
177
168
|
_react.useEffect.call(void 0, () => {
|
|
178
169
|
const hasWallet = walletClient ? Boolean(walletClient.account) : true;
|
|
179
|
-
if (address && hasWallet &&
|
|
170
|
+
if (address && hasWallet && !setupInitiatedRef.current && state.type === "idle") {
|
|
180
171
|
setupInitiatedRef.current = true;
|
|
181
172
|
runSetup();
|
|
182
173
|
}
|
|
183
|
-
}, [address, walletClient,
|
|
174
|
+
}, [address, walletClient, state.type, runSetup]);
|
|
184
175
|
const handleRetry = () => {
|
|
185
176
|
setupInitiatedRef.current = false;
|
|
186
177
|
setState({ type: "idle" });
|
|
@@ -189,8 +180,6 @@ function SetupStep({
|
|
|
189
180
|
switch (state.type) {
|
|
190
181
|
case "idle":
|
|
191
182
|
return "Preparing...";
|
|
192
|
-
case "checking":
|
|
193
|
-
return "Verifying your account...";
|
|
194
183
|
case "creating-account":
|
|
195
184
|
return "Preparing your deposit account...";
|
|
196
185
|
case "signing-session":
|
|
@@ -203,12 +192,12 @@ function SetupStep({
|
|
|
203
192
|
return state.message;
|
|
204
193
|
}
|
|
205
194
|
};
|
|
206
|
-
const isLoading = state.type === "idle" || state.type === "
|
|
195
|
+
const isLoading = state.type === "idle" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
207
196
|
const isError = state.type === "error";
|
|
208
197
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
209
198
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
210
199
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
211
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
200
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
212
201
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
213
202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
214
203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -245,7 +234,7 @@ function SetupStep({
|
|
|
245
234
|
] })
|
|
246
235
|
] })
|
|
247
236
|
] }),
|
|
248
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
249
238
|
] });
|
|
250
239
|
}
|
|
251
240
|
|
|
@@ -268,7 +257,7 @@ function AssetSelectStep({
|
|
|
268
257
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
269
258
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
270
259
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
271
|
-
return
|
|
260
|
+
return _chunkVW3QQWELcjs.getAssetId.call(void 0, {
|
|
272
261
|
chainId: defaultSourceChain,
|
|
273
262
|
token: defaultSourceToken
|
|
274
263
|
});
|
|
@@ -285,7 +274,7 @@ function AssetSelectStep({
|
|
|
285
274
|
try {
|
|
286
275
|
const portfolio = await service.fetchPortfolio(address);
|
|
287
276
|
if (!active) return;
|
|
288
|
-
const portfolioAssets =
|
|
277
|
+
const portfolioAssets = _chunkVW3QQWELcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
289
278
|
setAssets(portfolioAssets);
|
|
290
279
|
const hasNative = portfolioAssets.some(
|
|
291
280
|
(asset) => asset.token.toLowerCase() === _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS
|
|
@@ -326,7 +315,7 @@ function AssetSelectStep({
|
|
|
326
315
|
(sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
|
|
327
316
|
0
|
|
328
317
|
);
|
|
329
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
318
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _4 => _4(total)]);
|
|
330
319
|
}, [assets, onTotalBalanceComputed]);
|
|
331
320
|
const rows = _react.useMemo.call(void 0, () => {
|
|
332
321
|
return assets.filter((a) => {
|
|
@@ -353,7 +342,7 @@ function AssetSelectStep({
|
|
|
353
342
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
354
343
|
const numeric = Number(raw);
|
|
355
344
|
if (!Number.isFinite(numeric)) return raw;
|
|
356
|
-
return
|
|
345
|
+
return _chunkVW3QQWELcjs.tokenFormatter.format(numeric);
|
|
357
346
|
} catch (e3) {
|
|
358
347
|
return asset.balance;
|
|
359
348
|
}
|
|
@@ -367,7 +356,7 @@ function AssetSelectStep({
|
|
|
367
356
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
368
357
|
children: [
|
|
369
358
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
371
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
372
361
|
] }),
|
|
373
362
|
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 }) }),
|
|
@@ -457,7 +446,7 @@ function AssetSelectStep({
|
|
|
457
446
|
] })
|
|
458
447
|
] })
|
|
459
448
|
] }),
|
|
460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ?
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ? _chunkVW3QQWELcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
461
450
|
]
|
|
462
451
|
},
|
|
463
452
|
asset.id
|
|
@@ -467,7 +456,7 @@ function AssetSelectStep({
|
|
|
467
456
|
}
|
|
468
457
|
),
|
|
469
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
470
|
-
|
|
459
|
+
_chunkVW3QQWELcjs.Button,
|
|
471
460
|
{
|
|
472
461
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
473
462
|
disabled: !selectedAsset,
|
|
@@ -475,15 +464,15 @@ function AssetSelectStep({
|
|
|
475
464
|
children: "Continue"
|
|
476
465
|
}
|
|
477
466
|
) }),
|
|
478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.PoweredBy, {})
|
|
479
468
|
] });
|
|
480
469
|
}
|
|
481
470
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
482
471
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
483
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
472
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _5 => _5.chain, 'optionalAccess', _6 => _6.id]);
|
|
484
473
|
if (!connectedChainId) return [];
|
|
485
474
|
if (!_chunkCEIWN53Ncjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
486
|
-
const id =
|
|
475
|
+
const id = _chunkVW3QQWELcjs.getAssetId.call(void 0, {
|
|
487
476
|
chainId: connectedChainId,
|
|
488
477
|
token: _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS
|
|
489
478
|
});
|
|
@@ -542,7 +531,7 @@ function AmountStep({
|
|
|
542
531
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
543
532
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
544
533
|
const chainMismatch = Boolean(
|
|
545
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
534
|
+
_optionalChain([walletClient, 'optionalAccess', _7 => _7.chain, 'optionalAccess', _8 => _8.id]) && walletClient.chain.id !== asset.chainId
|
|
546
535
|
);
|
|
547
536
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
548
537
|
if (tokenPriceUsdOverride !== void 0) return tokenPriceUsdOverride;
|
|
@@ -563,7 +552,7 @@ function AmountStep({
|
|
|
563
552
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
564
553
|
if (!balanceTarget || !publicClient) return;
|
|
565
554
|
try {
|
|
566
|
-
const bal =
|
|
555
|
+
const bal = _chunkVW3QQWELcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
567
556
|
address: asset.token,
|
|
568
557
|
abi: _viem.erc20Abi,
|
|
569
558
|
functionName: "balanceOf",
|
|
@@ -616,7 +605,7 @@ function AmountStep({
|
|
|
616
605
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
617
606
|
_react.useEffect.call(void 0, () => {
|
|
618
607
|
if (balanceUsd === null) return;
|
|
619
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
608
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _9 => _9(balanceUsd)]);
|
|
620
609
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
621
610
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
622
611
|
if (balance === null) return "...";
|
|
@@ -624,7 +613,7 @@ function AmountStep({
|
|
|
624
613
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
625
614
|
const numeric = Number(raw);
|
|
626
615
|
if (!Number.isFinite(numeric)) return raw;
|
|
627
|
-
return
|
|
616
|
+
return _chunkVW3QQWELcjs.tokenFormatter.format(numeric);
|
|
628
617
|
} catch (e8) {
|
|
629
618
|
return "...";
|
|
630
619
|
}
|
|
@@ -638,7 +627,7 @@ function AmountStep({
|
|
|
638
627
|
}, [amountUsd, tokenPriceUsd]);
|
|
639
628
|
const formattedTokenAmount = _react.useMemo.call(void 0, () => {
|
|
640
629
|
if (tokenAmount === null) return "0.00";
|
|
641
|
-
return
|
|
630
|
+
return _chunkVW3QQWELcjs.tokenFormatter.format(tokenAmount);
|
|
642
631
|
}, [tokenAmount]);
|
|
643
632
|
const targetSymbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
644
633
|
const handlePresetClick = (percentage) => {
|
|
@@ -653,15 +642,15 @@ function AmountStep({
|
|
|
653
642
|
setError("Please enter a valid amount");
|
|
654
643
|
return;
|
|
655
644
|
}
|
|
656
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
645
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _10 => _10.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
657
646
|
setError(
|
|
658
|
-
`Maximum deposit is ${
|
|
647
|
+
`Maximum deposit is ${_chunkVW3QQWELcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
659
648
|
);
|
|
660
649
|
return;
|
|
661
650
|
}
|
|
662
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
651
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
663
652
|
setError(
|
|
664
|
-
`Minimum deposit is ${
|
|
653
|
+
`Minimum deposit is ${_chunkVW3QQWELcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
665
654
|
);
|
|
666
655
|
return;
|
|
667
656
|
}
|
|
@@ -731,7 +720,7 @@ function AmountStep({
|
|
|
731
720
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
732
721
|
" ",
|
|
733
722
|
"(",
|
|
734
|
-
|
|
723
|
+
_chunkVW3QQWELcjs.currencyFormatter.format(balanceUsd),
|
|
735
724
|
")"
|
|
736
725
|
] })
|
|
737
726
|
] }) })
|
|
@@ -874,7 +863,7 @@ function AmountStep({
|
|
|
874
863
|
" to continue."
|
|
875
864
|
] }),
|
|
876
865
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
877
|
-
|
|
866
|
+
_chunkVW3QQWELcjs.Button,
|
|
878
867
|
{
|
|
879
868
|
variant: "outline",
|
|
880
869
|
size: "small",
|
|
@@ -907,7 +896,7 @@ function AmountStep({
|
|
|
907
896
|
] })
|
|
908
897
|
] }),
|
|
909
898
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
910
|
-
|
|
899
|
+
_chunkVW3QQWELcjs.Button,
|
|
911
900
|
{
|
|
912
901
|
onClick: handleContinue,
|
|
913
902
|
fullWidth: true,
|
|
@@ -915,7 +904,7 @@ function AmountStep({
|
|
|
915
904
|
children: "Continue"
|
|
916
905
|
}
|
|
917
906
|
) }),
|
|
918
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.PoweredBy, {})
|
|
919
908
|
] });
|
|
920
909
|
}
|
|
921
910
|
|
|
@@ -942,7 +931,7 @@ function ConfirmStep({
|
|
|
942
931
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
943
932
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
944
933
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
945
|
-
const chainMismatch = _optionalChain([walletClient, 'optionalAccess',
|
|
934
|
+
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _12 => _12.chain, 'optionalAccess', _13 => _13.id]) && walletClient.chain.id !== asset.chainId;
|
|
946
935
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
947
936
|
const targetSymbol = sameRoute ? asset.symbol : _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
948
937
|
const formattedAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
@@ -1025,7 +1014,7 @@ function ConfirmStep({
|
|
|
1025
1014
|
throw new Error("Wallet not properly connected");
|
|
1026
1015
|
}
|
|
1027
1016
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1028
|
-
const hash =
|
|
1017
|
+
const hash = _chunkVW3QQWELcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1029
1018
|
account,
|
|
1030
1019
|
chain,
|
|
1031
1020
|
to: transferTo,
|
|
@@ -1038,13 +1027,13 @@ function ConfirmStep({
|
|
|
1038
1027
|
functionName: "transfer",
|
|
1039
1028
|
args: [transferTo, amountUnits]
|
|
1040
1029
|
});
|
|
1041
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1030
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _14 => _14(hash, asset.chainId, amountUnits.toString())]);
|
|
1042
1031
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1043
1032
|
} catch (err) {
|
|
1044
1033
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1045
|
-
const message =
|
|
1034
|
+
const message = _chunkVW3QQWELcjs.formatUserError.call(void 0, raw);
|
|
1046
1035
|
setError(message);
|
|
1047
|
-
_optionalChain([onError, 'optionalCall',
|
|
1036
|
+
_optionalChain([onError, 'optionalCall', _15 => _15(message, "TRANSFER_ERROR")]);
|
|
1048
1037
|
} finally {
|
|
1049
1038
|
setIsSubmitting(false);
|
|
1050
1039
|
}
|
|
@@ -1056,7 +1045,7 @@ function ConfirmStep({
|
|
|
1056
1045
|
await switchChain(asset.chainId);
|
|
1057
1046
|
} catch (err) {
|
|
1058
1047
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1059
|
-
setError(
|
|
1048
|
+
setError(_chunkVW3QQWELcjs.formatUserError.call(void 0, raw));
|
|
1060
1049
|
} finally {
|
|
1061
1050
|
setIsSwitching(false);
|
|
1062
1051
|
}
|
|
@@ -1161,7 +1150,7 @@ function ConfirmStep({
|
|
|
1161
1150
|
] }),
|
|
1162
1151
|
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1163
1152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
|
|
1164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children:
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkVW3QQWELcjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1165
1154
|
] })
|
|
1166
1155
|
] }),
|
|
1167
1156
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
@@ -1171,7 +1160,7 @@ function ConfirmStep({
|
|
|
1171
1160
|
" to sign."
|
|
1172
1161
|
] }),
|
|
1173
1162
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1174
|
-
|
|
1163
|
+
_chunkVW3QQWELcjs.Button,
|
|
1175
1164
|
{
|
|
1176
1165
|
variant: "outline",
|
|
1177
1166
|
size: "small",
|
|
@@ -1204,7 +1193,7 @@ function ConfirmStep({
|
|
|
1204
1193
|
] })
|
|
1205
1194
|
] }),
|
|
1206
1195
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1207
|
-
|
|
1196
|
+
_chunkVW3QQWELcjs.Button,
|
|
1208
1197
|
{
|
|
1209
1198
|
onClick: handleConfirm,
|
|
1210
1199
|
loading: isSubmitting,
|
|
@@ -1213,7 +1202,7 @@ function ConfirmStep({
|
|
|
1213
1202
|
children: "Confirm Order"
|
|
1214
1203
|
}
|
|
1215
1204
|
) }),
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.PoweredBy, {})
|
|
1217
1206
|
] });
|
|
1218
1207
|
}
|
|
1219
1208
|
|
|
@@ -1335,7 +1324,7 @@ function asAddress(value) {
|
|
|
1335
1324
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1336
1325
|
}
|
|
1337
1326
|
function getDepositEventDetails(event) {
|
|
1338
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1327
|
+
if (!_optionalChain([event, 'optionalAccess', _16 => _16.type]) || !isRecord(event.data)) return {};
|
|
1339
1328
|
if (event.type === "deposit-received") {
|
|
1340
1329
|
return {
|
|
1341
1330
|
chainId: asNumber(event.data.chain),
|
|
@@ -1346,8 +1335,8 @@ function getDepositEventDetails(event) {
|
|
|
1346
1335
|
if (event.type === "bridge-started") {
|
|
1347
1336
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1348
1337
|
return {
|
|
1349
|
-
chainId: asNumber(_optionalChain([source, 'optionalAccess',
|
|
1350
|
-
token: asAddress(_optionalChain([source, 'optionalAccess',
|
|
1338
|
+
chainId: asNumber(_optionalChain([source, 'optionalAccess', _17 => _17.chain])),
|
|
1339
|
+
token: asAddress(_optionalChain([source, 'optionalAccess', _18 => _18.asset]))
|
|
1351
1340
|
};
|
|
1352
1341
|
}
|
|
1353
1342
|
return {};
|
|
@@ -1418,7 +1407,7 @@ function DepositAddressStep({
|
|
|
1418
1407
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1419
1408
|
if (cancelled || depositHandledRef.current) return;
|
|
1420
1409
|
const event = status.lastEvent;
|
|
1421
|
-
const eventTxHash =
|
|
1410
|
+
const eventTxHash = _chunkVW3QQWELcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkVW3QQWELcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _19 => _19.toLowerCase, 'call', _20 => _20()]), () => ( null)) : null;
|
|
1422
1411
|
if (baselineTxHash === void 0) {
|
|
1423
1412
|
baselineTxHash = eventTxHash;
|
|
1424
1413
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1438,7 +1427,7 @@ function DepositAddressStep({
|
|
|
1438
1427
|
if (!cancelled) {
|
|
1439
1428
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1440
1429
|
setPollingError(msg);
|
|
1441
|
-
_optionalChain([onError, 'optionalCall',
|
|
1430
|
+
_optionalChain([onError, 'optionalCall', _21 => _21(msg, "STATUS_POLL_ERROR")]);
|
|
1442
1431
|
}
|
|
1443
1432
|
}
|
|
1444
1433
|
if (!cancelled && !depositHandledRef.current) {
|
|
@@ -1631,7 +1620,7 @@ function DepositAddressStep({
|
|
|
1631
1620
|
] }),
|
|
1632
1621
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1633
1622
|
] }) }),
|
|
1634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.PoweredBy, {})
|
|
1635
1624
|
] });
|
|
1636
1625
|
}
|
|
1637
1626
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1652,7 +1641,6 @@ function DepositFlow({
|
|
|
1652
1641
|
sourceToken: defaultSourceToken,
|
|
1653
1642
|
amount: defaultAmount,
|
|
1654
1643
|
recipient,
|
|
1655
|
-
rhinestoneApiKey,
|
|
1656
1644
|
signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
|
|
1657
1645
|
sessionChainIds,
|
|
1658
1646
|
forceRegister = false,
|
|
@@ -1677,17 +1665,16 @@ function DepositFlow({
|
|
|
1677
1665
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
1678
1666
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
1679
1667
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
1680
|
-
const targetChainObj = _react.useMemo.call(void 0, () => _chunkCEIWN53Ncjs.CHAIN_BY_ID[targetChain], [targetChain]);
|
|
1681
1668
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
1682
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1669
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _22 => _22.switchChain])) return void 0;
|
|
1683
1670
|
return async (chainId) => {
|
|
1684
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
1671
|
+
await _optionalChain([dappWalletClient, 'access', _23 => _23.switchChain, 'optionalCall', _24 => _24({ id: chainId })]);
|
|
1685
1672
|
};
|
|
1686
1673
|
}, [dappWalletClient]);
|
|
1687
1674
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
1688
1675
|
const options = [];
|
|
1689
1676
|
const seen = /* @__PURE__ */ new Set();
|
|
1690
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1677
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _25 => _25.account]) && dappAddress) {
|
|
1691
1678
|
options.push({
|
|
1692
1679
|
address: dappWalletClient.account.address,
|
|
1693
1680
|
label: "Connected Wallet",
|
|
@@ -1695,7 +1682,7 @@ function DepositFlow({
|
|
|
1695
1682
|
});
|
|
1696
1683
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
1697
1684
|
}
|
|
1698
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1685
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _26 => _26.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1699
1686
|
options.push({
|
|
1700
1687
|
address: reownWallet.address,
|
|
1701
1688
|
label: "External Wallet",
|
|
@@ -1706,10 +1693,10 @@ function DepositFlow({
|
|
|
1706
1693
|
}, [
|
|
1707
1694
|
dappWalletClient,
|
|
1708
1695
|
dappAddress,
|
|
1709
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1710
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1696
|
+
_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]),
|
|
1697
|
+
_optionalChain([reownWallet, 'optionalAccess', _28 => _28.isConnected])
|
|
1711
1698
|
]);
|
|
1712
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
1699
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _29 => _29.account]) && dappAddress && !reownWallet;
|
|
1713
1700
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1714
1701
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1715
1702
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
@@ -1718,30 +1705,30 @@ function DepositFlow({
|
|
|
1718
1705
|
return {
|
|
1719
1706
|
ownerAddress: dappAddress,
|
|
1720
1707
|
walletClient: void 0,
|
|
1721
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1708
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, targetChain))),
|
|
1722
1709
|
switchChain: void 0
|
|
1723
1710
|
};
|
|
1724
1711
|
}
|
|
1725
1712
|
if (canAutoLock) {
|
|
1726
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1713
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _30 => _30.chain, 'optionalAccess', _31 => _31.id]), () => ( targetChain));
|
|
1727
1714
|
return {
|
|
1728
1715
|
ownerAddress: dappWalletClient.account.address,
|
|
1729
1716
|
walletClient: dappWalletClient,
|
|
1730
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1717
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1731
1718
|
switchChain: dappSwitchChain
|
|
1732
1719
|
};
|
|
1733
1720
|
}
|
|
1734
1721
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
1735
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1736
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1722
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _32 => _32.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
1723
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _33 => _33.chain, 'optionalAccess', _34 => _34.id]), () => ( targetChain));
|
|
1737
1724
|
return {
|
|
1738
1725
|
ownerAddress: dappWalletClient.account.address,
|
|
1739
1726
|
walletClient: dappWalletClient,
|
|
1740
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1727
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1741
1728
|
switchChain: dappSwitchChain
|
|
1742
1729
|
};
|
|
1743
1730
|
}
|
|
1744
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1731
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _35 => _35.address, 'optionalAccess', _36 => _36.toLowerCase, 'call', _37 => _37()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
1745
1732
|
return {
|
|
1746
1733
|
ownerAddress: reownWallet.address,
|
|
1747
1734
|
walletClient: reownWallet.walletClient,
|
|
@@ -1762,7 +1749,7 @@ function DepositFlow({
|
|
|
1762
1749
|
reownWallet,
|
|
1763
1750
|
targetChain
|
|
1764
1751
|
]);
|
|
1765
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
1752
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _38 => _38.ownerAddress]))), () => ( null));
|
|
1766
1753
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
1767
1754
|
_react.useEffect.call(void 0, () => {
|
|
1768
1755
|
const prev = lastTargetRef.current;
|
|
@@ -1805,10 +1792,10 @@ function DepositFlow({
|
|
|
1805
1792
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : 4;
|
|
1806
1793
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
1807
1794
|
_react.useEffect.call(void 0, () => {
|
|
1808
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
1795
|
+
_optionalChain([onStepChange, 'optionalCall', _39 => _39(stepIndex, currentBackHandler)]);
|
|
1809
1796
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1810
1797
|
_react.useEffect.call(void 0, () => {
|
|
1811
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1798
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _40 => _40(totalBalanceUsd)]);
|
|
1812
1799
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1813
1800
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
1814
1801
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
@@ -1846,13 +1833,13 @@ function DepositFlow({
|
|
|
1846
1833
|
directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
|
|
1847
1834
|
};
|
|
1848
1835
|
});
|
|
1849
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1836
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _41 => _41({ txHash, sourceChain: chainId, amount })]);
|
|
1850
1837
|
},
|
|
1851
1838
|
[onDepositSubmitted, targetChain, targetToken]
|
|
1852
1839
|
);
|
|
1853
1840
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1854
1841
|
(addr, smartAccount) => {
|
|
1855
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1842
|
+
_optionalChain([onConnected, 'optionalCall', _42 => _42({ address: addr, smartAccount })]);
|
|
1856
1843
|
},
|
|
1857
1844
|
[onConnected]
|
|
1858
1845
|
);
|
|
@@ -1904,25 +1891,25 @@ function DepositFlow({
|
|
|
1904
1891
|
);
|
|
1905
1892
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
1906
1893
|
(txHash, sourceChain, amount) => {
|
|
1907
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1894
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _43 => _43({ txHash, sourceChain, amount })]);
|
|
1908
1895
|
},
|
|
1909
1896
|
[onDepositSubmitted]
|
|
1910
1897
|
);
|
|
1911
1898
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
1912
1899
|
(txHash, destinationTxHash) => {
|
|
1913
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1900
|
+
_optionalChain([onDepositComplete, 'optionalCall', _44 => _44({ txHash, destinationTxHash })]);
|
|
1914
1901
|
},
|
|
1915
1902
|
[onDepositComplete]
|
|
1916
1903
|
);
|
|
1917
1904
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
1918
1905
|
(txHash, error) => {
|
|
1919
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1906
|
+
_optionalChain([onDepositFailed, 'optionalCall', _45 => _45({ txHash, error })]);
|
|
1920
1907
|
},
|
|
1921
1908
|
[onDepositFailed]
|
|
1922
1909
|
);
|
|
1923
1910
|
const handleError = _react.useCallback.call(void 0,
|
|
1924
1911
|
(message, code) => {
|
|
1925
|
-
_optionalChain([onError, 'optionalCall',
|
|
1912
|
+
_optionalChain([onError, 'optionalCall', _46 => _46({ message, code })]);
|
|
1926
1913
|
},
|
|
1927
1914
|
[onError]
|
|
1928
1915
|
);
|
|
@@ -1945,7 +1932,7 @@ function DepositFlow({
|
|
|
1945
1932
|
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
1946
1933
|
if (showConnectStep) {
|
|
1947
1934
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1948
|
-
|
|
1935
|
+
_chunkVW3QQWELcjs.ConnectStep,
|
|
1949
1936
|
{
|
|
1950
1937
|
walletOptions,
|
|
1951
1938
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1970,14 +1957,12 @@ function DepositFlow({
|
|
|
1970
1957
|
if (isDepositAddressMode) {
|
|
1971
1958
|
if (!dappAddress || !sessionKeyAddress) return null;
|
|
1972
1959
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1973
|
-
step.type === "setup" &&
|
|
1960
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1974
1961
|
SetupStep,
|
|
1975
1962
|
{
|
|
1976
1963
|
address: sessionKeyAddress,
|
|
1977
1964
|
targetChain,
|
|
1978
|
-
targetChainObj,
|
|
1979
1965
|
targetToken,
|
|
1980
|
-
rhinestoneApiKey,
|
|
1981
1966
|
signerAddress,
|
|
1982
1967
|
sessionChainIds,
|
|
1983
1968
|
recipient,
|
|
@@ -1998,7 +1983,7 @@ function DepositFlow({
|
|
|
1998
1983
|
}
|
|
1999
1984
|
),
|
|
2000
1985
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2001
|
-
|
|
1986
|
+
_chunkVW3QQWELcjs.ProcessingStep,
|
|
2002
1987
|
{
|
|
2003
1988
|
smartAccount: step.smartAccount,
|
|
2004
1989
|
txHash: step.txHash,
|
|
@@ -2020,27 +2005,25 @@ function DepositFlow({
|
|
|
2020
2005
|
)
|
|
2021
2006
|
] });
|
|
2022
2007
|
}
|
|
2023
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
2008
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _47 => _47.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _48 => _48.publicClient])) {
|
|
2024
2009
|
return null;
|
|
2025
2010
|
}
|
|
2026
2011
|
const ownerAddress = signerContext.ownerAddress;
|
|
2027
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
2012
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _49 => _49.walletClient, 'optionalAccess', _50 => _50.chain, 'optionalAccess', _51 => _51.id]), () => ( _optionalChain([signerContext, 'access', _52 => _52.publicClient, 'access', _53 => _53.chain, 'optionalAccess', _54 => _54.id]))), () => ( targetChain));
|
|
2028
2013
|
const getReadClientForChain = (chainId) => {
|
|
2029
|
-
if (_optionalChain([signerContext, 'access',
|
|
2014
|
+
if (_optionalChain([signerContext, 'access', _55 => _55.publicClient, 'access', _56 => _56.chain, 'optionalAccess', _57 => _57.id]) === chainId) {
|
|
2030
2015
|
return signerContext.publicClient;
|
|
2031
2016
|
}
|
|
2032
|
-
return
|
|
2017
|
+
return _chunkVW3QQWELcjs.getPublicClient.call(void 0, chainId);
|
|
2033
2018
|
};
|
|
2034
2019
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2035
|
-
step.type === "setup" &&
|
|
2020
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2036
2021
|
SetupStep,
|
|
2037
2022
|
{
|
|
2038
2023
|
walletClient: signerContext.walletClient,
|
|
2039
2024
|
address: ownerAddress,
|
|
2040
2025
|
targetChain,
|
|
2041
|
-
targetChainObj,
|
|
2042
2026
|
targetToken,
|
|
2043
|
-
rhinestoneApiKey,
|
|
2044
2027
|
signerAddress,
|
|
2045
2028
|
sessionChainIds,
|
|
2046
2029
|
recipient,
|
|
@@ -2097,7 +2080,7 @@ function DepositFlow({
|
|
|
2097
2080
|
}
|
|
2098
2081
|
),
|
|
2099
2082
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2100
|
-
|
|
2083
|
+
_chunkVW3QQWELcjs.ProcessingStep,
|
|
2101
2084
|
{
|
|
2102
2085
|
smartAccount: step.smartAccount,
|
|
2103
2086
|
txHash: step.txHash,
|
|
@@ -2122,7 +2105,7 @@ function DepositFlow({
|
|
|
2122
2105
|
// src/DepositModal.tsx
|
|
2123
2106
|
|
|
2124
2107
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2125
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2108
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-6IXFIXR6.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2126
2109
|
);
|
|
2127
2110
|
function DepositModal(props) {
|
|
2128
2111
|
const needsReown = !!props.reownAppId;
|
|
@@ -2146,7 +2129,6 @@ function DepositModalInner({
|
|
|
2146
2129
|
defaultAmount,
|
|
2147
2130
|
recipient,
|
|
2148
2131
|
backendUrl = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL,
|
|
2149
|
-
rhinestoneApiKey,
|
|
2150
2132
|
signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
|
|
2151
2133
|
sessionChainIds,
|
|
2152
2134
|
forceRegister = false,
|
|
@@ -2173,17 +2155,17 @@ function DepositModalInner({
|
|
|
2173
2155
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2174
2156
|
const targetChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, targetChainProp);
|
|
2175
2157
|
const sourceChain = sourceChainProp ? _chunkCEIWN53Ncjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2176
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2158
|
+
const service = _react.useMemo.call(void 0, () => _chunkVW3QQWELcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2177
2159
|
_react.useEffect.call(void 0, () => {
|
|
2178
2160
|
if (isOpen && modalRef.current) {
|
|
2179
|
-
|
|
2161
|
+
_chunkVW3QQWELcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2180
2162
|
}
|
|
2181
2163
|
}, [isOpen, theme]);
|
|
2182
2164
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
2183
2165
|
_react.useEffect.call(void 0, () => {
|
|
2184
2166
|
if (isOpen && !hasCalledReady.current) {
|
|
2185
2167
|
hasCalledReady.current = true;
|
|
2186
|
-
_optionalChain([onReady, 'optionalCall',
|
|
2168
|
+
_optionalChain([onReady, 'optionalCall', _58 => _58()]);
|
|
2187
2169
|
}
|
|
2188
2170
|
}, [isOpen, onReady]);
|
|
2189
2171
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2202,17 +2184,17 @@ function DepositModalInner({
|
|
|
2202
2184
|
setTotalBalanceUsd(balance);
|
|
2203
2185
|
}, []);
|
|
2204
2186
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
2205
|
-
_optionalChain([backHandlerRef, 'access',
|
|
2187
|
+
_optionalChain([backHandlerRef, 'access', _59 => _59.current, 'optionalCall', _60 => _60()]);
|
|
2206
2188
|
}, []);
|
|
2207
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2208
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2209
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2210
|
-
const balanceTitle = _optionalChain([uiConfig, 'optionalAccess',
|
|
2211
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2212
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2189
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _61 => _61.showLogo]), () => ( false));
|
|
2190
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _62 => _62.showStepper]), () => ( false));
|
|
2191
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _63 => _63.showBackButton]), () => ( true));
|
|
2192
|
+
const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _64 => _64.balanceTitle]);
|
|
2193
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _65 => _65.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
2194
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _66 => _66.title]), () => ( "Deposit"));
|
|
2213
2195
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2214
2196
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2215
|
-
|
|
2197
|
+
_chunkVW3QQWELcjs.Modal,
|
|
2216
2198
|
{
|
|
2217
2199
|
isOpen,
|
|
2218
2200
|
onClose,
|
|
@@ -2273,7 +2255,7 @@ function DepositModalInner({
|
|
|
2273
2255
|
balanceTitle,
|
|
2274
2256
|
":"
|
|
2275
2257
|
] }),
|
|
2276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
2258
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkVW3QQWELcjs.currencyFormatter.format(totalBalanceUsd) })
|
|
2277
2259
|
] })
|
|
2278
2260
|
] }),
|
|
2279
2261
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2316,7 +2298,6 @@ function DepositModalInner({
|
|
|
2316
2298
|
sourceToken,
|
|
2317
2299
|
amount: defaultAmount,
|
|
2318
2300
|
recipient,
|
|
2319
|
-
rhinestoneApiKey,
|
|
2320
2301
|
signerAddress,
|
|
2321
2302
|
sessionChainIds,
|
|
2322
2303
|
forceRegister,
|