@rhinestone/deposit-modal 0.12.1 → 0.13.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/README.md +30 -16
- package/dist/ClaimModal-CREZO27I.mjs +11 -0
- package/dist/ClaimModal-JRIA32U2.cjs +11 -0
- package/dist/{DepositModalReown-SXAXHYTN.mjs → DepositModalReown-3H75G3XQ.mjs} +44 -22
- package/dist/{DepositModalReown-CH6FUTCR.cjs → DepositModalReown-YNNHLAV2.cjs} +57 -35
- package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
- package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
- package/dist/WithdrawModal-NVRX44IZ.mjs +10 -0
- package/dist/WithdrawModal-YYSBPCJJ.cjs +10 -0
- package/dist/{chunk-2BOEUV6B.cjs → chunk-2G2EIN4A.cjs} +1510 -896
- package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
- package/dist/{chunk-UGK4JRK6.cjs → chunk-5NUIKYSF.cjs} +83 -209
- package/dist/{chunk-ZLCY33FQ.cjs → chunk-7N77GIP4.cjs} +102 -88
- package/dist/{chunk-PVWZN66D.mjs → chunk-COCBCQQC.mjs} +121 -86
- package/dist/chunk-CVGNCUVU.cjs +154 -0
- package/dist/{chunk-KPWB2JAX.mjs → chunk-DSIZNRWA.mjs} +1540 -926
- package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
- package/dist/{chunk-2K44IE3V.mjs → chunk-EOMT5LKX.mjs} +374 -151
- package/dist/chunk-FZ5FZFIG.mjs +31 -0
- package/dist/chunk-GACIGCSN.cjs +31 -0
- package/dist/{chunk-TYBMAUGH.cjs → chunk-HOGZKHHY.cjs} +3 -3
- package/dist/{chunk-TQWEGW3A.mjs → chunk-LTMMETAB.mjs} +29 -15
- package/dist/{chunk-O4AXBFHU.mjs → chunk-OLCD75JK.mjs} +20 -146
- package/dist/{chunk-FKHPVLJY.cjs → chunk-RAADLTSW.cjs} +240 -205
- package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
- package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
- package/dist/{chunk-NHGFU3WC.mjs → chunk-XYJFEN5D.mjs} +1 -1
- package/dist/chunk-YREVFB64.mjs +154 -0
- package/dist/{chunk-65MLWUQD.cjs → chunk-ZMT4ATHR.cjs} +437 -214
- package/dist/claim.cjs +7 -6
- package/dist/claim.d.cts +11 -3
- package/dist/claim.d.ts +11 -3
- package/dist/claim.mjs +6 -5
- package/dist/{constants-FuzG3h4m.d.cts → constants-DBrWhJWE.d.cts} +12 -7
- package/dist/{constants-FuzG3h4m.d.ts → constants-DBrWhJWE.d.ts} +12 -7
- package/dist/constants.cjs +3 -9
- package/dist/constants.d.cts +2 -3
- package/dist/constants.d.ts +2 -3
- package/dist/constants.mjs +4 -10
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +7 -7
- package/dist/embed.cjs +1268 -0
- package/dist/embed.d.cts +177 -0
- package/dist/embed.d.ts +177 -0
- package/dist/embed.mjs +1268 -0
- package/dist/index.cjs +11 -16
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +14 -19
- package/dist/modal-ui-state-OD1RmKkK.d.cts +30 -0
- package/dist/modal-ui-state-OD1RmKkK.d.ts +30 -0
- package/dist/polymarket.cjs +17 -7
- package/dist/polymarket.mjs +13 -3
- package/dist/styles.css +133 -98
- package/dist/{types-oFblf65g.d.ts → types-B89I8_8H.d.ts} +27 -1
- package/dist/{types-BO4iP6fG.d.cts → types-nnDR4tqA.d.cts} +27 -1
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +11 -3
- package/dist/withdraw.d.ts +11 -3
- package/dist/withdraw.mjs +5 -5
- package/package.json +33 -1
- package/dist/chunk-DMYA7U53.cjs +0 -11
- package/dist/chunk-O2TQLD4I.mjs +0 -11
|
@@ -1,9 +1,10 @@
|
|
|
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 _chunkTYBMAUGHcjs = require('./chunk-TYBMAUGH.cjs');
|
|
4
3
|
|
|
4
|
+
var _chunkCVGNCUVUcjs = require('./chunk-CVGNCUVU.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkHOGZKHHYcjs = require('./chunk-HOGZKHHY.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
@@ -28,17 +29,15 @@ var _chunkTYBMAUGHcjs = require('./chunk-TYBMAUGH.cjs');
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
var _chunk65MLWUQDcjs = require('./chunk-65MLWUQD.cjs');
|
|
32
32
|
|
|
33
|
+
var _chunkZMT4ATHRcjs = require('./chunk-ZMT4ATHR.cjs');
|
|
33
34
|
|
|
34
|
-
var _chunkDMYA7U53cjs = require('./chunk-DMYA7U53.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
var _chunkO7BCVQ6Lcjs = require('./chunk-O7BCVQ6L.cjs');
|
|
40
|
+
var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
|
|
42
41
|
|
|
43
42
|
// src/ClaimModal.tsx
|
|
44
43
|
|
|
@@ -68,7 +67,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
68
67
|
}
|
|
69
68
|
),
|
|
70
69
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
71
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
70
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
72
71
|
error
|
|
73
72
|
] })
|
|
74
73
|
] });
|
|
@@ -76,142 +75,6 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
76
75
|
);
|
|
77
76
|
Input.displayName = "Input";
|
|
78
77
|
|
|
79
|
-
// src/core/recovery.ts
|
|
80
|
-
var RECOVER_DOMAIN = {
|
|
81
|
-
name: "Rhinestone Deposit Recovery",
|
|
82
|
-
version: "1"
|
|
83
|
-
};
|
|
84
|
-
var RECOVER_TYPES = {
|
|
85
|
-
RecoverDeposit: [
|
|
86
|
-
{ name: "depositId", type: "uint256" },
|
|
87
|
-
{ name: "destination", type: "address" }
|
|
88
|
-
]
|
|
89
|
-
};
|
|
90
|
-
var RecoveryError = class extends Error {
|
|
91
|
-
constructor(message, status, code, retryable = false) {
|
|
92
|
-
super(message);
|
|
93
|
-
this.name = "RecoveryError";
|
|
94
|
-
this.status = status;
|
|
95
|
-
this.code = code;
|
|
96
|
-
this.retryable = retryable;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
function formatRecoveryError(status, code, serverMessage) {
|
|
100
|
-
switch (code) {
|
|
101
|
-
case "DEPOSIT_NOT_RECOVERABLE":
|
|
102
|
-
return {
|
|
103
|
-
message: "This deposit can't be recovered \u2014 it may already have been claimed.",
|
|
104
|
-
retryable: false
|
|
105
|
-
};
|
|
106
|
-
case "RECOVERY_UNSUPPORTED":
|
|
107
|
-
return {
|
|
108
|
-
message: "This deposit can't be recovered automatically. Contact support to get your funds back.",
|
|
109
|
-
retryable: false
|
|
110
|
-
};
|
|
111
|
-
case "SIGNATURE_INVALID":
|
|
112
|
-
return {
|
|
113
|
-
message: "That signature wasn't accepted for this wallet. Contact support to recover this deposit.",
|
|
114
|
-
retryable: false
|
|
115
|
-
};
|
|
116
|
-
case "VERIFICATION_UNAVAILABLE":
|
|
117
|
-
return {
|
|
118
|
-
message: "Couldn't verify your signature just now. Try again shortly.",
|
|
119
|
-
retryable: true
|
|
120
|
-
};
|
|
121
|
-
case "REFUND_RECONCILIATION_REQUIRED":
|
|
122
|
-
return {
|
|
123
|
-
message: "Your recovery is being reviewed. Contact support with this deposit if it doesn't arrive.",
|
|
124
|
-
retryable: false
|
|
125
|
-
};
|
|
126
|
-
case "REFUND_FAILED":
|
|
127
|
-
return {
|
|
128
|
-
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
129
|
-
retryable: true
|
|
130
|
-
};
|
|
131
|
-
default:
|
|
132
|
-
if (status === 0) {
|
|
133
|
-
return {
|
|
134
|
-
message: "Couldn't reach the recovery service. Check your connection and try again.",
|
|
135
|
-
retryable: true
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
140
|
-
retryable: true
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async function submitSignedRecovery(params) {
|
|
145
|
-
const { backendUrl, depositId, signer, destination, signRecovery, debug } = params;
|
|
146
|
-
const scope = "service:recovery";
|
|
147
|
-
const typedData = {
|
|
148
|
-
domain: RECOVER_DOMAIN,
|
|
149
|
-
types: RECOVER_TYPES,
|
|
150
|
-
primaryType: "RecoverDeposit",
|
|
151
|
-
message: { depositId: BigInt(depositId), destination }
|
|
152
|
-
};
|
|
153
|
-
let signature;
|
|
154
|
-
try {
|
|
155
|
-
signature = await signRecovery({ typedData, signer, depositId, destination });
|
|
156
|
-
} catch (error) {
|
|
157
|
-
_chunk65MLWUQDcjs.debugError.call(void 0, debug, scope, "signRecovery:failed", error);
|
|
158
|
-
throw new RecoveryError(
|
|
159
|
-
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
160
|
-
0,
|
|
161
|
-
void 0,
|
|
162
|
-
true
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
if (!signature) {
|
|
166
|
-
throw new RecoveryError(
|
|
167
|
-
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
168
|
-
0,
|
|
169
|
-
void 0,
|
|
170
|
-
true
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
|
|
174
|
-
_chunk65MLWUQDcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:request", {
|
|
175
|
-
url,
|
|
176
|
-
depositId,
|
|
177
|
-
signer
|
|
178
|
-
});
|
|
179
|
-
let response;
|
|
180
|
-
try {
|
|
181
|
-
response = await fetch(url, {
|
|
182
|
-
method: "POST",
|
|
183
|
-
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
184
|
-
// every other backend call. Without it this path would be invisible in the
|
|
185
|
-
// per-client version telemetry the processor records.
|
|
186
|
-
headers: _chunkDMYA7U53cjs.SERVICE_HEADERS,
|
|
187
|
-
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
188
|
-
// precision well before that range.
|
|
189
|
-
body: JSON.stringify({ depositId, destination, signature })
|
|
190
|
-
});
|
|
191
|
-
} catch (error) {
|
|
192
|
-
_chunk65MLWUQDcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:network", error);
|
|
193
|
-
const { message, retryable } = formatRecoveryError(0);
|
|
194
|
-
throw new RecoveryError(message, 0, void 0, retryable);
|
|
195
|
-
}
|
|
196
|
-
if (!response.ok) {
|
|
197
|
-
const body = await response.json().catch(() => ({}));
|
|
198
|
-
_chunk65MLWUQDcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:failed", body, {
|
|
199
|
-
status: response.status
|
|
200
|
-
});
|
|
201
|
-
const { message, retryable } = formatRecoveryError(
|
|
202
|
-
response.status,
|
|
203
|
-
body.code,
|
|
204
|
-
body.error
|
|
205
|
-
);
|
|
206
|
-
throw new RecoveryError(message, response.status, body.code, retryable);
|
|
207
|
-
}
|
|
208
|
-
const result = await response.json();
|
|
209
|
-
_chunk65MLWUQDcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:success", {
|
|
210
|
-
transactionHash: result.transactionHash
|
|
211
|
-
});
|
|
212
|
-
return result;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
78
|
// src/ClaimModal.tsx
|
|
216
79
|
|
|
217
80
|
function evmChainIdFromCaip2(chain) {
|
|
@@ -224,17 +87,17 @@ function isEligible(row) {
|
|
|
224
87
|
}
|
|
225
88
|
function describeDeposit(row) {
|
|
226
89
|
const chainId = _nullishCoalesce(evmChainIdFromCaip2(row.chain), () => ( 0));
|
|
227
|
-
const decimals =
|
|
228
|
-
const symbol =
|
|
90
|
+
const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, row.token, chainId);
|
|
91
|
+
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, row.token, chainId);
|
|
229
92
|
const raw = BigInt(_nullishCoalesce(_nullishCoalesce(row.sourceAmount, () => ( row.amount)), () => ( "0")));
|
|
230
93
|
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
231
|
-
const amount = _nullishCoalesce(
|
|
94
|
+
const amount = _nullishCoalesce(_chunkZMT4ATHRcjs.formatTokenAmount.call(void 0, human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
232
95
|
return {
|
|
233
96
|
chainId,
|
|
234
97
|
symbol,
|
|
235
98
|
amount,
|
|
236
|
-
chainName:
|
|
237
|
-
chainIcon:
|
|
99
|
+
chainName: _chunk4KCSH4T3cjs.getChainName.call(void 0, chainId),
|
|
100
|
+
chainIcon: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, chainId)
|
|
238
101
|
};
|
|
239
102
|
}
|
|
240
103
|
function shortenHash(hash) {
|
|
@@ -323,17 +186,18 @@ function ClaimModal({
|
|
|
323
186
|
onLifecycle,
|
|
324
187
|
onEvent,
|
|
325
188
|
onError,
|
|
326
|
-
debug
|
|
189
|
+
debug,
|
|
190
|
+
onUiState
|
|
327
191
|
}) {
|
|
328
|
-
|
|
192
|
+
_chunkZMT4ATHRcjs.checkBackendUrl.call(void 0, "ClaimModal", backendUrl);
|
|
329
193
|
const modalRef = _react.useRef.call(void 0, null);
|
|
330
|
-
const onReadyRef =
|
|
331
|
-
const onLifecycleRef =
|
|
332
|
-
const onEventRef =
|
|
333
|
-
const onErrorRef =
|
|
334
|
-
const rpcUrls =
|
|
194
|
+
const onReadyRef = _chunkZMT4ATHRcjs.useLatestRef.call(void 0, onReady);
|
|
195
|
+
const onLifecycleRef = _chunkZMT4ATHRcjs.useLatestRef.call(void 0, onLifecycle);
|
|
196
|
+
const onEventRef = _chunkZMT4ATHRcjs.useLatestRef.call(void 0, onEvent);
|
|
197
|
+
const onErrorRef = _chunkZMT4ATHRcjs.useLatestRef.call(void 0, onError);
|
|
198
|
+
const rpcUrls = _chunkZMT4ATHRcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
335
199
|
const service = _react.useMemo.call(void 0,
|
|
336
|
-
() =>
|
|
200
|
+
() => _chunkZMT4ATHRcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:claim" }),
|
|
337
201
|
[backendUrl, debug]
|
|
338
202
|
);
|
|
339
203
|
const [state, dispatch] = _react.useReducer.call(void 0, claimReducer, INITIAL_STATE);
|
|
@@ -341,7 +205,8 @@ function ClaimModal({
|
|
|
341
205
|
const isOpenRef = _react.useRef.call(void 0, isOpen);
|
|
342
206
|
isOpenRef.current = isOpen;
|
|
343
207
|
_react.useEffect.call(void 0, () => {
|
|
344
|
-
if (isOpen
|
|
208
|
+
if (!isOpen || !modalRef.current) return;
|
|
209
|
+
return _chunkZMT4ATHRcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
345
210
|
}, [isOpen, theme]);
|
|
346
211
|
_react.useEffect.call(void 0, () => {
|
|
347
212
|
if (isOpen) {
|
|
@@ -362,9 +227,17 @@ function ClaimModal({
|
|
|
362
227
|
}
|
|
363
228
|
}, [state.step, onClose]);
|
|
364
229
|
const canGoBack = state.step === "select" || state.step === "review" || state.step === "failed";
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
230
|
+
const onUiStateRef = _chunkZMT4ATHRcjs.useLatestRef.call(void 0, onUiState);
|
|
231
|
+
_react.useEffect.call(void 0, () => {
|
|
232
|
+
_optionalChain([onUiStateRef, 'access', _7 => _7.current, 'optionalCall', _8 => _8({
|
|
233
|
+
screen: state.step,
|
|
234
|
+
back: canGoBack ? () => dispatch({ type: "back" }) : void 0,
|
|
235
|
+
submitting: state.step === "processing"
|
|
236
|
+
})]);
|
|
237
|
+
}, [state.step, canGoBack, onUiStateRef]);
|
|
238
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _9 => _9.showBackButton]), () => ( true));
|
|
239
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
+
_chunkZMT4ATHRcjs.Modal,
|
|
368
241
|
{
|
|
369
242
|
isOpen,
|
|
370
243
|
onClose: handleClose,
|
|
@@ -380,7 +253,7 @@ function ClaimModal({
|
|
|
380
253
|
className: "rs-modal-header-back",
|
|
381
254
|
"aria-label": "Go back",
|
|
382
255
|
onClick: () => dispatch({ type: "back" }),
|
|
383
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
256
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.ChevronLeftIcon, {})
|
|
384
257
|
}
|
|
385
258
|
) }),
|
|
386
259
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -391,7 +264,7 @@ function ClaimModal({
|
|
|
391
264
|
disabled: state.step === "processing",
|
|
392
265
|
className: "rs-modal-close",
|
|
393
266
|
"aria-label": "Close",
|
|
394
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
267
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.CloseIcon, {})
|
|
395
268
|
}
|
|
396
269
|
) })
|
|
397
270
|
] }),
|
|
@@ -503,19 +376,20 @@ function ClaimBody({
|
|
|
503
376
|
const operationEpoch = operationEpochRef.current;
|
|
504
377
|
const isCurrentOperation = () => isOpenRef.current && operationEpochRef.current === operationEpoch;
|
|
505
378
|
dispatch({ type: "submit" });
|
|
506
|
-
_optionalChain([onEventRef, 'access',
|
|
379
|
+
_optionalChain([onEventRef, 'access', _10 => _10.current, 'optionalCall', _11 => _11({
|
|
507
380
|
type: "claim_modal_refund_click",
|
|
508
381
|
chain: `eip155:${sourceChainId}`
|
|
509
382
|
})]);
|
|
510
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
383
|
+
_optionalChain([onLifecycleRef, 'access', _12 => _12.current, 'optionalCall', _13 => _13({
|
|
511
384
|
type: "refund_requested",
|
|
512
385
|
account,
|
|
513
386
|
destination,
|
|
514
387
|
chain: sourceChainId
|
|
515
388
|
})]);
|
|
516
389
|
try {
|
|
517
|
-
const result = await submitSignedRecovery({
|
|
390
|
+
const result = await _chunkCVGNCUVUcjs.submitSignedRecovery.call(void 0, {
|
|
518
391
|
backendUrl,
|
|
392
|
+
chainId: sourceChainId,
|
|
519
393
|
depositId: deposit.id,
|
|
520
394
|
signer,
|
|
521
395
|
destination,
|
|
@@ -524,12 +398,12 @@ function ClaimBody({
|
|
|
524
398
|
});
|
|
525
399
|
if (!isCurrentOperation()) return;
|
|
526
400
|
const paidTo = destination;
|
|
527
|
-
const decimals =
|
|
528
|
-
const symbol =
|
|
401
|
+
const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, token, sourceChainId);
|
|
402
|
+
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, token, sourceChainId);
|
|
529
403
|
const refundedRaw = BigInt(
|
|
530
404
|
_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(result.amount, () => ( deposit.sourceAmount)), () => ( deposit.amount)), () => ( "0"))
|
|
531
405
|
);
|
|
532
|
-
const amountDisplay = _nullishCoalesce(
|
|
406
|
+
const amountDisplay = _nullishCoalesce(_chunkZMT4ATHRcjs.formatTokenAmount.call(void 0, Number(_viem.formatUnits.call(void 0, refundedRaw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, refundedRaw, decimals)));
|
|
533
407
|
dispatch({
|
|
534
408
|
type: "complete",
|
|
535
409
|
txHash: result.transactionHash,
|
|
@@ -539,11 +413,11 @@ function ClaimBody({
|
|
|
539
413
|
destination: paidTo,
|
|
540
414
|
chain: sourceChainId
|
|
541
415
|
});
|
|
542
|
-
_optionalChain([onEventRef, 'access',
|
|
416
|
+
_optionalChain([onEventRef, 'access', _14 => _14.current, 'optionalCall', _15 => _15({
|
|
543
417
|
type: "claim_modal_complete",
|
|
544
418
|
chain: `eip155:${sourceChainId}`
|
|
545
419
|
})]);
|
|
546
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
420
|
+
_optionalChain([onLifecycleRef, 'access', _16 => _16.current, 'optionalCall', _17 => _17({
|
|
547
421
|
type: "complete",
|
|
548
422
|
txHash: result.transactionHash,
|
|
549
423
|
account,
|
|
@@ -554,23 +428,23 @@ function ClaimBody({
|
|
|
554
428
|
})]);
|
|
555
429
|
} catch (err) {
|
|
556
430
|
if (!isCurrentOperation()) return;
|
|
557
|
-
const recoveryError = err instanceof RecoveryError ? err : void 0;
|
|
558
|
-
const status = _optionalChain([recoveryError, 'optionalAccess',
|
|
559
|
-
const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
431
|
+
const recoveryError = err instanceof _chunkCVGNCUVUcjs.RecoveryError ? err : void 0;
|
|
432
|
+
const status = _optionalChain([recoveryError, 'optionalAccess', _18 => _18.status]);
|
|
433
|
+
const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _19 => _19.message]), () => ( _chunkZMT4ATHRcjs.formatUserError.call(void 0,
|
|
560
434
|
err instanceof Error ? err.message : "Recovery failed"
|
|
561
435
|
)));
|
|
562
436
|
dispatch({
|
|
563
437
|
type: "failed",
|
|
564
438
|
error: message,
|
|
565
|
-
retryable: _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
439
|
+
retryable: _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _20 => _20.retryable]), () => ( true))
|
|
566
440
|
});
|
|
567
|
-
_optionalChain([onEventRef, 'access',
|
|
441
|
+
_optionalChain([onEventRef, 'access', _21 => _21.current, 'optionalCall', _22 => _22({
|
|
568
442
|
type: "claim_modal_failed",
|
|
569
443
|
chain: `eip155:${sourceChainId}`,
|
|
570
444
|
status
|
|
571
445
|
})]);
|
|
572
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
573
|
-
_optionalChain([onErrorRef, 'access',
|
|
446
|
+
_optionalChain([onLifecycleRef, 'access', _23 => _23.current, 'optionalCall', _24 => _24({ type: "failed", status, error: message })]);
|
|
447
|
+
_optionalChain([onErrorRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26({ message, code: "CLAIM_FAILED" })]);
|
|
574
448
|
}
|
|
575
449
|
}
|
|
576
450
|
}
|
|
@@ -599,12 +473,12 @@ function LookupStep({
|
|
|
599
473
|
txHash: trimmed
|
|
600
474
|
});
|
|
601
475
|
if (!isCurrentOperation()) return;
|
|
602
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
476
|
+
_optionalChain([onLifecycleRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28({
|
|
603
477
|
type: "lookup",
|
|
604
478
|
txHash: trimmed,
|
|
605
479
|
matches: deposits.length
|
|
606
480
|
})]);
|
|
607
|
-
_optionalChain([onEventRef, 'access',
|
|
481
|
+
_optionalChain([onEventRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30({
|
|
608
482
|
type: "claim_modal_lookup",
|
|
609
483
|
matches: deposits.length
|
|
610
484
|
})]);
|
|
@@ -621,11 +495,11 @@ function LookupStep({
|
|
|
621
495
|
onResults(deposits);
|
|
622
496
|
} catch (err) {
|
|
623
497
|
if (!isCurrentOperation()) return;
|
|
624
|
-
const message =
|
|
498
|
+
const message = _chunkZMT4ATHRcjs.formatUserError.call(void 0,
|
|
625
499
|
err instanceof Error ? err.message : "Lookup failed"
|
|
626
500
|
);
|
|
627
501
|
setError(message);
|
|
628
|
-
_optionalChain([onErrorRef, 'access',
|
|
502
|
+
_optionalChain([onErrorRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32({ message, code: "CLAIM_LOOKUP_FAILED" })]);
|
|
629
503
|
} finally {
|
|
630
504
|
if (isCurrentOperation()) setLoading(false);
|
|
631
505
|
}
|
|
@@ -642,9 +516,9 @@ function LookupStep({
|
|
|
642
516
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
643
517
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
644
518
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
645
|
-
|
|
519
|
+
_chunkZMT4ATHRcjs.BodyHeader,
|
|
646
520
|
{
|
|
647
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.HandCoinsIcon, {}),
|
|
648
522
|
title: "Claim a deposit",
|
|
649
523
|
subtitle: "Get funds from a failed deposit sent back to you on the source chain."
|
|
650
524
|
}
|
|
@@ -659,9 +533,9 @@ function LookupStep({
|
|
|
659
533
|
error: trimmed.length > 0 && !validTxHash ? "Enter a valid transaction hash" : void 0
|
|
660
534
|
}
|
|
661
535
|
),
|
|
662
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
536
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Callout, { variant: "error", children: error }),
|
|
663
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
664
|
-
|
|
538
|
+
_chunkZMT4ATHRcjs.Button,
|
|
665
539
|
{
|
|
666
540
|
onClick: handleLookup,
|
|
667
541
|
loading,
|
|
@@ -672,7 +546,7 @@ function LookupStep({
|
|
|
672
546
|
}
|
|
673
547
|
)
|
|
674
548
|
] }),
|
|
675
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.PoweredBy, {})
|
|
676
550
|
] });
|
|
677
551
|
}
|
|
678
552
|
function SelectStep({
|
|
@@ -682,9 +556,9 @@ function SelectStep({
|
|
|
682
556
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
683
557
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
684
558
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
685
|
-
|
|
559
|
+
_chunkZMT4ATHRcjs.BodyHeader,
|
|
686
560
|
{
|
|
687
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
561
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.CoinsIcon, {}),
|
|
688
562
|
title: "Select a deposit",
|
|
689
563
|
subtitle: "This transaction produced multiple deposits. Choose the one to claim."
|
|
690
564
|
}
|
|
@@ -693,9 +567,9 @@ function SelectStep({
|
|
|
693
567
|
const { symbol, amount, chainName } = describeDeposit(row);
|
|
694
568
|
const eligible = isEligible(row);
|
|
695
569
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
696
|
-
|
|
570
|
+
_chunkHOGZKHHYcjs.ListRow,
|
|
697
571
|
{
|
|
698
|
-
leadingMedia:
|
|
572
|
+
leadingMedia: _chunk4KCSH4T3cjs.tokenIconUrl.call(void 0, symbol),
|
|
699
573
|
title: `${amount} ${symbol}`,
|
|
700
574
|
subtitle: chainName,
|
|
701
575
|
meta: eligible ? void 0 : humanizeStatus(row.status),
|
|
@@ -706,7 +580,7 @@ function SelectStep({
|
|
|
706
580
|
);
|
|
707
581
|
}) })
|
|
708
582
|
] }),
|
|
709
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.PoweredBy, {})
|
|
710
584
|
] });
|
|
711
585
|
}
|
|
712
586
|
function ReviewStep({
|
|
@@ -716,15 +590,15 @@ function ReviewStep({
|
|
|
716
590
|
onSubmit
|
|
717
591
|
}) {
|
|
718
592
|
const { chainId, symbol, amount, chainName, chainIcon } = describeDeposit(deposit);
|
|
719
|
-
const explorerTxUrl =
|
|
593
|
+
const explorerTxUrl = _chunkZMT4ATHRcjs.useExplorerTxUrl.call(void 0, );
|
|
720
594
|
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultRefundDestination, () => ( "")));
|
|
721
595
|
const destinationValid = _viem.isAddress.call(void 0, destination);
|
|
722
596
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
723
597
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
724
598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
725
|
-
|
|
599
|
+
_chunkZMT4ATHRcjs.BodyHeader,
|
|
726
600
|
{
|
|
727
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
601
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.HandCoinsIcon, {}),
|
|
728
602
|
title: "Review refund",
|
|
729
603
|
subtitle: "This returns the funds on the source chain. It does not retry the original bridge."
|
|
730
604
|
}
|
|
@@ -738,14 +612,14 @@ function ReviewStep({
|
|
|
738
612
|
" ",
|
|
739
613
|
symbol
|
|
740
614
|
] }),
|
|
741
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.TokenIcon, { symbol }) })
|
|
742
616
|
] })
|
|
743
617
|
] }),
|
|
744
618
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
745
619
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
746
620
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
747
621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
748
|
-
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
622
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.CdnIcon, { src: chainIcon }) })
|
|
749
623
|
] })
|
|
750
624
|
] }),
|
|
751
625
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -762,7 +636,7 @@ function ReviewStep({
|
|
|
762
636
|
rel: "noreferrer",
|
|
763
637
|
children: [
|
|
764
638
|
short,
|
|
765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.ExternalLinkIcon, {})
|
|
766
640
|
]
|
|
767
641
|
}
|
|
768
642
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
@@ -780,7 +654,7 @@ function ReviewStep({
|
|
|
780
654
|
}
|
|
781
655
|
),
|
|
782
656
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
783
|
-
|
|
657
|
+
_chunkZMT4ATHRcjs.Button,
|
|
784
658
|
{
|
|
785
659
|
onClick: () => destinationValid && onSubmit(destination),
|
|
786
660
|
loading: submitting,
|
|
@@ -791,7 +665,7 @@ function ReviewStep({
|
|
|
791
665
|
}
|
|
792
666
|
)
|
|
793
667
|
] }),
|
|
794
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.PoweredBy, {})
|
|
795
669
|
] });
|
|
796
670
|
}
|
|
797
671
|
function ResultStep({
|
|
@@ -802,13 +676,13 @@ function ResultStep({
|
|
|
802
676
|
onRetry
|
|
803
677
|
}) {
|
|
804
678
|
const success = !!result;
|
|
805
|
-
const explorerTxUrl =
|
|
679
|
+
const explorerTxUrl = _chunkZMT4ATHRcjs.useExplorerTxUrl.call(void 0, );
|
|
806
680
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
807
681
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
808
682
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
809
|
-
|
|
683
|
+
_chunkZMT4ATHRcjs.BodyHeader,
|
|
810
684
|
{
|
|
811
|
-
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
685
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.AlertTriangleIcon, {}),
|
|
812
686
|
variant: success ? "success" : "error",
|
|
813
687
|
title: success ? "Refund submitted" : "Refund failed",
|
|
814
688
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -823,7 +697,7 @@ function ResultStep({
|
|
|
823
697
|
" ",
|
|
824
698
|
result.symbol
|
|
825
699
|
] }),
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.TokenIcon, { symbol: result.symbol }) })
|
|
827
701
|
] })
|
|
828
702
|
] }),
|
|
829
703
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -844,22 +718,22 @@ function ResultStep({
|
|
|
844
718
|
rel: "noreferrer",
|
|
845
719
|
children: [
|
|
846
720
|
short,
|
|
847
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.ExternalLinkIcon, {})
|
|
848
722
|
]
|
|
849
723
|
}
|
|
850
724
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
851
725
|
})()
|
|
852
726
|
] })
|
|
853
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
727
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Callout, { variant: "error", children: error }),
|
|
854
728
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children: success ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
855
|
-
onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
856
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
|
+
onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Button, { variant: "outline", onClick: onReset, fullWidth: true, children: "Claim another deposit" }),
|
|
730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
857
731
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
858
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
859
|
-
onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
|
|
733
|
+
onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.Button, { onClick: onRetry, fullWidth: true, children: "Try again" })
|
|
860
734
|
] }) })
|
|
861
735
|
] }),
|
|
862
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.PoweredBy, {})
|
|
863
737
|
] });
|
|
864
738
|
}
|
|
865
739
|
|