@rhinestone/deposit-modal 0.0.0-dev-20260901125921 → 0.0.0-dev-20260901162023
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/ClaimModal-5JQHZ6RG.cjs +12 -0
- package/dist/{ClaimModal-GECPNVYW.mjs → ClaimModal-NJEVCXFZ.mjs} +4 -5
- package/dist/{DepositModalReown-7X2P4Q3U.cjs → DepositModalReown-7JUC6U7W.cjs} +18 -18
- package/dist/{DepositModalReown-J5677AO3.mjs → DepositModalReown-THSTSQHI.mjs} +5 -5
- package/dist/{WithdrawModal-EGUXJGKC.mjs → WithdrawModal-DXZYG3HU.mjs} +4 -4
- package/dist/WithdrawModal-VUILQYNT.cjs +12 -0
- package/dist/{chunk-ULDG2NFL.mjs → chunk-DHGJHRBX.mjs} +99 -99
- package/dist/{chunk-URYV6A2L.mjs → chunk-EVAKCGLK.mjs} +2 -2
- package/dist/chunk-FI6F5GUL.cjs +529 -0
- package/dist/{chunk-H4GKLXX7.cjs → chunk-GMYOHPI6.cjs} +73 -220
- package/dist/{chunk-V35JXQDL.mjs → chunk-I32JWFY4.mjs} +444 -126
- package/dist/{chunk-UMHZX3KX.cjs → chunk-J7ZCRY3H.cjs} +172 -172
- package/dist/{chunk-BBHL7Y6Q.cjs → chunk-JICOHQHN.cjs} +65 -65
- package/dist/{chunk-LHVHW2FC.cjs → chunk-MANGCUEL.cjs} +1 -1
- package/dist/{chunk-HEBZWISE.mjs → chunk-OJRBZQIE.mjs} +85 -232
- package/dist/{chunk-GGEX3J6J.cjs → chunk-OPRCCLSY.cjs} +67 -67
- package/dist/{chunk-QO63RXOH.mjs → chunk-PSLNTPKP.mjs} +1 -1
- package/dist/{chunk-76SNGRJ4.cjs → chunk-UU5JG66V.cjs} +662 -344
- package/dist/chunk-VMP2UYAN.mjs +529 -0
- package/dist/{chunk-SSODFKQC.mjs → chunk-ZJKENYOD.mjs} +1 -1
- package/dist/claim.cjs +5 -6
- package/dist/claim.d.cts +2 -2
- package/dist/claim.d.ts +2 -2
- package/dist/claim.mjs +4 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +26 -18
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +16 -8
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -8
- package/dist/styles.css +92 -9
- package/dist/{types-Bho4OA03.d.ts → types-D36e_rVZ.d.ts} +25 -3
- package/dist/{types-DP_3KwlD.d.cts → types-TsOeInuD.d.cts} +25 -3
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +4 -4
- package/package.json +5 -5
- package/dist/ClaimModal-TUIJ2FXZ.cjs +0 -13
- package/dist/WithdrawModal-ZRO4GPL5.cjs +0 -12
- package/dist/chunk-5VTLHOWL.mjs +0 -81
- package/dist/chunk-6NMICTMH.cjs +0 -163
- package/dist/chunk-E26VPCQS.cjs +0 -81
- package/dist/chunk-UIMR4O7B.mjs +0 -163
|
@@ -0,0 +1,529 @@
|
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkJ7ZCRY3Hcjs = require('./chunk-J7ZCRY3H.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkMANGCUELcjs = require('./chunk-MANGCUEL.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
|
|
29
|
+
|
|
30
|
+
// src/components/ui/ListRow.tsx
|
|
31
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
32
|
+
function ListRow({
|
|
33
|
+
leading,
|
|
34
|
+
leadingMedia,
|
|
35
|
+
title,
|
|
36
|
+
subtitle,
|
|
37
|
+
meta,
|
|
38
|
+
trailing,
|
|
39
|
+
action,
|
|
40
|
+
className = "",
|
|
41
|
+
onClick,
|
|
42
|
+
disabled,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
const inner = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
46
|
+
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
47
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-body", children: [
|
|
48
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-text", children: [
|
|
49
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-title", children: title }),
|
|
50
|
+
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-subtitle", children: subtitle })
|
|
51
|
+
] }),
|
|
52
|
+
action ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "rs-list-row-action",
|
|
57
|
+
disabled,
|
|
58
|
+
onClick: (e) => {
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
action.onClick();
|
|
61
|
+
},
|
|
62
|
+
children: action.label
|
|
63
|
+
}
|
|
64
|
+
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.ChevronRightIcon, {})))) })
|
|
67
|
+
] });
|
|
68
|
+
if (action) {
|
|
69
|
+
const handleKey = (e) => {
|
|
70
|
+
if (disabled) return;
|
|
71
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
_optionalChain([onClick, 'optionalCall', _ => _(e)]);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: `rs-list-row ${className}`.trim(),
|
|
80
|
+
role: "button",
|
|
81
|
+
tabIndex: disabled ? -1 : 0,
|
|
82
|
+
"aria-disabled": disabled || void 0,
|
|
83
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _2 => _2(e)]),
|
|
84
|
+
onKeyDown: handleKey,
|
|
85
|
+
children: inner
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
className: `rs-list-row ${className}`.trim(),
|
|
94
|
+
onClick,
|
|
95
|
+
disabled,
|
|
96
|
+
...props,
|
|
97
|
+
children: inner
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
ListRow.displayName = "ListRow";
|
|
102
|
+
|
|
103
|
+
// src/core/history-recovery.ts
|
|
104
|
+
var _viem = require('viem');
|
|
105
|
+
var RECOVERABLE_STATUSES = /* @__PURE__ */ new Set(["failed", "rejected"]);
|
|
106
|
+
function recoverySigningChainId(row) {
|
|
107
|
+
return _chunk4KCSH4T3cjs.parseEvmChainId.call(void 0, row.targetChain);
|
|
108
|
+
}
|
|
109
|
+
function sourceDepositTxHash(row) {
|
|
110
|
+
return _nullishCoalesce(row.sourceTxHash, () => ( row.txHash));
|
|
111
|
+
}
|
|
112
|
+
function toRecoverableDeposit(row, options = {}) {
|
|
113
|
+
if (!row.id) return null;
|
|
114
|
+
if (!RECOVERABLE_STATUSES.has((_nullishCoalesce(row.status, () => ( ""))).toLowerCase())) return null;
|
|
115
|
+
const sourceChainId = _chunk4KCSH4T3cjs.parseEvmChainId.call(void 0, row.chain);
|
|
116
|
+
const targetChainId = recoverySigningChainId(row);
|
|
117
|
+
if (sourceChainId === null || targetChainId === null) return null;
|
|
118
|
+
const signer = row.recipient;
|
|
119
|
+
if (!signer || !_viem.isAddress.call(void 0, signer)) return null;
|
|
120
|
+
if (options.recipient && options.recipient.toLowerCase() !== signer.toLowerCase()) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
depositId: row.id,
|
|
125
|
+
signer,
|
|
126
|
+
destinationPrefill: signer,
|
|
127
|
+
sourceChainId,
|
|
128
|
+
targetChainId,
|
|
129
|
+
token: row.token,
|
|
130
|
+
amountRaw: row.sourceAmount && row.sourceAmount !== "0" ? row.sourceAmount : row.amount,
|
|
131
|
+
sourceTxHash: sourceDepositTxHash(row)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function recoveryFailureCause(sourceChainName) {
|
|
135
|
+
return sourceChainName ? `This deposit couldn't be completed. Your funds are still on ${sourceChainName}.` : "This deposit couldn't be completed and your funds were not moved.";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/components/recovery/recovery-display.ts
|
|
139
|
+
|
|
140
|
+
function describeRecoveryDeposit(params) {
|
|
141
|
+
const token = _nullishCoalesce(params.token, () => ( "0x"));
|
|
142
|
+
const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, token, params.chainId);
|
|
143
|
+
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, token, params.chainId);
|
|
144
|
+
const raw = toBigInt(params.amountRaw);
|
|
145
|
+
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
146
|
+
return {
|
|
147
|
+
symbol,
|
|
148
|
+
decimals,
|
|
149
|
+
amount: _nullishCoalesce(_chunkJ7ZCRY3Hcjs.formatTokenAmount.call(void 0, human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals))),
|
|
150
|
+
chainName: _chunk4KCSH4T3cjs.getChainName.call(void 0, params.chainId),
|
|
151
|
+
chainIcon: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, params.chainId)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
155
|
+
const raw = toBigInt(amountRaw);
|
|
156
|
+
return _nullishCoalesce(_chunkJ7ZCRY3Hcjs.formatTokenAmount.call(void 0, Number(_viem.formatUnits.call(void 0, raw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
157
|
+
}
|
|
158
|
+
function toBigInt(value) {
|
|
159
|
+
try {
|
|
160
|
+
return BigInt(value || "0");
|
|
161
|
+
} catch (e2) {
|
|
162
|
+
return 0n;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function shortenHash(hash) {
|
|
166
|
+
return `${hash.slice(0, 10)}\u2026${hash.slice(-8)}`;
|
|
167
|
+
}
|
|
168
|
+
function shortenAddress(addr) {
|
|
169
|
+
return addr.length > 12 ? `${addr.slice(0, 6)}\u2026${addr.slice(-4)}` : addr;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/components/recovery/RecoveryOutcomeScreen.tsx
|
|
173
|
+
|
|
174
|
+
function RecoveryOutcomeScreen({
|
|
175
|
+
result,
|
|
176
|
+
error,
|
|
177
|
+
children
|
|
178
|
+
}) {
|
|
179
|
+
const success = !!result;
|
|
180
|
+
const explorerTxUrl = _chunkJ7ZCRY3Hcjs.useExplorerTxUrl.call(void 0, );
|
|
181
|
+
const txUrl = result ? explorerTxUrl(result.chainId, result.txHash) : null;
|
|
182
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
183
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
185
|
+
_chunkJ7ZCRY3Hcjs.BodyHeader,
|
|
186
|
+
{
|
|
187
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.AlertTriangleIcon, {}),
|
|
188
|
+
variant: success ? "success" : "error",
|
|
189
|
+
title: success ? "Refund submitted" : "Refund failed",
|
|
190
|
+
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
result ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
194
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
|
|
196
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
197
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
198
|
+
result.amountDisplay,
|
|
199
|
+
" ",
|
|
200
|
+
result.symbol
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.TokenIcon, { symbol: result.symbol }) })
|
|
203
|
+
] })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Sent to" }),
|
|
207
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenAddress(result.destination) })
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Refund transaction" }),
|
|
211
|
+
txUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
212
|
+
"a",
|
|
213
|
+
{
|
|
214
|
+
className: "rs-review-detail-value rs-link",
|
|
215
|
+
href: txUrl,
|
|
216
|
+
target: "_blank",
|
|
217
|
+
rel: "noreferrer",
|
|
218
|
+
children: [
|
|
219
|
+
shortenHash(result.txHash),
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.ExternalLinkIcon, {})
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenHash(result.txHash) })
|
|
224
|
+
] })
|
|
225
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.Callout, { variant: "error", children: error }),
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children })
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.PoweredBy, {})
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
231
|
+
RecoveryOutcomeScreen.displayName = "RecoveryOutcomeScreen";
|
|
232
|
+
|
|
233
|
+
// src/components/ui/Input.tsx
|
|
234
|
+
var _react = require('react');
|
|
235
|
+
|
|
236
|
+
var Input = _react.forwardRef.call(void 0,
|
|
237
|
+
({ label, error, hint, variant, className = "", ...props }, ref) => {
|
|
238
|
+
const inputVariant = error ? "error" : variant || "default";
|
|
239
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-input-wrapper", children: [
|
|
240
|
+
label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "rs-input-label", children: label }),
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
|
+
"input",
|
|
243
|
+
{
|
|
244
|
+
ref,
|
|
245
|
+
className: `rs-input rs-input--${inputVariant} ${className}`,
|
|
246
|
+
...props
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
error ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
250
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
251
|
+
error
|
|
252
|
+
] }) : hint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-input-hint", children: hint })
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
Input.displayName = "Input";
|
|
257
|
+
|
|
258
|
+
// src/components/recovery/RecoveryReviewScreen.tsx
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
function RecoveryReviewScreen({
|
|
263
|
+
chainId,
|
|
264
|
+
token,
|
|
265
|
+
amountRaw,
|
|
266
|
+
txHash,
|
|
267
|
+
defaultDestination,
|
|
268
|
+
destinationHint,
|
|
269
|
+
submitting,
|
|
270
|
+
onSubmit,
|
|
271
|
+
onDestinationInvalid
|
|
272
|
+
}) {
|
|
273
|
+
const { symbol, amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
274
|
+
chainId,
|
|
275
|
+
token,
|
|
276
|
+
amountRaw
|
|
277
|
+
});
|
|
278
|
+
const explorerTxUrl = _chunkJ7ZCRY3Hcjs.useExplorerTxUrl.call(void 0, );
|
|
279
|
+
const [destination, setDestination] = _react.useState.call(void 0,
|
|
280
|
+
_nullishCoalesce(defaultDestination, () => ( ""))
|
|
281
|
+
);
|
|
282
|
+
const destinationValid = _viem.isAddress.call(void 0, destination);
|
|
283
|
+
const onDestinationInvalidRef = _chunkJ7ZCRY3Hcjs.useLatestRef.call(void 0, onDestinationInvalid);
|
|
284
|
+
_react.useEffect.call(void 0, () => {
|
|
285
|
+
if (destination.length > 0 && !destinationValid) {
|
|
286
|
+
_optionalChain([onDestinationInvalidRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4()]);
|
|
287
|
+
}
|
|
288
|
+
}, [destination, destinationValid, onDestinationInvalidRef]);
|
|
289
|
+
const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
|
|
290
|
+
const txShort = txHash ? shortenHash(txHash) : "\u2014";
|
|
291
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
292
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
293
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
294
|
+
_chunkJ7ZCRY3Hcjs.BodyHeader,
|
|
295
|
+
{
|
|
296
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.HandCoinsIcon, {}),
|
|
297
|
+
title: "Review refund",
|
|
298
|
+
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
302
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
|
|
304
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
305
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
306
|
+
amount,
|
|
307
|
+
" ",
|
|
308
|
+
symbol
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.TokenIcon, { symbol }) })
|
|
311
|
+
] })
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
317
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.CdnIcon, { src: chainIcon }) })
|
|
318
|
+
] })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposit transaction" }),
|
|
322
|
+
txUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
323
|
+
"a",
|
|
324
|
+
{
|
|
325
|
+
className: "rs-review-detail-value rs-link",
|
|
326
|
+
href: txUrl,
|
|
327
|
+
target: "_blank",
|
|
328
|
+
rel: "noreferrer",
|
|
329
|
+
children: [
|
|
330
|
+
txShort,
|
|
331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.ExternalLinkIcon, {})
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: txShort })
|
|
335
|
+
] })
|
|
336
|
+
] }),
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
338
|
+
Input,
|
|
339
|
+
{
|
|
340
|
+
label: "Send to",
|
|
341
|
+
placeholder: "0x\u2026",
|
|
342
|
+
value: destination,
|
|
343
|
+
onChange: (e) => setDestination(e.target.value),
|
|
344
|
+
hint: destinationHint,
|
|
345
|
+
error: destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
349
|
+
_chunkJ7ZCRY3Hcjs.Button,
|
|
350
|
+
{
|
|
351
|
+
onClick: () => destinationValid && onSubmit(destination),
|
|
352
|
+
loading: submitting,
|
|
353
|
+
loadingText: "Refunding\u2026",
|
|
354
|
+
disabled: !destinationValid,
|
|
355
|
+
fullWidth: true,
|
|
356
|
+
children: "Claim refund"
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ7ZCRY3Hcjs.PoweredBy, {})
|
|
361
|
+
] });
|
|
362
|
+
}
|
|
363
|
+
RecoveryReviewScreen.displayName = "RecoveryReviewScreen";
|
|
364
|
+
|
|
365
|
+
// src/core/recovery.ts
|
|
366
|
+
var RECOVER_DOMAIN = {
|
|
367
|
+
name: "Rhinestone Deposit Recovery",
|
|
368
|
+
version: "1"
|
|
369
|
+
};
|
|
370
|
+
var RECOVER_TYPES = {
|
|
371
|
+
RecoverDeposit: [
|
|
372
|
+
{ name: "depositId", type: "uint256" },
|
|
373
|
+
{ name: "destination", type: "address" }
|
|
374
|
+
]
|
|
375
|
+
};
|
|
376
|
+
var RecoveryError = class extends Error {
|
|
377
|
+
constructor(message, status, code, retryable = false, phase = "response") {
|
|
378
|
+
super(message);
|
|
379
|
+
this.name = "RecoveryError";
|
|
380
|
+
this.status = status;
|
|
381
|
+
this.code = code;
|
|
382
|
+
this.retryable = retryable;
|
|
383
|
+
this.phase = phase;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
function formatRecoveryError(status, code, serverMessage) {
|
|
387
|
+
switch (code) {
|
|
388
|
+
case "DEPOSIT_NOT_RECOVERABLE":
|
|
389
|
+
return {
|
|
390
|
+
message: "This deposit can't be recovered \u2014 it may already have been claimed.",
|
|
391
|
+
retryable: false
|
|
392
|
+
};
|
|
393
|
+
case "RECOVERY_UNSUPPORTED":
|
|
394
|
+
return {
|
|
395
|
+
message: "This deposit can't be recovered automatically. Contact support to get your funds back.",
|
|
396
|
+
retryable: false
|
|
397
|
+
};
|
|
398
|
+
case "SIGNATURE_INVALID":
|
|
399
|
+
return {
|
|
400
|
+
message: "That signature wasn't accepted for this wallet. Contact support to recover this deposit.",
|
|
401
|
+
retryable: false
|
|
402
|
+
};
|
|
403
|
+
case "VERIFICATION_UNAVAILABLE":
|
|
404
|
+
return {
|
|
405
|
+
message: "Couldn't verify your signature just now. Try again shortly.",
|
|
406
|
+
retryable: true
|
|
407
|
+
};
|
|
408
|
+
case "REFUND_RECONCILIATION_REQUIRED":
|
|
409
|
+
return {
|
|
410
|
+
message: "Your recovery is being reviewed. Contact support with this deposit if it doesn't arrive.",
|
|
411
|
+
retryable: false
|
|
412
|
+
};
|
|
413
|
+
case "REFUND_FAILED":
|
|
414
|
+
return {
|
|
415
|
+
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
416
|
+
retryable: true
|
|
417
|
+
};
|
|
418
|
+
default:
|
|
419
|
+
if (status === 0) {
|
|
420
|
+
return {
|
|
421
|
+
message: "Couldn't reach the recovery service. Check your connection and try again.",
|
|
422
|
+
retryable: true
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
427
|
+
retryable: true
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
async function submitSignedRecovery(params) {
|
|
432
|
+
const { backendUrl, chainId, depositId, signer, destination, signRecovery, debug } = params;
|
|
433
|
+
const scope = "service:recovery";
|
|
434
|
+
const typedData = {
|
|
435
|
+
domain: RECOVER_DOMAIN,
|
|
436
|
+
types: RECOVER_TYPES,
|
|
437
|
+
primaryType: "RecoverDeposit",
|
|
438
|
+
message: { depositId: BigInt(depositId), destination }
|
|
439
|
+
};
|
|
440
|
+
let signature;
|
|
441
|
+
try {
|
|
442
|
+
signature = await signRecovery({
|
|
443
|
+
typedData,
|
|
444
|
+
chainId,
|
|
445
|
+
signer,
|
|
446
|
+
depositId,
|
|
447
|
+
destination
|
|
448
|
+
});
|
|
449
|
+
} catch (error) {
|
|
450
|
+
_chunkJ7ZCRY3Hcjs.debugError.call(void 0, debug, scope, "signRecovery:failed", error);
|
|
451
|
+
throw new RecoveryError(
|
|
452
|
+
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
453
|
+
0,
|
|
454
|
+
void 0,
|
|
455
|
+
true,
|
|
456
|
+
"signature"
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
if (!signature) {
|
|
460
|
+
throw new RecoveryError(
|
|
461
|
+
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
462
|
+
0,
|
|
463
|
+
void 0,
|
|
464
|
+
true,
|
|
465
|
+
"signature"
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
|
|
469
|
+
_chunkJ7ZCRY3Hcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:request", {
|
|
470
|
+
url,
|
|
471
|
+
depositId,
|
|
472
|
+
signer
|
|
473
|
+
});
|
|
474
|
+
let response;
|
|
475
|
+
try {
|
|
476
|
+
response = await fetch(url, {
|
|
477
|
+
method: "POST",
|
|
478
|
+
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
479
|
+
// every other backend call. Without it this path would be invisible in the
|
|
480
|
+
// per-client version telemetry the processor records.
|
|
481
|
+
headers: _chunkMANGCUELcjs.serviceHeaders.call(void 0, ),
|
|
482
|
+
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
483
|
+
// precision well before that range.
|
|
484
|
+
body: JSON.stringify({ depositId, destination, signature })
|
|
485
|
+
});
|
|
486
|
+
} catch (error) {
|
|
487
|
+
_chunkJ7ZCRY3Hcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:network", error);
|
|
488
|
+
const { message, retryable } = formatRecoveryError(0);
|
|
489
|
+
throw new RecoveryError(message, 0, void 0, retryable, "request");
|
|
490
|
+
}
|
|
491
|
+
if (!response.ok) {
|
|
492
|
+
const body = await response.json().catch(() => ({}));
|
|
493
|
+
_chunkJ7ZCRY3Hcjs.debugError.call(void 0, debug, scope, "submitSignedRecovery:failed", body, {
|
|
494
|
+
status: response.status
|
|
495
|
+
});
|
|
496
|
+
const { message, retryable } = formatRecoveryError(
|
|
497
|
+
response.status,
|
|
498
|
+
body.code,
|
|
499
|
+
body.error
|
|
500
|
+
);
|
|
501
|
+
throw new RecoveryError(
|
|
502
|
+
message,
|
|
503
|
+
response.status,
|
|
504
|
+
body.code,
|
|
505
|
+
retryable,
|
|
506
|
+
"response"
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
const result = await response.json();
|
|
510
|
+
_chunkJ7ZCRY3Hcjs.debugLog.call(void 0, debug, scope, "submitSignedRecovery:success", {
|
|
511
|
+
transactionHash: result.transactionHash
|
|
512
|
+
});
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
exports.ListRow = ListRow; exports.recoverySigningChainId = recoverySigningChainId; exports.sourceDepositTxHash = sourceDepositTxHash; exports.toRecoverableDeposit = toRecoverableDeposit; exports.recoveryFailureCause = recoveryFailureCause; exports.describeRecoveryDeposit = describeRecoveryDeposit; exports.formatRecoveryAmount = formatRecoveryAmount; exports.RecoveryOutcomeScreen = RecoveryOutcomeScreen; exports.Input = Input; exports.RecoveryReviewScreen = RecoveryReviewScreen; exports.RecoveryError = RecoveryError; exports.submitSignedRecovery = submitSignedRecovery;
|