@rhinestone/deposit-modal 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +732 -497
- package/dist/index.mjs +714 -480
- package/dist/styles.css +120 -22
- 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,62 +317,80 @@ 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",
|
|
288
387
|
className: "rs-connect-wallet-manage",
|
|
289
388
|
onClick: onConnect,
|
|
290
|
-
children: "
|
|
389
|
+
children: "Disconnect Wallet"
|
|
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,39 +403,57 @@ 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__ */
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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(
|
|
412
|
+
"svg",
|
|
413
|
+
{
|
|
414
|
+
viewBox: "0 0 24 24",
|
|
415
|
+
fill: "none",
|
|
416
|
+
stroke: "currentColor",
|
|
417
|
+
strokeWidth: "1.6",
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ jsx5(
|
|
420
|
+
"path",
|
|
421
|
+
{
|
|
422
|
+
strokeLinecap: "round",
|
|
423
|
+
strokeLinejoin: "round",
|
|
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"
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
/* @__PURE__ */ jsx5(
|
|
428
|
+
"path",
|
|
429
|
+
{
|
|
430
|
+
strokeLinecap: "round",
|
|
431
|
+
strokeLinejoin: "round",
|
|
432
|
+
d: "M20 10.5h-3.75a2.25 2.25 0 100 4.5H20"
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
/* @__PURE__ */ jsx5("circle", { cx: "16.25", cy: "12.75", r: "0.85", fill: "currentColor" })
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
) }),
|
|
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" })
|
|
333
441
|
] }),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__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." })
|
|
336
444
|
] }) }),
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
|
|
445
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-step-footer rs-step-footer--connect-empty", children: [
|
|
446
|
+
/* @__PURE__ */ jsx5(
|
|
447
|
+
Button,
|
|
448
|
+
{
|
|
449
|
+
onClick: handleConnect,
|
|
450
|
+
variant: "accent",
|
|
451
|
+
fullWidth: true,
|
|
452
|
+
disabled: !handleConnect,
|
|
453
|
+
children: connectButtonLabel
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
onSelectTransferCrypto && /* @__PURE__ */ jsx5(
|
|
340
457
|
"button",
|
|
341
458
|
{
|
|
342
459
|
type: "button",
|
|
@@ -352,6 +469,7 @@ var init_ConnectStep = __esm({
|
|
|
352
469
|
"src/components/steps/ConnectStep.tsx"() {
|
|
353
470
|
"use strict";
|
|
354
471
|
init_Button();
|
|
472
|
+
init_Icons();
|
|
355
473
|
ConnectStep.displayName = "ConnectStep";
|
|
356
474
|
}
|
|
357
475
|
});
|
|
@@ -855,7 +973,7 @@ var init_session_owner = __esm({
|
|
|
855
973
|
// src/components/steps/SetupStep.tsx
|
|
856
974
|
import { useState, useEffect as useEffect2, useRef as useRef2, useCallback as useCallback2 } from "react";
|
|
857
975
|
import { walletClientToAccount } from "@rhinestone/sdk";
|
|
858
|
-
import { Fragment, jsx as
|
|
976
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
859
977
|
async function resolveSessionOwner(eoaAddress) {
|
|
860
978
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
861
979
|
if (localOwner) {
|
|
@@ -995,24 +1113,24 @@ function SetupStep({
|
|
|
995
1113
|
};
|
|
996
1114
|
const isLoading = state.type === "idle" || state.type === "checking" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
997
1115
|
const isError = state.type === "error";
|
|
998
|
-
return /* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
isLoading && /* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__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" })
|
|
1005
1123
|
] })
|
|
1006
1124
|
] }),
|
|
1007
|
-
isError && /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1125
|
+
isError && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1126
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx6(
|
|
1009
1127
|
"svg",
|
|
1010
1128
|
{
|
|
1011
1129
|
viewBox: "0 0 24 24",
|
|
1012
1130
|
fill: "none",
|
|
1013
1131
|
stroke: "currentColor",
|
|
1014
1132
|
strokeWidth: "2",
|
|
1015
|
-
children: /* @__PURE__ */
|
|
1133
|
+
children: /* @__PURE__ */ jsx6(
|
|
1016
1134
|
"path",
|
|
1017
1135
|
{
|
|
1018
1136
|
strokeLinecap: "round",
|
|
@@ -1022,9 +1140,9 @@ function SetupStep({
|
|
|
1022
1140
|
)
|
|
1023
1141
|
}
|
|
1024
1142
|
) }),
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
/* @__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(
|
|
1028
1146
|
"div",
|
|
1029
1147
|
{
|
|
1030
1148
|
className: "rs-loading-subtitle",
|
|
@@ -1035,7 +1153,7 @@ function SetupStep({
|
|
|
1035
1153
|
] })
|
|
1036
1154
|
] })
|
|
1037
1155
|
] }),
|
|
1038
|
-
isError && /* @__PURE__ */
|
|
1156
|
+
isError && /* @__PURE__ */ jsx6("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx6(Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
1039
1157
|
] });
|
|
1040
1158
|
}
|
|
1041
1159
|
var init_SetupStep = __esm({
|
|
@@ -1049,17 +1167,17 @@ var init_SetupStep = __esm({
|
|
|
1049
1167
|
});
|
|
1050
1168
|
|
|
1051
1169
|
// src/components/ui/PoweredBy.tsx
|
|
1052
|
-
import { jsx as
|
|
1170
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1053
1171
|
function PoweredBy() {
|
|
1054
|
-
return /* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rs-powered-by", children: [
|
|
1173
|
+
/* @__PURE__ */ jsx7(
|
|
1056
1174
|
"svg",
|
|
1057
1175
|
{
|
|
1058
1176
|
viewBox: "0 0 24 24",
|
|
1059
1177
|
fill: "none",
|
|
1060
1178
|
stroke: "currentColor",
|
|
1061
1179
|
strokeWidth: "2",
|
|
1062
|
-
children: /* @__PURE__ */
|
|
1180
|
+
children: /* @__PURE__ */ jsx7(
|
|
1063
1181
|
"path",
|
|
1064
1182
|
{
|
|
1065
1183
|
strokeLinecap: "round",
|
|
@@ -1069,10 +1187,10 @@ function PoweredBy() {
|
|
|
1069
1187
|
)
|
|
1070
1188
|
}
|
|
1071
1189
|
),
|
|
1072
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1073
1191
|
"Powered by",
|
|
1074
1192
|
" ",
|
|
1075
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ jsx7(
|
|
1076
1194
|
"a",
|
|
1077
1195
|
{
|
|
1078
1196
|
href: "https://www.rhinestone.dev",
|
|
@@ -1354,12 +1472,10 @@ var init_formatters = __esm({
|
|
|
1354
1472
|
// src/components/steps/AssetSelectStep.tsx
|
|
1355
1473
|
import { useEffect as useEffect3, useMemo, useState as useState2 } from "react";
|
|
1356
1474
|
import { formatUnits } from "viem";
|
|
1357
|
-
import { jsx as
|
|
1475
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1358
1476
|
function AssetSelectStep({
|
|
1359
1477
|
address,
|
|
1360
1478
|
publicClient,
|
|
1361
|
-
smartAccount,
|
|
1362
|
-
recipient,
|
|
1363
1479
|
defaultSourceChain,
|
|
1364
1480
|
defaultSourceToken,
|
|
1365
1481
|
service,
|
|
@@ -1462,21 +1578,21 @@ function AssetSelectStep({
|
|
|
1462
1578
|
return asset.balance;
|
|
1463
1579
|
}
|
|
1464
1580
|
};
|
|
1465
|
-
return /* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__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(
|
|
1468
1584
|
"div",
|
|
1469
1585
|
{
|
|
1470
1586
|
className: "rs-step-body",
|
|
1471
1587
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1472
1588
|
children: [
|
|
1473
|
-
loading && /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__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" })
|
|
1476
1592
|
] }),
|
|
1477
|
-
error && /* @__PURE__ */
|
|
1478
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
1479
|
-
/* @__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(
|
|
1480
1596
|
"svg",
|
|
1481
1597
|
{
|
|
1482
1598
|
className: "rs-empty-icon",
|
|
@@ -1484,7 +1600,7 @@ function AssetSelectStep({
|
|
|
1484
1600
|
fill: "none",
|
|
1485
1601
|
stroke: "currentColor",
|
|
1486
1602
|
strokeWidth: "1.5",
|
|
1487
|
-
children: /* @__PURE__ */
|
|
1603
|
+
children: /* @__PURE__ */ jsx8(
|
|
1488
1604
|
"path",
|
|
1489
1605
|
{
|
|
1490
1606
|
strokeLinecap: "round",
|
|
@@ -1494,20 +1610,20 @@ function AssetSelectStep({
|
|
|
1494
1610
|
)
|
|
1495
1611
|
}
|
|
1496
1612
|
),
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
1614
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-empty-address", children: [
|
|
1499
1615
|
address.slice(0, 6),
|
|
1500
1616
|
"...",
|
|
1501
1617
|
address.slice(-4)
|
|
1502
1618
|
] })
|
|
1503
1619
|
] }),
|
|
1504
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
1620
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx8("div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
1505
1621
|
const isSelected = selectedAssetId === asset.id;
|
|
1506
1622
|
const tokenAmount = formatBalance(asset);
|
|
1507
1623
|
const badge = getChainBadge(asset.chainId);
|
|
1508
1624
|
const tokenIcon = getTokenIcon(asset.symbol);
|
|
1509
1625
|
const chainIcon = getChainIcon(asset.chainId);
|
|
1510
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ jsxs7(
|
|
1511
1627
|
"button",
|
|
1512
1628
|
{
|
|
1513
1629
|
type: "button",
|
|
@@ -1515,9 +1631,9 @@ function AssetSelectStep({
|
|
|
1515
1631
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
1516
1632
|
style: { textAlign: "left" },
|
|
1517
1633
|
children: [
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
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(
|
|
1521
1637
|
"img",
|
|
1522
1638
|
{
|
|
1523
1639
|
src: tokenIcon,
|
|
@@ -1525,15 +1641,15 @@ function AssetSelectStep({
|
|
|
1525
1641
|
className: "rs-asset-icon",
|
|
1526
1642
|
style: { background: "transparent" }
|
|
1527
1643
|
}
|
|
1528
|
-
) : /* @__PURE__ */
|
|
1529
|
-
chainIcon ? /* @__PURE__ */
|
|
1644
|
+
) : /* @__PURE__ */ jsx8("div", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
|
|
1645
|
+
chainIcon ? /* @__PURE__ */ jsx8(
|
|
1530
1646
|
"img",
|
|
1531
1647
|
{
|
|
1532
1648
|
src: chainIcon,
|
|
1533
1649
|
alt: getChainName(asset.chainId),
|
|
1534
1650
|
className: "rs-asset-chain-badge"
|
|
1535
1651
|
}
|
|
1536
|
-
) : /* @__PURE__ */
|
|
1652
|
+
) : /* @__PURE__ */ jsx8(
|
|
1537
1653
|
"div",
|
|
1538
1654
|
{
|
|
1539
1655
|
className: "rs-asset-chain-badge",
|
|
@@ -1545,23 +1661,23 @@ function AssetSelectStep({
|
|
|
1545
1661
|
}
|
|
1546
1662
|
)
|
|
1547
1663
|
] }),
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1665
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-name", children: [
|
|
1550
1666
|
asset.symbol,
|
|
1551
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-asset-chain", children: [
|
|
1552
1668
|
" ",
|
|
1553
1669
|
"on ",
|
|
1554
1670
|
getChainName(asset.chainId)
|
|
1555
1671
|
] })
|
|
1556
1672
|
] }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
|
|
1558
1674
|
tokenAmount,
|
|
1559
1675
|
" ",
|
|
1560
1676
|
asset.symbol
|
|
1561
1677
|
] })
|
|
1562
1678
|
] })
|
|
1563
1679
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ? currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
1565
1681
|
]
|
|
1566
1682
|
},
|
|
1567
1683
|
asset.id
|
|
@@ -1570,7 +1686,7 @@ function AssetSelectStep({
|
|
|
1570
1686
|
]
|
|
1571
1687
|
}
|
|
1572
1688
|
),
|
|
1573
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx8(
|
|
1574
1690
|
Button,
|
|
1575
1691
|
{
|
|
1576
1692
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
@@ -1579,7 +1695,7 @@ function AssetSelectStep({
|
|
|
1579
1695
|
children: "Continue"
|
|
1580
1696
|
}
|
|
1581
1697
|
) }),
|
|
1582
|
-
/* @__PURE__ */
|
|
1698
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
1583
1699
|
] });
|
|
1584
1700
|
}
|
|
1585
1701
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
@@ -1635,14 +1751,12 @@ var init_AssetSelectStep = __esm({
|
|
|
1635
1751
|
// src/components/steps/AmountStep.tsx
|
|
1636
1752
|
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState3, useRef as useRef3 } from "react";
|
|
1637
1753
|
import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
|
|
1638
|
-
import { jsx as
|
|
1754
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1639
1755
|
function AmountStep({
|
|
1640
1756
|
walletClient,
|
|
1641
1757
|
publicClient,
|
|
1642
1758
|
address,
|
|
1643
1759
|
balanceAddress,
|
|
1644
|
-
smartAccount,
|
|
1645
|
-
recipient,
|
|
1646
1760
|
asset,
|
|
1647
1761
|
defaultAmount,
|
|
1648
1762
|
switchChain,
|
|
@@ -1808,10 +1922,10 @@ function AmountStep({
|
|
|
1808
1922
|
setIsSwitching(false);
|
|
1809
1923
|
}
|
|
1810
1924
|
};
|
|
1811
|
-
return /* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__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(
|
|
1815
1929
|
"input",
|
|
1816
1930
|
{
|
|
1817
1931
|
type: "text",
|
|
@@ -1829,17 +1943,17 @@ function AmountStep({
|
|
|
1829
1943
|
autoFocus: true
|
|
1830
1944
|
}
|
|
1831
1945
|
) }),
|
|
1832
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-token-value", children: [
|
|
1833
1947
|
formattedTokenAmount,
|
|
1834
1948
|
" ",
|
|
1835
1949
|
asset.symbol
|
|
1836
1950
|
] }),
|
|
1837
|
-
/* @__PURE__ */
|
|
1951
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-amount-available", children: /* @__PURE__ */ jsxs8("span", { className: "rs-amount-available-value", children: [
|
|
1838
1952
|
formattedBalance,
|
|
1839
1953
|
" ",
|
|
1840
1954
|
asset.symbol,
|
|
1841
1955
|
" available",
|
|
1842
|
-
balanceUsd !== null && /* @__PURE__ */
|
|
1956
|
+
balanceUsd !== null && /* @__PURE__ */ jsxs8("span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
1843
1957
|
" ",
|
|
1844
1958
|
"(",
|
|
1845
1959
|
currencyFormatter.format(balanceUsd),
|
|
@@ -1847,26 +1961,59 @@ function AmountStep({
|
|
|
1847
1961
|
] })
|
|
1848
1962
|
] }) })
|
|
1849
1963
|
] }),
|
|
1850
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ jsx9(
|
|
1851
1965
|
"div",
|
|
1852
1966
|
{
|
|
1853
1967
|
style: { display: "flex", justifyContent: "center", marginTop: 16 },
|
|
1854
|
-
children: /* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
|
|
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(
|
|
1974
|
+
"img",
|
|
1975
|
+
{
|
|
1976
|
+
src: getTokenIcon(asset.symbol),
|
|
1977
|
+
alt: asset.symbol
|
|
1978
|
+
}
|
|
1979
|
+
) : asset.symbol.slice(0, 2) }),
|
|
1980
|
+
(() => {
|
|
1981
|
+
const chainIcon = getChainIcon(asset.chainId);
|
|
1982
|
+
if (chainIcon) {
|
|
1983
|
+
return /* @__PURE__ */ jsx9(
|
|
1984
|
+
"img",
|
|
1985
|
+
{
|
|
1986
|
+
src: chainIcon,
|
|
1987
|
+
alt: getChainName(asset.chainId),
|
|
1988
|
+
className: "rs-flow-pill-chain-badge"
|
|
1989
|
+
}
|
|
1990
|
+
);
|
|
1991
|
+
}
|
|
1992
|
+
const badge = getChainBadge(asset.chainId);
|
|
1993
|
+
return /* @__PURE__ */ jsx9(
|
|
1994
|
+
"div",
|
|
1995
|
+
{
|
|
1996
|
+
className: "rs-flow-pill-chain-badge",
|
|
1997
|
+
style: {
|
|
1998
|
+
backgroundColor: badge.bg,
|
|
1999
|
+
color: badge.color
|
|
2000
|
+
},
|
|
2001
|
+
children: badge.shortLabel.charAt(0)
|
|
2002
|
+
}
|
|
2003
|
+
);
|
|
2004
|
+
})()
|
|
2005
|
+
] }),
|
|
2006
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-token-symbol", children: asset.symbol })
|
|
1860
2007
|
] })
|
|
1861
2008
|
] }),
|
|
1862
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-flow-pill-arrow", children: /* @__PURE__ */ jsx9(
|
|
1863
2010
|
"svg",
|
|
1864
2011
|
{
|
|
1865
2012
|
viewBox: "0 0 24 24",
|
|
1866
2013
|
fill: "none",
|
|
1867
2014
|
stroke: "currentColor",
|
|
1868
2015
|
strokeWidth: "2",
|
|
1869
|
-
children: /* @__PURE__ */
|
|
2016
|
+
children: /* @__PURE__ */ jsx9(
|
|
1870
2017
|
"path",
|
|
1871
2018
|
{
|
|
1872
2019
|
strokeLinecap: "round",
|
|
@@ -1876,18 +2023,51 @@ function AmountStep({
|
|
|
1876
2023
|
)
|
|
1877
2024
|
}
|
|
1878
2025
|
) }),
|
|
1879
|
-
/* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
|
|
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(
|
|
2031
|
+
"img",
|
|
2032
|
+
{
|
|
2033
|
+
src: getTokenIcon(targetSymbol),
|
|
2034
|
+
alt: targetSymbol
|
|
2035
|
+
}
|
|
2036
|
+
) : targetSymbol.slice(0, 2) }),
|
|
2037
|
+
(() => {
|
|
2038
|
+
const chainIcon = getChainIcon(targetChain);
|
|
2039
|
+
if (chainIcon) {
|
|
2040
|
+
return /* @__PURE__ */ jsx9(
|
|
2041
|
+
"img",
|
|
2042
|
+
{
|
|
2043
|
+
src: chainIcon,
|
|
2044
|
+
alt: getChainName(targetChain),
|
|
2045
|
+
className: "rs-flow-pill-chain-badge"
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
2048
|
+
}
|
|
2049
|
+
const badge = getChainBadge(targetChain);
|
|
2050
|
+
return /* @__PURE__ */ jsx9(
|
|
2051
|
+
"div",
|
|
2052
|
+
{
|
|
2053
|
+
className: "rs-flow-pill-chain-badge",
|
|
2054
|
+
style: {
|
|
2055
|
+
backgroundColor: badge.bg,
|
|
2056
|
+
color: badge.color
|
|
2057
|
+
},
|
|
2058
|
+
children: badge.shortLabel.charAt(0)
|
|
2059
|
+
}
|
|
2060
|
+
);
|
|
2061
|
+
})()
|
|
2062
|
+
] }),
|
|
2063
|
+
/* @__PURE__ */ jsx9("span", { className: "rs-flow-pill-token-symbol", children: targetSymbol })
|
|
1884
2064
|
] })
|
|
1885
2065
|
] })
|
|
1886
2066
|
] })
|
|
1887
2067
|
}
|
|
1888
2068
|
),
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
[25, 50, 75].map((pct) => /* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-presets", children: [
|
|
2070
|
+
[25, 50, 75].map((pct) => /* @__PURE__ */ jsxs8(
|
|
1891
2071
|
"button",
|
|
1892
2072
|
{
|
|
1893
2073
|
type: "button",
|
|
@@ -1901,7 +2081,7 @@ function AmountStep({
|
|
|
1901
2081
|
},
|
|
1902
2082
|
pct
|
|
1903
2083
|
)),
|
|
1904
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx9(
|
|
1905
2085
|
"button",
|
|
1906
2086
|
{
|
|
1907
2087
|
type: "button",
|
|
@@ -1912,13 +2092,13 @@ function AmountStep({
|
|
|
1912
2092
|
}
|
|
1913
2093
|
)
|
|
1914
2094
|
] }),
|
|
1915
|
-
chainMismatch && /* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
2095
|
+
chainMismatch && /* @__PURE__ */ jsxs8("div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
2096
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-chain-switch-text", children: [
|
|
1917
2097
|
"Switch your wallet to ",
|
|
1918
2098
|
getChainName(asset.chainId),
|
|
1919
2099
|
" to continue."
|
|
1920
2100
|
] }),
|
|
1921
|
-
switchChain && /* @__PURE__ */
|
|
2101
|
+
switchChain && /* @__PURE__ */ jsx9(
|
|
1922
2102
|
Button,
|
|
1923
2103
|
{
|
|
1924
2104
|
variant: "outline",
|
|
@@ -1929,8 +2109,8 @@ function AmountStep({
|
|
|
1929
2109
|
}
|
|
1930
2110
|
)
|
|
1931
2111
|
] }),
|
|
1932
|
-
error && /* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
2112
|
+
error && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-error", children: [
|
|
2113
|
+
/* @__PURE__ */ jsx9(
|
|
1934
2114
|
"svg",
|
|
1935
2115
|
{
|
|
1936
2116
|
viewBox: "0 0 24 24",
|
|
@@ -1938,7 +2118,7 @@ function AmountStep({
|
|
|
1938
2118
|
stroke: "currentColor",
|
|
1939
2119
|
strokeWidth: "2",
|
|
1940
2120
|
style: { width: 16, height: 16, flexShrink: 0 },
|
|
1941
|
-
children: /* @__PURE__ */
|
|
2121
|
+
children: /* @__PURE__ */ jsx9(
|
|
1942
2122
|
"path",
|
|
1943
2123
|
{
|
|
1944
2124
|
strokeLinecap: "round",
|
|
@@ -1948,10 +2128,10 @@ function AmountStep({
|
|
|
1948
2128
|
)
|
|
1949
2129
|
}
|
|
1950
2130
|
),
|
|
1951
|
-
/* @__PURE__ */
|
|
2131
|
+
/* @__PURE__ */ jsx9("span", { children: error })
|
|
1952
2132
|
] })
|
|
1953
2133
|
] }),
|
|
1954
|
-
/* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx9(
|
|
1955
2135
|
Button,
|
|
1956
2136
|
{
|
|
1957
2137
|
onClick: handleContinue,
|
|
@@ -1960,7 +2140,7 @@ function AmountStep({
|
|
|
1960
2140
|
children: "Continue"
|
|
1961
2141
|
}
|
|
1962
2142
|
) }),
|
|
1963
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsx9(PoweredBy, {})
|
|
1964
2144
|
] });
|
|
1965
2145
|
}
|
|
1966
2146
|
var init_AmountStep = __esm({
|
|
@@ -1977,12 +2157,11 @@ var init_AmountStep = __esm({
|
|
|
1977
2157
|
// src/components/steps/ConfirmStep.tsx
|
|
1978
2158
|
import { useMemo as useMemo3, useState as useState4 } from "react";
|
|
1979
2159
|
import { erc20Abi as erc20Abi2, formatUnits as formatUnits3, parseUnits as parseUnits2 } from "viem";
|
|
1980
|
-
import { jsx as
|
|
2160
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1981
2161
|
function ConfirmStep({
|
|
1982
2162
|
walletClient,
|
|
1983
2163
|
address,
|
|
1984
2164
|
smartAccount,
|
|
1985
|
-
recipient,
|
|
1986
2165
|
asset,
|
|
1987
2166
|
amount,
|
|
1988
2167
|
balance,
|
|
@@ -2113,19 +2292,19 @@ function ConfirmStep({
|
|
|
2113
2292
|
setIsSwitching(false);
|
|
2114
2293
|
}
|
|
2115
2294
|
};
|
|
2116
|
-
return /* @__PURE__ */
|
|
2117
|
-
/* @__PURE__ */
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__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(
|
|
2123
2302
|
"span",
|
|
2124
2303
|
{
|
|
2125
2304
|
className: "rs-card-value",
|
|
2126
2305
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2127
2306
|
children: [
|
|
2128
|
-
getChainIcon(asset.chainId) && /* @__PURE__ */
|
|
2307
|
+
getChainIcon(asset.chainId) && /* @__PURE__ */ jsx10(
|
|
2129
2308
|
"img",
|
|
2130
2309
|
{
|
|
2131
2310
|
src: getChainIcon(asset.chainId),
|
|
@@ -2138,15 +2317,15 @@ function ConfirmStep({
|
|
|
2138
2317
|
}
|
|
2139
2318
|
)
|
|
2140
2319
|
] }),
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2320
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2321
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Destination" }),
|
|
2322
|
+
/* @__PURE__ */ jsxs9(
|
|
2144
2323
|
"span",
|
|
2145
2324
|
{
|
|
2146
2325
|
className: "rs-card-value",
|
|
2147
2326
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2148
2327
|
children: [
|
|
2149
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2328
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx10(
|
|
2150
2329
|
"img",
|
|
2151
2330
|
{
|
|
2152
2331
|
src: getChainIcon(targetChain),
|
|
@@ -2159,21 +2338,21 @@ function ConfirmStep({
|
|
|
2159
2338
|
}
|
|
2160
2339
|
)
|
|
2161
2340
|
] }),
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
/* @__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" })
|
|
2165
2344
|
] })
|
|
2166
2345
|
] }),
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
-
/* @__PURE__ */
|
|
2170
|
-
/* @__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(
|
|
2171
2350
|
"span",
|
|
2172
2351
|
{
|
|
2173
2352
|
className: "rs-card-value",
|
|
2174
2353
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2175
2354
|
children: [
|
|
2176
|
-
getTokenIcon(asset.symbol) && /* @__PURE__ */
|
|
2355
|
+
getTokenIcon(asset.symbol) && /* @__PURE__ */ jsx10(
|
|
2177
2356
|
"img",
|
|
2178
2357
|
{
|
|
2179
2358
|
src: getTokenIcon(asset.symbol),
|
|
@@ -2188,15 +2367,15 @@ function ConfirmStep({
|
|
|
2188
2367
|
}
|
|
2189
2368
|
)
|
|
2190
2369
|
] }),
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2370
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2371
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "You receive" }),
|
|
2372
|
+
/* @__PURE__ */ jsxs9(
|
|
2194
2373
|
"span",
|
|
2195
2374
|
{
|
|
2196
2375
|
className: "rs-card-value",
|
|
2197
2376
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2198
2377
|
children: [
|
|
2199
|
-
getTokenIcon(targetSymbol) && /* @__PURE__ */
|
|
2378
|
+
getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx10(
|
|
2200
2379
|
"img",
|
|
2201
2380
|
{
|
|
2202
2381
|
src: getTokenIcon(targetSymbol),
|
|
@@ -2211,18 +2390,18 @@ function ConfirmStep({
|
|
|
2211
2390
|
}
|
|
2212
2391
|
)
|
|
2213
2392
|
] }),
|
|
2214
|
-
receiveAmountUsd !== null && /* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
/* @__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) })
|
|
2217
2396
|
] })
|
|
2218
2397
|
] }),
|
|
2219
|
-
chainMismatch && /* @__PURE__ */
|
|
2220
|
-
/* @__PURE__ */
|
|
2398
|
+
chainMismatch && /* @__PURE__ */ jsxs9("div", { className: "rs-chain-switch", children: [
|
|
2399
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-chain-switch-text", children: [
|
|
2221
2400
|
"Switch your wallet to ",
|
|
2222
2401
|
getChainName(asset.chainId),
|
|
2223
2402
|
" to sign."
|
|
2224
2403
|
] }),
|
|
2225
|
-
switchChain && /* @__PURE__ */
|
|
2404
|
+
switchChain && /* @__PURE__ */ jsx10(
|
|
2226
2405
|
Button,
|
|
2227
2406
|
{
|
|
2228
2407
|
variant: "outline",
|
|
@@ -2233,8 +2412,8 @@ function ConfirmStep({
|
|
|
2233
2412
|
}
|
|
2234
2413
|
)
|
|
2235
2414
|
] }),
|
|
2236
|
-
error && /* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2415
|
+
error && /* @__PURE__ */ jsxs9("div", { className: "rs-alert rs-alert--error", children: [
|
|
2416
|
+
/* @__PURE__ */ jsx10(
|
|
2238
2417
|
"svg",
|
|
2239
2418
|
{
|
|
2240
2419
|
className: "rs-alert-icon",
|
|
@@ -2242,7 +2421,7 @@ function ConfirmStep({
|
|
|
2242
2421
|
fill: "none",
|
|
2243
2422
|
stroke: "currentColor",
|
|
2244
2423
|
strokeWidth: "2",
|
|
2245
|
-
children: /* @__PURE__ */
|
|
2424
|
+
children: /* @__PURE__ */ jsx10(
|
|
2246
2425
|
"path",
|
|
2247
2426
|
{
|
|
2248
2427
|
strokeLinecap: "round",
|
|
@@ -2252,7 +2431,7 @@ function ConfirmStep({
|
|
|
2252
2431
|
)
|
|
2253
2432
|
}
|
|
2254
2433
|
),
|
|
2255
|
-
/* @__PURE__ */
|
|
2434
|
+
/* @__PURE__ */ jsx10(
|
|
2256
2435
|
"span",
|
|
2257
2436
|
{
|
|
2258
2437
|
className: "rs-alert-text",
|
|
@@ -2267,7 +2446,7 @@ function ConfirmStep({
|
|
|
2267
2446
|
)
|
|
2268
2447
|
] })
|
|
2269
2448
|
] }),
|
|
2270
|
-
/* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
|
|
2271
2450
|
Button,
|
|
2272
2451
|
{
|
|
2273
2452
|
onClick: handleConfirm,
|
|
@@ -2277,7 +2456,7 @@ function ConfirmStep({
|
|
|
2277
2456
|
children: "Confirm Order"
|
|
2278
2457
|
}
|
|
2279
2458
|
) }),
|
|
2280
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ jsx10(PoweredBy, {})
|
|
2281
2460
|
] });
|
|
2282
2461
|
}
|
|
2283
2462
|
var STABLECOIN_SYMBOLS;
|
|
@@ -2293,33 +2472,41 @@ var init_ConfirmStep = __esm({
|
|
|
2293
2472
|
}
|
|
2294
2473
|
});
|
|
2295
2474
|
|
|
2296
|
-
// src/
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2475
|
+
// src/core/webhook.ts
|
|
2476
|
+
function isRecord(value) {
|
|
2477
|
+
return typeof value === "object" && value !== null;
|
|
2478
|
+
}
|
|
2479
|
+
function asString(value) {
|
|
2480
|
+
return typeof value === "string" ? value : void 0;
|
|
2481
|
+
}
|
|
2300
2482
|
function getEventTxHash(event) {
|
|
2301
2483
|
if (!event?.type) return void 0;
|
|
2302
2484
|
if (event.type === "deposit-received") {
|
|
2303
|
-
|
|
2304
|
-
return typeof data?.transactionHash === "string" ? data.transactionHash : void 0;
|
|
2485
|
+
return asString(event.data?.transactionHash);
|
|
2305
2486
|
}
|
|
2306
2487
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2309
|
-
return typeof txHash === "string" ? txHash : void 0;
|
|
2488
|
+
const source = isRecord(event.data?.source) ? event.data.source : void 0;
|
|
2489
|
+
return asString(source?.transactionHash);
|
|
2310
2490
|
}
|
|
2311
|
-
if (event.type === "bridge-failed") {
|
|
2312
|
-
const
|
|
2313
|
-
|
|
2314
|
-
return typeof txHash === "string" ? txHash : void 0;
|
|
2315
|
-
}
|
|
2316
|
-
if (event.type === "error") {
|
|
2317
|
-
const data = event.data;
|
|
2318
|
-
const txHash = data?.deposit?.transactionHash;
|
|
2319
|
-
return typeof txHash === "string" ? txHash : void 0;
|
|
2491
|
+
if (event.type === "bridge-failed" || event.type === "error") {
|
|
2492
|
+
const deposit = isRecord(event.data?.deposit) ? event.data.deposit : void 0;
|
|
2493
|
+
return asString(deposit?.transactionHash);
|
|
2320
2494
|
}
|
|
2321
2495
|
return void 0;
|
|
2322
2496
|
}
|
|
2497
|
+
function isDepositEvent(event) {
|
|
2498
|
+
return event?.type === "deposit-received" || event?.type === "bridge-started";
|
|
2499
|
+
}
|
|
2500
|
+
var init_webhook = __esm({
|
|
2501
|
+
"src/core/webhook.ts"() {
|
|
2502
|
+
"use strict";
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2505
|
+
|
|
2506
|
+
// src/components/steps/ProcessingStep.tsx
|
|
2507
|
+
import { useState as useState5, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
2508
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
2509
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2323
2510
|
function isEventForTx(event, txHash) {
|
|
2324
2511
|
const eventTxHash = getEventTxHash(event);
|
|
2325
2512
|
if (!eventTxHash) return false;
|
|
@@ -2501,7 +2688,6 @@ function ProcessingStep({
|
|
|
2501
2688
|
const secs = seconds % 60;
|
|
2502
2689
|
return `${mins}m ${secs}s`;
|
|
2503
2690
|
};
|
|
2504
|
-
const sourceSymbol = getTokenSymbol(sourceToken, sourceChain);
|
|
2505
2691
|
const targetSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2506
2692
|
const sourceDecimals = getTokenDecimalsByAddress(sourceToken, sourceChain);
|
|
2507
2693
|
const formattedReceivedAmount = (() => {
|
|
@@ -2517,17 +2703,17 @@ function ProcessingStep({
|
|
|
2517
2703
|
}
|
|
2518
2704
|
})();
|
|
2519
2705
|
if (isComplete) {
|
|
2520
|
-
return /* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */
|
|
2523
|
-
/* @__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(
|
|
2524
2710
|
"svg",
|
|
2525
2711
|
{
|
|
2526
2712
|
viewBox: "0 0 24 24",
|
|
2527
2713
|
fill: "none",
|
|
2528
2714
|
stroke: "currentColor",
|
|
2529
2715
|
strokeWidth: "2.5",
|
|
2530
|
-
children: /* @__PURE__ */
|
|
2716
|
+
children: /* @__PURE__ */ jsx11(
|
|
2531
2717
|
"path",
|
|
2532
2718
|
{
|
|
2533
2719
|
strokeLinecap: "round",
|
|
@@ -2537,13 +2723,13 @@ function ProcessingStep({
|
|
|
2537
2723
|
)
|
|
2538
2724
|
}
|
|
2539
2725
|
) }),
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__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.` })
|
|
2542
2728
|
] }),
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__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(
|
|
2547
2733
|
"span",
|
|
2548
2734
|
{
|
|
2549
2735
|
className: "rs-card-value",
|
|
@@ -2552,29 +2738,29 @@ function ProcessingStep({
|
|
|
2552
2738
|
}
|
|
2553
2739
|
)
|
|
2554
2740
|
] }),
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__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) })
|
|
2558
2744
|
] }),
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__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: [
|
|
2562
2748
|
formattedReceivedAmount,
|
|
2563
2749
|
" ",
|
|
2564
2750
|
targetSymbol
|
|
2565
2751
|
] })
|
|
2566
2752
|
] })
|
|
2567
2753
|
] }),
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__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(
|
|
2572
2758
|
"span",
|
|
2573
2759
|
{
|
|
2574
2760
|
className: "rs-card-value",
|
|
2575
2761
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2576
2762
|
children: [
|
|
2577
|
-
getChainIcon(sourceChain) && /* @__PURE__ */
|
|
2763
|
+
getChainIcon(sourceChain) && /* @__PURE__ */ jsx11(
|
|
2578
2764
|
"img",
|
|
2579
2765
|
{
|
|
2580
2766
|
src: getChainIcon(sourceChain),
|
|
@@ -2587,15 +2773,15 @@ function ProcessingStep({
|
|
|
2587
2773
|
}
|
|
2588
2774
|
)
|
|
2589
2775
|
] }),
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2592
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2777
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Destination" }),
|
|
2778
|
+
/* @__PURE__ */ jsxs10(
|
|
2593
2779
|
"span",
|
|
2594
2780
|
{
|
|
2595
2781
|
className: "rs-card-value",
|
|
2596
2782
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2597
2783
|
children: [
|
|
2598
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2784
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx11(
|
|
2599
2785
|
"img",
|
|
2600
2786
|
{
|
|
2601
2787
|
src: getChainIcon(targetChain),
|
|
@@ -2608,9 +2794,9 @@ function ProcessingStep({
|
|
|
2608
2794
|
}
|
|
2609
2795
|
)
|
|
2610
2796
|
] }),
|
|
2611
|
-
sourceExplorerUrl && /* @__PURE__ */
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2797
|
+
sourceExplorerUrl && /* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2798
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Transaction" }),
|
|
2799
|
+
/* @__PURE__ */ jsxs10(
|
|
2614
2800
|
"a",
|
|
2615
2801
|
{
|
|
2616
2802
|
href: sourceExplorerUrl,
|
|
@@ -2619,7 +2805,7 @@ function ProcessingStep({
|
|
|
2619
2805
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2620
2806
|
children: [
|
|
2621
2807
|
truncateHash(txHash),
|
|
2622
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsx11(
|
|
2623
2809
|
"svg",
|
|
2624
2810
|
{
|
|
2625
2811
|
viewBox: "0 0 24 24",
|
|
@@ -2627,7 +2813,7 @@ function ProcessingStep({
|
|
|
2627
2813
|
stroke: "currentColor",
|
|
2628
2814
|
strokeWidth: "2.5",
|
|
2629
2815
|
style: { width: 12, height: 12 },
|
|
2630
|
-
children: /* @__PURE__ */
|
|
2816
|
+
children: /* @__PURE__ */ jsx11(
|
|
2631
2817
|
"path",
|
|
2632
2818
|
{
|
|
2633
2819
|
strokeLinecap: "round",
|
|
@@ -2641,9 +2827,9 @@ function ProcessingStep({
|
|
|
2641
2827
|
}
|
|
2642
2828
|
)
|
|
2643
2829
|
] }),
|
|
2644
|
-
destinationTxHash && destExplorerUrl && /* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__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(
|
|
2647
2833
|
"a",
|
|
2648
2834
|
{
|
|
2649
2835
|
href: destExplorerUrl,
|
|
@@ -2652,7 +2838,7 @@ function ProcessingStep({
|
|
|
2652
2838
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2653
2839
|
children: [
|
|
2654
2840
|
truncateHash(destinationTxHash),
|
|
2655
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ jsx11(
|
|
2656
2842
|
"svg",
|
|
2657
2843
|
{
|
|
2658
2844
|
viewBox: "0 0 24 24",
|
|
@@ -2660,7 +2846,7 @@ function ProcessingStep({
|
|
|
2660
2846
|
stroke: "currentColor",
|
|
2661
2847
|
strokeWidth: "2.5",
|
|
2662
2848
|
style: { width: 12, height: 12 },
|
|
2663
|
-
children: /* @__PURE__ */
|
|
2849
|
+
children: /* @__PURE__ */ jsx11(
|
|
2664
2850
|
"path",
|
|
2665
2851
|
{
|
|
2666
2852
|
strokeLinecap: "round",
|
|
@@ -2676,31 +2862,31 @@ function ProcessingStep({
|
|
|
2676
2862
|
] })
|
|
2677
2863
|
] })
|
|
2678
2864
|
] }),
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__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: [
|
|
2682
2868
|
"New ",
|
|
2683
2869
|
flowNoun
|
|
2684
2870
|
] })
|
|
2685
2871
|
] }),
|
|
2686
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2687
2873
|
] });
|
|
2688
2874
|
}
|
|
2689
|
-
return /* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__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(
|
|
2693
2879
|
"div",
|
|
2694
2880
|
{
|
|
2695
2881
|
className: `rs-step-icon ${isError ? "rs-step-icon--error" : "rs-step-icon--accent"}`,
|
|
2696
|
-
children: isError ? /* @__PURE__ */
|
|
2882
|
+
children: isError ? /* @__PURE__ */ jsx11(
|
|
2697
2883
|
"svg",
|
|
2698
2884
|
{
|
|
2699
2885
|
viewBox: "0 0 24 24",
|
|
2700
2886
|
fill: "none",
|
|
2701
2887
|
stroke: "currentColor",
|
|
2702
2888
|
strokeWidth: "2",
|
|
2703
|
-
children: /* @__PURE__ */
|
|
2889
|
+
children: /* @__PURE__ */ jsx11(
|
|
2704
2890
|
"path",
|
|
2705
2891
|
{
|
|
2706
2892
|
strokeLinecap: "round",
|
|
@@ -2709,10 +2895,10 @@ function ProcessingStep({
|
|
|
2709
2895
|
}
|
|
2710
2896
|
)
|
|
2711
2897
|
}
|
|
2712
|
-
) : /* @__PURE__ */
|
|
2898
|
+
) : /* @__PURE__ */ jsx11(Spinner, {})
|
|
2713
2899
|
}
|
|
2714
2900
|
),
|
|
2715
|
-
/* @__PURE__ */
|
|
2901
|
+
/* @__PURE__ */ jsx11(
|
|
2716
2902
|
"div",
|
|
2717
2903
|
{
|
|
2718
2904
|
className: `rs-step-title ${isError ? "rs-step-title--error" : ""}`,
|
|
@@ -2720,7 +2906,7 @@ function ProcessingStep({
|
|
|
2720
2906
|
}
|
|
2721
2907
|
)
|
|
2722
2908
|
] }),
|
|
2723
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsxs10(
|
|
2724
2910
|
"div",
|
|
2725
2911
|
{
|
|
2726
2912
|
className: `rs-step-description ${isError ? "rs-text-error" : "rs-text-secondary"}`,
|
|
@@ -2732,11 +2918,11 @@ function ProcessingStep({
|
|
|
2732
2918
|
}
|
|
2733
2919
|
)
|
|
2734
2920
|
] }),
|
|
2735
|
-
/* @__PURE__ */
|
|
2736
|
-
isProcessing && /* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__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(
|
|
2740
2926
|
"svg",
|
|
2741
2927
|
{
|
|
2742
2928
|
className: "rs-alert-icon",
|
|
@@ -2744,7 +2930,7 @@ function ProcessingStep({
|
|
|
2744
2930
|
fill: "none",
|
|
2745
2931
|
stroke: "currentColor",
|
|
2746
2932
|
strokeWidth: "2",
|
|
2747
|
-
children: /* @__PURE__ */
|
|
2933
|
+
children: /* @__PURE__ */ jsx11(
|
|
2748
2934
|
"path",
|
|
2749
2935
|
{
|
|
2750
2936
|
strokeLinecap: "round",
|
|
@@ -2754,13 +2940,13 @@ function ProcessingStep({
|
|
|
2754
2940
|
)
|
|
2755
2941
|
}
|
|
2756
2942
|
),
|
|
2757
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsxs10("p", { className: "rs-alert-text", children: [
|
|
2758
2944
|
"You can safely close this window. Your ",
|
|
2759
2945
|
flowNoun,
|
|
2760
2946
|
" will complete in the background."
|
|
2761
2947
|
] })
|
|
2762
2948
|
] }),
|
|
2763
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsxs10(
|
|
2764
2950
|
"div",
|
|
2765
2951
|
{
|
|
2766
2952
|
className: "rs-text-sm rs-text-tertiary",
|
|
@@ -2772,16 +2958,16 @@ function ProcessingStep({
|
|
|
2772
2958
|
}
|
|
2773
2959
|
)
|
|
2774
2960
|
] }),
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__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(
|
|
2779
2965
|
"span",
|
|
2780
2966
|
{
|
|
2781
2967
|
className: "rs-card-value",
|
|
2782
2968
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2783
2969
|
children: [
|
|
2784
|
-
getChainIcon(sourceChain) && /* @__PURE__ */
|
|
2970
|
+
getChainIcon(sourceChain) && /* @__PURE__ */ jsx11(
|
|
2785
2971
|
"img",
|
|
2786
2972
|
{
|
|
2787
2973
|
src: getChainIcon(sourceChain),
|
|
@@ -2794,15 +2980,15 @@ function ProcessingStep({
|
|
|
2794
2980
|
}
|
|
2795
2981
|
)
|
|
2796
2982
|
] }),
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-card-row", children: [
|
|
2984
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-card-label", children: "Destination" }),
|
|
2985
|
+
/* @__PURE__ */ jsxs10(
|
|
2800
2986
|
"span",
|
|
2801
2987
|
{
|
|
2802
2988
|
className: "rs-card-value",
|
|
2803
2989
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2804
2990
|
children: [
|
|
2805
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2991
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx11(
|
|
2806
2992
|
"img",
|
|
2807
2993
|
{
|
|
2808
2994
|
src: getChainIcon(targetChain),
|
|
@@ -2815,9 +3001,9 @@ function ProcessingStep({
|
|
|
2815
3001
|
}
|
|
2816
3002
|
)
|
|
2817
3003
|
] }),
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
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(
|
|
2821
3007
|
"a",
|
|
2822
3008
|
{
|
|
2823
3009
|
href: sourceExplorerUrl,
|
|
@@ -2826,14 +3012,14 @@ function ProcessingStep({
|
|
|
2826
3012
|
className: "rs-link rs-link-external rs-font-mono rs-text-xs",
|
|
2827
3013
|
children: [
|
|
2828
3014
|
truncateHash(txHash),
|
|
2829
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ jsx11(
|
|
2830
3016
|
"svg",
|
|
2831
3017
|
{
|
|
2832
3018
|
viewBox: "0 0 24 24",
|
|
2833
3019
|
fill: "none",
|
|
2834
3020
|
stroke: "currentColor",
|
|
2835
3021
|
strokeWidth: "2.5",
|
|
2836
|
-
children: /* @__PURE__ */
|
|
3022
|
+
children: /* @__PURE__ */ jsx11(
|
|
2837
3023
|
"path",
|
|
2838
3024
|
{
|
|
2839
3025
|
strokeLinecap: "round",
|
|
@@ -2845,15 +3031,15 @@ function ProcessingStep({
|
|
|
2845
3031
|
)
|
|
2846
3032
|
]
|
|
2847
3033
|
}
|
|
2848
|
-
) : /* @__PURE__ */
|
|
3034
|
+
) : /* @__PURE__ */ jsx11("span", { className: "rs-card-value rs-card-value--mono", children: truncateHash(txHash) })
|
|
2849
3035
|
] })
|
|
2850
3036
|
] })
|
|
2851
3037
|
] }),
|
|
2852
|
-
isError && /* @__PURE__ */
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
/* @__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" })
|
|
2855
3041
|
] }),
|
|
2856
|
-
/* @__PURE__ */
|
|
3042
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2857
3043
|
] });
|
|
2858
3044
|
}
|
|
2859
3045
|
var INITIAL_POLL_INTERVAL, MAX_POLL_INTERVAL, BACKOFF_MULTIPLIER, PROCESS_TIMEOUT_MS;
|
|
@@ -2863,6 +3049,7 @@ var init_ProcessingStep = __esm({
|
|
|
2863
3049
|
init_Button();
|
|
2864
3050
|
init_PoweredBy();
|
|
2865
3051
|
init_Spinner();
|
|
3052
|
+
init_webhook();
|
|
2866
3053
|
init_constants();
|
|
2867
3054
|
INITIAL_POLL_INTERVAL = 3e3;
|
|
2868
3055
|
MAX_POLL_INTERVAL = 3e4;
|
|
@@ -2874,7 +3061,7 @@ var init_ProcessingStep = __esm({
|
|
|
2874
3061
|
// src/components/ui/QRCode.tsx
|
|
2875
3062
|
import { useMemo as useMemo4 } from "react";
|
|
2876
3063
|
import qrcode from "qrcode-generator";
|
|
2877
|
-
import { Fragment as Fragment3, jsx as
|
|
3064
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2878
3065
|
function QRCode({
|
|
2879
3066
|
value,
|
|
2880
3067
|
size = 200,
|
|
@@ -2908,7 +3095,7 @@ function QRCode({
|
|
|
2908
3095
|
}, [value, size, iconSrc]);
|
|
2909
3096
|
const iconSize = size * 0.22;
|
|
2910
3097
|
const iconOffset = (size - iconSize) / 2;
|
|
2911
|
-
return /* @__PURE__ */
|
|
3098
|
+
return /* @__PURE__ */ jsxs11(
|
|
2912
3099
|
"svg",
|
|
2913
3100
|
{
|
|
2914
3101
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -2918,10 +3105,10 @@ function QRCode({
|
|
|
2918
3105
|
role: "img",
|
|
2919
3106
|
"aria-label": "QR Code",
|
|
2920
3107
|
children: [
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
iconSrc && /* @__PURE__ */
|
|
2924
|
-
/* @__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(
|
|
2925
3112
|
"rect",
|
|
2926
3113
|
{
|
|
2927
3114
|
x: iconOffset - 4,
|
|
@@ -2932,7 +3119,7 @@ function QRCode({
|
|
|
2932
3119
|
rx: 8
|
|
2933
3120
|
}
|
|
2934
3121
|
),
|
|
2935
|
-
/* @__PURE__ */
|
|
3122
|
+
/* @__PURE__ */ jsx12(
|
|
2936
3123
|
"image",
|
|
2937
3124
|
{
|
|
2938
3125
|
href: iconSrc,
|
|
@@ -2956,7 +3143,47 @@ var init_QRCode = __esm({
|
|
|
2956
3143
|
|
|
2957
3144
|
// src/components/steps/DepositAddressStep.tsx
|
|
2958
3145
|
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback3, useRef as useRef5, useMemo as useMemo5 } from "react";
|
|
2959
|
-
import { jsx as
|
|
3146
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3147
|
+
function isRecord2(value) {
|
|
3148
|
+
return typeof value === "object" && value !== null;
|
|
3149
|
+
}
|
|
3150
|
+
function asNumber(value) {
|
|
3151
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
3152
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
3153
|
+
const parsed = Number(value);
|
|
3154
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
3155
|
+
}
|
|
3156
|
+
return void 0;
|
|
3157
|
+
}
|
|
3158
|
+
function asAmount(value) {
|
|
3159
|
+
if (typeof value === "string") return value;
|
|
3160
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
3161
|
+
return value.toString();
|
|
3162
|
+
}
|
|
3163
|
+
return void 0;
|
|
3164
|
+
}
|
|
3165
|
+
function asAddress(value) {
|
|
3166
|
+
if (typeof value !== "string") return void 0;
|
|
3167
|
+
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
3168
|
+
}
|
|
3169
|
+
function getDepositEventDetails(event) {
|
|
3170
|
+
if (!event?.type || !isRecord2(event.data)) return {};
|
|
3171
|
+
if (event.type === "deposit-received") {
|
|
3172
|
+
return {
|
|
3173
|
+
chainId: asNumber(event.data.chain),
|
|
3174
|
+
amount: asAmount(event.data.amount),
|
|
3175
|
+
token: asAddress(event.data.token)
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
if (event.type === "bridge-started") {
|
|
3179
|
+
const source = isRecord2(event.data.source) ? event.data.source : void 0;
|
|
3180
|
+
return {
|
|
3181
|
+
chainId: asNumber(source?.chain),
|
|
3182
|
+
token: asAddress(source?.asset)
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
return {};
|
|
3186
|
+
}
|
|
2960
3187
|
function DepositAddressStep({
|
|
2961
3188
|
smartAccount,
|
|
2962
3189
|
service,
|
|
@@ -2964,16 +3191,15 @@ function DepositAddressStep({
|
|
|
2964
3191
|
onError
|
|
2965
3192
|
}) {
|
|
2966
3193
|
const supportedChainIds = useMemo5(() => getSupportedChainIds(), []);
|
|
2967
|
-
const
|
|
2968
|
-
|
|
2969
|
-
);
|
|
3194
|
+
const BASE_CHAIN_ID = 8453;
|
|
3195
|
+
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
3196
|
+
const [sourceChainId, setSourceChainId] = useState6(defaultChainId);
|
|
2970
3197
|
const tokensForChain = useMemo5(
|
|
2971
3198
|
() => getSupportedTokenSymbolsForChain(sourceChainId),
|
|
2972
3199
|
[sourceChainId]
|
|
2973
3200
|
);
|
|
2974
|
-
const [
|
|
2975
|
-
|
|
2976
|
-
);
|
|
3201
|
+
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
|
|
3202
|
+
const [sourceTokenSymbol, setSourceTokenSymbol] = useState6(defaultToken);
|
|
2977
3203
|
useEffect6(() => {
|
|
2978
3204
|
if (!tokensForChain.includes(sourceTokenSymbol)) {
|
|
2979
3205
|
setSourceTokenSymbol(tokensForChain[0] ?? "USDC");
|
|
@@ -2984,6 +3210,16 @@ function DepositAddressStep({
|
|
|
2984
3210
|
const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
|
|
2985
3211
|
const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
|
|
2986
3212
|
const depositHandledRef = useRef5(false);
|
|
3213
|
+
const sourceSelectionRef = useRef5({
|
|
3214
|
+
chainId: defaultChainId,
|
|
3215
|
+
tokenSymbol: defaultToken
|
|
3216
|
+
});
|
|
3217
|
+
useEffect6(() => {
|
|
3218
|
+
sourceSelectionRef.current = {
|
|
3219
|
+
chainId: sourceChainId,
|
|
3220
|
+
tokenSymbol: sourceTokenSymbol
|
|
3221
|
+
};
|
|
3222
|
+
}, [sourceChainId, sourceTokenSymbol]);
|
|
2987
3223
|
const handleCopy = useCallback3(async () => {
|
|
2988
3224
|
try {
|
|
2989
3225
|
await navigator.clipboard.writeText(smartAccount);
|
|
@@ -3008,32 +3244,24 @@ function DepositAddressStep({
|
|
|
3008
3244
|
let timeoutId;
|
|
3009
3245
|
let cancelled = false;
|
|
3010
3246
|
let baselineTxHash = void 0;
|
|
3011
|
-
function extractDepositTxHash(event) {
|
|
3012
|
-
if (event?.type !== "deposit-received" || !event.data) return null;
|
|
3013
|
-
const hash = event.data.transactionHash;
|
|
3014
|
-
return typeof hash === "string" ? hash : null;
|
|
3015
|
-
}
|
|
3016
3247
|
async function poll() {
|
|
3017
3248
|
if (cancelled || depositHandledRef.current) return;
|
|
3018
3249
|
try {
|
|
3019
3250
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
3020
3251
|
if (cancelled || depositHandledRef.current) return;
|
|
3021
3252
|
const event = status.lastEvent;
|
|
3022
|
-
const eventTxHash =
|
|
3253
|
+
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event)?.toLowerCase() ?? null : null;
|
|
3023
3254
|
if (baselineTxHash === void 0) {
|
|
3024
3255
|
baselineTxHash = eventTxHash;
|
|
3025
|
-
} else if (eventTxHash && eventTxHash !== baselineTxHash
|
|
3026
|
-
const
|
|
3027
|
-
const
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3256
|
+
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
3257
|
+
const details = getDepositEventDetails(event);
|
|
3258
|
+
const fallback = sourceSelectionRef.current;
|
|
3259
|
+
const chainId = details.chainId ?? fallback.chainId;
|
|
3260
|
+
const amount = details.amount ?? "0";
|
|
3261
|
+
const token = details.token ?? getTokenAddress(fallback.tokenSymbol, fallback.chainId);
|
|
3262
|
+
if (token) {
|
|
3030
3263
|
depositHandledRef.current = true;
|
|
3031
|
-
onDepositDetected(
|
|
3032
|
-
eventTxHash,
|
|
3033
|
-
chainId,
|
|
3034
|
-
amount,
|
|
3035
|
-
token
|
|
3036
|
-
);
|
|
3264
|
+
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
3037
3265
|
return;
|
|
3038
3266
|
}
|
|
3039
3267
|
}
|
|
@@ -3056,12 +3284,12 @@ function DepositAddressStep({
|
|
|
3056
3284
|
};
|
|
3057
3285
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
3058
3286
|
const chainIconSrc = getChainIcon(sourceChainId);
|
|
3059
|
-
return /* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3064
|
-
/* @__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(
|
|
3065
3293
|
"button",
|
|
3066
3294
|
{
|
|
3067
3295
|
type: "button",
|
|
@@ -3071,7 +3299,7 @@ function DepositAddressStep({
|
|
|
3071
3299
|
setChainDropdownOpen(false);
|
|
3072
3300
|
},
|
|
3073
3301
|
children: [
|
|
3074
|
-
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */
|
|
3302
|
+
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx13(
|
|
3075
3303
|
"img",
|
|
3076
3304
|
{
|
|
3077
3305
|
src: getTokenIcon(sourceTokenSymbol),
|
|
@@ -3079,8 +3307,8 @@ function DepositAddressStep({
|
|
|
3079
3307
|
className: "rs-deposit-address-dropdown-icon"
|
|
3080
3308
|
}
|
|
3081
3309
|
),
|
|
3082
|
-
/* @__PURE__ */
|
|
3083
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsx13("span", { children: sourceTokenSymbol }),
|
|
3311
|
+
/* @__PURE__ */ jsx13(
|
|
3084
3312
|
"svg",
|
|
3085
3313
|
{
|
|
3086
3314
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -3088,7 +3316,7 @@ function DepositAddressStep({
|
|
|
3088
3316
|
fill: "none",
|
|
3089
3317
|
stroke: "currentColor",
|
|
3090
3318
|
strokeWidth: "2",
|
|
3091
|
-
children: /* @__PURE__ */
|
|
3319
|
+
children: /* @__PURE__ */ jsx13(
|
|
3092
3320
|
"path",
|
|
3093
3321
|
{
|
|
3094
3322
|
strokeLinecap: "round",
|
|
@@ -3101,7 +3329,7 @@ function DepositAddressStep({
|
|
|
3101
3329
|
]
|
|
3102
3330
|
}
|
|
3103
3331
|
),
|
|
3104
|
-
tokenDropdownOpen && /* @__PURE__ */
|
|
3332
|
+
tokenDropdownOpen && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs12(
|
|
3105
3333
|
"button",
|
|
3106
3334
|
{
|
|
3107
3335
|
type: "button",
|
|
@@ -3111,7 +3339,7 @@ function DepositAddressStep({
|
|
|
3111
3339
|
setTokenDropdownOpen(false);
|
|
3112
3340
|
},
|
|
3113
3341
|
children: [
|
|
3114
|
-
getTokenIcon(symbol) && /* @__PURE__ */
|
|
3342
|
+
getTokenIcon(symbol) && /* @__PURE__ */ jsx13(
|
|
3115
3343
|
"img",
|
|
3116
3344
|
{
|
|
3117
3345
|
src: getTokenIcon(symbol),
|
|
@@ -3119,15 +3347,15 @@ function DepositAddressStep({
|
|
|
3119
3347
|
className: "rs-deposit-address-dropdown-icon"
|
|
3120
3348
|
}
|
|
3121
3349
|
),
|
|
3122
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ jsx13("span", { children: symbol })
|
|
3123
3351
|
]
|
|
3124
3352
|
},
|
|
3125
3353
|
symbol
|
|
3126
3354
|
)) })
|
|
3127
3355
|
] }),
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3130
|
-
/* @__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(
|
|
3131
3359
|
"button",
|
|
3132
3360
|
{
|
|
3133
3361
|
type: "button",
|
|
@@ -3137,7 +3365,7 @@ function DepositAddressStep({
|
|
|
3137
3365
|
setTokenDropdownOpen(false);
|
|
3138
3366
|
},
|
|
3139
3367
|
children: [
|
|
3140
|
-
getChainIcon(sourceChainId) && /* @__PURE__ */
|
|
3368
|
+
getChainIcon(sourceChainId) && /* @__PURE__ */ jsx13(
|
|
3141
3369
|
"img",
|
|
3142
3370
|
{
|
|
3143
3371
|
src: getChainIcon(sourceChainId),
|
|
@@ -3145,8 +3373,8 @@ function DepositAddressStep({
|
|
|
3145
3373
|
className: "rs-deposit-address-dropdown-icon"
|
|
3146
3374
|
}
|
|
3147
3375
|
),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3376
|
+
/* @__PURE__ */ jsx13("span", { children: getChainName(sourceChainId) }),
|
|
3377
|
+
/* @__PURE__ */ jsx13(
|
|
3150
3378
|
"svg",
|
|
3151
3379
|
{
|
|
3152
3380
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -3154,7 +3382,7 @@ function DepositAddressStep({
|
|
|
3154
3382
|
fill: "none",
|
|
3155
3383
|
stroke: "currentColor",
|
|
3156
3384
|
strokeWidth: "2",
|
|
3157
|
-
children: /* @__PURE__ */
|
|
3385
|
+
children: /* @__PURE__ */ jsx13(
|
|
3158
3386
|
"path",
|
|
3159
3387
|
{
|
|
3160
3388
|
strokeLinecap: "round",
|
|
@@ -3167,7 +3395,7 @@ function DepositAddressStep({
|
|
|
3167
3395
|
]
|
|
3168
3396
|
}
|
|
3169
3397
|
),
|
|
3170
|
-
chainDropdownOpen && /* @__PURE__ */
|
|
3398
|
+
chainDropdownOpen && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-dropdown-menu", children: supportedChainIds.map((chainId) => /* @__PURE__ */ jsxs12(
|
|
3171
3399
|
"button",
|
|
3172
3400
|
{
|
|
3173
3401
|
type: "button",
|
|
@@ -3177,7 +3405,7 @@ function DepositAddressStep({
|
|
|
3177
3405
|
setChainDropdownOpen(false);
|
|
3178
3406
|
},
|
|
3179
3407
|
children: [
|
|
3180
|
-
getChainIcon(chainId) && /* @__PURE__ */
|
|
3408
|
+
getChainIcon(chainId) && /* @__PURE__ */ jsx13(
|
|
3181
3409
|
"img",
|
|
3182
3410
|
{
|
|
3183
3411
|
src: getChainIcon(chainId),
|
|
@@ -3185,32 +3413,25 @@ function DepositAddressStep({
|
|
|
3185
3413
|
className: "rs-deposit-address-dropdown-icon"
|
|
3186
3414
|
}
|
|
3187
3415
|
),
|
|
3188
|
-
/* @__PURE__ */
|
|
3416
|
+
/* @__PURE__ */ jsx13("span", { children: getChainName(chainId) })
|
|
3189
3417
|
]
|
|
3190
3418
|
},
|
|
3191
3419
|
chainId
|
|
3192
3420
|
)) })
|
|
3193
3421
|
] })
|
|
3194
3422
|
] }),
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
|
|
3197
|
-
{
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
iconSrc: chainIconSrc
|
|
3201
|
-
}
|
|
3202
|
-
) }),
|
|
3203
|
-
/* @__PURE__ */ jsxs11("div", { className: "rs-deposit-address-info", children: [
|
|
3204
|
-
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-label", children: "Your deposit address" }),
|
|
3205
|
-
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-value", children: smartAccount }),
|
|
3206
|
-
/* @__PURE__ */ jsxs11(
|
|
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(
|
|
3207
3428
|
"button",
|
|
3208
3429
|
{
|
|
3209
3430
|
type: "button",
|
|
3210
3431
|
className: "rs-deposit-address-copy",
|
|
3211
3432
|
onClick: handleCopy,
|
|
3212
3433
|
children: [
|
|
3213
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ jsx13(
|
|
3214
3435
|
"svg",
|
|
3215
3436
|
{
|
|
3216
3437
|
viewBox: "0 0 24 24",
|
|
@@ -3218,14 +3439,14 @@ function DepositAddressStep({
|
|
|
3218
3439
|
stroke: "currentColor",
|
|
3219
3440
|
strokeWidth: "2",
|
|
3220
3441
|
style: { width: 14, height: 14 },
|
|
3221
|
-
children: copied ? /* @__PURE__ */
|
|
3442
|
+
children: copied ? /* @__PURE__ */ jsx13(
|
|
3222
3443
|
"path",
|
|
3223
3444
|
{
|
|
3224
3445
|
strokeLinecap: "round",
|
|
3225
3446
|
strokeLinejoin: "round",
|
|
3226
3447
|
d: "M5 12l5 5L20 7"
|
|
3227
3448
|
}
|
|
3228
|
-
) : /* @__PURE__ */
|
|
3449
|
+
) : /* @__PURE__ */ jsx13(
|
|
3229
3450
|
"path",
|
|
3230
3451
|
{
|
|
3231
3452
|
strokeLinecap: "round",
|
|
@@ -3240,9 +3461,9 @@ function DepositAddressStep({
|
|
|
3240
3461
|
}
|
|
3241
3462
|
)
|
|
3242
3463
|
] }),
|
|
3243
|
-
pollingError && /* @__PURE__ */
|
|
3244
|
-
] }),
|
|
3245
|
-
/* @__PURE__ */
|
|
3464
|
+
pollingError && /* @__PURE__ */ jsx13("div", { className: "rs-deposit-address-error", children: pollingError })
|
|
3465
|
+
] }) }),
|
|
3466
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
3246
3467
|
] });
|
|
3247
3468
|
}
|
|
3248
3469
|
var POLL_INTERVAL_MS;
|
|
@@ -3252,6 +3473,7 @@ var init_DepositAddressStep = __esm({
|
|
|
3252
3473
|
init_QRCode();
|
|
3253
3474
|
init_PoweredBy();
|
|
3254
3475
|
init_constants();
|
|
3476
|
+
init_webhook();
|
|
3255
3477
|
POLL_INTERVAL_MS = 4e3;
|
|
3256
3478
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
3257
3479
|
}
|
|
@@ -3259,7 +3481,7 @@ var init_DepositAddressStep = __esm({
|
|
|
3259
3481
|
|
|
3260
3482
|
// src/DepositFlow.tsx
|
|
3261
3483
|
import { useState as useState7, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
3262
|
-
import { jsx as
|
|
3484
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3263
3485
|
function DepositFlow({
|
|
3264
3486
|
walletClient,
|
|
3265
3487
|
publicClient,
|
|
@@ -3320,6 +3542,13 @@ function DepositFlow({
|
|
|
3320
3542
|
setIsConnectSelectionConfirmed(false);
|
|
3321
3543
|
}
|
|
3322
3544
|
}, [hasConnectWalletOptions]);
|
|
3545
|
+
const handleBackFromDepositAddress = useCallback4(() => {
|
|
3546
|
+
setFlowMode(null);
|
|
3547
|
+
setStep({ type: "setup" });
|
|
3548
|
+
if (hasConnectWalletOptions) {
|
|
3549
|
+
setIsConnectSelectionConfirmed(false);
|
|
3550
|
+
}
|
|
3551
|
+
}, [hasConnectWalletOptions]);
|
|
3323
3552
|
const handleBackFromConfirm = useCallback4(() => {
|
|
3324
3553
|
setStep((prev) => {
|
|
3325
3554
|
if (prev.type !== "confirm") return prev;
|
|
@@ -3332,7 +3561,7 @@ function DepositFlow({
|
|
|
3332
3561
|
});
|
|
3333
3562
|
}, []);
|
|
3334
3563
|
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;
|
|
3335
|
-
const currentBackHandler = step.type === "select-asset" && hasConnectedWallet && hasConnectWalletOptions && isConnectSelectionConfirmed ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3564
|
+
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && hasConnectedWallet && hasConnectWalletOptions && isConnectSelectionConfirmed ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3336
3565
|
useEffect7(() => {
|
|
3337
3566
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
3338
3567
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
@@ -3471,7 +3700,7 @@ function DepositFlow({
|
|
|
3471
3700
|
setIsConnectSelectionConfirmed(false);
|
|
3472
3701
|
}, [connectWalletOptionsKey, selectedConnectAddressEffective]);
|
|
3473
3702
|
if (showConnectStep) {
|
|
3474
|
-
return /* @__PURE__ */
|
|
3703
|
+
return /* @__PURE__ */ jsx14("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx14(
|
|
3475
3704
|
ConnectStep,
|
|
3476
3705
|
{
|
|
3477
3706
|
walletOptions: connectWalletOptions,
|
|
@@ -3495,8 +3724,8 @@ function DepositFlow({
|
|
|
3495
3724
|
return null;
|
|
3496
3725
|
}
|
|
3497
3726
|
if (isDepositAddressMode) {
|
|
3498
|
-
return /* @__PURE__ */
|
|
3499
|
-
step.type === "setup" && targetChainObj && /* @__PURE__ */
|
|
3727
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-modal-body", children: [
|
|
3728
|
+
step.type === "setup" && targetChainObj && /* @__PURE__ */ jsx14(
|
|
3500
3729
|
SetupStep,
|
|
3501
3730
|
{
|
|
3502
3731
|
walletClient,
|
|
@@ -3514,7 +3743,7 @@ function DepositFlow({
|
|
|
3514
3743
|
onError: handleError
|
|
3515
3744
|
}
|
|
3516
3745
|
),
|
|
3517
|
-
step.type === "deposit-address" && /* @__PURE__ */
|
|
3746
|
+
step.type === "deposit-address" && /* @__PURE__ */ jsx14(
|
|
3518
3747
|
DepositAddressStep,
|
|
3519
3748
|
{
|
|
3520
3749
|
smartAccount: step.smartAccount,
|
|
@@ -3523,7 +3752,7 @@ function DepositFlow({
|
|
|
3523
3752
|
onError: handleError
|
|
3524
3753
|
}
|
|
3525
3754
|
),
|
|
3526
|
-
step.type === "processing" && /* @__PURE__ */
|
|
3755
|
+
step.type === "processing" && /* @__PURE__ */ jsx14(
|
|
3527
3756
|
ProcessingStep,
|
|
3528
3757
|
{
|
|
3529
3758
|
smartAccount: step.smartAccount,
|
|
@@ -3544,8 +3773,8 @@ function DepositFlow({
|
|
|
3544
3773
|
)
|
|
3545
3774
|
] });
|
|
3546
3775
|
}
|
|
3547
|
-
return /* @__PURE__ */
|
|
3548
|
-
step.type === "setup" && targetChainObj && /* @__PURE__ */
|
|
3776
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-modal-body", children: [
|
|
3777
|
+
step.type === "setup" && targetChainObj && /* @__PURE__ */ jsx14(
|
|
3549
3778
|
SetupStep,
|
|
3550
3779
|
{
|
|
3551
3780
|
walletClient,
|
|
@@ -3563,13 +3792,11 @@ function DepositFlow({
|
|
|
3563
3792
|
onError: handleError
|
|
3564
3793
|
}
|
|
3565
3794
|
),
|
|
3566
|
-
step.type === "select-asset" && /* @__PURE__ */
|
|
3795
|
+
step.type === "select-asset" && /* @__PURE__ */ jsx14(
|
|
3567
3796
|
AssetSelectStep,
|
|
3568
3797
|
{
|
|
3569
3798
|
address,
|
|
3570
3799
|
publicClient,
|
|
3571
|
-
smartAccount: step.smartAccount,
|
|
3572
|
-
recipient,
|
|
3573
3800
|
defaultSourceChain,
|
|
3574
3801
|
defaultSourceToken,
|
|
3575
3802
|
service,
|
|
@@ -3577,14 +3804,12 @@ function DepositFlow({
|
|
|
3577
3804
|
onTotalBalanceComputed: handleTotalBalanceComputed
|
|
3578
3805
|
}
|
|
3579
3806
|
),
|
|
3580
|
-
step.type === "amount" && /* @__PURE__ */
|
|
3807
|
+
step.type === "amount" && /* @__PURE__ */ jsx14(
|
|
3581
3808
|
AmountStep,
|
|
3582
3809
|
{
|
|
3583
3810
|
walletClient,
|
|
3584
3811
|
publicClient,
|
|
3585
3812
|
address,
|
|
3586
|
-
smartAccount: step.smartAccount,
|
|
3587
|
-
recipient,
|
|
3588
3813
|
asset: step.asset,
|
|
3589
3814
|
defaultAmount: step.amount ?? defaultAmount,
|
|
3590
3815
|
switchChain,
|
|
@@ -3594,13 +3819,12 @@ function DepositFlow({
|
|
|
3594
3819
|
onContinue: handleAmountContinue
|
|
3595
3820
|
}
|
|
3596
3821
|
),
|
|
3597
|
-
step.type === "confirm" && /* @__PURE__ */
|
|
3822
|
+
step.type === "confirm" && /* @__PURE__ */ jsx14(
|
|
3598
3823
|
ConfirmStep,
|
|
3599
3824
|
{
|
|
3600
3825
|
walletClient,
|
|
3601
3826
|
address,
|
|
3602
3827
|
smartAccount: step.smartAccount,
|
|
3603
|
-
recipient,
|
|
3604
3828
|
asset: step.asset,
|
|
3605
3829
|
amount: step.amount,
|
|
3606
3830
|
balance: step.balance,
|
|
@@ -3612,7 +3836,7 @@ function DepositFlow({
|
|
|
3612
3836
|
onError: handleError
|
|
3613
3837
|
}
|
|
3614
3838
|
),
|
|
3615
|
-
step.type === "processing" && /* @__PURE__ */
|
|
3839
|
+
step.type === "processing" && /* @__PURE__ */ jsx14(
|
|
3616
3840
|
ProcessingStep,
|
|
3617
3841
|
{
|
|
3618
3842
|
smartAccount: step.smartAccount,
|
|
@@ -3716,7 +3940,7 @@ import {
|
|
|
3716
3940
|
usePublicClient,
|
|
3717
3941
|
useSwitchChain
|
|
3718
3942
|
} from "wagmi";
|
|
3719
|
-
import { jsx as
|
|
3943
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3720
3944
|
function mapTheme(theme) {
|
|
3721
3945
|
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
3722
3946
|
const themeVariables = {};
|
|
@@ -3755,7 +3979,7 @@ function ReownWalletProvider({
|
|
|
3755
3979
|
const [queryClient] = useState8(() => new QueryClient());
|
|
3756
3980
|
const adapter = getOrCreateAdapter(projectId, theme);
|
|
3757
3981
|
const config = adapter.wagmiConfig;
|
|
3758
|
-
return /* @__PURE__ */
|
|
3982
|
+
return /* @__PURE__ */ jsx15(WagmiProvider, { config, children: /* @__PURE__ */ jsx15(QueryClientProvider, { client: queryClient, children }) });
|
|
3759
3983
|
}
|
|
3760
3984
|
function useReownWallet() {
|
|
3761
3985
|
const { open } = useAppKit();
|
|
@@ -3865,7 +4089,7 @@ __export(DepositModalReown_exports, {
|
|
|
3865
4089
|
DepositModalReown: () => DepositModalReown
|
|
3866
4090
|
});
|
|
3867
4091
|
import { useCallback as useCallback6 } from "react";
|
|
3868
|
-
import { jsx as
|
|
4092
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3869
4093
|
function DepositModalWithReown(props) {
|
|
3870
4094
|
const reown = useReownWallet();
|
|
3871
4095
|
const resolved = useResolvedWallet(
|
|
@@ -3880,7 +4104,7 @@ function DepositModalWithReown(props) {
|
|
|
3880
4104
|
const handleConnect = useCallback6(() => {
|
|
3881
4105
|
reown.openConnect();
|
|
3882
4106
|
}, [reown.openConnect]);
|
|
3883
|
-
return /* @__PURE__ */
|
|
4107
|
+
return /* @__PURE__ */ jsx16(
|
|
3884
4108
|
DepositModalInner,
|
|
3885
4109
|
{
|
|
3886
4110
|
...props,
|
|
@@ -3897,7 +4121,7 @@ function DepositModalWithReown(props) {
|
|
|
3897
4121
|
);
|
|
3898
4122
|
}
|
|
3899
4123
|
function DepositModalReown(props) {
|
|
3900
|
-
return /* @__PURE__ */
|
|
4124
|
+
return /* @__PURE__ */ jsx16(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx16(DepositModalWithReown, { ...props }) });
|
|
3901
4125
|
}
|
|
3902
4126
|
var init_DepositModalReown = __esm({
|
|
3903
4127
|
"src/DepositModalReown.tsx"() {
|
|
@@ -3917,13 +4141,13 @@ import {
|
|
|
3917
4141
|
lazy,
|
|
3918
4142
|
Suspense
|
|
3919
4143
|
} from "react";
|
|
3920
|
-
import { jsx as
|
|
4144
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3921
4145
|
function DepositModal(props) {
|
|
3922
4146
|
const needsReown = !!props.reownAppId;
|
|
3923
4147
|
if (needsReown) {
|
|
3924
|
-
return /* @__PURE__ */
|
|
4148
|
+
return /* @__PURE__ */ jsx17(Suspense, { fallback: null, children: /* @__PURE__ */ jsx17(ReownDepositInner, { ...props }) });
|
|
3925
4149
|
}
|
|
3926
|
-
return /* @__PURE__ */
|
|
4150
|
+
return /* @__PURE__ */ jsx17(DepositModalInner, { ...props });
|
|
3927
4151
|
}
|
|
3928
4152
|
function DepositModalInner({
|
|
3929
4153
|
walletClient,
|
|
@@ -4005,30 +4229,30 @@ function DepositModalInner({
|
|
|
4005
4229
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
4006
4230
|
const title = branding?.title ?? "Deposit";
|
|
4007
4231
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4008
|
-
return /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsx17(
|
|
4009
4233
|
Modal,
|
|
4010
4234
|
{
|
|
4011
4235
|
isOpen,
|
|
4012
4236
|
onClose,
|
|
4013
4237
|
className,
|
|
4014
4238
|
inline,
|
|
4015
|
-
children: /* @__PURE__ */
|
|
4016
|
-
/* @__PURE__ */
|
|
4017
|
-
/* @__PURE__ */
|
|
4239
|
+
children: /* @__PURE__ */ jsxs14("div", { ref: modalRef, className: "rs-modal", children: [
|
|
4240
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header--redesigned", children: [
|
|
4241
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx17(
|
|
4018
4242
|
"button",
|
|
4019
4243
|
{
|
|
4020
4244
|
type: "button",
|
|
4021
4245
|
className: "rs-modal-header-back",
|
|
4022
4246
|
"aria-label": "Go back",
|
|
4023
4247
|
onClick: handleBack,
|
|
4024
|
-
children: /* @__PURE__ */
|
|
4248
|
+
children: /* @__PURE__ */ jsx17(
|
|
4025
4249
|
"svg",
|
|
4026
4250
|
{
|
|
4027
4251
|
viewBox: "0 0 24 24",
|
|
4028
4252
|
fill: "none",
|
|
4029
4253
|
stroke: "currentColor",
|
|
4030
4254
|
strokeWidth: "2",
|
|
4031
|
-
children: /* @__PURE__ */
|
|
4255
|
+
children: /* @__PURE__ */ jsx17(
|
|
4032
4256
|
"path",
|
|
4033
4257
|
{
|
|
4034
4258
|
strokeLinecap: "round",
|
|
@@ -4040,9 +4264,9 @@ function DepositModalInner({
|
|
|
4040
4264
|
)
|
|
4041
4265
|
}
|
|
4042
4266
|
) }),
|
|
4043
|
-
/* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
4267
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-nav-center", children: [
|
|
4268
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-title-row", children: [
|
|
4269
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx17(
|
|
4046
4270
|
"img",
|
|
4047
4271
|
{
|
|
4048
4272
|
src: logoUrl,
|
|
@@ -4053,8 +4277,8 @@ function DepositModalInner({
|
|
|
4053
4277
|
}
|
|
4054
4278
|
}
|
|
4055
4279
|
),
|
|
4056
|
-
/* @__PURE__ */
|
|
4057
|
-
showStepper && /* @__PURE__ */
|
|
4280
|
+
/* @__PURE__ */ jsx17("span", { className: "rs-modal-header-title", children: title }),
|
|
4281
|
+
showStepper && /* @__PURE__ */ jsx17("div", { className: "rs-modal-progress", style: { marginLeft: 8 }, children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx17(
|
|
4058
4282
|
"div",
|
|
4059
4283
|
{
|
|
4060
4284
|
className: `rs-modal-progress-dot ${i <= currentStepIndex ? "rs-modal-progress-dot--active" : "rs-modal-progress-dot--inactive"}`
|
|
@@ -4062,29 +4286,29 @@ function DepositModalInner({
|
|
|
4062
4286
|
i
|
|
4063
4287
|
)) })
|
|
4064
4288
|
] }),
|
|
4065
|
-
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */
|
|
4066
|
-
/* @__PURE__ */
|
|
4289
|
+
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ jsxs14("div", { className: "rs-modal-header-balance", children: [
|
|
4290
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
4067
4291
|
balanceTitle,
|
|
4068
4292
|
":"
|
|
4069
4293
|
] }),
|
|
4070
|
-
/* @__PURE__ */
|
|
4294
|
+
/* @__PURE__ */ jsx17("span", { className: "rs-modal-header-balance-value", children: currencyFormatter.format(totalBalanceUsd) })
|
|
4071
4295
|
] })
|
|
4072
4296
|
] }),
|
|
4073
|
-
/* @__PURE__ */
|
|
4297
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ jsx17(
|
|
4074
4298
|
"button",
|
|
4075
4299
|
{
|
|
4076
4300
|
type: "button",
|
|
4077
4301
|
onClick: onClose,
|
|
4078
4302
|
className: "rs-modal-close",
|
|
4079
4303
|
"aria-label": "Close",
|
|
4080
|
-
children: /* @__PURE__ */
|
|
4304
|
+
children: /* @__PURE__ */ jsx17(
|
|
4081
4305
|
"svg",
|
|
4082
4306
|
{
|
|
4083
4307
|
viewBox: "0 0 24 24",
|
|
4084
4308
|
fill: "none",
|
|
4085
4309
|
stroke: "currentColor",
|
|
4086
4310
|
strokeWidth: "2",
|
|
4087
|
-
children: /* @__PURE__ */
|
|
4311
|
+
children: /* @__PURE__ */ jsx17(
|
|
4088
4312
|
"path",
|
|
4089
4313
|
{
|
|
4090
4314
|
strokeLinecap: "round",
|
|
@@ -4097,7 +4321,7 @@ function DepositModalInner({
|
|
|
4097
4321
|
}
|
|
4098
4322
|
) })
|
|
4099
4323
|
] }),
|
|
4100
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsx17(
|
|
4101
4325
|
DepositFlow,
|
|
4102
4326
|
{
|
|
4103
4327
|
walletClient,
|
|
@@ -4156,7 +4380,7 @@ var init_DepositModal = __esm({
|
|
|
4156
4380
|
// src/components/steps/WithdrawFormStep.tsx
|
|
4157
4381
|
import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo9, useRef as useRef8, useState as useState10 } from "react";
|
|
4158
4382
|
import { erc20Abi as erc20Abi3, formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
4159
|
-
import { jsx as
|
|
4383
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4160
4384
|
function useClickOutside(ref, onClose) {
|
|
4161
4385
|
useEffect9(() => {
|
|
4162
4386
|
function handleClick(e) {
|
|
@@ -4354,12 +4578,12 @@ function WithdrawFormStep({
|
|
|
4354
4578
|
setIsSwitching(false);
|
|
4355
4579
|
}
|
|
4356
4580
|
};
|
|
4357
|
-
return /* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4359
|
-
/* @__PURE__ */
|
|
4360
|
-
/* @__PURE__ */
|
|
4361
|
-
/* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4581
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
4582
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
4583
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-section", children: [
|
|
4584
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Recipient" }),
|
|
4585
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-input-row", children: [
|
|
4586
|
+
/* @__PURE__ */ jsx18(
|
|
4363
4587
|
"input",
|
|
4364
4588
|
{
|
|
4365
4589
|
type: "text",
|
|
@@ -4372,7 +4596,7 @@ function WithdrawFormStep({
|
|
|
4372
4596
|
}
|
|
4373
4597
|
}
|
|
4374
4598
|
),
|
|
4375
|
-
address && /* @__PURE__ */
|
|
4599
|
+
address && /* @__PURE__ */ jsxs15(
|
|
4376
4600
|
"button",
|
|
4377
4601
|
{
|
|
4378
4602
|
type: "button",
|
|
@@ -4380,7 +4604,7 @@ function WithdrawFormStep({
|
|
|
4380
4604
|
onClick: handleUseConnected,
|
|
4381
4605
|
title: isRecipientConnected ? "Using connected wallet" : "Use connected wallet",
|
|
4382
4606
|
children: [
|
|
4383
|
-
/* @__PURE__ */
|
|
4607
|
+
/* @__PURE__ */ jsx18(
|
|
4384
4608
|
"svg",
|
|
4385
4609
|
{
|
|
4386
4610
|
viewBox: "0 0 24 24",
|
|
@@ -4388,7 +4612,7 @@ function WithdrawFormStep({
|
|
|
4388
4612
|
stroke: "currentColor",
|
|
4389
4613
|
strokeWidth: "2",
|
|
4390
4614
|
className: "rs-withdraw-use-connected-icon",
|
|
4391
|
-
children: /* @__PURE__ */
|
|
4615
|
+
children: /* @__PURE__ */ jsx18(
|
|
4392
4616
|
"path",
|
|
4393
4617
|
{
|
|
4394
4618
|
strokeLinecap: "round",
|
|
@@ -4404,10 +4628,10 @@ function WithdrawFormStep({
|
|
|
4404
4628
|
)
|
|
4405
4629
|
] })
|
|
4406
4630
|
] }),
|
|
4407
|
-
/* @__PURE__ */
|
|
4408
|
-
/* @__PURE__ */
|
|
4409
|
-
/* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4631
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-section", children: [
|
|
4632
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Amount" }),
|
|
4633
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-input-row", children: [
|
|
4634
|
+
/* @__PURE__ */ jsx18(
|
|
4411
4635
|
"input",
|
|
4412
4636
|
{
|
|
4413
4637
|
type: "text",
|
|
@@ -4424,9 +4648,9 @@ function WithdrawFormStep({
|
|
|
4424
4648
|
}
|
|
4425
4649
|
}
|
|
4426
4650
|
),
|
|
4427
|
-
/* @__PURE__ */
|
|
4428
|
-
/* @__PURE__ */
|
|
4429
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-amount-right", children: [
|
|
4652
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-withdraw-token-label", children: asset.symbol }),
|
|
4653
|
+
/* @__PURE__ */ jsx18(
|
|
4430
4654
|
"button",
|
|
4431
4655
|
{
|
|
4432
4656
|
type: "button",
|
|
@@ -4438,25 +4662,25 @@ function WithdrawFormStep({
|
|
|
4438
4662
|
)
|
|
4439
4663
|
] })
|
|
4440
4664
|
] }),
|
|
4441
|
-
/* @__PURE__ */
|
|
4442
|
-
/* @__PURE__ */
|
|
4443
|
-
/* @__PURE__ */
|
|
4665
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-amount-info", children: [
|
|
4666
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-withdraw-usd", children: amountUsd !== null ? currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
4667
|
+
/* @__PURE__ */ jsxs15("span", { className: "rs-withdraw-balance", children: [
|
|
4444
4668
|
formattedBalance,
|
|
4445
4669
|
" ",
|
|
4446
4670
|
asset.symbol
|
|
4447
4671
|
] })
|
|
4448
4672
|
] })
|
|
4449
4673
|
] }),
|
|
4450
|
-
/* @__PURE__ */
|
|
4451
|
-
/* @__PURE__ */
|
|
4452
|
-
/* @__PURE__ */
|
|
4453
|
-
/* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-row", children: [
|
|
4675
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-col", children: [
|
|
4676
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Receive" }),
|
|
4677
|
+
/* @__PURE__ */ jsxs15(
|
|
4454
4678
|
"div",
|
|
4455
4679
|
{
|
|
4456
4680
|
className: "rs-withdraw-dropdown-container",
|
|
4457
4681
|
ref: tokenDropdownRef,
|
|
4458
4682
|
children: [
|
|
4459
|
-
/* @__PURE__ */
|
|
4683
|
+
/* @__PURE__ */ jsxs15(
|
|
4460
4684
|
"button",
|
|
4461
4685
|
{
|
|
4462
4686
|
type: "button",
|
|
@@ -4466,8 +4690,8 @@ function WithdrawFormStep({
|
|
|
4466
4690
|
setShowChainDropdown(false);
|
|
4467
4691
|
},
|
|
4468
4692
|
children: [
|
|
4469
|
-
/* @__PURE__ */
|
|
4470
|
-
getTokenIcon(targetSymbol) && /* @__PURE__ */
|
|
4693
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-dropdown-value", children: [
|
|
4694
|
+
getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx18(
|
|
4471
4695
|
"img",
|
|
4472
4696
|
{
|
|
4473
4697
|
src: getTokenIcon(targetSymbol),
|
|
@@ -4475,9 +4699,9 @@ function WithdrawFormStep({
|
|
|
4475
4699
|
className: "rs-withdraw-dropdown-icon"
|
|
4476
4700
|
}
|
|
4477
4701
|
),
|
|
4478
|
-
/* @__PURE__ */
|
|
4702
|
+
/* @__PURE__ */ jsx18("span", { children: targetSymbol })
|
|
4479
4703
|
] }),
|
|
4480
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ jsx18(
|
|
4481
4705
|
"svg",
|
|
4482
4706
|
{
|
|
4483
4707
|
viewBox: "0 0 24 24",
|
|
@@ -4488,7 +4712,7 @@ function WithdrawFormStep({
|
|
|
4488
4712
|
style: {
|
|
4489
4713
|
transform: showTokenDropdown ? "rotate(180deg)" : void 0
|
|
4490
4714
|
},
|
|
4491
|
-
children: /* @__PURE__ */
|
|
4715
|
+
children: /* @__PURE__ */ jsx18(
|
|
4492
4716
|
"path",
|
|
4493
4717
|
{
|
|
4494
4718
|
strokeLinecap: "round",
|
|
@@ -4501,7 +4725,7 @@ function WithdrawFormStep({
|
|
|
4501
4725
|
]
|
|
4502
4726
|
}
|
|
4503
4727
|
),
|
|
4504
|
-
showTokenDropdown && /* @__PURE__ */
|
|
4728
|
+
showTokenDropdown && /* @__PURE__ */ jsx18("div", { className: "rs-withdraw-dropdown-menu", children: targetTokenOptions.map((option) => /* @__PURE__ */ jsxs15(
|
|
4505
4729
|
"button",
|
|
4506
4730
|
{
|
|
4507
4731
|
type: "button",
|
|
@@ -4511,7 +4735,7 @@ function WithdrawFormStep({
|
|
|
4511
4735
|
setShowTokenDropdown(false);
|
|
4512
4736
|
},
|
|
4513
4737
|
children: [
|
|
4514
|
-
getTokenIcon(option.symbol) && /* @__PURE__ */
|
|
4738
|
+
getTokenIcon(option.symbol) && /* @__PURE__ */ jsx18(
|
|
4515
4739
|
"img",
|
|
4516
4740
|
{
|
|
4517
4741
|
src: getTokenIcon(option.symbol),
|
|
@@ -4519,7 +4743,7 @@ function WithdrawFormStep({
|
|
|
4519
4743
|
className: "rs-withdraw-dropdown-icon"
|
|
4520
4744
|
}
|
|
4521
4745
|
),
|
|
4522
|
-
/* @__PURE__ */
|
|
4746
|
+
/* @__PURE__ */ jsx18("span", { children: option.symbol })
|
|
4523
4747
|
]
|
|
4524
4748
|
},
|
|
4525
4749
|
option.address
|
|
@@ -4528,15 +4752,15 @@ function WithdrawFormStep({
|
|
|
4528
4752
|
}
|
|
4529
4753
|
)
|
|
4530
4754
|
] }),
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4533
|
-
/* @__PURE__ */
|
|
4755
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-receive-col", children: [
|
|
4756
|
+
/* @__PURE__ */ jsx18("label", { className: "rs-withdraw-label", children: "Chain" }),
|
|
4757
|
+
/* @__PURE__ */ jsxs15(
|
|
4534
4758
|
"div",
|
|
4535
4759
|
{
|
|
4536
4760
|
className: "rs-withdraw-dropdown-container",
|
|
4537
4761
|
ref: chainDropdownRef,
|
|
4538
4762
|
children: [
|
|
4539
|
-
/* @__PURE__ */
|
|
4763
|
+
/* @__PURE__ */ jsxs15(
|
|
4540
4764
|
"button",
|
|
4541
4765
|
{
|
|
4542
4766
|
type: "button",
|
|
@@ -4546,8 +4770,8 @@ function WithdrawFormStep({
|
|
|
4546
4770
|
setShowTokenDropdown(false);
|
|
4547
4771
|
},
|
|
4548
4772
|
children: [
|
|
4549
|
-
/* @__PURE__ */
|
|
4550
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
4773
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-dropdown-value", children: [
|
|
4774
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx18(
|
|
4551
4775
|
"img",
|
|
4552
4776
|
{
|
|
4553
4777
|
src: getChainIcon(targetChain),
|
|
@@ -4555,9 +4779,9 @@ function WithdrawFormStep({
|
|
|
4555
4779
|
className: "rs-withdraw-dropdown-icon"
|
|
4556
4780
|
}
|
|
4557
4781
|
),
|
|
4558
|
-
/* @__PURE__ */
|
|
4782
|
+
/* @__PURE__ */ jsx18("span", { children: targetChainName })
|
|
4559
4783
|
] }),
|
|
4560
|
-
/* @__PURE__ */
|
|
4784
|
+
/* @__PURE__ */ jsx18(
|
|
4561
4785
|
"svg",
|
|
4562
4786
|
{
|
|
4563
4787
|
viewBox: "0 0 24 24",
|
|
@@ -4568,7 +4792,7 @@ function WithdrawFormStep({
|
|
|
4568
4792
|
style: {
|
|
4569
4793
|
transform: showChainDropdown ? "rotate(180deg)" : void 0
|
|
4570
4794
|
},
|
|
4571
|
-
children: /* @__PURE__ */
|
|
4795
|
+
children: /* @__PURE__ */ jsx18(
|
|
4572
4796
|
"path",
|
|
4573
4797
|
{
|
|
4574
4798
|
strokeLinecap: "round",
|
|
@@ -4581,7 +4805,7 @@ function WithdrawFormStep({
|
|
|
4581
4805
|
]
|
|
4582
4806
|
}
|
|
4583
4807
|
),
|
|
4584
|
-
showChainDropdown && /* @__PURE__ */
|
|
4808
|
+
showChainDropdown && /* @__PURE__ */ jsx18("div", { className: "rs-withdraw-dropdown-menu", children: targetChains.map((chain) => /* @__PURE__ */ jsxs15(
|
|
4585
4809
|
"button",
|
|
4586
4810
|
{
|
|
4587
4811
|
type: "button",
|
|
@@ -4591,7 +4815,7 @@ function WithdrawFormStep({
|
|
|
4591
4815
|
setShowChainDropdown(false);
|
|
4592
4816
|
},
|
|
4593
4817
|
children: [
|
|
4594
|
-
getChainIcon(chain.id) && /* @__PURE__ */
|
|
4818
|
+
getChainIcon(chain.id) && /* @__PURE__ */ jsx18(
|
|
4595
4819
|
"img",
|
|
4596
4820
|
{
|
|
4597
4821
|
src: getChainIcon(chain.id),
|
|
@@ -4599,7 +4823,7 @@ function WithdrawFormStep({
|
|
|
4599
4823
|
className: "rs-withdraw-dropdown-icon"
|
|
4600
4824
|
}
|
|
4601
4825
|
),
|
|
4602
|
-
/* @__PURE__ */
|
|
4826
|
+
/* @__PURE__ */ jsx18("span", { children: chain.name })
|
|
4603
4827
|
]
|
|
4604
4828
|
},
|
|
4605
4829
|
chain.id
|
|
@@ -4609,13 +4833,13 @@ function WithdrawFormStep({
|
|
|
4609
4833
|
)
|
|
4610
4834
|
] })
|
|
4611
4835
|
] }),
|
|
4612
|
-
chainMismatch && /* @__PURE__ */
|
|
4613
|
-
/* @__PURE__ */
|
|
4836
|
+
chainMismatch && /* @__PURE__ */ jsxs15("div", { className: "rs-chain-switch", children: [
|
|
4837
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-chain-switch-text", children: [
|
|
4614
4838
|
"Switch to ",
|
|
4615
4839
|
getChainName(asset.chainId),
|
|
4616
4840
|
" to continue."
|
|
4617
4841
|
] }),
|
|
4618
|
-
switchChain && /* @__PURE__ */
|
|
4842
|
+
switchChain && /* @__PURE__ */ jsx18(
|
|
4619
4843
|
Button,
|
|
4620
4844
|
{
|
|
4621
4845
|
variant: "outline",
|
|
@@ -4626,15 +4850,15 @@ function WithdrawFormStep({
|
|
|
4626
4850
|
}
|
|
4627
4851
|
)
|
|
4628
4852
|
] }),
|
|
4629
|
-
error && /* @__PURE__ */
|
|
4630
|
-
/* @__PURE__ */
|
|
4853
|
+
error && /* @__PURE__ */ jsxs15("div", { className: "rs-withdraw-error", children: [
|
|
4854
|
+
/* @__PURE__ */ jsx18(
|
|
4631
4855
|
"svg",
|
|
4632
4856
|
{
|
|
4633
4857
|
viewBox: "0 0 24 24",
|
|
4634
4858
|
fill: "none",
|
|
4635
4859
|
stroke: "currentColor",
|
|
4636
4860
|
strokeWidth: "2",
|
|
4637
|
-
children: /* @__PURE__ */
|
|
4861
|
+
children: /* @__PURE__ */ jsx18(
|
|
4638
4862
|
"path",
|
|
4639
4863
|
{
|
|
4640
4864
|
strokeLinecap: "round",
|
|
@@ -4644,10 +4868,10 @@ function WithdrawFormStep({
|
|
|
4644
4868
|
)
|
|
4645
4869
|
}
|
|
4646
4870
|
),
|
|
4647
|
-
/* @__PURE__ */
|
|
4871
|
+
/* @__PURE__ */ jsx18("span", { children: error })
|
|
4648
4872
|
] })
|
|
4649
4873
|
] }),
|
|
4650
|
-
/* @__PURE__ */
|
|
4874
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx18(
|
|
4651
4875
|
Button,
|
|
4652
4876
|
{
|
|
4653
4877
|
onClick: handleWithdraw,
|
|
@@ -4657,7 +4881,7 @@ function WithdrawFormStep({
|
|
|
4657
4881
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
4658
4882
|
}
|
|
4659
4883
|
) }),
|
|
4660
|
-
/* @__PURE__ */
|
|
4884
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
4661
4885
|
] });
|
|
4662
4886
|
}
|
|
4663
4887
|
var init_WithdrawFormStep = __esm({
|
|
@@ -4907,9 +5131,10 @@ var init_safe = __esm({
|
|
|
4907
5131
|
|
|
4908
5132
|
// src/WithdrawFlow.tsx
|
|
4909
5133
|
import { useCallback as useCallback9, useEffect as useEffect10, useMemo as useMemo10, useState as useState11 } from "react";
|
|
5134
|
+
import { createPublicClient, http } from "viem";
|
|
4910
5135
|
import { walletClientToAccount as walletClientToAccount2 } from "@rhinestone/sdk";
|
|
4911
5136
|
import { parseUnits as parseUnits4 } from "viem";
|
|
4912
|
-
import { jsx as
|
|
5137
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4913
5138
|
function WithdrawFlow({
|
|
4914
5139
|
walletClient,
|
|
4915
5140
|
publicClient,
|
|
@@ -4934,7 +5159,6 @@ function WithdrawFlow({
|
|
|
4934
5159
|
onWithdrawSign,
|
|
4935
5160
|
onRequestConnect,
|
|
4936
5161
|
connectButtonLabel,
|
|
4937
|
-
uiConfig,
|
|
4938
5162
|
onStepChange,
|
|
4939
5163
|
onTotalBalanceChange,
|
|
4940
5164
|
onClose,
|
|
@@ -4955,6 +5179,12 @@ function WithdrawFlow({
|
|
|
4955
5179
|
setTargetToken(targetTokenProp);
|
|
4956
5180
|
}, [targetChainProp, targetTokenProp]);
|
|
4957
5181
|
const targetChainObj = useMemo10(() => CHAIN_BY_ID[targetChain], [targetChain]);
|
|
5182
|
+
const hasCustomSigner = Boolean(address && onWithdrawSign);
|
|
5183
|
+
const sourceChainObj = useMemo10(() => CHAIN_BY_ID[sourceChain], [sourceChain]);
|
|
5184
|
+
const effectivePublicClient = useMemo10(
|
|
5185
|
+
() => publicClient ?? (sourceChainObj ? createPublicClient({ chain: sourceChainObj, transport: http() }) : null),
|
|
5186
|
+
[publicClient, sourceChainObj]
|
|
5187
|
+
);
|
|
4958
5188
|
const asset = useMemo10(() => {
|
|
4959
5189
|
const symbol = getTokenSymbol(sourceToken, sourceChain);
|
|
4960
5190
|
const decimals = getTokenDecimalsByAddress(sourceToken, sourceChain);
|
|
@@ -5005,7 +5235,10 @@ function WithdrawFlow({
|
|
|
5005
5235
|
}, []);
|
|
5006
5236
|
const handleFormSubmit = useCallback9(
|
|
5007
5237
|
async (recipient, amountValue) => {
|
|
5008
|
-
if (!
|
|
5238
|
+
if (!address) {
|
|
5239
|
+
throw new Error("Wallet not connected");
|
|
5240
|
+
}
|
|
5241
|
+
if (!onWithdrawSign && (!walletClient || !publicClient)) {
|
|
5009
5242
|
throw new Error("Wallet not connected");
|
|
5010
5243
|
}
|
|
5011
5244
|
if (!targetChainObj) {
|
|
@@ -5013,7 +5246,7 @@ function WithdrawFlow({
|
|
|
5013
5246
|
}
|
|
5014
5247
|
setIsSubmitting(true);
|
|
5015
5248
|
try {
|
|
5016
|
-
const signerAccount = walletClientToAccount2(walletClient);
|
|
5249
|
+
const signerAccount = walletClient ? walletClientToAccount2(walletClient) : createViewOnlyAccount(address);
|
|
5017
5250
|
const sessionOwner = await resolveSessionOwner2(address);
|
|
5018
5251
|
const account = await createSmartAccount(
|
|
5019
5252
|
signerAccount,
|
|
@@ -5179,13 +5412,15 @@ function WithdrawFlow({
|
|
|
5179
5412
|
() => (connectWalletOptions ?? []).map((option) => option.address.toLowerCase()).join(","),
|
|
5180
5413
|
[connectWalletOptions]
|
|
5181
5414
|
);
|
|
5182
|
-
const hasConnectedWallet = Boolean(
|
|
5183
|
-
|
|
5415
|
+
const hasConnectedWallet = Boolean(
|
|
5416
|
+
walletClient && publicClient && address || hasCustomSigner
|
|
5417
|
+
);
|
|
5418
|
+
const showConnectStep = !hasConnectedWallet || !hasCustomSigner && hasConnectWalletOptions && !isConnectSelectionConfirmed;
|
|
5184
5419
|
useEffect10(() => {
|
|
5185
5420
|
setIsConnectSelectionConfirmed(false);
|
|
5186
5421
|
}, [connectWalletOptionsKey, selectedConnectAddressEffective]);
|
|
5187
5422
|
if (showConnectStep) {
|
|
5188
|
-
return /* @__PURE__ */
|
|
5423
|
+
return /* @__PURE__ */ jsx19("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx19(
|
|
5189
5424
|
ConnectStep,
|
|
5190
5425
|
{
|
|
5191
5426
|
walletOptions: connectWalletOptions,
|
|
@@ -5198,15 +5433,15 @@ function WithdrawFlow({
|
|
|
5198
5433
|
}
|
|
5199
5434
|
) });
|
|
5200
5435
|
}
|
|
5201
|
-
if (!
|
|
5436
|
+
if (!address || !effectivePublicClient) {
|
|
5202
5437
|
return null;
|
|
5203
5438
|
}
|
|
5204
|
-
return /* @__PURE__ */
|
|
5205
|
-
step.type === "form" && /* @__PURE__ */
|
|
5439
|
+
return /* @__PURE__ */ jsxs16("div", { className: "rs-modal-body", children: [
|
|
5440
|
+
step.type === "form" && /* @__PURE__ */ jsx19(
|
|
5206
5441
|
WithdrawFormStep,
|
|
5207
5442
|
{
|
|
5208
5443
|
walletClient,
|
|
5209
|
-
publicClient,
|
|
5444
|
+
publicClient: effectivePublicClient,
|
|
5210
5445
|
address,
|
|
5211
5446
|
safeAddress,
|
|
5212
5447
|
asset,
|
|
@@ -5224,7 +5459,7 @@ function WithdrawFlow({
|
|
|
5224
5459
|
onBalanceUsdChange: setTotalBalanceUsd
|
|
5225
5460
|
}
|
|
5226
5461
|
),
|
|
5227
|
-
step.type === "processing" && /* @__PURE__ */
|
|
5462
|
+
step.type === "processing" && /* @__PURE__ */ jsx19(
|
|
5228
5463
|
ProcessingStep,
|
|
5229
5464
|
{
|
|
5230
5465
|
smartAccount: step.smartAccount,
|
|
@@ -5266,7 +5501,7 @@ __export(WithdrawModalReown_exports, {
|
|
|
5266
5501
|
WithdrawModalReown: () => WithdrawModalReown
|
|
5267
5502
|
});
|
|
5268
5503
|
import { useCallback as useCallback10 } from "react";
|
|
5269
|
-
import { jsx as
|
|
5504
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
5270
5505
|
function WithdrawModalWithReown(props) {
|
|
5271
5506
|
const reown = useReownWallet();
|
|
5272
5507
|
const resolved = useResolvedWallet(
|
|
@@ -5281,7 +5516,7 @@ function WithdrawModalWithReown(props) {
|
|
|
5281
5516
|
const handleConnect = useCallback10(() => {
|
|
5282
5517
|
reown.openConnect();
|
|
5283
5518
|
}, [reown.openConnect]);
|
|
5284
|
-
return /* @__PURE__ */
|
|
5519
|
+
return /* @__PURE__ */ jsx20(
|
|
5285
5520
|
WithdrawModalInner,
|
|
5286
5521
|
{
|
|
5287
5522
|
...props,
|
|
@@ -5298,7 +5533,7 @@ function WithdrawModalWithReown(props) {
|
|
|
5298
5533
|
);
|
|
5299
5534
|
}
|
|
5300
5535
|
function WithdrawModalReown(props) {
|
|
5301
|
-
return /* @__PURE__ */
|
|
5536
|
+
return /* @__PURE__ */ jsx20(ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ jsx20(WithdrawModalWithReown, { ...props }) });
|
|
5302
5537
|
}
|
|
5303
5538
|
var init_WithdrawModalReown = __esm({
|
|
5304
5539
|
"src/WithdrawModalReown.tsx"() {
|
|
@@ -5318,13 +5553,13 @@ import {
|
|
|
5318
5553
|
lazy as lazy2,
|
|
5319
5554
|
Suspense as Suspense2
|
|
5320
5555
|
} from "react";
|
|
5321
|
-
import { jsx as
|
|
5556
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5322
5557
|
function WithdrawModal(props) {
|
|
5323
5558
|
const needsReown = !!props.reownAppId;
|
|
5324
5559
|
if (needsReown) {
|
|
5325
|
-
return /* @__PURE__ */
|
|
5560
|
+
return /* @__PURE__ */ jsx21(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx21(ReownWithdrawInner, { ...props }) });
|
|
5326
5561
|
}
|
|
5327
|
-
return /* @__PURE__ */
|
|
5562
|
+
return /* @__PURE__ */ jsx21(WithdrawModalInner, { ...props });
|
|
5328
5563
|
}
|
|
5329
5564
|
function WithdrawModalInner({
|
|
5330
5565
|
walletClient,
|
|
@@ -5408,30 +5643,30 @@ function WithdrawModalInner({
|
|
|
5408
5643
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
5409
5644
|
const title = branding?.title ?? "Withdraw";
|
|
5410
5645
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
5411
|
-
return /* @__PURE__ */
|
|
5646
|
+
return /* @__PURE__ */ jsx21(
|
|
5412
5647
|
Modal,
|
|
5413
5648
|
{
|
|
5414
5649
|
isOpen,
|
|
5415
5650
|
onClose,
|
|
5416
5651
|
className,
|
|
5417
5652
|
inline,
|
|
5418
|
-
children: /* @__PURE__ */
|
|
5419
|
-
/* @__PURE__ */
|
|
5420
|
-
/* @__PURE__ */
|
|
5653
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: modalRef, className: "rs-modal", children: [
|
|
5654
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
|
|
5655
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx21(
|
|
5421
5656
|
"button",
|
|
5422
5657
|
{
|
|
5423
5658
|
type: "button",
|
|
5424
5659
|
className: "rs-modal-header-back",
|
|
5425
5660
|
"aria-label": "Go back",
|
|
5426
5661
|
onClick: handleBack,
|
|
5427
|
-
children: /* @__PURE__ */
|
|
5662
|
+
children: /* @__PURE__ */ jsx21(
|
|
5428
5663
|
"svg",
|
|
5429
5664
|
{
|
|
5430
5665
|
viewBox: "0 0 24 24",
|
|
5431
5666
|
fill: "none",
|
|
5432
5667
|
stroke: "currentColor",
|
|
5433
5668
|
strokeWidth: "2",
|
|
5434
|
-
children: /* @__PURE__ */
|
|
5669
|
+
children: /* @__PURE__ */ jsx21(
|
|
5435
5670
|
"path",
|
|
5436
5671
|
{
|
|
5437
5672
|
strokeLinecap: "round",
|
|
@@ -5443,9 +5678,9 @@ function WithdrawModalInner({
|
|
|
5443
5678
|
)
|
|
5444
5679
|
}
|
|
5445
5680
|
) }),
|
|
5446
|
-
/* @__PURE__ */
|
|
5447
|
-
/* @__PURE__ */
|
|
5448
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-center", children: [
|
|
5682
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-title-row", children: [
|
|
5683
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx21(
|
|
5449
5684
|
"img",
|
|
5450
5685
|
{
|
|
5451
5686
|
src: logoUrl,
|
|
@@ -5456,8 +5691,8 @@ function WithdrawModalInner({
|
|
|
5456
5691
|
}
|
|
5457
5692
|
}
|
|
5458
5693
|
),
|
|
5459
|
-
/* @__PURE__ */
|
|
5460
|
-
showStepper && /* @__PURE__ */
|
|
5694
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-title", children: title }),
|
|
5695
|
+
showStepper && /* @__PURE__ */ jsx21("div", { className: "rs-modal-progress", style: { marginLeft: 8 }, children: [0, 1].map((i) => /* @__PURE__ */ jsx21(
|
|
5461
5696
|
"div",
|
|
5462
5697
|
{
|
|
5463
5698
|
className: `rs-modal-progress-dot ${i <= currentStepIndex ? "rs-modal-progress-dot--active" : "rs-modal-progress-dot--inactive"}`
|
|
@@ -5465,26 +5700,26 @@ function WithdrawModalInner({
|
|
|
5465
5700
|
i
|
|
5466
5701
|
)) })
|
|
5467
5702
|
] }),
|
|
5468
|
-
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5470
|
-
/* @__PURE__ */
|
|
5703
|
+
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-balance", children: [
|
|
5704
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-balance-label", children: balanceTitle }),
|
|
5705
|
+
/* @__PURE__ */ jsx21("span", { className: "rs-modal-header-balance-value", children: currencyFormatter.format(totalBalanceUsd) })
|
|
5471
5706
|
] })
|
|
5472
5707
|
] }),
|
|
5473
|
-
/* @__PURE__ */
|
|
5708
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ jsx21(
|
|
5474
5709
|
"button",
|
|
5475
5710
|
{
|
|
5476
5711
|
type: "button",
|
|
5477
5712
|
onClick: onClose,
|
|
5478
5713
|
className: "rs-modal-close",
|
|
5479
5714
|
"aria-label": "Close",
|
|
5480
|
-
children: /* @__PURE__ */
|
|
5715
|
+
children: /* @__PURE__ */ jsx21(
|
|
5481
5716
|
"svg",
|
|
5482
5717
|
{
|
|
5483
5718
|
viewBox: "0 0 24 24",
|
|
5484
5719
|
fill: "none",
|
|
5485
5720
|
stroke: "currentColor",
|
|
5486
5721
|
strokeWidth: "2",
|
|
5487
|
-
children: /* @__PURE__ */
|
|
5722
|
+
children: /* @__PURE__ */ jsx21(
|
|
5488
5723
|
"path",
|
|
5489
5724
|
{
|
|
5490
5725
|
strokeLinecap: "round",
|
|
@@ -5497,7 +5732,7 @@ function WithdrawModalInner({
|
|
|
5497
5732
|
}
|
|
5498
5733
|
) })
|
|
5499
5734
|
] }),
|
|
5500
|
-
/* @__PURE__ */
|
|
5735
|
+
/* @__PURE__ */ jsx21(
|
|
5501
5736
|
WithdrawFlow,
|
|
5502
5737
|
{
|
|
5503
5738
|
walletClient,
|
|
@@ -5523,7 +5758,6 @@ function WithdrawModalInner({
|
|
|
5523
5758
|
onWithdrawSign,
|
|
5524
5759
|
onRequestConnect,
|
|
5525
5760
|
connectButtonLabel,
|
|
5526
|
-
uiConfig,
|
|
5527
5761
|
onStepChange: handleStepChange,
|
|
5528
5762
|
onTotalBalanceChange: handleTotalBalanceChange,
|
|
5529
5763
|
onClose,
|