@rhinestone/deposit-modal 0.3.0-alpha.2 → 0.3.0-alpha.3
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-VFTXYG2B.mjs → DepositModalReown-6QBOLFNL.mjs} +2 -2
- package/dist/{DepositModalReown-B2XLFH4Z.cjs → DepositModalReown-DVRWDPYV.cjs} +3 -3
- package/dist/{WithdrawModalReown-K52AK53K.cjs → WithdrawModalReown-KGFCNAJP.cjs} +3 -3
- package/dist/{WithdrawModalReown-BDJFCWWM.mjs → WithdrawModalReown-UO7XCJ7K.mjs} +2 -2
- package/dist/{chunk-TWA3SXVV.mjs → chunk-GE3TMZEL.mjs} +17 -291
- package/dist/{chunk-BLAGBBMP.cjs → chunk-IATY2C5R.cjs} +1738 -764
- package/dist/{chunk-AHSVY7AE.mjs → chunk-QLTTDVFU.mjs} +1947 -973
- package/dist/{chunk-XKDZEIB7.mjs → chunk-TFXIQ7YH.mjs} +547 -192
- package/dist/{chunk-ZMNFBFIR.cjs → chunk-UEYFJM5Y.cjs} +69 -343
- package/dist/{chunk-FTMCKJM4.cjs → chunk-V6NJIPSS.cjs} +510 -155
- 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/styles.css +13 -1
- package/dist/{types-DRou84ZM.d.cts → types-xSHZSlrT.d.cts} +16 -1
- package/dist/{types-DRou84ZM.d.ts → types-xSHZSlrT.d.ts} +16 -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 +1 -1
|
@@ -45,7 +45,10 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var _chunkV6NJIPSScjs = require('./chunk-V6NJIPSS.cjs');
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
|
|
@@ -81,198 +84,10 @@ var _react = require('react');
|
|
|
81
84
|
|
|
82
85
|
var _viem = require('viem');
|
|
83
86
|
|
|
84
|
-
// src/components/steps/SetupStep.tsx
|
|
85
|
-
|
|
86
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
87
|
-
async function resolveSessionOwner(eoaAddress) {
|
|
88
|
-
const localOwner = _chunkFTMCKJM4cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
89
|
-
if (localOwner) {
|
|
90
|
-
return {
|
|
91
|
-
account: _chunkFTMCKJM4cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
92
|
-
address: localOwner.address
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
const created = _chunkFTMCKJM4cjs.createSessionOwnerKey.call(void 0, );
|
|
96
|
-
_chunkFTMCKJM4cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
97
|
-
return {
|
|
98
|
-
account: created.account,
|
|
99
|
-
address: created.address
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function SetupStep({
|
|
103
|
-
walletClient,
|
|
104
|
-
address,
|
|
105
|
-
targetChain,
|
|
106
|
-
targetToken,
|
|
107
|
-
signerAddress,
|
|
108
|
-
sessionChainIds,
|
|
109
|
-
recipient,
|
|
110
|
-
postBridgeActions,
|
|
111
|
-
outputTokenRules,
|
|
112
|
-
rejectUnmapped,
|
|
113
|
-
forceRegister,
|
|
114
|
-
enableSolana = true,
|
|
115
|
-
service,
|
|
116
|
-
onSetupComplete,
|
|
117
|
-
onError,
|
|
118
|
-
onConnected
|
|
119
|
-
}) {
|
|
120
|
-
const [state, setState] = _react.useState.call(void 0, { type: "idle" });
|
|
121
|
-
const setupInitiatedRef = _react.useRef.call(void 0, false);
|
|
122
|
-
const runSetup = _react.useCallback.call(void 0, async () => {
|
|
123
|
-
if (!address) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (walletClient && !walletClient.account) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
setState({ type: "creating-account" });
|
|
131
|
-
const sessionOwner = await resolveSessionOwner(address);
|
|
132
|
-
const setup = await service.setupAccount({
|
|
133
|
-
ownerAddress: address,
|
|
134
|
-
sessionOwnerAddress: sessionOwner.address,
|
|
135
|
-
targetChain: _chunkFTMCKJM4cjs.toEvmCaip2.call(void 0, targetChain),
|
|
136
|
-
targetToken,
|
|
137
|
-
recipient,
|
|
138
|
-
postBridgeActions,
|
|
139
|
-
outputTokenRules,
|
|
140
|
-
rejectUnmapped,
|
|
141
|
-
signerAddress,
|
|
142
|
-
sessionChainIds,
|
|
143
|
-
forceRegister
|
|
144
|
-
});
|
|
145
|
-
const smartAccount = setup.smartAccount;
|
|
146
|
-
if (!setup.needsRegistration) {
|
|
147
|
-
setState({ type: "ready", smartAccount });
|
|
148
|
-
_optionalChain([onConnected, 'optionalCall', _ => _(address, smartAccount)]);
|
|
149
|
-
onSetupComplete(
|
|
150
|
-
smartAccount,
|
|
151
|
-
enableSolana ? setup.solanaDepositAddress : void 0
|
|
152
|
-
);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
setState({ type: "signing-session" });
|
|
156
|
-
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
157
|
-
throw new Error("Missing registration payload from setup-account");
|
|
158
|
-
}
|
|
159
|
-
if (!sessionOwner.account.signTypedData) {
|
|
160
|
-
throw new Error("Session owner account does not support signTypedData");
|
|
161
|
-
}
|
|
162
|
-
const typedData = setup.sessionDetailsUnsigned.data;
|
|
163
|
-
const signature = await sessionOwner.account.signTypedData({
|
|
164
|
-
domain: typedData.domain,
|
|
165
|
-
types: typedData.types,
|
|
166
|
-
primaryType: typedData.primaryType,
|
|
167
|
-
message: typedData.message
|
|
168
|
-
});
|
|
169
|
-
const sessionDetails = _chunkFTMCKJM4cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
170
|
-
setState({ type: "registering" });
|
|
171
|
-
const registerResult = await service.registerAccount({
|
|
172
|
-
address: smartAccount,
|
|
173
|
-
accountParams: {
|
|
174
|
-
factory: setup.accountParams.factory,
|
|
175
|
-
factoryData: setup.accountParams.factoryData,
|
|
176
|
-
sessionDetails
|
|
177
|
-
},
|
|
178
|
-
eoaAddress: address,
|
|
179
|
-
sessionOwner: sessionOwner.address,
|
|
180
|
-
target: {
|
|
181
|
-
chain: _chunkFTMCKJM4cjs.toEvmCaip2.call(void 0, targetChain),
|
|
182
|
-
token: targetToken,
|
|
183
|
-
...recipient && { recipient },
|
|
184
|
-
..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions },
|
|
185
|
-
..._optionalChain([outputTokenRules, 'optionalAccess', _3 => _3.length]) && { outputTokenRules },
|
|
186
|
-
...rejectUnmapped != null && { rejectUnmapped }
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
setState({ type: "ready", smartAccount });
|
|
190
|
-
_optionalChain([onConnected, 'optionalCall', _4 => _4(address, smartAccount)]);
|
|
191
|
-
onSetupComplete(
|
|
192
|
-
smartAccount,
|
|
193
|
-
enableSolana ? registerResult.solanaDepositAddress : void 0
|
|
194
|
-
);
|
|
195
|
-
} catch (error) {
|
|
196
|
-
const message = error instanceof Error ? error.message : "Setup failed";
|
|
197
|
-
setState({ type: "error", message });
|
|
198
|
-
_optionalChain([onError, 'optionalCall', _5 => _5(message, "SETUP_ERROR")]);
|
|
199
|
-
}
|
|
200
|
-
}, [
|
|
201
|
-
address,
|
|
202
|
-
walletClient,
|
|
203
|
-
targetChain,
|
|
204
|
-
targetToken,
|
|
205
|
-
signerAddress,
|
|
206
|
-
sessionChainIds,
|
|
207
|
-
recipient,
|
|
208
|
-
postBridgeActions,
|
|
209
|
-
outputTokenRules,
|
|
210
|
-
rejectUnmapped,
|
|
211
|
-
forceRegister,
|
|
212
|
-
enableSolana,
|
|
213
|
-
service,
|
|
214
|
-
onSetupComplete,
|
|
215
|
-
onError,
|
|
216
|
-
onConnected
|
|
217
|
-
]);
|
|
218
|
-
_react.useEffect.call(void 0, () => {
|
|
219
|
-
const hasWallet = walletClient ? Boolean(walletClient.account) : true;
|
|
220
|
-
if (address && hasWallet && !setupInitiatedRef.current && state.type === "idle") {
|
|
221
|
-
setupInitiatedRef.current = true;
|
|
222
|
-
runSetup();
|
|
223
|
-
}
|
|
224
|
-
}, [address, walletClient, state.type, runSetup]);
|
|
225
|
-
const handleRetry = () => {
|
|
226
|
-
setupInitiatedRef.current = false;
|
|
227
|
-
setState({ type: "idle" });
|
|
228
|
-
};
|
|
229
|
-
const renderStateMessage = () => {
|
|
230
|
-
switch (state.type) {
|
|
231
|
-
case "idle":
|
|
232
|
-
return "Preparing...";
|
|
233
|
-
case "creating-account":
|
|
234
|
-
return "Preparing your deposit account...";
|
|
235
|
-
case "signing-session":
|
|
236
|
-
return "Authorizing your deposit session...";
|
|
237
|
-
case "registering":
|
|
238
|
-
return "Finalizing setup...";
|
|
239
|
-
case "ready":
|
|
240
|
-
return "Account ready!";
|
|
241
|
-
case "error":
|
|
242
|
-
return state.message;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
const isLoading = state.type === "idle" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
246
|
-
const isError = state.type === "error";
|
|
247
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
248
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
249
|
-
isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
-
_chunkFTMCKJM4cjs.BodyHeader,
|
|
251
|
-
{
|
|
252
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
253
|
-
title: renderStateMessage(),
|
|
254
|
-
subtitle: "This may take a moment"
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
258
|
-
_chunkFTMCKJM4cjs.BodyHeader,
|
|
259
|
-
{
|
|
260
|
-
variant: "error",
|
|
261
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, {}),
|
|
262
|
-
title: "Setup failed",
|
|
263
|
-
subtitle: state.message
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
] }),
|
|
267
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) }),
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
|
|
269
|
-
] });
|
|
270
|
-
}
|
|
271
|
-
|
|
272
87
|
// src/components/steps/AssetSelectStep.tsx
|
|
273
88
|
|
|
274
89
|
|
|
275
|
-
|
|
90
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
276
91
|
function AssetSelectStep({
|
|
277
92
|
address,
|
|
278
93
|
publicClient,
|
|
@@ -291,7 +106,7 @@ function AssetSelectStep({
|
|
|
291
106
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
292
107
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
293
108
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
294
|
-
return
|
|
109
|
+
return _chunkV6NJIPSScjs.getAssetId.call(void 0, {
|
|
295
110
|
chainId: defaultSourceChain,
|
|
296
111
|
token: defaultSourceToken
|
|
297
112
|
});
|
|
@@ -308,7 +123,7 @@ function AssetSelectStep({
|
|
|
308
123
|
try {
|
|
309
124
|
const portfolio = await service.fetchPortfolio(address);
|
|
310
125
|
if (!active) return;
|
|
311
|
-
const portfolioAssets =
|
|
126
|
+
const portfolioAssets = _chunkV6NJIPSScjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
312
127
|
setAssets(portfolioAssets);
|
|
313
128
|
const hasNative = portfolioAssets.some(
|
|
314
129
|
(asset) => asset.token.toLowerCase() === _chunkIVTXEYB2cjs.NATIVE_TOKEN_ADDRESS
|
|
@@ -349,16 +164,16 @@ function AssetSelectStep({
|
|
|
349
164
|
(sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
|
|
350
165
|
0
|
|
351
166
|
);
|
|
352
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
353
|
-
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall',
|
|
167
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _ => _(total)]);
|
|
168
|
+
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _2 => _2(assets)]);
|
|
354
169
|
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
355
170
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
356
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
357
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
171
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _3 => _3.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
172
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _4 => _4.sourceChains])]
|
|
358
173
|
);
|
|
359
174
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
360
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
361
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
175
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _5 => _5.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
176
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _6 => _6.sourceTokens])]
|
|
362
177
|
);
|
|
363
178
|
const rows = _react.useMemo.call(void 0, () => {
|
|
364
179
|
return assets.filter((a) => {
|
|
@@ -389,7 +204,7 @@ function AssetSelectStep({
|
|
|
389
204
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
390
205
|
const numeric = Number(raw);
|
|
391
206
|
if (!Number.isFinite(numeric)) return raw;
|
|
392
|
-
return
|
|
207
|
+
return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
|
|
393
208
|
} catch (e3) {
|
|
394
209
|
return asset.balance;
|
|
395
210
|
}
|
|
@@ -397,20 +212,20 @@ function AssetSelectStep({
|
|
|
397
212
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
398
213
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
399
214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
400
|
-
|
|
215
|
+
_chunkV6NJIPSScjs.BodyHeader,
|
|
401
216
|
{
|
|
402
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}),
|
|
403
218
|
title: "Your assets",
|
|
404
219
|
subtitle: "Select source assets to transfer"
|
|
405
220
|
}
|
|
406
221
|
),
|
|
407
222
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-text-tertiary" }),
|
|
409
224
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
410
225
|
] }),
|
|
411
226
|
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 }) }),
|
|
412
227
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
413
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
414
229
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
415
230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
416
231
|
address.slice(0, 6),
|
|
@@ -477,14 +292,14 @@ function AssetSelectStep({
|
|
|
477
292
|
] })
|
|
478
293
|
] })
|
|
479
294
|
] }),
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
295
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
481
296
|
]
|
|
482
297
|
},
|
|
483
298
|
asset.id
|
|
484
299
|
);
|
|
485
300
|
}) }),
|
|
486
301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
|
-
|
|
302
|
+
_chunkV6NJIPSScjs.Button,
|
|
488
303
|
{
|
|
489
304
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
490
305
|
disabled: !selectedAsset,
|
|
@@ -493,15 +308,15 @@ function AssetSelectStep({
|
|
|
493
308
|
}
|
|
494
309
|
)
|
|
495
310
|
] }),
|
|
496
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
311
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
497
312
|
] });
|
|
498
313
|
}
|
|
499
314
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
500
315
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
501
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
316
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _7 => _7.chain, 'optionalAccess', _8 => _8.id]);
|
|
502
317
|
if (!connectedChainId) return [];
|
|
503
318
|
if (!_chunkIVTXEYB2cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
504
|
-
const id =
|
|
319
|
+
const id = _chunkV6NJIPSScjs.getAssetId.call(void 0, {
|
|
505
320
|
chainId: connectedChainId,
|
|
506
321
|
token: _chunkIVTXEYB2cjs.NATIVE_TOKEN_ADDRESS
|
|
507
322
|
});
|
|
@@ -559,6 +374,7 @@ function AmountStep({
|
|
|
559
374
|
address,
|
|
560
375
|
balanceAddress,
|
|
561
376
|
asset,
|
|
377
|
+
liquiditySource,
|
|
562
378
|
defaultAmount,
|
|
563
379
|
switchChain,
|
|
564
380
|
targetChain,
|
|
@@ -577,7 +393,7 @@ function AmountStep({
|
|
|
577
393
|
const [isCheckingLiquidity, setIsCheckingLiquidity] = _react.useState.call(void 0, false);
|
|
578
394
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
579
395
|
const chainMismatch = Boolean(
|
|
580
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
396
|
+
_optionalChain([walletClient, 'optionalAccess', _9 => _9.chain, 'optionalAccess', _10 => _10.id]) && walletClient.chain.id !== asset.chainId
|
|
581
397
|
);
|
|
582
398
|
const targetSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
583
399
|
const isSourceStablecoin = _chunkIVTXEYB2cjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
@@ -604,7 +420,7 @@ function AmountStep({
|
|
|
604
420
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
605
421
|
if (!balanceTarget || !publicClient) return;
|
|
606
422
|
try {
|
|
607
|
-
const bal =
|
|
423
|
+
const bal = _chunkV6NJIPSScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
608
424
|
address: asset.token,
|
|
609
425
|
abi: _viem.erc20Abi,
|
|
610
426
|
functionName: "balanceOf",
|
|
@@ -625,7 +441,7 @@ function AmountStep({
|
|
|
625
441
|
hasAttemptedSwitch.current = true;
|
|
626
442
|
switchChain(asset.chainId).catch((err) => {
|
|
627
443
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
628
|
-
setError(
|
|
444
|
+
setError(_chunkV6NJIPSScjs.formatUserError.call(void 0, raw));
|
|
629
445
|
});
|
|
630
446
|
}
|
|
631
447
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -651,7 +467,7 @@ function AmountStep({
|
|
|
651
467
|
}
|
|
652
468
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
653
469
|
_react.useEffect.call(void 0, () => {
|
|
654
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
470
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _11 => _11(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
655
471
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
656
472
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
657
473
|
if (balance === null) return "\u2026";
|
|
@@ -659,7 +475,7 @@ function AmountStep({
|
|
|
659
475
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
660
476
|
const numeric = Number(raw);
|
|
661
477
|
if (!Number.isFinite(numeric)) return raw;
|
|
662
|
-
return
|
|
478
|
+
return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
|
|
663
479
|
} catch (e8) {
|
|
664
480
|
return "\u2026";
|
|
665
481
|
}
|
|
@@ -678,8 +494,8 @@ function AmountStep({
|
|
|
678
494
|
return null;
|
|
679
495
|
}
|
|
680
496
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
|
|
681
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
682
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
497
|
+
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]), () => ( null));
|
|
498
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _13 => _13.maxDepositUsd]), () => ( null));
|
|
683
499
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
|
|
684
500
|
const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
|
|
685
501
|
const exceedsBalance = Boolean(
|
|
@@ -688,7 +504,7 @@ function AmountStep({
|
|
|
688
504
|
const balanceAfterUsd = targetBalanceUsd !== void 0 ? targetBalanceUsd + numericAmount : null;
|
|
689
505
|
const handlePresetClick = (percentage) => {
|
|
690
506
|
if (balance === null) return;
|
|
691
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
507
|
+
_optionalChain([onCtaClick, 'optionalCall', _14 => _14(percentage === 100 ? "Max" : `${percentage}%`)]);
|
|
692
508
|
const next = formatAmountFromBalance(
|
|
693
509
|
balance,
|
|
694
510
|
asset.decimals,
|
|
@@ -735,13 +551,13 @@ function AmountStep({
|
|
|
735
551
|
return;
|
|
736
552
|
}
|
|
737
553
|
setError(null);
|
|
738
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
554
|
+
_optionalChain([onCtaClick, 'optionalCall', _15 => _15("continue")]);
|
|
739
555
|
setIsCheckingLiquidity(true);
|
|
740
556
|
let liquidityWarning;
|
|
741
557
|
try {
|
|
742
558
|
const liquidity = await service.checkLiquidity({
|
|
743
|
-
sourceChainId: asset.chainId,
|
|
744
|
-
sourceToken: asset.token,
|
|
559
|
+
sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _16 => _16.chainId]), () => ( asset.chainId)),
|
|
560
|
+
sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _17 => _17.token]), () => ( asset.token)),
|
|
745
561
|
destinationChainId: targetChain,
|
|
746
562
|
destinationToken: targetToken,
|
|
747
563
|
amount: amountInUnits.toString()
|
|
@@ -778,7 +594,7 @@ function AmountStep({
|
|
|
778
594
|
const targetTokenIcon = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, targetSymbol);
|
|
779
595
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
780
596
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
781
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
597
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
782
598
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
783
599
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
784
600
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-row", children: [
|
|
@@ -804,13 +620,13 @@ function AmountStep({
|
|
|
804
620
|
" available",
|
|
805
621
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
806
622
|
" (~",
|
|
807
|
-
|
|
623
|
+
_chunkV6NJIPSScjs.currencyFormatter.format(balanceUsd),
|
|
808
624
|
")"
|
|
809
625
|
] })
|
|
810
626
|
] }),
|
|
811
627
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
812
628
|
"Min. deposit ",
|
|
813
|
-
|
|
629
|
+
_chunkV6NJIPSScjs.currencyFormatter.format(minDepositUsd)
|
|
814
630
|
] })
|
|
815
631
|
] })
|
|
816
632
|
] }),
|
|
@@ -851,15 +667,15 @@ function AmountStep({
|
|
|
851
667
|
] }),
|
|
852
668
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
853
669
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
670
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkV6NJIPSScjs.currencyFormatter.format(balanceAfterUsd) })
|
|
855
671
|
] })
|
|
856
672
|
] }),
|
|
857
673
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
|
|
858
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
674
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
859
675
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
860
676
|
] }),
|
|
861
677
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
862
|
-
|
|
678
|
+
_chunkV6NJIPSScjs.Button,
|
|
863
679
|
{
|
|
864
680
|
onClick: handleContinue,
|
|
865
681
|
fullWidth: true,
|
|
@@ -868,7 +684,7 @@ function AmountStep({
|
|
|
868
684
|
}
|
|
869
685
|
)
|
|
870
686
|
] }),
|
|
871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
872
688
|
] });
|
|
873
689
|
}
|
|
874
690
|
|
|
@@ -876,6 +692,13 @@ function AmountStep({
|
|
|
876
692
|
|
|
877
693
|
|
|
878
694
|
|
|
695
|
+
// src/core/dapp-imports/types.ts
|
|
696
|
+
function isDappImportAsset(asset) {
|
|
697
|
+
return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// src/components/steps/ConfirmStep.tsx
|
|
701
|
+
|
|
879
702
|
function ConfirmStep({
|
|
880
703
|
walletClient,
|
|
881
704
|
address,
|
|
@@ -896,13 +719,14 @@ function ConfirmStep({
|
|
|
896
719
|
quotedFeeSymbol,
|
|
897
720
|
onConfirm,
|
|
898
721
|
onError,
|
|
899
|
-
onDepositSubmitted
|
|
722
|
+
onDepositSubmitted,
|
|
723
|
+
executeTransfer
|
|
900
724
|
}) {
|
|
901
725
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
902
726
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
903
727
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
904
728
|
const chainMismatch = Boolean(
|
|
905
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
729
|
+
_optionalChain([walletClient, 'optionalAccess', _18 => _18.chain, 'optionalAccess', _19 => _19.id]) && walletClient.chain.id !== asset.chainId
|
|
906
730
|
);
|
|
907
731
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
908
732
|
const targetSymbol = sameRoute ? asset.symbol : _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
@@ -925,15 +749,14 @@ function ConfirmStep({
|
|
|
925
749
|
return formattedSendAmount;
|
|
926
750
|
})();
|
|
927
751
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
928
|
-
const
|
|
929
|
-
const
|
|
930
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _24 => _24.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
752
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _20 => _20.feeSponsored]), () => ( false));
|
|
753
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _21 => _21.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
931
754
|
_react.useEffect.call(void 0, () => {
|
|
932
755
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
933
756
|
hasAttemptedSwitch.current = true;
|
|
934
757
|
switchChain(asset.chainId).catch((err) => {
|
|
935
758
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
936
|
-
setError(
|
|
759
|
+
setError(_chunkV6NJIPSScjs.formatUserError.call(void 0, raw));
|
|
937
760
|
});
|
|
938
761
|
}
|
|
939
762
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -974,33 +797,43 @@ function ConfirmStep({
|
|
|
974
797
|
throw new Error("Wallet not properly connected");
|
|
975
798
|
}
|
|
976
799
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
800
|
+
let hash;
|
|
801
|
+
let resolvedSourceToken = asset.token;
|
|
802
|
+
if (executeTransfer) {
|
|
803
|
+
const result = await executeTransfer(amountUnits);
|
|
804
|
+
hash = result.txHash;
|
|
805
|
+
resolvedSourceToken = result.sourceToken;
|
|
806
|
+
} else if (_chunkV6NJIPSScjs.isNativeAsset.call(void 0, asset)) {
|
|
807
|
+
hash = await walletClient.sendTransaction({
|
|
808
|
+
account,
|
|
809
|
+
chain,
|
|
810
|
+
to: transferTo,
|
|
811
|
+
value: amountUnits
|
|
812
|
+
});
|
|
813
|
+
} else {
|
|
814
|
+
hash = await walletClient.writeContract({
|
|
815
|
+
account,
|
|
816
|
+
chain,
|
|
817
|
+
address: asset.token,
|
|
818
|
+
abi: _viem.erc20Abi,
|
|
819
|
+
functionName: "transfer",
|
|
820
|
+
args: [transferTo, amountUnits]
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _22 => _22(hash, asset.chainId, amountUnits.toString())]);
|
|
824
|
+
onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
|
|
992
825
|
} catch (err) {
|
|
993
826
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
994
|
-
const message =
|
|
827
|
+
const message = _chunkV6NJIPSScjs.formatUserError.call(void 0, raw);
|
|
995
828
|
setError(message);
|
|
996
|
-
_optionalChain([onError, 'optionalCall',
|
|
829
|
+
_optionalChain([onError, 'optionalCall', _23 => _23(message, "TRANSFER_ERROR")]);
|
|
997
830
|
} finally {
|
|
998
831
|
setIsSubmitting(false);
|
|
999
832
|
}
|
|
1000
833
|
};
|
|
1001
834
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
1002
835
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
1003
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
836
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Review deposit" }),
|
|
1004
837
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-details", children: [
|
|
1005
838
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
1006
839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -1045,31 +878,37 @@ function ConfirmStep({
|
|
|
1045
878
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
1046
879
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
1047
880
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
1048
|
-
/* @__PURE__ */ _jsxruntime.
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1049
882
|
"span",
|
|
1050
883
|
{
|
|
1051
884
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
1052
|
-
children:
|
|
1053
|
-
quotedFeeAmount,
|
|
1054
|
-
" ",
|
|
1055
|
-
feeSymbol
|
|
1056
|
-
]
|
|
885
|
+
children: "$0.05"
|
|
1057
886
|
}
|
|
1058
887
|
),
|
|
1059
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
888
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, {}) }) })
|
|
1060
889
|
] })
|
|
1061
890
|
] })
|
|
1062
891
|
] }),
|
|
1063
|
-
liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") &&
|
|
1064
|
-
|
|
892
|
+
liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && (isDappImportAsset(asset) ? (
|
|
893
|
+
// Dapp-import sources route through an unwrap before the
|
|
894
|
+
// orchestrator sees funds; the upstream route check often
|
|
895
|
+
// returns "unavailable" for the source token even though the
|
|
896
|
+
// post-unwrap route works. Surface as a soft warning rather
|
|
897
|
+
// than a red blocker until the orchestrator handles it.
|
|
898
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error rs-amount-error--warning", role: "status", children: [
|
|
899
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
900
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Low liquidity detected \u2014 deposit may take longer" })
|
|
901
|
+
] })
|
|
902
|
+
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "status", children: [
|
|
903
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
1065
904
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
|
|
1066
|
-
] }),
|
|
905
|
+
] })),
|
|
1067
906
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
1069
908
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
1070
909
|
] }),
|
|
1071
910
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
|
|
911
|
+
_chunkV6NJIPSScjs.Button,
|
|
1073
912
|
{
|
|
1074
913
|
onClick: handleConfirm,
|
|
1075
914
|
loading: isSubmitting,
|
|
@@ -1080,7 +919,7 @@ function ConfirmStep({
|
|
|
1080
919
|
}
|
|
1081
920
|
)
|
|
1082
921
|
] }),
|
|
1083
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
1084
923
|
] });
|
|
1085
924
|
}
|
|
1086
925
|
|
|
@@ -1103,9 +942,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
1103
942
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1104
943
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
1105
944
|
function isEventForTx(event, txHash) {
|
|
1106
|
-
const eventTxHash =
|
|
945
|
+
const eventTxHash = _chunkV6NJIPSScjs.getEventTxHash.call(void 0, event);
|
|
1107
946
|
if (!eventTxHash) return false;
|
|
1108
|
-
return
|
|
947
|
+
return _chunkV6NJIPSScjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1109
948
|
}
|
|
1110
949
|
function truncateHash(hash) {
|
|
1111
950
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -1135,7 +974,7 @@ function formatTimestamp(ms) {
|
|
|
1135
974
|
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1136
975
|
}
|
|
1137
976
|
function formatBridgeFailedMessage(event) {
|
|
1138
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
977
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _24 => _24.data]), () => ( {}));
|
|
1139
978
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1140
979
|
if (backendMessage.length > 0) {
|
|
1141
980
|
const lower = backendMessage.toLowerCase();
|
|
@@ -1155,7 +994,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
1155
994
|
}
|
|
1156
995
|
return "Bridge failed";
|
|
1157
996
|
}
|
|
1158
|
-
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
997
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
|
|
1159
998
|
function DepositNotification({
|
|
1160
999
|
deposit,
|
|
1161
1000
|
smartAccount,
|
|
@@ -1183,7 +1022,7 @@ function DepositNotification({
|
|
|
1183
1022
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1184
1023
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1185
1024
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1186
|
-
const depositContextRef =
|
|
1025
|
+
const depositContextRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, {
|
|
1187
1026
|
amount,
|
|
1188
1027
|
sourceChain,
|
|
1189
1028
|
sourceToken: token,
|
|
@@ -1192,8 +1031,8 @@ function DepositNotification({
|
|
|
1192
1031
|
waitForFinalTx,
|
|
1193
1032
|
hasPostBridgeActions
|
|
1194
1033
|
});
|
|
1195
|
-
const onCompleteRef =
|
|
1196
|
-
const onFailedRef =
|
|
1034
|
+
const onCompleteRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onComplete);
|
|
1035
|
+
const onFailedRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onFailed);
|
|
1197
1036
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1198
1037
|
(destTxHash) => {
|
|
1199
1038
|
if (completedRef.current) return;
|
|
@@ -1202,7 +1041,7 @@ function DepositNotification({
|
|
|
1202
1041
|
setCompletedAt(Date.now());
|
|
1203
1042
|
setStatus("complete");
|
|
1204
1043
|
const context = depositContextRef.current;
|
|
1205
|
-
_optionalChain([onCompleteRef, 'access',
|
|
1044
|
+
_optionalChain([onCompleteRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26(txHash, destTxHash, {
|
|
1206
1045
|
amount: context.amount,
|
|
1207
1046
|
sourceChain: context.sourceChain,
|
|
1208
1047
|
sourceToken: context.sourceToken,
|
|
@@ -1217,7 +1056,7 @@ function DepositNotification({
|
|
|
1217
1056
|
if (completedRef.current) return;
|
|
1218
1057
|
completedRef.current = true;
|
|
1219
1058
|
setStatus("failed");
|
|
1220
|
-
_optionalChain([onFailedRef, 'access',
|
|
1059
|
+
_optionalChain([onFailedRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28(txHash, error)]);
|
|
1221
1060
|
},
|
|
1222
1061
|
[onFailedRef, txHash]
|
|
1223
1062
|
);
|
|
@@ -1236,30 +1075,30 @@ function DepositNotification({
|
|
|
1236
1075
|
const lastEvent = data.lastEvent;
|
|
1237
1076
|
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1238
1077
|
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1239
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1240
|
-
const swapTxHash = _optionalChain([eventForTx, 'access',
|
|
1078
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _29 => _29.type]) === "post-bridge-swap-complete") {
|
|
1079
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _30 => _30.data, 'optionalAccess', _31 => _31.swap, 'optionalAccess', _32 => _32.transactionHash]);
|
|
1241
1080
|
handleComplete(swapTxHash);
|
|
1242
1081
|
return;
|
|
1243
1082
|
}
|
|
1244
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1083
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _33 => _33.type]) === "post-bridge-swap-failed") {
|
|
1245
1084
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1246
1085
|
return;
|
|
1247
1086
|
}
|
|
1248
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1249
|
-
const destTx = _optionalChain([eventForTx, 'access',
|
|
1087
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _34 => _34.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1088
|
+
const destTx = _optionalChain([eventForTx, 'access', _35 => _35.data, 'optionalAccess', _36 => _36.destination, 'optionalAccess', _37 => _37.transactionHash]);
|
|
1250
1089
|
handleComplete(destTx);
|
|
1251
1090
|
return;
|
|
1252
1091
|
}
|
|
1253
|
-
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess',
|
|
1092
|
+
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _38 => _38.type]) === "bridge-started") {
|
|
1254
1093
|
handleComplete(void 0);
|
|
1255
1094
|
return;
|
|
1256
1095
|
}
|
|
1257
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1096
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _39 => _39.type]) === "bridge-failed") {
|
|
1258
1097
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1259
1098
|
return;
|
|
1260
1099
|
}
|
|
1261
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1262
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access',
|
|
1100
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _40 => _40.type]) === "error") {
|
|
1101
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _41 => _41.data, 'optionalAccess', _42 => _42.message]), () => ( "Unknown error"));
|
|
1263
1102
|
handleFailed(errorMessage);
|
|
1264
1103
|
return;
|
|
1265
1104
|
}
|
|
@@ -1301,7 +1140,7 @@ function DepositNotification({
|
|
|
1301
1140
|
const destExplorerUrl = destinationTxHash ? _chunkIVTXEYB2cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1302
1141
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1303
1142
|
const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
|
|
1304
|
-
const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
+
const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, {}) });
|
|
1305
1144
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1306
1145
|
"div",
|
|
1307
1146
|
{
|
|
@@ -1320,7 +1159,7 @@ function DepositNotification({
|
|
|
1320
1159
|
className: "rs-deposit-notification-close",
|
|
1321
1160
|
onClick: () => onDismiss(deposit.id),
|
|
1322
1161
|
"aria-label": "Dismiss",
|
|
1323
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1162
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
|
|
1324
1163
|
}
|
|
1325
1164
|
)
|
|
1326
1165
|
] }),
|
|
@@ -1409,7 +1248,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
1409
1248
|
var configuredSolanaRpcUrl = null;
|
|
1410
1249
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1411
1250
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
1412
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
1251
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
|
|
1413
1252
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1414
1253
|
cachedConnections.clear();
|
|
1415
1254
|
}
|
|
@@ -1547,7 +1386,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1547
1386
|
return {};
|
|
1548
1387
|
}
|
|
1549
1388
|
function getDepositEventDetails(event) {
|
|
1550
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1389
|
+
if (!_optionalChain([event, 'optionalAccess', _45 => _45.type]) || !isRecord(event.data)) return {};
|
|
1551
1390
|
if (event.type === "deposit-received") {
|
|
1552
1391
|
const chainId = asChainId(event.data.chain);
|
|
1553
1392
|
const token = asString(event.data.token);
|
|
@@ -1561,12 +1400,12 @@ function getDepositEventDetails(event) {
|
|
|
1561
1400
|
}
|
|
1562
1401
|
if (event.type === "bridge-started") {
|
|
1563
1402
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1564
|
-
const chainId = asChainId(_optionalChain([source, 'optionalAccess',
|
|
1565
|
-
const token = asString(_optionalChain([source, 'optionalAccess',
|
|
1403
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _46 => _46.chain]));
|
|
1404
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _47 => _47.asset]));
|
|
1566
1405
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1567
1406
|
return {
|
|
1568
1407
|
chainId,
|
|
1569
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1408
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _48 => _48.amount])),
|
|
1570
1409
|
token,
|
|
1571
1410
|
...solanaMeta
|
|
1572
1411
|
};
|
|
@@ -1590,16 +1429,17 @@ function DepositAddressStep({
|
|
|
1590
1429
|
onDepositComplete,
|
|
1591
1430
|
onDepositFailed,
|
|
1592
1431
|
onCopyAddress,
|
|
1432
|
+
onRequestWalletPicker,
|
|
1593
1433
|
onError
|
|
1594
1434
|
}) {
|
|
1595
1435
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1596
1436
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1597
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1598
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1437
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _49 => _49.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1438
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _50 => _50.sourceChains])]
|
|
1599
1439
|
);
|
|
1600
1440
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1601
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1602
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1441
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _51 => _51.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1442
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _52 => _52.sourceTokens])]
|
|
1603
1443
|
);
|
|
1604
1444
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1605
1445
|
const all = _chunkIVTXEYB2cjs.getSupportedChainIds.call(void 0, );
|
|
@@ -1648,9 +1488,9 @@ function DepositAddressStep({
|
|
|
1648
1488
|
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1649
1489
|
sourceSelectionRef.current = {
|
|
1650
1490
|
chainId: "solana",
|
|
1651
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1652
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1653
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
1491
|
+
token: _optionalChain([matched, 'optionalAccess', _53 => _53.mint]),
|
|
1492
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _54 => _54.symbol]),
|
|
1493
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _55 => _55.decimals])
|
|
1654
1494
|
};
|
|
1655
1495
|
return;
|
|
1656
1496
|
}
|
|
@@ -1719,8 +1559,8 @@ function DepositAddressStep({
|
|
|
1719
1559
|
function handlePointerDown(event) {
|
|
1720
1560
|
const target = event.target;
|
|
1721
1561
|
if (!target) return;
|
|
1722
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1723
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1562
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.contains, 'call', _58 => _58(target)]);
|
|
1563
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.contains, 'call', _61 => _61(target)]);
|
|
1724
1564
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1725
1565
|
setChainDropdownOpen(false);
|
|
1726
1566
|
setTokenDropdownOpen(false);
|
|
@@ -1733,7 +1573,7 @@ function DepositAddressStep({
|
|
|
1733
1573
|
};
|
|
1734
1574
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1735
1575
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
1736
|
-
_optionalChain([onCopyAddress, 'optionalCall',
|
|
1576
|
+
_optionalChain([onCopyAddress, 'optionalCall', _62 => _62()]);
|
|
1737
1577
|
try {
|
|
1738
1578
|
await navigator.clipboard.writeText(displayAddress);
|
|
1739
1579
|
setCopied(true);
|
|
@@ -1807,10 +1647,10 @@ function DepositAddressStep({
|
|
|
1807
1647
|
return;
|
|
1808
1648
|
}
|
|
1809
1649
|
const event = status.lastEvent;
|
|
1810
|
-
const eventTxHash =
|
|
1650
|
+
const eventTxHash = _chunkV6NJIPSScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkV6NJIPSScjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1811
1651
|
if (baselineTxHashRef.current === void 0) {
|
|
1812
1652
|
baselineTxHashRef.current = eventTxHash;
|
|
1813
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
1653
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkV6NJIPSScjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1814
1654
|
const details = getDepositEventDetails(event);
|
|
1815
1655
|
const chainId = _nullishCoalesce(details.chainId, () => ( "unknown"));
|
|
1816
1656
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
@@ -1839,7 +1679,7 @@ function DepositAddressStep({
|
|
|
1839
1679
|
directTransfer
|
|
1840
1680
|
};
|
|
1841
1681
|
setNotifications((prev) => [notification, ...prev]);
|
|
1842
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
1682
|
+
_optionalChain([onDepositSubmittedRef, 'access', _63 => _63.current, 'optionalCall', _64 => _64({
|
|
1843
1683
|
txHash: eventTxHash,
|
|
1844
1684
|
sourceChain: chainId,
|
|
1845
1685
|
amount
|
|
@@ -1850,7 +1690,7 @@ function DepositAddressStep({
|
|
|
1850
1690
|
if (!cancelled) {
|
|
1851
1691
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1852
1692
|
setPollingError(msg);
|
|
1853
|
-
_optionalChain([onErrorRef, 'access',
|
|
1693
|
+
_optionalChain([onErrorRef, 'access', _65 => _65.current, 'optionalCall', _66 => _66(msg, "STATUS_POLL_ERROR")]);
|
|
1854
1694
|
}
|
|
1855
1695
|
}
|
|
1856
1696
|
if (!cancelled) {
|
|
@@ -1866,14 +1706,14 @@ function DepositAddressStep({
|
|
|
1866
1706
|
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
1867
1707
|
(txHash, destinationTxHash, context) => {
|
|
1868
1708
|
isTrackingRef.current = false;
|
|
1869
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
1709
|
+
_optionalChain([onDepositCompleteRef, 'access', _67 => _67.current, 'optionalCall', _68 => _68(txHash, destinationTxHash, context)]);
|
|
1870
1710
|
},
|
|
1871
1711
|
[]
|
|
1872
1712
|
);
|
|
1873
1713
|
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
1874
1714
|
(txHash, error) => {
|
|
1875
1715
|
isTrackingRef.current = false;
|
|
1876
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
1716
|
+
_optionalChain([onDepositFailedRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70(txHash, error)]);
|
|
1877
1717
|
},
|
|
1878
1718
|
[]
|
|
1879
1719
|
);
|
|
@@ -1883,7 +1723,7 @@ function DepositAddressStep({
|
|
|
1883
1723
|
const qrIconSrc = _chunkIVTXEYB2cjs.getChainIcon.call(void 0, sourceChainId);
|
|
1884
1724
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-step--with-notifications", children: [
|
|
1885
1725
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
1886
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CoinsIcon, {}), title: "Transfer crypto" }),
|
|
1887
1727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1888
1728
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1889
1729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
@@ -1906,7 +1746,7 @@ function DepositAddressStep({
|
|
|
1906
1746
|
}
|
|
1907
1747
|
),
|
|
1908
1748
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkIVTXEYB2cjs.getChainName.call(void 0, sourceChainId) }),
|
|
1909
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1910
1750
|
]
|
|
1911
1751
|
}
|
|
1912
1752
|
),
|
|
@@ -1939,9 +1779,9 @@ function DepositAddressStep({
|
|
|
1939
1779
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
1940
1780
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
1941
1781
|
"Min.$",
|
|
1942
|
-
_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1944
|
-
|
|
1782
|
+
_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _71 => _71.minDepositUsd]), () => ( 0.1)),
|
|
1783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1784
|
+
_chunkV6NJIPSScjs.InfoIcon,
|
|
1945
1785
|
{
|
|
1946
1786
|
className: "rs-deposit-address-min-icon",
|
|
1947
1787
|
"aria-hidden": "true"
|
|
@@ -1968,7 +1808,7 @@ function DepositAddressStep({
|
|
|
1968
1808
|
}
|
|
1969
1809
|
),
|
|
1970
1810
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
|
|
1971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1972
1812
|
]
|
|
1973
1813
|
}
|
|
1974
1814
|
),
|
|
@@ -2016,7 +1856,7 @@ function DepositAddressStep({
|
|
|
2016
1856
|
alignItems: "center",
|
|
2017
1857
|
justifyContent: "center"
|
|
2018
1858
|
},
|
|
2019
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1859
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, {})
|
|
2020
1860
|
}
|
|
2021
1861
|
),
|
|
2022
1862
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 220, iconSrc: qrIconSrc })
|
|
@@ -2031,7 +1871,7 @@ function DepositAddressStep({
|
|
|
2031
1871
|
className: "rs-deposit-address-copy",
|
|
2032
1872
|
onClick: handleCopy,
|
|
2033
1873
|
children: [
|
|
2034
|
-
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1874
|
+
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CopyIcon, {}),
|
|
2035
1875
|
copied ? "Copied!" : "Copy address"
|
|
2036
1876
|
]
|
|
2037
1877
|
}
|
|
@@ -2056,16 +1896,16 @@ function DepositAddressStep({
|
|
|
2056
1896
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2057
1897
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
2058
1898
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2059
|
-
|
|
1899
|
+
_chunkV6NJIPSScjs.Tooltip,
|
|
2060
1900
|
{
|
|
2061
1901
|
className: "rs-price-impact-info",
|
|
2062
1902
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2063
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1903
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, { "aria-hidden": "true" })
|
|
2064
1904
|
}
|
|
2065
1905
|
)
|
|
2066
1906
|
] }),
|
|
2067
1907
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2068
|
-
|
|
1908
|
+
_chunkV6NJIPSScjs.ChevronDownIcon,
|
|
2069
1909
|
{
|
|
2070
1910
|
className: "rs-price-impact-chevron",
|
|
2071
1911
|
"aria-hidden": "true"
|
|
@@ -2076,29 +1916,29 @@ function DepositAddressStep({
|
|
|
2076
1916
|
),
|
|
2077
1917
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-panel-inner", children: [
|
|
2078
1918
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2079
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PercentIcon, {}) }),
|
|
2080
1920
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2081
1921
|
"Max slippage: ",
|
|
2082
1922
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
2083
1923
|
] }),
|
|
2084
1924
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2085
|
-
|
|
1925
|
+
_chunkV6NJIPSScjs.Tooltip,
|
|
2086
1926
|
{
|
|
2087
1927
|
className: "rs-price-impact-info",
|
|
2088
1928
|
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
2089
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1929
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, { "aria-hidden": "true" })
|
|
2090
1930
|
}
|
|
2091
1931
|
)
|
|
2092
1932
|
] }),
|
|
2093
1933
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2094
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ClockIcon, {}) }),
|
|
2095
1935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2096
1936
|
"Processing time: ",
|
|
2097
1937
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
2098
1938
|
] })
|
|
2099
1939
|
] }),
|
|
2100
1940
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2101
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PlusCircleIcon, {}) }),
|
|
2102
1942
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2103
1943
|
"Max deposit:",
|
|
2104
1944
|
" ",
|
|
@@ -2112,7 +1952,16 @@ function DepositAddressStep({
|
|
|
2112
1952
|
]
|
|
2113
1953
|
}
|
|
2114
1954
|
),
|
|
2115
|
-
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1955
|
+
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError }),
|
|
1956
|
+
onRequestWalletPicker && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1957
|
+
"button",
|
|
1958
|
+
{
|
|
1959
|
+
type: "button",
|
|
1960
|
+
className: "rs-connect-wallet-manage",
|
|
1961
|
+
onClick: onRequestWalletPicker,
|
|
1962
|
+
children: "Use a wallet to deposit instead"
|
|
1963
|
+
}
|
|
1964
|
+
)
|
|
2116
1965
|
] }),
|
|
2117
1966
|
notifications.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2118
1967
|
DepositNotification,
|
|
@@ -2131,7 +1980,7 @@ function DepositAddressStep({
|
|
|
2131
1980
|
},
|
|
2132
1981
|
deposit.id
|
|
2133
1982
|
)) }),
|
|
2134
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1983
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
2135
1984
|
] });
|
|
2136
1985
|
}
|
|
2137
1986
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -2162,7 +2011,7 @@ function SolanaTokenSelectStep({
|
|
|
2162
2011
|
setError(null);
|
|
2163
2012
|
const portfolioBySymbol = {};
|
|
2164
2013
|
try {
|
|
2165
|
-
|
|
2014
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
2166
2015
|
solanaAddress
|
|
2167
2016
|
});
|
|
2168
2017
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -2185,12 +2034,12 @@ function SolanaTokenSelectStep({
|
|
|
2185
2034
|
};
|
|
2186
2035
|
}
|
|
2187
2036
|
}
|
|
2188
|
-
|
|
2037
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2189
2038
|
symbols: Object.keys(portfolioBySymbol)
|
|
2190
2039
|
});
|
|
2191
2040
|
} catch (err) {
|
|
2192
2041
|
if (!active) return;
|
|
2193
|
-
|
|
2042
|
+
_chunkV6NJIPSScjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2194
2043
|
solanaAddress
|
|
2195
2044
|
});
|
|
2196
2045
|
setError(
|
|
@@ -2215,7 +2064,7 @@ function SolanaTokenSelectStep({
|
|
|
2215
2064
|
setTokenBalances(results);
|
|
2216
2065
|
setLoading(false);
|
|
2217
2066
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
2218
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2067
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _72 => _72(totalUsd)]);
|
|
2219
2068
|
}
|
|
2220
2069
|
void loadBalances();
|
|
2221
2070
|
return () => {
|
|
@@ -2237,9 +2086,9 @@ function SolanaTokenSelectStep({
|
|
|
2237
2086
|
}
|
|
2238
2087
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
2239
2088
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2240
|
-
|
|
2089
|
+
_chunkV6NJIPSScjs.BodyHeader,
|
|
2241
2090
|
{
|
|
2242
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2091
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CoinsIcon, {}),
|
|
2243
2092
|
title: "Select asset",
|
|
2244
2093
|
subtitle: "Pick a Solana token to deposit"
|
|
2245
2094
|
}
|
|
@@ -2251,11 +2100,11 @@ function SolanaTokenSelectStep({
|
|
|
2251
2100
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
2252
2101
|
children: [
|
|
2253
2102
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2254
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2103
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2255
2104
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2256
2105
|
] }),
|
|
2257
2106
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
2258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
2259
2108
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2260
2109
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
2261
2110
|
solanaAddress.slice(0, 6),
|
|
@@ -2271,7 +2120,7 @@ function SolanaTokenSelectStep({
|
|
|
2271
2120
|
try {
|
|
2272
2121
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2273
2122
|
const numeric = Number(raw);
|
|
2274
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
2123
|
+
formattedBalance = Number.isFinite(numeric) ? _chunkV6NJIPSScjs.tokenFormatter.format(numeric) : raw;
|
|
2275
2124
|
} catch (e16) {
|
|
2276
2125
|
formattedBalance = "...";
|
|
2277
2126
|
}
|
|
@@ -2315,7 +2164,7 @@ function SolanaTokenSelectStep({
|
|
|
2315
2164
|
] })
|
|
2316
2165
|
] })
|
|
2317
2166
|
] }),
|
|
2318
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2167
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
2319
2168
|
]
|
|
2320
2169
|
},
|
|
2321
2170
|
entry.token.symbol
|
|
@@ -2325,7 +2174,7 @@ function SolanaTokenSelectStep({
|
|
|
2325
2174
|
}
|
|
2326
2175
|
),
|
|
2327
2176
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2328
|
-
|
|
2177
|
+
_chunkV6NJIPSScjs.Button,
|
|
2329
2178
|
{
|
|
2330
2179
|
onClick: () => selectedEntry && onContinue(
|
|
2331
2180
|
selectedEntry.token,
|
|
@@ -2337,7 +2186,7 @@ function SolanaTokenSelectStep({
|
|
|
2337
2186
|
children: "Continue"
|
|
2338
2187
|
}
|
|
2339
2188
|
) }),
|
|
2340
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
2341
2190
|
] });
|
|
2342
2191
|
}
|
|
2343
2192
|
|
|
@@ -2395,7 +2244,7 @@ function SolanaAmountStep({
|
|
|
2395
2244
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2396
2245
|
const numeric = Number(raw);
|
|
2397
2246
|
if (!Number.isFinite(numeric)) return raw;
|
|
2398
|
-
return
|
|
2247
|
+
return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
|
|
2399
2248
|
} catch (e18) {
|
|
2400
2249
|
return "\u2026";
|
|
2401
2250
|
}
|
|
@@ -2438,8 +2287,8 @@ function SolanaAmountStep({
|
|
|
2438
2287
|
return null;
|
|
2439
2288
|
}
|
|
2440
2289
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
2441
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2442
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2290
|
+
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _73 => _73.minDepositUsd]), () => ( null));
|
|
2291
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _74 => _74.maxDepositUsd]), () => ( null));
|
|
2443
2292
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
2444
2293
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
2445
2294
|
const exceedsBalance = Boolean(
|
|
@@ -2454,7 +2303,7 @@ function SolanaAmountStep({
|
|
|
2454
2303
|
const factor = 1e3;
|
|
2455
2304
|
const truncated = Math.floor(value * factor) / factor;
|
|
2456
2305
|
const formatted = truncated.toFixed(3).replace(/\.?0+$/, "");
|
|
2457
|
-
|
|
2306
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2458
2307
|
percentage,
|
|
2459
2308
|
symbol: token.symbol,
|
|
2460
2309
|
formatted
|
|
@@ -2492,7 +2341,7 @@ function SolanaAmountStep({
|
|
|
2492
2341
|
try {
|
|
2493
2342
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2494
2343
|
} catch (e23) {
|
|
2495
|
-
|
|
2344
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2496
2345
|
amount,
|
|
2497
2346
|
sourceAmount: sourceAmountStr,
|
|
2498
2347
|
reason: "parse-units-failed"
|
|
@@ -2507,7 +2356,7 @@ function SolanaAmountStep({
|
|
|
2507
2356
|
);
|
|
2508
2357
|
return;
|
|
2509
2358
|
}
|
|
2510
|
-
|
|
2359
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2511
2360
|
symbol: token.symbol,
|
|
2512
2361
|
inputAmountUsd: amount,
|
|
2513
2362
|
sourceAmount: sourceAmountStr,
|
|
@@ -2521,7 +2370,7 @@ function SolanaAmountStep({
|
|
|
2521
2370
|
const sourceTokenIcon = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, token.symbol);
|
|
2522
2371
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2523
2372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
2525
2374
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
2526
2375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2527
2376
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-row", children: [
|
|
@@ -2547,13 +2396,13 @@ function SolanaAmountStep({
|
|
|
2547
2396
|
" available",
|
|
2548
2397
|
computedBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2549
2398
|
" (~",
|
|
2550
|
-
|
|
2399
|
+
_chunkV6NJIPSScjs.currencyFormatter.format(computedBalanceUsd),
|
|
2551
2400
|
")"
|
|
2552
2401
|
] })
|
|
2553
2402
|
] }),
|
|
2554
2403
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
2555
2404
|
"Min. deposit ",
|
|
2556
|
-
|
|
2405
|
+
_chunkV6NJIPSScjs.currencyFormatter.format(minDepositUsd)
|
|
2557
2406
|
] })
|
|
2558
2407
|
] })
|
|
2559
2408
|
] }),
|
|
@@ -2592,15 +2441,15 @@ function SolanaAmountStep({
|
|
|
2592
2441
|
] }),
|
|
2593
2442
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
2594
2443
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
2595
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
2444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkV6NJIPSScjs.currencyFormatter.format(balanceAfterUsd) })
|
|
2596
2445
|
] })
|
|
2597
2446
|
] }),
|
|
2598
2447
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
|
|
2599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
2600
2449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
2601
2450
|
] }),
|
|
2602
2451
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2603
|
-
|
|
2452
|
+
_chunkV6NJIPSScjs.Button,
|
|
2604
2453
|
{
|
|
2605
2454
|
onClick: handleContinue,
|
|
2606
2455
|
fullWidth: true,
|
|
@@ -2609,7 +2458,7 @@ function SolanaAmountStep({
|
|
|
2609
2458
|
}
|
|
2610
2459
|
)
|
|
2611
2460
|
] }),
|
|
2612
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
2613
2462
|
] });
|
|
2614
2463
|
}
|
|
2615
2464
|
|
|
@@ -2653,7 +2502,7 @@ function SolanaConfirmStep({
|
|
|
2653
2502
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
2654
2503
|
const handleConfirm = async () => {
|
|
2655
2504
|
if (!solanaProvider) {
|
|
2656
|
-
|
|
2505
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2657
2506
|
reason: "missing-provider"
|
|
2658
2507
|
});
|
|
2659
2508
|
setError("Solana wallet not connected");
|
|
@@ -2661,7 +2510,7 @@ function SolanaConfirmStep({
|
|
|
2661
2510
|
}
|
|
2662
2511
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2663
2512
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2664
|
-
|
|
2513
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2665
2514
|
reason: "invalid-amount",
|
|
2666
2515
|
sourceAmount
|
|
2667
2516
|
});
|
|
@@ -2670,7 +2519,7 @@ function SolanaConfirmStep({
|
|
|
2670
2519
|
}
|
|
2671
2520
|
setError(null);
|
|
2672
2521
|
setIsSubmitting(true);
|
|
2673
|
-
|
|
2522
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2674
2523
|
smartAccount,
|
|
2675
2524
|
solanaAddress,
|
|
2676
2525
|
solanaDepositAddress,
|
|
@@ -2680,7 +2529,7 @@ function SolanaConfirmStep({
|
|
|
2680
2529
|
});
|
|
2681
2530
|
try {
|
|
2682
2531
|
const check = await service.checkAccount(smartAccount);
|
|
2683
|
-
|
|
2532
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2684
2533
|
smartAccount,
|
|
2685
2534
|
isRegistered: check.isRegistered,
|
|
2686
2535
|
targetChain: check.targetChain,
|
|
@@ -2693,7 +2542,7 @@ function SolanaConfirmStep({
|
|
|
2693
2542
|
}
|
|
2694
2543
|
const connection = getSolanaConnection();
|
|
2695
2544
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2696
|
-
|
|
2545
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2697
2546
|
token: token.symbol,
|
|
2698
2547
|
sourceAmount,
|
|
2699
2548
|
amountUnits: amountUnits.toString()
|
|
@@ -2710,10 +2559,10 @@ function SolanaConfirmStep({
|
|
|
2710
2559
|
token.mint,
|
|
2711
2560
|
amountUnits
|
|
2712
2561
|
);
|
|
2713
|
-
|
|
2562
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2714
2563
|
token: token.symbol,
|
|
2715
2564
|
instructionCount: transaction.instructions.length,
|
|
2716
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2565
|
+
feePayer: _optionalChain([transaction, 'access', _75 => _75.feePayer, 'optionalAccess', _76 => _76.toBase58, 'call', _77 => _77()]),
|
|
2717
2566
|
recentBlockhash: transaction.recentBlockhash
|
|
2718
2567
|
});
|
|
2719
2568
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2721,27 +2570,27 @@ function SolanaConfirmStep({
|
|
|
2721
2570
|
connection,
|
|
2722
2571
|
transaction
|
|
2723
2572
|
);
|
|
2724
|
-
|
|
2573
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2725
2574
|
txHash,
|
|
2726
2575
|
amountUnits: amountUnits.toString()
|
|
2727
2576
|
});
|
|
2728
2577
|
onConfirm(txHash, amountUnits.toString());
|
|
2729
2578
|
} catch (err) {
|
|
2730
2579
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2731
|
-
const message =
|
|
2732
|
-
|
|
2580
|
+
const message = _chunkV6NJIPSScjs.formatUserError.call(void 0, raw);
|
|
2581
|
+
_chunkV6NJIPSScjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2733
2582
|
smartAccount,
|
|
2734
2583
|
token: token.symbol,
|
|
2735
2584
|
sourceAmount
|
|
2736
2585
|
});
|
|
2737
2586
|
setError(message);
|
|
2738
|
-
_optionalChain([onError, 'optionalCall',
|
|
2587
|
+
_optionalChain([onError, 'optionalCall', _78 => _78(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2739
2588
|
} finally {
|
|
2740
2589
|
setIsSubmitting(false);
|
|
2741
2590
|
}
|
|
2742
2591
|
};
|
|
2743
2592
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
2744
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2593
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Review deposit" }) }),
|
|
2745
2594
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
2746
2595
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
|
|
2747
2596
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
@@ -2840,12 +2689,12 @@ function SolanaConfirmStep({
|
|
|
2840
2689
|
] })
|
|
2841
2690
|
] }),
|
|
2842
2691
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
|
|
2843
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { className: "rs-alert-icon" }),
|
|
2844
2693
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error })
|
|
2845
2694
|
] })
|
|
2846
2695
|
] }),
|
|
2847
2696
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2848
|
-
|
|
2697
|
+
_chunkV6NJIPSScjs.Button,
|
|
2849
2698
|
{
|
|
2850
2699
|
onClick: handleConfirm,
|
|
2851
2700
|
loading: isSubmitting,
|
|
@@ -2854,9 +2703,350 @@ function SolanaConfirmStep({
|
|
|
2854
2703
|
children: "Continue"
|
|
2855
2704
|
}
|
|
2856
2705
|
) }),
|
|
2857
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2706
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
2707
|
+
] });
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
2711
|
+
|
|
2712
|
+
function DappImportAssetSelectStep({
|
|
2713
|
+
sourceLabel,
|
|
2714
|
+
assets,
|
|
2715
|
+
onSelect
|
|
2716
|
+
}) {
|
|
2717
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2718
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2720
|
+
_chunkV6NJIPSScjs.BodyHeader,
|
|
2721
|
+
{
|
|
2722
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HandCoinsIcon, {}),
|
|
2723
|
+
title: `Transfer from ${sourceLabel}`,
|
|
2724
|
+
subtitle: "Pick the balance to import"
|
|
2725
|
+
}
|
|
2726
|
+
),
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: assets.map((asset) => {
|
|
2728
|
+
const balanceTokens = asset.balance ? _chunkV6NJIPSScjs.tokenFormatter.format(
|
|
2729
|
+
Number(asset.balance) / 10 ** asset.decimals
|
|
2730
|
+
) : "0";
|
|
2731
|
+
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(asset.balanceUsd) : `${balanceTokens} ${asset.symbol}`;
|
|
2732
|
+
const iconSrc = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, asset.symbol);
|
|
2733
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2734
|
+
_chunkV6NJIPSScjs.ListRow,
|
|
2735
|
+
{
|
|
2736
|
+
leadingMedia: iconSrc || void 0,
|
|
2737
|
+
leading: iconSrc ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HandCoinsIcon, {}),
|
|
2738
|
+
title: asset.symbol,
|
|
2739
|
+
subtitle: `${balanceTokens} on ${_chunkIVTXEYB2cjs.getChainName.call(void 0, asset.chainId)}`,
|
|
2740
|
+
meta: balanceUsd,
|
|
2741
|
+
onClick: () => onSelect(asset)
|
|
2742
|
+
},
|
|
2743
|
+
asset.id
|
|
2744
|
+
);
|
|
2745
|
+
}) })
|
|
2746
|
+
] }),
|
|
2747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
2858
2748
|
] });
|
|
2859
2749
|
}
|
|
2750
|
+
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
2751
|
+
|
|
2752
|
+
// src/core/dapp-imports/polymarket/index.ts
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
// src/core/dapp-imports/polymarket/constants.ts
|
|
2757
|
+
var POLYMARKET_POLYGON_CHAIN_ID = 137;
|
|
2758
|
+
var POLYMARKET_PUSD_ADDRESS = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB";
|
|
2759
|
+
var POLYMARKET_USDCE_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
|
|
2760
|
+
var POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
|
|
2761
|
+
var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
|
|
2762
|
+
var GAMMA_API_PUBLIC_PROFILE = "https://gamma-api.polymarket.com/public-profile";
|
|
2763
|
+
var POLYMARKET_ICON_URL = "data:image/svg+xml,%3Csvg width='512' height='512' viewBox='0 0 512 512' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='512' height='512' fill='%232E5CFF'/%3E%3Cpath d='M375.84 389.422C375.84 403.572 375.84 410.647 371.212 414.154C366.585 417.662 359.773 415.75 346.15 411.927L127.22 350.493C119.012 348.19 114.907 347.038 112.534 343.907C110.161 340.776 110.161 336.513 110.161 327.988V184.012C110.161 175.487 110.161 171.224 112.534 168.093C114.907 164.962 119.012 163.81 127.22 161.507L346.15 100.072C359.773 96.2495 366.585 94.338 371.212 97.8455C375.84 101.353 375.84 108.428 375.84 122.578V389.422ZM164.761 330.463L346.035 381.337V279.595L164.761 330.463ZM139.963 306.862L321.201 256L139.963 205.138V306.862ZM164.759 181.537L346.035 232.406V130.663L164.759 181.537Z' fill='white'/%3E%3C/svg%3E";
|
|
2764
|
+
|
|
2765
|
+
// src/core/dapp-imports/polymarket/gamma-api.ts
|
|
2766
|
+
|
|
2767
|
+
async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
2768
|
+
const url = `${GAMMA_API_PUBLIC_PROFILE}?address=${eoa}`;
|
|
2769
|
+
let response;
|
|
2770
|
+
try {
|
|
2771
|
+
response = await fetch(url, { signal });
|
|
2772
|
+
} catch (e24) {
|
|
2773
|
+
return null;
|
|
2774
|
+
}
|
|
2775
|
+
if (!response.ok) {
|
|
2776
|
+
return null;
|
|
2777
|
+
}
|
|
2778
|
+
let payload;
|
|
2779
|
+
try {
|
|
2780
|
+
payload = await response.json();
|
|
2781
|
+
} catch (e25) {
|
|
2782
|
+
return null;
|
|
2783
|
+
}
|
|
2784
|
+
const raw = payload.proxyWallet;
|
|
2785
|
+
if (!raw || !_viem.isAddress.call(void 0, raw)) {
|
|
2786
|
+
return null;
|
|
2787
|
+
}
|
|
2788
|
+
const checksummed = _viem.getAddress.call(void 0, raw);
|
|
2789
|
+
if (checksummed === _viem.zeroAddress) {
|
|
2790
|
+
return null;
|
|
2791
|
+
}
|
|
2792
|
+
return checksummed;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
// src/core/dapp-imports/polymarket/safe.ts
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
var COLLATERAL_OFFRAMP_ABI = _viem.parseAbi.call(void 0, [
|
|
2808
|
+
"function unwrap(address _asset, address _to, uint256 _amount)"
|
|
2809
|
+
]);
|
|
2810
|
+
var MULTI_SEND_ABI = _viem.parseAbi.call(void 0, ["function multiSend(bytes transactions)"]);
|
|
2811
|
+
async function readPolymarketBalances(params) {
|
|
2812
|
+
const { publicClient, proxyWallet } = params;
|
|
2813
|
+
try {
|
|
2814
|
+
const results = await publicClient.multicall({
|
|
2815
|
+
allowFailure: true,
|
|
2816
|
+
contracts: [
|
|
2817
|
+
{
|
|
2818
|
+
address: POLYMARKET_PUSD_ADDRESS,
|
|
2819
|
+
abi: _viem.erc20Abi,
|
|
2820
|
+
functionName: "balanceOf",
|
|
2821
|
+
args: [proxyWallet]
|
|
2822
|
+
},
|
|
2823
|
+
{
|
|
2824
|
+
address: POLYMARKET_USDCE_ADDRESS,
|
|
2825
|
+
abi: _viem.erc20Abi,
|
|
2826
|
+
functionName: "balanceOf",
|
|
2827
|
+
args: [proxyWallet]
|
|
2828
|
+
}
|
|
2829
|
+
]
|
|
2830
|
+
});
|
|
2831
|
+
return {
|
|
2832
|
+
pusd: results[0].status === "success" ? results[0].result : 0n,
|
|
2833
|
+
usdce: results[1].status === "success" ? results[1].result : 0n
|
|
2834
|
+
};
|
|
2835
|
+
} catch (e26) {
|
|
2836
|
+
return { pusd: 0n, usdce: 0n };
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
async function executePolymarketSafeTransfer(params) {
|
|
2840
|
+
const {
|
|
2841
|
+
walletClient,
|
|
2842
|
+
publicClient,
|
|
2843
|
+
safeAddress,
|
|
2844
|
+
recipient,
|
|
2845
|
+
amount,
|
|
2846
|
+
tokenKind
|
|
2847
|
+
} = params;
|
|
2848
|
+
const account = walletClient.account;
|
|
2849
|
+
const chain = walletClient.chain;
|
|
2850
|
+
if (!account || !chain) {
|
|
2851
|
+
throw new Error("Wallet not connected");
|
|
2852
|
+
}
|
|
2853
|
+
if (chain.id !== POLYMARKET_POLYGON_CHAIN_ID) {
|
|
2854
|
+
throw new Error("Switch to Polygon to sign");
|
|
2855
|
+
}
|
|
2856
|
+
const isOwner = await publicClient.readContract({
|
|
2857
|
+
address: safeAddress,
|
|
2858
|
+
abi: _chunkV6NJIPSScjs.SAFE_ABI,
|
|
2859
|
+
functionName: "isOwner",
|
|
2860
|
+
args: [account.address]
|
|
2861
|
+
});
|
|
2862
|
+
if (!isOwner) {
|
|
2863
|
+
throw new Error("Connected wallet is not a Polymarket Safe owner");
|
|
2864
|
+
}
|
|
2865
|
+
const safeTx = tokenKind === "pusd" ? buildPusdUnwrapSafeTx(recipient, amount) : buildUsdceTransferSafeTx(recipient, amount);
|
|
2866
|
+
const signature = _viem.concat.call(void 0, [
|
|
2867
|
+
_viem.pad.call(void 0, account.address, { size: 32 }),
|
|
2868
|
+
_viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
|
|
2869
|
+
_viem.toHex.call(void 0, 1, { size: 1 })
|
|
2870
|
+
]);
|
|
2871
|
+
const txHash = await walletClient.writeContract({
|
|
2872
|
+
account,
|
|
2873
|
+
chain,
|
|
2874
|
+
address: safeAddress,
|
|
2875
|
+
abi: _chunkV6NJIPSScjs.SAFE_ABI,
|
|
2876
|
+
functionName: "execTransaction",
|
|
2877
|
+
args: [
|
|
2878
|
+
safeTx.to,
|
|
2879
|
+
0n,
|
|
2880
|
+
safeTx.data,
|
|
2881
|
+
safeTx.operation,
|
|
2882
|
+
0n,
|
|
2883
|
+
0n,
|
|
2884
|
+
0n,
|
|
2885
|
+
_viem.zeroAddress,
|
|
2886
|
+
_viem.zeroAddress,
|
|
2887
|
+
signature
|
|
2888
|
+
]
|
|
2889
|
+
});
|
|
2890
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
2891
|
+
hash: txHash
|
|
2892
|
+
});
|
|
2893
|
+
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
2894
|
+
abi: _chunkV6NJIPSScjs.SAFE_ABI,
|
|
2895
|
+
logs: receipt.logs.filter(
|
|
2896
|
+
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
2897
|
+
),
|
|
2898
|
+
strict: false
|
|
2899
|
+
});
|
|
2900
|
+
if (parsed.some((log) => log.eventName === "ExecutionFailure")) {
|
|
2901
|
+
throw new Error("Polymarket Safe transaction failed");
|
|
2902
|
+
}
|
|
2903
|
+
if (!parsed.some((log) => log.eventName === "ExecutionSuccess")) {
|
|
2904
|
+
throw new Error("Polymarket Safe transaction status unavailable");
|
|
2905
|
+
}
|
|
2906
|
+
return {
|
|
2907
|
+
txHash,
|
|
2908
|
+
// The smart account always receives USDC.e — pUSD is unwrapped to USDC.e
|
|
2909
|
+
// before it lands at `recipient`.
|
|
2910
|
+
sourceToken: POLYMARKET_USDCE_ADDRESS,
|
|
2911
|
+
sourceSymbol: tokenKind === "pusd" ? "pUSD" : "USDC.e"
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2914
|
+
function buildUsdceTransferSafeTx(recipient, amount) {
|
|
2915
|
+
return {
|
|
2916
|
+
to: POLYMARKET_USDCE_ADDRESS,
|
|
2917
|
+
data: _viem.encodeFunctionData.call(void 0, {
|
|
2918
|
+
abi: _viem.erc20Abi,
|
|
2919
|
+
functionName: "transfer",
|
|
2920
|
+
args: [recipient, amount]
|
|
2921
|
+
}),
|
|
2922
|
+
operation: 0
|
|
2923
|
+
};
|
|
2924
|
+
}
|
|
2925
|
+
function buildPusdUnwrapSafeTx(recipient, amount) {
|
|
2926
|
+
const approveData = _viem.encodeFunctionData.call(void 0, {
|
|
2927
|
+
abi: _viem.erc20Abi,
|
|
2928
|
+
functionName: "approve",
|
|
2929
|
+
args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
|
|
2930
|
+
});
|
|
2931
|
+
const unwrapData = _viem.encodeFunctionData.call(void 0, {
|
|
2932
|
+
abi: COLLATERAL_OFFRAMP_ABI,
|
|
2933
|
+
functionName: "unwrap",
|
|
2934
|
+
args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
|
|
2935
|
+
});
|
|
2936
|
+
return {
|
|
2937
|
+
to: SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
|
|
2938
|
+
data: _viem.encodeFunctionData.call(void 0, {
|
|
2939
|
+
abi: MULTI_SEND_ABI,
|
|
2940
|
+
functionName: "multiSend",
|
|
2941
|
+
args: [
|
|
2942
|
+
_viem.concat.call(void 0, [
|
|
2943
|
+
encodeMultiSendCall(POLYMARKET_PUSD_ADDRESS, approveData),
|
|
2944
|
+
encodeMultiSendCall(POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, unwrapData)
|
|
2945
|
+
])
|
|
2946
|
+
]
|
|
2947
|
+
}),
|
|
2948
|
+
operation: 1
|
|
2949
|
+
};
|
|
2950
|
+
}
|
|
2951
|
+
function encodeMultiSendCall(to, data) {
|
|
2952
|
+
return _viem.encodePacked.call(void 0,
|
|
2953
|
+
["uint8", "address", "uint256", "uint256", "bytes"],
|
|
2954
|
+
[0, to, 0n, BigInt((data.length - 2) / 2), data]
|
|
2955
|
+
);
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
// src/core/dapp-imports/polymarket/index.ts
|
|
2959
|
+
var PROVIDER_ID = "polymarket";
|
|
2960
|
+
var polymarketProvider = {
|
|
2961
|
+
id: PROVIDER_ID,
|
|
2962
|
+
label: "Transfer from Polymarket",
|
|
2963
|
+
icon: _react.createElement.call(void 0, "img", {
|
|
2964
|
+
src: POLYMARKET_ICON_URL,
|
|
2965
|
+
alt: "Polymarket",
|
|
2966
|
+
style: { width: 24, height: 24, borderRadius: 6 }
|
|
2967
|
+
}),
|
|
2968
|
+
chainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
2969
|
+
async fetchAvailability({ eoa, getPublicClient: getPublicClient2, signal }) {
|
|
2970
|
+
const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
|
|
2971
|
+
if (!proxyWallet) return null;
|
|
2972
|
+
if (_optionalChain([signal, 'optionalAccess', _79 => _79.aborted])) return null;
|
|
2973
|
+
const polygonClient = getPublicClient2(POLYMARKET_POLYGON_CHAIN_ID);
|
|
2974
|
+
if (!polygonClient) return null;
|
|
2975
|
+
const balances = await readPolymarketBalances({
|
|
2976
|
+
publicClient: polygonClient,
|
|
2977
|
+
proxyWallet
|
|
2978
|
+
});
|
|
2979
|
+
if (_optionalChain([signal, 'optionalAccess', _80 => _80.aborted])) return null;
|
|
2980
|
+
if (balances.pusd === 0n && balances.usdce === 0n) return null;
|
|
2981
|
+
const assets = [];
|
|
2982
|
+
if (balances.pusd > 0n) {
|
|
2983
|
+
assets.push(buildAsset({ tokenKind: "pusd", proxyWallet, balance: balances.pusd }));
|
|
2984
|
+
}
|
|
2985
|
+
if (balances.usdce > 0n) {
|
|
2986
|
+
assets.push(buildAsset({ tokenKind: "usdce", proxyWallet, balance: balances.usdce }));
|
|
2987
|
+
}
|
|
2988
|
+
const totalUsd = assets.reduce((sum, a) => sum + (_nullishCoalesce(a.balanceUsd, () => ( 0))), 0);
|
|
2989
|
+
const availability = {
|
|
2990
|
+
providerId: PROVIDER_ID,
|
|
2991
|
+
totalUsd,
|
|
2992
|
+
assets
|
|
2993
|
+
};
|
|
2994
|
+
return availability;
|
|
2995
|
+
},
|
|
2996
|
+
async executeTransfer({ walletClient, publicClient, recipient, asset, amount }) {
|
|
2997
|
+
const metadata = asset.providerMetadata;
|
|
2998
|
+
const result = await executePolymarketSafeTransfer({
|
|
2999
|
+
walletClient,
|
|
3000
|
+
publicClient,
|
|
3001
|
+
safeAddress: metadata.proxyWallet,
|
|
3002
|
+
recipient,
|
|
3003
|
+
amount,
|
|
3004
|
+
tokenKind: metadata.tokenKind
|
|
3005
|
+
});
|
|
3006
|
+
return {
|
|
3007
|
+
txHash: result.txHash,
|
|
3008
|
+
sourceToken: result.sourceToken,
|
|
3009
|
+
sourceSymbol: result.sourceSymbol,
|
|
3010
|
+
sourceDecimals: 6
|
|
3011
|
+
};
|
|
3012
|
+
}
|
|
3013
|
+
};
|
|
3014
|
+
function buildAsset(params) {
|
|
3015
|
+
const { tokenKind, proxyWallet, balance } = params;
|
|
3016
|
+
const isPusd = tokenKind === "pusd";
|
|
3017
|
+
const tokenAddress = isPusd ? POLYMARKET_PUSD_ADDRESS : POLYMARKET_USDCE_ADDRESS;
|
|
3018
|
+
const symbol = isPusd ? "pUSD" : "USDC.e";
|
|
3019
|
+
const balanceUsd = Number(_viem.formatUnits.call(void 0, balance, 6));
|
|
3020
|
+
const metadata = { proxyWallet, tokenKind };
|
|
3021
|
+
return {
|
|
3022
|
+
id: `polymarket:${tokenKind}`,
|
|
3023
|
+
chainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
3024
|
+
token: tokenAddress,
|
|
3025
|
+
symbol,
|
|
3026
|
+
name: isPusd ? "Polymarket USD" : "Polygon USDC.e",
|
|
3027
|
+
decimals: 6,
|
|
3028
|
+
balance: balance.toString(),
|
|
3029
|
+
balanceUsd: Number.isFinite(balanceUsd) ? balanceUsd : 0,
|
|
3030
|
+
source: PROVIDER_ID,
|
|
3031
|
+
sourceLabel: "Polymarket",
|
|
3032
|
+
reviewLabel: isPusd ? "You send pUSD from Polymarket" : "You send USDC.e from Polymarket",
|
|
3033
|
+
// pUSD unwraps to USDC.e via the offramp; USDC.e is what actually
|
|
3034
|
+
// arrives at the smart account, so it's also what the orchestrator
|
|
3035
|
+
// bridges from.
|
|
3036
|
+
depositToken: POLYMARKET_USDCE_ADDRESS,
|
|
3037
|
+
depositChainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
3038
|
+
providerMetadata: metadata
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
// src/core/dapp-imports/registry.ts
|
|
3043
|
+
var DAPP_IMPORT_PROVIDERS = [polymarketProvider];
|
|
3044
|
+
function getEnabledProviders(config) {
|
|
3045
|
+
if (!config) return [];
|
|
3046
|
+
return DAPP_IMPORT_PROVIDERS.filter(
|
|
3047
|
+
(p) => config[p.id] === true
|
|
3048
|
+
);
|
|
3049
|
+
}
|
|
2860
3050
|
|
|
2861
3051
|
// src/store/index.ts
|
|
2862
3052
|
|
|
@@ -2884,6 +3074,23 @@ var RESET_DEPOSIT_FIELDS = {
|
|
|
2884
3074
|
sourceSymbol: null,
|
|
2885
3075
|
sourceDecimals: null
|
|
2886
3076
|
};
|
|
3077
|
+
function ownerKey(owner) {
|
|
3078
|
+
return owner.toString().toLowerCase();
|
|
3079
|
+
}
|
|
3080
|
+
function idleEntry(owner) {
|
|
3081
|
+
return {
|
|
3082
|
+
owner,
|
|
3083
|
+
requestKey: null,
|
|
3084
|
+
cacheKey: null,
|
|
3085
|
+
status: "idle",
|
|
3086
|
+
smartAccount: null,
|
|
3087
|
+
sessionOwnerAddress: null,
|
|
3088
|
+
solanaDepositAddress: null,
|
|
3089
|
+
message: null,
|
|
3090
|
+
cacheable: true,
|
|
3091
|
+
attemptNonce: 0
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
2887
3094
|
function applyBack(state, hasWalletOptions) {
|
|
2888
3095
|
const { step, mode } = state.flow;
|
|
2889
3096
|
switch (step) {
|
|
@@ -2898,7 +3105,11 @@ function applyBack(state, hasWalletOptions) {
|
|
|
2898
3105
|
balance: null,
|
|
2899
3106
|
liquidityWarning: null
|
|
2900
3107
|
},
|
|
2901
|
-
flow: {
|
|
3108
|
+
flow: {
|
|
3109
|
+
...state.flow,
|
|
3110
|
+
step: mode === "dapp-import" ? "dapp-import-asset-select" : "select-asset",
|
|
3111
|
+
hasNavigatedBack: true
|
|
3112
|
+
}
|
|
2902
3113
|
};
|
|
2903
3114
|
case "confirm":
|
|
2904
3115
|
return {
|
|
@@ -2940,37 +3151,70 @@ function applyBack(state, hasWalletOptions) {
|
|
|
2940
3151
|
case "select-asset":
|
|
2941
3152
|
case "deposit-address":
|
|
2942
3153
|
case "solana-token-select":
|
|
3154
|
+
case "dapp-import-asset-select":
|
|
2943
3155
|
return {
|
|
2944
3156
|
...state,
|
|
2945
3157
|
flow: {
|
|
2946
3158
|
...state.flow,
|
|
2947
|
-
step: "
|
|
3159
|
+
step: "connect",
|
|
2948
3160
|
mode: null,
|
|
2949
3161
|
isConnectSelectionConfirmed: false,
|
|
2950
|
-
hasNavigatedBack:
|
|
3162
|
+
hasNavigatedBack: true
|
|
2951
3163
|
},
|
|
2952
|
-
deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS }
|
|
3164
|
+
deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
|
|
3165
|
+
dappImport: {
|
|
3166
|
+
...state.dappImport,
|
|
3167
|
+
activeProviderId: null,
|
|
3168
|
+
selectedAsset: null
|
|
3169
|
+
}
|
|
2953
3170
|
};
|
|
3171
|
+
case "connect":
|
|
2954
3172
|
case "setup":
|
|
2955
|
-
if (mode !== null
|
|
3173
|
+
if (mode !== null) {
|
|
2956
3174
|
return {
|
|
2957
3175
|
...state,
|
|
2958
3176
|
flow: {
|
|
2959
3177
|
...state.flow,
|
|
3178
|
+
step: "connect",
|
|
2960
3179
|
mode: null,
|
|
2961
3180
|
isConnectSelectionConfirmed: false,
|
|
2962
|
-
hasNavigatedBack:
|
|
3181
|
+
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
2963
3182
|
}
|
|
2964
3183
|
};
|
|
2965
3184
|
}
|
|
2966
3185
|
return state;
|
|
2967
|
-
case "connect":
|
|
2968
3186
|
case "processing":
|
|
2969
3187
|
return state;
|
|
2970
3188
|
default:
|
|
2971
3189
|
return unreachable(step);
|
|
2972
3190
|
}
|
|
2973
3191
|
}
|
|
3192
|
+
function modeEntryStep(mode) {
|
|
3193
|
+
switch (mode) {
|
|
3194
|
+
case "wallet":
|
|
3195
|
+
return "select-asset";
|
|
3196
|
+
case "deposit-address":
|
|
3197
|
+
return "deposit-address";
|
|
3198
|
+
case "solana-wallet":
|
|
3199
|
+
return "solana-token-select";
|
|
3200
|
+
case "dapp-import":
|
|
3201
|
+
return "dapp-import-asset-select";
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
function updateSetupEntry(state, owner, update) {
|
|
3205
|
+
const key = ownerKey(owner);
|
|
3206
|
+
const existing = _nullishCoalesce(state.setup.byOwner[key], () => ( idleEntry(owner)));
|
|
3207
|
+
return {
|
|
3208
|
+
...state,
|
|
3209
|
+
setup: {
|
|
3210
|
+
...state.setup,
|
|
3211
|
+
byOwner: {
|
|
3212
|
+
...state.setup.byOwner,
|
|
3213
|
+
[key]: update(existing)
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
2974
3218
|
function applyAction(state, action) {
|
|
2975
3219
|
switch (action.type) {
|
|
2976
3220
|
case "flow/mode-set":
|
|
@@ -2995,16 +3239,22 @@ function applyAction(state, action) {
|
|
|
2995
3239
|
mode: null,
|
|
2996
3240
|
isConnectSelectionConfirmed: false
|
|
2997
3241
|
},
|
|
2998
|
-
wallet: { ...state.wallet, selectedWalletId: null }
|
|
3242
|
+
wallet: { ...state.wallet, selectedWalletId: null },
|
|
3243
|
+
dappImport: {
|
|
3244
|
+
...state.dappImport,
|
|
3245
|
+
activeProviderId: null,
|
|
3246
|
+
selectedAsset: null
|
|
3247
|
+
}
|
|
2999
3248
|
};
|
|
3000
3249
|
case "connect/wallet-confirmed":
|
|
3250
|
+
if (!action.mode) return state;
|
|
3001
3251
|
return {
|
|
3002
3252
|
...state,
|
|
3003
3253
|
flow: {
|
|
3004
3254
|
...state.flow,
|
|
3005
3255
|
mode: action.mode,
|
|
3006
3256
|
isConnectSelectionConfirmed: true,
|
|
3007
|
-
step:
|
|
3257
|
+
step: modeEntryStep(action.mode)
|
|
3008
3258
|
},
|
|
3009
3259
|
wallet: { ...state.wallet, selectedWalletId: action.walletId }
|
|
3010
3260
|
};
|
|
@@ -3015,7 +3265,7 @@ function applyAction(state, action) {
|
|
|
3015
3265
|
...state.flow,
|
|
3016
3266
|
mode: "deposit-address",
|
|
3017
3267
|
isConnectSelectionConfirmed: true,
|
|
3018
|
-
step: "
|
|
3268
|
+
step: "deposit-address"
|
|
3019
3269
|
}
|
|
3020
3270
|
};
|
|
3021
3271
|
case "connect/auto-locked":
|
|
@@ -3025,23 +3275,81 @@ function applyAction(state, action) {
|
|
|
3025
3275
|
...state.flow,
|
|
3026
3276
|
mode: "wallet",
|
|
3027
3277
|
isConnectSelectionConfirmed: true,
|
|
3028
|
-
step: "
|
|
3278
|
+
step: "select-asset"
|
|
3029
3279
|
}
|
|
3030
3280
|
};
|
|
3031
|
-
case "
|
|
3281
|
+
case "connect/wallet-picker-requested":
|
|
3032
3282
|
return {
|
|
3033
3283
|
...state,
|
|
3034
|
-
deposit: {
|
|
3035
|
-
...state.deposit,
|
|
3036
|
-
smartAccount: action.smartAccount,
|
|
3037
|
-
smartAccountOwner: action.smartAccountOwner,
|
|
3038
|
-
solanaDepositAddress: _nullishCoalesce(action.solanaDepositAddress, () => ( null))
|
|
3039
|
-
},
|
|
3040
3284
|
flow: {
|
|
3041
3285
|
...state.flow,
|
|
3042
|
-
step:
|
|
3286
|
+
step: "connect",
|
|
3287
|
+
mode: null,
|
|
3288
|
+
isConnectSelectionConfirmed: false,
|
|
3289
|
+
hasNavigatedBack: true
|
|
3290
|
+
},
|
|
3291
|
+
deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
|
|
3292
|
+
dappImport: {
|
|
3293
|
+
...state.dappImport,
|
|
3294
|
+
activeProviderId: null,
|
|
3295
|
+
selectedAsset: null
|
|
3043
3296
|
}
|
|
3044
3297
|
};
|
|
3298
|
+
case "setup/started": {
|
|
3299
|
+
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
3300
|
+
return updateSetupEntry(state, action.owner, () => ({
|
|
3301
|
+
owner: action.owner,
|
|
3302
|
+
requestKey: action.requestKey,
|
|
3303
|
+
cacheKey: action.cacheKey,
|
|
3304
|
+
status: "loading",
|
|
3305
|
+
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _81 => _81.smartAccount]), () => ( null)),
|
|
3306
|
+
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _82 => _82.sessionOwnerAddress]), () => ( null)),
|
|
3307
|
+
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _83 => _83.solanaDepositAddress]), () => ( null)),
|
|
3308
|
+
message: null,
|
|
3309
|
+
cacheable: action.cacheable,
|
|
3310
|
+
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _84 => _84.attemptNonce]), () => ( 0))
|
|
3311
|
+
}));
|
|
3312
|
+
}
|
|
3313
|
+
case "setup/ready": {
|
|
3314
|
+
const key = ownerKey(action.owner);
|
|
3315
|
+
const existing = state.setup.byOwner[key];
|
|
3316
|
+
if (!existing || existing.requestKey !== action.requestKey) {
|
|
3317
|
+
return state;
|
|
3318
|
+
}
|
|
3319
|
+
return updateSetupEntry(state, action.owner, (entry) => ({
|
|
3320
|
+
...entry,
|
|
3321
|
+
status: "ready",
|
|
3322
|
+
smartAccount: action.result.smartAccount,
|
|
3323
|
+
sessionOwnerAddress: action.result.sessionOwnerAddress,
|
|
3324
|
+
solanaDepositAddress: _nullishCoalesce(action.result.solanaDepositAddress, () => ( null)),
|
|
3325
|
+
cacheKey: action.result.cacheKey,
|
|
3326
|
+
message: null
|
|
3327
|
+
}));
|
|
3328
|
+
}
|
|
3329
|
+
case "setup/failed": {
|
|
3330
|
+
const key = ownerKey(action.owner);
|
|
3331
|
+
const existing = state.setup.byOwner[key];
|
|
3332
|
+
if (!existing || existing.requestKey !== action.requestKey) {
|
|
3333
|
+
return state;
|
|
3334
|
+
}
|
|
3335
|
+
return updateSetupEntry(state, action.owner, (entry) => ({
|
|
3336
|
+
...entry,
|
|
3337
|
+
status: "error",
|
|
3338
|
+
message: action.message
|
|
3339
|
+
}));
|
|
3340
|
+
}
|
|
3341
|
+
case "setup/retry-requested":
|
|
3342
|
+
return updateSetupEntry(state, action.owner, (entry) => ({
|
|
3343
|
+
...entry,
|
|
3344
|
+
status: "idle",
|
|
3345
|
+
// Clear requestKey/cacheKey so the BG effect's
|
|
3346
|
+
// "entry.requestKey !== currentRequestKey" check passes even when
|
|
3347
|
+
// inputs haven't changed.
|
|
3348
|
+
requestKey: null,
|
|
3349
|
+
cacheKey: null,
|
|
3350
|
+
message: null,
|
|
3351
|
+
attemptNonce: entry.attemptNonce + 1
|
|
3352
|
+
}));
|
|
3045
3353
|
case "asset/selected":
|
|
3046
3354
|
return {
|
|
3047
3355
|
...state,
|
|
@@ -3112,27 +3420,109 @@ function applyAction(state, action) {
|
|
|
3112
3420
|
},
|
|
3113
3421
|
flow: { ...state.flow, step: "processing" }
|
|
3114
3422
|
};
|
|
3115
|
-
case "
|
|
3116
|
-
return applyBack(state, action.hasWalletOptions);
|
|
3117
|
-
case "flow/reset":
|
|
3423
|
+
case "dapp-import/availability-loading":
|
|
3118
3424
|
return {
|
|
3119
3425
|
...state,
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
selectedWalletId: null
|
|
3128
|
-
},
|
|
3129
|
-
deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
|
|
3130
|
-
processing: {
|
|
3131
|
-
txHash: null,
|
|
3132
|
-
directTransfer: false
|
|
3426
|
+
dappImport: {
|
|
3427
|
+
...state.dappImport,
|
|
3428
|
+
availabilityOwner: action.owner,
|
|
3429
|
+
availability: {
|
|
3430
|
+
...state.dappImport.availabilityOwner && ownerKey(state.dappImport.availabilityOwner) === ownerKey(action.owner) ? state.dappImport.availability : {},
|
|
3431
|
+
[action.providerId]: "loading"
|
|
3432
|
+
}
|
|
3133
3433
|
}
|
|
3134
3434
|
};
|
|
3135
|
-
case "
|
|
3435
|
+
case "dapp-import/availability-loaded":
|
|
3436
|
+
if (!state.dappImport.availabilityOwner || ownerKey(state.dappImport.availabilityOwner) !== ownerKey(action.owner)) {
|
|
3437
|
+
return state;
|
|
3438
|
+
}
|
|
3439
|
+
return {
|
|
3440
|
+
...state,
|
|
3441
|
+
dappImport: {
|
|
3442
|
+
...state.dappImport,
|
|
3443
|
+
availability: {
|
|
3444
|
+
...state.dappImport.availability,
|
|
3445
|
+
[action.providerId]: action.availability
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3449
|
+
case "dapp-import/availability-cleared":
|
|
3450
|
+
return {
|
|
3451
|
+
...state,
|
|
3452
|
+
dappImport: {
|
|
3453
|
+
...state.dappImport,
|
|
3454
|
+
availabilityOwner: null,
|
|
3455
|
+
availability: {},
|
|
3456
|
+
activeProviderId: null,
|
|
3457
|
+
selectedAsset: null
|
|
3458
|
+
}
|
|
3459
|
+
};
|
|
3460
|
+
case "dapp-import/provider-selected":
|
|
3461
|
+
return {
|
|
3462
|
+
...state,
|
|
3463
|
+
flow: {
|
|
3464
|
+
...state.flow,
|
|
3465
|
+
mode: "dapp-import",
|
|
3466
|
+
isConnectSelectionConfirmed: true,
|
|
3467
|
+
step: "dapp-import-asset-select"
|
|
3468
|
+
},
|
|
3469
|
+
dappImport: {
|
|
3470
|
+
...state.dappImport,
|
|
3471
|
+
activeProviderId: action.providerId,
|
|
3472
|
+
selectedAsset: null
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
case "dapp-import/asset-selected":
|
|
3476
|
+
return {
|
|
3477
|
+
...state,
|
|
3478
|
+
deposit: {
|
|
3479
|
+
...state.deposit,
|
|
3480
|
+
selectedAsset: action.asset
|
|
3481
|
+
},
|
|
3482
|
+
dappImport: {
|
|
3483
|
+
...state.dappImport,
|
|
3484
|
+
selectedAsset: action.asset
|
|
3485
|
+
},
|
|
3486
|
+
flow: { ...state.flow, step: "amount" }
|
|
3487
|
+
};
|
|
3488
|
+
case "back/requested":
|
|
3489
|
+
return applyBack(state, action.hasWalletOptions);
|
|
3490
|
+
case "flow/reset": {
|
|
3491
|
+
const preservedByOwner = {};
|
|
3492
|
+
for (const [key, entry] of Object.entries(state.setup.byOwner)) {
|
|
3493
|
+
if (entry.status === "ready" && entry.smartAccount && entry.cacheKey && entry.cacheable) {
|
|
3494
|
+
preservedByOwner[key] = { ...entry, message: null };
|
|
3495
|
+
} else {
|
|
3496
|
+
preservedByOwner[key] = idleEntry(entry.owner);
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
return {
|
|
3500
|
+
...state,
|
|
3501
|
+
flow: {
|
|
3502
|
+
step: "connect",
|
|
3503
|
+
mode: null,
|
|
3504
|
+
isConnectSelectionConfirmed: false,
|
|
3505
|
+
hasNavigatedBack: false
|
|
3506
|
+
},
|
|
3507
|
+
wallet: {
|
|
3508
|
+
selectedWalletId: null
|
|
3509
|
+
},
|
|
3510
|
+
deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
|
|
3511
|
+
processing: {
|
|
3512
|
+
txHash: null,
|
|
3513
|
+
directTransfer: false
|
|
3514
|
+
},
|
|
3515
|
+
// Preserve fetched availability for its recorded EOA — refetching on
|
|
3516
|
+
// every modal close burns a request. Just clear active selection.
|
|
3517
|
+
dappImport: {
|
|
3518
|
+
...state.dappImport,
|
|
3519
|
+
activeProviderId: null,
|
|
3520
|
+
selectedAsset: null
|
|
3521
|
+
},
|
|
3522
|
+
setup: { byOwner: preservedByOwner }
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
case "target/changed": {
|
|
3136
3526
|
if (state.flow.step === "processing") {
|
|
3137
3527
|
return {
|
|
3138
3528
|
...state,
|
|
@@ -3143,18 +3533,20 @@ function applyAction(state, action) {
|
|
|
3143
3533
|
}
|
|
3144
3534
|
};
|
|
3145
3535
|
}
|
|
3536
|
+
const nextStep = state.flow.step === "confirm" ? "amount" : state.flow.step;
|
|
3146
3537
|
return {
|
|
3147
3538
|
...state,
|
|
3148
3539
|
deposit: {
|
|
3149
3540
|
...state.deposit,
|
|
3150
3541
|
targetChain: action.targetChain,
|
|
3151
3542
|
targetToken: action.targetToken,
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3543
|
+
targetAmount: null,
|
|
3544
|
+
targetTokenPriceUsd: null,
|
|
3545
|
+
liquidityWarning: null
|
|
3155
3546
|
},
|
|
3156
|
-
flow: { ...state.flow, step:
|
|
3547
|
+
flow: { ...state.flow, step: nextStep }
|
|
3157
3548
|
};
|
|
3549
|
+
}
|
|
3158
3550
|
default:
|
|
3159
3551
|
return unreachable(action);
|
|
3160
3552
|
}
|
|
@@ -3173,9 +3565,6 @@ function createInitialState(overrides) {
|
|
|
3173
3565
|
selectedWalletId: null
|
|
3174
3566
|
},
|
|
3175
3567
|
deposit: {
|
|
3176
|
-
smartAccount: null,
|
|
3177
|
-
smartAccountOwner: null,
|
|
3178
|
-
solanaDepositAddress: null,
|
|
3179
3568
|
targetChain: overrides.targetChain,
|
|
3180
3569
|
targetToken: overrides.targetToken,
|
|
3181
3570
|
sourceChain: null,
|
|
@@ -3195,12 +3584,38 @@ function createInitialState(overrides) {
|
|
|
3195
3584
|
processing: {
|
|
3196
3585
|
txHash: null,
|
|
3197
3586
|
directTransfer: false
|
|
3587
|
+
},
|
|
3588
|
+
dappImport: {
|
|
3589
|
+
activeProviderId: null,
|
|
3590
|
+
availabilityOwner: null,
|
|
3591
|
+
availability: {},
|
|
3592
|
+
selectedAsset: null
|
|
3593
|
+
},
|
|
3594
|
+
setup: {
|
|
3595
|
+
byOwner: {}
|
|
3198
3596
|
}
|
|
3199
3597
|
};
|
|
3200
3598
|
}
|
|
3201
3599
|
|
|
3202
3600
|
// src/store/selectors.ts
|
|
3203
3601
|
var selectedWalletIdSelector = (state) => state.wallet.selectedWalletId;
|
|
3602
|
+
var IDLE_SETUP_ENTRY = {
|
|
3603
|
+
owner: null,
|
|
3604
|
+
requestKey: null,
|
|
3605
|
+
cacheKey: null,
|
|
3606
|
+
status: "idle",
|
|
3607
|
+
smartAccount: null,
|
|
3608
|
+
sessionOwnerAddress: null,
|
|
3609
|
+
solanaDepositAddress: null,
|
|
3610
|
+
message: null,
|
|
3611
|
+
cacheable: true,
|
|
3612
|
+
attemptNonce: 0
|
|
3613
|
+
};
|
|
3614
|
+
function readSetupForOwner(setup, owner) {
|
|
3615
|
+
if (!owner) return IDLE_SETUP_ENTRY;
|
|
3616
|
+
const entry = setup.byOwner[owner.toLowerCase()];
|
|
3617
|
+
return _nullishCoalesce(entry, () => ( { ...IDLE_SETUP_ENTRY, owner }));
|
|
3618
|
+
}
|
|
3204
3619
|
|
|
3205
3620
|
// src/store/index.ts
|
|
3206
3621
|
function createDepositStore(overrides) {
|
|
@@ -3237,8 +3652,229 @@ function useDepositStore(selector) {
|
|
|
3237
3652
|
return _zustand.useStore.call(void 0, store, selector);
|
|
3238
3653
|
}
|
|
3239
3654
|
|
|
3655
|
+
// src/core/account-setup.ts
|
|
3656
|
+
var SetupError = class extends Error {
|
|
3657
|
+
constructor(message, category) {
|
|
3658
|
+
super(message);
|
|
3659
|
+
this.category = category;
|
|
3660
|
+
this.name = "SetupError";
|
|
3661
|
+
}
|
|
3662
|
+
};
|
|
3663
|
+
async function resolveSessionOwner(eoaAddress) {
|
|
3664
|
+
const local = _chunkV6NJIPSScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
3665
|
+
if (local) {
|
|
3666
|
+
return {
|
|
3667
|
+
account: _chunkV6NJIPSScjs.accountFromPrivateKey.call(void 0, local.privateKey),
|
|
3668
|
+
address: local.address
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
const created = _chunkV6NJIPSScjs.createSessionOwnerKey.call(void 0, );
|
|
3672
|
+
_chunkV6NJIPSScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
3673
|
+
return { account: created.account, address: created.address };
|
|
3674
|
+
}
|
|
3675
|
+
function stableStringify(value) {
|
|
3676
|
+
if (value === null || typeof value !== "object") {
|
|
3677
|
+
return JSON.stringify(value);
|
|
3678
|
+
}
|
|
3679
|
+
if (Array.isArray(value)) {
|
|
3680
|
+
return `[${value.map(stableStringify).join(",")}]`;
|
|
3681
|
+
}
|
|
3682
|
+
const obj = value;
|
|
3683
|
+
const keys = Object.keys(obj).sort();
|
|
3684
|
+
const entries = keys.filter((k) => obj[k] !== void 0).map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k])}`);
|
|
3685
|
+
return `{${entries.join(",")}}`;
|
|
3686
|
+
}
|
|
3687
|
+
function computeRequestKey(input, sessionOwnerAddress) {
|
|
3688
|
+
return stableStringify({
|
|
3689
|
+
ownerAddress: input.ownerAddress.toLowerCase(),
|
|
3690
|
+
sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
|
|
3691
|
+
targetChain: input.targetChain,
|
|
3692
|
+
targetToken: input.targetToken.toLowerCase(),
|
|
3693
|
+
recipient: _optionalChain([input, 'access', _85 => _85.recipient, 'optionalAccess', _86 => _86.toLowerCase, 'call', _87 => _87()]),
|
|
3694
|
+
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
3695
|
+
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
3696
|
+
signerAddress: input.signerAddress.toLowerCase(),
|
|
3697
|
+
sessionChainIds: _nullishCoalesce(input.sessionChainIds, () => ( null)),
|
|
3698
|
+
enableSolana: _nullishCoalesce(input.enableSolana, () => ( true)),
|
|
3699
|
+
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false)),
|
|
3700
|
+
postBridgeActions: _nullishCoalesce(input.postBridgeActions, () => ( null))
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
function computeCacheKey(input, sessionOwnerAddress) {
|
|
3704
|
+
return stableStringify({
|
|
3705
|
+
ownerAddress: input.ownerAddress.toLowerCase(),
|
|
3706
|
+
sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
|
|
3707
|
+
targetChain: input.targetChain,
|
|
3708
|
+
targetToken: input.targetToken.toLowerCase(),
|
|
3709
|
+
recipient: _optionalChain([input, 'access', _88 => _88.recipient, 'optionalAccess', _89 => _89.toLowerCase, 'call', _90 => _90()]),
|
|
3710
|
+
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
3711
|
+
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
3712
|
+
signerAddress: input.signerAddress.toLowerCase(),
|
|
3713
|
+
sessionChainIds: _nullishCoalesce(input.sessionChainIds, () => ( null)),
|
|
3714
|
+
enableSolana: _nullishCoalesce(input.enableSolana, () => ( true))
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
function computeIsCacheable(input) {
|
|
3718
|
+
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access', _91 => _91.postBridgeActions, 'optionalAccess', _92 => _92.length]), () => ( 0)));
|
|
3719
|
+
}
|
|
3720
|
+
async function runAccountSetup(input, deps) {
|
|
3721
|
+
const { service, debug } = deps;
|
|
3722
|
+
const enableSolana = _nullishCoalesce(input.enableSolana, () => ( true));
|
|
3723
|
+
try {
|
|
3724
|
+
const sessionOwner = await resolveSessionOwner(input.ownerAddress);
|
|
3725
|
+
const cacheKey = computeCacheKey(input, sessionOwner.address);
|
|
3726
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
|
|
3727
|
+
owner: input.ownerAddress,
|
|
3728
|
+
sessionOwner: sessionOwner.address,
|
|
3729
|
+
hasPostBridgeActions: Boolean(_optionalChain([input, 'access', _93 => _93.postBridgeActions, 'optionalAccess', _94 => _94.length])),
|
|
3730
|
+
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
3731
|
+
});
|
|
3732
|
+
const setup = await service.setupAccount({
|
|
3733
|
+
ownerAddress: input.ownerAddress,
|
|
3734
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
3735
|
+
targetChain: _chunkV6NJIPSScjs.toEvmCaip2.call(void 0, input.targetChain),
|
|
3736
|
+
targetToken: input.targetToken,
|
|
3737
|
+
recipient: input.recipient,
|
|
3738
|
+
postBridgeActions: input.postBridgeActions,
|
|
3739
|
+
outputTokenRules: input.outputTokenRules,
|
|
3740
|
+
rejectUnmapped: input.rejectUnmapped,
|
|
3741
|
+
signerAddress: input.signerAddress,
|
|
3742
|
+
sessionChainIds: input.sessionChainIds,
|
|
3743
|
+
forceRegister: input.forceRegister
|
|
3744
|
+
});
|
|
3745
|
+
const smartAccount = setup.smartAccount;
|
|
3746
|
+
if (!setup.needsRegistration) {
|
|
3747
|
+
return {
|
|
3748
|
+
smartAccount,
|
|
3749
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
3750
|
+
solanaDepositAddress: enableSolana ? setup.solanaDepositAddress : void 0,
|
|
3751
|
+
cacheKey,
|
|
3752
|
+
isRegistered: true
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3755
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
3756
|
+
throw new SetupError(
|
|
3757
|
+
"Couldn't prepare account.",
|
|
3758
|
+
"server"
|
|
3759
|
+
);
|
|
3760
|
+
}
|
|
3761
|
+
if (!sessionOwner.account.signTypedData) {
|
|
3762
|
+
throw new SetupError(
|
|
3763
|
+
"Couldn't prepare account.",
|
|
3764
|
+
"client"
|
|
3765
|
+
);
|
|
3766
|
+
}
|
|
3767
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
3768
|
+
const signature = await sessionOwner.account.signTypedData({
|
|
3769
|
+
domain: typedData.domain,
|
|
3770
|
+
types: typedData.types,
|
|
3771
|
+
primaryType: typedData.primaryType,
|
|
3772
|
+
message: typedData.message
|
|
3773
|
+
});
|
|
3774
|
+
const sessionDetails = _chunkV6NJIPSScjs.buildSessionDetails.call(void 0,
|
|
3775
|
+
setup.sessionDetailsUnsigned,
|
|
3776
|
+
signature
|
|
3777
|
+
);
|
|
3778
|
+
const registerResult = await service.registerAccount({
|
|
3779
|
+
address: smartAccount,
|
|
3780
|
+
accountParams: {
|
|
3781
|
+
factory: setup.accountParams.factory,
|
|
3782
|
+
factoryData: setup.accountParams.factoryData,
|
|
3783
|
+
sessionDetails
|
|
3784
|
+
},
|
|
3785
|
+
eoaAddress: input.ownerAddress,
|
|
3786
|
+
sessionOwner: sessionOwner.address,
|
|
3787
|
+
target: {
|
|
3788
|
+
chain: _chunkV6NJIPSScjs.toEvmCaip2.call(void 0, input.targetChain),
|
|
3789
|
+
token: input.targetToken,
|
|
3790
|
+
...input.recipient && { recipient: input.recipient },
|
|
3791
|
+
..._optionalChain([input, 'access', _95 => _95.postBridgeActions, 'optionalAccess', _96 => _96.length]) && {
|
|
3792
|
+
postBridgeActions: input.postBridgeActions
|
|
3793
|
+
},
|
|
3794
|
+
..._optionalChain([input, 'access', _97 => _97.outputTokenRules, 'optionalAccess', _98 => _98.length]) && {
|
|
3795
|
+
outputTokenRules: input.outputTokenRules
|
|
3796
|
+
},
|
|
3797
|
+
...input.rejectUnmapped != null && {
|
|
3798
|
+
rejectUnmapped: input.rejectUnmapped
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
});
|
|
3802
|
+
return {
|
|
3803
|
+
smartAccount,
|
|
3804
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
3805
|
+
solanaDepositAddress: enableSolana ? registerResult.solanaDepositAddress : void 0,
|
|
3806
|
+
cacheKey,
|
|
3807
|
+
isRegistered: true
|
|
3808
|
+
};
|
|
3809
|
+
} catch (error) {
|
|
3810
|
+
_chunkV6NJIPSScjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
|
|
3811
|
+
owner: input.ownerAddress
|
|
3812
|
+
});
|
|
3813
|
+
if (error instanceof SetupError) throw error;
|
|
3814
|
+
throw mapError(error);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
function mapError(error) {
|
|
3818
|
+
if (error instanceof TypeError) {
|
|
3819
|
+
return new SetupError(
|
|
3820
|
+
"Couldn't reach the deposit service. Please check your connection.",
|
|
3821
|
+
"network"
|
|
3822
|
+
);
|
|
3823
|
+
}
|
|
3824
|
+
if (error instanceof Error) {
|
|
3825
|
+
const statusMatch = error.message.match(/\b(4\d{2}|5\d{2})\b/);
|
|
3826
|
+
if (statusMatch) {
|
|
3827
|
+
const status = Number(statusMatch[1]);
|
|
3828
|
+
if (status >= 500) {
|
|
3829
|
+
return new SetupError(
|
|
3830
|
+
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
3831
|
+
"server"
|
|
3832
|
+
);
|
|
3833
|
+
}
|
|
3834
|
+
return new SetupError("Couldn't prepare account.", "client");
|
|
3835
|
+
}
|
|
3836
|
+
return new SetupError(
|
|
3837
|
+
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
3838
|
+
"unknown"
|
|
3839
|
+
);
|
|
3840
|
+
}
|
|
3841
|
+
return new SetupError(
|
|
3842
|
+
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
3843
|
+
"unknown"
|
|
3844
|
+
);
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3240
3847
|
// src/DepositFlow.tsx
|
|
3241
3848
|
|
|
3849
|
+
function AccountPreparingSkeleton({
|
|
3850
|
+
errorMessage,
|
|
3851
|
+
onRetry
|
|
3852
|
+
}) {
|
|
3853
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
3854
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
|
|
3856
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: errorMessage })
|
|
3857
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
|
|
3858
|
+
errorMessage && onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3859
|
+
"button",
|
|
3860
|
+
{
|
|
3861
|
+
type: "button",
|
|
3862
|
+
className: "rs-button rs-button--default rs-button--full-width",
|
|
3863
|
+
onClick: onRetry,
|
|
3864
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Try again" })
|
|
3865
|
+
}
|
|
3866
|
+
) })
|
|
3867
|
+
] });
|
|
3868
|
+
}
|
|
3869
|
+
function SetupUpdatingBanner({
|
|
3870
|
+
status,
|
|
3871
|
+
message
|
|
3872
|
+
}) {
|
|
3873
|
+
if (status === "error") {
|
|
3874
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", role: "alert", children: _nullishCoalesce(message, () => ( "Couldn't update deposit details \u2014 please retry.")) });
|
|
3875
|
+
}
|
|
3876
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", style: { padding: "8px 16px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Updating deposit details\u2026" }) }) });
|
|
3877
|
+
}
|
|
3242
3878
|
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
3243
3879
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
3244
3880
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
@@ -3246,37 +3882,39 @@ function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
|
3246
3882
|
function getAddressKey(address) {
|
|
3247
3883
|
return address ? address.toLowerCase() : null;
|
|
3248
3884
|
}
|
|
3249
|
-
function deriveStep(flow, d, p) {
|
|
3885
|
+
function deriveStep(flow, d, p, activeEntry) {
|
|
3250
3886
|
const flowStep = flow.step;
|
|
3887
|
+
const smartAccount = activeEntry.smartAccount;
|
|
3888
|
+
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
3251
3889
|
switch (flowStep) {
|
|
3252
3890
|
case "connect":
|
|
3253
3891
|
case "setup":
|
|
3254
3892
|
return { type: "setup" };
|
|
3255
3893
|
case "deposit-address":
|
|
3256
|
-
if (!
|
|
3894
|
+
if (!smartAccount) return { type: "setup" };
|
|
3257
3895
|
return {
|
|
3258
3896
|
type: "deposit-address",
|
|
3259
|
-
smartAccount
|
|
3260
|
-
solanaDepositAddress: _nullishCoalesce(
|
|
3897
|
+
smartAccount,
|
|
3898
|
+
solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0))
|
|
3261
3899
|
};
|
|
3262
3900
|
case "select-asset":
|
|
3263
|
-
if (!
|
|
3264
|
-
return { type: "select-asset", smartAccount
|
|
3901
|
+
if (!smartAccount) return { type: "setup" };
|
|
3902
|
+
return { type: "select-asset", smartAccount };
|
|
3265
3903
|
case "amount":
|
|
3266
|
-
if (!
|
|
3904
|
+
if (!smartAccount || !d.selectedAsset) return { type: "setup" };
|
|
3267
3905
|
return {
|
|
3268
3906
|
type: "amount",
|
|
3269
|
-
smartAccount
|
|
3907
|
+
smartAccount,
|
|
3270
3908
|
asset: d.selectedAsset,
|
|
3271
3909
|
amount: _nullishCoalesce(d.amount, () => ( void 0))
|
|
3272
3910
|
};
|
|
3273
3911
|
case "confirm":
|
|
3274
|
-
if (!
|
|
3912
|
+
if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
|
|
3275
3913
|
return { type: "setup" };
|
|
3276
3914
|
}
|
|
3277
3915
|
return {
|
|
3278
3916
|
type: "confirm",
|
|
3279
|
-
smartAccount
|
|
3917
|
+
smartAccount,
|
|
3280
3918
|
asset: d.selectedAsset,
|
|
3281
3919
|
amount: d.amount,
|
|
3282
3920
|
targetAmount: d.targetAmount,
|
|
@@ -3285,33 +3923,36 @@ function deriveStep(flow, d, p) {
|
|
|
3285
3923
|
liquidityWarning: _nullishCoalesce(d.liquidityWarning, () => ( void 0))
|
|
3286
3924
|
};
|
|
3287
3925
|
case "solana-token-select":
|
|
3288
|
-
if (!
|
|
3926
|
+
if (!smartAccount || !solanaDepositAddress) return { type: "setup" };
|
|
3289
3927
|
return {
|
|
3290
3928
|
type: "solana-token-select",
|
|
3291
|
-
smartAccount
|
|
3292
|
-
solanaDepositAddress
|
|
3929
|
+
smartAccount,
|
|
3930
|
+
solanaDepositAddress
|
|
3293
3931
|
};
|
|
3294
3932
|
case "solana-amount":
|
|
3295
|
-
if (!
|
|
3933
|
+
if (!smartAccount || !solanaDepositAddress || !d.selectedSolanaToken || d.balance === null || d.balanceUsd === null) {
|
|
3296
3934
|
return { type: "setup" };
|
|
3297
3935
|
}
|
|
3298
3936
|
return {
|
|
3299
3937
|
type: "solana-amount",
|
|
3300
|
-
smartAccount
|
|
3301
|
-
solanaDepositAddress
|
|
3938
|
+
smartAccount,
|
|
3939
|
+
solanaDepositAddress,
|
|
3302
3940
|
token: d.selectedSolanaToken,
|
|
3303
3941
|
balance: d.balance,
|
|
3304
3942
|
balanceUsd: d.balanceUsd,
|
|
3305
3943
|
inputAmountUsd: _nullishCoalesce(d.inputAmountUsd, () => ( void 0))
|
|
3306
3944
|
};
|
|
3945
|
+
case "dapp-import-asset-select":
|
|
3946
|
+
if (!smartAccount) return { type: "setup" };
|
|
3947
|
+
return { type: "dapp-import-asset-select", smartAccount };
|
|
3307
3948
|
case "solana-confirm":
|
|
3308
|
-
if (!
|
|
3949
|
+
if (!smartAccount || !solanaDepositAddress || !d.selectedSolanaToken || !d.amount || !d.inputAmountUsd || !d.targetAmount || d.balance === null || d.balanceUsd === null) {
|
|
3309
3950
|
return { type: "setup" };
|
|
3310
3951
|
}
|
|
3311
3952
|
return {
|
|
3312
3953
|
type: "solana-confirm",
|
|
3313
|
-
smartAccount
|
|
3314
|
-
solanaDepositAddress
|
|
3954
|
+
smartAccount,
|
|
3955
|
+
solanaDepositAddress,
|
|
3315
3956
|
token: d.selectedSolanaToken,
|
|
3316
3957
|
sourceAmount: d.amount,
|
|
3317
3958
|
inputAmountUsd: d.inputAmountUsd,
|
|
@@ -3321,13 +3962,13 @@ function deriveStep(flow, d, p) {
|
|
|
3321
3962
|
balanceUsd: d.balanceUsd
|
|
3322
3963
|
};
|
|
3323
3964
|
case "processing":
|
|
3324
|
-
if (!
|
|
3965
|
+
if (!smartAccount || !p.txHash || !d.amount || d.sourceChain === null || d.sourceChain === "unknown" || !d.sourceToken) {
|
|
3325
3966
|
return { type: "setup" };
|
|
3326
3967
|
}
|
|
3327
3968
|
return {
|
|
3328
3969
|
type: "processing",
|
|
3329
|
-
smartAccount
|
|
3330
|
-
solanaDepositAddress: _nullishCoalesce(
|
|
3970
|
+
smartAccount,
|
|
3971
|
+
solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0)),
|
|
3331
3972
|
txHash: p.txHash,
|
|
3332
3973
|
sourceChain: d.sourceChain,
|
|
3333
3974
|
sourceToken: d.sourceToken,
|
|
@@ -3338,6 +3979,19 @@ function deriveStep(flow, d, p) {
|
|
|
3338
3979
|
};
|
|
3339
3980
|
}
|
|
3340
3981
|
}
|
|
3982
|
+
function resolveOwnerForMode(mode, ctx) {
|
|
3983
|
+
switch (mode) {
|
|
3984
|
+
case "deposit-address":
|
|
3985
|
+
case "solana-wallet":
|
|
3986
|
+
return _nullishCoalesce(ctx.dappAddress, () => ( null));
|
|
3987
|
+
case "wallet":
|
|
3988
|
+
return _nullishCoalesce(ctx.walletOwner, () => ( null));
|
|
3989
|
+
case "dapp-import":
|
|
3990
|
+
return _nullishCoalesce(ctx.dappImportOwner, () => ( null));
|
|
3991
|
+
default:
|
|
3992
|
+
return null;
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3341
3995
|
function DepositFlow({
|
|
3342
3996
|
dappWalletClient,
|
|
3343
3997
|
dappPublicClient,
|
|
@@ -3358,6 +4012,7 @@ function DepositFlow({
|
|
|
3358
4012
|
forceRegister = false,
|
|
3359
4013
|
waitForFinalTx = true,
|
|
3360
4014
|
enableSolana = true,
|
|
4015
|
+
dappImports,
|
|
3361
4016
|
reownWallet,
|
|
3362
4017
|
onConnect,
|
|
3363
4018
|
onDisconnect,
|
|
@@ -3371,12 +4026,12 @@ function DepositFlow({
|
|
|
3371
4026
|
onError,
|
|
3372
4027
|
debug
|
|
3373
4028
|
}) {
|
|
3374
|
-
const onStepChangeRef =
|
|
3375
|
-
const onEventRef =
|
|
3376
|
-
const onLifecycleRef =
|
|
3377
|
-
const onErrorRef =
|
|
4029
|
+
const onStepChangeRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onStepChange);
|
|
4030
|
+
const onEventRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onEvent);
|
|
4031
|
+
const onLifecycleRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onLifecycle);
|
|
4032
|
+
const onErrorRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onError);
|
|
3378
4033
|
const hasInitialReownSession = Boolean(
|
|
3379
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
4034
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _99 => _99.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _100 => _100.address]) : _optionalChain([reownWallet, 'optionalAccess', _101 => _101.address])
|
|
3380
4035
|
);
|
|
3381
4036
|
const hasInitialWalletHydrationPending = Boolean(
|
|
3382
4037
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -3385,26 +4040,11 @@ function DepositFlow({
|
|
|
3385
4040
|
const flowSlice = useDepositStore((s) => s.flow);
|
|
3386
4041
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
3387
4042
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
3388
|
-
const
|
|
3389
|
-
() => deriveStep(flowSlice, depositSlice, processingSlice),
|
|
3390
|
-
[flowSlice, depositSlice, processingSlice]
|
|
3391
|
-
);
|
|
4043
|
+
const setupSlice = useDepositStore((s) => s.setup);
|
|
3392
4044
|
const flowMode = flowSlice.mode;
|
|
3393
4045
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
3394
4046
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
3395
4047
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
3396
|
-
const setFlowMode = _react.useCallback.call(void 0,
|
|
3397
|
-
(mode) => storeApi.dispatch({ type: "flow/mode-set", mode }),
|
|
3398
|
-
[storeApi]
|
|
3399
|
-
);
|
|
3400
|
-
const setIsConnectSelectionConfirmed = _react.useCallback.call(void 0,
|
|
3401
|
-
(value) => storeApi.dispatch({ type: "flow/connect-confirmed-set", value }),
|
|
3402
|
-
[storeApi]
|
|
3403
|
-
);
|
|
3404
|
-
const setSelectedWalletId = _react.useCallback.call(void 0,
|
|
3405
|
-
(walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
|
|
3406
|
-
[storeApi]
|
|
3407
|
-
);
|
|
3408
4048
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
3409
4049
|
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = _react.useState.call(void 0, () => !hasInitialWalletHydrationPending);
|
|
3410
4050
|
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
@@ -3412,13 +4052,13 @@ function DepositFlow({
|
|
|
3412
4052
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
3413
4053
|
const logFlow = _react.useCallback.call(void 0,
|
|
3414
4054
|
(message, data) => {
|
|
3415
|
-
|
|
4055
|
+
_chunkV6NJIPSScjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
3416
4056
|
},
|
|
3417
4057
|
[debug]
|
|
3418
4058
|
);
|
|
3419
4059
|
const logFlowError = _react.useCallback.call(void 0,
|
|
3420
4060
|
(message, error, data) => {
|
|
3421
|
-
|
|
4061
|
+
_chunkV6NJIPSScjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
3422
4062
|
},
|
|
3423
4063
|
[debug]
|
|
3424
4064
|
);
|
|
@@ -3434,19 +4074,19 @@ function DepositFlow({
|
|
|
3434
4074
|
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
3435
4075
|
);
|
|
3436
4076
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
3437
|
-
} catch (
|
|
4077
|
+
} catch (e27) {
|
|
3438
4078
|
}
|
|
3439
4079
|
}
|
|
3440
4080
|
}
|
|
3441
4081
|
return null;
|
|
3442
4082
|
}, []);
|
|
3443
4083
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
3444
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4084
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _102 => _102.switchChain])) return void 0;
|
|
3445
4085
|
return async (chainId) => {
|
|
3446
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
4086
|
+
await _optionalChain([dappWalletClient, 'access', _103 => _103.switchChain, 'optionalCall', _104 => _104({ id: chainId })]);
|
|
3447
4087
|
};
|
|
3448
4088
|
}, [dappWalletClient]);
|
|
3449
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4089
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _105 => _105.account, 'optionalAccess', _106 => _106.address]), () => ( null));
|
|
3450
4090
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
3451
4091
|
const options = [];
|
|
3452
4092
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3460,7 +4100,7 @@ function DepositFlow({
|
|
|
3460
4100
|
});
|
|
3461
4101
|
seen.add(id);
|
|
3462
4102
|
}
|
|
3463
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
4103
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _107 => _107.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
3464
4104
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
3465
4105
|
if (!seen.has(id)) {
|
|
3466
4106
|
options.push({
|
|
@@ -3472,7 +4112,7 @@ function DepositFlow({
|
|
|
3472
4112
|
});
|
|
3473
4113
|
seen.add(id);
|
|
3474
4114
|
}
|
|
3475
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
4115
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _108 => _108.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
3476
4116
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
3477
4117
|
if (!seen.has(id)) {
|
|
3478
4118
|
options.push({
|
|
@@ -3489,25 +4129,25 @@ function DepositFlow({
|
|
|
3489
4129
|
}, [
|
|
3490
4130
|
connectedWalletAddress,
|
|
3491
4131
|
dappAddress,
|
|
3492
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3493
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3494
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3495
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3496
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4132
|
+
_optionalChain([reownWallet, 'optionalAccess', _109 => _109.address]),
|
|
4133
|
+
_optionalChain([reownWallet, 'optionalAccess', _110 => _110.isConnected]),
|
|
4134
|
+
_optionalChain([reownWallet, 'optionalAccess', _111 => _111.walletClient]),
|
|
4135
|
+
_optionalChain([reownWallet, 'optionalAccess', _112 => _112.publicClient]),
|
|
4136
|
+
_optionalChain([reownWallet, 'optionalAccess', _113 => _113.icon]),
|
|
3497
4137
|
enableSolana,
|
|
3498
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3499
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3500
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4138
|
+
_optionalChain([reownWallet, 'optionalAccess', _114 => _114.isSolana]),
|
|
4139
|
+
_optionalChain([reownWallet, 'optionalAccess', _115 => _115.solanaAddress]),
|
|
4140
|
+
_optionalChain([reownWallet, 'optionalAccess', _116 => _116.caipAddress])
|
|
3501
4141
|
]);
|
|
3502
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
4142
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _117 => _117.account]) && dappAddress && !reownWallet;
|
|
3503
4143
|
const hasWalletOptions = walletOptions.length > 0;
|
|
3504
4144
|
const hasReownSession = Boolean(
|
|
3505
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
4145
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _118 => _118.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _119 => _119.address]) : _optionalChain([reownWallet, 'optionalAccess', _120 => _120.address])
|
|
3506
4146
|
);
|
|
3507
4147
|
const isWalletHydrationPending = Boolean(
|
|
3508
4148
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
3509
4149
|
);
|
|
3510
|
-
const showConnectStep = flowMode === null && !
|
|
4150
|
+
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
3511
4151
|
_react.useEffect.call(void 0, () => {
|
|
3512
4152
|
if (!isWalletHydrationPending) {
|
|
3513
4153
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
@@ -3520,7 +4160,7 @@ function DepositFlow({
|
|
|
3520
4160
|
return () => window.clearTimeout(timeout);
|
|
3521
4161
|
}, [isWalletHydrationPending]);
|
|
3522
4162
|
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
3523
|
-
if (flowMode !== "wallet") return null;
|
|
4163
|
+
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
3524
4164
|
if (canAutoLock) {
|
|
3525
4165
|
return getAddressKey(connectedWalletAddress);
|
|
3526
4166
|
}
|
|
@@ -3542,16 +4182,16 @@ function DepositFlow({
|
|
|
3542
4182
|
return {
|
|
3543
4183
|
ownerAddress: dappAddress,
|
|
3544
4184
|
walletClient: void 0,
|
|
3545
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4185
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
|
|
3546
4186
|
switchChain: void 0
|
|
3547
4187
|
};
|
|
3548
4188
|
}
|
|
3549
4189
|
if (canAutoLock) {
|
|
3550
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4190
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _121 => _121.chain, 'optionalAccess', _122 => _122.id]), () => ( targetChain));
|
|
3551
4191
|
return {
|
|
3552
4192
|
ownerAddress: dappWalletClient.account.address,
|
|
3553
4193
|
walletClient: dappWalletClient,
|
|
3554
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4194
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3555
4195
|
switchChain: dappSwitchChain
|
|
3556
4196
|
};
|
|
3557
4197
|
}
|
|
@@ -3565,24 +4205,24 @@ function DepositFlow({
|
|
|
3565
4205
|
return {
|
|
3566
4206
|
ownerAddress: dappAddress,
|
|
3567
4207
|
walletClient: void 0,
|
|
3568
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4208
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
|
|
3569
4209
|
switchChain: void 0
|
|
3570
4210
|
};
|
|
3571
4211
|
}
|
|
3572
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
3573
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4212
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _123 => _123.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
4213
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _124 => _124.chain, 'optionalAccess', _125 => _125.id]), () => ( targetChain));
|
|
3574
4214
|
return {
|
|
3575
4215
|
ownerAddress: dappWalletClient.account.address,
|
|
3576
4216
|
walletClient: dappWalletClient,
|
|
3577
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4217
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3578
4218
|
switchChain: dappSwitchChain
|
|
3579
4219
|
};
|
|
3580
4220
|
}
|
|
3581
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
4221
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _126 => _126.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
3582
4222
|
return {
|
|
3583
4223
|
ownerAddress: reownWallet.address,
|
|
3584
4224
|
walletClient: reownWallet.walletClient,
|
|
3585
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
4225
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
|
|
3586
4226
|
switchChain: reownWallet.switchChain
|
|
3587
4227
|
};
|
|
3588
4228
|
}
|
|
@@ -3600,7 +4240,7 @@ function DepositFlow({
|
|
|
3600
4240
|
targetChain
|
|
3601
4241
|
]);
|
|
3602
4242
|
_react.useEffect.call(void 0, () => {
|
|
3603
|
-
if (flowMode !== "wallet") {
|
|
4243
|
+
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
3604
4244
|
stableWalletSelectionKeyRef.current = null;
|
|
3605
4245
|
stableWalletSignerRef.current = null;
|
|
3606
4246
|
return;
|
|
@@ -3620,11 +4260,11 @@ function DepositFlow({
|
|
|
3620
4260
|
return {
|
|
3621
4261
|
ownerAddress: dappAddress,
|
|
3622
4262
|
walletClient: void 0,
|
|
3623
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4263
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
|
|
3624
4264
|
switchChain: void 0
|
|
3625
4265
|
};
|
|
3626
4266
|
}
|
|
3627
|
-
if (flowMode !== "wallet") {
|
|
4267
|
+
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
3628
4268
|
return null;
|
|
3629
4269
|
}
|
|
3630
4270
|
if (walletSignerContext) {
|
|
@@ -3642,7 +4282,92 @@ function DepositFlow({
|
|
|
3642
4282
|
walletSignerContext,
|
|
3643
4283
|
walletSelectionKey
|
|
3644
4284
|
]);
|
|
3645
|
-
const
|
|
4285
|
+
const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
|
|
4286
|
+
if (!selectedWalletId) return null;
|
|
4287
|
+
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4288
|
+
if (_optionalChain([opt, 'optionalAccess', _127 => _127.kind]) === "external" && opt.address) {
|
|
4289
|
+
return opt.address;
|
|
4290
|
+
}
|
|
4291
|
+
if (_optionalChain([opt, 'optionalAccess', _128 => _128.kind]) === "connected" && opt.address) {
|
|
4292
|
+
return opt.address;
|
|
4293
|
+
}
|
|
4294
|
+
return null;
|
|
4295
|
+
}, [selectedWalletId, walletOptions]);
|
|
4296
|
+
const dappImportOwner = _react.useMemo.call(void 0, () => {
|
|
4297
|
+
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4298
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _129 => _129.address]) && reownWallet.isConnected) {
|
|
4299
|
+
return reownWallet.address;
|
|
4300
|
+
}
|
|
4301
|
+
if (connectedWalletAddress) return connectedWalletAddress;
|
|
4302
|
+
return null;
|
|
4303
|
+
}, [
|
|
4304
|
+
selectedEvmWalletOwner,
|
|
4305
|
+
_optionalChain([reownWallet, 'optionalAccess', _130 => _130.address]),
|
|
4306
|
+
_optionalChain([reownWallet, 'optionalAccess', _131 => _131.isConnected]),
|
|
4307
|
+
connectedWalletAddress
|
|
4308
|
+
]);
|
|
4309
|
+
const activeOwner = _react.useMemo.call(void 0,
|
|
4310
|
+
() => resolveOwnerForMode(flowMode, {
|
|
4311
|
+
dappAddress,
|
|
4312
|
+
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _132 => _132.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
|
|
4313
|
+
dappImportOwner
|
|
4314
|
+
}),
|
|
4315
|
+
[
|
|
4316
|
+
flowMode,
|
|
4317
|
+
dappAddress,
|
|
4318
|
+
_optionalChain([signerContext, 'optionalAccess', _133 => _133.ownerAddress]),
|
|
4319
|
+
canAutoLock,
|
|
4320
|
+
connectedWalletAddress,
|
|
4321
|
+
selectedEvmWalletOwner,
|
|
4322
|
+
dappImportOwner
|
|
4323
|
+
]
|
|
4324
|
+
);
|
|
4325
|
+
const activeEntry = _react.useMemo.call(void 0,
|
|
4326
|
+
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4327
|
+
[setupSlice, activeOwner]
|
|
4328
|
+
);
|
|
4329
|
+
const lastActiveSetupLifecycleKeyRef = _react.useRef.call(void 0, null);
|
|
4330
|
+
_react.useEffect.call(void 0, () => {
|
|
4331
|
+
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
4332
|
+
lastActiveSetupLifecycleKeyRef.current = null;
|
|
4333
|
+
return;
|
|
4334
|
+
}
|
|
4335
|
+
if (!activeOwner || activeEntry.status !== "ready" || !activeEntry.smartAccount) {
|
|
4336
|
+
return;
|
|
4337
|
+
}
|
|
4338
|
+
const lifecycleKey = [
|
|
4339
|
+
activeOwner.toLowerCase(),
|
|
4340
|
+
activeEntry.smartAccount.toLowerCase(),
|
|
4341
|
+
_nullishCoalesce(activeEntry.solanaDepositAddress, () => ( ""))
|
|
4342
|
+
].join(":");
|
|
4343
|
+
if (lastActiveSetupLifecycleKeyRef.current === lifecycleKey) {
|
|
4344
|
+
return;
|
|
4345
|
+
}
|
|
4346
|
+
lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
|
|
4347
|
+
_optionalChain([onLifecycleRef, 'access', _134 => _134.current, 'optionalCall', _135 => _135({
|
|
4348
|
+
type: "smart-account-changed",
|
|
4349
|
+
evm: activeEntry.smartAccount,
|
|
4350
|
+
solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
|
|
4351
|
+
})]);
|
|
4352
|
+
_optionalChain([onLifecycleRef, 'access', _136 => _136.current, 'optionalCall', _137 => _137({
|
|
4353
|
+
type: "connected",
|
|
4354
|
+
address: activeOwner,
|
|
4355
|
+
smartAccount: activeEntry.smartAccount
|
|
4356
|
+
})]);
|
|
4357
|
+
}, [
|
|
4358
|
+
flowMode,
|
|
4359
|
+
isConnectSelectionConfirmed,
|
|
4360
|
+
activeOwner,
|
|
4361
|
+
activeEntry.status,
|
|
4362
|
+
activeEntry.smartAccount,
|
|
4363
|
+
activeEntry.solanaDepositAddress,
|
|
4364
|
+
onLifecycleRef
|
|
4365
|
+
]);
|
|
4366
|
+
const effectiveStep = _react.useMemo.call(void 0,
|
|
4367
|
+
() => deriveStep(flowSlice, depositSlice, processingSlice, activeEntry),
|
|
4368
|
+
[flowSlice, depositSlice, processingSlice, activeEntry]
|
|
4369
|
+
);
|
|
4370
|
+
const step = effectiveStep;
|
|
3646
4371
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
3647
4372
|
const stepBeforeBack = storeApi.getState().flow.step;
|
|
3648
4373
|
storeApi.dispatch({
|
|
@@ -3653,14 +4378,14 @@ function DepositFlow({
|
|
|
3653
4378
|
portfolioAssetsRef.current = [];
|
|
3654
4379
|
}
|
|
3655
4380
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
3656
|
-
const canGoBackFromHere =
|
|
4381
|
+
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
3657
4382
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
3658
|
-
const currentScreen = showConnectStep ? "connect" :
|
|
4383
|
+
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
3659
4384
|
_react.useEffect.call(void 0, () => {
|
|
3660
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
4385
|
+
_optionalChain([onStepChangeRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(currentBackHandler, currentScreen)]);
|
|
3661
4386
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
3662
|
-
const stepSendToken =
|
|
3663
|
-
const stepOpenEventKey =
|
|
4387
|
+
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4388
|
+
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
3664
4389
|
const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
|
|
3665
4390
|
_react.useEffect.call(void 0, () => {
|
|
3666
4391
|
if (!stepOpenEventKey) {
|
|
@@ -3671,24 +4396,24 @@ function DepositFlow({
|
|
|
3671
4396
|
return;
|
|
3672
4397
|
}
|
|
3673
4398
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
3674
|
-
if (
|
|
3675
|
-
_optionalChain([onEventRef, 'access',
|
|
4399
|
+
if (effectiveStep.type === "select-asset") {
|
|
4400
|
+
_optionalChain([onEventRef, 'access', _140 => _140.current, 'optionalCall', _141 => _141({
|
|
3676
4401
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
3677
4402
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3678
4403
|
pred_balance: totalBalanceUsd
|
|
3679
4404
|
})]);
|
|
3680
|
-
} else if (
|
|
4405
|
+
} else if (effectiveStep.type === "deposit-address") {
|
|
3681
4406
|
const chainName = _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain);
|
|
3682
4407
|
const tokenSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3683
|
-
_optionalChain([onEventRef, 'access',
|
|
4408
|
+
_optionalChain([onEventRef, 'access', _142 => _142.current, 'optionalCall', _143 => _143({
|
|
3684
4409
|
type: "deposit_modal_transfer_crypto_open",
|
|
3685
4410
|
default_chain: chainName,
|
|
3686
4411
|
default_token: tokenSymbol,
|
|
3687
4412
|
pred_balance: totalBalanceUsd
|
|
3688
4413
|
})]);
|
|
3689
|
-
} else if (
|
|
4414
|
+
} else if (effectiveStep.type === "amount" && stepSendToken) {
|
|
3690
4415
|
const receiveSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3691
|
-
_optionalChain([onEventRef, 'access',
|
|
4416
|
+
_optionalChain([onEventRef, 'access', _144 => _144.current, 'optionalCall', _145 => _145({
|
|
3692
4417
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
3693
4418
|
send_token: stepSendToken,
|
|
3694
4419
|
receive_token: receiveSymbol,
|
|
@@ -3696,7 +4421,7 @@ function DepositFlow({
|
|
|
3696
4421
|
})]);
|
|
3697
4422
|
}
|
|
3698
4423
|
}, [
|
|
3699
|
-
|
|
4424
|
+
effectiveStep.type,
|
|
3700
4425
|
stepOpenEventKey,
|
|
3701
4426
|
stepSendToken,
|
|
3702
4427
|
targetChain,
|
|
@@ -3706,7 +4431,7 @@ function DepositFlow({
|
|
|
3706
4431
|
]);
|
|
3707
4432
|
_react.useEffect.call(void 0, () => {
|
|
3708
4433
|
logFlow("state:changed", {
|
|
3709
|
-
step:
|
|
4434
|
+
step: effectiveStep.type,
|
|
3710
4435
|
flowMode,
|
|
3711
4436
|
targetChain,
|
|
3712
4437
|
targetToken,
|
|
@@ -3716,29 +4441,183 @@ function DepositFlow({
|
|
|
3716
4441
|
flowMode,
|
|
3717
4442
|
logFlow,
|
|
3718
4443
|
selectedWalletId,
|
|
3719
|
-
|
|
4444
|
+
effectiveStep.type,
|
|
3720
4445
|
targetChain,
|
|
3721
4446
|
targetToken
|
|
3722
4447
|
]);
|
|
3723
4448
|
_react.useEffect.call(void 0, () => {
|
|
3724
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4449
|
+
_optionalChain([onLifecycleRef, 'access', _146 => _146.current, 'optionalCall', _147 => _147({
|
|
3725
4450
|
type: "balance-changed",
|
|
3726
4451
|
totalUsd: totalBalanceUsd
|
|
3727
4452
|
})]);
|
|
3728
4453
|
}, [totalBalanceUsd, onLifecycleRef]);
|
|
3729
4454
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
3730
4455
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
3731
|
-
const
|
|
3732
|
-
setFlowMode("wallet");
|
|
3733
|
-
}, [setFlowMode]);
|
|
3734
|
-
const handleSelectSolanaWallet = _react.useCallback.call(void 0, () => {
|
|
3735
|
-
setFlowMode("solana-wallet");
|
|
3736
|
-
}, [setFlowMode]);
|
|
4456
|
+
const isDappImportMode = flowMode === "dapp-import";
|
|
3737
4457
|
const handleSelectTransferCrypto = _react.useCallback.call(void 0, () => {
|
|
3738
|
-
|
|
3739
|
-
}, [
|
|
4458
|
+
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4459
|
+
}, [storeApi]);
|
|
4460
|
+
const handleConfirmWallet = _react.useCallback.call(void 0,
|
|
4461
|
+
(walletId) => {
|
|
4462
|
+
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4463
|
+
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _148 => _148.kind]) === "solana" ? "solana-wallet" : "wallet";
|
|
4464
|
+
storeApi.dispatch({
|
|
4465
|
+
type: "connect/wallet-confirmed",
|
|
4466
|
+
walletId,
|
|
4467
|
+
mode
|
|
4468
|
+
});
|
|
4469
|
+
},
|
|
4470
|
+
[walletOptions, enableSolana, storeApi]
|
|
4471
|
+
);
|
|
4472
|
+
const enabledDappImportProviders = _react.useMemo.call(void 0,
|
|
4473
|
+
() => getEnabledProviders(dappImports),
|
|
4474
|
+
[dappImports]
|
|
4475
|
+
);
|
|
4476
|
+
const handleSelectDappImport = _react.useCallback.call(void 0,
|
|
4477
|
+
(providerId) => {
|
|
4478
|
+
const owner = dappImportOwner;
|
|
4479
|
+
if (owner) {
|
|
4480
|
+
const wallet = walletOptions.find(
|
|
4481
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _149 => _149.toLowerCase, 'call', _150 => _150()]) === owner.toLowerCase()
|
|
4482
|
+
);
|
|
4483
|
+
if (wallet) {
|
|
4484
|
+
storeApi.dispatch({
|
|
4485
|
+
type: "wallet/id-selected",
|
|
4486
|
+
walletId: wallet.id
|
|
4487
|
+
});
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
storeApi.dispatch({
|
|
4491
|
+
type: "dapp-import/provider-selected",
|
|
4492
|
+
providerId
|
|
4493
|
+
});
|
|
4494
|
+
},
|
|
4495
|
+
[storeApi, walletOptions, dappImportOwner]
|
|
4496
|
+
);
|
|
4497
|
+
const handleDappImportAssetSelected = _react.useCallback.call(void 0,
|
|
4498
|
+
(asset) => {
|
|
4499
|
+
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
4500
|
+
},
|
|
4501
|
+
[storeApi]
|
|
4502
|
+
);
|
|
4503
|
+
_react.useEffect.call(void 0, () => {
|
|
4504
|
+
if (!dappImportOwner || enabledDappImportProviders.length === 0) {
|
|
4505
|
+
storeApi.dispatch({ type: "dapp-import/availability-cleared" });
|
|
4506
|
+
return;
|
|
4507
|
+
}
|
|
4508
|
+
const controller = new AbortController();
|
|
4509
|
+
for (const provider of enabledDappImportProviders) {
|
|
4510
|
+
storeApi.dispatch({
|
|
4511
|
+
type: "dapp-import/availability-loading",
|
|
4512
|
+
providerId: provider.id,
|
|
4513
|
+
owner: dappImportOwner
|
|
4514
|
+
});
|
|
4515
|
+
provider.fetchAvailability({
|
|
4516
|
+
eoa: dappImportOwner,
|
|
4517
|
+
getPublicClient: (chainId) => {
|
|
4518
|
+
try {
|
|
4519
|
+
return _chunkV6NJIPSScjs.getPublicClient.call(void 0, chainId);
|
|
4520
|
+
} catch (e28) {
|
|
4521
|
+
return null;
|
|
4522
|
+
}
|
|
4523
|
+
},
|
|
4524
|
+
signal: controller.signal
|
|
4525
|
+
}).then((availability) => {
|
|
4526
|
+
if (controller.signal.aborted) return;
|
|
4527
|
+
storeApi.dispatch({
|
|
4528
|
+
type: "dapp-import/availability-loaded",
|
|
4529
|
+
providerId: provider.id,
|
|
4530
|
+
owner: dappImportOwner,
|
|
4531
|
+
availability
|
|
4532
|
+
});
|
|
4533
|
+
}).catch(() => {
|
|
4534
|
+
if (controller.signal.aborted) return;
|
|
4535
|
+
storeApi.dispatch({
|
|
4536
|
+
type: "dapp-import/availability-loaded",
|
|
4537
|
+
providerId: provider.id,
|
|
4538
|
+
owner: dappImportOwner,
|
|
4539
|
+
availability: null
|
|
4540
|
+
});
|
|
4541
|
+
});
|
|
4542
|
+
}
|
|
4543
|
+
return () => controller.abort();
|
|
4544
|
+
}, [dappImportOwner, enabledDappImportProviders, storeApi]);
|
|
4545
|
+
const dappImportAvailability = useDepositStore((s) => s.dappImport.availability);
|
|
4546
|
+
const dappImportAvailabilityOwner = useDepositStore(
|
|
4547
|
+
(s) => s.dappImport.availabilityOwner
|
|
4548
|
+
);
|
|
4549
|
+
const activeDappImportProviderId = useDepositStore(
|
|
4550
|
+
(s) => s.dappImport.activeProviderId
|
|
4551
|
+
);
|
|
4552
|
+
const connectStepDappImports = _react.useMemo.call(void 0,
|
|
4553
|
+
() => enabledDappImportProviders.map((provider) => {
|
|
4554
|
+
const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _151 => _151.toLowerCase, 'call', _152 => _152()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
4555
|
+
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
4556
|
+
const baseRow = {
|
|
4557
|
+
id: provider.id,
|
|
4558
|
+
label: provider.label,
|
|
4559
|
+
icon: provider.icon
|
|
4560
|
+
};
|
|
4561
|
+
if (availabilityEntry === "loading" || availabilityEntry === void 0) {
|
|
4562
|
+
return { ...baseRow, status: "loading" };
|
|
4563
|
+
}
|
|
4564
|
+
if (availabilityEntry === null) {
|
|
4565
|
+
return {
|
|
4566
|
+
...baseRow,
|
|
4567
|
+
status: { enabled: false, reason: "No balance" }
|
|
4568
|
+
};
|
|
4569
|
+
}
|
|
4570
|
+
if (dappImportSetup.status === "loading" || !dappImportOwner) {
|
|
4571
|
+
return { ...baseRow, status: "loading" };
|
|
4572
|
+
}
|
|
4573
|
+
if (dappImportSetup.status === "error") {
|
|
4574
|
+
return {
|
|
4575
|
+
...baseRow,
|
|
4576
|
+
status: {
|
|
4577
|
+
enabled: false,
|
|
4578
|
+
reason: "Couldn't prepare account \u2014 tap to retry",
|
|
4579
|
+
retryable: true
|
|
4580
|
+
}
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
return {
|
|
4584
|
+
...baseRow,
|
|
4585
|
+
status: {
|
|
4586
|
+
enabled: true,
|
|
4587
|
+
balanceUsd: availabilityEntry.totalUsd
|
|
4588
|
+
}
|
|
4589
|
+
};
|
|
4590
|
+
}),
|
|
4591
|
+
[
|
|
4592
|
+
enabledDappImportProviders,
|
|
4593
|
+
dappImportAvailability,
|
|
4594
|
+
dappImportAvailabilityOwner,
|
|
4595
|
+
setupSlice,
|
|
4596
|
+
dappImportOwner
|
|
4597
|
+
]
|
|
4598
|
+
);
|
|
4599
|
+
const activeDappImportProvider = _react.useMemo.call(void 0, () => {
|
|
4600
|
+
if (!activeDappImportProviderId) return null;
|
|
4601
|
+
return _nullishCoalesce(enabledDappImportProviders.find(
|
|
4602
|
+
(p) => p.id === activeDappImportProviderId
|
|
4603
|
+
), () => ( null));
|
|
4604
|
+
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
4605
|
+
const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
|
|
4606
|
+
if (!activeDappImportProviderId) return null;
|
|
4607
|
+
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _153 => _153.toLowerCase, 'call', _154 => _154()]) !== dappImportOwner.toLowerCase()) {
|
|
4608
|
+
return null;
|
|
4609
|
+
}
|
|
4610
|
+
const entry = dappImportAvailability[activeDappImportProviderId];
|
|
4611
|
+
if (!entry || entry === "loading") return null;
|
|
4612
|
+
return entry;
|
|
4613
|
+
}, [
|
|
4614
|
+
activeDappImportProviderId,
|
|
4615
|
+
dappImportAvailability,
|
|
4616
|
+
dappImportAvailabilityOwner,
|
|
4617
|
+
dappImportOwner
|
|
4618
|
+
]);
|
|
3740
4619
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
3741
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4620
|
+
_optionalChain([onLifecycleRef, 'access', _155 => _155.current, 'optionalCall', _156 => _156({
|
|
3742
4621
|
type: "smart-account-changed",
|
|
3743
4622
|
evm: null,
|
|
3744
4623
|
solana: null
|
|
@@ -3748,62 +4627,121 @@ function DepositFlow({
|
|
|
3748
4627
|
stableWalletSignerRef.current = null;
|
|
3749
4628
|
stableWalletSelectionKeyRef.current = null;
|
|
3750
4629
|
}, [onLifecycleRef, storeApi]);
|
|
3751
|
-
const
|
|
3752
|
-
(
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
_optionalChain([onErrorRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126({
|
|
3765
|
-
message: "Solana deposit address not available. Please try again.",
|
|
3766
|
-
code: "SOLANA_SETUP_FAILED"
|
|
3767
|
-
})]);
|
|
3768
|
-
return;
|
|
3769
|
-
}
|
|
3770
|
-
if (!sessionKeyAddress) return;
|
|
3771
|
-
storeApi.dispatch({
|
|
3772
|
-
type: "setup/complete",
|
|
3773
|
-
smartAccount,
|
|
3774
|
-
smartAccountOwner: sessionKeyAddress,
|
|
3775
|
-
solanaDepositAddress
|
|
3776
|
-
});
|
|
3777
|
-
},
|
|
4630
|
+
const setupInputBase = _react.useMemo.call(void 0,
|
|
4631
|
+
() => ({
|
|
4632
|
+
targetChain,
|
|
4633
|
+
targetToken,
|
|
4634
|
+
signerAddress,
|
|
4635
|
+
sessionChainIds,
|
|
4636
|
+
recipient,
|
|
4637
|
+
postBridgeActions,
|
|
4638
|
+
outputTokenRules,
|
|
4639
|
+
rejectUnmapped,
|
|
4640
|
+
forceRegister,
|
|
4641
|
+
enableSolana
|
|
4642
|
+
}),
|
|
3778
4643
|
[
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
4644
|
+
targetChain,
|
|
4645
|
+
targetToken,
|
|
4646
|
+
signerAddress,
|
|
4647
|
+
sessionChainIds,
|
|
4648
|
+
recipient,
|
|
4649
|
+
postBridgeActions,
|
|
4650
|
+
outputTokenRules,
|
|
4651
|
+
rejectUnmapped,
|
|
4652
|
+
forceRegister,
|
|
4653
|
+
enableSolana
|
|
3786
4654
|
]
|
|
3787
4655
|
);
|
|
3788
|
-
const
|
|
3789
|
-
|
|
3790
|
-
|
|
4656
|
+
const desiredOwnersKey = _react.useMemo.call(void 0, () => {
|
|
4657
|
+
const owners = [];
|
|
4658
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4659
|
+
const push = (addr) => {
|
|
4660
|
+
if (!addr) return;
|
|
4661
|
+
const key = addr.toLowerCase();
|
|
4662
|
+
if (seen.has(key)) return;
|
|
4663
|
+
seen.add(key);
|
|
4664
|
+
owners.push(addr);
|
|
4665
|
+
};
|
|
4666
|
+
push(dappAddress);
|
|
4667
|
+
push(connectedWalletAddress);
|
|
4668
|
+
push(_optionalChain([reownWallet, 'optionalAccess', _157 => _157.address]));
|
|
4669
|
+
push(dappImportOwner);
|
|
4670
|
+
return owners;
|
|
4671
|
+
}, [
|
|
4672
|
+
dappAddress,
|
|
4673
|
+
connectedWalletAddress,
|
|
4674
|
+
_optionalChain([reownWallet, 'optionalAccess', _158 => _158.address]),
|
|
4675
|
+
dappImportOwner
|
|
4676
|
+
]);
|
|
3791
4677
|
_react.useEffect.call(void 0, () => {
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
4678
|
+
desiredOwnersKey.forEach((owner) => {
|
|
4679
|
+
void (async () => {
|
|
4680
|
+
const input = {
|
|
4681
|
+
ownerAddress: owner,
|
|
4682
|
+
...setupInputBase
|
|
4683
|
+
};
|
|
4684
|
+
let sessionOwner;
|
|
4685
|
+
try {
|
|
4686
|
+
sessionOwner = await resolveSessionOwner(owner);
|
|
4687
|
+
} catch (error) {
|
|
4688
|
+
_chunkV6NJIPSScjs.debugError.call(void 0,
|
|
4689
|
+
debug,
|
|
4690
|
+
"deposit-flow",
|
|
4691
|
+
"session-owner:resolve-failed",
|
|
4692
|
+
error,
|
|
4693
|
+
{ owner }
|
|
4694
|
+
);
|
|
4695
|
+
return;
|
|
4696
|
+
}
|
|
4697
|
+
const requestKey = computeRequestKey(input, sessionOwner.address);
|
|
4698
|
+
const cacheKey = computeCacheKey(input, sessionOwner.address);
|
|
4699
|
+
const cacheable = computeIsCacheable(input);
|
|
4700
|
+
const current = readSetupForOwner(
|
|
4701
|
+
storeApi.getState().setup,
|
|
4702
|
+
owner
|
|
4703
|
+
);
|
|
4704
|
+
if (current.requestKey === requestKey) {
|
|
4705
|
+
return;
|
|
4706
|
+
}
|
|
4707
|
+
storeApi.dispatch({
|
|
4708
|
+
type: "setup/started",
|
|
4709
|
+
owner,
|
|
4710
|
+
requestKey,
|
|
4711
|
+
cacheKey,
|
|
4712
|
+
cacheable
|
|
4713
|
+
});
|
|
4714
|
+
try {
|
|
4715
|
+
const result = await runAccountSetup(input, { service, debug });
|
|
4716
|
+
storeApi.dispatch({
|
|
4717
|
+
type: "setup/ready",
|
|
4718
|
+
owner,
|
|
4719
|
+
requestKey,
|
|
4720
|
+
result: {
|
|
4721
|
+
smartAccount: result.smartAccount,
|
|
4722
|
+
sessionOwnerAddress: result.sessionOwnerAddress,
|
|
4723
|
+
solanaDepositAddress: result.solanaDepositAddress,
|
|
4724
|
+
cacheKey: result.cacheKey
|
|
4725
|
+
}
|
|
4726
|
+
});
|
|
4727
|
+
} catch (error) {
|
|
4728
|
+
const message = error instanceof SetupError ? error.message : "Deposit service is temporarily unavailable. Please try again shortly.";
|
|
4729
|
+
storeApi.dispatch({
|
|
4730
|
+
type: "setup/failed",
|
|
4731
|
+
owner,
|
|
4732
|
+
requestKey,
|
|
4733
|
+
message
|
|
4734
|
+
});
|
|
4735
|
+
}
|
|
4736
|
+
})();
|
|
4737
|
+
});
|
|
3800
4738
|
}, [
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
4739
|
+
desiredOwnersKey,
|
|
4740
|
+
setupInputBase,
|
|
4741
|
+
service,
|
|
4742
|
+
debug,
|
|
4743
|
+
storeApi,
|
|
4744
|
+
setupSlice.byOwner
|
|
3807
4745
|
]);
|
|
3808
4746
|
const handleDepositAddressSubmitted = _react.useCallback.call(void 0,
|
|
3809
4747
|
(data) => {
|
|
@@ -3812,7 +4750,7 @@ function DepositFlow({
|
|
|
3812
4750
|
sourceChain: data.sourceChain,
|
|
3813
4751
|
amount: data.amount
|
|
3814
4752
|
});
|
|
3815
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4753
|
+
_optionalChain([onLifecycleRef, 'access', _159 => _159.current, 'optionalCall', _160 => _160({ type: "submitted", ...data })]);
|
|
3816
4754
|
},
|
|
3817
4755
|
[logFlow, onLifecycleRef]
|
|
3818
4756
|
);
|
|
@@ -3869,7 +4807,7 @@ function DepositFlow({
|
|
|
3869
4807
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
3870
4808
|
sourceDecimals: tokenAtSubmit.decimals
|
|
3871
4809
|
});
|
|
3872
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4810
|
+
_optionalChain([onLifecycleRef, 'access', _161 => _161.current, 'optionalCall', _162 => _162({
|
|
3873
4811
|
type: "submitted",
|
|
3874
4812
|
txHash,
|
|
3875
4813
|
sourceChain: "solana",
|
|
@@ -3878,19 +4816,9 @@ function DepositFlow({
|
|
|
3878
4816
|
},
|
|
3879
4817
|
[logFlow, onLifecycleRef, storeApi]
|
|
3880
4818
|
);
|
|
3881
|
-
const handleConnected = _react.useCallback.call(void 0,
|
|
3882
|
-
(addr, smartAccount) => {
|
|
3883
|
-
_optionalChain([onLifecycleRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132({
|
|
3884
|
-
type: "connected",
|
|
3885
|
-
address: addr,
|
|
3886
|
-
smartAccount
|
|
3887
|
-
})]);
|
|
3888
|
-
},
|
|
3889
|
-
[onLifecycleRef]
|
|
3890
|
-
);
|
|
3891
4819
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
3892
4820
|
(asset) => {
|
|
3893
|
-
_optionalChain([onEventRef, 'access',
|
|
4821
|
+
_optionalChain([onEventRef, 'access', _163 => _163.current, 'optionalCall', _164 => _164({
|
|
3894
4822
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3895
4823
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3896
4824
|
pred_balance: totalBalanceUsd,
|
|
@@ -3908,6 +4836,11 @@ function DepositFlow({
|
|
|
3908
4836
|
);
|
|
3909
4837
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
3910
4838
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
4839
|
+
const entry = readSetupForOwner(
|
|
4840
|
+
storeApi.getState().setup,
|
|
4841
|
+
activeOwner
|
|
4842
|
+
);
|
|
4843
|
+
if (entry.status !== "ready") return;
|
|
3911
4844
|
const targetSym = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3912
4845
|
const isTargetStable = _chunkIVTXEYB2cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3913
4846
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
@@ -3920,7 +4853,7 @@ function DepositFlow({
|
|
|
3920
4853
|
liquidityWarning
|
|
3921
4854
|
});
|
|
3922
4855
|
},
|
|
3923
|
-
[targetToken, targetChain, getTokenPriceUsd, storeApi]
|
|
4856
|
+
[targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
|
|
3924
4857
|
);
|
|
3925
4858
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
3926
4859
|
(txHash, chainId, amount, token) => {
|
|
@@ -3930,20 +4863,24 @@ function DepositFlow({
|
|
|
3930
4863
|
sourceToken: token,
|
|
3931
4864
|
amount
|
|
3932
4865
|
});
|
|
4866
|
+
const asset = storeApi.getState().deposit.selectedAsset;
|
|
4867
|
+
const dappImport = asset && isDappImportAsset(asset) ? asset : null;
|
|
3933
4868
|
storeApi.dispatch({
|
|
3934
4869
|
type: "deposit/submitted",
|
|
3935
4870
|
txHash,
|
|
3936
4871
|
sourceChain: chainId,
|
|
3937
4872
|
sourceToken: token,
|
|
3938
4873
|
amount,
|
|
3939
|
-
|
|
4874
|
+
sourceSymbol: _optionalChain([dappImport, 'optionalAccess', _165 => _165.symbol]),
|
|
4875
|
+
sourceDecimals: _optionalChain([dappImport, 'optionalAccess', _166 => _166.decimals]),
|
|
4876
|
+
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
3940
4877
|
});
|
|
3941
4878
|
},
|
|
3942
4879
|
[logFlow, storeApi, targetChain, targetToken]
|
|
3943
4880
|
);
|
|
3944
4881
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3945
4882
|
(txHash, sourceChain, amount) => {
|
|
3946
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4883
|
+
_optionalChain([onLifecycleRef, 'access', _167 => _167.current, 'optionalCall', _168 => _168({
|
|
3947
4884
|
type: "submitted",
|
|
3948
4885
|
txHash,
|
|
3949
4886
|
sourceChain,
|
|
@@ -3955,7 +4892,7 @@ function DepositFlow({
|
|
|
3955
4892
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3956
4893
|
(txHash, destinationTxHash, context) => {
|
|
3957
4894
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
3958
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4895
|
+
_optionalChain([onLifecycleRef, 'access', _169 => _169.current, 'optionalCall', _170 => _170({
|
|
3959
4896
|
type: "complete",
|
|
3960
4897
|
txHash,
|
|
3961
4898
|
destinationTxHash,
|
|
@@ -3967,27 +4904,20 @@ function DepositFlow({
|
|
|
3967
4904
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
3968
4905
|
(txHash, error) => {
|
|
3969
4906
|
logFlowError("deposit:failed", error, { txHash });
|
|
3970
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4907
|
+
_optionalChain([onLifecycleRef, 'access', _171 => _171.current, 'optionalCall', _172 => _172({ type: "failed", txHash, error })]);
|
|
3971
4908
|
},
|
|
3972
4909
|
[logFlowError, onLifecycleRef]
|
|
3973
4910
|
);
|
|
3974
4911
|
const handleError = _react.useCallback.call(void 0,
|
|
3975
4912
|
(message, code) => {
|
|
3976
4913
|
logFlowError("flow:error", message, { code });
|
|
3977
|
-
_optionalChain([onErrorRef, 'access',
|
|
4914
|
+
_optionalChain([onErrorRef, 'access', _173 => _173.current, 'optionalCall', _174 => _174({ message, code })]);
|
|
3978
4915
|
},
|
|
3979
4916
|
[logFlowError, onErrorRef]
|
|
3980
4917
|
);
|
|
3981
4918
|
const handleTotalBalanceComputed = _react.useCallback.call(void 0, (total) => {
|
|
3982
4919
|
setTotalBalanceUsd(total);
|
|
3983
4920
|
}, []);
|
|
3984
|
-
const selectedWalletIdEffective = _react.useMemo.call(void 0, () => {
|
|
3985
|
-
if (selectedWalletId) return selectedWalletId;
|
|
3986
|
-
if (walletOptions.length === 1) {
|
|
3987
|
-
return walletOptions[0].id;
|
|
3988
|
-
}
|
|
3989
|
-
return null;
|
|
3990
|
-
}, [selectedWalletId, walletOptions]);
|
|
3991
4921
|
const walletOptionsKey = _react.useMemo.call(void 0,
|
|
3992
4922
|
() => walletOptions.map((option) => option.id).join(","),
|
|
3993
4923
|
[walletOptions]
|
|
@@ -3999,11 +4929,11 @@ function DepositFlow({
|
|
|
3999
4929
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
4000
4930
|
const currentStep = storeApi.getState().flow.step;
|
|
4001
4931
|
if (currentStep !== "processing" && currentStep !== "confirm" && currentStep !== "solana-confirm" && currentStep !== "amount" && currentStep !== "solana-amount") {
|
|
4002
|
-
storeApi.dispatch({ type: "flow/step-set", step: "
|
|
4932
|
+
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
4003
4933
|
}
|
|
4004
4934
|
}, [walletOptionsKey]);
|
|
4005
4935
|
_react.useEffect.call(void 0, () => {
|
|
4006
|
-
if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
|
|
4936
|
+
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
|
|
4007
4937
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
4008
4938
|
}
|
|
4009
4939
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
|
|
@@ -4013,110 +4943,130 @@ function DepositFlow({
|
|
|
4013
4943
|
}
|
|
4014
4944
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
4015
4945
|
if (storeApi.getState().flow.step !== "processing") {
|
|
4016
|
-
storeApi.dispatch({ type: "flow/step-set", step: "
|
|
4946
|
+
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
4017
4947
|
}
|
|
4018
4948
|
}, [enableSolana, flowMode, storeApi]);
|
|
4019
4949
|
_react.useEffect.call(void 0, () => {
|
|
4020
4950
|
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
4021
4951
|
return;
|
|
4022
4952
|
}
|
|
4023
|
-
if (hasWalletOptions) {
|
|
4024
|
-
const walletId = selectedWalletIdEffective;
|
|
4025
|
-
if (walletId) {
|
|
4026
|
-
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4027
|
-
setSelectedWalletId(walletId);
|
|
4028
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _143 => _143.kind]) === "solana") {
|
|
4029
|
-
handleSelectSolanaWallet();
|
|
4030
|
-
} else {
|
|
4031
|
-
handleSelectProvider();
|
|
4032
|
-
}
|
|
4033
|
-
setIsConnectSelectionConfirmed(true);
|
|
4034
|
-
return;
|
|
4035
|
-
}
|
|
4036
|
-
}
|
|
4037
4953
|
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
4038
4954
|
handleSelectTransferCrypto();
|
|
4039
|
-
setIsConnectSelectionConfirmed(true);
|
|
4040
4955
|
}
|
|
4041
4956
|
}, [
|
|
4042
4957
|
hasWalletOptions,
|
|
4043
4958
|
hasReownSession,
|
|
4044
4959
|
hasQrAutoAdvanceGraceElapsed,
|
|
4045
|
-
enableSolana,
|
|
4046
4960
|
isConnectSelectionConfirmed,
|
|
4047
4961
|
flowMode,
|
|
4048
4962
|
hasNavigatedBack,
|
|
4049
|
-
selectedWalletIdEffective,
|
|
4050
4963
|
dappAddress,
|
|
4051
4964
|
dappWalletClient,
|
|
4052
|
-
|
|
4053
|
-
handleSelectProvider,
|
|
4054
|
-
handleSelectSolanaWallet,
|
|
4055
|
-
handleSelectTransferCrypto,
|
|
4056
|
-
setSelectedWalletId,
|
|
4057
|
-
setIsConnectSelectionConfirmed
|
|
4965
|
+
handleSelectTransferCrypto
|
|
4058
4966
|
]);
|
|
4967
|
+
const walletRows = _react.useMemo.call(void 0, () => {
|
|
4968
|
+
return walletOptions.map((option) => {
|
|
4969
|
+
const ownerForRow = option.kind === "solana" ? dappAddress : _nullishCoalesce(option.address, () => ( null));
|
|
4970
|
+
const entry = readSetupForOwner(setupSlice, _nullishCoalesce(ownerForRow, () => ( null)));
|
|
4971
|
+
const state = entry.status === "ready" ? "ready" : entry.status === "error" ? "error" : "loading";
|
|
4972
|
+
return {
|
|
4973
|
+
id: option.id,
|
|
4974
|
+
kind: option.kind,
|
|
4975
|
+
label: option.label,
|
|
4976
|
+
icon: option.icon,
|
|
4977
|
+
address: _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id)),
|
|
4978
|
+
state,
|
|
4979
|
+
errorReason: _nullishCoalesce(entry.message, () => ( void 0))
|
|
4980
|
+
};
|
|
4981
|
+
});
|
|
4982
|
+
}, [walletOptions, setupSlice, dappAddress]);
|
|
4983
|
+
const transferCryptoEntry = _react.useMemo.call(void 0,
|
|
4984
|
+
() => readSetupForOwner(setupSlice, dappAddress),
|
|
4985
|
+
[setupSlice, dappAddress]
|
|
4986
|
+
);
|
|
4987
|
+
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
4988
|
+
const handleRetrySetup = _react.useCallback.call(void 0,
|
|
4989
|
+
(owner) => {
|
|
4990
|
+
storeApi.dispatch({ type: "setup/retry-requested", owner });
|
|
4991
|
+
},
|
|
4992
|
+
[storeApi]
|
|
4993
|
+
);
|
|
4059
4994
|
if (showConnectStep) {
|
|
4060
4995
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4061
|
-
|
|
4996
|
+
_chunkV6NJIPSScjs.ConnectStep,
|
|
4062
4997
|
{
|
|
4063
|
-
|
|
4998
|
+
walletRows,
|
|
4999
|
+
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5000
|
+
transferCryptoErrorReason: dappAddress ? _nullishCoalesce(transferCryptoEntry.message, () => ( void 0)) : void 0,
|
|
4064
5001
|
onSelectTransferCrypto: dappAddress ? () => {
|
|
5002
|
+
if (transferCryptoState === "error") {
|
|
5003
|
+
handleRetrySetup(dappAddress);
|
|
5004
|
+
return;
|
|
5005
|
+
}
|
|
5006
|
+
if (transferCryptoState !== "ready") return;
|
|
4065
5007
|
handleSelectTransferCrypto();
|
|
4066
|
-
setIsConnectSelectionConfirmed(true);
|
|
4067
5008
|
} : void 0,
|
|
4068
5009
|
onRequestConnect,
|
|
4069
5010
|
onConnect,
|
|
4070
5011
|
onDisconnect,
|
|
4071
5012
|
onConfirmWallet: (walletId) => {
|
|
4072
|
-
|
|
4073
|
-
const
|
|
4074
|
-
|
|
5013
|
+
const row = walletRows.find((r) => r.id === walletId);
|
|
5014
|
+
const option = walletOptions.find((o) => o.id === walletId);
|
|
5015
|
+
if (!row || !option) return;
|
|
5016
|
+
if (row.state === "error") {
|
|
5017
|
+
const owner = option.kind === "solana" ? dappAddress : _nullishCoalesce(option.address, () => ( null));
|
|
5018
|
+
if (owner) handleRetrySetup(owner);
|
|
5019
|
+
return;
|
|
5020
|
+
}
|
|
5021
|
+
if (row.state !== "ready") return;
|
|
5022
|
+
handleConfirmWallet(walletId);
|
|
5023
|
+
},
|
|
5024
|
+
dappImports: connectStepDappImports,
|
|
5025
|
+
onSelectDappImport: (providerId) => {
|
|
5026
|
+
const dappImportEntry = readSetupForOwner(
|
|
5027
|
+
setupSlice,
|
|
5028
|
+
dappImportOwner
|
|
4075
5029
|
);
|
|
4076
|
-
if (
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
handleSelectProvider();
|
|
5030
|
+
if (dappImportEntry.status === "error" && dappImportOwner) {
|
|
5031
|
+
handleRetrySetup(dappImportOwner);
|
|
5032
|
+
return;
|
|
4080
5033
|
}
|
|
4081
|
-
|
|
5034
|
+
if (dappImportEntry.status !== "ready") return;
|
|
5035
|
+
handleSelectDappImport(providerId);
|
|
4082
5036
|
}
|
|
4083
5037
|
}
|
|
4084
5038
|
) });
|
|
4085
5039
|
}
|
|
4086
5040
|
if (isDepositAddressMode) {
|
|
4087
|
-
if (!dappAddress
|
|
5041
|
+
if (!dappAddress) return null;
|
|
5042
|
+
const isWalletPickerReachable = walletOptions.length > 0 || Boolean(reownWallet) || Boolean(onConnect);
|
|
5043
|
+
const showBanner = effectiveStep.type !== "setup" && (activeEntry.status === "loading" || activeEntry.status === "error");
|
|
4088
5044
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4089
|
-
|
|
4090
|
-
|
|
5045
|
+
showBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5046
|
+
SetupUpdatingBanner,
|
|
4091
5047
|
{
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
forceRegister,
|
|
4102
|
-
enableSolana,
|
|
4103
|
-
service,
|
|
4104
|
-
onSetupComplete: handleSetupComplete,
|
|
4105
|
-
onConnected: handleConnected,
|
|
4106
|
-
onError: handleError
|
|
5048
|
+
status: activeEntry.status,
|
|
5049
|
+
message: _nullishCoalesce(activeEntry.message, () => ( void 0))
|
|
5050
|
+
}
|
|
5051
|
+
),
|
|
5052
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5053
|
+
AccountPreparingSkeleton,
|
|
5054
|
+
{
|
|
5055
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
5056
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
4107
5057
|
}
|
|
4108
5058
|
),
|
|
4109
|
-
|
|
5059
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4110
5060
|
DepositAddressStep,
|
|
4111
5061
|
{
|
|
4112
|
-
smartAccount:
|
|
4113
|
-
solanaDepositAddress: enableSolana ?
|
|
5062
|
+
smartAccount: effectiveStep.smartAccount,
|
|
5063
|
+
solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
|
|
4114
5064
|
service,
|
|
4115
5065
|
allowedRoutes,
|
|
4116
5066
|
targetChain,
|
|
4117
5067
|
targetToken,
|
|
4118
5068
|
waitForFinalTx,
|
|
4119
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5069
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _175 => _175.length])),
|
|
4120
5070
|
uiConfig,
|
|
4121
5071
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
4122
5072
|
onDepositComplete: handleDepositComplete,
|
|
@@ -4124,7 +5074,7 @@ function DepositFlow({
|
|
|
4124
5074
|
onCopyAddress: () => {
|
|
4125
5075
|
const chainName = _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain);
|
|
4126
5076
|
const tokenSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4127
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
5077
|
+
_optionalChain([onEvent, 'optionalCall', _176 => _176({
|
|
4128
5078
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
4129
5079
|
default_chain: chainName,
|
|
4130
5080
|
default_token: tokenSymbol,
|
|
@@ -4132,6 +5082,9 @@ function DepositFlow({
|
|
|
4132
5082
|
cta_name: "copy"
|
|
4133
5083
|
})]);
|
|
4134
5084
|
},
|
|
5085
|
+
onRequestWalletPicker: isWalletPickerReachable ? () => storeApi.dispatch({
|
|
5086
|
+
type: "connect/wallet-picker-requested"
|
|
5087
|
+
}) : void 0,
|
|
4135
5088
|
onError: handleError,
|
|
4136
5089
|
debug
|
|
4137
5090
|
}
|
|
@@ -4139,31 +5092,26 @@ function DepositFlow({
|
|
|
4139
5092
|
] });
|
|
4140
5093
|
}
|
|
4141
5094
|
if (isSolanaWalletMode) {
|
|
4142
|
-
if (!
|
|
4143
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
4144
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
5095
|
+
if (!dappAddress) return null;
|
|
5096
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _177 => _177.solanaAddress]);
|
|
5097
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _178 => _178.solanaProvider]);
|
|
5098
|
+
const solanaShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
|
|
4145
5099
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4146
|
-
|
|
4147
|
-
|
|
5100
|
+
solanaShowBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5101
|
+
SetupUpdatingBanner,
|
|
4148
5102
|
{
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
targetToken,
|
|
4152
|
-
signerAddress,
|
|
4153
|
-
sessionChainIds,
|
|
4154
|
-
recipient,
|
|
4155
|
-
postBridgeActions,
|
|
4156
|
-
outputTokenRules,
|
|
4157
|
-
rejectUnmapped,
|
|
4158
|
-
forceRegister,
|
|
4159
|
-
enableSolana,
|
|
4160
|
-
service,
|
|
4161
|
-
onSetupComplete: handleSetupComplete,
|
|
4162
|
-
onConnected: handleConnected,
|
|
4163
|
-
onError: handleError
|
|
5103
|
+
status: activeEntry.status,
|
|
5104
|
+
message: _nullishCoalesce(activeEntry.message, () => ( void 0))
|
|
4164
5105
|
}
|
|
4165
5106
|
),
|
|
4166
|
-
|
|
5107
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5108
|
+
AccountPreparingSkeleton,
|
|
5109
|
+
{
|
|
5110
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
5111
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
5112
|
+
}
|
|
5113
|
+
),
|
|
5114
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4167
5115
|
SolanaTokenSelectStep,
|
|
4168
5116
|
{
|
|
4169
5117
|
solanaAddress: solanaAddr,
|
|
@@ -4173,13 +5121,13 @@ function DepositFlow({
|
|
|
4173
5121
|
debug
|
|
4174
5122
|
}
|
|
4175
5123
|
),
|
|
4176
|
-
|
|
5124
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4177
5125
|
SolanaAmountStep,
|
|
4178
5126
|
{
|
|
4179
|
-
token:
|
|
4180
|
-
balance:
|
|
4181
|
-
balanceUsd:
|
|
4182
|
-
defaultAmount:
|
|
5127
|
+
token: effectiveStep.token,
|
|
5128
|
+
balance: effectiveStep.balance,
|
|
5129
|
+
balanceUsd: effectiveStep.balanceUsd,
|
|
5130
|
+
defaultAmount: effectiveStep.inputAmountUsd,
|
|
4183
5131
|
uiConfig,
|
|
4184
5132
|
targetChainName: _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain),
|
|
4185
5133
|
targetTokenSymbol: _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain),
|
|
@@ -4190,17 +5138,17 @@ function DepositFlow({
|
|
|
4190
5138
|
debug
|
|
4191
5139
|
}
|
|
4192
5140
|
),
|
|
4193
|
-
|
|
5141
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4194
5142
|
SolanaConfirmStep,
|
|
4195
5143
|
{
|
|
4196
|
-
smartAccount:
|
|
5144
|
+
smartAccount: effectiveStep.smartAccount,
|
|
4197
5145
|
solanaAddress: solanaAddr,
|
|
4198
|
-
solanaDepositAddress:
|
|
4199
|
-
token:
|
|
4200
|
-
sourceAmount:
|
|
4201
|
-
inputAmountUsd:
|
|
4202
|
-
targetAmount:
|
|
4203
|
-
targetTokenPriceUsd:
|
|
5146
|
+
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
5147
|
+
token: effectiveStep.token,
|
|
5148
|
+
sourceAmount: effectiveStep.sourceAmount,
|
|
5149
|
+
inputAmountUsd: effectiveStep.inputAmountUsd,
|
|
5150
|
+
targetAmount: effectiveStep.targetAmount,
|
|
5151
|
+
targetTokenPriceUsd: effectiveStep.targetTokenPriceUsd,
|
|
4204
5152
|
targetChain,
|
|
4205
5153
|
targetToken,
|
|
4206
5154
|
service,
|
|
@@ -4209,7 +5157,7 @@ function DepositFlow({
|
|
|
4209
5157
|
onError: handleError,
|
|
4210
5158
|
debug
|
|
4211
5159
|
}
|
|
4212
|
-
) :
|
|
5160
|
+
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
4213
5161
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
4214
5162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4215
5163
|
"svg",
|
|
@@ -4243,23 +5191,23 @@ function DepositFlow({
|
|
|
4243
5191
|
}
|
|
4244
5192
|
) })
|
|
4245
5193
|
] }) : null,
|
|
4246
|
-
|
|
4247
|
-
|
|
5194
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5195
|
+
_chunkV6NJIPSScjs.ProcessingStep,
|
|
4248
5196
|
{
|
|
4249
|
-
smartAccount:
|
|
4250
|
-
solanaDepositAddress:
|
|
4251
|
-
txHash:
|
|
4252
|
-
sourceChain:
|
|
4253
|
-
sourceToken:
|
|
5197
|
+
smartAccount: effectiveStep.smartAccount,
|
|
5198
|
+
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
5199
|
+
txHash: effectiveStep.txHash,
|
|
5200
|
+
sourceChain: effectiveStep.sourceChain,
|
|
5201
|
+
sourceToken: effectiveStep.sourceToken,
|
|
4254
5202
|
targetChain,
|
|
4255
5203
|
targetToken,
|
|
4256
|
-
amount:
|
|
4257
|
-
sourceSymbol:
|
|
4258
|
-
sourceDecimals:
|
|
5204
|
+
amount: effectiveStep.amount,
|
|
5205
|
+
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5206
|
+
sourceDecimals: effectiveStep.sourceDecimals,
|
|
4259
5207
|
waitForFinalTx,
|
|
4260
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5208
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _179 => _179.length])),
|
|
4261
5209
|
service,
|
|
4262
|
-
directTransfer:
|
|
5210
|
+
directTransfer: effectiveStep.directTransfer,
|
|
4263
5211
|
onClose,
|
|
4264
5212
|
onNewDeposit: handleNewDeposit,
|
|
4265
5213
|
onDepositComplete: handleDepositComplete,
|
|
@@ -4270,40 +5218,34 @@ function DepositFlow({
|
|
|
4270
5218
|
)
|
|
4271
5219
|
] });
|
|
4272
5220
|
}
|
|
4273
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
5221
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _180 => _180.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _181 => _181.publicClient])) {
|
|
4274
5222
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
4275
5223
|
}
|
|
4276
5224
|
const ownerAddress = signerContext.ownerAddress;
|
|
4277
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
5225
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _182 => _182.walletClient, 'optionalAccess', _183 => _183.chain, 'optionalAccess', _184 => _184.id]), () => ( _optionalChain([signerContext, 'access', _185 => _185.publicClient, 'access', _186 => _186.chain, 'optionalAccess', _187 => _187.id]))), () => ( targetChain));
|
|
4278
5226
|
const getReadClientForChain = (chainId) => {
|
|
4279
|
-
if (_optionalChain([signerContext, 'access',
|
|
5227
|
+
if (_optionalChain([signerContext, 'access', _188 => _188.publicClient, 'access', _189 => _189.chain, 'optionalAccess', _190 => _190.id]) === chainId) {
|
|
4280
5228
|
return signerContext.publicClient;
|
|
4281
5229
|
}
|
|
4282
|
-
return
|
|
5230
|
+
return _chunkV6NJIPSScjs.getPublicClient.call(void 0, chainId);
|
|
4283
5231
|
};
|
|
5232
|
+
const walletShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
|
|
4284
5233
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4285
|
-
|
|
4286
|
-
|
|
5234
|
+
walletShowBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5235
|
+
SetupUpdatingBanner,
|
|
4287
5236
|
{
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
targetChain,
|
|
4291
|
-
targetToken,
|
|
4292
|
-
signerAddress,
|
|
4293
|
-
sessionChainIds,
|
|
4294
|
-
recipient,
|
|
4295
|
-
postBridgeActions,
|
|
4296
|
-
outputTokenRules,
|
|
4297
|
-
rejectUnmapped,
|
|
4298
|
-
forceRegister,
|
|
4299
|
-
enableSolana,
|
|
4300
|
-
service,
|
|
4301
|
-
onSetupComplete: handleSetupComplete,
|
|
4302
|
-
onConnected: handleConnected,
|
|
4303
|
-
onError: handleError
|
|
5237
|
+
status: activeEntry.status,
|
|
5238
|
+
message: _nullishCoalesce(activeEntry.message, () => ( void 0))
|
|
4304
5239
|
}
|
|
4305
5240
|
),
|
|
4306
|
-
|
|
5241
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5242
|
+
AccountPreparingSkeleton,
|
|
5243
|
+
{
|
|
5244
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
5245
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
|
|
5246
|
+
}
|
|
5247
|
+
),
|
|
5248
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
5249
|
AssetSelectStep,
|
|
4308
5250
|
{
|
|
4309
5251
|
address: ownerAddress,
|
|
@@ -4321,14 +5263,27 @@ function DepositFlow({
|
|
|
4321
5263
|
} : void 0
|
|
4322
5264
|
}
|
|
4323
5265
|
),
|
|
4324
|
-
|
|
5266
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5267
|
+
DappImportAssetSelectStep,
|
|
5268
|
+
{
|
|
5269
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _191 => _191.assets, 'access', _192 => _192[0], 'optionalAccess', _193 => _193.sourceLabel]), () => ( activeDappImportProvider.label)),
|
|
5270
|
+
assets: activeDappImportAvailability.assets,
|
|
5271
|
+
onSelect: handleDappImportAssetSelected
|
|
5272
|
+
}
|
|
5273
|
+
),
|
|
5274
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4325
5275
|
AmountStep,
|
|
4326
5276
|
{
|
|
4327
5277
|
walletClient: signerContext.walletClient,
|
|
4328
|
-
publicClient: getReadClientForChain(
|
|
5278
|
+
publicClient: getReadClientForChain(effectiveStep.asset.chainId),
|
|
4329
5279
|
address: ownerAddress,
|
|
4330
|
-
|
|
4331
|
-
|
|
5280
|
+
balanceAddress: isDappImportAsset(effectiveStep.asset) ? effectiveStep.asset.providerMetadata.proxyWallet : void 0,
|
|
5281
|
+
asset: effectiveStep.asset,
|
|
5282
|
+
liquiditySource: isDappImportAsset(effectiveStep.asset) ? {
|
|
5283
|
+
chainId: effectiveStep.asset.depositChainId,
|
|
5284
|
+
token: effectiveStep.asset.depositToken
|
|
5285
|
+
} : void 0,
|
|
5286
|
+
defaultAmount: _nullishCoalesce(effectiveStep.amount, () => ( defaultAmount)),
|
|
4332
5287
|
switchChain: signerContext.switchChain,
|
|
4333
5288
|
targetChain,
|
|
4334
5289
|
targetToken,
|
|
@@ -4337,9 +5292,9 @@ function DepositFlow({
|
|
|
4337
5292
|
onContinue: handleAmountContinue,
|
|
4338
5293
|
onCtaClick: (ctaName) => {
|
|
4339
5294
|
const receiveSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4340
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
5295
|
+
_optionalChain([onEvent, 'optionalCall', _194 => _194({
|
|
4341
5296
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
4342
|
-
send_token:
|
|
5297
|
+
send_token: effectiveStep.asset.symbol,
|
|
4343
5298
|
receive_token: receiveSymbol,
|
|
4344
5299
|
pred_balance: totalBalanceUsd,
|
|
4345
5300
|
cta_name: ctaName
|
|
@@ -4347,45 +5302,62 @@ function DepositFlow({
|
|
|
4347
5302
|
}
|
|
4348
5303
|
}
|
|
4349
5304
|
),
|
|
4350
|
-
|
|
5305
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4351
5306
|
ConfirmStep,
|
|
4352
5307
|
{
|
|
4353
5308
|
walletClient: signerContext.walletClient,
|
|
4354
5309
|
address: ownerAddress,
|
|
4355
|
-
smartAccount:
|
|
5310
|
+
smartAccount: effectiveStep.smartAccount,
|
|
4356
5311
|
recipient,
|
|
4357
|
-
asset:
|
|
4358
|
-
amount:
|
|
4359
|
-
targetAmount:
|
|
4360
|
-
targetTokenPriceUsd:
|
|
4361
|
-
balance:
|
|
5312
|
+
asset: effectiveStep.asset,
|
|
5313
|
+
amount: effectiveStep.amount,
|
|
5314
|
+
targetAmount: effectiveStep.targetAmount,
|
|
5315
|
+
targetTokenPriceUsd: effectiveStep.targetTokenPriceUsd,
|
|
5316
|
+
balance: effectiveStep.balance,
|
|
4362
5317
|
targetChain,
|
|
4363
5318
|
targetToken,
|
|
4364
5319
|
switchChain: signerContext.switchChain,
|
|
4365
|
-
liquidityWarning:
|
|
5320
|
+
liquidityWarning: effectiveStep.liquidityWarning,
|
|
4366
5321
|
uiConfig,
|
|
5322
|
+
executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
|
|
5323
|
+
const result = await activeDappImportProvider.executeTransfer(
|
|
5324
|
+
{
|
|
5325
|
+
walletClient: signerContext.walletClient,
|
|
5326
|
+
publicClient: getReadClientForChain(
|
|
5327
|
+
activeDappImportProvider.chainId
|
|
5328
|
+
),
|
|
5329
|
+
recipient: effectiveStep.smartAccount,
|
|
5330
|
+
asset: effectiveStep.asset,
|
|
5331
|
+
amount: amountUnits
|
|
5332
|
+
}
|
|
5333
|
+
);
|
|
5334
|
+
return {
|
|
5335
|
+
txHash: result.txHash,
|
|
5336
|
+
sourceToken: result.sourceToken
|
|
5337
|
+
};
|
|
5338
|
+
} : void 0,
|
|
4367
5339
|
onConfirm: handleDepositSubmitted,
|
|
4368
5340
|
onDepositSubmitted: handleDepositSubmittedCallback,
|
|
4369
5341
|
onError: handleError
|
|
4370
5342
|
}
|
|
4371
5343
|
),
|
|
4372
|
-
|
|
4373
|
-
|
|
5344
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5345
|
+
_chunkV6NJIPSScjs.ProcessingStep,
|
|
4374
5346
|
{
|
|
4375
|
-
smartAccount:
|
|
4376
|
-
solanaDepositAddress:
|
|
4377
|
-
txHash:
|
|
4378
|
-
sourceChain:
|
|
4379
|
-
sourceToken:
|
|
5347
|
+
smartAccount: effectiveStep.smartAccount,
|
|
5348
|
+
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
5349
|
+
txHash: effectiveStep.txHash,
|
|
5350
|
+
sourceChain: effectiveStep.sourceChain,
|
|
5351
|
+
sourceToken: effectiveStep.sourceToken,
|
|
4380
5352
|
targetChain,
|
|
4381
5353
|
targetToken,
|
|
4382
|
-
amount:
|
|
4383
|
-
sourceSymbol:
|
|
4384
|
-
sourceDecimals:
|
|
5354
|
+
amount: effectiveStep.amount,
|
|
5355
|
+
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5356
|
+
sourceDecimals: effectiveStep.sourceDecimals,
|
|
4385
5357
|
waitForFinalTx,
|
|
4386
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5358
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _195 => _195.length])),
|
|
4387
5359
|
service,
|
|
4388
|
-
directTransfer:
|
|
5360
|
+
directTransfer: effectiveStep.directTransfer,
|
|
4389
5361
|
uiConfig,
|
|
4390
5362
|
onClose,
|
|
4391
5363
|
onNewDeposit: handleNewDeposit,
|
|
@@ -4415,15 +5387,15 @@ function formatDate(iso) {
|
|
|
4415
5387
|
month: "short",
|
|
4416
5388
|
year: "numeric"
|
|
4417
5389
|
});
|
|
4418
|
-
} catch (
|
|
5390
|
+
} catch (e29) {
|
|
4419
5391
|
return iso;
|
|
4420
5392
|
}
|
|
4421
5393
|
}
|
|
4422
5394
|
function resolveChainId(value) {
|
|
4423
5395
|
if (value === void 0 || value === null) return null;
|
|
4424
5396
|
if (typeof value === "number") return value;
|
|
4425
|
-
if (
|
|
4426
|
-
const parsed =
|
|
5397
|
+
if (_chunkV6NJIPSScjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
5398
|
+
const parsed = _chunkV6NJIPSScjs.parseEvmChainId.call(void 0, value);
|
|
4427
5399
|
if (parsed !== null) return parsed;
|
|
4428
5400
|
const num = Number(value);
|
|
4429
5401
|
return Number.isFinite(num) ? num : null;
|
|
@@ -4474,7 +5446,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
4474
5446
|
const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
|
|
4475
5447
|
if (!trimmed) return whole.toString();
|
|
4476
5448
|
return `${whole}.${trimmed}`;
|
|
4477
|
-
} catch (
|
|
5449
|
+
} catch (e30) {
|
|
4478
5450
|
return rawAmount;
|
|
4479
5451
|
}
|
|
4480
5452
|
}
|
|
@@ -4537,7 +5509,7 @@ function DepositHistoryPanel({
|
|
|
4537
5509
|
className: "rs-modal-header-back",
|
|
4538
5510
|
"aria-label": "Back",
|
|
4539
5511
|
onClick: onClose,
|
|
4540
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5512
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronLeftIcon, {})
|
|
4541
5513
|
}
|
|
4542
5514
|
) }),
|
|
4543
5515
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-center" }),
|
|
@@ -4548,29 +5520,29 @@ function DepositHistoryPanel({
|
|
|
4548
5520
|
className: "rs-modal-close",
|
|
4549
5521
|
"aria-label": "Close",
|
|
4550
5522
|
onClick: onCloseModal,
|
|
4551
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5523
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
|
|
4552
5524
|
}
|
|
4553
5525
|
) })
|
|
4554
5526
|
] }),
|
|
4555
5527
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
4556
5528
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
4557
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}), title: "History" }),
|
|
4558
5530
|
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4559
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}) }),
|
|
4560
5532
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
4561
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-spinner--sm" }),
|
|
4562
5534
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
4563
5535
|
] })
|
|
4564
5536
|
] }),
|
|
4565
5537
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4566
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5538
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, {}) }),
|
|
4567
5539
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
4568
5540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
4569
5541
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
4570
5542
|
] })
|
|
4571
5543
|
] }),
|
|
4572
5544
|
!isLoading && !error && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5545
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}) }),
|
|
4574
5546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
4575
5547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
4576
5548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
@@ -4590,7 +5562,7 @@ function DepositHistoryPanel({
|
|
|
4590
5562
|
)
|
|
4591
5563
|
] })
|
|
4592
5564
|
] }),
|
|
4593
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5565
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
|
|
4594
5566
|
] })
|
|
4595
5567
|
]
|
|
4596
5568
|
}
|
|
@@ -4664,7 +5636,7 @@ function HistoryCard({ deposit }) {
|
|
|
4664
5636
|
onClick: (e) => e.stopPropagation(),
|
|
4665
5637
|
children: [
|
|
4666
5638
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
4667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ArrowRightIcon, {})
|
|
4668
5640
|
]
|
|
4669
5641
|
}
|
|
4670
5642
|
)
|
|
@@ -4679,7 +5651,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
4679
5651
|
// src/DepositModal.tsx
|
|
4680
5652
|
|
|
4681
5653
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
4682
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
5654
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-DVRWDPYV.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
4683
5655
|
);
|
|
4684
5656
|
function sortByCreatedAtDesc(items) {
|
|
4685
5657
|
return [...items].sort((a, b) => {
|
|
@@ -4734,6 +5706,7 @@ function DepositModalInner({
|
|
|
4734
5706
|
forceRegister = false,
|
|
4735
5707
|
waitForFinalTx = true,
|
|
4736
5708
|
enableSolana = true,
|
|
5709
|
+
dappImports,
|
|
4737
5710
|
postBridgeActions,
|
|
4738
5711
|
outputTokenRules,
|
|
4739
5712
|
rejectUnmapped,
|
|
@@ -4752,12 +5725,12 @@ function DepositModalInner({
|
|
|
4752
5725
|
debug
|
|
4753
5726
|
}) {
|
|
4754
5727
|
const modalRef = _react.useRef.call(void 0, null);
|
|
4755
|
-
const onReadyRef =
|
|
5728
|
+
const onReadyRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onReady);
|
|
4756
5729
|
const [currentScreen, setCurrentScreen] = _react.useState.call(void 0, "connect");
|
|
4757
5730
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
4758
5731
|
void 0
|
|
4759
5732
|
);
|
|
4760
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
5733
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _196 => _196.showHistoryButton]), () => ( false));
|
|
4761
5734
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
4762
5735
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
4763
5736
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -4771,7 +5744,7 @@ function DepositModalInner({
|
|
|
4771
5744
|
const targetChain = _chunkIVTXEYB2cjs.getChainId.call(void 0, targetChainProp);
|
|
4772
5745
|
const sourceChain = sourceChainProp ? _chunkIVTXEYB2cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
4773
5746
|
const service = _react.useMemo.call(void 0,
|
|
4774
|
-
() =>
|
|
5747
|
+
() => _chunkV6NJIPSScjs.createDepositService.call(void 0, backendUrl, {
|
|
4775
5748
|
debug,
|
|
4776
5749
|
debugScope: "service:deposit"
|
|
4777
5750
|
}),
|
|
@@ -4787,7 +5760,7 @@ function DepositModalInner({
|
|
|
4787
5760
|
}, [store, targetChain, targetToken]);
|
|
4788
5761
|
_react.useEffect.call(void 0, () => {
|
|
4789
5762
|
if (isOpen && modalRef.current) {
|
|
4790
|
-
|
|
5763
|
+
_chunkV6NJIPSScjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
4791
5764
|
}
|
|
4792
5765
|
}, [isOpen, theme]);
|
|
4793
5766
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4795,7 +5768,7 @@ function DepositModalInner({
|
|
|
4795
5768
|
}, [solanaRpcUrl]);
|
|
4796
5769
|
_react.useEffect.call(void 0, () => {
|
|
4797
5770
|
if (isOpen) {
|
|
4798
|
-
_optionalChain([onReadyRef, 'access',
|
|
5771
|
+
_optionalChain([onReadyRef, 'access', _197 => _197.current, 'optionalCall', _198 => _198()]);
|
|
4799
5772
|
}
|
|
4800
5773
|
}, [isOpen, onReadyRef]);
|
|
4801
5774
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -4871,10 +5844,10 @@ function DepositModalInner({
|
|
|
4871
5844
|
fetchHistory("initial");
|
|
4872
5845
|
}
|
|
4873
5846
|
}, [historyOpen, fetchHistory]);
|
|
4874
|
-
const onLifecycleRef =
|
|
5847
|
+
const onLifecycleRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onLifecycle);
|
|
4875
5848
|
const handleLifecycle = _react.useCallback.call(void 0,
|
|
4876
5849
|
(event) => {
|
|
4877
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5850
|
+
_optionalChain([onLifecycleRef, 'access', _199 => _199.current, 'optionalCall', _200 => _200(event)]);
|
|
4878
5851
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
4879
5852
|
historyStaleRef.current = true;
|
|
4880
5853
|
}
|
|
@@ -4900,10 +5873,10 @@ function DepositModalInner({
|
|
|
4900
5873
|
store.dispatch({ type: "flow/reset" });
|
|
4901
5874
|
}
|
|
4902
5875
|
}, [isOpen, store]);
|
|
4903
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
5876
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _201 => _201.showBackButton]), () => ( true));
|
|
4904
5877
|
const canGoBack = backHandler !== void 0;
|
|
4905
5878
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4906
|
-
|
|
5879
|
+
_chunkV6NJIPSScjs.Modal,
|
|
4907
5880
|
{
|
|
4908
5881
|
isOpen,
|
|
4909
5882
|
onClose,
|
|
@@ -4919,7 +5892,7 @@ function DepositModalInner({
|
|
|
4919
5892
|
className: "rs-modal-header-back",
|
|
4920
5893
|
"aria-label": "Go back",
|
|
4921
5894
|
onClick: backHandler,
|
|
4922
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5895
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronLeftIcon, {})
|
|
4923
5896
|
}
|
|
4924
5897
|
) }),
|
|
4925
5898
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -4931,7 +5904,7 @@ function DepositModalInner({
|
|
|
4931
5904
|
"aria-label": "Deposit history",
|
|
4932
5905
|
onClick: handleHistoryOpen,
|
|
4933
5906
|
disabled: !recipient,
|
|
4934
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5907
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {})
|
|
4935
5908
|
}
|
|
4936
5909
|
),
|
|
4937
5910
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4941,7 +5914,7 @@ function DepositModalInner({
|
|
|
4941
5914
|
onClick: onClose,
|
|
4942
5915
|
className: "rs-modal-close",
|
|
4943
5916
|
"aria-label": "Close",
|
|
4944
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5917
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
|
|
4945
5918
|
}
|
|
4946
5919
|
)
|
|
4947
5920
|
] })
|
|
@@ -4968,6 +5941,7 @@ function DepositModalInner({
|
|
|
4968
5941
|
forceRegister,
|
|
4969
5942
|
waitForFinalTx,
|
|
4970
5943
|
enableSolana,
|
|
5944
|
+
dappImports,
|
|
4971
5945
|
reownWallet,
|
|
4972
5946
|
onConnect,
|
|
4973
5947
|
onDisconnect,
|