@rhinestone/deposit-modal 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-MTWT6Y66.mjs → DepositModalReown-6RVLEM3B.mjs} +96 -26
- package/dist/{DepositModalReown-S3DSFXTX.cjs → DepositModalReown-TXTLVZIQ.cjs} +97 -27
- package/dist/caip-D8aRWdEY.d.cts +40 -0
- package/dist/caip-D8aRWdEY.d.ts +40 -0
- package/dist/{chunk-A223BLVC.mjs → chunk-53IFZGSF.mjs} +177 -21
- package/dist/{chunk-W4YAOJPG.cjs → chunk-7RNEYPI4.cjs} +614 -560
- package/dist/{chunk-UMCDZJMG.cjs → chunk-BLJMYCBF.cjs} +92 -90
- package/dist/{chunk-KW32UBUQ.mjs → chunk-DYTRG4C7.mjs} +1 -1
- package/dist/{chunk-LR7MKHYV.mjs → chunk-G4FVZQOM.mjs} +23 -21
- package/dist/{chunk-DEF767BA.cjs → chunk-GWA6GFTI.cjs} +66 -63
- package/dist/{chunk-A42XAHIB.cjs → chunk-HCQWFL3A.cjs} +84 -101
- package/dist/{chunk-7TV7GLJB.mjs → chunk-ITAYM7SB.mjs} +723 -167
- package/dist/{chunk-YEBXUUH3.cjs → chunk-JPRV36DT.cjs} +2 -2
- package/dist/{chunk-VTVOHNXM.cjs → chunk-JYKMR6QI.cjs} +3 -3
- package/dist/{chunk-ILT2PITN.mjs → chunk-MZ53PDIX.mjs} +1 -1
- package/dist/{chunk-PUJHXHRA.cjs → chunk-NPSC5R22.cjs} +805 -249
- package/dist/{chunk-5OEWGJR4.mjs → chunk-QRR3Y7EK.mjs} +1 -1
- package/dist/{chunk-H577RJN5.cjs → chunk-TENL4H64.cjs} +186 -30
- package/dist/{chunk-MHIOMTMM.mjs → chunk-TRD2FCAR.mjs} +140 -86
- package/dist/{chunk-5NJYW5FT.mjs → chunk-VRNRRN2U.mjs} +12 -9
- package/dist/{chunk-VDGT6NZQ.mjs → chunk-WLDTBKRA.mjs} +14 -31
- package/dist/{chunk-NF4NBRUP.cjs → chunk-XVKBCDZI.cjs} +1 -1
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -2
- package/dist/claim.d.ts +3 -2
- package/dist/claim.mjs +5 -5
- package/dist/{caip-523Zrc3r.d.cts → constants-FuzG3h4m.d.cts} +1 -18
- package/dist/{caip-523Zrc3r.d.ts → constants-FuzG3h4m.d.ts} +1 -18
- package/dist/constants.cjs +5 -3
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +4 -2
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +3 -2
- package/dist/deposit.d.ts +3 -2
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +11 -9
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/{types-C0SGf-21.d.cts → types-C7wag_iL.d.cts} +4 -3
- package/dist/{types-C0SGf-21.d.ts → types-D4b6Cjox.d.ts} +4 -3
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +3 -2
- package/dist/withdraw.d.ts +3 -2
- package/dist/withdraw.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProcessingStep,
|
|
3
3
|
deriveAccountSalt,
|
|
4
|
-
getPublicClient,
|
|
5
4
|
useTokenPrices,
|
|
6
5
|
warnRemovedProps
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WLDTBKRA.mjs";
|
|
8
7
|
import {
|
|
9
8
|
BodyHeader,
|
|
10
9
|
Button,
|
|
11
10
|
Callout,
|
|
12
11
|
CdnIcon,
|
|
12
|
+
ChainCatalogProvider,
|
|
13
13
|
ChevronDownIcon,
|
|
14
14
|
ChevronLeftIcon,
|
|
15
15
|
CircleArrowOutUpLeftIcon,
|
|
@@ -29,23 +29,24 @@ import {
|
|
|
29
29
|
formatTokenAmount,
|
|
30
30
|
formatUserError,
|
|
31
31
|
getAssetId,
|
|
32
|
+
getPublicClient,
|
|
32
33
|
isNativeAsset,
|
|
33
34
|
isRecognizedToken,
|
|
35
|
+
useDestinationChains,
|
|
34
36
|
useLatestRef,
|
|
35
37
|
useRpcUrls,
|
|
36
|
-
useStableRpcUrls
|
|
37
|
-
|
|
38
|
+
useStableRpcUrls,
|
|
39
|
+
useTargetTokens
|
|
40
|
+
} from "./chunk-ITAYM7SB.mjs";
|
|
38
41
|
import {
|
|
39
42
|
NATIVE_TOKEN_ADDRESS,
|
|
40
|
-
SOURCE_CHAINS,
|
|
41
43
|
getChainIcon,
|
|
42
44
|
getChainId,
|
|
43
45
|
getChainName,
|
|
44
|
-
getSupportedTargetTokens,
|
|
45
46
|
getTokenDecimalsByAddress,
|
|
46
47
|
getTokenSymbol,
|
|
47
48
|
targetChainToCaip2
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-53IFZGSF.mjs";
|
|
49
50
|
|
|
50
51
|
// src/WithdrawModal.tsx
|
|
51
52
|
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
|
|
@@ -602,8 +603,13 @@ function WithdrawFormStep({
|
|
|
602
603
|
onClick: handleWithdraw,
|
|
603
604
|
fullWidth: true,
|
|
604
605
|
loading: isBusy,
|
|
605
|
-
disabled: !recipient || !amount || isBusy || Boolean(registrationError)
|
|
606
|
-
|
|
606
|
+
disabled: !recipient || !amount || isBusy || Boolean(registrationError) || // No token list for the selected chain yet. A destination published
|
|
607
|
+
// at runtime becomes selectable as soon as `/chains` resolves, which
|
|
608
|
+
// can precede its addresses; submitting in that window would send
|
|
609
|
+
// the previously selected chain's token address to a chain it does
|
|
610
|
+
// not exist on.
|
|
611
|
+
targetTokenOptions.length === 0,
|
|
612
|
+
children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : targetTokenOptions.length === 0 ? "Loading tokens..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
607
613
|
}
|
|
608
614
|
)
|
|
609
615
|
] }),
|
|
@@ -1137,15 +1143,11 @@ function WithdrawFlow({
|
|
|
1137
1143
|
},
|
|
1138
1144
|
[logFlowError, onLifecycleRef, storeApi]
|
|
1139
1145
|
);
|
|
1140
|
-
const targetChainOptions =
|
|
1141
|
-
|
|
1142
|
-
(chain) => getSupportedTargetTokens(chain.id).length > 0
|
|
1143
|
-
),
|
|
1144
|
-
[]
|
|
1145
|
-
);
|
|
1146
|
+
const targetChainOptions = useDestinationChains();
|
|
1147
|
+
const targetTokensFor = useTargetTokens();
|
|
1146
1148
|
const targetTokenOptions = useMemo2(
|
|
1147
|
-
() =>
|
|
1148
|
-
[targetChain]
|
|
1149
|
+
() => targetTokensFor(targetChain),
|
|
1150
|
+
[targetChain, targetTokensFor]
|
|
1149
1151
|
);
|
|
1150
1152
|
useEffect2(() => {
|
|
1151
1153
|
if (targetTokenOptions.length === 0) return;
|
|
@@ -1157,7 +1159,7 @@ function WithdrawFlow({
|
|
|
1157
1159
|
const handleTargetChainChange = useCallback2(
|
|
1158
1160
|
(chainId) => {
|
|
1159
1161
|
setTargetChain(chainId);
|
|
1160
|
-
const options =
|
|
1162
|
+
const options = targetTokensFor(chainId);
|
|
1161
1163
|
if (options.length === 0) return;
|
|
1162
1164
|
const currentlySupported = options.some(
|
|
1163
1165
|
(option) => option.address.toLowerCase() === targetToken.toLowerCase()
|
|
@@ -1166,7 +1168,7 @@ function WithdrawFlow({
|
|
|
1166
1168
|
currentlySupported ? targetToken : options[0].address
|
|
1167
1169
|
);
|
|
1168
1170
|
},
|
|
1169
|
-
[targetToken]
|
|
1171
|
+
[targetToken, targetTokensFor]
|
|
1170
1172
|
);
|
|
1171
1173
|
const handleTargetTokenChange = useCallback2((token) => {
|
|
1172
1174
|
setTargetToken(token);
|
|
@@ -1328,7 +1330,7 @@ function WithdrawModal({
|
|
|
1328
1330
|
}, []);
|
|
1329
1331
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
1330
1332
|
const canGoBack = backHandler !== void 0;
|
|
1331
|
-
return /* @__PURE__ */ jsx4(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx4(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx4(
|
|
1333
|
+
return /* @__PURE__ */ jsx4(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx4(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx4(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx4(
|
|
1332
1334
|
Modal,
|
|
1333
1335
|
{
|
|
1334
1336
|
isOpen,
|
|
@@ -1382,7 +1384,7 @@ function WithdrawModal({
|
|
|
1382
1384
|
)
|
|
1383
1385
|
] })
|
|
1384
1386
|
}
|
|
1385
|
-
) }) });
|
|
1387
|
+
) }) }) });
|
|
1386
1388
|
}
|
|
1387
1389
|
|
|
1388
1390
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJYKMR6QIcjs = require('./chunk-JYKMR6QI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -26,18 +26,19 @@ var _chunkVTVOHNXMcjs = require('./chunk-VTVOHNXM.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var _chunkPUJHXHRAcjs = require('./chunk-PUJHXHRA.cjs');
|
|
30
29
|
|
|
31
30
|
|
|
32
|
-
var
|
|
31
|
+
var _chunkNPSC5R22cjs = require('./chunk-NPSC5R22.cjs');
|
|
33
32
|
|
|
34
33
|
|
|
34
|
+
var _chunkXVKBCDZIcjs = require('./chunk-XVKBCDZI.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
var _chunkTENL4H64cjs = require('./chunk-TENL4H64.cjs');
|
|
41
42
|
|
|
42
43
|
// src/ClaimModal.tsx
|
|
43
44
|
|
|
@@ -67,7 +68,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
70
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
70
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
71
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
71
72
|
error
|
|
72
73
|
] })
|
|
73
74
|
] });
|
|
@@ -153,7 +154,7 @@ async function submitSignedRecovery(params) {
|
|
|
153
154
|
try {
|
|
154
155
|
signature = await signRecovery({ typedData, signer, depositId, destination });
|
|
155
156
|
} catch (error) {
|
|
156
|
-
|
|
157
|
+
_chunkNPSC5R22cjs.debugError.call(void 0, debug, scope, "signRecovery:failed", error);
|
|
157
158
|
throw new RecoveryError(
|
|
158
159
|
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
159
160
|
0,
|
|
@@ -170,7 +171,7 @@ async function submitSignedRecovery(params) {
|
|
|
170
171
|
);
|
|
171
172
|
}
|
|
172
173
|
const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
|
|
173
|
-
|
|
174
|
+
_chunkNPSC5R22cjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:request", {
|
|
174
175
|
url,
|
|
175
176
|
depositId,
|
|
176
177
|
signer
|
|
@@ -182,19 +183,19 @@ async function submitSignedRecovery(params) {
|
|
|
182
183
|
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
183
184
|
// every other backend call. Without it this path would be invisible in the
|
|
184
185
|
// per-client version telemetry the processor records.
|
|
185
|
-
headers:
|
|
186
|
+
headers: _chunkXVKBCDZIcjs.SERVICE_HEADERS,
|
|
186
187
|
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
187
188
|
// precision well before that range.
|
|
188
189
|
body: JSON.stringify({ depositId, destination, signature })
|
|
189
190
|
});
|
|
190
191
|
} catch (error) {
|
|
191
|
-
|
|
192
|
+
_chunkNPSC5R22cjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:network", error);
|
|
192
193
|
const { message, retryable } = formatRecoveryError(0);
|
|
193
194
|
throw new RecoveryError(message, 0, void 0, retryable);
|
|
194
195
|
}
|
|
195
196
|
if (!response.ok) {
|
|
196
197
|
const body = await response.json().catch(() => ({}));
|
|
197
|
-
|
|
198
|
+
_chunkNPSC5R22cjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:failed", body, {
|
|
198
199
|
status: response.status
|
|
199
200
|
});
|
|
200
201
|
const { message, retryable } = formatRecoveryError(
|
|
@@ -205,7 +206,7 @@ async function submitSignedRecovery(params) {
|
|
|
205
206
|
throw new RecoveryError(message, response.status, body.code, retryable);
|
|
206
207
|
}
|
|
207
208
|
const result = await response.json();
|
|
208
|
-
|
|
209
|
+
_chunkNPSC5R22cjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:success", {
|
|
209
210
|
transactionHash: result.transactionHash
|
|
210
211
|
});
|
|
211
212
|
return result;
|
|
@@ -223,17 +224,17 @@ function isEligible(row) {
|
|
|
223
224
|
}
|
|
224
225
|
function describeDeposit(row) {
|
|
225
226
|
const chainId = _nullishCoalesce(evmChainIdFromCaip2(row.chain), () => ( 0));
|
|
226
|
-
const decimals =
|
|
227
|
-
const symbol =
|
|
227
|
+
const decimals = _chunkTENL4H64cjs.getTokenDecimalsByAddress.call(void 0, row.token, chainId);
|
|
228
|
+
const symbol = _chunkTENL4H64cjs.getTokenSymbol.call(void 0, row.token, chainId);
|
|
228
229
|
const raw = BigInt(_nullishCoalesce(_nullishCoalesce(row.sourceAmount, () => ( row.amount)), () => ( "0")));
|
|
229
230
|
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
230
|
-
const amount = _nullishCoalesce(
|
|
231
|
+
const amount = _nullishCoalesce(_chunkNPSC5R22cjs.formatTokenAmount.call(void 0, human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
231
232
|
return {
|
|
232
233
|
chainId,
|
|
233
234
|
symbol,
|
|
234
235
|
amount,
|
|
235
|
-
chainName:
|
|
236
|
-
chainIcon:
|
|
236
|
+
chainName: _chunkTENL4H64cjs.getChainName.call(void 0, chainId),
|
|
237
|
+
chainIcon: _chunkTENL4H64cjs.getChainIcon.call(void 0, chainId)
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
240
|
function shortenHash(hash) {
|
|
@@ -324,15 +325,15 @@ function ClaimModal({
|
|
|
324
325
|
onError,
|
|
325
326
|
debug
|
|
326
327
|
}) {
|
|
327
|
-
|
|
328
|
+
_chunkNPSC5R22cjs.checkBackendUrl.call(void 0, "ClaimModal", backendUrl);
|
|
328
329
|
const modalRef = _react.useRef.call(void 0, null);
|
|
329
|
-
const onReadyRef =
|
|
330
|
-
const onLifecycleRef =
|
|
331
|
-
const onEventRef =
|
|
332
|
-
const onErrorRef =
|
|
333
|
-
const rpcUrls =
|
|
330
|
+
const onReadyRef = _chunkNPSC5R22cjs.useLatestRef.call(void 0, onReady);
|
|
331
|
+
const onLifecycleRef = _chunkNPSC5R22cjs.useLatestRef.call(void 0, onLifecycle);
|
|
332
|
+
const onEventRef = _chunkNPSC5R22cjs.useLatestRef.call(void 0, onEvent);
|
|
333
|
+
const onErrorRef = _chunkNPSC5R22cjs.useLatestRef.call(void 0, onError);
|
|
334
|
+
const rpcUrls = _chunkNPSC5R22cjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
334
335
|
const service = _react.useMemo.call(void 0,
|
|
335
|
-
() =>
|
|
336
|
+
() => _chunkNPSC5R22cjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:claim" }),
|
|
336
337
|
[backendUrl, debug]
|
|
337
338
|
);
|
|
338
339
|
const [state, dispatch] = _react.useReducer.call(void 0, claimReducer, INITIAL_STATE);
|
|
@@ -340,7 +341,7 @@ function ClaimModal({
|
|
|
340
341
|
const isOpenRef = _react.useRef.call(void 0, isOpen);
|
|
341
342
|
isOpenRef.current = isOpen;
|
|
342
343
|
_react.useEffect.call(void 0, () => {
|
|
343
|
-
if (isOpen && modalRef.current)
|
|
344
|
+
if (isOpen && modalRef.current) _chunkNPSC5R22cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
344
345
|
}, [isOpen, theme]);
|
|
345
346
|
_react.useEffect.call(void 0, () => {
|
|
346
347
|
if (isOpen) {
|
|
@@ -362,8 +363,8 @@ function ClaimModal({
|
|
|
362
363
|
}, [state.step, onClose]);
|
|
363
364
|
const canGoBack = state.step === "select" || state.step === "review" || state.step === "failed";
|
|
364
365
|
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _7 => _7.showBackButton]), () => ( true));
|
|
365
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
366
|
-
|
|
366
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
_chunkNPSC5R22cjs.Modal,
|
|
367
368
|
{
|
|
368
369
|
isOpen,
|
|
369
370
|
onClose: handleClose,
|
|
@@ -379,7 +380,7 @@ function ClaimModal({
|
|
|
379
380
|
className: "rs-modal-header-back",
|
|
380
381
|
"aria-label": "Go back",
|
|
381
382
|
onClick: () => dispatch({ type: "back" }),
|
|
382
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
383
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.ChevronLeftIcon, {})
|
|
383
384
|
}
|
|
384
385
|
) }),
|
|
385
386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -390,7 +391,7 @@ function ClaimModal({
|
|
|
390
391
|
disabled: state.step === "processing",
|
|
391
392
|
className: "rs-modal-close",
|
|
392
393
|
"aria-label": "Close",
|
|
393
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
394
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.CloseIcon, {})
|
|
394
395
|
}
|
|
395
396
|
) })
|
|
396
397
|
] }),
|
|
@@ -415,7 +416,7 @@ function ClaimModal({
|
|
|
415
416
|
) })
|
|
416
417
|
] })
|
|
417
418
|
}
|
|
418
|
-
) });
|
|
419
|
+
) }) });
|
|
419
420
|
}
|
|
420
421
|
function ClaimBody({
|
|
421
422
|
state,
|
|
@@ -523,12 +524,12 @@ function ClaimBody({
|
|
|
523
524
|
});
|
|
524
525
|
if (!isCurrentOperation()) return;
|
|
525
526
|
const paidTo = destination;
|
|
526
|
-
const decimals =
|
|
527
|
-
const symbol =
|
|
527
|
+
const decimals = _chunkTENL4H64cjs.getTokenDecimalsByAddress.call(void 0, token, sourceChainId);
|
|
528
|
+
const symbol = _chunkTENL4H64cjs.getTokenSymbol.call(void 0, token, sourceChainId);
|
|
528
529
|
const refundedRaw = BigInt(
|
|
529
530
|
_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(result.amount, () => ( deposit.sourceAmount)), () => ( deposit.amount)), () => ( "0"))
|
|
530
531
|
);
|
|
531
|
-
const amountDisplay = _nullishCoalesce(
|
|
532
|
+
const amountDisplay = _nullishCoalesce(_chunkNPSC5R22cjs.formatTokenAmount.call(void 0, Number(_viem.formatUnits.call(void 0, refundedRaw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, refundedRaw, decimals)));
|
|
532
533
|
dispatch({
|
|
533
534
|
type: "complete",
|
|
534
535
|
txHash: result.transactionHash,
|
|
@@ -555,7 +556,7 @@ function ClaimBody({
|
|
|
555
556
|
if (!isCurrentOperation()) return;
|
|
556
557
|
const recoveryError = err instanceof RecoveryError ? err : void 0;
|
|
557
558
|
const status = _optionalChain([recoveryError, 'optionalAccess', _16 => _16.status]);
|
|
558
|
-
const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _17 => _17.message]), () => (
|
|
559
|
+
const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _17 => _17.message]), () => ( _chunkNPSC5R22cjs.formatUserError.call(void 0,
|
|
559
560
|
err instanceof Error ? err.message : "Recovery failed"
|
|
560
561
|
)));
|
|
561
562
|
dispatch({
|
|
@@ -620,7 +621,7 @@ function LookupStep({
|
|
|
620
621
|
onResults(deposits);
|
|
621
622
|
} catch (err) {
|
|
622
623
|
if (!isCurrentOperation()) return;
|
|
623
|
-
const message =
|
|
624
|
+
const message = _chunkNPSC5R22cjs.formatUserError.call(void 0,
|
|
624
625
|
err instanceof Error ? err.message : "Lookup failed"
|
|
625
626
|
);
|
|
626
627
|
setError(message);
|
|
@@ -641,9 +642,9 @@ function LookupStep({
|
|
|
641
642
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
642
643
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
643
644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
-
|
|
645
|
+
_chunkNPSC5R22cjs.BodyHeader,
|
|
645
646
|
{
|
|
646
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.HandCoinsIcon, {}),
|
|
647
648
|
title: "Claim a deposit",
|
|
648
649
|
subtitle: "Get funds from a failed deposit sent back to you on the source chain."
|
|
649
650
|
}
|
|
@@ -658,9 +659,9 @@ function LookupStep({
|
|
|
658
659
|
error: trimmed.length > 0 && !validTxHash ? "Enter a valid transaction hash" : void 0
|
|
659
660
|
}
|
|
660
661
|
),
|
|
661
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
662
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Callout, { variant: "error", children: error }),
|
|
662
663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
-
|
|
664
|
+
_chunkNPSC5R22cjs.Button,
|
|
664
665
|
{
|
|
665
666
|
onClick: handleLookup,
|
|
666
667
|
loading,
|
|
@@ -671,7 +672,7 @@ function LookupStep({
|
|
|
671
672
|
}
|
|
672
673
|
)
|
|
673
674
|
] }),
|
|
674
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.PoweredBy, {})
|
|
675
676
|
] });
|
|
676
677
|
}
|
|
677
678
|
function SelectStep({
|
|
@@ -681,9 +682,9 @@ function SelectStep({
|
|
|
681
682
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
682
683
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
683
684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
684
|
-
|
|
685
|
+
_chunkNPSC5R22cjs.BodyHeader,
|
|
685
686
|
{
|
|
686
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.CoinsIcon, {}),
|
|
687
688
|
title: "Select a deposit",
|
|
688
689
|
subtitle: "This transaction produced multiple deposits. Choose the one to claim."
|
|
689
690
|
}
|
|
@@ -692,9 +693,9 @@ function SelectStep({
|
|
|
692
693
|
const { symbol, amount, chainName } = describeDeposit(row);
|
|
693
694
|
const eligible = isEligible(row);
|
|
694
695
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
695
|
-
|
|
696
|
+
_chunkJYKMR6QIcjs.ListRow,
|
|
696
697
|
{
|
|
697
|
-
leadingMedia:
|
|
698
|
+
leadingMedia: _chunkTENL4H64cjs.tokenIconUrl.call(void 0, symbol),
|
|
698
699
|
title: `${amount} ${symbol}`,
|
|
699
700
|
subtitle: chainName,
|
|
700
701
|
meta: eligible ? void 0 : humanizeStatus(row.status),
|
|
@@ -705,7 +706,7 @@ function SelectStep({
|
|
|
705
706
|
);
|
|
706
707
|
}) })
|
|
707
708
|
] }),
|
|
708
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
709
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.PoweredBy, {})
|
|
709
710
|
] });
|
|
710
711
|
}
|
|
711
712
|
function ReviewStep({
|
|
@@ -715,14 +716,15 @@ function ReviewStep({
|
|
|
715
716
|
onSubmit
|
|
716
717
|
}) {
|
|
717
718
|
const { chainId, symbol, amount, chainName, chainIcon } = describeDeposit(deposit);
|
|
719
|
+
const explorerTxUrl = _chunkNPSC5R22cjs.useExplorerTxUrl.call(void 0, );
|
|
718
720
|
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultRefundDestination, () => ( "")));
|
|
719
721
|
const destinationValid = _viem.isAddress.call(void 0, destination);
|
|
720
722
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
721
723
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
722
724
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
723
|
-
|
|
725
|
+
_chunkNPSC5R22cjs.BodyHeader,
|
|
724
726
|
{
|
|
725
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
727
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.HandCoinsIcon, {}),
|
|
726
728
|
title: "Review refund",
|
|
727
729
|
subtitle: "This returns the funds on the source chain. It does not retry the original bridge."
|
|
728
730
|
}
|
|
@@ -736,20 +738,20 @@ function ReviewStep({
|
|
|
736
738
|
" ",
|
|
737
739
|
symbol
|
|
738
740
|
] }),
|
|
739
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
741
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.TokenIcon, { symbol }) })
|
|
740
742
|
] })
|
|
741
743
|
] }),
|
|
742
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
743
745
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
744
746
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
745
747
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
746
|
-
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
748
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.CdnIcon, { src: chainIcon }) })
|
|
747
749
|
] })
|
|
748
750
|
] }),
|
|
749
751
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
750
752
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposit transaction" }),
|
|
751
753
|
(() => {
|
|
752
|
-
const url = deposit.txHash ?
|
|
754
|
+
const url = deposit.txHash ? explorerTxUrl(chainId, deposit.txHash) : null;
|
|
753
755
|
const short = deposit.txHash ? shortenHash(deposit.txHash) : "\u2014";
|
|
754
756
|
return url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
755
757
|
"a",
|
|
@@ -760,7 +762,7 @@ function ReviewStep({
|
|
|
760
762
|
rel: "noreferrer",
|
|
761
763
|
children: [
|
|
762
764
|
short,
|
|
763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.ExternalLinkIcon, {})
|
|
764
766
|
]
|
|
765
767
|
}
|
|
766
768
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
@@ -778,7 +780,7 @@ function ReviewStep({
|
|
|
778
780
|
}
|
|
779
781
|
),
|
|
780
782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
781
|
-
|
|
783
|
+
_chunkNPSC5R22cjs.Button,
|
|
782
784
|
{
|
|
783
785
|
onClick: () => destinationValid && onSubmit(destination),
|
|
784
786
|
loading: submitting,
|
|
@@ -789,7 +791,7 @@ function ReviewStep({
|
|
|
789
791
|
}
|
|
790
792
|
)
|
|
791
793
|
] }),
|
|
792
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
794
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.PoweredBy, {})
|
|
793
795
|
] });
|
|
794
796
|
}
|
|
795
797
|
function ResultStep({
|
|
@@ -800,12 +802,13 @@ function ResultStep({
|
|
|
800
802
|
onRetry
|
|
801
803
|
}) {
|
|
802
804
|
const success = !!result;
|
|
805
|
+
const explorerTxUrl = _chunkNPSC5R22cjs.useExplorerTxUrl.call(void 0, );
|
|
803
806
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
804
807
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
805
808
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
806
|
-
|
|
809
|
+
_chunkNPSC5R22cjs.BodyHeader,
|
|
807
810
|
{
|
|
808
|
-
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.AlertTriangleIcon, {}),
|
|
809
812
|
variant: success ? "success" : "error",
|
|
810
813
|
title: success ? "Refund submitted" : "Refund failed",
|
|
811
814
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -820,7 +823,7 @@ function ResultStep({
|
|
|
820
823
|
" ",
|
|
821
824
|
result.symbol
|
|
822
825
|
] }),
|
|
823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.TokenIcon, { symbol: result.symbol }) })
|
|
824
827
|
] })
|
|
825
828
|
] }),
|
|
826
829
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -830,7 +833,7 @@ function ResultStep({
|
|
|
830
833
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
831
834
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Transaction" }),
|
|
832
835
|
(() => {
|
|
833
|
-
const url =
|
|
836
|
+
const url = explorerTxUrl(result.chain, result.txHash);
|
|
834
837
|
const short = shortenHash(result.txHash);
|
|
835
838
|
return url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
836
839
|
"a",
|
|
@@ -841,22 +844,22 @@ function ResultStep({
|
|
|
841
844
|
rel: "noreferrer",
|
|
842
845
|
children: [
|
|
843
846
|
short,
|
|
844
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
847
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.ExternalLinkIcon, {})
|
|
845
848
|
]
|
|
846
849
|
}
|
|
847
850
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
848
851
|
})()
|
|
849
852
|
] })
|
|
850
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
853
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Callout, { variant: "error", children: error }),
|
|
851
854
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children: success ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
852
|
-
onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
853
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
855
|
+
onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Button, { variant: "outline", onClick: onReset, fullWidth: true, children: "Claim another deposit" }),
|
|
856
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
854
857
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
855
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
856
|
-
onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
858
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
|
|
859
|
+
onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.Button, { onClick: onRetry, fullWidth: true, children: "Try again" })
|
|
857
860
|
] }) })
|
|
858
861
|
] }),
|
|
859
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
862
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.PoweredBy, {})
|
|
860
863
|
] });
|
|
861
864
|
}
|
|
862
865
|
|