@rhinestone/deposit-modal 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -21
- package/dist/index.cjs +854 -655
- package/dist/index.d.cts +6 -12
- package/dist/index.d.ts +6 -12
- package/dist/index.mjs +849 -659
- package/dist/styles.css +76 -21
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -219,8 +219,89 @@ var init_Button = __esm({
|
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
// src/components/
|
|
222
|
+
// src/components/ui/Icons.tsx
|
|
223
223
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
224
|
+
function WalletIcon() {
|
|
225
|
+
return /* @__PURE__ */ jsxs3("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
226
|
+
/* @__PURE__ */ jsx4(
|
|
227
|
+
"rect",
|
|
228
|
+
{
|
|
229
|
+
x: "3",
|
|
230
|
+
y: "6",
|
|
231
|
+
width: "18",
|
|
232
|
+
height: "13",
|
|
233
|
+
rx: "2",
|
|
234
|
+
strokeLinecap: "round",
|
|
235
|
+
strokeLinejoin: "round"
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx4(
|
|
239
|
+
"path",
|
|
240
|
+
{
|
|
241
|
+
d: "M16 12.5a1 1 0 100-2 1 1 0 000 2z",
|
|
242
|
+
fill: "currentColor",
|
|
243
|
+
stroke: "none"
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 10h18", strokeLinecap: "round" })
|
|
247
|
+
] });
|
|
248
|
+
}
|
|
249
|
+
function ExternalLinkIcon() {
|
|
250
|
+
return /* @__PURE__ */ jsxs3("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
251
|
+
/* @__PURE__ */ jsx4(
|
|
252
|
+
"path",
|
|
253
|
+
{
|
|
254
|
+
d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5",
|
|
255
|
+
strokeLinecap: "round",
|
|
256
|
+
strokeLinejoin: "round"
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ jsx4("path", { d: "M15 3h6v6", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
260
|
+
/* @__PURE__ */ jsx4("path", { d: "M10 14L21 3", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
261
|
+
] });
|
|
262
|
+
}
|
|
263
|
+
function TransferIcon() {
|
|
264
|
+
return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx4(
|
|
265
|
+
"path",
|
|
266
|
+
{
|
|
267
|
+
d: "M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-9L21 12m0 0l-4.5 4.5M21 12H7.5",
|
|
268
|
+
strokeLinecap: "round",
|
|
269
|
+
strokeLinejoin: "round"
|
|
270
|
+
}
|
|
271
|
+
) });
|
|
272
|
+
}
|
|
273
|
+
function CheckIcon() {
|
|
274
|
+
return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx4(
|
|
275
|
+
"path",
|
|
276
|
+
{
|
|
277
|
+
d: "M5 13l4 4L19 7",
|
|
278
|
+
strokeLinecap: "round",
|
|
279
|
+
strokeLinejoin: "round"
|
|
280
|
+
}
|
|
281
|
+
) });
|
|
282
|
+
}
|
|
283
|
+
function ChevronRightIcon() {
|
|
284
|
+
return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx4(
|
|
285
|
+
"path",
|
|
286
|
+
{
|
|
287
|
+
d: "M9 5l7 7-7 7",
|
|
288
|
+
strokeLinecap: "round",
|
|
289
|
+
strokeLinejoin: "round"
|
|
290
|
+
}
|
|
291
|
+
) });
|
|
292
|
+
}
|
|
293
|
+
var init_Icons = __esm({
|
|
294
|
+
"src/components/ui/Icons.tsx"() {
|
|
295
|
+
"use strict";
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// src/components/steps/ConnectStep.tsx
|
|
300
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
301
|
+
function rowIcon(kind) {
|
|
302
|
+
if (kind === "connected") return /* @__PURE__ */ jsx5(WalletIcon, {});
|
|
303
|
+
return /* @__PURE__ */ jsx5(ExternalLinkIcon, {});
|
|
304
|
+
}
|
|
224
305
|
function ConnectStep({
|
|
225
306
|
walletOptions,
|
|
226
307
|
selectedAddress,
|
|
@@ -236,52 +317,70 @@ function ConnectStep({
|
|
|
236
317
|
if (hasWalletOptions) {
|
|
237
318
|
const hasExternalWallet = walletOptions?.some((option) => option.kind === "external") ?? false;
|
|
238
319
|
const showConnectDifferentWalletOption = Boolean(onConnect) && !hasExternalWallet;
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rs-step", children: [
|
|
321
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
|
|
322
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-list", children: [
|
|
242
323
|
walletOptions?.map((option) => {
|
|
243
324
|
const isSelected = option.address.toLowerCase() === (selectedAddress ?? "").toLowerCase();
|
|
244
325
|
const shortAddress = `${option.address.slice(0, 6)}...${option.address.slice(-4)}`;
|
|
245
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsxs4(
|
|
246
327
|
"button",
|
|
247
328
|
{
|
|
248
329
|
type: "button",
|
|
249
330
|
className: `rs-connect-wallet-row ${isSelected ? "rs-connect-wallet-row--selected" : ""}`,
|
|
250
331
|
onClick: () => onSelectAddress?.(option.address),
|
|
251
|
-
children:
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
|
|
254
|
-
|
|
332
|
+
children: [
|
|
333
|
+
/* @__PURE__ */ jsx5(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
className: `rs-connect-wallet-icon ${isSelected ? "rs-connect-wallet-icon--selected" : ""}`,
|
|
337
|
+
children: rowIcon(option.kind)
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
341
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: option.label }),
|
|
342
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: shortAddress })
|
|
343
|
+
] }),
|
|
344
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: isSelected ? /* @__PURE__ */ jsx5(CheckIcon, {}) : /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
345
|
+
]
|
|
255
346
|
},
|
|
256
347
|
`${option.label}-${option.address}`
|
|
257
348
|
);
|
|
258
349
|
}),
|
|
259
|
-
showConnectDifferentWalletOption && /* @__PURE__ */
|
|
350
|
+
showConnectDifferentWalletOption && /* @__PURE__ */ jsxs4(
|
|
260
351
|
"button",
|
|
261
352
|
{
|
|
262
353
|
type: "button",
|
|
263
354
|
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
264
355
|
onClick: onConnect,
|
|
265
|
-
children:
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(ExternalLinkIcon, {}) }),
|
|
358
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
359
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "External Wallet" }),
|
|
360
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "Connect different wallet" })
|
|
361
|
+
] }),
|
|
362
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
363
|
+
]
|
|
269
364
|
}
|
|
270
365
|
),
|
|
271
|
-
onSelectTransferCrypto && /* @__PURE__ */
|
|
366
|
+
onSelectTransferCrypto && /* @__PURE__ */ jsxs4(
|
|
272
367
|
"button",
|
|
273
368
|
{
|
|
274
369
|
type: "button",
|
|
275
370
|
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
276
371
|
onClick: onSelectTransferCrypto,
|
|
277
|
-
children:
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(TransferIcon, {}) }),
|
|
374
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
375
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "Transfer Crypto" }),
|
|
376
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "Deposit via QR code" })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
379
|
+
]
|
|
281
380
|
}
|
|
282
381
|
)
|
|
283
382
|
] }),
|
|
284
|
-
onConnect && walletOptions?.some((option) => option.kind === "external") && /* @__PURE__ */
|
|
383
|
+
onConnect && walletOptions?.some((option) => option.kind === "external") && /* @__PURE__ */ jsx5(
|
|
285
384
|
"button",
|
|
286
385
|
{
|
|
287
386
|
type: "button",
|
|
@@ -291,7 +390,7 @@ function ConnectStep({
|
|
|
291
390
|
}
|
|
292
391
|
)
|
|
293
392
|
] }),
|
|
294
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-step-footer rs-step-footer--connect-empty", children: /* @__PURE__ */ jsx5(
|
|
295
394
|
Button,
|
|
296
395
|
{
|
|
297
396
|
onClick: onContinue,
|
|
@@ -304,12 +403,12 @@ function ConnectStep({
|
|
|
304
403
|
] });
|
|
305
404
|
}
|
|
306
405
|
const handleConnect = onConnect ?? onRequestConnect;
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
406
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rs-step", children: [
|
|
407
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-centered rs-connect-centered--minimal", children: /* @__PURE__ */ jsxs4("div", { className: "rs-connect-empty", children: [
|
|
408
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-empty-graphic", "aria-hidden": "true", children: [
|
|
409
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-orbit rs-connect-empty-orbit--outer" }),
|
|
410
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-orbit rs-connect-empty-orbit--inner" }),
|
|
411
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-core", children: /* @__PURE__ */ jsxs4(
|
|
313
412
|
"svg",
|
|
314
413
|
{
|
|
315
414
|
viewBox: "0 0 24 24",
|
|
@@ -317,7 +416,7 @@ function ConnectStep({
|
|
|
317
416
|
stroke: "currentColor",
|
|
318
417
|
strokeWidth: "1.6",
|
|
319
418
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ jsx5(
|
|
321
420
|
"path",
|
|
322
421
|
{
|
|
323
422
|
strokeLinecap: "round",
|
|
@@ -325,7 +424,7 @@ function ConnectStep({
|
|
|
325
424
|
d: "M4 8.25A2.25 2.25 0 016.25 6h11.5A2.25 2.25 0 0120 8.25v7.5A2.25 2.25 0 0117.75 18H6.25A2.25 2.25 0 014 15.75v-7.5z"
|
|
326
425
|
}
|
|
327
426
|
),
|
|
328
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ jsx5(
|
|
329
428
|
"path",
|
|
330
429
|
{
|
|
331
430
|
strokeLinecap: "round",
|
|
@@ -333,18 +432,18 @@ function ConnectStep({
|
|
|
333
432
|
d: "M20 10.5h-3.75a2.25 2.25 0 100 4.5H20"
|
|
334
433
|
}
|
|
335
434
|
),
|
|
336
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsx5("circle", { cx: "16.25", cy: "12.75", r: "0.85", fill: "currentColor" })
|
|
337
436
|
]
|
|
338
437
|
}
|
|
339
438
|
) }),
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ jsx5("span", { className: "rs-connect-empty-dot rs-connect-empty-dot--left" }),
|
|
440
|
+
/* @__PURE__ */ jsx5("span", { className: "rs-connect-empty-dot rs-connect-empty-dot--right" })
|
|
342
441
|
] }),
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-title", children: "No wallet connected" }),
|
|
443
|
+
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-subtitle", children: "Connect an external wallet to continue." })
|
|
345
444
|
] }) }),
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-step-footer rs-step-footer--connect-empty", children: [
|
|
446
|
+
/* @__PURE__ */ jsx5(
|
|
348
447
|
Button,
|
|
349
448
|
{
|
|
350
449
|
onClick: handleConnect,
|
|
@@ -354,7 +453,7 @@ function ConnectStep({
|
|
|
354
453
|
children: connectButtonLabel
|
|
355
454
|
}
|
|
356
455
|
),
|
|
357
|
-
onSelectTransferCrypto && /* @__PURE__ */
|
|
456
|
+
onSelectTransferCrypto && /* @__PURE__ */ jsx5(
|
|
358
457
|
"button",
|
|
359
458
|
{
|
|
360
459
|
type: "button",
|
|
@@ -370,6 +469,7 @@ var init_ConnectStep = __esm({
|
|
|
370
469
|
"src/components/steps/ConnectStep.tsx"() {
|
|
371
470
|
"use strict";
|
|
372
471
|
init_Button();
|
|
472
|
+
init_Icons();
|
|
373
473
|
ConnectStep.displayName = "ConnectStep";
|
|
374
474
|
}
|
|
375
475
|
});
|
|
@@ -873,7 +973,7 @@ var init_session_owner = __esm({
|
|
|
873
973
|
// src/components/steps/SetupStep.tsx
|
|
874
974
|
import { useState, useEffect as useEffect2, useRef as useRef2, useCallback as useCallback2 } from "react";
|
|
875
975
|
import { walletClientToAccount } from "@rhinestone/sdk";
|
|
876
|
-
import { Fragment, jsx as
|
|
976
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
877
977
|
async function resolveSessionOwner(eoaAddress) {
|
|
878
978
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
879
979
|
if (localOwner) {
|
|
@@ -1013,24 +1113,24 @@ function SetupStep({
|
|
|
1013
1113
|
};
|
|
1014
1114
|
const isLoading = state.type === "idle" || state.type === "checking" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
1015
1115
|
const isError = state.type === "error";
|
|
1016
|
-
return /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
isLoading && /* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ jsxs5("div", { className: "rs-step", children: [
|
|
1117
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-loading-state", children: [
|
|
1118
|
+
isLoading && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1119
|
+
/* @__PURE__ */ jsx6(Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
1120
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-loading-text", children: [
|
|
1121
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
1122
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
1023
1123
|
] })
|
|
1024
1124
|
] }),
|
|
1025
|
-
isError && /* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1125
|
+
isError && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1126
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx6(
|
|
1027
1127
|
"svg",
|
|
1028
1128
|
{
|
|
1029
1129
|
viewBox: "0 0 24 24",
|
|
1030
1130
|
fill: "none",
|
|
1031
1131
|
stroke: "currentColor",
|
|
1032
1132
|
strokeWidth: "2",
|
|
1033
|
-
children: /* @__PURE__ */
|
|
1133
|
+
children: /* @__PURE__ */ jsx6(
|
|
1034
1134
|
"path",
|
|
1035
1135
|
{
|
|
1036
1136
|
strokeLinecap: "round",
|
|
@@ -1040,9 +1140,9 @@ function SetupStep({
|
|
|
1040
1140
|
)
|
|
1041
1141
|
}
|
|
1042
1142
|
) }),
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-loading-text", children: [
|
|
1144
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-loading-title rs-text-error", children: "Setup failed" }),
|
|
1145
|
+
/* @__PURE__ */ jsx6(
|
|
1046
1146
|
"div",
|
|
1047
1147
|
{
|
|
1048
1148
|
className: "rs-loading-subtitle",
|
|
@@ -1053,7 +1153,7 @@ function SetupStep({
|
|
|
1053
1153
|
] })
|
|
1054
1154
|
] })
|
|
1055
1155
|
] }),
|
|
1056
|
-
isError && /* @__PURE__ */
|
|
1156
|
+
isError && /* @__PURE__ */ jsx6("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx6(Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
1057
1157
|
] });
|
|
1058
1158
|
}
|
|
1059
1159
|
var init_SetupStep = __esm({
|
|
@@ -1067,17 +1167,17 @@ var init_SetupStep = __esm({
|
|
|
1067
1167
|
});
|
|
1068
1168
|
|
|
1069
1169
|
// src/components/ui/PoweredBy.tsx
|
|
1070
|
-
import { jsx as
|
|
1170
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1071
1171
|
function PoweredBy() {
|
|
1072
|
-
return /* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rs-powered-by", children: [
|
|
1173
|
+
/* @__PURE__ */ jsx7(
|
|
1074
1174
|
"svg",
|
|
1075
1175
|
{
|
|
1076
1176
|
viewBox: "0 0 24 24",
|
|
1077
1177
|
fill: "none",
|
|
1078
1178
|
stroke: "currentColor",
|
|
1079
1179
|
strokeWidth: "2",
|
|
1080
|
-
children: /* @__PURE__ */
|
|
1180
|
+
children: /* @__PURE__ */ jsx7(
|
|
1081
1181
|
"path",
|
|
1082
1182
|
{
|
|
1083
1183
|
strokeLinecap: "round",
|
|
@@ -1087,10 +1187,10 @@ function PoweredBy() {
|
|
|
1087
1187
|
)
|
|
1088
1188
|
}
|
|
1089
1189
|
),
|
|
1090
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1091
1191
|
"Powered by",
|
|
1092
1192
|
" ",
|
|
1093
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ jsx7(
|
|
1094
1194
|
"a",
|
|
1095
1195
|
{
|
|
1096
1196
|
href: "https://www.rhinestone.dev",
|
|
@@ -1372,7 +1472,7 @@ var init_formatters = __esm({
|
|
|
1372
1472
|
// src/components/steps/AssetSelectStep.tsx
|
|
1373
1473
|
import { useEffect as useEffect3, useMemo, useState as useState2 } from "react";
|
|
1374
1474
|
import { formatUnits } from "viem";
|
|
1375
|
-
import { jsx as
|
|
1475
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1376
1476
|
function AssetSelectStep({
|
|
1377
1477
|
address,
|
|
1378
1478
|
publicClient,
|
|
@@ -1478,21 +1578,21 @@ function AssetSelectStep({
|
|
|
1478
1578
|
return asset.balance;
|
|
1479
1579
|
}
|
|
1480
1580
|
};
|
|
1481
|
-
return /* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1581
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rs-step", children: [
|
|
1582
|
+
/* @__PURE__ */ jsx8("div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ jsx8("div", { className: "rs-step-title", children: "Select source asset" }) }),
|
|
1583
|
+
/* @__PURE__ */ jsxs7(
|
|
1484
1584
|
"div",
|
|
1485
1585
|
{
|
|
1486
1586
|
className: "rs-step-body",
|
|
1487
1587
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1488
1588
|
children: [
|
|
1489
|
-
loading && /* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1589
|
+
loading && /* @__PURE__ */ jsxs7("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
1590
|
+
/* @__PURE__ */ jsx8(Spinner, { className: "rs-text-tertiary" }),
|
|
1591
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
1492
1592
|
] }),
|
|
1493
|
-
error && /* @__PURE__ */
|
|
1494
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1593
|
+
error && /* @__PURE__ */ jsx8("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx8("span", { className: "rs-alert-text", children: error }) }),
|
|
1594
|
+
!loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-empty-state", children: [
|
|
1595
|
+
/* @__PURE__ */ jsx8(
|
|
1496
1596
|
"svg",
|
|
1497
1597
|
{
|
|
1498
1598
|
className: "rs-empty-icon",
|
|
@@ -1500,7 +1600,7 @@ function AssetSelectStep({
|
|
|
1500
1600
|
fill: "none",
|
|
1501
1601
|
stroke: "currentColor",
|
|
1502
1602
|
strokeWidth: "1.5",
|
|
1503
|
-
children: /* @__PURE__ */
|
|
1603
|
+
children: /* @__PURE__ */ jsx8(
|
|
1504
1604
|
"path",
|
|
1505
1605
|
{
|
|
1506
1606
|
strokeLinecap: "round",
|
|
@@ -1510,20 +1610,20 @@ function AssetSelectStep({
|
|
|
1510
1610
|
)
|
|
1511
1611
|
}
|
|
1512
1612
|
),
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
1614
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-empty-address", children: [
|
|
1515
1615
|
address.slice(0, 6),
|
|
1516
1616
|
"...",
|
|
1517
1617
|
address.slice(-4)
|
|
1518
1618
|
] })
|
|
1519
1619
|
] }),
|
|
1520
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
1620
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx8("div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
1521
1621
|
const isSelected = selectedAssetId === asset.id;
|
|
1522
1622
|
const tokenAmount = formatBalance(asset);
|
|
1523
1623
|
const badge = getChainBadge(asset.chainId);
|
|
1524
1624
|
const tokenIcon = getTokenIcon(asset.symbol);
|
|
1525
1625
|
const chainIcon = getChainIcon(asset.chainId);
|
|
1526
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ jsxs7(
|
|
1527
1627
|
"button",
|
|
1528
1628
|
{
|
|
1529
1629
|
type: "button",
|
|
@@ -1531,9 +1631,9 @@ function AssetSelectStep({
|
|
|
1531
1631
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
1532
1632
|
style: { textAlign: "left" },
|
|
1533
1633
|
children: [
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
tokenIcon ? /* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-info", children: [
|
|
1635
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-icon-wrapper", children: [
|
|
1636
|
+
tokenIcon ? /* @__PURE__ */ jsx8(
|
|
1537
1637
|
"img",
|
|
1538
1638
|
{
|
|
1539
1639
|
src: tokenIcon,
|
|
@@ -1541,15 +1641,15 @@ function AssetSelectStep({
|
|
|
1541
1641
|
className: "rs-asset-icon",
|
|
1542
1642
|
style: { background: "transparent" }
|
|
1543
1643
|
}
|
|
1544
|
-
) : /* @__PURE__ */
|
|
1545
|
-
chainIcon ? /* @__PURE__ */
|
|
1644
|
+
) : /* @__PURE__ */ jsx8("div", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
|
|
1645
|
+
chainIcon ? /* @__PURE__ */ jsx8(
|
|
1546
1646
|
"img",
|
|
1547
1647
|
{
|
|
1548
1648
|
src: chainIcon,
|
|
1549
1649
|
alt: getChainName(asset.chainId),
|
|
1550
1650
|
className: "rs-asset-chain-badge"
|
|
1551
1651
|
}
|
|
1552
|
-
) : /* @__PURE__ */
|
|
1652
|
+
) : /* @__PURE__ */ jsx8(
|
|
1553
1653
|
"div",
|
|
1554
1654
|
{
|
|
1555
1655
|
className: "rs-asset-chain-badge",
|
|
@@ -1561,23 +1661,23 @@ function AssetSelectStep({
|
|
|
1561
1661
|
}
|
|
1562
1662
|
)
|
|
1563
1663
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1665
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-name", children: [
|
|
1566
1666
|
asset.symbol,
|
|
1567
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-asset-chain", children: [
|
|
1568
1668
|
" ",
|
|
1569
1669
|
"on ",
|
|
1570
1670
|
getChainName(asset.chainId)
|
|
1571
1671
|
] })
|
|
1572
1672
|
] }),
|
|
1573
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
|
|
1574
1674
|
tokenAmount,
|
|
1575
1675
|
" ",
|
|
1576
1676
|
asset.symbol
|
|
1577
1677
|
] })
|
|
1578
1678
|
] })
|
|
1579
1679
|
] }),
|
|
1580
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ? currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
1581
1681
|
]
|
|
1582
1682
|
},
|
|
1583
1683
|
asset.id
|
|
@@ -1586,7 +1686,7 @@ function AssetSelectStep({
|
|
|
1586
1686
|
]
|
|
1587
1687
|
}
|
|
1588
1688
|
),
|
|
1589
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx8(
|
|
1590
1690
|
Button,
|
|
1591
1691
|
{
|
|
1592
1692
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
@@ -1595,7 +1695,7 @@ function AssetSelectStep({
|
|
|
1595
1695
|
children: "Continue"
|
|
1596
1696
|
}
|
|
1597
1697
|
) }),
|
|
1598
|
-
/* @__PURE__ */
|
|
1698
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
1599
1699
|
] });
|
|
1600
1700
|
}
|
|
1601
1701
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
@@ -1651,7 +1751,7 @@ var init_AssetSelectStep = __esm({
|
|
|
1651
1751
|
// src/components/steps/AmountStep.tsx
|
|
1652
1752
|
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState3, useRef as useRef3 } from "react";
|
|
1653
1753
|
import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
|
|
1654
|
-
import { jsx as
|
|
1754
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1655
1755
|
function AmountStep({
|
|
1656
1756
|
walletClient,
|
|
1657
1757
|
publicClient,
|
|
@@ -1822,10 +1922,10 @@ function AmountStep({
|
|
|
1822
1922
|
setIsSwitching(false);
|
|
1823
1923
|
}
|
|
1824
1924
|
};
|
|
1825
|
-
return /* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1925
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rs-step", children: [
|
|
1926
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
1927
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-display", children: [
|
|
1928
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ jsx9(
|
|
1829
1929
|
"input",
|
|
1830
1930
|
{
|
|
1831
1931
|
type: "text",
|
|
@@ -1843,17 +1943,17 @@ function AmountStep({
|
|
|
1843
1943
|
autoFocus: true
|
|
1844
1944
|
}
|
|
1845
1945
|
) }),
|
|
1846
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-token-value", children: [
|
|
1847
1947
|
formattedTokenAmount,
|
|
1848
1948
|
" ",
|
|
1849
1949
|
asset.symbol
|
|
1850
1950
|
] }),
|
|
1851
|
-
/* @__PURE__ */
|
|
1951
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-amount-available", children: /* @__PURE__ */ jsxs8("span", { className: "rs-amount-available-value", children: [
|
|
1852
1952
|
formattedBalance,
|
|
1853
1953
|
" ",
|
|
1854
1954
|
asset.symbol,
|
|
1855
1955
|
" available",
|
|
1856
|
-
balanceUsd !== null && /* @__PURE__ */
|
|
1956
|
+
balanceUsd !== null && /* @__PURE__ */ jsxs8("span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
1857
1957
|
" ",
|
|
1858
1958
|
"(",
|
|
1859
1959
|
currencyFormatter.format(balanceUsd),
|
|
@@ -1861,16 +1961,16 @@ function AmountStep({
|
|
|
1861
1961
|
] })
|
|
1862
1962
|
] }) })
|
|
1863
1963
|
] }),
|
|
1864
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ jsx9(
|
|
1865
1965
|
"div",
|
|
1866
1966
|
{
|
|
1867
1967
|
style: { display: "flex", justifyContent: "center", marginTop: 16 },
|
|
1868
|
-
children: /* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1968
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill", children: [
|
|
1969
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-side", children: [
|
|
1970
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
1971
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-token", children: [
|
|
1972
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
1973
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-flow-pill-token-icon", children: getTokenIcon(asset.symbol) ? /* @__PURE__ */ jsx9(
|
|
1874
1974
|
"img",
|
|
1875
1975
|
{
|
|
1876
1976
|
src: getTokenIcon(asset.symbol),
|
|
@@ -1880,7 +1980,7 @@ function AmountStep({
|
|
|
1880
1980
|
(() => {
|
|
1881
1981
|
const chainIcon = getChainIcon(asset.chainId);
|
|
1882
1982
|
if (chainIcon) {
|
|
1883
|
-
return /* @__PURE__ */
|
|
1983
|
+
return /* @__PURE__ */ jsx9(
|
|
1884
1984
|
"img",
|
|
1885
1985
|
{
|
|
1886
1986
|
src: chainIcon,
|
|
@@ -1890,7 +1990,7 @@ function AmountStep({
|
|
|
1890
1990
|
);
|
|
1891
1991
|
}
|
|
1892
1992
|
const badge = getChainBadge(asset.chainId);
|
|
1893
|
-
return /* @__PURE__ */
|
|
1993
|
+
return /* @__PURE__ */ jsx9(
|
|
1894
1994
|
"div",
|
|
1895
1995
|
{
|
|
1896
1996
|
className: "rs-flow-pill-chain-badge",
|
|
@@ -1903,17 +2003,17 @@ function AmountStep({
|
|
|
1903
2003
|
);
|
|
1904
2004
|
})()
|
|
1905
2005
|
] }),
|
|
1906
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-token-symbol", children: asset.symbol })
|
|
1907
2007
|
] })
|
|
1908
2008
|
] }),
|
|
1909
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-flow-pill-arrow", children: /* @__PURE__ */ jsx9(
|
|
1910
2010
|
"svg",
|
|
1911
2011
|
{
|
|
1912
2012
|
viewBox: "0 0 24 24",
|
|
1913
2013
|
fill: "none",
|
|
1914
2014
|
stroke: "currentColor",
|
|
1915
2015
|
strokeWidth: "2",
|
|
1916
|
-
children: /* @__PURE__ */
|
|
2016
|
+
children: /* @__PURE__ */ jsx9(
|
|
1917
2017
|
"path",
|
|
1918
2018
|
{
|
|
1919
2019
|
strokeLinecap: "round",
|
|
@@ -1923,11 +2023,11 @@ function AmountStep({
|
|
|
1923
2023
|
)
|
|
1924
2024
|
}
|
|
1925
2025
|
) }),
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-side", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
2028
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-token", children: [
|
|
2029
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
2030
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-flow-pill-token-icon", children: getTokenIcon(targetSymbol) ? /* @__PURE__ */ jsx9(
|
|
1931
2031
|
"img",
|
|
1932
2032
|
{
|
|
1933
2033
|
src: getTokenIcon(targetSymbol),
|
|
@@ -1937,7 +2037,7 @@ function AmountStep({
|
|
|
1937
2037
|
(() => {
|
|
1938
2038
|
const chainIcon = getChainIcon(targetChain);
|
|
1939
2039
|
if (chainIcon) {
|
|
1940
|
-
return /* @__PURE__ */
|
|
2040
|
+
return /* @__PURE__ */ jsx9(
|
|
1941
2041
|
"img",
|
|
1942
2042
|
{
|
|
1943
2043
|
src: chainIcon,
|
|
@@ -1947,7 +2047,7 @@ function AmountStep({
|
|
|
1947
2047
|
);
|
|
1948
2048
|
}
|
|
1949
2049
|
const badge = getChainBadge(targetChain);
|
|
1950
|
-
return /* @__PURE__ */
|
|
2050
|
+
return /* @__PURE__ */ jsx9(
|
|
1951
2051
|
"div",
|
|
1952
2052
|
{
|
|
1953
2053
|
className: "rs-flow-pill-chain-badge",
|
|
@@ -1960,14 +2060,14 @@ function AmountStep({
|
|
|
1960
2060
|
);
|
|
1961
2061
|
})()
|
|
1962
2062
|
] }),
|
|
1963
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-token-symbol", children: targetSymbol })
|
|
1964
2064
|
] })
|
|
1965
2065
|
] })
|
|
1966
2066
|
] })
|
|
1967
2067
|
}
|
|
1968
2068
|
),
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
[25, 50, 75].map((pct) => /* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-presets", children: [
|
|
2070
|
+
[25, 50, 75].map((pct) => /* @__PURE__ */ jsxs8(
|
|
1971
2071
|
"button",
|
|
1972
2072
|
{
|
|
1973
2073
|
type: "button",
|
|
@@ -1981,7 +2081,7 @@ function AmountStep({
|
|
|
1981
2081
|
},
|
|
1982
2082
|
pct
|
|
1983
2083
|
)),
|
|
1984
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx9(
|
|
1985
2085
|
"button",
|
|
1986
2086
|
{
|
|
1987
2087
|
type: "button",
|
|
@@ -1992,13 +2092,13 @@ function AmountStep({
|
|
|
1992
2092
|
}
|
|
1993
2093
|
)
|
|
1994
2094
|
] }),
|
|
1995
|
-
chainMismatch && /* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
2095
|
+
chainMismatch && /* @__PURE__ */ jsxs8("div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
2096
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-chain-switch-text", children: [
|
|
1997
2097
|
"Switch your wallet to ",
|
|
1998
2098
|
getChainName(asset.chainId),
|
|
1999
2099
|
" to continue."
|
|
2000
2100
|
] }),
|
|
2001
|
-
switchChain && /* @__PURE__ */
|
|
2101
|
+
switchChain && /* @__PURE__ */ jsx9(
|
|
2002
2102
|
Button,
|
|
2003
2103
|
{
|
|
2004
2104
|
variant: "outline",
|
|
@@ -2009,8 +2109,8 @@ function AmountStep({
|
|
|
2009
2109
|
}
|
|
2010
2110
|
)
|
|
2011
2111
|
] }),
|
|
2012
|
-
error && /* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2112
|
+
error && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-error", children: [
|
|
2113
|
+
/* @__PURE__ */ jsx9(
|
|
2014
2114
|
"svg",
|
|
2015
2115
|
{
|
|
2016
2116
|
viewBox: "0 0 24 24",
|
|
@@ -2018,7 +2118,7 @@ function AmountStep({
|
|
|
2018
2118
|
stroke: "currentColor",
|
|
2019
2119
|
strokeWidth: "2",
|
|
2020
2120
|
style: { width: 16, height: 16, flexShrink: 0 },
|
|
2021
|
-
children: /* @__PURE__ */
|
|
2121
|
+
children: /* @__PURE__ */ jsx9(
|
|
2022
2122
|
"path",
|
|
2023
2123
|
{
|
|
2024
2124
|
strokeLinecap: "round",
|
|
@@ -2028,10 +2128,10 @@ function AmountStep({
|
|
|
2028
2128
|
)
|
|
2029
2129
|
}
|
|
2030
2130
|
),
|
|
2031
|
-
/* @__PURE__ */
|
|
2131
|
+
/* @__PURE__ */ jsx9("span", { children: error })
|
|
2032
2132
|
] })
|
|
2033
2133
|
] }),
|
|
2034
|
-
/* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx9(
|
|
2035
2135
|
Button,
|
|
2036
2136
|
{
|
|
2037
2137
|
onClick: handleContinue,
|
|
@@ -2040,7 +2140,7 @@ function AmountStep({
|
|
|
2040
2140
|
children: "Continue"
|
|
2041
2141
|
}
|
|
2042
2142
|
) }),
|
|
2043
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsx9(PoweredBy, {})
|
|
2044
2144
|
] });
|
|
2045
2145
|
}
|
|
2046
2146
|
var init_AmountStep = __esm({
|
|
@@ -2057,7 +2157,7 @@ var init_AmountStep = __esm({
|
|
|
2057
2157
|
// src/components/steps/ConfirmStep.tsx
|
|
2058
2158
|
import { useMemo as useMemo3, useState as useState4 } from "react";
|
|
2059
2159
|
import { erc20Abi as erc20Abi2, formatUnits as formatUnits3, parseUnits as parseUnits2 } from "viem";
|
|
2060
|
-
import { jsx as
|
|
2160
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2061
2161
|
function ConfirmStep({
|
|
2062
2162
|
walletClient,
|
|
2063
2163
|
address,
|
|
@@ -2192,19 +2292,19 @@ function ConfirmStep({
|
|
|
2192
2292
|
setIsSwitching(false);
|
|
2193
2293
|
}
|
|
2194
2294
|
};
|
|
2195
|
-
return /* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-step", children: [
|
|
2296
|
+
/* @__PURE__ */ jsx10("div", { style: { padding: "12px 12px 10px" }, children: /* @__PURE__ */ jsx10("div", { className: "rs-step-title", children: "Review order" }) }),
|
|
2297
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
2298
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
|
|
2299
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2300
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Source" }),
|
|
2301
|
+
/* @__PURE__ */ jsxs9(
|
|
2202
2302
|
"span",
|
|
2203
2303
|
{
|
|
2204
2304
|
className: "rs-card-value",
|
|
2205
2305
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2206
2306
|
children: [
|
|
2207
|
-
getChainIcon(asset.chainId) && /* @__PURE__ */
|
|
2307
|
+
getChainIcon(asset.chainId) && /* @__PURE__ */ jsx10(
|
|
2208
2308
|
"img",
|
|
2209
2309
|
{
|
|
2210
2310
|
src: getChainIcon(asset.chainId),
|
|
@@ -2217,15 +2317,15 @@ function ConfirmStep({
|
|
|
2217
2317
|
}
|
|
2218
2318
|
)
|
|
2219
2319
|
] }),
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2320
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2321
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Destination" }),
|
|
2322
|
+
/* @__PURE__ */ jsxs9(
|
|
2223
2323
|
"span",
|
|
2224
2324
|
{
|
|
2225
2325
|
className: "rs-card-value",
|
|
2226
2326
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2227
2327
|
children: [
|
|
2228
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2328
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx10(
|
|
2229
2329
|
"img",
|
|
2230
2330
|
{
|
|
2231
2331
|
src: getChainIcon(targetChain),
|
|
@@ -2238,21 +2338,21 @@ function ConfirmStep({
|
|
|
2238
2338
|
}
|
|
2239
2339
|
)
|
|
2240
2340
|
] }),
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2342
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Estimated time" }),
|
|
2343
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-value", children: "< 1 min" })
|
|
2244
2344
|
] })
|
|
2245
2345
|
] }),
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2346
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
|
|
2347
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2348
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "You send" }),
|
|
2349
|
+
/* @__PURE__ */ jsxs9(
|
|
2250
2350
|
"span",
|
|
2251
2351
|
{
|
|
2252
2352
|
className: "rs-card-value",
|
|
2253
2353
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2254
2354
|
children: [
|
|
2255
|
-
getTokenIcon(asset.symbol) && /* @__PURE__ */
|
|
2355
|
+
getTokenIcon(asset.symbol) && /* @__PURE__ */ jsx10(
|
|
2256
2356
|
"img",
|
|
2257
2357
|
{
|
|
2258
2358
|
src: getTokenIcon(asset.symbol),
|
|
@@ -2267,15 +2367,15 @@ function ConfirmStep({
|
|
|
2267
2367
|
}
|
|
2268
2368
|
)
|
|
2269
2369
|
] }),
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
/* @__PURE__ */
|
|
2370
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2371
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "You receive" }),
|
|
2372
|
+
/* @__PURE__ */ jsxs9(
|
|
2273
2373
|
"span",
|
|
2274
2374
|
{
|
|
2275
2375
|
className: "rs-card-value",
|
|
2276
2376
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2277
2377
|
children: [
|
|
2278
|
-
getTokenIcon(targetSymbol) && /* @__PURE__ */
|
|
2378
|
+
getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx10(
|
|
2279
2379
|
"img",
|
|
2280
2380
|
{
|
|
2281
2381
|
src: getTokenIcon(targetSymbol),
|
|
@@ -2290,18 +2390,18 @@ function ConfirmStep({
|
|
|
2290
2390
|
}
|
|
2291
2391
|
)
|
|
2292
2392
|
] }),
|
|
2293
|
-
receiveAmountUsd !== null && /* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2393
|
+
receiveAmountUsd !== null && /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2394
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Value" }),
|
|
2395
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-value", children: currencyFormatter.format(receiveAmountUsd) })
|
|
2296
2396
|
] })
|
|
2297
2397
|
] }),
|
|
2298
|
-
chainMismatch && /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2398
|
+
chainMismatch && /* @__PURE__ */ jsxs9("div", { className: "rs-chain-switch", children: [
|
|
2399
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-chain-switch-text", children: [
|
|
2300
2400
|
"Switch your wallet to ",
|
|
2301
2401
|
getChainName(asset.chainId),
|
|
2302
2402
|
" to sign."
|
|
2303
2403
|
] }),
|
|
2304
|
-
switchChain && /* @__PURE__ */
|
|
2404
|
+
switchChain && /* @__PURE__ */ jsx10(
|
|
2305
2405
|
Button,
|
|
2306
2406
|
{
|
|
2307
2407
|
variant: "outline",
|
|
@@ -2312,8 +2412,8 @@ function ConfirmStep({
|
|
|
2312
2412
|
}
|
|
2313
2413
|
)
|
|
2314
2414
|
] }),
|
|
2315
|
-
error && /* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2415
|
+
error && /* @__PURE__ */ jsxs9("div", { className: "rs-alert rs-alert--error", children: [
|
|
2416
|
+
/* @__PURE__ */ jsx10(
|
|
2317
2417
|
"svg",
|
|
2318
2418
|
{
|
|
2319
2419
|
className: "rs-alert-icon",
|
|
@@ -2321,7 +2421,7 @@ function ConfirmStep({
|
|
|
2321
2421
|
fill: "none",
|
|
2322
2422
|
stroke: "currentColor",
|
|
2323
2423
|
strokeWidth: "2",
|
|
2324
|
-
children: /* @__PURE__ */
|
|
2424
|
+
children: /* @__PURE__ */ jsx10(
|
|
2325
2425
|
"path",
|
|
2326
2426
|
{
|
|
2327
2427
|
strokeLinecap: "round",
|
|
@@ -2331,7 +2431,7 @@ function ConfirmStep({
|
|
|
2331
2431
|
)
|
|
2332
2432
|
}
|
|
2333
2433
|
),
|
|
2334
|
-
/* @__PURE__ */
|
|
2434
|
+
/* @__PURE__ */ jsx10(
|
|
2335
2435
|
"span",
|
|
2336
2436
|
{
|
|
2337
2437
|
className: "rs-alert-text",
|
|
@@ -2346,7 +2446,7 @@ function ConfirmStep({
|
|
|
2346
2446
|
)
|
|
2347
2447
|
] })
|
|
2348
2448
|
] }),
|
|
2349
|
-
/* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
|
|
2350
2450
|
Button,
|
|
2351
2451
|
{
|
|
2352
2452
|
onClick: handleConfirm,
|
|
@@ -2356,7 +2456,7 @@ function ConfirmStep({
|
|
|
2356
2456
|
children: "Confirm Order"
|
|
2357
2457
|
}
|
|
2358
2458
|
) }),
|
|
2359
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ jsx10(PoweredBy, {})
|
|
2360
2460
|
] });
|
|
2361
2461
|
}
|
|
2362
2462
|
var STABLECOIN_SYMBOLS;
|
|
@@ -2406,7 +2506,7 @@ var init_webhook = __esm({
|
|
|
2406
2506
|
// src/components/steps/ProcessingStep.tsx
|
|
2407
2507
|
import { useState as useState5, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
2408
2508
|
import { formatUnits as formatUnits4 } from "viem";
|
|
2409
|
-
import { Fragment as Fragment2, jsx as
|
|
2509
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2410
2510
|
function isEventForTx(event, txHash) {
|
|
2411
2511
|
const eventTxHash = getEventTxHash(event);
|
|
2412
2512
|
if (!eventTxHash) return false;
|
|
@@ -2603,17 +2703,17 @@ function ProcessingStep({
|
|
|
2603
2703
|
}
|
|
2604
2704
|
})();
|
|
2605
2705
|
if (isComplete) {
|
|
2606
|
-
return /* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
|
|
2707
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-step-body rs-space-y-3", children: [
|
|
2708
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-success-state", children: [
|
|
2709
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-success-checkmark", children: /* @__PURE__ */ jsx11(
|
|
2610
2710
|
"svg",
|
|
2611
2711
|
{
|
|
2612
2712
|
viewBox: "0 0 24 24",
|
|
2613
2713
|
fill: "none",
|
|
2614
2714
|
stroke: "currentColor",
|
|
2615
2715
|
strokeWidth: "2.5",
|
|
2616
|
-
children: /* @__PURE__ */
|
|
2716
|
+
children: /* @__PURE__ */ jsx11(
|
|
2617
2717
|
"path",
|
|
2618
2718
|
{
|
|
2619
2719
|
strokeLinecap: "round",
|
|
@@ -2623,13 +2723,13 @@ function ProcessingStep({
|
|
|
2623
2723
|
)
|
|
2624
2724
|
}
|
|
2625
2725
|
) }),
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-success-title", children: isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` }),
|
|
2727
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-success-subtitle", children: isEarlyComplete ? "Your transfer has been confirmed and funds will arrive shortly." : `Your funds have been successfully bridged.` })
|
|
2628
2728
|
] }),
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2631
|
-
/* @__PURE__ */
|
|
2632
|
-
/* @__PURE__ */
|
|
2729
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card", children: [
|
|
2730
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2731
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Status" }),
|
|
2732
|
+
/* @__PURE__ */ jsx11(
|
|
2633
2733
|
"span",
|
|
2634
2734
|
{
|
|
2635
2735
|
className: "rs-card-value",
|
|
@@ -2638,29 +2738,29 @@ function ProcessingStep({
|
|
|
2638
2738
|
}
|
|
2639
2739
|
)
|
|
2640
2740
|
] }),
|
|
2641
|
-
/* @__PURE__ */
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2741
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2742
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Total time" }),
|
|
2743
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-value", children: formatElapsedTime(elapsedSeconds) })
|
|
2644
2744
|
] }),
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2746
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "You received" }),
|
|
2747
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-card-value", children: [
|
|
2648
2748
|
formattedReceivedAmount,
|
|
2649
2749
|
" ",
|
|
2650
2750
|
targetSymbol
|
|
2651
2751
|
] })
|
|
2652
2752
|
] })
|
|
2653
2753
|
] }),
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card", children: [
|
|
2755
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2756
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Source" }),
|
|
2757
|
+
/* @__PURE__ */ jsxs10(
|
|
2658
2758
|
"span",
|
|
2659
2759
|
{
|
|
2660
2760
|
className: "rs-card-value",
|
|
2661
2761
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2662
2762
|
children: [
|
|
2663
|
-
getChainIcon(sourceChain) && /* @__PURE__ */
|
|
2763
|
+
getChainIcon(sourceChain) && /* @__PURE__ */ jsx11(
|
|
2664
2764
|
"img",
|
|
2665
2765
|
{
|
|
2666
2766
|
src: getChainIcon(sourceChain),
|
|
@@ -2673,15 +2773,15 @@ function ProcessingStep({
|
|
|
2673
2773
|
}
|
|
2674
2774
|
)
|
|
2675
2775
|
] }),
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2777
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Destination" }),
|
|
2778
|
+
/* @__PURE__ */ jsxs10(
|
|
2679
2779
|
"span",
|
|
2680
2780
|
{
|
|
2681
2781
|
className: "rs-card-value",
|
|
2682
2782
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2683
2783
|
children: [
|
|
2684
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2784
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx11(
|
|
2685
2785
|
"img",
|
|
2686
2786
|
{
|
|
2687
2787
|
src: getChainIcon(targetChain),
|
|
@@ -2694,9 +2794,9 @@ function ProcessingStep({
|
|
|
2694
2794
|
}
|
|
2695
2795
|
)
|
|
2696
2796
|
] }),
|
|
2697
|
-
sourceExplorerUrl && /* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2797
|
+
sourceExplorerUrl && /* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2798
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Transaction" }),
|
|
2799
|
+
/* @__PURE__ */ jsxs10(
|
|
2700
2800
|
"a",
|
|
2701
2801
|
{
|
|
2702
2802
|
href: sourceExplorerUrl,
|
|
@@ -2705,7 +2805,7 @@ function ProcessingStep({
|
|
|
2705
2805
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2706
2806
|
children: [
|
|
2707
2807
|
truncateHash(txHash),
|
|
2708
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsx11(
|
|
2709
2809
|
"svg",
|
|
2710
2810
|
{
|
|
2711
2811
|
viewBox: "0 0 24 24",
|
|
@@ -2713,7 +2813,7 @@ function ProcessingStep({
|
|
|
2713
2813
|
stroke: "currentColor",
|
|
2714
2814
|
strokeWidth: "2.5",
|
|
2715
2815
|
style: { width: 12, height: 12 },
|
|
2716
|
-
children: /* @__PURE__ */
|
|
2816
|
+
children: /* @__PURE__ */ jsx11(
|
|
2717
2817
|
"path",
|
|
2718
2818
|
{
|
|
2719
2819
|
strokeLinecap: "round",
|
|
@@ -2727,9 +2827,9 @@ function ProcessingStep({
|
|
|
2727
2827
|
}
|
|
2728
2828
|
)
|
|
2729
2829
|
] }),
|
|
2730
|
-
destinationTxHash && destExplorerUrl && /* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2830
|
+
destinationTxHash && destExplorerUrl && /* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2831
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Destination tx" }),
|
|
2832
|
+
/* @__PURE__ */ jsxs10(
|
|
2733
2833
|
"a",
|
|
2734
2834
|
{
|
|
2735
2835
|
href: destExplorerUrl,
|
|
@@ -2738,7 +2838,7 @@ function ProcessingStep({
|
|
|
2738
2838
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2739
2839
|
children: [
|
|
2740
2840
|
truncateHash(destinationTxHash),
|
|
2741
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ jsx11(
|
|
2742
2842
|
"svg",
|
|
2743
2843
|
{
|
|
2744
2844
|
viewBox: "0 0 24 24",
|
|
@@ -2746,7 +2846,7 @@ function ProcessingStep({
|
|
|
2746
2846
|
stroke: "currentColor",
|
|
2747
2847
|
strokeWidth: "2.5",
|
|
2748
2848
|
style: { width: 12, height: 12 },
|
|
2749
|
-
children: /* @__PURE__ */
|
|
2849
|
+
children: /* @__PURE__ */ jsx11(
|
|
2750
2850
|
"path",
|
|
2751
2851
|
{
|
|
2752
2852
|
strokeLinecap: "round",
|
|
@@ -2762,31 +2862,31 @@ function ProcessingStep({
|
|
|
2762
2862
|
] })
|
|
2763
2863
|
] })
|
|
2764
2864
|
] }),
|
|
2765
|
-
/* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-step-footer", style: { gap: 8, display: "flex" }, children: [
|
|
2866
|
+
/* @__PURE__ */ jsx11(Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Close" }),
|
|
2867
|
+
/* @__PURE__ */ jsxs10(Button, { onClick: onNewDeposit, fullWidth: true, children: [
|
|
2768
2868
|
"New ",
|
|
2769
2869
|
flowNoun
|
|
2770
2870
|
] })
|
|
2771
2871
|
] }),
|
|
2772
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2773
2873
|
] });
|
|
2774
2874
|
}
|
|
2775
|
-
return /* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2875
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
|
|
2876
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-step-header", children: [
|
|
2877
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-step-header-row", children: [
|
|
2878
|
+
/* @__PURE__ */ jsx11(
|
|
2779
2879
|
"div",
|
|
2780
2880
|
{
|
|
2781
2881
|
className: `rs-step-icon ${isError ? "rs-step-icon--error" : "rs-step-icon--accent"}`,
|
|
2782
|
-
children: isError ? /* @__PURE__ */
|
|
2882
|
+
children: isError ? /* @__PURE__ */ jsx11(
|
|
2783
2883
|
"svg",
|
|
2784
2884
|
{
|
|
2785
2885
|
viewBox: "0 0 24 24",
|
|
2786
2886
|
fill: "none",
|
|
2787
2887
|
stroke: "currentColor",
|
|
2788
2888
|
strokeWidth: "2",
|
|
2789
|
-
children: /* @__PURE__ */
|
|
2889
|
+
children: /* @__PURE__ */ jsx11(
|
|
2790
2890
|
"path",
|
|
2791
2891
|
{
|
|
2792
2892
|
strokeLinecap: "round",
|
|
@@ -2795,10 +2895,10 @@ function ProcessingStep({
|
|
|
2795
2895
|
}
|
|
2796
2896
|
)
|
|
2797
2897
|
}
|
|
2798
|
-
) : /* @__PURE__ */
|
|
2898
|
+
) : /* @__PURE__ */ jsx11(Spinner, {})
|
|
2799
2899
|
}
|
|
2800
2900
|
),
|
|
2801
|
-
/* @__PURE__ */
|
|
2901
|
+
/* @__PURE__ */ jsx11(
|
|
2802
2902
|
"div",
|
|
2803
2903
|
{
|
|
2804
2904
|
className: `rs-step-title ${isError ? "rs-step-title--error" : ""}`,
|
|
@@ -2806,7 +2906,7 @@ function ProcessingStep({
|
|
|
2806
2906
|
}
|
|
2807
2907
|
)
|
|
2808
2908
|
] }),
|
|
2809
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsxs10(
|
|
2810
2910
|
"div",
|
|
2811
2911
|
{
|
|
2812
2912
|
className: `rs-step-description ${isError ? "rs-text-error" : "rs-text-secondary"}`,
|
|
@@ -2818,11 +2918,11 @@ function ProcessingStep({
|
|
|
2818
2918
|
}
|
|
2819
2919
|
)
|
|
2820
2920
|
] }),
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
isProcessing && /* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
/* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-step-body rs-space-y-3", children: [
|
|
2922
|
+
isProcessing && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2923
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-progress-bar", children: /* @__PURE__ */ jsx11("div", { className: "rs-progress-bar-fill rs-progress-bar-fill--indeterminate" }) }),
|
|
2924
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-alert rs-alert--info", children: [
|
|
2925
|
+
/* @__PURE__ */ jsx11(
|
|
2826
2926
|
"svg",
|
|
2827
2927
|
{
|
|
2828
2928
|
className: "rs-alert-icon",
|
|
@@ -2830,7 +2930,7 @@ function ProcessingStep({
|
|
|
2830
2930
|
fill: "none",
|
|
2831
2931
|
stroke: "currentColor",
|
|
2832
2932
|
strokeWidth: "2",
|
|
2833
|
-
children: /* @__PURE__ */
|
|
2933
|
+
children: /* @__PURE__ */ jsx11(
|
|
2834
2934
|
"path",
|
|
2835
2935
|
{
|
|
2836
2936
|
strokeLinecap: "round",
|
|
@@ -2840,13 +2940,13 @@ function ProcessingStep({
|
|
|
2840
2940
|
)
|
|
2841
2941
|
}
|
|
2842
2942
|
),
|
|
2843
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsxs10("p", { className: "rs-alert-text", children: [
|
|
2844
2944
|
"You can safely close this window. Your ",
|
|
2845
2945
|
flowNoun,
|
|
2846
2946
|
" will complete in the background."
|
|
2847
2947
|
] })
|
|
2848
2948
|
] }),
|
|
2849
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsxs10(
|
|
2850
2950
|
"div",
|
|
2851
2951
|
{
|
|
2852
2952
|
className: "rs-text-sm rs-text-tertiary",
|
|
@@ -2858,16 +2958,16 @@ function ProcessingStep({
|
|
|
2858
2958
|
}
|
|
2859
2959
|
)
|
|
2860
2960
|
] }),
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
/* @__PURE__ */
|
|
2864
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card", children: [
|
|
2962
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2963
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Source" }),
|
|
2964
|
+
/* @__PURE__ */ jsxs10(
|
|
2865
2965
|
"span",
|
|
2866
2966
|
{
|
|
2867
2967
|
className: "rs-card-value",
|
|
2868
2968
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2869
2969
|
children: [
|
|
2870
|
-
getChainIcon(sourceChain) && /* @__PURE__ */
|
|
2970
|
+
getChainIcon(sourceChain) && /* @__PURE__ */ jsx11(
|
|
2871
2971
|
"img",
|
|
2872
2972
|
{
|
|
2873
2973
|
src: getChainIcon(sourceChain),
|
|
@@ -2880,15 +2980,15 @@ function ProcessingStep({
|
|
|
2880
2980
|
}
|
|
2881
2981
|
)
|
|
2882
2982
|
] }),
|
|
2883
|
-
/* @__PURE__ */
|
|
2884
|
-
/* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2984
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Destination" }),
|
|
2985
|
+
/* @__PURE__ */ jsxs10(
|
|
2886
2986
|
"span",
|
|
2887
2987
|
{
|
|
2888
2988
|
className: "rs-card-value",
|
|
2889
2989
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2890
2990
|
children: [
|
|
2891
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2991
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx11(
|
|
2892
2992
|
"img",
|
|
2893
2993
|
{
|
|
2894
2994
|
src: getChainIcon(targetChain),
|
|
@@ -2901,9 +3001,9 @@ function ProcessingStep({
|
|
|
2901
3001
|
}
|
|
2902
3002
|
)
|
|
2903
3003
|
] }),
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
sourceExplorerUrl ? /* @__PURE__ */
|
|
3004
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
3005
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Transaction" }),
|
|
3006
|
+
sourceExplorerUrl ? /* @__PURE__ */ jsxs10(
|
|
2907
3007
|
"a",
|
|
2908
3008
|
{
|
|
2909
3009
|
href: sourceExplorerUrl,
|
|
@@ -2912,14 +3012,14 @@ function ProcessingStep({
|
|
|
2912
3012
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2913
3013
|
children: [
|
|
2914
3014
|
truncateHash(txHash),
|
|
2915
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ jsx11(
|
|
2916
3016
|
"svg",
|
|
2917
3017
|
{
|
|
2918
3018
|
viewBox: "0 0 24 24",
|
|
2919
3019
|
fill: "none",
|
|
2920
3020
|
stroke: "currentColor",
|
|
2921
3021
|
strokeWidth: "2.5",
|
|
2922
|
-
children: /* @__PURE__ */
|
|
3022
|
+
children: /* @__PURE__ */ jsx11(
|
|
2923
3023
|
"path",
|
|
2924
3024
|
{
|
|
2925
3025
|
strokeLinecap: "round",
|
|
@@ -2931,15 +3031,15 @@ function ProcessingStep({
|
|
|
2931
3031
|
)
|
|
2932
3032
|
]
|
|
2933
3033
|
}
|
|
2934
|
-
) : /* @__PURE__ */
|
|
3034
|
+
) : /* @__PURE__ */ jsx11("span", { className: "rs-card-value rs-card-value--mono", children: truncateHash(txHash) })
|
|
2935
3035
|
] })
|
|
2936
3036
|
] })
|
|
2937
3037
|
] }),
|
|
2938
|
-
isError && /* @__PURE__ */
|
|
2939
|
-
/* @__PURE__ */
|
|
2940
|
-
/* @__PURE__ */
|
|
3038
|
+
isError && /* @__PURE__ */ jsxs10("div", { className: "rs-step-footer", style: { gap: 8, display: "flex" }, children: [
|
|
3039
|
+
/* @__PURE__ */ jsx11(Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Close" }),
|
|
3040
|
+
/* @__PURE__ */ jsx11(Button, { onClick: onNewDeposit, fullWidth: true, children: "Try Again" })
|
|
2941
3041
|
] }),
|
|
2942
|
-
/* @__PURE__ */
|
|
3042
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2943
3043
|
] });
|
|
2944
3044
|
}
|
|
2945
3045
|
var INITIAL_POLL_INTERVAL, MAX_POLL_INTERVAL, BACKOFF_MULTIPLIER, PROCESS_TIMEOUT_MS;
|
|
@@ -2961,7 +3061,7 @@ var init_ProcessingStep = __esm({
|
|
|
2961
3061
|
// src/components/ui/QRCode.tsx
|
|
2962
3062
|
import { useMemo as useMemo4 } from "react";
|
|
2963
3063
|
import qrcode from "qrcode-generator";
|
|
2964
|
-
import { Fragment as Fragment3, jsx as
|
|
3064
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2965
3065
|
function QRCode({
|
|
2966
3066
|
value,
|
|
2967
3067
|
size = 200,
|
|
@@ -2995,7 +3095,7 @@ function QRCode({
|
|
|
2995
3095
|
}, [value, size, iconSrc]);
|
|
2996
3096
|
const iconSize = size * 0.22;
|
|
2997
3097
|
const iconOffset = (size - iconSize) / 2;
|
|
2998
|
-
return /* @__PURE__ */
|
|
3098
|
+
return /* @__PURE__ */ jsxs11(
|
|
2999
3099
|
"svg",
|
|
3000
3100
|
{
|
|
3001
3101
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -3005,10 +3105,10 @@ function QRCode({
|
|
|
3005
3105
|
role: "img",
|
|
3006
3106
|
"aria-label": "QR Code",
|
|
3007
3107
|
children: [
|
|
3008
|
-
/* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3010
|
-
iconSrc && /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3108
|
+
/* @__PURE__ */ jsx12("rect", { width: size, height: size, fill: "white", rx: 4 }),
|
|
3109
|
+
/* @__PURE__ */ jsx12("path", { d: svgContent.paths, fill: "black" }),
|
|
3110
|
+
iconSrc && /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3111
|
+
/* @__PURE__ */ jsx12(
|
|
3012
3112
|
"rect",
|
|
3013
3113
|
{
|
|
3014
3114
|
x: iconOffset - 4,
|
|
@@ -3019,7 +3119,7 @@ function QRCode({
|
|
|
3019
3119
|
rx: 8
|
|
3020
3120
|
}
|
|
3021
3121
|
),
|
|
3022
|
-
/* @__PURE__ */
|
|
3122
|
+
/* @__PURE__ */ jsx12(
|
|
3023
3123
|
"image",
|
|
3024
3124
|
{
|
|
3025
3125
|
href: iconSrc,
|
|
@@ -3043,7 +3143,7 @@ var init_QRCode = __esm({
|
|
|
3043
3143
|
|
|
3044
3144
|
// src/components/steps/DepositAddressStep.tsx
|
|
3045
3145
|
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback3, useRef as useRef5, useMemo as useMemo5 } from "react";
|
|
3046
|
-
import { jsx as
|
|
3146
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3047
3147
|
function isRecord2(value) {
|
|
3048
3148
|
return typeof value === "object" && value !== null;
|
|
3049
3149
|
}
|
|
@@ -3184,12 +3284,12 @@ function DepositAddressStep({
|
|
|
3184
3284
|
};
|
|
3185
3285
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
3186
3286
|
const chainIconSrc = getChainIcon(sourceChainId);
|
|
3187
|
-
return /* @__PURE__ */
|
|
3188
|
-
/* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3192
|
-
/* @__PURE__ */
|
|
3287
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-step", children: [
|
|
3288
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-step-body", children: /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address", children: [
|
|
3289
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-selectors", children: [
|
|
3290
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-dropdown", children: [
|
|
3291
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-label", children: "Supported token" }),
|
|
3292
|
+
/* @__PURE__ */ jsxs12(
|
|
3193
3293
|
"button",
|
|
3194
3294
|
{
|
|
3195
3295
|
type: "button",
|
|
@@ -3199,7 +3299,7 @@ function DepositAddressStep({
|
|
|
3199
3299
|
setChainDropdownOpen(false);
|
|
3200
3300
|
},
|
|
3201
3301
|
children: [
|
|
3202
|
-
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */
|
|
3302
|
+
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx13(
|
|
3203
3303
|
"img",
|
|
3204
3304
|
{
|
|
3205
3305
|
src: getTokenIcon(sourceTokenSymbol),
|
|
@@ -3207,8 +3307,8 @@ function DepositAddressStep({
|
|
|
3207
3307
|
className: "rs-deposit-address-dropdown-icon"
|
|
3208
3308
|
}
|
|
3209
3309
|
),
|
|
3210
|
-
/* @__PURE__ */
|
|
3211
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsx13("span", { children: sourceTokenSymbol }),
|
|
3311
|
+
/* @__PURE__ */ jsx13(
|
|
3212
3312
|
"svg",
|
|
3213
3313
|
{
|
|
3214
3314
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -3216,7 +3316,7 @@ function DepositAddressStep({
|
|
|
3216
3316
|
fill: "none",
|
|
3217
3317
|
stroke: "currentColor",
|
|
3218
3318
|
strokeWidth: "2",
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3319
|
+
children: /* @__PURE__ */ jsx13(
|
|
3220
3320
|
"path",
|
|
3221
3321
|
{
|
|
3222
3322
|
strokeLinecap: "round",
|
|
@@ -3229,7 +3329,7 @@ function DepositAddressStep({
|
|
|
3229
3329
|
]
|
|
3230
3330
|
}
|
|
3231
3331
|
),
|
|
3232
|
-
tokenDropdownOpen && /* @__PURE__ */
|
|
3332
|
+
tokenDropdownOpen && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs12(
|
|
3233
3333
|
"button",
|
|
3234
3334
|
{
|
|
3235
3335
|
type: "button",
|
|
@@ -3239,7 +3339,7 @@ function DepositAddressStep({
|
|
|
3239
3339
|
setTokenDropdownOpen(false);
|
|
3240
3340
|
},
|
|
3241
3341
|
children: [
|
|
3242
|
-
getTokenIcon(symbol) && /* @__PURE__ */
|
|
3342
|
+
getTokenIcon(symbol) && /* @__PURE__ */ jsx13(
|
|
3243
3343
|
"img",
|
|
3244
3344
|
{
|
|
3245
3345
|
src: getTokenIcon(symbol),
|
|
@@ -3247,15 +3347,15 @@ function DepositAddressStep({
|
|
|
3247
3347
|
className: "rs-deposit-address-dropdown-icon"
|
|
3248
3348
|
}
|
|
3249
3349
|
),
|
|
3250
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ jsx13("span", { children: symbol })
|
|
3251
3351
|
]
|
|
3252
3352
|
},
|
|
3253
3353
|
symbol
|
|
3254
3354
|
)) })
|
|
3255
3355
|
] }),
|
|
3256
|
-
/* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-dropdown", children: [
|
|
3357
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
3358
|
+
/* @__PURE__ */ jsxs12(
|
|
3259
3359
|
"button",
|
|
3260
3360
|
{
|
|
3261
3361
|
type: "button",
|
|
@@ -3265,7 +3365,7 @@ function DepositAddressStep({
|
|
|
3265
3365
|
setTokenDropdownOpen(false);
|
|
3266
3366
|
},
|
|
3267
3367
|
children: [
|
|
3268
|
-
getChainIcon(sourceChainId) && /* @__PURE__ */
|
|
3368
|
+
getChainIcon(sourceChainId) && /* @__PURE__ */ jsx13(
|
|
3269
3369
|
"img",
|
|
3270
3370
|
{
|
|
3271
3371
|
src: getChainIcon(sourceChainId),
|
|
@@ -3273,8 +3373,8 @@ function DepositAddressStep({
|
|
|
3273
3373
|
className: "rs-deposit-address-dropdown-icon"
|
|
3274
3374
|
}
|
|
3275
3375
|
),
|
|
3276
|
-
/* @__PURE__ */
|
|
3277
|
-
/* @__PURE__ */
|
|
3376
|
+
/* @__PURE__ */ jsx13("span", { children: getChainName(sourceChainId) }),
|
|
3377
|
+
/* @__PURE__ */ jsx13(
|
|
3278
3378
|
"svg",
|
|
3279
3379
|
{
|
|
3280
3380
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -3282,7 +3382,7 @@ function DepositAddressStep({
|
|
|
3282
3382
|
fill: "none",
|
|
3283
3383
|
stroke: "currentColor",
|
|
3284
3384
|
strokeWidth: "2",
|
|
3285
|
-
children: /* @__PURE__ */
|
|
3385
|
+
children: /* @__PURE__ */ jsx13(
|
|
3286
3386
|
"path",
|
|
3287
3387
|
{
|
|
3288
3388
|
strokeLinecap: "round",
|
|
@@ -3295,7 +3395,7 @@ function DepositAddressStep({
|
|
|
3295
3395
|
]
|
|
3296
3396
|
}
|
|
3297
3397
|
),
|
|
3298
|
-
chainDropdownOpen && /* @__PURE__ */
|
|
3398
|
+
chainDropdownOpen && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-menu", children: supportedChainIds.map((chainId) => /* @__PURE__ */ jsxs12(
|
|
3299
3399
|
"button",
|
|
3300
3400
|
{
|
|
3301
3401
|
type: "button",
|
|
@@ -3305,7 +3405,7 @@ function DepositAddressStep({
|
|
|
3305
3405
|
setChainDropdownOpen(false);
|
|
3306
3406
|
},
|
|
3307
3407
|
children: [
|
|
3308
|
-
getChainIcon(chainId) && /* @__PURE__ */
|
|
3408
|
+
getChainIcon(chainId) && /* @__PURE__ */ jsx13(
|
|
3309
3409
|
"img",
|
|
3310
3410
|
{
|
|
3311
3411
|
src: getChainIcon(chainId),
|
|
@@ -3313,25 +3413,25 @@ function DepositAddressStep({
|
|
|
3313
3413
|
className: "rs-deposit-address-dropdown-icon"
|
|
3314
3414
|
}
|
|
3315
3415
|
),
|
|
3316
|
-
/* @__PURE__ */
|
|
3416
|
+
/* @__PURE__ */ jsx13("span", { children: getChainName(chainId) })
|
|
3317
3417
|
]
|
|
3318
3418
|
},
|
|
3319
3419
|
chainId
|
|
3320
3420
|
)) })
|
|
3321
3421
|
] })
|
|
3322
3422
|
] }),
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx13(QRCode, { value: smartAccount, size: 200, iconSrc: chainIconSrc }) }),
|
|
3424
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-info", children: [
|
|
3425
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-label", children: "Your deposit address" }),
|
|
3426
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-value", children: smartAccount }),
|
|
3427
|
+
/* @__PURE__ */ jsxs12(
|
|
3328
3428
|
"button",
|
|
3329
3429
|
{
|
|
3330
3430
|
type: "button",
|
|
3331
3431
|
className: "rs-deposit-address-copy",
|
|
3332
3432
|
onClick: handleCopy,
|
|
3333
3433
|
children: [
|
|
3334
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ jsx13(
|
|
3335
3435
|
"svg",
|
|
3336
3436
|
{
|
|
3337
3437
|
viewBox: "0 0 24 24",
|
|
@@ -3339,14 +3439,14 @@ function DepositAddressStep({
|
|
|
3339
3439
|
stroke: "currentColor",
|
|
3340
3440
|
strokeWidth: "2",
|
|
3341
3441
|
style: { width: 14, height: 14 },
|
|
3342
|
-
children: copied ? /* @__PURE__ */
|
|
3442
|
+
children: copied ? /* @__PURE__ */ jsx13(
|
|
3343
3443
|
"path",
|
|
3344
3444
|
{
|
|
3345
3445
|
strokeLinecap: "round",
|
|
3346
3446
|
strokeLinejoin: "round",
|
|
3347
3447
|
d: "M5 12l5 5L20 7"
|
|
3348
3448
|
}
|
|
3349
|
-
) : /* @__PURE__ */
|
|
3449
|
+
) : /* @__PURE__ */ jsx13(
|
|
3350
3450
|
"path",
|
|
3351
3451
|
{
|
|
3352
3452
|
strokeLinecap: "round",
|
|
@@ -3361,9 +3461,9 @@ function DepositAddressStep({
|
|
|
3361
3461
|
}
|
|
3362
3462
|
)
|
|
3363
3463
|
] }),
|
|
3364
|
-
pollingError && /* @__PURE__ */
|
|
3464
|
+
pollingError && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-error", children: pollingError })
|
|
3365
3465
|
] }) }),
|
|
3366
|
-
/* @__PURE__ */
|
|
3466
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
3367
3467
|
] });
|
|
3368
3468
|
}
|
|
3369
3469
|
var POLL_INTERVAL_MS;
|
|
@@ -3379,17 +3479,39 @@ var init_DepositAddressStep = __esm({
|
|
|
3379
3479
|
}
|
|
3380
3480
|
});
|
|
3381
3481
|
|
|
3482
|
+
// src/core/public-client.ts
|
|
3483
|
+
import { createPublicClient, http } from "viem";
|
|
3484
|
+
function getPublicClient(chainId) {
|
|
3485
|
+
let client = clientCache.get(chainId);
|
|
3486
|
+
if (!client) {
|
|
3487
|
+
const chain = CHAIN_BY_ID[chainId];
|
|
3488
|
+
client = createPublicClient({
|
|
3489
|
+
chain,
|
|
3490
|
+
transport: http()
|
|
3491
|
+
});
|
|
3492
|
+
clientCache.set(chainId, client);
|
|
3493
|
+
}
|
|
3494
|
+
return client;
|
|
3495
|
+
}
|
|
3496
|
+
var clientCache;
|
|
3497
|
+
var init_public_client = __esm({
|
|
3498
|
+
"src/core/public-client.ts"() {
|
|
3499
|
+
"use strict";
|
|
3500
|
+
init_constants();
|
|
3501
|
+
clientCache = /* @__PURE__ */ new Map();
|
|
3502
|
+
}
|
|
3503
|
+
});
|
|
3504
|
+
|
|
3382
3505
|
// src/DepositFlow.tsx
|
|
3383
3506
|
import { useState as useState7, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
3384
|
-
import { jsx as
|
|
3507
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3385
3508
|
function DepositFlow({
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3509
|
+
dappWalletClient,
|
|
3510
|
+
dappPublicClient,
|
|
3511
|
+
dappAddress,
|
|
3389
3512
|
targetChain,
|
|
3390
3513
|
targetToken,
|
|
3391
3514
|
service,
|
|
3392
|
-
switchChain,
|
|
3393
3515
|
sourceChain: defaultSourceChain,
|
|
3394
3516
|
sourceToken: defaultSourceToken,
|
|
3395
3517
|
amount: defaultAmount,
|
|
@@ -3398,9 +3520,7 @@ function DepositFlow({
|
|
|
3398
3520
|
sessionChainIds,
|
|
3399
3521
|
forceRegister = false,
|
|
3400
3522
|
waitForFinalTx = true,
|
|
3401
|
-
|
|
3402
|
-
selectedConnectAddress,
|
|
3403
|
-
onSelectConnectAddress,
|
|
3523
|
+
reownWallet,
|
|
3404
3524
|
onConnect,
|
|
3405
3525
|
onRequestConnect,
|
|
3406
3526
|
connectButtonLabel,
|
|
@@ -3418,9 +3538,93 @@ function DepositFlow({
|
|
|
3418
3538
|
const [flowMode, setFlowMode] = useState7(null);
|
|
3419
3539
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState7(0);
|
|
3420
3540
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState7(false);
|
|
3421
|
-
const
|
|
3422
|
-
const hasConnectedWallet = Boolean(walletClient && publicClient && address);
|
|
3541
|
+
const [selectedConnectAddress, setSelectedConnectAddress] = useState7(null);
|
|
3423
3542
|
const targetChainObj = useMemo6(() => CHAIN_BY_ID[targetChain], [targetChain]);
|
|
3543
|
+
const dappSwitchChain = useMemo6(() => {
|
|
3544
|
+
if (!dappWalletClient?.switchChain) return void 0;
|
|
3545
|
+
return async (chainId) => {
|
|
3546
|
+
await dappWalletClient.switchChain?.({ id: chainId });
|
|
3547
|
+
};
|
|
3548
|
+
}, [dappWalletClient]);
|
|
3549
|
+
const walletOptions = useMemo6(() => {
|
|
3550
|
+
const options = [];
|
|
3551
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3552
|
+
if (dappWalletClient?.account && dappAddress) {
|
|
3553
|
+
options.push({
|
|
3554
|
+
address: dappWalletClient.account.address,
|
|
3555
|
+
label: "Connected Wallet",
|
|
3556
|
+
kind: "connected"
|
|
3557
|
+
});
|
|
3558
|
+
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
3559
|
+
}
|
|
3560
|
+
if (reownWallet?.address && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
3561
|
+
options.push({
|
|
3562
|
+
address: reownWallet.address,
|
|
3563
|
+
label: "External Wallet",
|
|
3564
|
+
kind: "external"
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3567
|
+
return options;
|
|
3568
|
+
}, [
|
|
3569
|
+
dappWalletClient,
|
|
3570
|
+
dappAddress,
|
|
3571
|
+
reownWallet?.address,
|
|
3572
|
+
reownWallet?.isConnected
|
|
3573
|
+
]);
|
|
3574
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
3575
|
+
const hasWalletOptions = walletOptions.length > 0;
|
|
3576
|
+
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
3577
|
+
const signerContext = useMemo6(() => {
|
|
3578
|
+
if (flowMode === "deposit-address") {
|
|
3579
|
+
if (!dappAddress) return null;
|
|
3580
|
+
return {
|
|
3581
|
+
ownerAddress: dappAddress,
|
|
3582
|
+
walletClient: void 0,
|
|
3583
|
+
publicClient: dappPublicClient ?? getPublicClient(targetChain),
|
|
3584
|
+
switchChain: void 0
|
|
3585
|
+
};
|
|
3586
|
+
}
|
|
3587
|
+
if (canAutoLock) {
|
|
3588
|
+
const fallbackChainId = dappWalletClient?.chain?.id ?? targetChain;
|
|
3589
|
+
return {
|
|
3590
|
+
ownerAddress: dappWalletClient.account.address,
|
|
3591
|
+
walletClient: dappWalletClient,
|
|
3592
|
+
publicClient: dappPublicClient ?? getPublicClient(fallbackChainId),
|
|
3593
|
+
switchChain: dappSwitchChain
|
|
3594
|
+
};
|
|
3595
|
+
}
|
|
3596
|
+
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
3597
|
+
if (dappWalletClient?.account && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
3598
|
+
const fallbackChainId = dappWalletClient?.chain?.id ?? targetChain;
|
|
3599
|
+
return {
|
|
3600
|
+
ownerAddress: dappWalletClient.account.address,
|
|
3601
|
+
walletClient: dappWalletClient,
|
|
3602
|
+
publicClient: dappPublicClient ?? getPublicClient(fallbackChainId),
|
|
3603
|
+
switchChain: dappSwitchChain
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
if (reownWallet?.address?.toLowerCase() === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
3607
|
+
return {
|
|
3608
|
+
ownerAddress: reownWallet.address,
|
|
3609
|
+
walletClient: reownWallet.walletClient,
|
|
3610
|
+
publicClient: reownWallet.publicClient,
|
|
3611
|
+
switchChain: reownWallet.switchChain
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3614
|
+
return null;
|
|
3615
|
+
}, [
|
|
3616
|
+
flowMode,
|
|
3617
|
+
canAutoLock,
|
|
3618
|
+
isConnectSelectionConfirmed,
|
|
3619
|
+
selectedConnectAddress,
|
|
3620
|
+
dappWalletClient,
|
|
3621
|
+
dappPublicClient,
|
|
3622
|
+
dappSwitchChain,
|
|
3623
|
+
dappAddress,
|
|
3624
|
+
reownWallet,
|
|
3625
|
+
targetChain
|
|
3626
|
+
]);
|
|
3627
|
+
const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
|
|
3424
3628
|
const lastTargetRef = useRef6(null);
|
|
3425
3629
|
useEffect7(() => {
|
|
3426
3630
|
const prev = lastTargetRef.current;
|
|
@@ -3438,10 +3642,17 @@ function DepositFlow({
|
|
|
3438
3642
|
});
|
|
3439
3643
|
}, []);
|
|
3440
3644
|
const handleBackFromSelectAsset = useCallback4(() => {
|
|
3441
|
-
if (
|
|
3645
|
+
if (hasWalletOptions || reownWallet) {
|
|
3442
3646
|
setIsConnectSelectionConfirmed(false);
|
|
3443
3647
|
}
|
|
3444
|
-
}, [
|
|
3648
|
+
}, [hasWalletOptions, reownWallet]);
|
|
3649
|
+
const handleBackFromDepositAddress = useCallback4(() => {
|
|
3650
|
+
setFlowMode(null);
|
|
3651
|
+
setStep({ type: "setup" });
|
|
3652
|
+
if (hasWalletOptions || reownWallet) {
|
|
3653
|
+
setIsConnectSelectionConfirmed(false);
|
|
3654
|
+
}
|
|
3655
|
+
}, [hasWalletOptions, reownWallet]);
|
|
3445
3656
|
const handleBackFromConfirm = useCallback4(() => {
|
|
3446
3657
|
setStep((prev) => {
|
|
3447
3658
|
if (prev.type !== "confirm") return prev;
|
|
@@ -3454,7 +3665,7 @@ function DepositFlow({
|
|
|
3454
3665
|
});
|
|
3455
3666
|
}, []);
|
|
3456
3667
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : 4;
|
|
3457
|
-
const currentBackHandler = step.type === "select-asset" &&
|
|
3668
|
+
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3458
3669
|
useEffect7(() => {
|
|
3459
3670
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
3460
3671
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
@@ -3579,33 +3790,35 @@ function DepositFlow({
|
|
|
3579
3790
|
}, []);
|
|
3580
3791
|
const selectedConnectAddressEffective = useMemo6(() => {
|
|
3581
3792
|
if (selectedConnectAddress) return selectedConnectAddress;
|
|
3582
|
-
if (
|
|
3583
|
-
return
|
|
3793
|
+
if (walletOptions.length === 1) {
|
|
3794
|
+
return walletOptions[0].address;
|
|
3584
3795
|
}
|
|
3585
3796
|
return null;
|
|
3586
|
-
}, [selectedConnectAddress,
|
|
3587
|
-
const
|
|
3588
|
-
() =>
|
|
3589
|
-
[
|
|
3797
|
+
}, [selectedConnectAddress, walletOptions]);
|
|
3798
|
+
const walletOptionsKey = useMemo6(
|
|
3799
|
+
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
3800
|
+
[walletOptions]
|
|
3590
3801
|
);
|
|
3591
|
-
const showConnectStep = !hasConnectedWallet || hasConnectWalletOptions && !isConnectSelectionConfirmed;
|
|
3592
3802
|
useEffect7(() => {
|
|
3593
3803
|
setIsConnectSelectionConfirmed(false);
|
|
3594
|
-
}, [
|
|
3804
|
+
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
3595
3805
|
if (showConnectStep) {
|
|
3596
|
-
return /* @__PURE__ */
|
|
3806
|
+
return /* @__PURE__ */ jsx14("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx14(
|
|
3597
3807
|
ConnectStep,
|
|
3598
3808
|
{
|
|
3599
|
-
walletOptions
|
|
3809
|
+
walletOptions,
|
|
3600
3810
|
selectedAddress: selectedConnectAddressEffective,
|
|
3601
|
-
onSelectAddress:
|
|
3602
|
-
onSelectTransferCrypto: () => {
|
|
3811
|
+
onSelectAddress: setSelectedConnectAddress,
|
|
3812
|
+
onSelectTransferCrypto: dappAddress ? () => {
|
|
3603
3813
|
handleSelectTransferCrypto();
|
|
3604
3814
|
setIsConnectSelectionConfirmed(true);
|
|
3605
|
-
},
|
|
3815
|
+
} : void 0,
|
|
3606
3816
|
onRequestConnect,
|
|
3607
3817
|
onConnect,
|
|
3608
3818
|
onContinue: () => {
|
|
3819
|
+
if (selectedConnectAddressEffective) {
|
|
3820
|
+
setSelectedConnectAddress(selectedConnectAddressEffective);
|
|
3821
|
+
}
|
|
3609
3822
|
handleSelectProvider();
|
|
3610
3823
|
setIsConnectSelectionConfirmed(true);
|
|
3611
3824
|
},
|
|
@@ -3613,16 +3826,13 @@ function DepositFlow({
|
|
|
3613
3826
|
}
|
|
3614
3827
|
) });
|
|
3615
3828
|
}
|
|
3616
|
-
if (!walletClient || !publicClient || !address) {
|
|
3617
|
-
return null;
|
|
3618
|
-
}
|
|
3619
3829
|
if (isDepositAddressMode) {
|
|
3620
|
-
|
|
3621
|
-
|
|
3830
|
+
if (!dappAddress || !sessionKeyAddress) return null;
|
|
3831
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-modal-body", children: [
|
|
3832
|
+
step.type === "setup" && targetChainObj && /* @__PURE__ */ jsx14(
|
|
3622
3833
|
SetupStep,
|
|
3623
3834
|
{
|
|
3624
|
-
|
|
3625
|
-
address,
|
|
3835
|
+
address: sessionKeyAddress,
|
|
3626
3836
|
targetChain,
|
|
3627
3837
|
targetChainObj,
|
|
3628
3838
|
targetToken,
|
|
@@ -3636,7 +3846,7 @@ function DepositFlow({
|
|
|
3636
3846
|
onError: handleError
|
|
3637
3847
|
}
|
|
3638
3848
|
),
|
|
3639
|
-
step.type === "deposit-address" && /* @__PURE__ */
|
|
3849
|
+
step.type === "deposit-address" && /* @__PURE__ */ jsx14(
|
|
3640
3850
|
DepositAddressStep,
|
|
3641
3851
|
{
|
|
3642
3852
|
smartAccount: step.smartAccount,
|
|
@@ -3645,7 +3855,7 @@ function DepositFlow({
|
|
|
3645
3855
|
onError: handleError
|
|
3646
3856
|
}
|
|
3647
3857
|
),
|
|
3648
|
-
step.type === "processing" && /* @__PURE__ */
|
|
3858
|
+
step.type === "processing" && /* @__PURE__ */ jsx14(
|
|
3649
3859
|
ProcessingStep,
|
|
3650
3860
|
{
|
|
3651
3861
|
smartAccount: step.smartAccount,
|
|
@@ -3666,12 +3876,23 @@ function DepositFlow({
|
|
|
3666
3876
|
)
|
|
3667
3877
|
] });
|
|
3668
3878
|
}
|
|
3669
|
-
|
|
3670
|
-
|
|
3879
|
+
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
3880
|
+
return null;
|
|
3881
|
+
}
|
|
3882
|
+
const ownerAddress = signerContext.ownerAddress;
|
|
3883
|
+
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? targetChain;
|
|
3884
|
+
const getReadClientForChain = (chainId) => {
|
|
3885
|
+
if (signerContext.publicClient.chain?.id === chainId) {
|
|
3886
|
+
return signerContext.publicClient;
|
|
3887
|
+
}
|
|
3888
|
+
return getPublicClient(chainId);
|
|
3889
|
+
};
|
|
3890
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-modal-body", children: [
|
|
3891
|
+
step.type === "setup" && targetChainObj && /* @__PURE__ */ jsx14(
|
|
3671
3892
|
SetupStep,
|
|
3672
3893
|
{
|
|
3673
|
-
walletClient,
|
|
3674
|
-
address,
|
|
3894
|
+
walletClient: signerContext.walletClient,
|
|
3895
|
+
address: ownerAddress,
|
|
3675
3896
|
targetChain,
|
|
3676
3897
|
targetChainObj,
|
|
3677
3898
|
targetToken,
|
|
@@ -3685,11 +3906,11 @@ function DepositFlow({
|
|
|
3685
3906
|
onError: handleError
|
|
3686
3907
|
}
|
|
3687
3908
|
),
|
|
3688
|
-
step.type === "select-asset" && /* @__PURE__ */
|
|
3909
|
+
step.type === "select-asset" && /* @__PURE__ */ jsx14(
|
|
3689
3910
|
AssetSelectStep,
|
|
3690
3911
|
{
|
|
3691
|
-
address,
|
|
3692
|
-
publicClient,
|
|
3912
|
+
address: ownerAddress,
|
|
3913
|
+
publicClient: getReadClientForChain(ownerChainId),
|
|
3693
3914
|
defaultSourceChain,
|
|
3694
3915
|
defaultSourceToken,
|
|
3695
3916
|
service,
|
|
@@ -3697,39 +3918,39 @@ function DepositFlow({
|
|
|
3697
3918
|
onTotalBalanceComputed: handleTotalBalanceComputed
|
|
3698
3919
|
}
|
|
3699
3920
|
),
|
|
3700
|
-
step.type === "amount" && /* @__PURE__ */
|
|
3921
|
+
step.type === "amount" && /* @__PURE__ */ jsx14(
|
|
3701
3922
|
AmountStep,
|
|
3702
3923
|
{
|
|
3703
|
-
walletClient,
|
|
3704
|
-
publicClient,
|
|
3705
|
-
address,
|
|
3924
|
+
walletClient: signerContext.walletClient,
|
|
3925
|
+
publicClient: getReadClientForChain(step.asset.chainId),
|
|
3926
|
+
address: ownerAddress,
|
|
3706
3927
|
asset: step.asset,
|
|
3707
3928
|
defaultAmount: step.amount ?? defaultAmount,
|
|
3708
|
-
switchChain,
|
|
3929
|
+
switchChain: signerContext.switchChain,
|
|
3709
3930
|
targetChain,
|
|
3710
3931
|
targetToken,
|
|
3711
3932
|
uiConfig,
|
|
3712
3933
|
onContinue: handleAmountContinue
|
|
3713
3934
|
}
|
|
3714
3935
|
),
|
|
3715
|
-
step.type === "confirm" && /* @__PURE__ */
|
|
3936
|
+
step.type === "confirm" && /* @__PURE__ */ jsx14(
|
|
3716
3937
|
ConfirmStep,
|
|
3717
3938
|
{
|
|
3718
|
-
walletClient,
|
|
3719
|
-
address,
|
|
3939
|
+
walletClient: signerContext.walletClient,
|
|
3940
|
+
address: ownerAddress,
|
|
3720
3941
|
smartAccount: step.smartAccount,
|
|
3721
3942
|
asset: step.asset,
|
|
3722
3943
|
amount: step.amount,
|
|
3723
3944
|
balance: step.balance,
|
|
3724
3945
|
targetChain,
|
|
3725
3946
|
targetToken,
|
|
3726
|
-
switchChain,
|
|
3947
|
+
switchChain: signerContext.switchChain,
|
|
3727
3948
|
onConfirm: handleDepositSubmitted,
|
|
3728
3949
|
onDepositSubmitted: handleDepositSubmittedCallback,
|
|
3729
3950
|
onError: handleError
|
|
3730
3951
|
}
|
|
3731
3952
|
),
|
|
3732
|
-
step.type === "processing" && /* @__PURE__ */
|
|
3953
|
+
step.type === "processing" && /* @__PURE__ */ jsx14(
|
|
3733
3954
|
ProcessingStep,
|
|
3734
3955
|
{
|
|
3735
3956
|
smartAccount: step.smartAccount,
|
|
@@ -3761,6 +3982,7 @@ var init_DepositFlow = __esm({
|
|
|
3761
3982
|
init_ProcessingStep();
|
|
3762
3983
|
init_DepositAddressStep();
|
|
3763
3984
|
init_constants();
|
|
3985
|
+
init_public_client();
|
|
3764
3986
|
}
|
|
3765
3987
|
});
|
|
3766
3988
|
|
|
@@ -3811,15 +4033,11 @@ var init_theme = __esm({
|
|
|
3811
4033
|
});
|
|
3812
4034
|
|
|
3813
4035
|
// src/core/reown.tsx
|
|
3814
|
-
import { useState as useState8
|
|
4036
|
+
import { useState as useState8 } from "react";
|
|
3815
4037
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3816
4038
|
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
3817
4039
|
import { WagmiProvider } from "wagmi";
|
|
3818
|
-
import {
|
|
3819
|
-
createAppKit,
|
|
3820
|
-
useAppKit,
|
|
3821
|
-
useAppKitAccount
|
|
3822
|
-
} from "@reown/appkit/react";
|
|
4040
|
+
import { createAppKit, useAppKit, useAppKitAccount } from "@reown/appkit/react";
|
|
3823
4041
|
import {
|
|
3824
4042
|
mainnet as mainnet2,
|
|
3825
4043
|
base as base2,
|
|
@@ -3828,12 +4046,8 @@ import {
|
|
|
3828
4046
|
polygon as polygon2,
|
|
3829
4047
|
bsc as bsc2
|
|
3830
4048
|
} from "@reown/appkit/networks";
|
|
3831
|
-
import {
|
|
3832
|
-
|
|
3833
|
-
usePublicClient,
|
|
3834
|
-
useSwitchChain
|
|
3835
|
-
} from "wagmi";
|
|
3836
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
4049
|
+
import { useWalletClient, usePublicClient, useSwitchChain } from "wagmi";
|
|
4050
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3837
4051
|
function mapTheme(theme) {
|
|
3838
4052
|
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
3839
4053
|
const themeVariables = {};
|
|
@@ -3872,7 +4086,7 @@ function ReownWalletProvider({
|
|
|
3872
4086
|
const [queryClient] = useState8(() => new QueryClient());
|
|
3873
4087
|
const adapter = getOrCreateAdapter(projectId, theme);
|
|
3874
4088
|
const config = adapter.wagmiConfig;
|
|
3875
|
-
return /* @__PURE__ */
|
|
4089
|
+
return /* @__PURE__ */ jsx15(WagmiProvider, { config, children: /* @__PURE__ */ jsx15(QueryClientProvider, { client: queryClient, children }) });
|
|
3876
4090
|
}
|
|
3877
4091
|
function useReownWallet() {
|
|
3878
4092
|
const { open } = useAppKit();
|
|
@@ -3893,72 +4107,6 @@ function useReownWallet() {
|
|
|
3893
4107
|
}
|
|
3894
4108
|
};
|
|
3895
4109
|
}
|
|
3896
|
-
function useResolvedWallet(host, reown) {
|
|
3897
|
-
const [selectedAddress, setSelectedAddress] = useState8(null);
|
|
3898
|
-
const walletOptions = useMemo7(() => {
|
|
3899
|
-
const options = [];
|
|
3900
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3901
|
-
if (host.address) {
|
|
3902
|
-
options.push({
|
|
3903
|
-
address: host.address,
|
|
3904
|
-
label: "Connected Wallet",
|
|
3905
|
-
kind: "connected"
|
|
3906
|
-
});
|
|
3907
|
-
seen.add(host.address.toLowerCase());
|
|
3908
|
-
}
|
|
3909
|
-
if (reown.address && !seen.has(reown.address.toLowerCase())) {
|
|
3910
|
-
options.push({
|
|
3911
|
-
address: reown.address,
|
|
3912
|
-
label: "External Wallet",
|
|
3913
|
-
kind: "external"
|
|
3914
|
-
});
|
|
3915
|
-
}
|
|
3916
|
-
return options;
|
|
3917
|
-
}, [host.address, reown.address]);
|
|
3918
|
-
const effectiveAddress = useMemo7(() => {
|
|
3919
|
-
if (walletOptions.length === 0) return null;
|
|
3920
|
-
if (walletOptions.length === 1) return walletOptions[0].address;
|
|
3921
|
-
if (selectedAddress) {
|
|
3922
|
-
const valid = walletOptions.some(
|
|
3923
|
-
(opt) => opt.address.toLowerCase() === selectedAddress.toLowerCase()
|
|
3924
|
-
);
|
|
3925
|
-
if (valid) return selectedAddress;
|
|
3926
|
-
}
|
|
3927
|
-
return null;
|
|
3928
|
-
}, [walletOptions, selectedAddress]);
|
|
3929
|
-
let walletClient;
|
|
3930
|
-
let publicClient;
|
|
3931
|
-
if (effectiveAddress) {
|
|
3932
|
-
const key = effectiveAddress.toLowerCase();
|
|
3933
|
-
if (host.address?.toLowerCase() === key && host.walletClient && host.publicClient) {
|
|
3934
|
-
walletClient = host.walletClient;
|
|
3935
|
-
publicClient = host.publicClient;
|
|
3936
|
-
} else if (reown.address?.toLowerCase() === key && reown.walletClient && reown.publicClient) {
|
|
3937
|
-
walletClient = reown.walletClient;
|
|
3938
|
-
publicClient = reown.publicClient;
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
const handleSwitchChain = useCallback5(
|
|
3942
|
-
async (chainId) => {
|
|
3943
|
-
if (host.switchChain && effectiveAddress?.toLowerCase() === host.address?.toLowerCase()) {
|
|
3944
|
-
await host.switchChain(chainId);
|
|
3945
|
-
} else {
|
|
3946
|
-
await reown.switchChain(chainId);
|
|
3947
|
-
}
|
|
3948
|
-
},
|
|
3949
|
-
[host.switchChain, host.address, reown.switchChain, effectiveAddress]
|
|
3950
|
-
);
|
|
3951
|
-
return {
|
|
3952
|
-
walletClient,
|
|
3953
|
-
publicClient,
|
|
3954
|
-
address: effectiveAddress ?? void 0,
|
|
3955
|
-
walletOptions,
|
|
3956
|
-
selectedAddress: effectiveAddress,
|
|
3957
|
-
onSelectAddress: setSelectedAddress,
|
|
3958
|
-
openConnect: reown.openConnect,
|
|
3959
|
-
switchChain: handleSwitchChain
|
|
3960
|
-
};
|
|
3961
|
-
}
|
|
3962
4110
|
var NETWORKS, cachedAdapter, cachedProjectId;
|
|
3963
4111
|
var init_reown = __esm({
|
|
3964
4112
|
"src/core/reown.tsx"() {
|
|
@@ -3981,40 +4129,24 @@ var DepositModalReown_exports = {};
|
|
|
3981
4129
|
__export(DepositModalReown_exports, {
|
|
3982
4130
|
DepositModalReown: () => DepositModalReown
|
|
3983
4131
|
});
|
|
3984
|
-
import { useCallback as
|
|
3985
|
-
import { jsx as
|
|
4132
|
+
import { useCallback as useCallback5 } from "react";
|
|
4133
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3986
4134
|
function DepositModalWithReown(props) {
|
|
3987
4135
|
const reown = useReownWallet();
|
|
3988
|
-
const
|
|
3989
|
-
{
|
|
3990
|
-
walletClient: props.walletClient,
|
|
3991
|
-
publicClient: props.publicClient,
|
|
3992
|
-
address: props.address,
|
|
3993
|
-
switchChain: props.switchChain
|
|
3994
|
-
},
|
|
3995
|
-
reown
|
|
3996
|
-
);
|
|
3997
|
-
const handleConnect = useCallback6(() => {
|
|
4136
|
+
const handleConnect = useCallback5(() => {
|
|
3998
4137
|
reown.openConnect();
|
|
3999
4138
|
}, [reown.openConnect]);
|
|
4000
|
-
return /* @__PURE__ */
|
|
4139
|
+
return /* @__PURE__ */ jsx16(
|
|
4001
4140
|
DepositModalInner,
|
|
4002
4141
|
{
|
|
4003
4142
|
...props,
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
address: resolved.address,
|
|
4007
|
-
switchChain: resolved.switchChain,
|
|
4008
|
-
connectWalletOptions: resolved.walletOptions,
|
|
4009
|
-
selectedConnectAddress: resolved.selectedAddress,
|
|
4010
|
-
onSelectConnectAddress: resolved.onSelectAddress,
|
|
4011
|
-
onConnect: handleConnect,
|
|
4012
|
-
onRequestConnect: props.onRequestConnect
|
|
4143
|
+
reownWallet: reown,
|
|
4144
|
+
onConnect: handleConnect
|
|
4013
4145
|
}
|
|
4014
4146
|
);
|
|
4015
4147
|
}
|
|
4016
4148
|
function DepositModalReown(props) {
|
|
4017
|
-
return /* @__PURE__ */
|
|
4149
|
+
return /* @__PURE__ */ jsx16(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx16(DepositModalWithReown, { ...props }) });
|
|
4018
4150
|
}
|
|
4019
4151
|
var init_DepositModalReown = __esm({
|
|
4020
4152
|
"src/DepositModalReown.tsx"() {
|
|
@@ -4026,32 +4158,31 @@ var init_DepositModalReown = __esm({
|
|
|
4026
4158
|
|
|
4027
4159
|
// src/DepositModal.tsx
|
|
4028
4160
|
import {
|
|
4029
|
-
useMemo as
|
|
4161
|
+
useMemo as useMemo7,
|
|
4030
4162
|
useEffect as useEffect8,
|
|
4031
4163
|
useRef as useRef7,
|
|
4032
4164
|
useState as useState9,
|
|
4033
|
-
useCallback as
|
|
4165
|
+
useCallback as useCallback6,
|
|
4034
4166
|
lazy,
|
|
4035
4167
|
Suspense
|
|
4036
4168
|
} from "react";
|
|
4037
|
-
import { jsx as
|
|
4169
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4038
4170
|
function DepositModal(props) {
|
|
4039
4171
|
const needsReown = !!props.reownAppId;
|
|
4040
4172
|
if (needsReown) {
|
|
4041
|
-
return /* @__PURE__ */
|
|
4173
|
+
return /* @__PURE__ */ jsx17(Suspense, { fallback: null, children: /* @__PURE__ */ jsx17(ReownDepositInner, { ...props }) });
|
|
4042
4174
|
}
|
|
4043
|
-
return /* @__PURE__ */
|
|
4175
|
+
return /* @__PURE__ */ jsx17(DepositModalInner, { ...props });
|
|
4044
4176
|
}
|
|
4045
4177
|
function DepositModalInner({
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4178
|
+
dappWalletClient,
|
|
4179
|
+
dappPublicClient,
|
|
4180
|
+
dappAddress,
|
|
4049
4181
|
targetChain: targetChainProp,
|
|
4050
4182
|
targetToken,
|
|
4051
4183
|
isOpen,
|
|
4052
4184
|
onClose,
|
|
4053
4185
|
inline,
|
|
4054
|
-
switchChain,
|
|
4055
4186
|
sourceChain: sourceChainProp,
|
|
4056
4187
|
sourceToken,
|
|
4057
4188
|
defaultAmount,
|
|
@@ -4061,9 +4192,7 @@ function DepositModalInner({
|
|
|
4061
4192
|
sessionChainIds,
|
|
4062
4193
|
forceRegister = false,
|
|
4063
4194
|
waitForFinalTx = true,
|
|
4064
|
-
|
|
4065
|
-
selectedConnectAddress,
|
|
4066
|
-
onSelectConnectAddress,
|
|
4195
|
+
reownWallet,
|
|
4067
4196
|
onConnect,
|
|
4068
4197
|
onRequestConnect,
|
|
4069
4198
|
connectButtonLabel,
|
|
@@ -4084,7 +4213,7 @@ function DepositModalInner({
|
|
|
4084
4213
|
const backHandlerRef = useRef7(void 0);
|
|
4085
4214
|
const targetChain = getChainId(targetChainProp);
|
|
4086
4215
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
4087
|
-
const service =
|
|
4216
|
+
const service = useMemo7(() => createDepositService(backendUrl), [backendUrl]);
|
|
4088
4217
|
useEffect8(() => {
|
|
4089
4218
|
if (isOpen && modalRef.current) {
|
|
4090
4219
|
applyTheme(modalRef.current, theme);
|
|
@@ -4102,17 +4231,17 @@ function DepositModalInner({
|
|
|
4102
4231
|
setCurrentStepIndex(0);
|
|
4103
4232
|
}
|
|
4104
4233
|
}, [isOpen]);
|
|
4105
|
-
const handleStepChange =
|
|
4234
|
+
const handleStepChange = useCallback6(
|
|
4106
4235
|
(stepIndex, onBack) => {
|
|
4107
4236
|
setCurrentStepIndex(stepIndex);
|
|
4108
4237
|
backHandlerRef.current = onBack;
|
|
4109
4238
|
},
|
|
4110
4239
|
[]
|
|
4111
4240
|
);
|
|
4112
|
-
const handleTotalBalanceChange =
|
|
4241
|
+
const handleTotalBalanceChange = useCallback6((balance) => {
|
|
4113
4242
|
setTotalBalanceUsd(balance);
|
|
4114
4243
|
}, []);
|
|
4115
|
-
const handleBack =
|
|
4244
|
+
const handleBack = useCallback6(() => {
|
|
4116
4245
|
backHandlerRef.current?.();
|
|
4117
4246
|
}, []);
|
|
4118
4247
|
const showLogo = uiConfig?.showLogo ?? false;
|
|
@@ -4122,30 +4251,30 @@ function DepositModalInner({
|
|
|
4122
4251
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
4123
4252
|
const title = branding?.title ?? "Deposit";
|
|
4124
4253
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4125
|
-
return /* @__PURE__ */
|
|
4254
|
+
return /* @__PURE__ */ jsx17(
|
|
4126
4255
|
Modal,
|
|
4127
4256
|
{
|
|
4128
4257
|
isOpen,
|
|
4129
4258
|
onClose,
|
|
4130
4259
|
className,
|
|
4131
4260
|
inline,
|
|
4132
|
-
children: /* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4261
|
+
children: /* @__PURE__ */ jsxs14("div", { ref: modalRef, className: "rs-modal", children: [
|
|
4262
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header--redesigned", children: [
|
|
4263
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx17(
|
|
4135
4264
|
"button",
|
|
4136
4265
|
{
|
|
4137
4266
|
type: "button",
|
|
4138
4267
|
className: "rs-modal-header-back",
|
|
4139
4268
|
"aria-label": "Go back",
|
|
4140
4269
|
onClick: handleBack,
|
|
4141
|
-
children: /* @__PURE__ */
|
|
4270
|
+
children: /* @__PURE__ */ jsx17(
|
|
4142
4271
|
"svg",
|
|
4143
4272
|
{
|
|
4144
4273
|
viewBox: "0 0 24 24",
|
|
4145
4274
|
fill: "none",
|
|
4146
4275
|
stroke: "currentColor",
|
|
4147
4276
|
strokeWidth: "2",
|
|
4148
|
-
children: /* @__PURE__ */
|
|
4277
|
+
children: /* @__PURE__ */ jsx17(
|
|
4149
4278
|
"path",
|
|
4150
4279
|
{
|
|
4151
4280
|
strokeLinecap: "round",
|
|
@@ -4157,9 +4286,9 @@ function DepositModalInner({
|
|
|
4157
4286
|
)
|
|
4158
4287
|
}
|
|
4159
4288
|
) }),
|
|
4160
|
-
/* @__PURE__ */
|
|
4161
|
-
/* @__PURE__ */
|
|
4162
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
4289
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-nav-center", children: [
|
|
4290
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-title-row", children: [
|
|
4291
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx17(
|
|
4163
4292
|
"img",
|
|
4164
4293
|
{
|
|
4165
4294
|
src: logoUrl,
|
|
@@ -4170,8 +4299,8 @@ function DepositModalInner({
|
|
|
4170
4299
|
}
|
|
4171
4300
|
}
|
|
4172
4301
|
),
|
|
4173
|
-
/* @__PURE__ */
|
|
4174
|
-
showStepper && /* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx17("span", { className: "rs-modal-header-title", children: title }),
|
|
4303
|
+
showStepper && /* @__PURE__ */ jsx17("div", { className: "rs-modal-progress", style: { marginLeft: 8 }, children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx17(
|
|
4175
4304
|
"div",
|
|
4176
4305
|
{
|
|
4177
4306
|
className: `rs-modal-progress-dot ${i <= currentStepIndex ? "rs-modal-progress-dot--active" : "rs-modal-progress-dot--inactive"}`
|
|
@@ -4179,29 +4308,29 @@ function DepositModalInner({
|
|
|
4179
4308
|
i
|
|
4180
4309
|
)) })
|
|
4181
4310
|
] }),
|
|
4182
|
-
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */
|
|
4183
|
-
/* @__PURE__ */
|
|
4311
|
+
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-balance", children: [
|
|
4312
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
4184
4313
|
balanceTitle,
|
|
4185
4314
|
":"
|
|
4186
4315
|
] }),
|
|
4187
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx17("span", { className: "rs-modal-header-balance-value", children: currencyFormatter.format(totalBalanceUsd) })
|
|
4188
4317
|
] })
|
|
4189
4318
|
] }),
|
|
4190
|
-
/* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ jsx17(
|
|
4191
4320
|
"button",
|
|
4192
4321
|
{
|
|
4193
4322
|
type: "button",
|
|
4194
4323
|
onClick: onClose,
|
|
4195
4324
|
className: "rs-modal-close",
|
|
4196
4325
|
"aria-label": "Close",
|
|
4197
|
-
children: /* @__PURE__ */
|
|
4326
|
+
children: /* @__PURE__ */ jsx17(
|
|
4198
4327
|
"svg",
|
|
4199
4328
|
{
|
|
4200
4329
|
viewBox: "0 0 24 24",
|
|
4201
4330
|
fill: "none",
|
|
4202
4331
|
stroke: "currentColor",
|
|
4203
4332
|
strokeWidth: "2",
|
|
4204
|
-
children: /* @__PURE__ */
|
|
4333
|
+
children: /* @__PURE__ */ jsx17(
|
|
4205
4334
|
"path",
|
|
4206
4335
|
{
|
|
4207
4336
|
strokeLinecap: "round",
|
|
@@ -4214,16 +4343,15 @@ function DepositModalInner({
|
|
|
4214
4343
|
}
|
|
4215
4344
|
) })
|
|
4216
4345
|
] }),
|
|
4217
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx17(
|
|
4218
4347
|
DepositFlow,
|
|
4219
4348
|
{
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4349
|
+
dappWalletClient,
|
|
4350
|
+
dappPublicClient,
|
|
4351
|
+
dappAddress,
|
|
4223
4352
|
targetChain,
|
|
4224
4353
|
targetToken,
|
|
4225
4354
|
service,
|
|
4226
|
-
switchChain,
|
|
4227
4355
|
sourceChain,
|
|
4228
4356
|
sourceToken,
|
|
4229
4357
|
amount: defaultAmount,
|
|
@@ -4232,9 +4360,7 @@ function DepositModalInner({
|
|
|
4232
4360
|
sessionChainIds,
|
|
4233
4361
|
forceRegister,
|
|
4234
4362
|
waitForFinalTx,
|
|
4235
|
-
|
|
4236
|
-
selectedConnectAddress,
|
|
4237
|
-
onSelectConnectAddress,
|
|
4363
|
+
reownWallet,
|
|
4238
4364
|
onConnect,
|
|
4239
4365
|
onRequestConnect,
|
|
4240
4366
|
connectButtonLabel,
|
|
@@ -4271,9 +4397,9 @@ var init_DepositModal = __esm({
|
|
|
4271
4397
|
});
|
|
4272
4398
|
|
|
4273
4399
|
// src/components/steps/WithdrawFormStep.tsx
|
|
4274
|
-
import { useCallback as
|
|
4400
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo8, useRef as useRef8, useState as useState10 } from "react";
|
|
4275
4401
|
import { erc20Abi as erc20Abi3, formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
4276
|
-
import { jsx as
|
|
4402
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4277
4403
|
function useClickOutside(ref, onClose) {
|
|
4278
4404
|
useEffect9(() => {
|
|
4279
4405
|
function handleClick(e) {
|
|
@@ -4379,7 +4505,7 @@ function WithdrawFormStep({
|
|
|
4379
4505
|
unwatch();
|
|
4380
4506
|
};
|
|
4381
4507
|
}, [safeAddress, publicClient, publicClientChainId, asset]);
|
|
4382
|
-
const formattedBalance =
|
|
4508
|
+
const formattedBalance = useMemo8(() => {
|
|
4383
4509
|
if (balance === null) return "...";
|
|
4384
4510
|
try {
|
|
4385
4511
|
const raw = formatUnits5(balance, asset.decimals);
|
|
@@ -4405,7 +4531,7 @@ function WithdrawFormStep({
|
|
|
4405
4531
|
return;
|
|
4406
4532
|
}
|
|
4407
4533
|
}, [balance, asset.decimals, asset.symbol, onBalanceUsdChange]);
|
|
4408
|
-
const amountUsd =
|
|
4534
|
+
const amountUsd = useMemo8(() => {
|
|
4409
4535
|
if (!amount) return null;
|
|
4410
4536
|
const parsed = Number(amount);
|
|
4411
4537
|
if (!Number.isFinite(parsed) || parsed <= 0) return null;
|
|
@@ -4415,18 +4541,18 @@ function WithdrawFormStep({
|
|
|
4415
4541
|
}
|
|
4416
4542
|
return null;
|
|
4417
4543
|
}, [amount, asset.symbol]);
|
|
4418
|
-
const handleMaxClick =
|
|
4544
|
+
const handleMaxClick = useCallback7(() => {
|
|
4419
4545
|
if (balance === null) return;
|
|
4420
4546
|
const maxAmount = formatUnits5(balance, asset.decimals);
|
|
4421
4547
|
setAmount(maxAmount);
|
|
4422
4548
|
setError(null);
|
|
4423
4549
|
}, [balance, asset.decimals]);
|
|
4424
|
-
const handleUseConnected =
|
|
4550
|
+
const handleUseConnected = useCallback7(() => {
|
|
4425
4551
|
if (!address) return;
|
|
4426
4552
|
setRecipient(address);
|
|
4427
4553
|
setError(null);
|
|
4428
4554
|
}, [address]);
|
|
4429
|
-
const handleWithdraw =
|
|
4555
|
+
const handleWithdraw = useCallback7(async () => {
|
|
4430
4556
|
if (!recipient || !/^0x[a-fA-F0-9]{40}$/.test(recipient)) {
|
|
4431
4557
|
setError("Enter a valid recipient address");
|
|
4432
4558
|
return;
|
|
@@ -4471,12 +4597,12 @@ function WithdrawFormStep({
|
|
|
4471
4597
|
setIsSwitching(false);
|
|
4472
4598
|
}
|
|
4473
4599
|
};
|
|
4474
|
-
return /* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4478
|
-
/* @__PURE__ */
|
|
4479
|
-
/* @__PURE__ */
|
|
4600
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
4601
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
4602
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-section", children: [
|
|
4603
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Recipient" }),
|
|
4604
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-input-row", children: [
|
|
4605
|
+
/* @__PURE__ */ jsx18(
|
|
4480
4606
|
"input",
|
|
4481
4607
|
{
|
|
4482
4608
|
type: "text",
|
|
@@ -4489,7 +4615,7 @@ function WithdrawFormStep({
|
|
|
4489
4615
|
}
|
|
4490
4616
|
}
|
|
4491
4617
|
),
|
|
4492
|
-
address && /* @__PURE__ */
|
|
4618
|
+
address && /* @__PURE__ */ jsxs15(
|
|
4493
4619
|
"button",
|
|
4494
4620
|
{
|
|
4495
4621
|
type: "button",
|
|
@@ -4497,7 +4623,7 @@ function WithdrawFormStep({
|
|
|
4497
4623
|
onClick: handleUseConnected,
|
|
4498
4624
|
title: isRecipientConnected ? "Using connected wallet" : "Use connected wallet",
|
|
4499
4625
|
children: [
|
|
4500
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsx18(
|
|
4501
4627
|
"svg",
|
|
4502
4628
|
{
|
|
4503
4629
|
viewBox: "0 0 24 24",
|
|
@@ -4505,7 +4631,7 @@ function WithdrawFormStep({
|
|
|
4505
4631
|
stroke: "currentColor",
|
|
4506
4632
|
strokeWidth: "2",
|
|
4507
4633
|
className: "rs-withdraw-use-connected-icon",
|
|
4508
|
-
children: /* @__PURE__ */
|
|
4634
|
+
children: /* @__PURE__ */ jsx18(
|
|
4509
4635
|
"path",
|
|
4510
4636
|
{
|
|
4511
4637
|
strokeLinecap: "round",
|
|
@@ -4521,10 +4647,10 @@ function WithdrawFormStep({
|
|
|
4521
4647
|
)
|
|
4522
4648
|
] })
|
|
4523
4649
|
] }),
|
|
4524
|
-
/* @__PURE__ */
|
|
4525
|
-
/* @__PURE__ */
|
|
4526
|
-
/* @__PURE__ */
|
|
4527
|
-
/* @__PURE__ */
|
|
4650
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-section", children: [
|
|
4651
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Amount" }),
|
|
4652
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-input-row", children: [
|
|
4653
|
+
/* @__PURE__ */ jsx18(
|
|
4528
4654
|
"input",
|
|
4529
4655
|
{
|
|
4530
4656
|
type: "text",
|
|
@@ -4541,9 +4667,9 @@ function WithdrawFormStep({
|
|
|
4541
4667
|
}
|
|
4542
4668
|
}
|
|
4543
4669
|
),
|
|
4544
|
-
/* @__PURE__ */
|
|
4545
|
-
/* @__PURE__ */
|
|
4546
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-amount-right", children: [
|
|
4671
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-withdraw-token-label", children: asset.symbol }),
|
|
4672
|
+
/* @__PURE__ */ jsx18(
|
|
4547
4673
|
"button",
|
|
4548
4674
|
{
|
|
4549
4675
|
type: "button",
|
|
@@ -4555,25 +4681,25 @@ function WithdrawFormStep({
|
|
|
4555
4681
|
)
|
|
4556
4682
|
] })
|
|
4557
4683
|
] }),
|
|
4558
|
-
/* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
4560
|
-
/* @__PURE__ */
|
|
4684
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-amount-info", children: [
|
|
4685
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-withdraw-usd", children: amountUsd !== null ? currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
4686
|
+
/* @__PURE__ */ jsxs15("span", { className: "rs-withdraw-balance", children: [
|
|
4561
4687
|
formattedBalance,
|
|
4562
4688
|
" ",
|
|
4563
4689
|
asset.symbol
|
|
4564
4690
|
] })
|
|
4565
4691
|
] })
|
|
4566
4692
|
] }),
|
|
4567
|
-
/* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
/* @__PURE__ */
|
|
4693
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-row", children: [
|
|
4694
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-col", children: [
|
|
4695
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Receive" }),
|
|
4696
|
+
/* @__PURE__ */ jsxs15(
|
|
4571
4697
|
"div",
|
|
4572
4698
|
{
|
|
4573
4699
|
className: "rs-withdraw-dropdown-container",
|
|
4574
4700
|
ref: tokenDropdownRef,
|
|
4575
4701
|
children: [
|
|
4576
|
-
/* @__PURE__ */
|
|
4702
|
+
/* @__PURE__ */ jsxs15(
|
|
4577
4703
|
"button",
|
|
4578
4704
|
{
|
|
4579
4705
|
type: "button",
|
|
@@ -4583,8 +4709,8 @@ function WithdrawFormStep({
|
|
|
4583
4709
|
setShowChainDropdown(false);
|
|
4584
4710
|
},
|
|
4585
4711
|
children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
getTokenIcon(targetSymbol) && /* @__PURE__ */
|
|
4712
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-dropdown-value", children: [
|
|
4713
|
+
getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx18(
|
|
4588
4714
|
"img",
|
|
4589
4715
|
{
|
|
4590
4716
|
src: getTokenIcon(targetSymbol),
|
|
@@ -4592,9 +4718,9 @@ function WithdrawFormStep({
|
|
|
4592
4718
|
className: "rs-withdraw-dropdown-icon"
|
|
4593
4719
|
}
|
|
4594
4720
|
),
|
|
4595
|
-
/* @__PURE__ */
|
|
4721
|
+
/* @__PURE__ */ jsx18("span", { children: targetSymbol })
|
|
4596
4722
|
] }),
|
|
4597
|
-
/* @__PURE__ */
|
|
4723
|
+
/* @__PURE__ */ jsx18(
|
|
4598
4724
|
"svg",
|
|
4599
4725
|
{
|
|
4600
4726
|
viewBox: "0 0 24 24",
|
|
@@ -4605,7 +4731,7 @@ function WithdrawFormStep({
|
|
|
4605
4731
|
style: {
|
|
4606
4732
|
transform: showTokenDropdown ? "rotate(180deg)" : void 0
|
|
4607
4733
|
},
|
|
4608
|
-
children: /* @__PURE__ */
|
|
4734
|
+
children: /* @__PURE__ */ jsx18(
|
|
4609
4735
|
"path",
|
|
4610
4736
|
{
|
|
4611
4737
|
strokeLinecap: "round",
|
|
@@ -4618,7 +4744,7 @@ function WithdrawFormStep({
|
|
|
4618
4744
|
]
|
|
4619
4745
|
}
|
|
4620
4746
|
),
|
|
4621
|
-
showTokenDropdown && /* @__PURE__ */
|
|
4747
|
+
showTokenDropdown && /* @__PURE__ */ jsx18("div", { className: "rs-withdraw-dropdown-menu", children: targetTokenOptions.map((option) => /* @__PURE__ */ jsxs15(
|
|
4622
4748
|
"button",
|
|
4623
4749
|
{
|
|
4624
4750
|
type: "button",
|
|
@@ -4628,7 +4754,7 @@ function WithdrawFormStep({
|
|
|
4628
4754
|
setShowTokenDropdown(false);
|
|
4629
4755
|
},
|
|
4630
4756
|
children: [
|
|
4631
|
-
getTokenIcon(option.symbol) && /* @__PURE__ */
|
|
4757
|
+
getTokenIcon(option.symbol) && /* @__PURE__ */ jsx18(
|
|
4632
4758
|
"img",
|
|
4633
4759
|
{
|
|
4634
4760
|
src: getTokenIcon(option.symbol),
|
|
@@ -4636,7 +4762,7 @@ function WithdrawFormStep({
|
|
|
4636
4762
|
className: "rs-withdraw-dropdown-icon"
|
|
4637
4763
|
}
|
|
4638
4764
|
),
|
|
4639
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ jsx18("span", { children: option.symbol })
|
|
4640
4766
|
]
|
|
4641
4767
|
},
|
|
4642
4768
|
option.address
|
|
@@ -4645,15 +4771,15 @@ function WithdrawFormStep({
|
|
|
4645
4771
|
}
|
|
4646
4772
|
)
|
|
4647
4773
|
] }),
|
|
4648
|
-
/* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4774
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-col", children: [
|
|
4775
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Chain" }),
|
|
4776
|
+
/* @__PURE__ */ jsxs15(
|
|
4651
4777
|
"div",
|
|
4652
4778
|
{
|
|
4653
4779
|
className: "rs-withdraw-dropdown-container",
|
|
4654
4780
|
ref: chainDropdownRef,
|
|
4655
4781
|
children: [
|
|
4656
|
-
/* @__PURE__ */
|
|
4782
|
+
/* @__PURE__ */ jsxs15(
|
|
4657
4783
|
"button",
|
|
4658
4784
|
{
|
|
4659
4785
|
type: "button",
|
|
@@ -4663,8 +4789,8 @@ function WithdrawFormStep({
|
|
|
4663
4789
|
setShowTokenDropdown(false);
|
|
4664
4790
|
},
|
|
4665
4791
|
children: [
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
4792
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-dropdown-value", children: [
|
|
4793
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx18(
|
|
4668
4794
|
"img",
|
|
4669
4795
|
{
|
|
4670
4796
|
src: getChainIcon(targetChain),
|
|
@@ -4672,9 +4798,9 @@ function WithdrawFormStep({
|
|
|
4672
4798
|
className: "rs-withdraw-dropdown-icon"
|
|
4673
4799
|
}
|
|
4674
4800
|
),
|
|
4675
|
-
/* @__PURE__ */
|
|
4801
|
+
/* @__PURE__ */ jsx18("span", { children: targetChainName })
|
|
4676
4802
|
] }),
|
|
4677
|
-
/* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ jsx18(
|
|
4678
4804
|
"svg",
|
|
4679
4805
|
{
|
|
4680
4806
|
viewBox: "0 0 24 24",
|
|
@@ -4685,7 +4811,7 @@ function WithdrawFormStep({
|
|
|
4685
4811
|
style: {
|
|
4686
4812
|
transform: showChainDropdown ? "rotate(180deg)" : void 0
|
|
4687
4813
|
},
|
|
4688
|
-
children: /* @__PURE__ */
|
|
4814
|
+
children: /* @__PURE__ */ jsx18(
|
|
4689
4815
|
"path",
|
|
4690
4816
|
{
|
|
4691
4817
|
strokeLinecap: "round",
|
|
@@ -4698,7 +4824,7 @@ function WithdrawFormStep({
|
|
|
4698
4824
|
]
|
|
4699
4825
|
}
|
|
4700
4826
|
),
|
|
4701
|
-
showChainDropdown && /* @__PURE__ */
|
|
4827
|
+
showChainDropdown && /* @__PURE__ */ jsx18("div", { className: "rs-withdraw-dropdown-menu", children: targetChains.map((chain) => /* @__PURE__ */ jsxs15(
|
|
4702
4828
|
"button",
|
|
4703
4829
|
{
|
|
4704
4830
|
type: "button",
|
|
@@ -4708,7 +4834,7 @@ function WithdrawFormStep({
|
|
|
4708
4834
|
setShowChainDropdown(false);
|
|
4709
4835
|
},
|
|
4710
4836
|
children: [
|
|
4711
|
-
getChainIcon(chain.id) && /* @__PURE__ */
|
|
4837
|
+
getChainIcon(chain.id) && /* @__PURE__ */ jsx18(
|
|
4712
4838
|
"img",
|
|
4713
4839
|
{
|
|
4714
4840
|
src: getChainIcon(chain.id),
|
|
@@ -4716,7 +4842,7 @@ function WithdrawFormStep({
|
|
|
4716
4842
|
className: "rs-withdraw-dropdown-icon"
|
|
4717
4843
|
}
|
|
4718
4844
|
),
|
|
4719
|
-
/* @__PURE__ */
|
|
4845
|
+
/* @__PURE__ */ jsx18("span", { children: chain.name })
|
|
4720
4846
|
]
|
|
4721
4847
|
},
|
|
4722
4848
|
chain.id
|
|
@@ -4726,13 +4852,13 @@ function WithdrawFormStep({
|
|
|
4726
4852
|
)
|
|
4727
4853
|
] })
|
|
4728
4854
|
] }),
|
|
4729
|
-
chainMismatch && /* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
4855
|
+
chainMismatch && /* @__PURE__ */ jsxs15("div", { className: "rs-chain-switch", children: [
|
|
4856
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-chain-switch-text", children: [
|
|
4731
4857
|
"Switch to ",
|
|
4732
4858
|
getChainName(asset.chainId),
|
|
4733
4859
|
" to continue."
|
|
4734
4860
|
] }),
|
|
4735
|
-
switchChain && /* @__PURE__ */
|
|
4861
|
+
switchChain && /* @__PURE__ */ jsx18(
|
|
4736
4862
|
Button,
|
|
4737
4863
|
{
|
|
4738
4864
|
variant: "outline",
|
|
@@ -4743,15 +4869,15 @@ function WithdrawFormStep({
|
|
|
4743
4869
|
}
|
|
4744
4870
|
)
|
|
4745
4871
|
] }),
|
|
4746
|
-
error && /* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
4872
|
+
error && /* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-error", children: [
|
|
4873
|
+
/* @__PURE__ */ jsx18(
|
|
4748
4874
|
"svg",
|
|
4749
4875
|
{
|
|
4750
4876
|
viewBox: "0 0 24 24",
|
|
4751
4877
|
fill: "none",
|
|
4752
4878
|
stroke: "currentColor",
|
|
4753
4879
|
strokeWidth: "2",
|
|
4754
|
-
children: /* @__PURE__ */
|
|
4880
|
+
children: /* @__PURE__ */ jsx18(
|
|
4755
4881
|
"path",
|
|
4756
4882
|
{
|
|
4757
4883
|
strokeLinecap: "round",
|
|
@@ -4761,10 +4887,10 @@ function WithdrawFormStep({
|
|
|
4761
4887
|
)
|
|
4762
4888
|
}
|
|
4763
4889
|
),
|
|
4764
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsx18("span", { children: error })
|
|
4765
4891
|
] })
|
|
4766
4892
|
] }),
|
|
4767
|
-
/* @__PURE__ */
|
|
4893
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx18(
|
|
4768
4894
|
Button,
|
|
4769
4895
|
{
|
|
4770
4896
|
onClick: handleWithdraw,
|
|
@@ -4774,7 +4900,7 @@ function WithdrawFormStep({
|
|
|
4774
4900
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
4775
4901
|
}
|
|
4776
4902
|
) }),
|
|
4777
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
4778
4904
|
] });
|
|
4779
4905
|
}
|
|
4780
4906
|
var init_WithdrawFormStep = __esm({
|
|
@@ -5023,14 +5149,14 @@ var init_safe = __esm({
|
|
|
5023
5149
|
});
|
|
5024
5150
|
|
|
5025
5151
|
// src/WithdrawFlow.tsx
|
|
5026
|
-
import { useCallback as
|
|
5152
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo9, useState as useState11 } from "react";
|
|
5027
5153
|
import { walletClientToAccount as walletClientToAccount2 } from "@rhinestone/sdk";
|
|
5028
5154
|
import { parseUnits as parseUnits4 } from "viem";
|
|
5029
|
-
import { jsx as
|
|
5155
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5030
5156
|
function WithdrawFlow({
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5157
|
+
dappWalletClient,
|
|
5158
|
+
dappPublicClient,
|
|
5159
|
+
dappAddress,
|
|
5034
5160
|
safeAddress,
|
|
5035
5161
|
sourceChain,
|
|
5036
5162
|
sourceToken,
|
|
@@ -5039,14 +5165,11 @@ function WithdrawFlow({
|
|
|
5039
5165
|
recipient: defaultRecipient,
|
|
5040
5166
|
amount: defaultAmount,
|
|
5041
5167
|
service,
|
|
5042
|
-
switchChain,
|
|
5043
5168
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5044
5169
|
sessionChainIds,
|
|
5045
5170
|
forceRegister = false,
|
|
5046
5171
|
waitForFinalTx = true,
|
|
5047
|
-
|
|
5048
|
-
selectedConnectAddress,
|
|
5049
|
-
onSelectConnectAddress,
|
|
5172
|
+
reownWallet,
|
|
5050
5173
|
onConnect,
|
|
5051
5174
|
onWithdrawSign,
|
|
5052
5175
|
onRequestConnect,
|
|
@@ -5070,8 +5193,89 @@ function WithdrawFlow({
|
|
|
5070
5193
|
setTargetChain(targetChainProp);
|
|
5071
5194
|
setTargetToken(targetTokenProp);
|
|
5072
5195
|
}, [targetChainProp, targetTokenProp]);
|
|
5073
|
-
const targetChainObj =
|
|
5074
|
-
const
|
|
5196
|
+
const targetChainObj = useMemo9(() => CHAIN_BY_ID[targetChain], [targetChain]);
|
|
5197
|
+
const hasCustomSigner = Boolean(dappAddress && onWithdrawSign);
|
|
5198
|
+
const dappSwitchChain = useMemo9(() => {
|
|
5199
|
+
if (!dappWalletClient?.switchChain) return void 0;
|
|
5200
|
+
return async (chainId) => {
|
|
5201
|
+
await dappWalletClient.switchChain?.({ id: chainId });
|
|
5202
|
+
};
|
|
5203
|
+
}, [dappWalletClient]);
|
|
5204
|
+
const walletOptions = useMemo9(() => {
|
|
5205
|
+
const options = [];
|
|
5206
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5207
|
+
if (dappWalletClient?.account && dappAddress) {
|
|
5208
|
+
options.push({
|
|
5209
|
+
address: dappWalletClient.account.address,
|
|
5210
|
+
label: "Connected Wallet",
|
|
5211
|
+
kind: "connected"
|
|
5212
|
+
});
|
|
5213
|
+
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
5214
|
+
}
|
|
5215
|
+
if (reownWallet?.address && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
5216
|
+
options.push({
|
|
5217
|
+
address: reownWallet.address,
|
|
5218
|
+
label: "External Wallet",
|
|
5219
|
+
kind: "external"
|
|
5220
|
+
});
|
|
5221
|
+
}
|
|
5222
|
+
return options;
|
|
5223
|
+
}, [
|
|
5224
|
+
dappWalletClient,
|
|
5225
|
+
dappAddress,
|
|
5226
|
+
reownWallet?.address,
|
|
5227
|
+
reownWallet?.isConnected
|
|
5228
|
+
]);
|
|
5229
|
+
const canAutoLock = (dappWalletClient?.account && dappAddress || hasCustomSigner) && !reownWallet;
|
|
5230
|
+
const [selectedConnectAddress, setSelectedConnectAddress] = useState11(null);
|
|
5231
|
+
const signerContext = useMemo9(() => {
|
|
5232
|
+
if (canAutoLock) {
|
|
5233
|
+
if (hasCustomSigner) {
|
|
5234
|
+
return {
|
|
5235
|
+
ownerAddress: dappAddress,
|
|
5236
|
+
walletClient: dappWalletClient ?? void 0,
|
|
5237
|
+
publicClient: dappPublicClient ?? getPublicClient(sourceChain),
|
|
5238
|
+
switchChain: dappSwitchChain
|
|
5239
|
+
};
|
|
5240
|
+
}
|
|
5241
|
+
return {
|
|
5242
|
+
ownerAddress: dappWalletClient.account.address,
|
|
5243
|
+
walletClient: dappWalletClient,
|
|
5244
|
+
publicClient: dappPublicClient ?? getPublicClient(sourceChain),
|
|
5245
|
+
switchChain: dappSwitchChain
|
|
5246
|
+
};
|
|
5247
|
+
}
|
|
5248
|
+
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
5249
|
+
if (dappWalletClient?.account && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
5250
|
+
return {
|
|
5251
|
+
ownerAddress: dappWalletClient.account.address,
|
|
5252
|
+
walletClient: dappWalletClient,
|
|
5253
|
+
publicClient: dappPublicClient ?? getPublicClient(sourceChain),
|
|
5254
|
+
switchChain: dappSwitchChain
|
|
5255
|
+
};
|
|
5256
|
+
}
|
|
5257
|
+
if (reownWallet?.address?.toLowerCase() === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
5258
|
+
return {
|
|
5259
|
+
ownerAddress: reownWallet.address,
|
|
5260
|
+
walletClient: reownWallet.walletClient,
|
|
5261
|
+
publicClient: reownWallet.publicClient,
|
|
5262
|
+
switchChain: reownWallet.switchChain
|
|
5263
|
+
};
|
|
5264
|
+
}
|
|
5265
|
+
return null;
|
|
5266
|
+
}, [
|
|
5267
|
+
canAutoLock,
|
|
5268
|
+
hasCustomSigner,
|
|
5269
|
+
isConnectSelectionConfirmed,
|
|
5270
|
+
selectedConnectAddress,
|
|
5271
|
+
dappWalletClient,
|
|
5272
|
+
dappPublicClient,
|
|
5273
|
+
dappSwitchChain,
|
|
5274
|
+
dappAddress,
|
|
5275
|
+
reownWallet,
|
|
5276
|
+
sourceChain
|
|
5277
|
+
]);
|
|
5278
|
+
const asset = useMemo9(() => {
|
|
5075
5279
|
const symbol = getTokenSymbol(sourceToken, sourceChain);
|
|
5076
5280
|
const decimals = getTokenDecimalsByAddress(sourceToken, sourceChain);
|
|
5077
5281
|
return {
|
|
@@ -5092,19 +5296,19 @@ function WithdrawFlow({
|
|
|
5092
5296
|
useEffect10(() => {
|
|
5093
5297
|
onTotalBalanceChange?.(totalBalanceUsd);
|
|
5094
5298
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
5095
|
-
const handleConnected =
|
|
5299
|
+
const handleConnected = useCallback8(
|
|
5096
5300
|
(addr, smartAccount) => {
|
|
5097
5301
|
onConnected?.({ address: addr, smartAccount });
|
|
5098
5302
|
},
|
|
5099
5303
|
[onConnected]
|
|
5100
5304
|
);
|
|
5101
|
-
const handleError =
|
|
5305
|
+
const handleError = useCallback8(
|
|
5102
5306
|
(message, code) => {
|
|
5103
5307
|
onError?.({ message, code });
|
|
5104
5308
|
},
|
|
5105
5309
|
[onError]
|
|
5106
5310
|
);
|
|
5107
|
-
const resolveSessionOwner2 =
|
|
5311
|
+
const resolveSessionOwner2 = useCallback8(async (eoaAddress) => {
|
|
5108
5312
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
5109
5313
|
if (localOwner) {
|
|
5110
5314
|
return {
|
|
@@ -5119,9 +5323,13 @@ function WithdrawFlow({
|
|
|
5119
5323
|
address: created.address
|
|
5120
5324
|
};
|
|
5121
5325
|
}, []);
|
|
5122
|
-
const handleFormSubmit =
|
|
5326
|
+
const handleFormSubmit = useCallback8(
|
|
5123
5327
|
async (recipient, amountValue) => {
|
|
5124
|
-
|
|
5328
|
+
const ownerAddress2 = signerContext?.ownerAddress;
|
|
5329
|
+
if (!ownerAddress2) {
|
|
5330
|
+
throw new Error("Wallet not connected");
|
|
5331
|
+
}
|
|
5332
|
+
if (!onWithdrawSign && !signerContext?.walletClient) {
|
|
5125
5333
|
throw new Error("Wallet not connected");
|
|
5126
5334
|
}
|
|
5127
5335
|
if (!targetChainObj) {
|
|
@@ -5129,8 +5337,8 @@ function WithdrawFlow({
|
|
|
5129
5337
|
}
|
|
5130
5338
|
setIsSubmitting(true);
|
|
5131
5339
|
try {
|
|
5132
|
-
const signerAccount = walletClientToAccount2(walletClient);
|
|
5133
|
-
const sessionOwner = await resolveSessionOwner2(
|
|
5340
|
+
const signerAccount = signerContext?.walletClient ? walletClientToAccount2(signerContext.walletClient) : createViewOnlyAccount(ownerAddress2);
|
|
5341
|
+
const sessionOwner = await resolveSessionOwner2(ownerAddress2);
|
|
5134
5342
|
const account = await createSmartAccount(
|
|
5135
5343
|
signerAccount,
|
|
5136
5344
|
sessionOwner.account
|
|
@@ -5155,7 +5363,7 @@ function WithdrawFlow({
|
|
|
5155
5363
|
factoryData: initData.factoryData,
|
|
5156
5364
|
sessionDetails
|
|
5157
5365
|
},
|
|
5158
|
-
eoaAddress:
|
|
5366
|
+
eoaAddress: ownerAddress2,
|
|
5159
5367
|
sessionOwner: sessionOwner.address,
|
|
5160
5368
|
target: {
|
|
5161
5369
|
chain: targetChain,
|
|
@@ -5164,8 +5372,9 @@ function WithdrawFlow({
|
|
|
5164
5372
|
}
|
|
5165
5373
|
});
|
|
5166
5374
|
}
|
|
5167
|
-
handleConnected(
|
|
5375
|
+
handleConnected(ownerAddress2, smartAccount);
|
|
5168
5376
|
const amountUnits = parseUnits4(amountValue, asset.decimals);
|
|
5377
|
+
const pc = signerContext?.publicClient ?? getPublicClient(sourceChain);
|
|
5169
5378
|
const result = onWithdrawSign ? await onWithdrawSign({
|
|
5170
5379
|
safeAddress,
|
|
5171
5380
|
recipient: smartAccount,
|
|
@@ -5174,15 +5383,15 @@ function WithdrawFlow({
|
|
|
5174
5383
|
chainId: sourceChain,
|
|
5175
5384
|
isNative: isSourceNative
|
|
5176
5385
|
}) : isSourceNative ? await executeSafeEthTransfer({
|
|
5177
|
-
walletClient,
|
|
5178
|
-
publicClient,
|
|
5386
|
+
walletClient: signerContext.walletClient,
|
|
5387
|
+
publicClient: pc,
|
|
5179
5388
|
safeAddress,
|
|
5180
5389
|
recipient: smartAccount,
|
|
5181
5390
|
amount: amountUnits,
|
|
5182
5391
|
chainId: sourceChain
|
|
5183
5392
|
}) : await executeSafeErc20Transfer({
|
|
5184
|
-
walletClient,
|
|
5185
|
-
publicClient,
|
|
5393
|
+
walletClient: signerContext.walletClient,
|
|
5394
|
+
publicClient: pc,
|
|
5186
5395
|
safeAddress,
|
|
5187
5396
|
tokenAddress: sourceToken,
|
|
5188
5397
|
recipient: smartAccount,
|
|
@@ -5212,9 +5421,7 @@ function WithdrawFlow({
|
|
|
5212
5421
|
}
|
|
5213
5422
|
},
|
|
5214
5423
|
[
|
|
5215
|
-
|
|
5216
|
-
publicClient,
|
|
5217
|
-
address,
|
|
5424
|
+
signerContext,
|
|
5218
5425
|
targetChainObj,
|
|
5219
5426
|
resolveSessionOwner2,
|
|
5220
5427
|
signerAddress,
|
|
@@ -5234,24 +5441,24 @@ function WithdrawFlow({
|
|
|
5234
5441
|
handleError
|
|
5235
5442
|
]
|
|
5236
5443
|
);
|
|
5237
|
-
const handleWithdrawComplete =
|
|
5444
|
+
const handleWithdrawComplete = useCallback8(
|
|
5238
5445
|
(txHash, destinationTxHash) => {
|
|
5239
5446
|
onWithdrawComplete?.({ txHash, destinationTxHash });
|
|
5240
5447
|
},
|
|
5241
5448
|
[onWithdrawComplete]
|
|
5242
5449
|
);
|
|
5243
|
-
const handleWithdrawFailed =
|
|
5450
|
+
const handleWithdrawFailed = useCallback8(
|
|
5244
5451
|
(txHash, error) => {
|
|
5245
5452
|
onWithdrawFailed?.({ txHash, error });
|
|
5246
5453
|
},
|
|
5247
5454
|
[onWithdrawFailed]
|
|
5248
5455
|
);
|
|
5249
|
-
const targetChainOptions =
|
|
5456
|
+
const targetChainOptions = useMemo9(() => {
|
|
5250
5457
|
return SOURCE_CHAINS.filter(
|
|
5251
5458
|
(chain) => getSupportedTargetTokens(chain.id).length > 0
|
|
5252
5459
|
);
|
|
5253
5460
|
}, []);
|
|
5254
|
-
const targetTokenOptions =
|
|
5461
|
+
const targetTokenOptions = useMemo9(
|
|
5255
5462
|
() => getSupportedTargetTokens(targetChain),
|
|
5256
5463
|
[targetChain]
|
|
5257
5464
|
);
|
|
@@ -5264,7 +5471,7 @@ function WithdrawFlow({
|
|
|
5264
5471
|
setTargetToken(targetTokenOptions[0].address);
|
|
5265
5472
|
}
|
|
5266
5473
|
}, [targetToken, targetTokenOptions]);
|
|
5267
|
-
const handleTargetChainChange =
|
|
5474
|
+
const handleTargetChainChange = useCallback8(
|
|
5268
5475
|
(chainId) => {
|
|
5269
5476
|
setTargetChain(chainId);
|
|
5270
5477
|
const options = getSupportedTargetTokens(chainId);
|
|
@@ -5280,53 +5487,57 @@ function WithdrawFlow({
|
|
|
5280
5487
|
},
|
|
5281
5488
|
[targetToken]
|
|
5282
5489
|
);
|
|
5283
|
-
const handleTargetTokenChange =
|
|
5490
|
+
const handleTargetTokenChange = useCallback8((token) => {
|
|
5284
5491
|
setTargetToken(token);
|
|
5285
5492
|
}, []);
|
|
5286
|
-
const
|
|
5287
|
-
const selectedConnectAddressEffective = useMemo10(() => {
|
|
5493
|
+
const selectedConnectAddressEffective = useMemo9(() => {
|
|
5288
5494
|
if (selectedConnectAddress) return selectedConnectAddress;
|
|
5289
|
-
if (
|
|
5290
|
-
return
|
|
5495
|
+
if (walletOptions.length === 1) {
|
|
5496
|
+
return walletOptions[0].address;
|
|
5291
5497
|
}
|
|
5292
5498
|
return null;
|
|
5293
|
-
}, [selectedConnectAddress,
|
|
5294
|
-
const
|
|
5295
|
-
() =>
|
|
5296
|
-
[
|
|
5499
|
+
}, [selectedConnectAddress, walletOptions]);
|
|
5500
|
+
const walletOptionsKey = useMemo9(
|
|
5501
|
+
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
5502
|
+
[walletOptions]
|
|
5297
5503
|
);
|
|
5298
|
-
const
|
|
5299
|
-
const showConnectStep = !hasConnectedWallet || hasConnectWalletOptions && !isConnectSelectionConfirmed;
|
|
5504
|
+
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
5300
5505
|
useEffect10(() => {
|
|
5301
5506
|
setIsConnectSelectionConfirmed(false);
|
|
5302
|
-
}, [
|
|
5507
|
+
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
5303
5508
|
if (showConnectStep) {
|
|
5304
|
-
return /* @__PURE__ */
|
|
5509
|
+
return /* @__PURE__ */ jsx19("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx19(
|
|
5305
5510
|
ConnectStep,
|
|
5306
5511
|
{
|
|
5307
|
-
walletOptions
|
|
5512
|
+
walletOptions,
|
|
5308
5513
|
selectedAddress: selectedConnectAddressEffective,
|
|
5309
|
-
onSelectAddress:
|
|
5514
|
+
onSelectAddress: setSelectedConnectAddress,
|
|
5310
5515
|
onRequestConnect,
|
|
5311
5516
|
onConnect,
|
|
5312
|
-
onContinue: () =>
|
|
5517
|
+
onContinue: () => {
|
|
5518
|
+
if (selectedConnectAddressEffective) {
|
|
5519
|
+
setSelectedConnectAddress(selectedConnectAddressEffective);
|
|
5520
|
+
}
|
|
5521
|
+
setIsConnectSelectionConfirmed(true);
|
|
5522
|
+
},
|
|
5313
5523
|
connectButtonLabel
|
|
5314
5524
|
}
|
|
5315
5525
|
) });
|
|
5316
5526
|
}
|
|
5317
|
-
if (!
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5527
|
+
if (!signerContext) return null;
|
|
5528
|
+
if (!onWithdrawSign && !signerContext.walletClient) return null;
|
|
5529
|
+
const ownerAddress = signerContext.ownerAddress;
|
|
5530
|
+
const formPublicClient = signerContext.publicClient ?? getPublicClient(sourceChain);
|
|
5531
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rs-modal-body", children: [
|
|
5532
|
+
step.type === "form" && /* @__PURE__ */ jsx19(
|
|
5322
5533
|
WithdrawFormStep,
|
|
5323
5534
|
{
|
|
5324
|
-
walletClient,
|
|
5325
|
-
publicClient,
|
|
5326
|
-
address,
|
|
5535
|
+
walletClient: signerContext.walletClient,
|
|
5536
|
+
publicClient: formPublicClient,
|
|
5537
|
+
address: ownerAddress,
|
|
5327
5538
|
safeAddress,
|
|
5328
5539
|
asset,
|
|
5329
|
-
defaultRecipient: defaultRecipient ??
|
|
5540
|
+
defaultRecipient: defaultRecipient ?? ownerAddress,
|
|
5330
5541
|
defaultAmount,
|
|
5331
5542
|
targetChain,
|
|
5332
5543
|
targetToken,
|
|
@@ -5334,13 +5545,13 @@ function WithdrawFlow({
|
|
|
5334
5545
|
targetTokenOptions,
|
|
5335
5546
|
onTargetChainChange: handleTargetChainChange,
|
|
5336
5547
|
onTargetTokenChange: handleTargetTokenChange,
|
|
5337
|
-
switchChain,
|
|
5548
|
+
switchChain: signerContext.switchChain,
|
|
5338
5549
|
submitting: isSubmitting,
|
|
5339
5550
|
onSubmit: handleFormSubmit,
|
|
5340
5551
|
onBalanceUsdChange: setTotalBalanceUsd
|
|
5341
5552
|
}
|
|
5342
5553
|
),
|
|
5343
|
-
step.type === "processing" && /* @__PURE__ */
|
|
5554
|
+
step.type === "processing" && /* @__PURE__ */ jsx19(
|
|
5344
5555
|
ProcessingStep,
|
|
5345
5556
|
{
|
|
5346
5557
|
smartAccount: step.smartAccount,
|
|
@@ -5366,6 +5577,7 @@ var init_WithdrawFlow = __esm({
|
|
|
5366
5577
|
"src/WithdrawFlow.tsx"() {
|
|
5367
5578
|
"use strict";
|
|
5368
5579
|
init_ConnectStep();
|
|
5580
|
+
init_public_client();
|
|
5369
5581
|
init_WithdrawFormStep();
|
|
5370
5582
|
init_ProcessingStep();
|
|
5371
5583
|
init_constants();
|
|
@@ -5381,40 +5593,24 @@ var WithdrawModalReown_exports = {};
|
|
|
5381
5593
|
__export(WithdrawModalReown_exports, {
|
|
5382
5594
|
WithdrawModalReown: () => WithdrawModalReown
|
|
5383
5595
|
});
|
|
5384
|
-
import { useCallback as
|
|
5385
|
-
import { jsx as
|
|
5596
|
+
import { useCallback as useCallback9 } from "react";
|
|
5597
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
5386
5598
|
function WithdrawModalWithReown(props) {
|
|
5387
5599
|
const reown = useReownWallet();
|
|
5388
|
-
const
|
|
5389
|
-
{
|
|
5390
|
-
walletClient: props.walletClient,
|
|
5391
|
-
publicClient: props.publicClient,
|
|
5392
|
-
address: props.address,
|
|
5393
|
-
switchChain: props.switchChain
|
|
5394
|
-
},
|
|
5395
|
-
reown
|
|
5396
|
-
);
|
|
5397
|
-
const handleConnect = useCallback10(() => {
|
|
5600
|
+
const handleConnect = useCallback9(() => {
|
|
5398
5601
|
reown.openConnect();
|
|
5399
5602
|
}, [reown.openConnect]);
|
|
5400
|
-
return /* @__PURE__ */
|
|
5603
|
+
return /* @__PURE__ */ jsx20(
|
|
5401
5604
|
WithdrawModalInner,
|
|
5402
5605
|
{
|
|
5403
5606
|
...props,
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
address: resolved.address,
|
|
5407
|
-
switchChain: resolved.switchChain,
|
|
5408
|
-
connectWalletOptions: resolved.walletOptions,
|
|
5409
|
-
selectedConnectAddress: resolved.selectedAddress,
|
|
5410
|
-
onSelectConnectAddress: resolved.onSelectAddress,
|
|
5411
|
-
onConnect: handleConnect,
|
|
5412
|
-
onRequestConnect: props.onRequestConnect
|
|
5607
|
+
reownWallet: reown,
|
|
5608
|
+
onConnect: handleConnect
|
|
5413
5609
|
}
|
|
5414
5610
|
);
|
|
5415
5611
|
}
|
|
5416
5612
|
function WithdrawModalReown(props) {
|
|
5417
|
-
return /* @__PURE__ */
|
|
5613
|
+
return /* @__PURE__ */ jsx20(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx20(WithdrawModalWithReown, { ...props }) });
|
|
5418
5614
|
}
|
|
5419
5615
|
var init_WithdrawModalReown = __esm({
|
|
5420
5616
|
"src/WithdrawModalReown.tsx"() {
|
|
@@ -5426,26 +5622,26 @@ var init_WithdrawModalReown = __esm({
|
|
|
5426
5622
|
|
|
5427
5623
|
// src/WithdrawModal.tsx
|
|
5428
5624
|
import {
|
|
5429
|
-
useCallback as
|
|
5625
|
+
useCallback as useCallback10,
|
|
5430
5626
|
useEffect as useEffect11,
|
|
5431
|
-
useMemo as
|
|
5627
|
+
useMemo as useMemo10,
|
|
5432
5628
|
useRef as useRef9,
|
|
5433
5629
|
useState as useState12,
|
|
5434
5630
|
lazy as lazy2,
|
|
5435
5631
|
Suspense as Suspense2
|
|
5436
5632
|
} from "react";
|
|
5437
|
-
import { jsx as
|
|
5633
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5438
5634
|
function WithdrawModal(props) {
|
|
5439
5635
|
const needsReown = !!props.reownAppId;
|
|
5440
5636
|
if (needsReown) {
|
|
5441
|
-
return /* @__PURE__ */
|
|
5637
|
+
return /* @__PURE__ */ jsx21(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx21(ReownWithdrawInner, { ...props }) });
|
|
5442
5638
|
}
|
|
5443
|
-
return /* @__PURE__ */
|
|
5639
|
+
return /* @__PURE__ */ jsx21(WithdrawModalInner, { ...props });
|
|
5444
5640
|
}
|
|
5445
5641
|
function WithdrawModalInner({
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5642
|
+
dappWalletClient,
|
|
5643
|
+
dappPublicClient,
|
|
5644
|
+
dappAddress,
|
|
5449
5645
|
safeAddress,
|
|
5450
5646
|
sourceChain: sourceChainProp,
|
|
5451
5647
|
sourceToken,
|
|
@@ -5456,15 +5652,12 @@ function WithdrawModalInner({
|
|
|
5456
5652
|
isOpen,
|
|
5457
5653
|
onClose,
|
|
5458
5654
|
inline,
|
|
5459
|
-
switchChain,
|
|
5460
5655
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
5461
5656
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
5462
5657
|
sessionChainIds,
|
|
5463
5658
|
forceRegister = false,
|
|
5464
5659
|
waitForFinalTx = true,
|
|
5465
|
-
|
|
5466
|
-
selectedConnectAddress,
|
|
5467
|
-
onSelectConnectAddress,
|
|
5660
|
+
reownWallet,
|
|
5468
5661
|
onConnect,
|
|
5469
5662
|
onWithdrawSign,
|
|
5470
5663
|
onRequestConnect,
|
|
@@ -5486,7 +5679,7 @@ function WithdrawModalInner({
|
|
|
5486
5679
|
const backHandlerRef = useRef9(void 0);
|
|
5487
5680
|
const targetChain = getChainId(targetChainProp);
|
|
5488
5681
|
const sourceChain = getChainId(sourceChainProp);
|
|
5489
|
-
const service =
|
|
5682
|
+
const service = useMemo10(() => createDepositService(backendUrl), [backendUrl]);
|
|
5490
5683
|
useEffect11(() => {
|
|
5491
5684
|
if (isOpen && modalRef.current) {
|
|
5492
5685
|
applyTheme(modalRef.current, theme);
|
|
@@ -5504,17 +5697,17 @@ function WithdrawModalInner({
|
|
|
5504
5697
|
setCurrentStepIndex(0);
|
|
5505
5698
|
}
|
|
5506
5699
|
}, [isOpen]);
|
|
5507
|
-
const handleStepChange =
|
|
5700
|
+
const handleStepChange = useCallback10(
|
|
5508
5701
|
(stepIndex, onBack) => {
|
|
5509
5702
|
setCurrentStepIndex(stepIndex);
|
|
5510
5703
|
backHandlerRef.current = onBack;
|
|
5511
5704
|
},
|
|
5512
5705
|
[]
|
|
5513
5706
|
);
|
|
5514
|
-
const handleTotalBalanceChange =
|
|
5707
|
+
const handleTotalBalanceChange = useCallback10((balance) => {
|
|
5515
5708
|
setTotalBalanceUsd(balance);
|
|
5516
5709
|
}, []);
|
|
5517
|
-
const handleBack =
|
|
5710
|
+
const handleBack = useCallback10(() => {
|
|
5518
5711
|
backHandlerRef.current?.();
|
|
5519
5712
|
}, []);
|
|
5520
5713
|
const showLogo = uiConfig?.showLogo ?? false;
|
|
@@ -5524,30 +5717,30 @@ function WithdrawModalInner({
|
|
|
5524
5717
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
5525
5718
|
const title = branding?.title ?? "Withdraw";
|
|
5526
5719
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
5527
|
-
return /* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsx21(
|
|
5528
5721
|
Modal,
|
|
5529
5722
|
{
|
|
5530
5723
|
isOpen,
|
|
5531
5724
|
onClose,
|
|
5532
5725
|
className,
|
|
5533
5726
|
inline,
|
|
5534
|
-
children: /* @__PURE__ */
|
|
5535
|
-
/* @__PURE__ */
|
|
5536
|
-
/* @__PURE__ */
|
|
5727
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: modalRef, className: "rs-modal", children: [
|
|
5728
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
|
|
5729
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx21(
|
|
5537
5730
|
"button",
|
|
5538
5731
|
{
|
|
5539
5732
|
type: "button",
|
|
5540
5733
|
className: "rs-modal-header-back",
|
|
5541
5734
|
"aria-label": "Go back",
|
|
5542
5735
|
onClick: handleBack,
|
|
5543
|
-
children: /* @__PURE__ */
|
|
5736
|
+
children: /* @__PURE__ */ jsx21(
|
|
5544
5737
|
"svg",
|
|
5545
5738
|
{
|
|
5546
5739
|
viewBox: "0 0 24 24",
|
|
5547
5740
|
fill: "none",
|
|
5548
5741
|
stroke: "currentColor",
|
|
5549
5742
|
strokeWidth: "2",
|
|
5550
|
-
children: /* @__PURE__ */
|
|
5743
|
+
children: /* @__PURE__ */ jsx21(
|
|
5551
5744
|
"path",
|
|
5552
5745
|
{
|
|
5553
5746
|
strokeLinecap: "round",
|
|
@@ -5559,9 +5752,9 @@ function WithdrawModalInner({
|
|
|
5559
5752
|
)
|
|
5560
5753
|
}
|
|
5561
5754
|
) }),
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
/* @__PURE__ */
|
|
5564
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
5755
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-center", children: [
|
|
5756
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-title-row", children: [
|
|
5757
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx21(
|
|
5565
5758
|
"img",
|
|
5566
5759
|
{
|
|
5567
5760
|
src: logoUrl,
|
|
@@ -5572,8 +5765,8 @@ function WithdrawModalInner({
|
|
|
5572
5765
|
}
|
|
5573
5766
|
}
|
|
5574
5767
|
),
|
|
5575
|
-
/* @__PURE__ */
|
|
5576
|
-
showStepper && /* @__PURE__ */
|
|
5768
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-title", children: title }),
|
|
5769
|
+
showStepper && /* @__PURE__ */ jsx21("div", { className: "rs-modal-progress", style: { marginLeft: 8 }, children: [0, 1].map((i) => /* @__PURE__ */ jsx21(
|
|
5577
5770
|
"div",
|
|
5578
5771
|
{
|
|
5579
5772
|
className: `rs-modal-progress-dot ${i <= currentStepIndex ? "rs-modal-progress-dot--active" : "rs-modal-progress-dot--inactive"}`
|
|
@@ -5581,26 +5774,26 @@ function WithdrawModalInner({
|
|
|
5581
5774
|
i
|
|
5582
5775
|
)) })
|
|
5583
5776
|
] }),
|
|
5584
|
-
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5777
|
+
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-balance", children: [
|
|
5778
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-balance-label", children: balanceTitle }),
|
|
5779
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-balance-value", children: currencyFormatter.format(totalBalanceUsd) })
|
|
5587
5780
|
] })
|
|
5588
5781
|
] }),
|
|
5589
|
-
/* @__PURE__ */
|
|
5782
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ jsx21(
|
|
5590
5783
|
"button",
|
|
5591
5784
|
{
|
|
5592
5785
|
type: "button",
|
|
5593
5786
|
onClick: onClose,
|
|
5594
5787
|
className: "rs-modal-close",
|
|
5595
5788
|
"aria-label": "Close",
|
|
5596
|
-
children: /* @__PURE__ */
|
|
5789
|
+
children: /* @__PURE__ */ jsx21(
|
|
5597
5790
|
"svg",
|
|
5598
5791
|
{
|
|
5599
5792
|
viewBox: "0 0 24 24",
|
|
5600
5793
|
fill: "none",
|
|
5601
5794
|
stroke: "currentColor",
|
|
5602
5795
|
strokeWidth: "2",
|
|
5603
|
-
children: /* @__PURE__ */
|
|
5796
|
+
children: /* @__PURE__ */ jsx21(
|
|
5604
5797
|
"path",
|
|
5605
5798
|
{
|
|
5606
5799
|
strokeLinecap: "round",
|
|
@@ -5613,12 +5806,12 @@ function WithdrawModalInner({
|
|
|
5613
5806
|
}
|
|
5614
5807
|
) })
|
|
5615
5808
|
] }),
|
|
5616
|
-
/* @__PURE__ */
|
|
5809
|
+
/* @__PURE__ */ jsx21(
|
|
5617
5810
|
WithdrawFlow,
|
|
5618
5811
|
{
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5812
|
+
dappWalletClient,
|
|
5813
|
+
dappPublicClient,
|
|
5814
|
+
dappAddress,
|
|
5622
5815
|
safeAddress,
|
|
5623
5816
|
sourceChain,
|
|
5624
5817
|
sourceToken,
|
|
@@ -5627,14 +5820,11 @@ function WithdrawModalInner({
|
|
|
5627
5820
|
recipient,
|
|
5628
5821
|
amount: defaultAmount,
|
|
5629
5822
|
service,
|
|
5630
|
-
switchChain,
|
|
5631
5823
|
signerAddress,
|
|
5632
5824
|
sessionChainIds,
|
|
5633
5825
|
forceRegister,
|
|
5634
5826
|
waitForFinalTx,
|
|
5635
|
-
|
|
5636
|
-
selectedConnectAddress,
|
|
5637
|
-
onSelectConnectAddress,
|
|
5827
|
+
reownWallet,
|
|
5638
5828
|
onConnect,
|
|
5639
5829
|
onWithdrawSign,
|
|
5640
5830
|
onRequestConnect,
|