@rhinestone/deposit-modal 0.19.0 → 0.20.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 +151 -61
- package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
- package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
- package/dist/{DepositModalReown-XBNY6QCI.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
- package/dist/{DepositModalReown-UITYXJ6W.cjs → DepositModalReown-ALVWADG7.cjs} +21 -20
- package/dist/WithdrawModal-5YWFJSYY.cjs +12 -0
- package/dist/WithdrawModal-LL4Z5WZP.mjs +12 -0
- package/dist/{bearer-transport-CVHNBgoV.d.cts → bearer-transport-DZyeDG64.d.cts} +5 -1
- package/dist/{bearer-transport-CVHNBgoV.d.ts → bearer-transport-DZyeDG64.d.ts} +5 -1
- package/dist/{caip-BMi-9t09.d.cts → caip-nwFFL46o.d.cts} +2 -2
- package/dist/{caip-BMi-9t09.d.ts → caip-nwFFL46o.d.ts} +2 -2
- package/dist/{chunk-NITKDXHR.mjs → chunk-247GJH57.mjs} +480 -272
- package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-5NWLS5BQ.mjs → chunk-32ERBFMO.mjs} +1432 -961
- package/dist/chunk-5QUWEFD4.mjs +19 -0
- package/dist/chunk-6CTJFR3T.mjs +113 -0
- package/dist/{chunk-X6N2XPTO.mjs → chunk-B2LZQIGB.mjs} +1 -1
- package/dist/{chunk-EG4H7OMC.cjs → chunk-BTEG2VNZ.cjs} +171 -130
- package/dist/{chunk-HMUGY66O.cjs → chunk-CXRH5MKO.cjs} +1502 -1031
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/{chunk-PYOC6K24.cjs → chunk-EKFXUF5A.cjs} +1 -1
- package/dist/chunk-FKJ6EJHH.cjs +346 -0
- package/dist/chunk-FMUSY563.cjs +19 -0
- package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
- package/dist/chunk-G264OM23.cjs +224 -0
- package/dist/{chunk-BIL4ENC3.mjs → chunk-HP7S7AD6.mjs} +73 -32
- package/dist/{chunk-ISLVD5HQ.cjs → chunk-OPT5EW6L.cjs} +10 -5
- package/dist/chunk-PYRXOP2Y.cjs +113 -0
- package/dist/{chunk-ZGHVJ2XM.mjs → chunk-XBJCZYBX.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-OCWSMLOP.cjs → chunk-Z4RBTNKX.cjs} +980 -772
- package/dist/compliance.cjs +4 -7
- package/dist/compliance.d.cts +26 -3
- package/dist/compliance.d.ts +26 -3
- package/dist/compliance.mjs +6 -9
- package/dist/constants-BQDxVNgr.d.cts +29 -0
- package/dist/constants-DjGQW5N5.d.ts +29 -0
- package/dist/constants.cjs +3 -37
- package/dist/constants.d.cts +4 -20
- package/dist/constants.d.ts +4 -20
- package/dist/constants.mjs +4 -38
- package/dist/deposit.cjs +7 -6
- package/dist/deposit.d.cts +5 -3
- package/dist/deposit.d.ts +5 -3
- package/dist/deposit.mjs +6 -5
- package/dist/embed.cjs +21 -20
- package/dist/embed.d.cts +3 -2
- package/dist/embed.d.ts +3 -2
- package/dist/embed.mjs +7 -6
- package/dist/index.cjs +8 -35
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +9 -36
- package/dist/onramp.cjs +4 -33
- package/dist/onramp.d.cts +51 -33
- package/dist/onramp.d.ts +51 -33
- package/dist/onramp.mjs +5 -34
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/ramp-types-HYWd7CW0.d.cts +108 -0
- package/dist/ramp-types-HYWd7CW0.d.ts +108 -0
- package/dist/styles.css +255 -0
- package/dist/{types-BShYNpvO.d.cts → types-BxSrazbq.d.ts} +20 -2
- package/dist/{types-BOxa1DE-.d.ts → types-CixUBhrM.d.cts} +20 -2
- package/dist/withdraw.cjs +6 -5
- package/dist/withdraw.d.cts +4 -3
- package/dist/withdraw.d.ts +4 -3
- package/dist/withdraw.mjs +5 -4
- package/package.json +9 -17
- package/dist/WithdrawModal-DY6A55OA.mjs +0 -11
- package/dist/WithdrawModal-V42OK7L3.cjs +0 -11
- package/dist/chunk-ADEWTBSN.cjs +0 -19
- package/dist/chunk-EAGMY3QE.mjs +0 -962
- package/dist/chunk-OY5N3E6L.cjs +0 -962
- package/dist/chunk-PP4QE32S.mjs +0 -19
- package/dist/constants-BT4ctuHo.d.cts +0 -64
- package/dist/constants-D21ZdNOP.d.ts +0 -64
- package/dist/offramp.cjs +0 -25
- package/dist/offramp.d.cts +0 -28
- package/dist/offramp.d.ts +0 -28
- package/dist/offramp.mjs +0 -25
- package/dist/ramp-types-C6aUz4SZ.d.cts +0 -43
- package/dist/ramp-types-C6aUz4SZ.d.ts +0 -43
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertTriangleIcon,
|
|
3
|
+
ArrowUpRightIcon,
|
|
4
|
+
BankIcon,
|
|
5
|
+
BodyHeader,
|
|
6
|
+
CheckIcon,
|
|
7
|
+
ChevronDownIcon,
|
|
8
|
+
ChevronLeftIcon,
|
|
9
|
+
ChevronRightIcon,
|
|
10
|
+
CloseIcon,
|
|
11
|
+
CoinsIcon,
|
|
12
|
+
ExternalLinkIcon,
|
|
13
|
+
HandCoinsIcon,
|
|
14
|
+
HistoryIcon,
|
|
15
|
+
InfoIcon,
|
|
16
|
+
Spinner,
|
|
17
|
+
WalletIcon,
|
|
18
|
+
useLatestRef
|
|
19
|
+
} from "./chunk-YY4ZOAH5.mjs";
|
|
1
20
|
import {
|
|
2
21
|
CHAIN_DISPLAY_ORDER,
|
|
3
22
|
HYPERCORE_CHAIN_ID,
|
|
@@ -6,36 +25,27 @@ import {
|
|
|
6
25
|
ICON_CDN,
|
|
7
26
|
NATIVE_TOKEN_ADDRESS,
|
|
8
27
|
SOLANA_MAINNET_CAIP2,
|
|
9
|
-
SOLANA_TOKENS,
|
|
10
28
|
STELLAR_PUBNET_CAIP2,
|
|
11
29
|
TRON_MAINNET_CAIP2,
|
|
12
30
|
cdnIconUrl,
|
|
13
31
|
displayChainIdForCaip2,
|
|
14
|
-
findTokenDecimals,
|
|
15
32
|
getChainIcon,
|
|
16
33
|
getChainName,
|
|
17
34
|
getExplorerTxUrl,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getTokenAddress,
|
|
21
|
-
getTokenDecimalsByAddress,
|
|
22
|
-
getTokenSymbol,
|
|
35
|
+
getRuntimeNativeDecimals,
|
|
36
|
+
getRuntimeNativeSymbol,
|
|
23
37
|
isHyperCoreCaip2,
|
|
24
|
-
isRegistryTokenOnChain,
|
|
25
38
|
isSolanaCaip2,
|
|
26
39
|
parseEvmChainId,
|
|
27
|
-
publishShortlistTokens,
|
|
28
40
|
setRuntimeChainMeta,
|
|
29
|
-
setRuntimeTokens,
|
|
30
41
|
targetChainToCaip2,
|
|
31
42
|
targetChainToChainId,
|
|
32
|
-
toEvmCaip2
|
|
33
|
-
|
|
34
|
-
} from "./chunk-EAGMY3QE.mjs";
|
|
43
|
+
toEvmCaip2
|
|
44
|
+
} from "./chunk-E7IMWVMN.mjs";
|
|
35
45
|
import {
|
|
36
46
|
MODAL_VERSION,
|
|
37
47
|
serviceHeaders
|
|
38
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-B2LZQIGB.mjs";
|
|
39
49
|
|
|
40
50
|
// src/components/ui/Modal.tsx
|
|
41
51
|
import {
|
|
@@ -164,139 +174,72 @@ function Modal({
|
|
|
164
174
|
}
|
|
165
175
|
Modal.displayName = "Modal";
|
|
166
176
|
|
|
167
|
-
// src/
|
|
168
|
-
import {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
Unplug
|
|
188
|
-
} from "lucide-react";
|
|
189
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
190
|
-
var WalletIcon = Wallet;
|
|
191
|
-
var ExternalLinkIcon = ExternalLink;
|
|
192
|
-
var CheckIcon = Check;
|
|
193
|
-
function TransferCryptoIcon() {
|
|
194
|
-
return /* @__PURE__ */ jsx2(
|
|
195
|
-
"svg",
|
|
196
|
-
{
|
|
197
|
-
width: "24",
|
|
198
|
-
height: "24",
|
|
199
|
-
viewBox: "8 8 24 24",
|
|
200
|
-
fill: "none",
|
|
201
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
202
|
-
"aria-hidden": "true",
|
|
203
|
-
children: /* @__PURE__ */ jsx2(
|
|
204
|
-
"path",
|
|
205
|
-
{
|
|
206
|
-
d: "M26.08 18.37C27.03 18.72 27.87 19.30 28.53 20.07C29.19 20.83 29.65 21.75 29.86 22.73C30.07 23.72 30.03 24.74 29.74 25.71C29.45 26.68 28.92 27.55 28.20 28.26C27.48 28.97 26.59 29.49 25.62 29.76C24.65 30.04 23.63 30.06 22.64 29.83C21.66 29.61 20.75 29.14 20.00 28.47C19.24 27.80 18.67 26.95 18.33 26.00M15 14H16V18M24.70 21.87L25.40 22.58L22.58 25.40M22 16C22 19.31 19.31 22 16 22C12.68 22 10 19.31 10 16C10 12.68 12.68 10 16 10C19.31 10 22 12.68 22 16Z",
|
|
207
|
-
stroke: "currentColor",
|
|
208
|
-
strokeWidth: "2",
|
|
209
|
-
strokeLinecap: "round",
|
|
210
|
-
strokeLinejoin: "round"
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
);
|
|
177
|
+
// src/core/deposit-service.ts
|
|
178
|
+
import { getAddress } from "viem";
|
|
179
|
+
|
|
180
|
+
// src/core/runtime-token-meta.ts
|
|
181
|
+
var bySymbol = /* @__PURE__ */ new Map();
|
|
182
|
+
var byAddress = /* @__PURE__ */ new Map();
|
|
183
|
+
function symbolKey(chainId, symbol) {
|
|
184
|
+
return `${chainId}:${symbol.trim().toUpperCase()}`;
|
|
185
|
+
}
|
|
186
|
+
function addressKey(chainId, address) {
|
|
187
|
+
const key = address.startsWith("0x") ? address.toLowerCase() : address;
|
|
188
|
+
return `${chainId}:${key}`;
|
|
189
|
+
}
|
|
190
|
+
var version = 0;
|
|
191
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
192
|
+
function subscribeToRuntimeTokens(listener) {
|
|
193
|
+
listeners.add(listener);
|
|
194
|
+
return () => {
|
|
195
|
+
listeners.delete(listener);
|
|
196
|
+
};
|
|
215
197
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
var AlertTriangleIcon = AlertTriangle;
|
|
227
|
-
var CircleArrowOutUpLeftIcon = CircleArrowOutUpLeft;
|
|
228
|
-
var CardIcon = CreditCard;
|
|
229
|
-
var BankIcon = Landmark;
|
|
230
|
-
var UnplugIcon = Unplug;
|
|
231
|
-
function MigrateAssetsIcon() {
|
|
232
|
-
return /* @__PURE__ */ jsx2(
|
|
233
|
-
"svg",
|
|
234
|
-
{
|
|
235
|
-
width: "24",
|
|
236
|
-
height: "24",
|
|
237
|
-
viewBox: "0 0 24 24",
|
|
238
|
-
fill: "none",
|
|
239
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
240
|
-
"aria-hidden": "true",
|
|
241
|
-
children: /* @__PURE__ */ jsxs(
|
|
242
|
-
"g",
|
|
243
|
-
{
|
|
244
|
-
stroke: "currentColor",
|
|
245
|
-
strokeWidth: "2",
|
|
246
|
-
strokeLinecap: "round",
|
|
247
|
-
strokeLinejoin: "round",
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ jsx2(
|
|
250
|
-
"path",
|
|
251
|
-
{
|
|
252
|
-
d: "M19 4.344V3C19 2.46957 18.7893 1.96086 18.4142 1.58579C18.0391 1.21071 17.5304 1 17 1H3C2.46957 1 1.96086 1.21071 1.58579 1.58579C1.21071 1.96086 1 2.46957 1 3V17C1 17.5304 1.21071 18.0391 1.58579 18.4142C1.96086 18.7893 2.46957 19 3 19H17C17.5304 19 18.0391 18.7893 18.4142 18.4142C18.7893 18.0391 19 17.5304 19 17V15.656",
|
|
253
|
-
transform: "translate(2 2)"
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
/* @__PURE__ */ jsx2("path", { d: "M1 1H12", transform: "translate(9 11)" }),
|
|
257
|
-
/* @__PURE__ */ jsx2("path", { d: "M1 9L5 5L1 1", transform: "translate(16 7)" })
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
)
|
|
198
|
+
function getRuntimeTokensVersion() {
|
|
199
|
+
return version;
|
|
200
|
+
}
|
|
201
|
+
function setRuntimeTokens(tokens) {
|
|
202
|
+
let changed = false;
|
|
203
|
+
for (const token of tokens) {
|
|
204
|
+
const sKey = symbolKey(token.chainId, token.symbol);
|
|
205
|
+
if (!bySymbol.has(sKey)) {
|
|
206
|
+
bySymbol.set(sKey, token);
|
|
207
|
+
changed = true;
|
|
261
208
|
}
|
|
262
|
-
|
|
209
|
+
const aKey = addressKey(token.chainId, token.address);
|
|
210
|
+
const previous = byAddress.get(aKey);
|
|
211
|
+
if (previous?.symbol !== token.symbol || previous.decimals !== token.decimals) {
|
|
212
|
+
changed = true;
|
|
213
|
+
}
|
|
214
|
+
byAddress.set(aKey, token);
|
|
215
|
+
}
|
|
216
|
+
if (!changed) return;
|
|
217
|
+
version += 1;
|
|
218
|
+
for (const listener of [...listeners]) listener();
|
|
263
219
|
}
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
{
|
|
278
|
-
d: "M16.36 1.43c0 1.14-.49 2.27-1.18 3.08-.74.9-1.99 1.57-2.98 1.57-.12 0-.23-.02-.3-.03-.01-.06-.04-.22-.04-.39 0-1.15.57-2.27 1.2-2.98.8-.94 2.15-1.64 3.25-1.68.03.13.05.28.05.43z",
|
|
279
|
-
stroke: "currentColor",
|
|
280
|
-
strokeWidth: "1.6",
|
|
281
|
-
strokeLinejoin: "round"
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
/* @__PURE__ */ jsx2(
|
|
285
|
-
"path",
|
|
286
|
-
{
|
|
287
|
-
d: "M20.93 17.14c-.03.07-.46 1.58-1.52 3.12-.94 1.34-1.94 2.71-3.43 2.71-1.51 0-1.9-.88-3.63-.88-1.7 0-2.3.91-3.67.91-1.38 0-2.33-1.26-3.43-2.8-1.29-1.82-2.32-4.63-2.32-7.28 0-4.28 2.8-6.55 5.55-6.55 1.45 0 2.68.95 3.6.95.86 0 2.22-1.01 3.9-1.01.61 0 2.89.06 4.37 2.19-.13.09-2.38 1.37-2.38 4.19 0 3.26 2.85 4.42 2.96 4.45z",
|
|
288
|
-
stroke: "currentColor",
|
|
289
|
-
strokeWidth: "1.6",
|
|
290
|
-
strokeLinejoin: "round"
|
|
291
|
-
}
|
|
292
|
-
)
|
|
293
|
-
]
|
|
220
|
+
function publishShortlistTokens(shortlist) {
|
|
221
|
+
const tokens = [];
|
|
222
|
+
for (const [chainKey, entries] of Object.entries(shortlist)) {
|
|
223
|
+
const chainId = Number(chainKey);
|
|
224
|
+
if (!Number.isInteger(chainId)) continue;
|
|
225
|
+
for (const entry of entries) {
|
|
226
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(entry.address)) continue;
|
|
227
|
+
tokens.push({
|
|
228
|
+
chainId,
|
|
229
|
+
symbol: entry.symbol,
|
|
230
|
+
address: entry.address,
|
|
231
|
+
decimals: entry.decimals
|
|
232
|
+
});
|
|
294
233
|
}
|
|
295
|
-
|
|
234
|
+
}
|
|
235
|
+
setRuntimeTokens(tokens);
|
|
236
|
+
}
|
|
237
|
+
function getRuntimeToken(chainId, symbol) {
|
|
238
|
+
return bySymbol.get(symbolKey(chainId, symbol));
|
|
239
|
+
}
|
|
240
|
+
function getRuntimeTokenByAddress(chainId, address) {
|
|
241
|
+
return byAddress.get(addressKey(chainId, address));
|
|
296
242
|
}
|
|
297
|
-
|
|
298
|
-
// src/core/deposit-service.ts
|
|
299
|
-
import { getAddress } from "viem";
|
|
300
243
|
|
|
301
244
|
// src/core/debug.ts
|
|
302
245
|
function truncateString(value, max = 240) {
|
|
@@ -351,6 +294,32 @@ function debugError(enabled, scope, message, error, data) {
|
|
|
351
294
|
console.error(`[deposit-modal:${scope}] ${message}`, payload);
|
|
352
295
|
}
|
|
353
296
|
|
|
297
|
+
// src/core/solana-tokens.ts
|
|
298
|
+
var SOLANA_TOKENS = [
|
|
299
|
+
{ symbol: "SOL", mint: "native", decimals: 9 },
|
|
300
|
+
{
|
|
301
|
+
symbol: "USDC",
|
|
302
|
+
mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
303
|
+
decimals: 6
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
symbol: "USDT",
|
|
307
|
+
mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
|
308
|
+
decimals: 6
|
|
309
|
+
}
|
|
310
|
+
];
|
|
311
|
+
var SOLANA_SYSTEM_PROGRAM = "11111111111111111111111111111111";
|
|
312
|
+
function resolveSolanaToken(mint) {
|
|
313
|
+
if (mint === "native" || mint === SOLANA_SYSTEM_PROGRAM) {
|
|
314
|
+
return { symbol: "SOL", decimals: 9 };
|
|
315
|
+
}
|
|
316
|
+
const token = SOLANA_TOKENS.find((t) => t.mint === mint);
|
|
317
|
+
return token ? { symbol: token.symbol, decimals: token.decimals } : void 0;
|
|
318
|
+
}
|
|
319
|
+
function isNativeSol(token) {
|
|
320
|
+
return token.mint === "native";
|
|
321
|
+
}
|
|
322
|
+
|
|
354
323
|
// src/core/chain-catalog.ts
|
|
355
324
|
function parseToken(value) {
|
|
356
325
|
if (typeof value !== "object" || value === null) return null;
|
|
@@ -719,16 +688,6 @@ function parseFeeLine(raw) {
|
|
|
719
688
|
...line.internal !== void 0 && { internal: line.internal }
|
|
720
689
|
};
|
|
721
690
|
}
|
|
722
|
-
var SwappedConnectFeeChangedError = class extends Error {
|
|
723
|
-
constructor(exchangeFeeBps, message = "The Exchange Fee changed") {
|
|
724
|
-
super(message);
|
|
725
|
-
this.exchangeFeeBps = exchangeFeeBps;
|
|
726
|
-
this.name = "SwappedConnectFeeChangedError";
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
function parseExchangeFeeBps(value) {
|
|
730
|
-
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
|
|
731
|
-
}
|
|
732
691
|
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
733
692
|
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
734
693
|
function isSupportedConnectExchange(exchange) {
|
|
@@ -750,6 +709,10 @@ var DEPOSIT_POLICY_REFUSAL_CODES = [
|
|
|
750
709
|
"BALANCE-3",
|
|
751
710
|
"BALANCE-4"
|
|
752
711
|
];
|
|
712
|
+
var ASSET_LOOKUP_MAX_IDS = 100;
|
|
713
|
+
var ASSET_LOOKUP_MAX_URL_LENGTH = 2e3;
|
|
714
|
+
var ASSET_LOOKUP_TIMEOUT_MS = 8e3;
|
|
715
|
+
var ASSET_LOGO_PREFIX = "https://s3.rhinestone.dev/";
|
|
753
716
|
var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
|
|
754
717
|
async function readPolicyRefusal(response) {
|
|
755
718
|
if (response.status !== 422) return null;
|
|
@@ -790,16 +753,14 @@ function createDepositService(baseUrl, options) {
|
|
|
790
753
|
if (value.length <= 20) return value;
|
|
791
754
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
792
755
|
}
|
|
793
|
-
function withPreflightTimeout(label, fallback, run) {
|
|
756
|
+
function withPreflightTimeout(label, fallback, run, timeoutMs = DEPOSIT_PREFLIGHT_TIMEOUT_MS) {
|
|
794
757
|
const controller = new AbortController();
|
|
795
758
|
return new Promise((resolve) => {
|
|
796
759
|
const timer = setTimeout(() => {
|
|
797
|
-
debugLog(debug, scope, `${label}:timeout`, {
|
|
798
|
-
timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
|
|
799
|
-
});
|
|
760
|
+
debugLog(debug, scope, `${label}:timeout`, { timeoutMs });
|
|
800
761
|
controller.abort();
|
|
801
762
|
resolve(fallback);
|
|
802
|
-
},
|
|
763
|
+
}, timeoutMs);
|
|
803
764
|
run(controller.signal).then(
|
|
804
765
|
(value) => {
|
|
805
766
|
clearTimeout(timer);
|
|
@@ -814,6 +775,85 @@ function createDepositService(baseUrl, options) {
|
|
|
814
775
|
}
|
|
815
776
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
816
777
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
778
|
+
let assetsRouteMissing = false;
|
|
779
|
+
let assetsQueryUnsupported = false;
|
|
780
|
+
function assetsGetUrl(ids, fields) {
|
|
781
|
+
return apiUrl(
|
|
782
|
+
`/assets?${new URLSearchParams({
|
|
783
|
+
ids: ids.join(","),
|
|
784
|
+
fields: fields.join(",")
|
|
785
|
+
}).toString()}`
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
function requestAssets(method, ids, fields) {
|
|
789
|
+
const failed = { ok: false, status: null };
|
|
790
|
+
return withPreflightTimeout(
|
|
791
|
+
`lookupAssets:${method}`,
|
|
792
|
+
failed,
|
|
793
|
+
async (signal) => {
|
|
794
|
+
const response = await fetch(
|
|
795
|
+
method === "GET" ? assetsGetUrl(ids, fields) : apiUrl("/assets"),
|
|
796
|
+
{
|
|
797
|
+
method,
|
|
798
|
+
headers: serviceHeaders(),
|
|
799
|
+
body: method === "QUERY" ? JSON.stringify({ ids, fields }) : void 0,
|
|
800
|
+
cache: "no-store",
|
|
801
|
+
signal
|
|
802
|
+
}
|
|
803
|
+
);
|
|
804
|
+
if (response.status !== 200) {
|
|
805
|
+
debugError(debug, scope, "lookupAssets:failed", {
|
|
806
|
+
method,
|
|
807
|
+
status: response.status
|
|
808
|
+
});
|
|
809
|
+
return { ok: false, status: response.status };
|
|
810
|
+
}
|
|
811
|
+
const body = await response.json().catch(() => null);
|
|
812
|
+
const data = body?.data;
|
|
813
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
814
|
+
debugError(debug, scope, "lookupAssets:malformed", { method });
|
|
815
|
+
return failed;
|
|
816
|
+
}
|
|
817
|
+
return { ok: true, data };
|
|
818
|
+
},
|
|
819
|
+
ASSET_LOOKUP_TIMEOUT_MS
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
function chunkForGet(ids, fields) {
|
|
823
|
+
const chunks = [];
|
|
824
|
+
let current = [];
|
|
825
|
+
for (const id of ids) {
|
|
826
|
+
const next = [...current, id];
|
|
827
|
+
if (current.length > 0 && assetsGetUrl(next, fields).length > ASSET_LOOKUP_MAX_URL_LENGTH) {
|
|
828
|
+
chunks.push(current);
|
|
829
|
+
current = [id];
|
|
830
|
+
} else {
|
|
831
|
+
current = next;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if (current.length > 0) chunks.push(current);
|
|
835
|
+
return chunks;
|
|
836
|
+
}
|
|
837
|
+
async function lookupAssetsViaGet(ids, fields) {
|
|
838
|
+
const data = {};
|
|
839
|
+
for (const chunk of chunkForGet(ids, fields)) {
|
|
840
|
+
const outcome = await requestAssets("GET", chunk, fields);
|
|
841
|
+
if (!outcome.ok) return outcome;
|
|
842
|
+
Object.assign(data, outcome.data);
|
|
843
|
+
}
|
|
844
|
+
return { ok: true, data };
|
|
845
|
+
}
|
|
846
|
+
async function lookupAssetsBatch(ids, fields) {
|
|
847
|
+
const fitsGet = assetsGetUrl(ids, fields).length <= ASSET_LOOKUP_MAX_URL_LENGTH;
|
|
848
|
+
if (fitsGet || assetsQueryUnsupported) {
|
|
849
|
+
return lookupAssetsViaGet(ids, fields);
|
|
850
|
+
}
|
|
851
|
+
const viaQuery = await requestAssets("QUERY", ids, fields);
|
|
852
|
+
if (viaQuery.ok) return viaQuery;
|
|
853
|
+
const viaGet = await lookupAssetsViaGet(ids, fields);
|
|
854
|
+
if (viaGet.ok) assetsQueryUnsupported = true;
|
|
855
|
+
return viaGet;
|
|
856
|
+
}
|
|
817
857
|
let topTokensPromise = null;
|
|
818
858
|
let chainsPromise = null;
|
|
819
859
|
function parseDepositOptions(value) {
|
|
@@ -918,6 +958,39 @@ function createDepositService(baseUrl, options) {
|
|
|
918
958
|
});
|
|
919
959
|
return promise;
|
|
920
960
|
}
|
|
961
|
+
async function startSwappedCheckout(kind, account, fields) {
|
|
962
|
+
const label = kind === "fiat" ? "Swapped widget URL" : "Swapped Connect URL";
|
|
963
|
+
const response = await fetch(apiUrl("/onramp/orders"), {
|
|
964
|
+
method: "POST",
|
|
965
|
+
headers: serviceHeaders(),
|
|
966
|
+
body: JSON.stringify({
|
|
967
|
+
provider: "swapped",
|
|
968
|
+
kind,
|
|
969
|
+
account,
|
|
970
|
+
...fields
|
|
971
|
+
})
|
|
972
|
+
});
|
|
973
|
+
if (!response.ok) {
|
|
974
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
975
|
+
debugError(debug, scope, "startSwappedCheckout:failed", error, {
|
|
976
|
+
status: response.status,
|
|
977
|
+
kind
|
|
978
|
+
});
|
|
979
|
+
throw new Error(
|
|
980
|
+
typeof error.error === "string" && error.error || `${label} failed: ${response.status}`
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
const body = await response.json().catch(() => null);
|
|
984
|
+
if (typeof body?.orderId !== "string" || body.nextAction?.type !== "hosted" || typeof body.nextAction.url !== "string") {
|
|
985
|
+
throw new Error(`${label}: malformed response`);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
orderId: body.orderId,
|
|
989
|
+
url: body.nextAction.url,
|
|
990
|
+
externalCustomerId: `${account.toLowerCase()}:${body.orderId}`,
|
|
991
|
+
expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : void 0
|
|
992
|
+
};
|
|
993
|
+
}
|
|
921
994
|
return {
|
|
922
995
|
async registerManagedAccount(params) {
|
|
923
996
|
const url = apiUrl("/register-managed");
|
|
@@ -1292,7 +1365,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1292
1365
|
},
|
|
1293
1366
|
async checkLiquidity(params) {
|
|
1294
1367
|
if (isSolanaCaip2(params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1295
|
-
const token =
|
|
1368
|
+
const token = resolveSolanaToken(params.destinationToken);
|
|
1296
1369
|
return {
|
|
1297
1370
|
hasLiquidity: true,
|
|
1298
1371
|
symbol: token?.symbol ?? "Token",
|
|
@@ -1566,138 +1639,45 @@ function createDepositService(baseUrl, options) {
|
|
|
1566
1639
|
status: result.status ?? "processing"
|
|
1567
1640
|
};
|
|
1568
1641
|
},
|
|
1569
|
-
async
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
)
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
if (!response.ok) {
|
|
1582
|
-
debugError(debug, scope, "fetchPrices:failed", {
|
|
1583
|
-
status: response.status
|
|
1584
|
-
});
|
|
1585
|
-
return {};
|
|
1642
|
+
async lookupAssets(ids, fields) {
|
|
1643
|
+
const unique = [...new Set(ids.filter((id) => id.length > 0))];
|
|
1644
|
+
if (unique.length === 0) return { ok: true, items: {} };
|
|
1645
|
+
if (assetsRouteMissing) return { ok: false, routeMissing: true };
|
|
1646
|
+
const items = {};
|
|
1647
|
+
for (let i = 0; i < unique.length; i += ASSET_LOOKUP_MAX_IDS) {
|
|
1648
|
+
const batch = unique.slice(i, i + ASSET_LOOKUP_MAX_IDS);
|
|
1649
|
+
const outcome = await lookupAssetsBatch(batch, fields);
|
|
1650
|
+
if (!outcome.ok) {
|
|
1651
|
+
const routeMissing = outcome.status === 404 || outcome.status === 405;
|
|
1652
|
+
if (routeMissing) assetsRouteMissing = true;
|
|
1653
|
+
return { ok: false, routeMissing };
|
|
1586
1654
|
}
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
symbol.toUpperCase(),
|
|
1591
|
-
price
|
|
1592
|
-
])
|
|
1593
|
-
);
|
|
1594
|
-
} catch (err) {
|
|
1595
|
-
debugError(debug, scope, "fetchPrices:error", err);
|
|
1596
|
-
return {};
|
|
1597
|
-
}
|
|
1598
|
-
},
|
|
1599
|
-
async fetchPricesByAddress(caip2Ids) {
|
|
1600
|
-
const list = caip2Ids.filter((id) => id.length > 0);
|
|
1601
|
-
if (list.length === 0) return {};
|
|
1602
|
-
const url = apiUrl(
|
|
1603
|
-
`/prices?${new URLSearchParams({
|
|
1604
|
-
addresses: list.join(",")
|
|
1605
|
-
}).toString()}`
|
|
1606
|
-
);
|
|
1607
|
-
try {
|
|
1608
|
-
const response = await fetch(url, {
|
|
1609
|
-
method: "GET",
|
|
1610
|
-
headers: serviceHeaders(),
|
|
1611
|
-
cache: "no-store"
|
|
1612
|
-
});
|
|
1613
|
-
if (!response.ok) {
|
|
1614
|
-
debugError(debug, scope, "fetchPricesByAddress:failed", {
|
|
1615
|
-
status: response.status
|
|
1616
|
-
});
|
|
1617
|
-
return {};
|
|
1655
|
+
for (const id of batch) {
|
|
1656
|
+
const item = parseAssetItem(outcome.data[id], fields);
|
|
1657
|
+
if (item) items[id] = item;
|
|
1618
1658
|
}
|
|
1619
|
-
const data = await response.json();
|
|
1620
|
-
return data.prices ?? {};
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
debugError(debug, scope, "fetchPricesByAddress:error", err);
|
|
1623
|
-
return {};
|
|
1624
1659
|
}
|
|
1660
|
+
return { ok: true, items };
|
|
1625
1661
|
},
|
|
1626
1662
|
async getSwappedWidgetUrl(params) {
|
|
1627
|
-
const
|
|
1663
|
+
const { smartAccount, ...fields } = params;
|
|
1628
1664
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1629
|
-
smartAccount: shortRef(
|
|
1665
|
+
smartAccount: shortRef(smartAccount),
|
|
1630
1666
|
method: params.method,
|
|
1631
1667
|
methodSelectionSource: params.methodSelectionSource
|
|
1632
1668
|
});
|
|
1633
|
-
|
|
1634
|
-
method: "POST",
|
|
1635
|
-
headers: serviceHeaders(),
|
|
1636
|
-
body: JSON.stringify(params)
|
|
1637
|
-
});
|
|
1638
|
-
if (!response.ok) {
|
|
1639
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1640
|
-
debugError(debug, scope, "getSwappedWidgetUrl:failed", error, {
|
|
1641
|
-
status: response.status
|
|
1642
|
-
});
|
|
1643
|
-
throw new Error(
|
|
1644
|
-
error.error || `Swapped widget URL failed: ${response.status}`
|
|
1645
|
-
);
|
|
1646
|
-
}
|
|
1647
|
-
const body = await response.json();
|
|
1648
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1649
|
-
throw new Error("Swapped widget URL: malformed response");
|
|
1650
|
-
}
|
|
1651
|
-
return {
|
|
1652
|
-
url: body.url,
|
|
1653
|
-
currencyCode: body.currencyCode,
|
|
1654
|
-
sandbox: body.sandbox === true,
|
|
1655
|
-
externalCustomerId: body.externalCustomerId,
|
|
1656
|
-
expiresAt: body.expiresAt
|
|
1657
|
-
};
|
|
1669
|
+
return startSwappedCheckout("fiat", smartAccount, fields);
|
|
1658
1670
|
},
|
|
1659
1671
|
async getSwappedConnectUrl(params) {
|
|
1660
|
-
const
|
|
1672
|
+
const { smartAccount, ...fields } = params;
|
|
1661
1673
|
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1662
|
-
smartAccount: shortRef(
|
|
1674
|
+
smartAccount: shortRef(smartAccount),
|
|
1663
1675
|
connection: params.connection
|
|
1664
1676
|
});
|
|
1665
|
-
|
|
1666
|
-
method: "POST",
|
|
1667
|
-
headers: serviceHeaders(),
|
|
1668
|
-
body: JSON.stringify(params)
|
|
1669
|
-
});
|
|
1670
|
-
if (!response.ok) {
|
|
1671
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1672
|
-
debugError(debug, scope, "getSwappedConnectUrl:failed", error, {
|
|
1673
|
-
status: response.status
|
|
1674
|
-
});
|
|
1675
|
-
const currentFeeBps = parseExchangeFeeBps(error.exchangeFeeBps);
|
|
1676
|
-
if (response.status === 409 && currentFeeBps !== void 0) {
|
|
1677
|
-
throw new SwappedConnectFeeChangedError(
|
|
1678
|
-
currentFeeBps,
|
|
1679
|
-
typeof error.error === "string" ? error.error : void 0
|
|
1680
|
-
);
|
|
1681
|
-
}
|
|
1682
|
-
throw new Error(
|
|
1683
|
-
typeof error.error === "string" && error.error || `Swapped Connect URL failed: ${response.status}`
|
|
1684
|
-
);
|
|
1685
|
-
}
|
|
1686
|
-
const body = await response.json();
|
|
1687
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1688
|
-
throw new Error("Swapped Connect URL: malformed response");
|
|
1689
|
-
}
|
|
1690
|
-
return {
|
|
1691
|
-
url: body.url,
|
|
1692
|
-
currencyCode: body.currencyCode,
|
|
1693
|
-
sandbox: body.sandbox === true,
|
|
1694
|
-
externalCustomerId: body.externalCustomerId,
|
|
1695
|
-
expiresAt: body.expiresAt,
|
|
1696
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1697
|
-
};
|
|
1677
|
+
return startSwappedCheckout("exchange", smartAccount, fields);
|
|
1698
1678
|
},
|
|
1699
1679
|
async getSwappedConnectExchanges() {
|
|
1700
|
-
const url = apiUrl("/onramp/swapped
|
|
1680
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=exchange");
|
|
1701
1681
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1702
1682
|
const response = await fetch(url, {
|
|
1703
1683
|
method: "GET",
|
|
@@ -1714,7 +1694,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1714
1694
|
);
|
|
1715
1695
|
}
|
|
1716
1696
|
const body = await response.json();
|
|
1717
|
-
const rawExchanges = Array.isArray(body.
|
|
1697
|
+
const rawExchanges = Array.isArray(body.connections) ? body.connections : null;
|
|
1718
1698
|
const exchanges = [];
|
|
1719
1699
|
let hasMalformedExchange = rawExchanges === null;
|
|
1720
1700
|
for (const exchange of rawExchanges ?? []) {
|
|
@@ -1732,16 +1712,10 @@ function createDepositService(baseUrl, options) {
|
|
|
1732
1712
|
}
|
|
1733
1713
|
exchanges.push({ connection, name, logoUrl });
|
|
1734
1714
|
}
|
|
1735
|
-
if (hasMalformedExchange
|
|
1715
|
+
if (hasMalformedExchange) {
|
|
1736
1716
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1737
1717
|
}
|
|
1738
|
-
return {
|
|
1739
|
-
exchanges: exchanges.filter(isSupportedConnectExchange),
|
|
1740
|
-
fetchedAt: body.fetchedAt,
|
|
1741
|
-
expiresAt: body.expiresAt,
|
|
1742
|
-
stale: body.stale === true ? true : void 0,
|
|
1743
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1744
|
-
};
|
|
1718
|
+
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1745
1719
|
},
|
|
1746
1720
|
async getSwappedPaymentMethods() {
|
|
1747
1721
|
const empty = {
|
|
@@ -1749,7 +1723,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1749
1723
|
methods: [],
|
|
1750
1724
|
recommendedMethod: null
|
|
1751
1725
|
};
|
|
1752
|
-
const url = apiUrl("/onramp/swapped
|
|
1726
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=fiat");
|
|
1753
1727
|
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1754
1728
|
try {
|
|
1755
1729
|
const response = await fetch(url, {
|
|
@@ -1863,51 +1837,87 @@ function createDepositService(baseUrl, options) {
|
|
|
1863
1837
|
return null;
|
|
1864
1838
|
}
|
|
1865
1839
|
},
|
|
1866
|
-
async
|
|
1867
|
-
const url = apiUrl(
|
|
1868
|
-
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1869
|
-
);
|
|
1840
|
+
async fetchSwappedOrder(orderId) {
|
|
1841
|
+
const url = apiUrl(`/onramp/orders/${encodeURIComponent(orderId)}`);
|
|
1870
1842
|
const response = await fetch(url, {
|
|
1871
1843
|
method: "GET",
|
|
1872
1844
|
headers: serviceHeaders(),
|
|
1873
1845
|
cache: "no-store"
|
|
1874
1846
|
});
|
|
1875
1847
|
if (!response.ok) return null;
|
|
1876
|
-
let body
|
|
1848
|
+
let body;
|
|
1877
1849
|
try {
|
|
1878
1850
|
body = await response.json();
|
|
1879
1851
|
} catch {
|
|
1880
1852
|
return null;
|
|
1881
1853
|
}
|
|
1882
|
-
|
|
1883
|
-
const status = typeof body.status === "string" ? body.status : null;
|
|
1884
|
-
const orderId = typeof body.orderId === "string" ? body.orderId : null;
|
|
1885
|
-
if (!status || !orderId) return null;
|
|
1886
|
-
const numericOrNull = (v) => {
|
|
1887
|
-
if (typeof v === "number") {
|
|
1888
|
-
return Number.isFinite(v) ? v : null;
|
|
1889
|
-
}
|
|
1890
|
-
if (typeof v === "string" && v.trim().length > 0) {
|
|
1891
|
-
const parsed = Number(v);
|
|
1892
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1893
|
-
}
|
|
1894
|
-
return null;
|
|
1895
|
-
};
|
|
1896
|
-
return {
|
|
1897
|
-
orderId,
|
|
1898
|
-
status,
|
|
1899
|
-
orderCrypto: typeof body.orderCrypto === "string" ? body.orderCrypto : null,
|
|
1900
|
-
orderCryptoAmount: typeof body.orderCryptoAmount === "string" ? body.orderCryptoAmount : null,
|
|
1901
|
-
transactionId: typeof body.transactionId === "string" ? body.transactionId : null,
|
|
1902
|
-
receivedAt: typeof body.receivedAt === "string" ? body.receivedAt : null,
|
|
1903
|
-
paidAmountUsd: numericOrNull(body.paidAmountUsd),
|
|
1904
|
-
paidAmountEur: numericOrNull(body.paidAmountEur),
|
|
1905
|
-
onrampFeeUsd: numericOrNull(body.onrampFeeUsd),
|
|
1906
|
-
paymentMethod: typeof body.paymentMethod === "string" ? body.paymentMethod : null
|
|
1907
|
-
};
|
|
1854
|
+
return swappedOrderFromView(orderId, body);
|
|
1908
1855
|
}
|
|
1909
1856
|
};
|
|
1910
1857
|
}
|
|
1858
|
+
var SWAPPED_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1859
|
+
"payment_pending",
|
|
1860
|
+
"order_completed",
|
|
1861
|
+
"order_broadcasted",
|
|
1862
|
+
"order_cancelled"
|
|
1863
|
+
]);
|
|
1864
|
+
function swappedOrderFromView(orderId, raw) {
|
|
1865
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1866
|
+
const view = raw;
|
|
1867
|
+
if (view.provider !== "swapped") return null;
|
|
1868
|
+
const status = view.providerStatus;
|
|
1869
|
+
if (typeof status !== "string" || !SWAPPED_ORDER_STATUSES.has(status)) {
|
|
1870
|
+
return null;
|
|
1871
|
+
}
|
|
1872
|
+
const number = (v) => {
|
|
1873
|
+
const n = typeof v === "string" && v.trim() ? Number(v) : v;
|
|
1874
|
+
return typeof n === "number" && Number.isFinite(n) ? n : null;
|
|
1875
|
+
};
|
|
1876
|
+
const text = (v) => typeof v === "string" && v.length > 0 ? v : null;
|
|
1877
|
+
const railName = (v) => {
|
|
1878
|
+
const name = text(v);
|
|
1879
|
+
return name === "provider_selected" || name === "unknown" ? null : name;
|
|
1880
|
+
};
|
|
1881
|
+
const usdTotal = number(view.fiat?.usd?.total);
|
|
1882
|
+
const usdNet = number(view.fiat?.usd?.net);
|
|
1883
|
+
return {
|
|
1884
|
+
orderId,
|
|
1885
|
+
status,
|
|
1886
|
+
orderCrypto: text(view.crypto?.asset),
|
|
1887
|
+
orderCryptoAmount: text(view.crypto?.amount),
|
|
1888
|
+
transactionId: text(view.stages?.delivery?.txHash),
|
|
1889
|
+
receivedAt: text(view.updatedAt),
|
|
1890
|
+
paidAmountUsd: usdTotal ?? usdNet,
|
|
1891
|
+
paidAmountEur: number(view.fiat?.eur?.total) ?? number(view.fiat?.eur?.net),
|
|
1892
|
+
onrampFeeUsd: usdTotal !== null && usdNet !== null && usdTotal > usdNet ? Number((usdTotal - usdNet).toFixed(2)) : null,
|
|
1893
|
+
paymentMethod: railName(view.rail?.method ?? view.rail?.connection)
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
function parseAssetItem(raw, fields) {
|
|
1897
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
1898
|
+
const record = raw;
|
|
1899
|
+
const item = {};
|
|
1900
|
+
if (fields.includes("symbol")) {
|
|
1901
|
+
const symbol = record.symbol;
|
|
1902
|
+
item.symbol = typeof symbol === "string" && symbol.trim().length > 0 ? symbol.trim() : null;
|
|
1903
|
+
}
|
|
1904
|
+
if (fields.includes("decimals")) {
|
|
1905
|
+
const decimals = record.decimals;
|
|
1906
|
+
item.decimals = typeof decimals === "number" && Number.isInteger(decimals) && decimals >= 0 && decimals <= 255 ? decimals : null;
|
|
1907
|
+
}
|
|
1908
|
+
if (fields.includes("logo")) {
|
|
1909
|
+
const logo = record.logo;
|
|
1910
|
+
item.logo = typeof logo === "string" && logo.startsWith(ASSET_LOGO_PREFIX) ? logo : null;
|
|
1911
|
+
}
|
|
1912
|
+
if (fields.includes("price")) {
|
|
1913
|
+
const price = record.price;
|
|
1914
|
+
const usd = price && typeof price === "object" ? typeof price.usd === "string" && price.usd.trim() !== "" ? Number(price.usd) : typeof price.usd === "number" ? price.usd : Number.NaN : Number.NaN;
|
|
1915
|
+
item.priceUsd = Number.isFinite(usd) && usd > 0 ? usd : null;
|
|
1916
|
+
}
|
|
1917
|
+
const error = record.error;
|
|
1918
|
+
item.error = error && typeof error === "object" && typeof error.code === "string" ? { code: error.code } : null;
|
|
1919
|
+
return item;
|
|
1920
|
+
}
|
|
1911
1921
|
function normalizeDirectPortfolio(data) {
|
|
1912
1922
|
const rawTokens = extractArray(data, "tokens") ?? extractArray(
|
|
1913
1923
|
data?.data,
|
|
@@ -1933,20 +1943,13 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1933
1943
|
const unlocked = chainBalance.balance?.unlocked ?? "0";
|
|
1934
1944
|
const normalizedName = tokenData.tokenName.trim();
|
|
1935
1945
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1936
|
-
const tokenAddress = chainBalance.tokenAddress ?? extractTokenAddress(tokenData, chainBalance.chainId) ??
|
|
1946
|
+
const tokenAddress = chainBalance.tokenAddress ?? extractTokenAddress(tokenData, chainBalance.chainId) ?? runtimeEvmAddress(chainBalance.chainId, normalizedName);
|
|
1937
1947
|
const resolvedTokenAddress = isNativeSymbol ? NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1938
1948
|
if (!resolvedTokenAddress) {
|
|
1939
1949
|
continue;
|
|
1940
1950
|
}
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
chainBalance.chainId
|
|
1944
|
-
);
|
|
1945
|
-
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1946
|
-
const decimals = registrySymbol !== "Token" ? getTokenDecimalsByAddress(
|
|
1947
|
-
resolvedTokenAddress,
|
|
1948
|
-
chainBalance.chainId
|
|
1949
|
-
) : tokenData.tokenDecimals ?? 18;
|
|
1951
|
+
const symbol = normalizedName || "Token";
|
|
1952
|
+
const decimals = tokenData.tokenDecimals ?? 18;
|
|
1950
1953
|
tokens.push({
|
|
1951
1954
|
chainId: chainBalance.chainId,
|
|
1952
1955
|
address: resolvedTokenAddress,
|
|
@@ -1972,7 +1975,6 @@ function normalizeDirectToken(token) {
|
|
|
1972
1975
|
isHyperCoreCaip2(rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : parseEvmChainId(rawChainString)
|
|
1973
1976
|
) : null);
|
|
1974
1977
|
if (chainId === null) return null;
|
|
1975
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? HYPERCORE_CHAIN_ID : void 0;
|
|
1976
1978
|
const symbol = extractString(token, "symbol") ?? extractString(token, "tokenSymbol") ?? extractString(token, "tokenName") ?? extractString(token, "name");
|
|
1977
1979
|
if (!symbol) return null;
|
|
1978
1980
|
const balanceValue = extractString(token, "balance") ?? extractString(token, "amount") ?? extractString(token, "value") ?? extractString(token, "rawBalance") ?? extractNumber(token, "balance")?.toString() ?? extractNumber(token, "amount")?.toString() ?? extractNumber(token, "value")?.toString() ?? extractNumber(token, "rawBalance")?.toString();
|
|
@@ -1980,14 +1982,13 @@ function normalizeDirectToken(token) {
|
|
|
1980
1982
|
const address = extractString(token, "address") ?? extractString(token, "tokenAddress") ?? extractString(
|
|
1981
1983
|
token.token,
|
|
1982
1984
|
"address"
|
|
1983
|
-
) ?? (
|
|
1985
|
+
) ?? (chainId === "hypercore" ? hyperCoreSourceToken(void 0, symbol)?.address : typeof chainId === "number" ? runtimeEvmAddress(chainId, symbol) : void 0);
|
|
1984
1986
|
if (!address) return null;
|
|
1985
1987
|
const balanceUsd = extractNumber(token, "balanceUsd") ?? extractNumber(token, "usdValue") ?? extractNumber(token, "valueUsd") ?? extractNumericString(token, "balanceUsd") ?? extractNumericString(token, "usdValue") ?? extractNumericString(token, "valueUsd") ?? 0;
|
|
1986
|
-
const isSolanaToken = chainId === "solana";
|
|
1987
|
-
const registrySymbol = isSolanaToken ? "Token" : getTokenSymbol(address, registryChainId);
|
|
1988
|
-
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1989
1988
|
const backendDecimals = extractNumber(token, "decimals") ?? extractNumber(token, "tokenDecimals");
|
|
1990
|
-
const
|
|
1989
|
+
const hyperCore = chainId === "hypercore" ? hyperCoreSourceToken(address, symbol) : void 0;
|
|
1990
|
+
const resolvedSymbol = hyperCore?.symbol ?? symbol;
|
|
1991
|
+
const resolvedDecimals = hyperCore?.decimals ?? backendDecimals ?? 18;
|
|
1991
1992
|
return {
|
|
1992
1993
|
chainId,
|
|
1993
1994
|
address,
|
|
@@ -1998,6 +1999,15 @@ function normalizeDirectToken(token) {
|
|
|
1998
1999
|
balanceUsd
|
|
1999
2000
|
};
|
|
2000
2001
|
}
|
|
2002
|
+
function runtimeEvmAddress(chainId, symbol) {
|
|
2003
|
+
const token = getRuntimeToken(chainId, symbol);
|
|
2004
|
+
return token && /^0x[a-fA-F0-9]{40}$/.test(token.address) ? token.address : void 0;
|
|
2005
|
+
}
|
|
2006
|
+
function hyperCoreSourceToken(address, symbol) {
|
|
2007
|
+
return HYPERCORE_SOURCE_TOKENS.find(
|
|
2008
|
+
(t) => address ? t.address.toLowerCase() === address.toLowerCase() : t.symbol.toUpperCase() === symbol.trim().toUpperCase()
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2001
2011
|
function extractTokenAddress(tokenData, chainId) {
|
|
2002
2012
|
const token = tokenData;
|
|
2003
2013
|
return token.tokenAddress ?? token.address ?? token.addresses?.[chainId] ?? token.token?.address ?? token.token?.addresses?.[chainId];
|
|
@@ -2269,7 +2279,7 @@ function needsViemChains(catalog, overrides) {
|
|
|
2269
2279
|
}
|
|
2270
2280
|
|
|
2271
2281
|
// src/core/chain-catalog-context.tsx
|
|
2272
|
-
import { jsx as
|
|
2282
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2273
2283
|
var EMPTY = {
|
|
2274
2284
|
catalog: null,
|
|
2275
2285
|
viemChains: null,
|
|
@@ -2343,6 +2353,7 @@ function publishRuntimeChainMeta(catalog) {
|
|
|
2343
2353
|
name: chain.name,
|
|
2344
2354
|
iconUrl: chain.iconUrl ?? void 0,
|
|
2345
2355
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2356
|
+
nativeDecimals: chain.nativeToken.decimals,
|
|
2346
2357
|
explorerUrl: chain.explorer?.url,
|
|
2347
2358
|
explorerTxPath: chain.explorer?.txPath,
|
|
2348
2359
|
explorerAddressPath: chain.explorer?.addressPath
|
|
@@ -2504,10 +2515,10 @@ function useRuntimeChainsVersion() {
|
|
|
2504
2515
|
);
|
|
2505
2516
|
}
|
|
2506
2517
|
function useReadClient(chainId, rpcUrls) {
|
|
2507
|
-
const
|
|
2518
|
+
const version2 = useRuntimeChainsVersion();
|
|
2508
2519
|
return useMemo2(
|
|
2509
2520
|
() => getPublicClient(chainId, rpcUrls),
|
|
2510
|
-
[chainId, rpcUrls,
|
|
2521
|
+
[chainId, rpcUrls, version2]
|
|
2511
2522
|
);
|
|
2512
2523
|
}
|
|
2513
2524
|
function useExplorerTxUrl() {
|
|
@@ -2625,27 +2636,303 @@ function ChainCatalogProvider({
|
|
|
2625
2636
|
clientCapableChainIds
|
|
2626
2637
|
]
|
|
2627
2638
|
);
|
|
2628
|
-
return /* @__PURE__ */
|
|
2639
|
+
return /* @__PURE__ */ jsx2(ChainCatalogContext.Provider, { value, children });
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
// src/core/asset-metadata.tsx
|
|
2643
|
+
import {
|
|
2644
|
+
createContext as createContext3,
|
|
2645
|
+
useContext as useContext3,
|
|
2646
|
+
useEffect as useEffect3,
|
|
2647
|
+
useMemo as useMemo3,
|
|
2648
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
2649
|
+
} from "react";
|
|
2650
|
+
|
|
2651
|
+
// src/core/asset-id.ts
|
|
2652
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2653
|
+
var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
2654
|
+
var BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
2655
|
+
var SOLANA_SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
2656
|
+
function isNativeSpelling(chain, address) {
|
|
2657
|
+
if (chain === "solana") {
|
|
2658
|
+
return address === "native" || address === SOLANA_SYSTEM_PROGRAM2;
|
|
2659
|
+
}
|
|
2660
|
+
if (chain === "stellar") return address === "native";
|
|
2661
|
+
if (chain === "tron") return address === "native" || address === ZERO_ADDRESS;
|
|
2662
|
+
return address.toLowerCase() === ZERO_ADDRESS;
|
|
2663
|
+
}
|
|
2664
|
+
function assetIdFor(chain, address) {
|
|
2665
|
+
if (chain === void 0 || !address) return void 0;
|
|
2666
|
+
const native = isNativeSpelling(chain, address);
|
|
2667
|
+
if (chain === "hypercore" || chain === HYPERCORE_CHAIN_ID) {
|
|
2668
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2669
|
+
return `${HYPERCORE_SPOT_CAIP2}:${native ? "native" : address.toLowerCase()}`;
|
|
2670
|
+
}
|
|
2671
|
+
if (typeof chain === "number") {
|
|
2672
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2673
|
+
return `${toEvmCaip2(chain)}:${native ? "native" : address.toLowerCase()}`;
|
|
2674
|
+
}
|
|
2675
|
+
if (chain === "solana") {
|
|
2676
|
+
if (native) return `${SOLANA_MAINNET_CAIP2}:native`;
|
|
2677
|
+
return BASE58_RE.test(address) ? `${SOLANA_MAINNET_CAIP2}:${address}` : void 0;
|
|
2678
|
+
}
|
|
2679
|
+
const caip2 = chain === "tron" ? TRON_MAINNET_CAIP2 : STELLAR_PUBNET_CAIP2;
|
|
2680
|
+
return `${caip2}:${native ? "native" : address}`;
|
|
2681
|
+
}
|
|
2682
|
+
function assetIdForRef(ref) {
|
|
2683
|
+
return ref ? assetIdFor(ref.chain, ref.address) : void 0;
|
|
2629
2684
|
}
|
|
2630
2685
|
|
|
2631
|
-
// src/core/
|
|
2632
|
-
import {
|
|
2633
|
-
|
|
2634
|
-
|
|
2686
|
+
// src/core/asset-metadata.tsx
|
|
2687
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2688
|
+
var ASSET_RETRY_MS = 6e4;
|
|
2689
|
+
var ASSET_PRICE_TTL_MS = 6e4;
|
|
2690
|
+
var META_FIELDS = ["symbol", "decimals", "logo"];
|
|
2691
|
+
var PRICE_FIELDS = ["price"];
|
|
2692
|
+
var TERMINAL_ITEM_ERRORS = /* @__PURE__ */ new Set([
|
|
2693
|
+
"not_found",
|
|
2694
|
+
"unsupported_chain",
|
|
2695
|
+
"invalid_id"
|
|
2696
|
+
]);
|
|
2697
|
+
function createAssetStore(service, now = Date.now) {
|
|
2698
|
+
const meta = /* @__PURE__ */ new Map();
|
|
2699
|
+
const prices = /* @__PURE__ */ new Map();
|
|
2700
|
+
const metaInFlight = /* @__PURE__ */ new Set();
|
|
2701
|
+
const priceInFlight = /* @__PURE__ */ new Set();
|
|
2702
|
+
let metaQueue = /* @__PURE__ */ new Set();
|
|
2703
|
+
let priceQueue = /* @__PURE__ */ new Set();
|
|
2704
|
+
let flushScheduled = false;
|
|
2705
|
+
let routeMissing = false;
|
|
2706
|
+
let version2 = 0;
|
|
2707
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
2708
|
+
function notify() {
|
|
2709
|
+
version2 += 1;
|
|
2710
|
+
for (const listener of [...listeners2]) listener();
|
|
2711
|
+
}
|
|
2712
|
+
function idsFor(refs) {
|
|
2713
|
+
const ids = [];
|
|
2714
|
+
for (const ref of refs) {
|
|
2715
|
+
const id = assetIdForRef(ref);
|
|
2716
|
+
if (!id) continue;
|
|
2717
|
+
ids.push(id);
|
|
2718
|
+
}
|
|
2719
|
+
return ids;
|
|
2720
|
+
}
|
|
2721
|
+
function scheduleFlush() {
|
|
2722
|
+
if (flushScheduled) return;
|
|
2723
|
+
flushScheduled = true;
|
|
2724
|
+
queueMicrotask(() => {
|
|
2725
|
+
flushScheduled = false;
|
|
2726
|
+
const metaIds = [...metaQueue];
|
|
2727
|
+
const priceIds = [...priceQueue];
|
|
2728
|
+
metaQueue = /* @__PURE__ */ new Set();
|
|
2729
|
+
priceQueue = /* @__PURE__ */ new Set();
|
|
2730
|
+
if (metaIds.length > 0) void flushMeta(metaIds);
|
|
2731
|
+
if (priceIds.length > 0) void flushPrices(priceIds);
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
function needsMeta(id) {
|
|
2735
|
+
if (metaInFlight.has(id) || metaQueue.has(id)) return false;
|
|
2736
|
+
const entry = meta.get(id);
|
|
2737
|
+
if (!entry) return true;
|
|
2738
|
+
if (entry.status === "missing" || entry.status === "pending") return false;
|
|
2739
|
+
if (entry.status === "failed" && routeMissing) return false;
|
|
2740
|
+
return entry.retryAt !== void 0 && now() >= entry.retryAt;
|
|
2741
|
+
}
|
|
2742
|
+
function needsPrice(id) {
|
|
2743
|
+
if (priceInFlight.has(id) || priceQueue.has(id)) return false;
|
|
2744
|
+
const entry = prices.get(id);
|
|
2745
|
+
return !entry || now() - entry.at >= ASSET_PRICE_TTL_MS;
|
|
2746
|
+
}
|
|
2747
|
+
async function lookup2(ids, fields) {
|
|
2748
|
+
try {
|
|
2749
|
+
return await service.lookupAssets(ids, fields);
|
|
2750
|
+
} catch {
|
|
2751
|
+
return { ok: false, routeMissing: false };
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
async function flushMeta(ids) {
|
|
2755
|
+
for (const id of ids) metaInFlight.add(id);
|
|
2756
|
+
const result = await lookup2(ids, META_FIELDS);
|
|
2757
|
+
const at = now();
|
|
2758
|
+
for (const id of ids) {
|
|
2759
|
+
metaInFlight.delete(id);
|
|
2760
|
+
const previous = meta.get(id);
|
|
2761
|
+
if (!result.ok) {
|
|
2762
|
+
if (result.routeMissing) routeMissing = true;
|
|
2763
|
+
meta.set(id, {
|
|
2764
|
+
...previous,
|
|
2765
|
+
status: previous?.status === "ready" ? "ready" : "failed",
|
|
2766
|
+
retryAt: at + ASSET_RETRY_MS
|
|
2767
|
+
});
|
|
2768
|
+
continue;
|
|
2769
|
+
}
|
|
2770
|
+
const item = result.items[id];
|
|
2771
|
+
const code = item?.error?.code;
|
|
2772
|
+
if (!item || code && TERMINAL_ITEM_ERRORS.has(code)) {
|
|
2773
|
+
meta.set(id, { status: "missing" });
|
|
2774
|
+
continue;
|
|
2775
|
+
}
|
|
2776
|
+
meta.set(id, {
|
|
2777
|
+
status: "ready",
|
|
2778
|
+
symbol: item.symbol ?? previous?.symbol,
|
|
2779
|
+
decimals: item.decimals ?? previous?.decimals,
|
|
2780
|
+
logo: item.logo ?? previous?.logo,
|
|
2781
|
+
retryAt: code ? at + ASSET_RETRY_MS : void 0
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
notify();
|
|
2785
|
+
}
|
|
2786
|
+
async function flushPrices(ids) {
|
|
2787
|
+
for (const id of ids) priceInFlight.add(id);
|
|
2788
|
+
const result = await lookup2(ids, PRICE_FIELDS);
|
|
2789
|
+
const at = now();
|
|
2790
|
+
for (const id of ids) {
|
|
2791
|
+
priceInFlight.delete(id);
|
|
2792
|
+
prices.set(id, {
|
|
2793
|
+
usd: result.ok ? result.items[id]?.priceUsd ?? null : null,
|
|
2794
|
+
at
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
notify();
|
|
2798
|
+
}
|
|
2799
|
+
function requestMeta(refs) {
|
|
2800
|
+
let queued = false;
|
|
2801
|
+
for (const id of idsFor(refs)) {
|
|
2802
|
+
if (!needsMeta(id)) continue;
|
|
2803
|
+
metaQueue.add(id);
|
|
2804
|
+
queued = true;
|
|
2805
|
+
}
|
|
2806
|
+
if (queued) scheduleFlush();
|
|
2807
|
+
}
|
|
2808
|
+
function requestPrices(refs) {
|
|
2809
|
+
let queued = false;
|
|
2810
|
+
for (const id of idsFor(refs)) {
|
|
2811
|
+
if (!needsPrice(id)) continue;
|
|
2812
|
+
priceQueue.add(id);
|
|
2813
|
+
queued = true;
|
|
2814
|
+
}
|
|
2815
|
+
if (queued) scheduleFlush();
|
|
2816
|
+
}
|
|
2817
|
+
function settled(test) {
|
|
2818
|
+
if (test()) return Promise.resolve();
|
|
2819
|
+
return new Promise((resolve) => {
|
|
2820
|
+
const unsubscribe = subscribe(() => {
|
|
2821
|
+
if (!test()) return;
|
|
2822
|
+
unsubscribe();
|
|
2823
|
+
resolve();
|
|
2824
|
+
});
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
function subscribe(listener) {
|
|
2828
|
+
listeners2.add(listener);
|
|
2829
|
+
return () => {
|
|
2830
|
+
listeners2.delete(listener);
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
function peekMeta(id) {
|
|
2834
|
+
const entry = meta.get(id);
|
|
2835
|
+
if (!entry) {
|
|
2836
|
+
return metaInFlight.has(id) || metaQueue.has(id) ? { status: "pending" } : void 0;
|
|
2837
|
+
}
|
|
2838
|
+
const { retryAt: _retryAt, ...rest } = entry;
|
|
2839
|
+
return rest;
|
|
2840
|
+
}
|
|
2841
|
+
return {
|
|
2842
|
+
subscribe,
|
|
2843
|
+
getVersion: () => version2,
|
|
2844
|
+
requestMeta,
|
|
2845
|
+
requestPrices,
|
|
2846
|
+
peekMeta,
|
|
2847
|
+
peekPrice: (id) => prices.get(id)?.usd,
|
|
2848
|
+
async resolveMeta(refs) {
|
|
2849
|
+
const ids = idsFor(refs);
|
|
2850
|
+
requestMeta(refs);
|
|
2851
|
+
await settled(
|
|
2852
|
+
() => ids.every((id) => !metaInFlight.has(id) && !metaQueue.has(id))
|
|
2853
|
+
);
|
|
2854
|
+
return Object.fromEntries(
|
|
2855
|
+
ids.map((id) => [id, peekMeta(id) ?? { status: "missing" }])
|
|
2856
|
+
);
|
|
2857
|
+
},
|
|
2858
|
+
async resolvePrice(ref) {
|
|
2859
|
+
const [id] = idsFor([ref]);
|
|
2860
|
+
if (!id) return null;
|
|
2861
|
+
requestPrices([ref]);
|
|
2862
|
+
await settled(() => !priceInFlight.has(id) && !priceQueue.has(id));
|
|
2863
|
+
return prices.get(id)?.usd ?? null;
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
var AssetStoreContext = createContext3(null);
|
|
2868
|
+
function AssetMetadataProvider({
|
|
2869
|
+
service,
|
|
2870
|
+
children
|
|
2871
|
+
}) {
|
|
2872
|
+
const store = useMemo3(() => createAssetStore(service), [service]);
|
|
2873
|
+
return /* @__PURE__ */ jsx3(AssetStoreContext.Provider, { value: store, children });
|
|
2874
|
+
}
|
|
2875
|
+
function useAssetStore() {
|
|
2876
|
+
return useContext3(AssetStoreContext);
|
|
2877
|
+
}
|
|
2878
|
+
var noopSubscribe = () => () => {
|
|
2879
|
+
};
|
|
2880
|
+
var zero = () => 0;
|
|
2881
|
+
function useStoreVersion(store) {
|
|
2882
|
+
return useSyncExternalStore2(
|
|
2883
|
+
store ? store.subscribe : noopSubscribe,
|
|
2884
|
+
store ? store.getVersion : zero,
|
|
2885
|
+
store ? store.getVersion : zero
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
function refsKey(refs) {
|
|
2889
|
+
return refs.map((ref) => assetIdForRef(ref) ?? "").filter(Boolean).join("|");
|
|
2890
|
+
}
|
|
2891
|
+
function definedRefs(refs) {
|
|
2892
|
+
return refs.filter((ref) => Boolean(ref));
|
|
2893
|
+
}
|
|
2894
|
+
function useAssetMetadata(refs) {
|
|
2895
|
+
const store = useAssetStore();
|
|
2896
|
+
const version2 = useStoreVersion(store);
|
|
2897
|
+
const key = refsKey(refs);
|
|
2635
2898
|
useEffect3(() => {
|
|
2636
|
-
|
|
2637
|
-
}, [
|
|
2638
|
-
return
|
|
2899
|
+
if (store && key) store.requestMeta(definedRefs(refs));
|
|
2900
|
+
}, [store, key]);
|
|
2901
|
+
return useMemo3(() => {
|
|
2902
|
+
const out = {};
|
|
2903
|
+
if (!store || !key) return out;
|
|
2904
|
+
for (const id of key.split("|")) {
|
|
2905
|
+
out[id] = store.peekMeta(id) ?? { status: "pending" };
|
|
2906
|
+
}
|
|
2907
|
+
return out;
|
|
2908
|
+
}, [store, key, version2]);
|
|
2909
|
+
}
|
|
2910
|
+
function useAssetPrices(refs) {
|
|
2911
|
+
const store = useAssetStore();
|
|
2912
|
+
const version2 = useStoreVersion(store);
|
|
2913
|
+
const key = refsKey(refs);
|
|
2914
|
+
useEffect3(() => {
|
|
2915
|
+
if (store && key) store.requestPrices(definedRefs(refs));
|
|
2916
|
+
}, [store, key]);
|
|
2917
|
+
return useMemo3(() => {
|
|
2918
|
+
const out = {};
|
|
2919
|
+
if (!store || !key) return out;
|
|
2920
|
+
for (const id of key.split("|")) {
|
|
2921
|
+
const usd = store.peekPrice(id);
|
|
2922
|
+
if (typeof usd === "number") out[id] = usd;
|
|
2923
|
+
}
|
|
2924
|
+
return out;
|
|
2925
|
+
}, [store, key, version2]);
|
|
2639
2926
|
}
|
|
2640
2927
|
|
|
2641
2928
|
// src/core/analytics.tsx
|
|
2642
2929
|
import {
|
|
2643
|
-
createContext as
|
|
2930
|
+
createContext as createContext4,
|
|
2644
2931
|
useCallback as useCallback3,
|
|
2645
|
-
useContext as
|
|
2932
|
+
useContext as useContext4,
|
|
2646
2933
|
useEffect as useEffect4,
|
|
2647
|
-
useMemo as
|
|
2648
|
-
useRef as
|
|
2934
|
+
useMemo as useMemo4,
|
|
2935
|
+
useRef as useRef2
|
|
2649
2936
|
} from "react";
|
|
2650
2937
|
|
|
2651
2938
|
// src/core/analytics-ingest.ts
|
|
@@ -2994,7 +3281,7 @@ function resolveProxyOrigin(backendUrl) {
|
|
|
2994
3281
|
|
|
2995
3282
|
// src/core/analytics.tsx
|
|
2996
3283
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2997
|
-
var AnalyticsContext =
|
|
3284
|
+
var AnalyticsContext = createContext4(null);
|
|
2998
3285
|
var noopDepositEmitter = () => {
|
|
2999
3286
|
};
|
|
3000
3287
|
var noopWithdrawEmitter = () => {
|
|
@@ -3014,21 +3301,21 @@ function cloneAndFreeze(value) {
|
|
|
3014
3301
|
return value;
|
|
3015
3302
|
}
|
|
3016
3303
|
function AnalyticsSession(props) {
|
|
3017
|
-
const sessionIdRef =
|
|
3304
|
+
const sessionIdRef = useRef2(void 0);
|
|
3018
3305
|
if (sessionIdRef.current === void 0) {
|
|
3019
3306
|
sessionIdRef.current = (props.createSessionId ?? randomUuid)();
|
|
3020
3307
|
}
|
|
3021
|
-
const sessionPropertiesRef =
|
|
3308
|
+
const sessionPropertiesRef = useRef2(void 0);
|
|
3022
3309
|
if (sessionPropertiesRef.current === void 0) {
|
|
3023
3310
|
sessionPropertiesRef.current = cloneAndFreeze(props.sessionProperties);
|
|
3024
3311
|
}
|
|
3025
3312
|
if (props.sessionIdRef) props.sessionIdRef.current = sessionIdRef.current;
|
|
3026
|
-
const onEventRef =
|
|
3313
|
+
const onEventRef = useRef2(props.onEvent);
|
|
3027
3314
|
onEventRef.current = props.onEvent;
|
|
3028
|
-
const nowRef =
|
|
3315
|
+
const nowRef = useRef2(props.now ?? (() => /* @__PURE__ */ new Date()));
|
|
3029
3316
|
nowRef.current = props.now ?? (() => /* @__PURE__ */ new Date());
|
|
3030
3317
|
const modal = props.modal;
|
|
3031
|
-
const reportedFailuresRef =
|
|
3318
|
+
const reportedFailuresRef = useRef2(/* @__PURE__ */ new Set());
|
|
3032
3319
|
const emitFailure = useCallback3(
|
|
3033
3320
|
({ reason, status, droppedEvents }) => {
|
|
3034
3321
|
if (reportedFailuresRef.current.has(reason)) return;
|
|
@@ -3074,11 +3361,11 @@ function AnalyticsSession(props) {
|
|
|
3074
3361
|
initialFailure: null
|
|
3075
3362
|
};
|
|
3076
3363
|
}
|
|
3077
|
-
const ingestRef =
|
|
3364
|
+
const ingestRef = useRef2(void 0);
|
|
3078
3365
|
if (ingestRef.current === void 0) {
|
|
3079
3366
|
ingestRef.current = createIngest();
|
|
3080
3367
|
}
|
|
3081
|
-
const pendingDisposalRef =
|
|
3368
|
+
const pendingDisposalRef = useRef2(null);
|
|
3082
3369
|
const enqueue = useCallback3(
|
|
3083
3370
|
(event) => {
|
|
3084
3371
|
try {
|
|
@@ -3165,24 +3452,24 @@ function AnalyticsSession(props) {
|
|
|
3165
3452
|
},
|
|
3166
3453
|
[enqueue, modal, nowRef, onEventRef]
|
|
3167
3454
|
);
|
|
3168
|
-
const context =
|
|
3455
|
+
const context = useMemo4(
|
|
3169
3456
|
() => modal === "deposit" ? { modal, emit: emitDeposit } : modal === "withdraw" ? { modal, emit: emitWithdraw } : { modal, emit: emitClaim },
|
|
3170
3457
|
[modal, emitDeposit, emitWithdraw, emitClaim]
|
|
3171
3458
|
);
|
|
3172
3459
|
return /* @__PURE__ */ jsx4(AnalyticsContext.Provider, { value: context, children: props.children });
|
|
3173
3460
|
}
|
|
3174
3461
|
function useDepositAnalyticsEmitter() {
|
|
3175
|
-
const context =
|
|
3462
|
+
const context = useContext4(AnalyticsContext);
|
|
3176
3463
|
if (!context || context.modal !== "deposit") return noopDepositEmitter;
|
|
3177
3464
|
return context.emit;
|
|
3178
3465
|
}
|
|
3179
3466
|
function useWithdrawAnalyticsEmitter() {
|
|
3180
|
-
const context =
|
|
3467
|
+
const context = useContext4(AnalyticsContext);
|
|
3181
3468
|
if (!context || context.modal !== "withdraw") return noopWithdrawEmitter;
|
|
3182
3469
|
return context.emit;
|
|
3183
3470
|
}
|
|
3184
3471
|
function useClaimAnalyticsEmitter() {
|
|
3185
|
-
const context =
|
|
3472
|
+
const context = useContext4(AnalyticsContext);
|
|
3186
3473
|
if (!context || context.modal !== "claim") return noopClaimEmitter;
|
|
3187
3474
|
return context.emit;
|
|
3188
3475
|
}
|
|
@@ -3210,7 +3497,6 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3210
3497
|
return {
|
|
3211
3498
|
depositId: row.id,
|
|
3212
3499
|
signer,
|
|
3213
|
-
destinationPrefill: signer,
|
|
3214
3500
|
depositAddress: row.depositAddress,
|
|
3215
3501
|
sourceChainId,
|
|
3216
3502
|
targetChainId,
|
|
@@ -3322,26 +3608,27 @@ function historyBadgeAriaLabel(badge) {
|
|
|
3322
3608
|
}
|
|
3323
3609
|
|
|
3324
3610
|
// src/components/history/HistoryEntryButton.tsx
|
|
3325
|
-
import { jsx as jsx5, jsxs
|
|
3611
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
3326
3612
|
function HistoryEntryButton({
|
|
3327
3613
|
badge,
|
|
3328
3614
|
onClick,
|
|
3329
|
-
disabled
|
|
3615
|
+
disabled,
|
|
3616
|
+
unread = false
|
|
3330
3617
|
}) {
|
|
3331
|
-
return /* @__PURE__ */
|
|
3618
|
+
return /* @__PURE__ */ jsxs(
|
|
3332
3619
|
"button",
|
|
3333
3620
|
{
|
|
3334
3621
|
type: "button",
|
|
3335
3622
|
className: "rs-modal-header-history",
|
|
3336
|
-
"aria-label": historyBadgeAriaLabel(badge),
|
|
3623
|
+
"aria-label": unread ? "Deposit history \u2014 new bank transfer activity" : historyBadgeAriaLabel(badge),
|
|
3337
3624
|
onClick,
|
|
3338
3625
|
disabled,
|
|
3339
3626
|
children: [
|
|
3340
3627
|
/* @__PURE__ */ jsx5(HistoryIcon, {}),
|
|
3341
|
-
badge && /* @__PURE__ */ jsx5(
|
|
3628
|
+
(badge || unread) && /* @__PURE__ */ jsx5(
|
|
3342
3629
|
"span",
|
|
3343
3630
|
{
|
|
3344
|
-
className: `rs-history-dot rs-history-dot--${badge
|
|
3631
|
+
className: `rs-history-dot rs-history-dot--${badge?.state ?? "progress"}`,
|
|
3345
3632
|
"aria-hidden": "true"
|
|
3346
3633
|
}
|
|
3347
3634
|
)
|
|
@@ -3351,16 +3638,16 @@ function HistoryEntryButton({
|
|
|
3351
3638
|
}
|
|
3352
3639
|
|
|
3353
3640
|
// src/components/history/HistoryOverlay.tsx
|
|
3354
|
-
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as
|
|
3641
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as useMemo8, useRef as useRef6, useState as useState9 } from "react";
|
|
3355
3642
|
|
|
3356
3643
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3357
3644
|
import {
|
|
3358
3645
|
useCallback as useCallback4,
|
|
3359
3646
|
useEffect as useEffect5,
|
|
3360
|
-
useId,
|
|
3361
|
-
useMemo as
|
|
3362
|
-
useRef as
|
|
3363
|
-
useState as
|
|
3647
|
+
useId as useId2,
|
|
3648
|
+
useMemo as useMemo6,
|
|
3649
|
+
useRef as useRef3,
|
|
3650
|
+
useState as useState4
|
|
3364
3651
|
} from "react";
|
|
3365
3652
|
|
|
3366
3653
|
// src/components/ui/CdnIcon.tsx
|
|
@@ -3411,65 +3698,8 @@ function CdnIcon({
|
|
|
3411
3698
|
}
|
|
3412
3699
|
CdnIcon.displayName = "CdnIcon";
|
|
3413
3700
|
|
|
3414
|
-
// src/components/ui/BodyHeader.tsx
|
|
3415
|
-
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3416
|
-
function BodyHeader({
|
|
3417
|
-
icon,
|
|
3418
|
-
title,
|
|
3419
|
-
subtitle,
|
|
3420
|
-
variant = "default",
|
|
3421
|
-
aside
|
|
3422
|
-
}) {
|
|
3423
|
-
const iconClasses = [
|
|
3424
|
-
"rs-body-header-icon",
|
|
3425
|
-
variant === "success" ? "rs-body-header-icon--success" : "",
|
|
3426
|
-
variant === "error" ? "rs-body-header-icon--error" : ""
|
|
3427
|
-
].filter(Boolean).join(" ");
|
|
3428
|
-
return /* @__PURE__ */ jsxs3("div", { className: "rs-body-header", children: [
|
|
3429
|
-
/* @__PURE__ */ jsx7("div", { className: iconClasses, children: icon }),
|
|
3430
|
-
/* @__PURE__ */ jsxs3("div", { className: "rs-body-header-main", children: [
|
|
3431
|
-
/* @__PURE__ */ jsxs3("div", { className: "rs-body-header-text", children: [
|
|
3432
|
-
/* @__PURE__ */ jsx7("h2", { className: "rs-body-header-title", children: title }),
|
|
3433
|
-
subtitle && /* @__PURE__ */ jsx7("p", { className: "rs-body-header-subtitle", children: subtitle })
|
|
3434
|
-
] }),
|
|
3435
|
-
aside && /* @__PURE__ */ jsx7("div", { className: "rs-body-header-aside", children: aside })
|
|
3436
|
-
] })
|
|
3437
|
-
] });
|
|
3438
|
-
}
|
|
3439
|
-
BodyHeader.displayName = "BodyHeader";
|
|
3440
|
-
|
|
3441
|
-
// src/components/ui/Spinner.tsx
|
|
3442
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3443
|
-
function Spinner({ className }) {
|
|
3444
|
-
return /* @__PURE__ */ jsxs4(
|
|
3445
|
-
"svg",
|
|
3446
|
-
{
|
|
3447
|
-
className: `rs-spinner ${className || ""}`,
|
|
3448
|
-
fill: "none",
|
|
3449
|
-
viewBox: "0 0 20 21",
|
|
3450
|
-
children: [
|
|
3451
|
-
/* @__PURE__ */ jsx8(
|
|
3452
|
-
"path",
|
|
3453
|
-
{
|
|
3454
|
-
d: "M10 0.5C8.02 0.5 6.08 1.08 4.44 2.18C2.79 3.28 1.51 4.84 0.76 6.67C0.00 8.50 -0.19 10.51 0.19 12.45C0.57 14.39 1.53 16.17 2.92 17.57C4.32 18.96 6.10 19.92 8.04 20.30C9.98 20.69 11.99 20.49 13.82 19.73C15.65 18.98 17.21 17.70 18.31 16.05C19.41 14.41 20 12.47 20 10.5C20 7.84 18.94 5.30 17.07 3.42C15.19 1.55 12.65 0.5 10 0.5ZM10 17.77C8.56 17.77 7.15 17.34 5.95 16.54C4.76 15.74 3.83 14.61 3.28 13.28C2.73 11.95 2.58 10.49 2.86 9.08C3.14 7.67 3.84 6.37 4.85 5.35C5.87 4.34 7.17 3.64 8.58 3.36C9.99 3.08 11.45 3.23 12.78 3.78C14.11 4.33 15.24 5.26 16.04 6.45C16.84 7.65 17.27 9.06 17.27 10.5C17.27 12.42 16.50 14.27 15.14 15.64C13.77 17.00 11.92 17.77 10 17.77Z",
|
|
3455
|
-
fill: "currentColor",
|
|
3456
|
-
opacity: 0.3
|
|
3457
|
-
}
|
|
3458
|
-
),
|
|
3459
|
-
/* @__PURE__ */ jsx8(
|
|
3460
|
-
"path",
|
|
3461
|
-
{
|
|
3462
|
-
d: "M10 3.22C11.74 3.22 13.42 3.84 14.75 4.95C16.08 6.07 16.96 7.61 17.25 9.31C17.30 9.64 17.46 9.94 17.71 10.15C17.96 10.37 18.28 10.49 18.62 10.5C18.82 10.50 19.01 10.45 19.20 10.37C19.38 10.29 19.54 10.16 19.67 10.01C19.80 9.86 19.89 9.68 19.95 9.49C20.00 9.30 20.01 9.10 19.98 8.90C19.59 6.56 18.38 4.42 16.55 2.88C14.72 1.34 12.40 0.5 10 0.5C7.59 0.5 5.27 1.34 3.44 2.88C1.61 4.42 0.40 6.56 0.01 8.90C-0.01 9.10 -0.00 9.30 0.04 9.49C0.10 9.68 0.19 9.86 0.32 10.01C0.45 10.16 0.61 10.29 0.79 10.37C0.98 10.45 1.17 10.50 1.37 10.5C1.71 10.49 2.03 10.37 2.28 10.15C2.53 9.94 2.69 9.64 2.74 9.31C3.03 7.61 3.91 6.07 5.24 4.95C6.57 3.84 8.25 3.22 10 3.22Z",
|
|
3463
|
-
fill: "currentColor"
|
|
3464
|
-
}
|
|
3465
|
-
)
|
|
3466
|
-
]
|
|
3467
|
-
}
|
|
3468
|
-
);
|
|
3469
|
-
}
|
|
3470
|
-
|
|
3471
3701
|
// src/components/ui/Button.tsx
|
|
3472
|
-
import { Fragment as Fragment2, jsx as
|
|
3702
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3473
3703
|
function Button({
|
|
3474
3704
|
children,
|
|
3475
3705
|
variant = "accent",
|
|
@@ -3489,19 +3719,19 @@ function Button({
|
|
|
3489
3719
|
className
|
|
3490
3720
|
].filter(Boolean).join(" ");
|
|
3491
3721
|
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
3492
|
-
return /* @__PURE__ */
|
|
3722
|
+
return /* @__PURE__ */ jsx7(
|
|
3493
3723
|
"button",
|
|
3494
3724
|
{
|
|
3495
3725
|
className: classes,
|
|
3496
3726
|
disabled: disabled || loading,
|
|
3497
3727
|
"aria-busy": loading || void 0,
|
|
3498
3728
|
...props,
|
|
3499
|
-
children: showInlineLoadingText ? /* @__PURE__ */
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3502
|
-
] }) : /* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
loading && /* @__PURE__ */
|
|
3729
|
+
children: showInlineLoadingText ? /* @__PURE__ */ jsxs2("span", { className: "rs-button__loading-row", children: [
|
|
3730
|
+
/* @__PURE__ */ jsx7(Spinner, { className: "rs-spinner--sm" }),
|
|
3731
|
+
/* @__PURE__ */ jsx7("span", { children: loadingText })
|
|
3732
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
3733
|
+
/* @__PURE__ */ jsx7("span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
3734
|
+
loading && /* @__PURE__ */ jsx7("span", { className: "rs-button__spinner", children: /* @__PURE__ */ jsx7(Spinner, { className: "rs-spinner--sm" }) })
|
|
3505
3735
|
] })
|
|
3506
3736
|
}
|
|
3507
3737
|
);
|
|
@@ -3509,9 +3739,9 @@ function Button({
|
|
|
3509
3739
|
Button.displayName = "Button";
|
|
3510
3740
|
|
|
3511
3741
|
// src/components/ui/Callout.tsx
|
|
3512
|
-
import { jsx as
|
|
3742
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3513
3743
|
function CircleAlertIcon() {
|
|
3514
|
-
return /* @__PURE__ */
|
|
3744
|
+
return /* @__PURE__ */ jsx8(
|
|
3515
3745
|
"svg",
|
|
3516
3746
|
{
|
|
3517
3747
|
width: "16",
|
|
@@ -3520,7 +3750,7 @@ function CircleAlertIcon() {
|
|
|
3520
3750
|
fill: "none",
|
|
3521
3751
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3522
3752
|
"aria-hidden": "true",
|
|
3523
|
-
children: /* @__PURE__ */
|
|
3753
|
+
children: /* @__PURE__ */ jsx8(
|
|
3524
3754
|
"path",
|
|
3525
3755
|
{
|
|
3526
3756
|
d: "M10 5.99L6 9.99M6 5.99L10 9.99M14.66 7.99C14.66 11.68 11.68 14.66 8 14.66C4.31 14.66 1.33 11.68 1.33 7.99C1.33 4.31 4.31 1.33 8 1.33C11.68 1.33 14.66 4.31 14.66 7.99Z",
|
|
@@ -3534,14 +3764,14 @@ function CircleAlertIcon() {
|
|
|
3534
3764
|
);
|
|
3535
3765
|
}
|
|
3536
3766
|
function Callout({ variant = "error", children, role }) {
|
|
3537
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsxs3(
|
|
3538
3768
|
"div",
|
|
3539
3769
|
{
|
|
3540
3770
|
className: `rs-callout rs-callout--${variant}`,
|
|
3541
3771
|
role: role ?? (variant === "error" ? "alert" : "status"),
|
|
3542
3772
|
children: [
|
|
3543
|
-
/* @__PURE__ */
|
|
3544
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ jsx8(CircleAlertIcon, {}) : /* @__PURE__ */ jsx8(AlertTriangleIcon, {}) }),
|
|
3774
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-callout-text", children })
|
|
3545
3775
|
]
|
|
3546
3776
|
}
|
|
3547
3777
|
);
|
|
@@ -3549,8 +3779,8 @@ function Callout({ variant = "error", children, role }) {
|
|
|
3549
3779
|
Callout.displayName = "Callout";
|
|
3550
3780
|
|
|
3551
3781
|
// src/components/ui/PoweredBy.tsx
|
|
3552
|
-
import { jsx as
|
|
3553
|
-
var rhinestoneLogo = /* @__PURE__ */
|
|
3782
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3783
|
+
var rhinestoneLogo = /* @__PURE__ */ jsxs4(
|
|
3554
3784
|
"svg",
|
|
3555
3785
|
{
|
|
3556
3786
|
className: "rs-powered-by-logo",
|
|
@@ -3559,8 +3789,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3559
3789
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3560
3790
|
"aria-hidden": "true",
|
|
3561
3791
|
children: [
|
|
3562
|
-
/* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ jsxs4("g", { fill: "currentColor", clipPath: "url(#rs-pb-clip)", children: [
|
|
3793
|
+
/* @__PURE__ */ jsx9(
|
|
3564
3794
|
"path",
|
|
3565
3795
|
{
|
|
3566
3796
|
opacity: "0.5",
|
|
@@ -3569,8 +3799,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3569
3799
|
d: "M10.48 14.82a4.3 4.3 0 0 1-2.9 1 4.3 4.3 0 0 1-2.4-1 25 25 0 0 1-2.08-1.95l-.13-.13c-.78-.78-1.46-1.46-1.94-2.08a4.3 4.3 0 0 1-1-2.9c.05-.96.48-1.72 1-2.4a25 25 0 0 1 1.94-2.08l.07-.06.06-.07a25 25 0 0 1 2.08-1.94 4.3 4.3 0 0 1 2.9-1c.96.05 1.73.48 2.4 1 .62.49 1.3 1.17 2.08 1.94l.13.13c.77.78 1.46 1.46 1.94 2.09a4.3 4.3 0 0 1 1 2.9 4.3 4.3 0 0 1-1 2.39c-.48.62-1.17 1.3-1.94 2.08l-.07.07-.06.06c-.78.78-1.46 1.46-2.08 1.94m-8.9-6.63c.07 1.02.9 1.86 2.56 3.52s2.5 2.5 3.53 2.56h.32c1.03-.06 1.86-.9 3.53-2.56s2.5-2.5 2.56-3.52v-.33c-.07-1.03-.9-1.86-2.56-3.52-1.67-1.67-2.5-2.5-3.53-2.56h-.32c-1.03.06-1.86.89-3.53 2.56-1.66 1.66-2.5 2.5-2.56 3.52z"
|
|
3570
3800
|
}
|
|
3571
3801
|
),
|
|
3572
|
-
/* @__PURE__ */
|
|
3573
|
-
/* @__PURE__ */
|
|
3802
|
+
/* @__PURE__ */ jsx9("path", { d: "M3.66 8.01q.02-.27.28-.35a4.6 4.6 0 0 0 2.53-1.48q.72-.8 1-2.05a.4.4 0 0 1 .36-.29c.17 0 .32.12.36.29a4.6 4.6 0 0 0 1.47 2.52c.55.49 1.21.8 2.06 1a.4.4 0 0 1 .28.36.4.4 0 0 1-.28.36 4.6 4.6 0 0 0-2.53 1.47 4.6 4.6 0 0 0-1 2.06.4.4 0 0 1-.36.28.4.4 0 0 1-.36-.28A4.6 4.6 0 0 0 6 9.38a4.6 4.6 0 0 0-2.06-1.01.4.4 0 0 1-.28-.36m26.46-3.44c0 .51.38.87.96.87s.95-.36.95-.87c0-.52-.37-.86-.95-.86s-.96.34-.96.86m.2 1.44v5.33h1.53V6.01zm-4.4 5.33h-1.55V3.88h1.54v2.98c.25-.5.8-1.01 1.6-1.01 1.29 0 1.87.83 1.87 2.28v3.21h-1.54V8.3c0-.77-.34-1.16-.92-1.16-.67 0-1 .53-1 1.3zm-4.45 0h-1.54V6.01h1.54l-.27 1.22a.1.1 0 0 0 .02.1.1.1 0 0 0 .1.04q.09 0 .1-.09c.24-.84.93-1.36 1.64-1.36q.4.01.57.05v1.42l-.67-.04c-.67 0-1.5.31-1.5 2zm13 0h-1.55V6.01h1.54l-.02.9a1.8 1.8 0 0 1 1.61-1.06c1.3 0 1.88.83 1.88 2.28v3.21H36.4V8.3c0-.77-.35-1.16-.93-1.16-.67 0-1 .53-1 1.3z" }),
|
|
3803
|
+
/* @__PURE__ */ jsx9(
|
|
3574
3804
|
"path",
|
|
3575
3805
|
{
|
|
3576
3806
|
fillRule: "evenodd",
|
|
@@ -3578,8 +3808,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3578
3808
|
d: "M38.74 8.69c0 1.63 1.01 2.82 2.7 2.82 1.51 0 2.32-.82 2.55-1.73l-1.43-.26c-.1.37-.47.82-1.12.82-.67 0-1.23-.6-1.24-1.31H44q.05-.19.06-.56a2.55 2.55 0 0 0-2.6-2.63c-1.5 0-2.72 1.2-2.72 2.85m3.82-.58h-2.3a1.2 1.2 0 0 1 1.18-1.13c.6 0 1.14.45 1.12 1.13"
|
|
3579
3809
|
}
|
|
3580
3810
|
),
|
|
3581
|
-
/* @__PURE__ */
|
|
3582
|
-
/* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ jsx9("path", { d: "M47.1 11.51c-1.2 0-2.33-.41-2.55-1.65l1.43-.21q.27.8 1.1.79c.5 0 .77-.24.77-.55 0-.27-.2-.45-.75-.55l-.5-.1c-1.1-.24-1.77-.74-1.77-1.63 0-1.06.91-1.78 2.25-1.78 1.26 0 2.2.59 2.32 1.68l-1.41.22c-.07-.52-.43-.82-.91-.82-.5 0-.75.26-.75.57 0 .25.17.42.63.51l.5.1c1.28.26 1.94.77 1.94 1.75 0 1.01-1.03 1.66-2.3 1.66" }),
|
|
3812
|
+
/* @__PURE__ */ jsx9(
|
|
3583
3813
|
"path",
|
|
3584
3814
|
{
|
|
3585
3815
|
fillRule: "evenodd",
|
|
@@ -3587,8 +3817,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3587
3817
|
d: "M54.44 8.68c0 1.53 1.08 2.83 2.78 2.83s2.79-1.3 2.79-2.83c0-1.55-1.1-2.84-2.79-2.84-1.7 0-2.78 1.29-2.78 2.84m4.02 0c0 .98-.59 1.45-1.24 1.45-.64 0-1.23-.47-1.23-1.45 0-.97.59-1.47 1.23-1.47.65 0 1.24.48 1.24 1.47"
|
|
3588
3818
|
}
|
|
3589
3819
|
),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsx9("path", { d: "M62.4 11.34h-1.53V6.01h1.54l-.02.9a1.8 1.8 0 0 1 1.6-1.06c1.3 0 1.89.83 1.89 2.28v3.21h-1.54V8.3c0-.77-.34-1.16-.93-1.16-.66 0-1 .53-1 1.3z" }),
|
|
3821
|
+
/* @__PURE__ */ jsx9(
|
|
3592
3822
|
"path",
|
|
3593
3823
|
{
|
|
3594
3824
|
fillRule: "evenodd",
|
|
@@ -3596,38 +3826,280 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3596
3826
|
d: "M66.68 8.69c0 1.63 1.02 2.82 2.71 2.82 1.51 0 2.31-.82 2.55-1.73l-1.44-.26c-.1.37-.47.82-1.12.82-.67 0-1.23-.6-1.24-1.31h3.8q.06-.19.06-.56a2.55 2.55 0 0 0-2.6-2.63c-1.5 0-2.72 1.2-2.72 2.85m3.82-.58h-2.3a1.2 1.2 0 0 1 1.18-1.13c.6 0 1.15.45 1.12 1.13"
|
|
3597
3827
|
}
|
|
3598
3828
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3829
|
+
/* @__PURE__ */ jsx9("path", { d: "M52.44 9.05V7.26h1.53V6h-1.53V4.42h-1.53V6h-1.1v1.26h1.1v1.85l.02.49a1.9 1.9 0 0 0 1.67 1.67c.22.03.47.03.62.03h.65V9.87h-.61c-.4 0-.59 0-.7-.12-.12-.11-.12-.3-.12-.64z" })
|
|
3600
3830
|
] }),
|
|
3601
|
-
/* @__PURE__ */
|
|
3831
|
+
/* @__PURE__ */ jsx9("defs", { children: /* @__PURE__ */ jsx9("clipPath", { id: "rs-pb-clip", children: /* @__PURE__ */ jsx9("path", { fill: "#fff", d: "M0 0h72v16H0z" }) }) })
|
|
3602
3832
|
]
|
|
3603
3833
|
}
|
|
3604
3834
|
);
|
|
3605
3835
|
function PoweredBy() {
|
|
3606
|
-
return /* @__PURE__ */
|
|
3607
|
-
/* @__PURE__ */
|
|
3608
|
-
/* @__PURE__ */
|
|
3836
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rs-powered-by", "aria-label": "Powered by Rhinestone", children: [
|
|
3837
|
+
/* @__PURE__ */ jsx9("span", { children: "Powered by" }),
|
|
3838
|
+
/* @__PURE__ */ jsx9(
|
|
3839
|
+
"a",
|
|
3840
|
+
{
|
|
3841
|
+
className: "rs-powered-by-link",
|
|
3842
|
+
href: "https://www.rhinestone.dev",
|
|
3843
|
+
target: "_blank",
|
|
3844
|
+
rel: "noopener noreferrer",
|
|
3845
|
+
children: rhinestoneLogo
|
|
3846
|
+
}
|
|
3847
|
+
)
|
|
3848
|
+
] });
|
|
3849
|
+
}
|
|
3850
|
+
PoweredBy.displayName = "PoweredBy";
|
|
3851
|
+
|
|
3852
|
+
// src/components/history/BankOrderCard.tsx
|
|
3853
|
+
import { useId, useState as useState3 } from "react";
|
|
3854
|
+
|
|
3855
|
+
// src/components/history/HistoryTransactionLink.tsx
|
|
3856
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3857
|
+
function resolveHistoryChainId(value) {
|
|
3858
|
+
if (value === void 0 || value === null) return null;
|
|
3859
|
+
if (typeof value === "number") return value;
|
|
3860
|
+
const display = displayChainIdForCaip2(value);
|
|
3861
|
+
if (display !== null) return display;
|
|
3862
|
+
if (value === "solana" || value === "hypercore") return value;
|
|
3863
|
+
const number = Number(value);
|
|
3864
|
+
return Number.isFinite(number) ? number : null;
|
|
3865
|
+
}
|
|
3866
|
+
function HistoryTransactionLink({
|
|
3867
|
+
chainId,
|
|
3868
|
+
txHash,
|
|
3869
|
+
label = "Transaction details"
|
|
3870
|
+
}) {
|
|
3871
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
3872
|
+
const chain = resolveHistoryChainId(chainId);
|
|
3873
|
+
const url = chain !== null && txHash ? explorerTxUrl(chain, txHash) : void 0;
|
|
3874
|
+
if (!url || !txHash) return null;
|
|
3875
|
+
const text = txHash.length > 14 ? `${txHash.slice(0, 6)}\u2026${txHash.slice(-4)}` : txHash;
|
|
3876
|
+
return /* @__PURE__ */ jsxs5("div", { className: "rs-amount-detail-row", children: [
|
|
3877
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
3878
|
+
/* @__PURE__ */ jsxs5(
|
|
3609
3879
|
"a",
|
|
3610
3880
|
{
|
|
3611
|
-
|
|
3612
|
-
href: "https://www.rhinestone.dev",
|
|
3881
|
+
href: url,
|
|
3613
3882
|
target: "_blank",
|
|
3614
3883
|
rel: "noopener noreferrer",
|
|
3615
|
-
|
|
3884
|
+
className: "rs-history-card-link",
|
|
3885
|
+
"aria-label": `${label}: ${txHash}`,
|
|
3886
|
+
children: [
|
|
3887
|
+
/* @__PURE__ */ jsx10("span", { children: text }),
|
|
3888
|
+
/* @__PURE__ */ jsx10(ArrowUpRightIcon, {})
|
|
3889
|
+
]
|
|
3616
3890
|
}
|
|
3617
3891
|
)
|
|
3618
3892
|
] });
|
|
3619
3893
|
}
|
|
3620
|
-
|
|
3894
|
+
|
|
3895
|
+
// src/core/bank-onramp-progress.ts
|
|
3896
|
+
function toPaymentProgress(order) {
|
|
3897
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
3898
|
+
const stages = [receipt.status, conversion.status, delivery.status];
|
|
3899
|
+
if (stages.includes("on_hold")) return "on_hold";
|
|
3900
|
+
if (order.stages.return.status !== "none") return "returned";
|
|
3901
|
+
if (stages.includes("failed")) return "failed";
|
|
3902
|
+
if (delivery.status === "completed") return "delivered";
|
|
3903
|
+
if (delivery.status !== "not_started") return "sending";
|
|
3904
|
+
if (conversion.status === "completed") return "sending";
|
|
3905
|
+
if (conversion.status !== "not_started") return "converting";
|
|
3906
|
+
if (receipt.status === "completed") return "received";
|
|
3907
|
+
return "awaiting_transfer";
|
|
3908
|
+
}
|
|
3909
|
+
var TERMINAL = /* @__PURE__ */ new Set([
|
|
3910
|
+
"delivered",
|
|
3911
|
+
"returned",
|
|
3912
|
+
"failed"
|
|
3913
|
+
]);
|
|
3914
|
+
function toPaymentView(order) {
|
|
3915
|
+
const progress = toPaymentProgress(order);
|
|
3916
|
+
return {
|
|
3917
|
+
id: order.id,
|
|
3918
|
+
amount: order.fiat.charged?.total ?? "",
|
|
3919
|
+
currency: order.fiat.charged?.currency ?? "",
|
|
3920
|
+
progress,
|
|
3921
|
+
terminal: TERMINAL.has(progress)
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3924
|
+
var BANK_ONRAMP_COPY = {
|
|
3925
|
+
awaiting_transfer: {
|
|
3926
|
+
title: "Waiting for your transfer",
|
|
3927
|
+
subtitle: "Send the transfer from your bank using the details above."
|
|
3928
|
+
},
|
|
3929
|
+
received: {
|
|
3930
|
+
title: "Transfer received",
|
|
3931
|
+
subtitle: "Your bank transfer has arrived and is being processed."
|
|
3932
|
+
},
|
|
3933
|
+
converting: {
|
|
3934
|
+
title: "Converting",
|
|
3935
|
+
subtitle: "Your money is being converted to crypto."
|
|
3936
|
+
},
|
|
3937
|
+
sending: {
|
|
3938
|
+
title: "Sending to your account",
|
|
3939
|
+
subtitle: "The crypto is on its way. This usually takes a few minutes."
|
|
3940
|
+
},
|
|
3941
|
+
delivered: {
|
|
3942
|
+
title: "Funds delivered",
|
|
3943
|
+
subtitle: "The crypto has arrived in your account."
|
|
3944
|
+
},
|
|
3945
|
+
on_hold: {
|
|
3946
|
+
title: "Under review",
|
|
3947
|
+
subtitle: "Your provider is reviewing this transfer and may contact you for more information."
|
|
3948
|
+
},
|
|
3949
|
+
returned: {
|
|
3950
|
+
title: "Transfer returned",
|
|
3951
|
+
subtitle: "This transfer was returned. Contact support if unexpected."
|
|
3952
|
+
},
|
|
3953
|
+
failed: {
|
|
3954
|
+
title: "Transfer failed",
|
|
3955
|
+
subtitle: "This transfer could not be completed. Contact support."
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
// src/components/history/BankOrderCard.tsx
|
|
3960
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3961
|
+
function bankSupportHref(value) {
|
|
3962
|
+
if (!value) return void 0;
|
|
3963
|
+
try {
|
|
3964
|
+
const url = new URL(value);
|
|
3965
|
+
return ["https:", "mailto:"].includes(url.protocol) ? url.href : void 0;
|
|
3966
|
+
} catch {
|
|
3967
|
+
return void 0;
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
function BankOrderCard({
|
|
3971
|
+
order,
|
|
3972
|
+
supportUrl,
|
|
3973
|
+
children,
|
|
3974
|
+
deposit
|
|
3975
|
+
}) {
|
|
3976
|
+
const [expanded, setExpanded] = useState3(false);
|
|
3977
|
+
const panelId = useId();
|
|
3978
|
+
const view = toPaymentView(order);
|
|
3979
|
+
const subFee = [order.stages.conversion, order.stages.delivery].some(
|
|
3980
|
+
(stage) => stage.status === "failed" && stage.reason === "sub_fee"
|
|
3981
|
+
);
|
|
3982
|
+
const support = bankSupportHref(supportUrl);
|
|
3983
|
+
const { delivery } = order.stages;
|
|
3984
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : void 0;
|
|
3985
|
+
const needsHelp = ["failed", "returned", "on_hold"].includes(view.progress);
|
|
3986
|
+
const settlement = deposit ? normalizeStatus(deposit.status, deposit.isSpam) : null;
|
|
3987
|
+
let status = "pending";
|
|
3988
|
+
let label = "Detected";
|
|
3989
|
+
if (view.progress === "failed" || settlement === "failed" || settlement === "spam") {
|
|
3990
|
+
status = "failed";
|
|
3991
|
+
label = "Failed";
|
|
3992
|
+
} else if (view.progress === "returned" || settlement === "refunded") {
|
|
3993
|
+
status = "refunded";
|
|
3994
|
+
label = "Returned";
|
|
3995
|
+
} else if (settlement === "completed") {
|
|
3996
|
+
status = "completed";
|
|
3997
|
+
label = "Completed";
|
|
3998
|
+
} else if (view.progress === "on_hold") {
|
|
3999
|
+
status = "processing";
|
|
4000
|
+
label = "Under review";
|
|
4001
|
+
} else if (view.progress === "delivered") {
|
|
4002
|
+
status = "processing";
|
|
4003
|
+
label = "Settled";
|
|
4004
|
+
} else if (view.progress !== "awaiting_transfer" && view.progress !== "received") {
|
|
4005
|
+
status = "processing";
|
|
4006
|
+
label = "Settling";
|
|
4007
|
+
}
|
|
4008
|
+
const amount = view.amount && Number.isFinite(Number(view.amount)) ? `${Number(view.amount).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${view.currency}` : "\u2014";
|
|
4009
|
+
const date = new Date(order.createdAt).toLocaleDateString(void 0, {
|
|
4010
|
+
day: "numeric",
|
|
4011
|
+
month: "short",
|
|
4012
|
+
year: "numeric"
|
|
4013
|
+
});
|
|
4014
|
+
const description = subFee ? "The transfer was consumed by the provider\u2019s fees. No crypto was delivered." : label === "Failed" && deposit ? "Crypto arrived, but settlement to your destination could not be completed." : label === "Completed" ? "Your bank transfer has completed and the crypto reached its destination." : label === "Settled" ? "Your bank transfer has settled into crypto. Final delivery is being confirmed." : label === "Settling" ? "Your bank transfer is being settled into crypto." : label === "Detected" ? "Your bank transfer was detected and is awaiting settlement." : BANK_ONRAMP_COPY[view.progress].subtitle;
|
|
4015
|
+
return /* @__PURE__ */ jsxs6(
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
className: `rs-history-card${expanded ? " rs-history-card--expanded" : ""}`,
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ jsx11(
|
|
4021
|
+
"button",
|
|
4022
|
+
{
|
|
4023
|
+
type: "button",
|
|
4024
|
+
className: "rs-history-card-trigger",
|
|
4025
|
+
onClick: () => setExpanded(!expanded),
|
|
4026
|
+
"aria-expanded": expanded,
|
|
4027
|
+
"aria-controls": panelId,
|
|
4028
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "rs-history-card-row", children: [
|
|
4029
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-history-card-icons", children: /* @__PURE__ */ jsx11("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx11(BankIcon, {}) }) }),
|
|
4030
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-history-card-text", children: [
|
|
4031
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-history-card-title", children: "Bank transfer" }),
|
|
4032
|
+
/* @__PURE__ */ jsx11("time", { className: "rs-history-card-date", dateTime: order.createdAt, children: date })
|
|
4033
|
+
] }),
|
|
4034
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-history-card-side", children: [
|
|
4035
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-history-card-amount", children: amount }),
|
|
4036
|
+
/* @__PURE__ */ jsx11("span", { className: `rs-history-badge rs-history-badge--${status}`, children: label })
|
|
4037
|
+
] })
|
|
4038
|
+
] })
|
|
4039
|
+
}
|
|
4040
|
+
),
|
|
4041
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-history-card-panel", id: panelId, children: /* @__PURE__ */ jsx11("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs6("div", { className: "rs-history-card-details", children: [
|
|
4042
|
+
subFee || status === "failed" ? /* @__PURE__ */ jsx11(Callout, { variant: "error", children: description }) : /* @__PURE__ */ jsx11("p", { className: "rs-history-empty-hint", children: description }),
|
|
4043
|
+
order.crypto && /* @__PURE__ */ jsxs6("div", { className: "rs-amount-detail-row", children: [
|
|
4044
|
+
/* @__PURE__ */ jsx11("span", { children: "Converted amount" }),
|
|
4045
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-amount-detail-value", children: [
|
|
4046
|
+
order.crypto.amount,
|
|
4047
|
+
" ",
|
|
4048
|
+
order.crypto.asset
|
|
4049
|
+
] })
|
|
4050
|
+
] }),
|
|
4051
|
+
/* @__PURE__ */ jsx11(
|
|
4052
|
+
HistoryTransactionLink,
|
|
4053
|
+
{
|
|
4054
|
+
chainId: deposit?.chain ?? order.deliveryChain,
|
|
4055
|
+
txHash: deposit?.txHash ?? deliveryTxHash,
|
|
4056
|
+
label: "Crypto deposit"
|
|
4057
|
+
}
|
|
4058
|
+
),
|
|
4059
|
+
deposit?.destinationTxHash !== deposit?.txHash && /* @__PURE__ */ jsx11(HistoryTransactionLink, { chainId: deposit?.targetChain, txHash: deposit?.destinationTxHash, label: "Final settlement" }),
|
|
4060
|
+
(needsHelp || status === "failed") && support && /* @__PURE__ */ jsxs6(
|
|
4061
|
+
"a",
|
|
4062
|
+
{
|
|
4063
|
+
className: "rs-history-card-link",
|
|
4064
|
+
href: support,
|
|
4065
|
+
target: "_blank",
|
|
4066
|
+
rel: "noopener noreferrer",
|
|
4067
|
+
children: [
|
|
4068
|
+
"Contact support ",
|
|
4069
|
+
/* @__PURE__ */ jsx11(ArrowUpRightIcon, {})
|
|
4070
|
+
]
|
|
4071
|
+
}
|
|
4072
|
+
),
|
|
4073
|
+
children
|
|
4074
|
+
] }) }) })
|
|
4075
|
+
]
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4078
|
+
}
|
|
3621
4079
|
|
|
3622
4080
|
// src/components/ui/TokenIcon.tsx
|
|
3623
4081
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3624
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
4082
|
+
function TokenIcon({ token, symbol, className, fallback }) {
|
|
4083
|
+
const id = assetIdForRef(token);
|
|
4084
|
+
const entry = useAssetMetadata([token])[id ?? ""];
|
|
4085
|
+
const classes = `rs-token-icon ${className ?? ""}`.trimEnd();
|
|
4086
|
+
const badge = fallback ?? /* @__PURE__ */ jsx12("span", { className: "rs-token-initials", "aria-hidden": "true", children: (symbol ?? "").trim().slice(0, 1).toUpperCase() });
|
|
4087
|
+
if (entry?.status === "pending") {
|
|
4088
|
+
return /* @__PURE__ */ jsx12(
|
|
4089
|
+
"span",
|
|
4090
|
+
{
|
|
4091
|
+
className: `${classes} rs-token-icon--pending`,
|
|
4092
|
+
"data-loading": "",
|
|
4093
|
+
"aria-hidden": "true"
|
|
4094
|
+
}
|
|
4095
|
+
);
|
|
4096
|
+
}
|
|
3625
4097
|
return /* @__PURE__ */ jsx12(
|
|
3626
4098
|
CdnIcon,
|
|
3627
4099
|
{
|
|
3628
|
-
src:
|
|
3629
|
-
className:
|
|
3630
|
-
fallback
|
|
4100
|
+
src: entry?.status === "ready" ? entry.logo : void 0,
|
|
4101
|
+
className: classes,
|
|
4102
|
+
fallback: badge
|
|
3631
4103
|
}
|
|
3632
4104
|
);
|
|
3633
4105
|
}
|
|
@@ -3707,8 +4179,84 @@ function resolveHistoryTiming({
|
|
|
3707
4179
|
};
|
|
3708
4180
|
}
|
|
3709
4181
|
|
|
4182
|
+
// src/core/token-display.ts
|
|
4183
|
+
import { useMemo as useMemo5, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
4184
|
+
function isHyperCore(chain) {
|
|
4185
|
+
return chain === "hypercore" || chain === HYPERCORE_CHAIN_ID;
|
|
4186
|
+
}
|
|
4187
|
+
function resolveCuratedToken(token, chain) {
|
|
4188
|
+
if (isHyperCore(chain)) {
|
|
4189
|
+
const listed = HYPERCORE_SOURCE_TOKENS.find(
|
|
4190
|
+
(t) => t.address.toLowerCase() === token.toLowerCase()
|
|
4191
|
+
);
|
|
4192
|
+
return listed ? { symbol: listed.symbol, decimals: listed.decimals } : void 0;
|
|
4193
|
+
}
|
|
4194
|
+
const published = getRuntimeTokenByAddress(chain, token);
|
|
4195
|
+
if (published) {
|
|
4196
|
+
return { symbol: published.symbol, decimals: published.decimals };
|
|
4197
|
+
}
|
|
4198
|
+
if (chain === "solana") return resolveSolanaToken(token);
|
|
4199
|
+
if (isNativeSpelling(chain, token)) {
|
|
4200
|
+
const symbol = getRuntimeNativeSymbol(chain);
|
|
4201
|
+
const decimals = getRuntimeNativeDecimals(chain) ?? (typeof chain === "number" ? 18 : void 0);
|
|
4202
|
+
return symbol ? { symbol, decimals } : void 0;
|
|
4203
|
+
}
|
|
4204
|
+
return void 0;
|
|
4205
|
+
}
|
|
4206
|
+
function resolveTokenDisplay(token, chain, asset, fallback) {
|
|
4207
|
+
const pending = asset?.status === "pending";
|
|
4208
|
+
const curated = token !== void 0 && chain !== void 0 ? resolveCuratedToken(token, chain) : void 0;
|
|
4209
|
+
const fromAsset = asset?.status === "ready" ? asset : void 0;
|
|
4210
|
+
const hyperCore = chain !== void 0 && isHyperCore(chain);
|
|
4211
|
+
const native = token !== void 0 && chain !== void 0 && isNativeSpelling(chain, token);
|
|
4212
|
+
const curatedSymbol = native ? curated?.symbol ?? fromAsset?.symbol : fromAsset?.symbol ?? curated?.symbol;
|
|
4213
|
+
const decimals = fallback?.decimals ?? curated?.decimals ?? (hyperCore ? void 0 : fromAsset?.decimals);
|
|
4214
|
+
return {
|
|
4215
|
+
symbol: curatedSymbol ?? fallback?.symbol ?? "Token",
|
|
4216
|
+
decimals,
|
|
4217
|
+
logo: fromAsset?.logo,
|
|
4218
|
+
curated: curatedSymbol !== void 0,
|
|
4219
|
+
pending
|
|
4220
|
+
};
|
|
4221
|
+
}
|
|
4222
|
+
function toAssetRef(ref) {
|
|
4223
|
+
return ref?.chain !== void 0 && ref.address ? { chain: ref.chain, address: ref.address } : void 0;
|
|
4224
|
+
}
|
|
4225
|
+
function useTokenDisplays(refs) {
|
|
4226
|
+
const { catalog } = useChainCatalog();
|
|
4227
|
+
const tokensVersion = useSyncExternalStore3(
|
|
4228
|
+
subscribeToRuntimeTokens,
|
|
4229
|
+
getRuntimeTokensVersion,
|
|
4230
|
+
getRuntimeTokensVersion
|
|
4231
|
+
);
|
|
4232
|
+
const assets = useAssetMetadata(refs.map(toAssetRef));
|
|
4233
|
+
const key = refs.map(
|
|
4234
|
+
(ref) => `${String(ref?.chain)}:${ref?.address ?? ""}:${ref?.fallback?.symbol ?? ""}:${ref?.fallback?.decimals ?? ""}`
|
|
4235
|
+
).join("|");
|
|
4236
|
+
return useMemo5(
|
|
4237
|
+
() => refs.map((ref) => {
|
|
4238
|
+
const id = assetIdFor(ref?.chain, ref?.address);
|
|
4239
|
+
return resolveTokenDisplay(
|
|
4240
|
+
ref?.address,
|
|
4241
|
+
ref?.chain,
|
|
4242
|
+
id ? assets[id] : void 0,
|
|
4243
|
+
ref?.fallback
|
|
4244
|
+
);
|
|
4245
|
+
}),
|
|
4246
|
+
// `refs` enters through `key`.
|
|
4247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4248
|
+
[key, assets, catalog, tokensVersion]
|
|
4249
|
+
);
|
|
4250
|
+
}
|
|
4251
|
+
function useTokenDisplay(chain, address, fallback) {
|
|
4252
|
+
return useTokenDisplays([{ chain, address, fallback }])[0];
|
|
4253
|
+
}
|
|
4254
|
+
function useIsRecognizedToken(chain, address) {
|
|
4255
|
+
return useTokenDisplay(chain, address).curated;
|
|
4256
|
+
}
|
|
4257
|
+
|
|
3710
4258
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3711
|
-
import { jsx as jsx13, jsxs as
|
|
4259
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3712
4260
|
var MAX_TIMER_DELAY_MS = 2147e6;
|
|
3713
4261
|
function shortenHash(hash) {
|
|
3714
4262
|
if (hash.length <= 14) return hash;
|
|
@@ -3727,60 +4275,8 @@ function formatDate(iso) {
|
|
|
3727
4275
|
return iso;
|
|
3728
4276
|
}
|
|
3729
4277
|
}
|
|
3730
|
-
function
|
|
3731
|
-
if (
|
|
3732
|
-
if (typeof value === "number") return value;
|
|
3733
|
-
const display = displayChainIdForCaip2(value);
|
|
3734
|
-
if (display !== null) return display;
|
|
3735
|
-
if (value === "solana" || value === "hypercore") return value;
|
|
3736
|
-
const num = Number(value);
|
|
3737
|
-
return Number.isFinite(num) ? num : null;
|
|
3738
|
-
}
|
|
3739
|
-
function resolveTokenSymbol(token, chainId) {
|
|
3740
|
-
if (!token) return "";
|
|
3741
|
-
if (chainId === "solana") {
|
|
3742
|
-
const normalized = token.toLowerCase();
|
|
3743
|
-
const matched = SOLANA_TOKENS.find(
|
|
3744
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3745
|
-
);
|
|
3746
|
-
if (matched) return matched.symbol;
|
|
3747
|
-
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3748
|
-
return "SOL";
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && // Both callers pass the SOURCE chain, and `/chains` reports
|
|
3752
|
-
// `deposit: false` for Tron and Stellar — so neither can appear here, and
|
|
3753
|
-
// neither has an EVM token table to look one up in if it did.
|
|
3754
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3755
|
-
const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
|
|
3756
|
-
const sym = getTokenSymbol(token, evmChainId);
|
|
3757
|
-
if (sym !== "Token") return sym;
|
|
3758
|
-
}
|
|
3759
|
-
return shortenHash(token);
|
|
3760
|
-
}
|
|
3761
|
-
function formatAmount(rawAmount, token, chainId) {
|
|
3762
|
-
if (!rawAmount) return "";
|
|
3763
|
-
let decimals = 18;
|
|
3764
|
-
if (token && chainId !== null && chainId !== void 0) {
|
|
3765
|
-
if (chainId === "solana") {
|
|
3766
|
-
const normalized = token.toLowerCase();
|
|
3767
|
-
const matched = SOLANA_TOKENS.find(
|
|
3768
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3769
|
-
);
|
|
3770
|
-
if (matched) {
|
|
3771
|
-
decimals = matched.decimals;
|
|
3772
|
-
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3773
|
-
decimals = 9;
|
|
3774
|
-
}
|
|
3775
|
-
} else if (
|
|
3776
|
-
// See `resolveTokenSymbol`: this reads the source chain, which Tron and
|
|
3777
|
-
// Stellar cannot be.
|
|
3778
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)
|
|
3779
|
-
) {
|
|
3780
|
-
const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
|
|
3781
|
-
decimals = getTokenDecimalsByAddress(token, evmChainId);
|
|
3782
|
-
}
|
|
3783
|
-
}
|
|
4278
|
+
function formatAmount(rawAmount, decimals) {
|
|
4279
|
+
if (!rawAmount || decimals === void 0) return null;
|
|
3784
4280
|
try {
|
|
3785
4281
|
const raw = BigInt(rawAmount);
|
|
3786
4282
|
const divisor = 10n ** BigInt(decimals);
|
|
@@ -3795,6 +4291,8 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3795
4291
|
}
|
|
3796
4292
|
}
|
|
3797
4293
|
function DepositHistoryPanel({
|
|
4294
|
+
bankHistory,
|
|
4295
|
+
bankSupportUrl,
|
|
3798
4296
|
deposits,
|
|
3799
4297
|
isLoading,
|
|
3800
4298
|
error,
|
|
@@ -3811,7 +4309,7 @@ function DepositHistoryPanel({
|
|
|
3811
4309
|
onRowView,
|
|
3812
4310
|
obscured
|
|
3813
4311
|
}) {
|
|
3814
|
-
const rootRef =
|
|
4312
|
+
const rootRef = useRef3(null);
|
|
3815
4313
|
useEffect5(() => {
|
|
3816
4314
|
rootRef.current?.toggleAttribute("inert", Boolean(obscured));
|
|
3817
4315
|
}, [obscured]);
|
|
@@ -3825,12 +4323,12 @@ function DepositHistoryPanel({
|
|
|
3825
4323
|
},
|
|
3826
4324
|
[onClose, obscured]
|
|
3827
4325
|
);
|
|
3828
|
-
const visibleDeposits =
|
|
4326
|
+
const visibleDeposits = useMemo6(
|
|
3829
4327
|
() => filterVisibleDeposits(deposits),
|
|
3830
4328
|
[deposits]
|
|
3831
4329
|
);
|
|
3832
|
-
const [nowMs, setNowMs] =
|
|
3833
|
-
const timingPresentations =
|
|
4330
|
+
const [nowMs, setNowMs] = useState4(() => Date.now());
|
|
4331
|
+
const timingPresentations = useMemo6(
|
|
3834
4332
|
() => visibleDeposits.map(
|
|
3835
4333
|
(deposit) => resolveHistoryTiming({
|
|
3836
4334
|
status: deposit.status,
|
|
@@ -3871,7 +4369,7 @@ function DepositHistoryPanel({
|
|
|
3871
4369
|
if (timeout !== void 0) clearTimeout(timeout);
|
|
3872
4370
|
};
|
|
3873
4371
|
}, [timingPresentations]);
|
|
3874
|
-
return /* @__PURE__ */
|
|
4372
|
+
return /* @__PURE__ */ jsxs7(
|
|
3875
4373
|
"div",
|
|
3876
4374
|
{
|
|
3877
4375
|
ref: rootRef,
|
|
@@ -3881,8 +4379,8 @@ function DepositHistoryPanel({
|
|
|
3881
4379
|
"aria-hidden": obscured || void 0,
|
|
3882
4380
|
onKeyDown: handleKeyDown,
|
|
3883
4381
|
children: [
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */
|
|
4382
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-modal-header--redesigned", children: [
|
|
4383
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsxs7(
|
|
3886
4384
|
"button",
|
|
3887
4385
|
{
|
|
3888
4386
|
type: "button",
|
|
@@ -3906,10 +4404,10 @@ function DepositHistoryPanel({
|
|
|
3906
4404
|
}
|
|
3907
4405
|
) })
|
|
3908
4406
|
] }),
|
|
3909
|
-
/* @__PURE__ */
|
|
3910
|
-
/* @__PURE__ */
|
|
4407
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-screen", children: [
|
|
4408
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-screen-body", children: [
|
|
3911
4409
|
/* @__PURE__ */ jsx13(BodyHeader, { icon: /* @__PURE__ */ jsx13(HistoryIcon, {}), title }),
|
|
3912
|
-
onFindByTxHash && /* @__PURE__ */
|
|
4410
|
+
onFindByTxHash && /* @__PURE__ */ jsxs7(
|
|
3913
4411
|
"button",
|
|
3914
4412
|
{
|
|
3915
4413
|
type: "button",
|
|
@@ -3921,40 +4419,82 @@ function DepositHistoryPanel({
|
|
|
3921
4419
|
]
|
|
3922
4420
|
}
|
|
3923
4421
|
),
|
|
3924
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
4422
|
+
(isLoading || bankHistory?.loading) && deposits.length === 0 && !bankHistory?.orders.length && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3925
4423
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(HistoryIcon, {}) }),
|
|
3926
|
-
/* @__PURE__ */
|
|
4424
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3927
4425
|
/* @__PURE__ */ jsx13(Spinner, { className: "rs-spinner--sm" }),
|
|
3928
4426
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
3929
4427
|
] })
|
|
3930
4428
|
] }),
|
|
3931
|
-
error && !isLoading && /* @__PURE__ */
|
|
4429
|
+
error && !isLoading && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3932
4430
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(AlertTriangleIcon, {}) }),
|
|
3933
|
-
/* @__PURE__ */
|
|
4431
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3934
4432
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
3935
4433
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: error })
|
|
3936
4434
|
] })
|
|
3937
4435
|
] }),
|
|
3938
|
-
|
|
4436
|
+
bankHistory?.error && /* @__PURE__ */ jsx13("p", { role: "status", children: bankHistory.error }),
|
|
4437
|
+
!isLoading && !error && !bankHistory?.loading && !bankHistory?.error && !bankHistory?.orders.length && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3939
4438
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(HistoryIcon, {}) }),
|
|
3940
|
-
/* @__PURE__ */
|
|
4439
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3941
4440
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
3942
4441
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
3943
4442
|
] })
|
|
3944
4443
|
] }),
|
|
3945
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
3946
|
-
|
|
3947
|
-
|
|
4444
|
+
(visibleDeposits.length > 0 || Boolean(bankHistory?.orders.length)) && /* @__PURE__ */ jsxs7("div", { className: "rs-history-list", children: [
|
|
4445
|
+
[
|
|
4446
|
+
...visibleDeposits.filter(
|
|
4447
|
+
(deposit) => !bankHistory?.orders.some(
|
|
4448
|
+
(order) => order.stages.delivery.status === "completed" && order.stages.delivery.depositId === deposit.id
|
|
4449
|
+
)
|
|
4450
|
+
).map((deposit, i) => ({
|
|
4451
|
+
id: `deposit:${deposit.id ?? deposit.txHash}`,
|
|
4452
|
+
createdAt: deposit.createdAt ?? "",
|
|
4453
|
+
content: /* @__PURE__ */ jsx13(
|
|
4454
|
+
HistoryCard,
|
|
4455
|
+
{
|
|
4456
|
+
deposit,
|
|
4457
|
+
timing: timingPresentations[visibleDeposits.indexOf(deposit)],
|
|
4458
|
+
position: i,
|
|
4459
|
+
recipient,
|
|
4460
|
+
onRecover,
|
|
4461
|
+
onRowView
|
|
4462
|
+
},
|
|
4463
|
+
deposit.txHash || i
|
|
4464
|
+
)
|
|
4465
|
+
})),
|
|
4466
|
+
...(bankHistory?.orders ?? []).map((order) => {
|
|
4467
|
+
const delivery = order.stages.delivery;
|
|
4468
|
+
const linked = delivery.status === "completed" ? visibleDeposits.find(
|
|
4469
|
+
(deposit) => deposit.id === delivery.depositId
|
|
4470
|
+
) : void 0;
|
|
4471
|
+
return {
|
|
4472
|
+
id: `bank:${order.id}`,
|
|
4473
|
+
createdAt: order.createdAt,
|
|
4474
|
+
content: /* @__PURE__ */ jsx13(BankOrderCard, { order, deposit: linked, supportUrl: bankSupportUrl, children: linked && normalizeStatus(linked.status) === "failed" && /* @__PURE__ */ jsx13(
|
|
4475
|
+
HistoryCard,
|
|
4476
|
+
{
|
|
4477
|
+
deposit: linked,
|
|
4478
|
+
position: visibleDeposits.indexOf(linked),
|
|
4479
|
+
recipient,
|
|
4480
|
+
onRecover,
|
|
4481
|
+
onRowView,
|
|
4482
|
+
timing: timingPresentations[visibleDeposits.indexOf(linked)]
|
|
4483
|
+
}
|
|
4484
|
+
) })
|
|
4485
|
+
};
|
|
4486
|
+
})
|
|
4487
|
+
].sort((a, b) => b.createdAt.localeCompare(a.createdAt)).map((entry) => /* @__PURE__ */ jsx13("div", { children: entry.content }, entry.id)),
|
|
4488
|
+
bankHistory?.hasMore && /* @__PURE__ */ jsx13(
|
|
4489
|
+
"button",
|
|
3948
4490
|
{
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
deposit.txHash || i
|
|
3957
|
-
)),
|
|
4491
|
+
type: "button",
|
|
4492
|
+
className: "rs-history-load-more",
|
|
4493
|
+
disabled: bankHistory.loading,
|
|
4494
|
+
onClick: bankHistory.loadMore,
|
|
4495
|
+
children: "Load older bank transfers"
|
|
4496
|
+
}
|
|
4497
|
+
),
|
|
3958
4498
|
hasMore && /* @__PURE__ */ jsx13(
|
|
3959
4499
|
"button",
|
|
3960
4500
|
{
|
|
@@ -3981,27 +4521,27 @@ function HistoryCard({
|
|
|
3981
4521
|
onRecover,
|
|
3982
4522
|
onRowView
|
|
3983
4523
|
}) {
|
|
3984
|
-
const
|
|
3985
|
-
const
|
|
3986
|
-
const panelId = useId();
|
|
4524
|
+
const [expanded, setExpanded] = useState4(false);
|
|
4525
|
+
const panelId = useId2();
|
|
3987
4526
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
3988
|
-
const sourceChainId =
|
|
3989
|
-
const targetChainId =
|
|
4527
|
+
const sourceChainId = resolveHistoryChainId(deposit.chain);
|
|
4528
|
+
const targetChainId = resolveHistoryChainId(deposit.targetChain);
|
|
3990
4529
|
const sourceChainName = sourceChainId ? getChainName(sourceChainId) : null;
|
|
3991
4530
|
const targetChainName = targetChainId ? getChainName(targetChainId) : null;
|
|
3992
4531
|
const sourceChainIcon = sourceChainId ? getChainIcon(sourceChainId) : void 0;
|
|
3993
4532
|
const targetChainIcon = targetChainId ? getChainIcon(targetChainId) : void 0;
|
|
3994
|
-
const
|
|
4533
|
+
const sourceToken = deposit.token ?? void 0;
|
|
4534
|
+
const tokenDisplay = useTokenDisplay(sourceChainId ?? void 0, sourceToken);
|
|
4535
|
+
const sourceSymbol = !sourceToken ? "" : tokenDisplay.curated ? tokenDisplay.symbol : shortenHash(sourceToken);
|
|
3995
4536
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
3996
|
-
const formattedAmount = rawAmount ? formatAmount(rawAmount,
|
|
4537
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, tokenDisplay.decimals) : null;
|
|
3997
4538
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
3998
4539
|
minimumFractionDigits: 2,
|
|
3999
4540
|
maximumFractionDigits: 2
|
|
4000
|
-
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
4541
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : rawAmount && tokenDisplay.pending ? "\u2026" : "\u2014";
|
|
4001
4542
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
4002
4543
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
4003
4544
|
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
4004
|
-
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
4005
4545
|
const eligible = toRecoverableDeposit(deposit, { recipient });
|
|
4006
4546
|
const recoverable = onRecover ? eligible : null;
|
|
4007
4547
|
const toggleExpanded = () => {
|
|
@@ -4016,7 +4556,7 @@ function HistoryCard({
|
|
|
4016
4556
|
position
|
|
4017
4557
|
});
|
|
4018
4558
|
};
|
|
4019
|
-
return /* @__PURE__ */
|
|
4559
|
+
return /* @__PURE__ */ jsxs7(
|
|
4020
4560
|
"div",
|
|
4021
4561
|
{
|
|
4022
4562
|
className: `rs-history-card ${expanded ? "rs-history-card--expanded" : ""}`,
|
|
@@ -4029,60 +4569,46 @@ function HistoryCard({
|
|
|
4029
4569
|
onClick: toggleExpanded,
|
|
4030
4570
|
"aria-expanded": expanded,
|
|
4031
4571
|
"aria-controls": panelId,
|
|
4032
|
-
children: /* @__PURE__ */
|
|
4033
|
-
/* @__PURE__ */
|
|
4572
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "rs-history-card-row", children: [
|
|
4573
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-icons", children: [
|
|
4034
4574
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx13(
|
|
4035
4575
|
TokenIcon,
|
|
4036
4576
|
{
|
|
4577
|
+
token: sourceChainId !== null && sourceToken ? { chain: sourceChainId, address: sourceToken } : void 0,
|
|
4037
4578
|
symbol: sourceSymbol,
|
|
4038
4579
|
fallback: sourceSymbol.slice(0, 2)
|
|
4039
4580
|
}
|
|
4040
4581
|
) }),
|
|
4041
4582
|
sourceChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx13(CdnIcon, { src: sourceChainIcon }) })
|
|
4042
4583
|
] }),
|
|
4043
|
-
/* @__PURE__ */
|
|
4584
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-text", children: [
|
|
4044
4585
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
4045
4586
|
date && /* @__PURE__ */ jsx13("span", { className: "rs-history-card-date", children: date })
|
|
4046
4587
|
] }),
|
|
4047
|
-
/* @__PURE__ */
|
|
4588
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-side", children: [
|
|
4048
4589
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
4049
4590
|
/* @__PURE__ */ jsx13("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
4050
4591
|
] })
|
|
4051
4592
|
] })
|
|
4052
4593
|
}
|
|
4053
4594
|
),
|
|
4054
|
-
/* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel", id: panelId, children: /* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel", id: panelId, children: /* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs7("div", { className: "rs-history-card-details", children: [
|
|
4055
4596
|
(status === "failed" || recoverable) && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: recoveryFailureCause(sourceChainName) }),
|
|
4056
|
-
sourceChainName && /* @__PURE__ */
|
|
4597
|
+
sourceChainName && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
|
|
4057
4598
|
/* @__PURE__ */ jsx13("span", { children: "Source chain" }),
|
|
4058
|
-
/* @__PURE__ */
|
|
4599
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
|
|
4059
4600
|
/* @__PURE__ */ jsx13("span", { children: sourceChainName }),
|
|
4060
4601
|
sourceChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx13(CdnIcon, { src: sourceChainIcon }) })
|
|
4061
4602
|
] })
|
|
4062
4603
|
] }),
|
|
4063
|
-
targetChainName && /* @__PURE__ */
|
|
4604
|
+
targetChainName && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
|
|
4064
4605
|
/* @__PURE__ */ jsx13("span", { children: "Destination chain" }),
|
|
4065
|
-
/* @__PURE__ */
|
|
4606
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
|
|
4066
4607
|
/* @__PURE__ */ jsx13("span", { children: targetChainName }),
|
|
4067
4608
|
targetChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx13(CdnIcon, { src: targetChainIcon }) })
|
|
4068
4609
|
] })
|
|
4069
4610
|
] }),
|
|
4070
|
-
|
|
4071
|
-
/* @__PURE__ */ jsx13("span", { children: "Transaction details" }),
|
|
4072
|
-
/* @__PURE__ */ jsxs8(
|
|
4073
|
-
"a",
|
|
4074
|
-
{
|
|
4075
|
-
href: srcTxUrl,
|
|
4076
|
-
target: "_blank",
|
|
4077
|
-
rel: "noopener noreferrer",
|
|
4078
|
-
className: "rs-history-card-link",
|
|
4079
|
-
children: [
|
|
4080
|
-
/* @__PURE__ */ jsx13("span", { children: shortenHash(srcTxHash) }),
|
|
4081
|
-
/* @__PURE__ */ jsx13(ArrowUpRightIcon, {})
|
|
4082
|
-
]
|
|
4083
|
-
}
|
|
4084
|
-
)
|
|
4085
|
-
] }),
|
|
4611
|
+
/* @__PURE__ */ jsx13(HistoryTransactionLink, { chainId: sourceChainId, txHash: srcTxHash }),
|
|
4086
4612
|
timing && /* @__PURE__ */ jsx13(
|
|
4087
4613
|
"span",
|
|
4088
4614
|
{
|
|
@@ -4093,14 +4619,14 @@ function HistoryCard({
|
|
|
4093
4619
|
children: timing.state === "expected" ? `Usually arrives in ${timing.expectedDuration}` : timing.state === "soft" ? "Taking longer than usual" : "Taking much longer than usual"
|
|
4094
4620
|
}
|
|
4095
4621
|
),
|
|
4096
|
-
recoverable && /* @__PURE__ */
|
|
4622
|
+
recoverable && /* @__PURE__ */ jsxs7(
|
|
4097
4623
|
Button,
|
|
4098
4624
|
{
|
|
4099
4625
|
onClick: () => onRecover?.(recoverable),
|
|
4100
4626
|
fullWidth: true,
|
|
4101
4627
|
className: "rs-history-card-recover",
|
|
4102
4628
|
children: [
|
|
4103
|
-
/* @__PURE__ */
|
|
4629
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
4104
4630
|
"Recover ",
|
|
4105
4631
|
displayAmount
|
|
4106
4632
|
] }),
|
|
@@ -4116,10 +4642,10 @@ function HistoryCard({
|
|
|
4116
4642
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
4117
4643
|
|
|
4118
4644
|
// src/components/history/HistoryFallbackFlow.tsx
|
|
4119
|
-
import { useCallback as useCallback5, useEffect as useEffect7, useRef as
|
|
4645
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef4, useState as useState6 } from "react";
|
|
4120
4646
|
|
|
4121
4647
|
// src/components/ui/ListRow.tsx
|
|
4122
|
-
import { Fragment as Fragment3, jsx as jsx14, jsxs as
|
|
4648
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4123
4649
|
function ListRow({
|
|
4124
4650
|
leading,
|
|
4125
4651
|
leadingMedia,
|
|
@@ -4133,10 +4659,10 @@ function ListRow({
|
|
|
4133
4659
|
disabled,
|
|
4134
4660
|
...props
|
|
4135
4661
|
}) {
|
|
4136
|
-
const inner = /* @__PURE__ */
|
|
4662
|
+
const inner = /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
4137
4663
|
leadingMedia ? /* @__PURE__ */ jsx14("span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ jsx14(CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ jsx14("span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
4138
|
-
/* @__PURE__ */
|
|
4139
|
-
/* @__PURE__ */
|
|
4664
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-list-row-body", children: [
|
|
4665
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-list-row-text", children: [
|
|
4140
4666
|
/* @__PURE__ */ jsx14("span", { className: "rs-list-row-title", children: title }),
|
|
4141
4667
|
subtitle && /* @__PURE__ */ jsx14("span", { className: "rs-list-row-subtitle", children: subtitle })
|
|
4142
4668
|
] }),
|
|
@@ -4192,15 +4718,15 @@ function ListRow({
|
|
|
4192
4718
|
ListRow.displayName = "ListRow";
|
|
4193
4719
|
|
|
4194
4720
|
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
4195
|
-
import { useEffect as useEffect6, useState as
|
|
4721
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
4196
4722
|
|
|
4197
4723
|
// src/components/ui/Input.tsx
|
|
4198
4724
|
import { forwardRef } from "react";
|
|
4199
|
-
import { jsx as jsx15, jsxs as
|
|
4725
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4200
4726
|
var Input = forwardRef(
|
|
4201
4727
|
({ label, error, hint, variant, className = "", ...props }, ref) => {
|
|
4202
4728
|
const inputVariant = error ? "error" : variant || "default";
|
|
4203
|
-
return /* @__PURE__ */
|
|
4729
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-input-wrapper", children: [
|
|
4204
4730
|
label && /* @__PURE__ */ jsx15("label", { className: "rs-input-label", children: label }),
|
|
4205
4731
|
/* @__PURE__ */ jsx15(
|
|
4206
4732
|
"input",
|
|
@@ -4210,7 +4736,7 @@ var Input = forwardRef(
|
|
|
4210
4736
|
...props
|
|
4211
4737
|
}
|
|
4212
4738
|
),
|
|
4213
|
-
error ? /* @__PURE__ */
|
|
4739
|
+
error ? /* @__PURE__ */ jsxs9("p", { className: "rs-input-error", children: [
|
|
4214
4740
|
/* @__PURE__ */ jsx15(AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
4215
4741
|
error
|
|
4216
4742
|
] }) : hint && /* @__PURE__ */ jsx15("p", { className: "rs-input-hint", children: hint })
|
|
@@ -4240,7 +4766,7 @@ function classifyRecoveryLookup(rows, options = {}) {
|
|
|
4240
4766
|
}
|
|
4241
4767
|
|
|
4242
4768
|
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
4243
|
-
import { jsx as jsx16, jsxs as
|
|
4769
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4244
4770
|
function RecoveryLookupScreen({
|
|
4245
4771
|
title,
|
|
4246
4772
|
subtitle,
|
|
@@ -4251,7 +4777,7 @@ function RecoveryLookupScreen({
|
|
|
4251
4777
|
onSubmit,
|
|
4252
4778
|
onInvalid
|
|
4253
4779
|
}) {
|
|
4254
|
-
const [txHash, setTxHash] =
|
|
4780
|
+
const [txHash, setTxHash] = useState5("");
|
|
4255
4781
|
const onInvalidRef = useLatestRef(onInvalid);
|
|
4256
4782
|
const trimmed = txHash.trim();
|
|
4257
4783
|
const valid = isRecoveryTxHash(trimmed);
|
|
@@ -4260,8 +4786,8 @@ function RecoveryLookupScreen({
|
|
|
4260
4786
|
onInvalidRef.current?.();
|
|
4261
4787
|
}
|
|
4262
4788
|
}, [trimmed, valid, onInvalidRef]);
|
|
4263
|
-
return /* @__PURE__ */
|
|
4264
|
-
/* @__PURE__ */
|
|
4789
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", children: [
|
|
4790
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4265
4791
|
/* @__PURE__ */ jsx16(
|
|
4266
4792
|
BodyHeader,
|
|
4267
4793
|
{
|
|
@@ -4319,43 +4845,12 @@ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
|
4319
4845
|
"BUSD",
|
|
4320
4846
|
"USDE"
|
|
4321
4847
|
]);
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
if (token !== void 0) {
|
|
4325
|
-
if (chain === "solana") {
|
|
4326
|
-
const solanaToken = getSolanaTokenByMint(token);
|
|
4327
|
-
if (solanaToken) {
|
|
4328
|
-
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
4329
|
-
}
|
|
4330
|
-
} else if (chain === "hypercore") {
|
|
4331
|
-
const t = HYPERCORE_SOURCE_TOKENS.find(
|
|
4332
|
-
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
4333
|
-
);
|
|
4334
|
-
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
4335
|
-
} else if (chain === "tron" || chain === "stellar") {
|
|
4336
|
-
const published = getRuntimeTokenByAddress(chain, token);
|
|
4337
|
-
if (published) {
|
|
4338
|
-
return { symbol: published.symbol, decimals: published.decimals };
|
|
4339
|
-
}
|
|
4340
|
-
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
4341
|
-
const symbol = getTokenSymbol(token, chain);
|
|
4342
|
-
const decimals = findTokenDecimals(token, chain);
|
|
4343
|
-
if (symbol !== "Token" || decimals !== void 0) {
|
|
4344
|
-
return {
|
|
4345
|
-
symbol: symbol !== "Token" ? symbol : fallback?.symbol ?? symbol,
|
|
4346
|
-
decimals: decimals ?? fallback?.decimals
|
|
4347
|
-
};
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
}
|
|
4351
|
-
return {
|
|
4352
|
-
symbol: fallback?.symbol ?? "Token",
|
|
4353
|
-
decimals: fallback?.decimals
|
|
4354
|
-
};
|
|
4848
|
+
function normalizeStableSymbol(symbol) {
|
|
4849
|
+
return symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
|
|
4355
4850
|
}
|
|
4356
4851
|
function maxFractionDigitsFor(symbol) {
|
|
4357
4852
|
if (!symbol) return 6;
|
|
4358
|
-
return STABLECOIN_SYMBOLS.has(symbol
|
|
4853
|
+
return STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol)) ? 3 : 6;
|
|
4359
4854
|
}
|
|
4360
4855
|
function formatTokenAmount(amount, symbol) {
|
|
4361
4856
|
if (!Number.isFinite(amount)) return void 0;
|
|
@@ -4379,26 +4874,13 @@ function formatRawTokenAmount(rawAmount, token) {
|
|
|
4379
4874
|
return formatTokenAmount(value, token.symbol);
|
|
4380
4875
|
}
|
|
4381
4876
|
function isDisplayStablecoinSymbol(symbol) {
|
|
4382
|
-
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(symbol
|
|
4877
|
+
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol));
|
|
4383
4878
|
}
|
|
4384
4879
|
function priceUsdFor(symbol, prices) {
|
|
4385
4880
|
if (!symbol) return void 0;
|
|
4386
4881
|
const quoted = prices[symbol.toUpperCase()];
|
|
4387
4882
|
return typeof quoted === "number" && quoted > 0 ? quoted : void 0;
|
|
4388
4883
|
}
|
|
4389
|
-
function isRecognizedToken(address, chain) {
|
|
4390
|
-
if (address === void 0 || chain === void 0) return false;
|
|
4391
|
-
if (chain === "solana") return getSolanaTokenByMint(address) !== void 0;
|
|
4392
|
-
if (chain === "hypercore") {
|
|
4393
|
-
return HYPERCORE_SOURCE_TOKENS.some(
|
|
4394
|
-
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
4395
|
-
);
|
|
4396
|
-
}
|
|
4397
|
-
if (chain === "tron" || chain === "stellar") {
|
|
4398
|
-
return getRuntimeTokenByAddress(chain, address) !== void 0;
|
|
4399
|
-
}
|
|
4400
|
-
return EVM_ADDRESS_RE.test(address) && isRegistryTokenOnChain(address, chain);
|
|
4401
|
-
}
|
|
4402
4884
|
function estimateReceiveAmount(params) {
|
|
4403
4885
|
const {
|
|
4404
4886
|
sourceAmount,
|
|
@@ -4450,20 +4932,14 @@ function formatReceiveEstimate(params) {
|
|
|
4450
4932
|
|
|
4451
4933
|
// src/components/recovery/recovery-display.ts
|
|
4452
4934
|
function describeRecoveryDeposit(params) {
|
|
4453
|
-
const token = params.token ?? "0x";
|
|
4454
|
-
const decimals = getTokenDecimalsByAddress(token, params.chainId);
|
|
4455
|
-
const symbol = getTokenSymbol(token, params.chainId);
|
|
4456
|
-
const raw = toBigInt(params.amountRaw);
|
|
4457
|
-
const human = Number(formatUnits3(raw, decimals));
|
|
4458
4935
|
return {
|
|
4459
|
-
symbol,
|
|
4460
|
-
decimals,
|
|
4461
|
-
amount: formatTokenAmount(human, symbol) ?? formatUnits3(raw, decimals),
|
|
4936
|
+
amount: formatRecoveryAmount(params.amountRaw, params.decimals, params.symbol),
|
|
4462
4937
|
chainName: getChainName(params.chainId),
|
|
4463
4938
|
chainIcon: getChainIcon(params.chainId)
|
|
4464
4939
|
};
|
|
4465
4940
|
}
|
|
4466
4941
|
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
4942
|
+
if (decimals === void 0) return "\u2014";
|
|
4467
4943
|
const raw = toBigInt(amountRaw);
|
|
4468
4944
|
return formatTokenAmount(Number(formatUnits3(raw, decimals)), symbol) ?? formatUnits3(raw, decimals);
|
|
4469
4945
|
}
|
|
@@ -4483,9 +4959,9 @@ function shortenAddress(addr) {
|
|
|
4483
4959
|
|
|
4484
4960
|
// src/core/claim-analytics.tsx
|
|
4485
4961
|
import {
|
|
4486
|
-
createContext as
|
|
4487
|
-
useContext as
|
|
4488
|
-
useMemo as
|
|
4962
|
+
createContext as createContext5,
|
|
4963
|
+
useContext as useContext5,
|
|
4964
|
+
useMemo as useMemo7
|
|
4489
4965
|
} from "react";
|
|
4490
4966
|
|
|
4491
4967
|
// src/core/recovery.ts
|
|
@@ -4804,7 +5280,7 @@ function createClaimAnalyticsController(emit, correlation) {
|
|
|
4804
5280
|
};
|
|
4805
5281
|
return controller;
|
|
4806
5282
|
}
|
|
4807
|
-
var ClaimAnalyticsControllerContext =
|
|
5283
|
+
var ClaimAnalyticsControllerContext = createContext5(null);
|
|
4808
5284
|
var noopController = createClaimAnalyticsController(() => {
|
|
4809
5285
|
});
|
|
4810
5286
|
function ClaimAnalyticsControllerProvider({
|
|
@@ -4813,7 +5289,7 @@ function ClaimAnalyticsControllerProvider({
|
|
|
4813
5289
|
correlation
|
|
4814
5290
|
}) {
|
|
4815
5291
|
const emit = useClaimAnalyticsEmitter();
|
|
4816
|
-
const controller =
|
|
5292
|
+
const controller = useMemo7(
|
|
4817
5293
|
() => createClaimAnalyticsController(emit, correlation),
|
|
4818
5294
|
[emit, correlation]
|
|
4819
5295
|
);
|
|
@@ -4821,7 +5297,7 @@ function ClaimAnalyticsControllerProvider({
|
|
|
4821
5297
|
return /* @__PURE__ */ jsx17(ClaimAnalyticsControllerContext.Provider, { value: controller, children });
|
|
4822
5298
|
}
|
|
4823
5299
|
function useClaimAnalyticsController() {
|
|
4824
|
-
return
|
|
5300
|
+
return useContext5(ClaimAnalyticsControllerContext) ?? noopController;
|
|
4825
5301
|
}
|
|
4826
5302
|
|
|
4827
5303
|
// src/core/formatters.ts
|
|
@@ -4929,7 +5405,7 @@ function formatUserError(raw) {
|
|
|
4929
5405
|
}
|
|
4930
5406
|
|
|
4931
5407
|
// src/components/history/HistoryFallbackFlow.tsx
|
|
4932
|
-
import { jsx as jsx18, jsxs as
|
|
5408
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4933
5409
|
function HistoryFallbackFlow({
|
|
4934
5410
|
service,
|
|
4935
5411
|
recipient,
|
|
@@ -4938,13 +5414,13 @@ function HistoryFallbackFlow({
|
|
|
4938
5414
|
onFound
|
|
4939
5415
|
}) {
|
|
4940
5416
|
const analytics = useClaimAnalyticsController();
|
|
4941
|
-
const [loading, setLoading] =
|
|
4942
|
-
const [error, setError] =
|
|
4943
|
-
const [matches, setMatches] =
|
|
5417
|
+
const [loading, setLoading] = useState6(false);
|
|
5418
|
+
const [error, setError] = useState6(null);
|
|
5419
|
+
const [matches, setMatches] = useState6(null);
|
|
4944
5420
|
useEffect7(() => {
|
|
4945
5421
|
analytics.openStep("lookup");
|
|
4946
5422
|
}, [analytics]);
|
|
4947
|
-
const epochRef =
|
|
5423
|
+
const epochRef = useRef4(0);
|
|
4948
5424
|
useEffect7(() => {
|
|
4949
5425
|
setMatches(null);
|
|
4950
5426
|
setError(null);
|
|
@@ -5023,7 +5499,13 @@ function HistoryFallbackFlow({
|
|
|
5023
5499
|
},
|
|
5024
5500
|
[onBack]
|
|
5025
5501
|
);
|
|
5026
|
-
|
|
5502
|
+
const matchDisplays = useTokenDisplays(
|
|
5503
|
+
(matches ?? []).map((match) => ({
|
|
5504
|
+
chain: match.sourceChainId,
|
|
5505
|
+
address: match.token
|
|
5506
|
+
}))
|
|
5507
|
+
);
|
|
5508
|
+
return /* @__PURE__ */ jsxs11(
|
|
5027
5509
|
"div",
|
|
5028
5510
|
{
|
|
5029
5511
|
className: "rs-history-lookup",
|
|
@@ -5031,8 +5513,8 @@ function HistoryFallbackFlow({
|
|
|
5031
5513
|
"aria-label": "Find a deposit",
|
|
5032
5514
|
onKeyDown: handleKeyDown,
|
|
5033
5515
|
children: [
|
|
5034
|
-
/* @__PURE__ */
|
|
5035
|
-
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */
|
|
5516
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-modal-header--redesigned", children: [
|
|
5517
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsxs11(
|
|
5036
5518
|
"button",
|
|
5037
5519
|
{
|
|
5038
5520
|
type: "button",
|
|
@@ -5056,8 +5538,8 @@ function HistoryFallbackFlow({
|
|
|
5056
5538
|
}
|
|
5057
5539
|
) })
|
|
5058
5540
|
] }),
|
|
5059
|
-
matches ? /* @__PURE__ */
|
|
5060
|
-
/* @__PURE__ */
|
|
5541
|
+
matches ? /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
5542
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5061
5543
|
/* @__PURE__ */ jsx18(
|
|
5062
5544
|
BodyHeader,
|
|
5063
5545
|
{
|
|
@@ -5066,16 +5548,19 @@ function HistoryFallbackFlow({
|
|
|
5066
5548
|
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
5067
5549
|
}
|
|
5068
5550
|
),
|
|
5069
|
-
/* @__PURE__ */ jsx18("div", { className: "rs-list", children: matches.map((match) => {
|
|
5070
|
-
const
|
|
5551
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-list", children: matches.map((match, i) => {
|
|
5552
|
+
const display = matchDisplays[i];
|
|
5553
|
+
const symbol = display?.symbol ?? "Token";
|
|
5554
|
+
const { amount, chainName } = describeRecoveryDeposit({
|
|
5071
5555
|
chainId: match.sourceChainId,
|
|
5072
|
-
|
|
5073
|
-
|
|
5556
|
+
amountRaw: match.amountRaw,
|
|
5557
|
+
symbol,
|
|
5558
|
+
decimals: display?.decimals
|
|
5074
5559
|
});
|
|
5075
5560
|
return /* @__PURE__ */ jsx18(
|
|
5076
5561
|
ListRow,
|
|
5077
5562
|
{
|
|
5078
|
-
leadingMedia:
|
|
5563
|
+
leadingMedia: display?.logo,
|
|
5079
5564
|
title: `${amount} ${symbol}`,
|
|
5080
5565
|
subtitle: chainName,
|
|
5081
5566
|
onClick: () => selectMatch(match)
|
|
@@ -5109,10 +5594,10 @@ function newestFirst(rows) {
|
|
|
5109
5594
|
HistoryFallbackFlow.displayName = "HistoryFallbackFlow";
|
|
5110
5595
|
|
|
5111
5596
|
// src/components/history/HistoryRecoveryFlow.tsx
|
|
5112
|
-
import { useCallback as useCallback6, useEffect as useEffect9, useRef as
|
|
5597
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
5113
5598
|
|
|
5114
5599
|
// src/components/recovery/RecoveryOutcomeScreen.tsx
|
|
5115
|
-
import { jsx as jsx19, jsxs as
|
|
5600
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5116
5601
|
function RecoveryOutcomeScreen({
|
|
5117
5602
|
result,
|
|
5118
5603
|
error,
|
|
@@ -5121,8 +5606,8 @@ function RecoveryOutcomeScreen({
|
|
|
5121
5606
|
const success = !!result;
|
|
5122
5607
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5123
5608
|
const txUrl = result ? explorerTxUrl(result.chainId, result.txHash) : null;
|
|
5124
|
-
return /* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5609
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
|
|
5610
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5126
5611
|
/* @__PURE__ */ jsx19(
|
|
5127
5612
|
BodyHeader,
|
|
5128
5613
|
{
|
|
@@ -5132,25 +5617,31 @@ function RecoveryOutcomeScreen({
|
|
|
5132
5617
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
5133
5618
|
}
|
|
5134
5619
|
),
|
|
5135
|
-
result ? /* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5620
|
+
result ? /* @__PURE__ */ jsxs12("div", { className: "rs-review-details", children: [
|
|
5621
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5137
5622
|
/* @__PURE__ */ jsx19("span", { children: "Amount" }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5623
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-review-detail-value", children: [
|
|
5624
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
5140
5625
|
result.amountDisplay,
|
|
5141
5626
|
" ",
|
|
5142
5627
|
result.symbol
|
|
5143
5628
|
] }),
|
|
5144
|
-
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx19(
|
|
5629
|
+
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx19(
|
|
5630
|
+
TokenIcon,
|
|
5631
|
+
{
|
|
5632
|
+
token: result.token ? { chain: result.chainId, address: result.token } : void 0,
|
|
5633
|
+
symbol: result.symbol
|
|
5634
|
+
}
|
|
5635
|
+
) })
|
|
5145
5636
|
] })
|
|
5146
5637
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5638
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5148
5639
|
/* @__PURE__ */ jsx19("span", { children: "Sent to" }),
|
|
5149
5640
|
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-value", children: shortenAddress(result.destination) })
|
|
5150
5641
|
] }),
|
|
5151
|
-
/* @__PURE__ */
|
|
5642
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5152
5643
|
/* @__PURE__ */ jsx19("span", { children: "Refund transaction" }),
|
|
5153
|
-
txUrl ? /* @__PURE__ */
|
|
5644
|
+
txUrl ? /* @__PURE__ */ jsxs12(
|
|
5154
5645
|
"a",
|
|
5155
5646
|
{
|
|
5156
5647
|
className: "rs-review-detail-value rs-link",
|
|
@@ -5173,31 +5664,30 @@ function RecoveryOutcomeScreen({
|
|
|
5173
5664
|
RecoveryOutcomeScreen.displayName = "RecoveryOutcomeScreen";
|
|
5174
5665
|
|
|
5175
5666
|
// src/components/recovery/RecoveryReviewScreen.tsx
|
|
5176
|
-
import { useEffect as useEffect8, useState as
|
|
5667
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
5177
5668
|
import { isAddress as isAddress2 } from "viem";
|
|
5178
|
-
import { jsx as jsx20, jsxs as
|
|
5669
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5179
5670
|
function RecoveryReviewScreen({
|
|
5180
5671
|
chainId,
|
|
5181
5672
|
token,
|
|
5182
5673
|
amountRaw,
|
|
5183
5674
|
txHash,
|
|
5184
5675
|
defaultDestination,
|
|
5185
|
-
destinationHint,
|
|
5186
5676
|
depositAddress,
|
|
5187
5677
|
submitting,
|
|
5188
5678
|
onSubmit,
|
|
5189
5679
|
onDestinationInvalid,
|
|
5190
5680
|
onDestinationIsDepositAddress
|
|
5191
5681
|
}) {
|
|
5192
|
-
const { symbol,
|
|
5682
|
+
const { symbol, decimals } = useTokenDisplay(chainId, token);
|
|
5683
|
+
const { amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
5193
5684
|
chainId,
|
|
5194
|
-
|
|
5195
|
-
|
|
5685
|
+
amountRaw,
|
|
5686
|
+
symbol,
|
|
5687
|
+
decimals
|
|
5196
5688
|
});
|
|
5197
5689
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5198
|
-
const [destination, setDestination] =
|
|
5199
|
-
defaultDestination ?? ""
|
|
5200
|
-
);
|
|
5690
|
+
const [destination, setDestination] = useState7(defaultDestination ?? "");
|
|
5201
5691
|
const isSelfDestination = isDepositSelfDestination(
|
|
5202
5692
|
{ depositAddress },
|
|
5203
5693
|
destination
|
|
@@ -5224,8 +5714,8 @@ function RecoveryReviewScreen({
|
|
|
5224
5714
|
const selfDestinationError = `${shortenAddress(destination)} is this deposit's own address. Enter a different address.`;
|
|
5225
5715
|
const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
|
|
5226
5716
|
const txShort = txHash ? shortenHash2(txHash) : "\u2014";
|
|
5227
|
-
return /* @__PURE__ */
|
|
5228
|
-
/* @__PURE__ */
|
|
5717
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
|
|
5718
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5229
5719
|
/* @__PURE__ */ jsx20(
|
|
5230
5720
|
BodyHeader,
|
|
5231
5721
|
{
|
|
@@ -5234,28 +5724,34 @@ function RecoveryReviewScreen({
|
|
|
5234
5724
|
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
5235
5725
|
}
|
|
5236
5726
|
),
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
5727
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
|
|
5728
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5239
5729
|
/* @__PURE__ */ jsx20("span", { children: "Amount" }),
|
|
5240
|
-
/* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5730
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
5731
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
5242
5732
|
amount,
|
|
5243
5733
|
" ",
|
|
5244
5734
|
symbol
|
|
5245
5735
|
] }),
|
|
5246
|
-
/* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(
|
|
5736
|
+
/* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(
|
|
5737
|
+
TokenIcon,
|
|
5738
|
+
{
|
|
5739
|
+
token: token ? { chain: chainId, address: token } : void 0,
|
|
5740
|
+
symbol
|
|
5741
|
+
}
|
|
5742
|
+
) })
|
|
5247
5743
|
] })
|
|
5248
5744
|
] }),
|
|
5249
|
-
/* @__PURE__ */
|
|
5745
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5250
5746
|
/* @__PURE__ */ jsx20("span", { children: "Source chain" }),
|
|
5251
|
-
/* @__PURE__ */
|
|
5747
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
5252
5748
|
/* @__PURE__ */ jsx20("span", { children: chainName }),
|
|
5253
5749
|
chainIcon && /* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(CdnIcon, { src: chainIcon }) })
|
|
5254
5750
|
] })
|
|
5255
5751
|
] }),
|
|
5256
|
-
/* @__PURE__ */
|
|
5752
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5257
5753
|
/* @__PURE__ */ jsx20("span", { children: "Deposit transaction" }),
|
|
5258
|
-
txUrl ? /* @__PURE__ */
|
|
5754
|
+
txUrl ? /* @__PURE__ */ jsxs13(
|
|
5259
5755
|
"a",
|
|
5260
5756
|
{
|
|
5261
5757
|
className: "rs-review-detail-value rs-link",
|
|
@@ -5277,7 +5773,7 @@ function RecoveryReviewScreen({
|
|
|
5277
5773
|
placeholder: "0x\u2026",
|
|
5278
5774
|
value: destination,
|
|
5279
5775
|
onChange: (e) => setDestination(e.target.value),
|
|
5280
|
-
hint:
|
|
5776
|
+
hint: `An address you control on ${chainName}.`,
|
|
5281
5777
|
error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5282
5778
|
}
|
|
5283
5779
|
),
|
|
@@ -5299,7 +5795,7 @@ function RecoveryReviewScreen({
|
|
|
5299
5795
|
RecoveryReviewScreen.displayName = "RecoveryReviewScreen";
|
|
5300
5796
|
|
|
5301
5797
|
// src/components/history/HistoryRecoveryFlow.tsx
|
|
5302
|
-
import { jsx as jsx21, jsxs as
|
|
5798
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5303
5799
|
function HistoryRecoveryFlow({
|
|
5304
5800
|
deposit,
|
|
5305
5801
|
entrySource,
|
|
@@ -5312,11 +5808,12 @@ function HistoryRecoveryFlow({
|
|
|
5312
5808
|
onRecovered
|
|
5313
5809
|
}) {
|
|
5314
5810
|
const analytics = useClaimAnalyticsController();
|
|
5315
|
-
const [phase, setPhase] =
|
|
5316
|
-
const [outcome, setOutcome] =
|
|
5317
|
-
const [error, setError] =
|
|
5318
|
-
const [retryable, setRetryable] =
|
|
5319
|
-
const
|
|
5811
|
+
const [phase, setPhase] = useState8("review");
|
|
5812
|
+
const [outcome, setOutcome] = useState8(null);
|
|
5813
|
+
const [error, setError] = useState8(null);
|
|
5814
|
+
const [retryable, setRetryable] = useState8(false);
|
|
5815
|
+
const [destination, setDestination] = useState8();
|
|
5816
|
+
const lastFailureRef = useRef5(null);
|
|
5320
5817
|
useEffect9(() => {
|
|
5321
5818
|
if (entrySource === "history_row") {
|
|
5322
5819
|
analytics.selectDeposit({
|
|
@@ -5327,13 +5824,13 @@ function HistoryRecoveryFlow({
|
|
|
5327
5824
|
}
|
|
5328
5825
|
analytics.openStep("review");
|
|
5329
5826
|
}, [analytics, deposit, entrySource]);
|
|
5330
|
-
const { symbol, decimals } =
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
});
|
|
5827
|
+
const { symbol, decimals } = useTokenDisplay(
|
|
5828
|
+
deposit.sourceChainId,
|
|
5829
|
+
deposit.token
|
|
5830
|
+
);
|
|
5335
5831
|
const submit = useCallback6(
|
|
5336
|
-
async (
|
|
5832
|
+
async (destination2) => {
|
|
5833
|
+
setDestination(destination2);
|
|
5337
5834
|
setPhase("submitting");
|
|
5338
5835
|
onSubmittingChange(true);
|
|
5339
5836
|
analytics.completeStep("review");
|
|
@@ -5346,14 +5843,14 @@ function HistoryRecoveryFlow({
|
|
|
5346
5843
|
chainId: deposit.targetChainId,
|
|
5347
5844
|
depositId: deposit.depositId,
|
|
5348
5845
|
signer: deposit.signer,
|
|
5349
|
-
destination,
|
|
5846
|
+
destination: destination2,
|
|
5350
5847
|
signRecovery,
|
|
5351
5848
|
debug
|
|
5352
5849
|
});
|
|
5353
5850
|
setOutcome({
|
|
5354
5851
|
// No destination to reconcile: it is inside the signed struct, so the
|
|
5355
5852
|
// processor cannot have paid anywhere else.
|
|
5356
|
-
destination,
|
|
5853
|
+
destination: destination2,
|
|
5357
5854
|
txHash: result.transactionHash,
|
|
5358
5855
|
symbol,
|
|
5359
5856
|
amountDisplay: formatRecoveryAmount(
|
|
@@ -5414,15 +5911,15 @@ function HistoryRecoveryFlow({
|
|
|
5414
5911
|
setPhase("review");
|
|
5415
5912
|
}, [analytics]);
|
|
5416
5913
|
const submitting = phase === "submitting";
|
|
5417
|
-
return /* @__PURE__ */
|
|
5914
|
+
return /* @__PURE__ */ jsxs14(
|
|
5418
5915
|
"div",
|
|
5419
5916
|
{
|
|
5420
5917
|
className: "rs-history-recovery",
|
|
5421
5918
|
role: "dialog",
|
|
5422
5919
|
"aria-label": "Recover deposit",
|
|
5423
5920
|
children: [
|
|
5424
|
-
/* @__PURE__ */
|
|
5425
|
-
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: !submitting && /* @__PURE__ */
|
|
5921
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header--redesigned", children: [
|
|
5922
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: !submitting && /* @__PURE__ */ jsxs14(
|
|
5426
5923
|
"button",
|
|
5427
5924
|
{
|
|
5428
5925
|
type: "button",
|
|
@@ -5454,8 +5951,7 @@ function HistoryRecoveryFlow({
|
|
|
5454
5951
|
token: deposit.token,
|
|
5455
5952
|
amountRaw: deposit.amountRaw,
|
|
5456
5953
|
txHash: deposit.sourceTxHash,
|
|
5457
|
-
defaultDestination:
|
|
5458
|
-
destinationHint: "Prefilled with the account this deposit was for. Editable.",
|
|
5954
|
+
defaultDestination: destination,
|
|
5459
5955
|
depositAddress: deposit.depositAddress,
|
|
5460
5956
|
submitting,
|
|
5461
5957
|
onSubmit: submit,
|
|
@@ -5469,11 +5965,15 @@ function HistoryRecoveryFlow({
|
|
|
5469
5965
|
phase === "success" && outcome && /* @__PURE__ */ jsx21(
|
|
5470
5966
|
RecoveryOutcomeScreen,
|
|
5471
5967
|
{
|
|
5472
|
-
result: {
|
|
5968
|
+
result: {
|
|
5969
|
+
...outcome,
|
|
5970
|
+
chainId: deposit.sourceChainId,
|
|
5971
|
+
token: deposit.token
|
|
5972
|
+
},
|
|
5473
5973
|
children: /* @__PURE__ */ jsx21(Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
5474
5974
|
}
|
|
5475
5975
|
),
|
|
5476
|
-
phase === "failed" && /* @__PURE__ */
|
|
5976
|
+
phase === "failed" && /* @__PURE__ */ jsxs14(RecoveryOutcomeScreen, { error, children: [
|
|
5477
5977
|
/* @__PURE__ */ jsx21(Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" }),
|
|
5478
5978
|
retryable && /* @__PURE__ */ jsx21(Button, { onClick: retry, fullWidth: true, children: "Try again" })
|
|
5479
5979
|
] })
|
|
@@ -5484,9 +5984,11 @@ function HistoryRecoveryFlow({
|
|
|
5484
5984
|
HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
5485
5985
|
|
|
5486
5986
|
// src/components/history/HistoryOverlay.tsx
|
|
5487
|
-
import { Fragment as Fragment4, jsx as jsx22, jsxs as
|
|
5987
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5488
5988
|
function HistoryOverlay({
|
|
5489
5989
|
controller,
|
|
5990
|
+
bankHistory,
|
|
5991
|
+
bankSupportUrl,
|
|
5490
5992
|
backLabel,
|
|
5491
5993
|
title,
|
|
5492
5994
|
recipient,
|
|
@@ -5503,9 +6005,9 @@ function HistoryOverlay({
|
|
|
5503
6005
|
onEvent
|
|
5504
6006
|
}) {
|
|
5505
6007
|
const recovering = signRecovery ? controller.recovering : null;
|
|
5506
|
-
const [fallbackOpen, setFallbackOpen] =
|
|
5507
|
-
const [attempt, setAttempt] =
|
|
5508
|
-
const claimControllerRef =
|
|
6008
|
+
const [fallbackOpen, setFallbackOpen] = useState9(false);
|
|
6009
|
+
const [attempt, setAttempt] = useState9(null);
|
|
6010
|
+
const claimControllerRef = useRef6(null);
|
|
5509
6011
|
const beginAttempt = useCallback7(
|
|
5510
6012
|
(entrySource) => {
|
|
5511
6013
|
const id = randomUuid();
|
|
@@ -5590,15 +6092,15 @@ function HistoryOverlay({
|
|
|
5590
6092
|
claim?.close("host_controlled");
|
|
5591
6093
|
};
|
|
5592
6094
|
}, [attempt]);
|
|
5593
|
-
const claimSessionProperties =
|
|
6095
|
+
const claimSessionProperties = useMemo8(
|
|
5594
6096
|
() => ({
|
|
5595
6097
|
presentation: inline ? "inline" : "overlay",
|
|
5596
6098
|
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
5597
|
-
prefills: { transaction_hash: false, refund_destination:
|
|
6099
|
+
prefills: { transaction_hash: false, refund_destination: false }
|
|
5598
6100
|
}),
|
|
5599
6101
|
[inline, closeOnOverlayClick]
|
|
5600
6102
|
);
|
|
5601
|
-
const layers = /* @__PURE__ */
|
|
6103
|
+
const layers = /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
5602
6104
|
fallbackOpen && recipient && !recovering && /* @__PURE__ */ jsx22(
|
|
5603
6105
|
HistoryFallbackFlow,
|
|
5604
6106
|
{
|
|
@@ -5624,10 +6126,12 @@ function HistoryOverlay({
|
|
|
5624
6126
|
}
|
|
5625
6127
|
)
|
|
5626
6128
|
] });
|
|
5627
|
-
return /* @__PURE__ */
|
|
6129
|
+
return /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
5628
6130
|
/* @__PURE__ */ jsx22(
|
|
5629
6131
|
DepositHistoryPanel,
|
|
5630
6132
|
{
|
|
6133
|
+
bankHistory,
|
|
6134
|
+
bankSupportUrl,
|
|
5631
6135
|
deposits: controller.deposits,
|
|
5632
6136
|
isLoading: controller.isLoading,
|
|
5633
6137
|
error: controller.error,
|
|
@@ -5669,7 +6173,7 @@ function HistoryOverlay({
|
|
|
5669
6173
|
}
|
|
5670
6174
|
|
|
5671
6175
|
// src/components/history/useHistoryPanel.ts
|
|
5672
|
-
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as
|
|
6176
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo9, useRef as useRef7, useState as useState10 } from "react";
|
|
5673
6177
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5674
6178
|
function sortByCreatedAtDesc(items) {
|
|
5675
6179
|
return [...items].sort((a, b) => {
|
|
@@ -5685,19 +6189,19 @@ function useHistoryPanel({
|
|
|
5685
6189
|
canRecover,
|
|
5686
6190
|
analytics
|
|
5687
6191
|
}) {
|
|
5688
|
-
const [isPanelOpen, setIsPanelOpen] =
|
|
5689
|
-
const [deposits, setDeposits] =
|
|
5690
|
-
const [hasMore, setHasMore] =
|
|
5691
|
-
const [isLoading, setIsLoading] =
|
|
5692
|
-
const [isLoadingMore, setIsLoadingMore] =
|
|
5693
|
-
const [error, setError] =
|
|
5694
|
-
const cursorRef =
|
|
5695
|
-
const staleRef =
|
|
5696
|
-
const loadedRef =
|
|
5697
|
-
const recipientRef =
|
|
5698
|
-
const requestRef =
|
|
5699
|
-
const [recovering, setRecovering] =
|
|
5700
|
-
const [recoverySubmitting, setRecoverySubmitting] =
|
|
6192
|
+
const [isPanelOpen, setIsPanelOpen] = useState10(false);
|
|
6193
|
+
const [deposits, setDeposits] = useState10([]);
|
|
6194
|
+
const [hasMore, setHasMore] = useState10(false);
|
|
6195
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
6196
|
+
const [isLoadingMore, setIsLoadingMore] = useState10(false);
|
|
6197
|
+
const [error, setError] = useState10(null);
|
|
6198
|
+
const cursorRef = useRef7(null);
|
|
6199
|
+
const staleRef = useRef7(false);
|
|
6200
|
+
const loadedRef = useRef7(false);
|
|
6201
|
+
const recipientRef = useRef7(recipient);
|
|
6202
|
+
const requestRef = useRef7(0);
|
|
6203
|
+
const [recovering, setRecovering] = useState10(null);
|
|
6204
|
+
const [recoverySubmitting, setRecoverySubmitting] = useState10(false);
|
|
5701
6205
|
const fetchHistory = useCallback8(
|
|
5702
6206
|
async (mode = "initial") => {
|
|
5703
6207
|
if (!recipient) return;
|
|
@@ -5821,7 +6325,7 @@ function useHistoryPanel({
|
|
|
5821
6325
|
staleRef.current = true;
|
|
5822
6326
|
}, []);
|
|
5823
6327
|
const cancelRecovery = useCallback8(() => setRecovering(null), []);
|
|
5824
|
-
return
|
|
6328
|
+
return useMemo9(
|
|
5825
6329
|
() => ({
|
|
5826
6330
|
deposits,
|
|
5827
6331
|
isLoading,
|
|
@@ -6068,6 +6572,9 @@ var REMOVED_UI_CONFIG_KEYS = {
|
|
|
6068
6572
|
checkLiquidity: "removed \u2014 the modal no longer surfaces a liquidity cap. Route capacity is enforced when the deposit is processed.",
|
|
6069
6573
|
showHistoryButton: "removed \u2014 deposit history is always offered, from the modal's home screen. There is no way to hide it."
|
|
6070
6574
|
};
|
|
6575
|
+
var REMOVED_BANK_ONRAMP_KEYS = {
|
|
6576
|
+
currency: "removed \u2014 the currency follows the residence the customer declares at verification: EUR inside SEPA, USD elsewhere."
|
|
6577
|
+
};
|
|
6071
6578
|
var warned = /* @__PURE__ */ new Set();
|
|
6072
6579
|
function warnOnce(component, key, replacement) {
|
|
6073
6580
|
const id = `${component}.${key}`;
|
|
@@ -6085,6 +6592,18 @@ function warnRemovedProps(component, props) {
|
|
|
6085
6592
|
warnOnce(component, key, table[key]);
|
|
6086
6593
|
}
|
|
6087
6594
|
}
|
|
6595
|
+
const bankOnramp = props.bankOnramp;
|
|
6596
|
+
if (bankOnramp && typeof bankOnramp === "object") {
|
|
6597
|
+
for (const key of Object.keys(REMOVED_BANK_ONRAMP_KEYS)) {
|
|
6598
|
+
if (Object.prototype.hasOwnProperty.call(bankOnramp, key)) {
|
|
6599
|
+
warnOnce(
|
|
6600
|
+
component,
|
|
6601
|
+
`bankOnramp.${key}`,
|
|
6602
|
+
REMOVED_BANK_ONRAMP_KEYS[key]
|
|
6603
|
+
);
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6088
6607
|
const uiConfig = props.uiConfig;
|
|
6089
6608
|
if (uiConfig && typeof uiConfig === "object") {
|
|
6090
6609
|
for (const key of Object.keys(REMOVED_UI_CONFIG_KEYS)) {
|
|
@@ -6254,22 +6773,22 @@ function isSubmissionUncertain(error) {
|
|
|
6254
6773
|
}
|
|
6255
6774
|
|
|
6256
6775
|
// src/components/steps/ProcessingStep.tsx
|
|
6257
|
-
import { useCallback as useCallback10, useEffect as
|
|
6776
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useRef as useRef9, useState as useState13 } from "react";
|
|
6258
6777
|
|
|
6259
6778
|
// src/components/ui/Tooltip.tsx
|
|
6260
6779
|
import {
|
|
6261
|
-
useState as
|
|
6262
|
-
useRef as
|
|
6780
|
+
useState as useState11,
|
|
6781
|
+
useRef as useRef8,
|
|
6263
6782
|
useEffect as useEffect12,
|
|
6264
6783
|
useCallback as useCallback9
|
|
6265
6784
|
} from "react";
|
|
6266
6785
|
import { createPortal as createPortal2 } from "react-dom";
|
|
6267
|
-
import { jsx as jsx23, jsxs as
|
|
6786
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6268
6787
|
function Tooltip({ content, children, className }) {
|
|
6269
|
-
const [open, setOpen] =
|
|
6270
|
-
const [position, setPosition] =
|
|
6271
|
-
const triggerRef =
|
|
6272
|
-
const bubbleRef =
|
|
6788
|
+
const [open, setOpen] = useState11(false);
|
|
6789
|
+
const [position, setPosition] = useState11(null);
|
|
6790
|
+
const triggerRef = useRef8(null);
|
|
6791
|
+
const bubbleRef = useRef8(null);
|
|
6273
6792
|
const updatePosition = useCallback9(() => {
|
|
6274
6793
|
const trigger = triggerRef.current;
|
|
6275
6794
|
if (!trigger) return;
|
|
@@ -6305,7 +6824,7 @@ function Tooltip({ content, children, className }) {
|
|
|
6305
6824
|
window.removeEventListener("resize", updatePosition);
|
|
6306
6825
|
};
|
|
6307
6826
|
}, [open, updatePosition]);
|
|
6308
|
-
return /* @__PURE__ */
|
|
6827
|
+
return /* @__PURE__ */ jsxs16(
|
|
6309
6828
|
"span",
|
|
6310
6829
|
{
|
|
6311
6830
|
ref: triggerRef,
|
|
@@ -6354,18 +6873,18 @@ function Tooltip({ content, children, className }) {
|
|
|
6354
6873
|
Tooltip.displayName = "Tooltip";
|
|
6355
6874
|
|
|
6356
6875
|
// src/components/ui/FeesAccordion.tsx
|
|
6357
|
-
import { useState as
|
|
6358
|
-
import { jsx as jsx24, jsxs as
|
|
6876
|
+
import { useState as useState12 } from "react";
|
|
6877
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6359
6878
|
function FeesAccordion({ total, rows, tooltip }) {
|
|
6360
|
-
const [open, setOpen] =
|
|
6879
|
+
const [open, setOpen] = useState12(false);
|
|
6361
6880
|
const expandable = rows.length > 0;
|
|
6362
|
-
return /* @__PURE__ */
|
|
6363
|
-
/* @__PURE__ */
|
|
6364
|
-
/* @__PURE__ */
|
|
6881
|
+
return /* @__PURE__ */ jsxs17("div", { className: "rs-fees-accordion", children: [
|
|
6882
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-fees-accordion-summary", children: [
|
|
6883
|
+
/* @__PURE__ */ jsxs17("span", { className: "rs-fees-accordion-label", children: [
|
|
6365
6884
|
/* @__PURE__ */ jsx24("span", { children: "Fees" }),
|
|
6366
6885
|
tooltip && /* @__PURE__ */ jsx24(Tooltip, { content: tooltip, children: /* @__PURE__ */ jsx24("span", { className: "rs-review-detail-info", "aria-label": "Fees info", children: /* @__PURE__ */ jsx24(InfoIcon, {}) }) })
|
|
6367
6886
|
] }),
|
|
6368
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsxs17(
|
|
6369
6888
|
"button",
|
|
6370
6889
|
{
|
|
6371
6890
|
type: "button",
|
|
@@ -6388,9 +6907,9 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6388
6907
|
}
|
|
6389
6908
|
)
|
|
6390
6909
|
] }),
|
|
6391
|
-
expandable && open && /* @__PURE__ */ jsx24("div", { className: "rs-fees-accordion-rows", children: rows.map((row, i) => /* @__PURE__ */
|
|
6910
|
+
expandable && open && /* @__PURE__ */ jsx24("div", { className: "rs-fees-accordion-rows", children: rows.map((row, i) => /* @__PURE__ */ jsxs17("div", { className: "rs-fees-accordion-row", children: [
|
|
6392
6911
|
/* @__PURE__ */ jsx24("span", { children: row.label }),
|
|
6393
|
-
/* @__PURE__ */
|
|
6912
|
+
/* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
|
|
6394
6913
|
/* @__PURE__ */ jsx24(
|
|
6395
6914
|
"span",
|
|
6396
6915
|
{
|
|
@@ -6413,13 +6932,14 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6413
6932
|
FeesAccordion.displayName = "FeesAccordion";
|
|
6414
6933
|
|
|
6415
6934
|
// src/components/steps/SwappedReceipt.tsx
|
|
6416
|
-
import { jsx as jsx25, jsxs as
|
|
6935
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6417
6936
|
function SwappedReceipt({
|
|
6418
6937
|
onrampMethod,
|
|
6419
6938
|
onrampMethodIcon,
|
|
6420
6939
|
amountPaid,
|
|
6421
6940
|
depositedAmount,
|
|
6422
6941
|
depositedSymbol,
|
|
6942
|
+
depositedToken,
|
|
6423
6943
|
feesTotal,
|
|
6424
6944
|
feeRows,
|
|
6425
6945
|
feesTooltip,
|
|
@@ -6427,26 +6947,26 @@ function SwappedReceipt({
|
|
|
6427
6947
|
onNewDeposit,
|
|
6428
6948
|
onClose
|
|
6429
6949
|
}) {
|
|
6430
|
-
return /* @__PURE__ */
|
|
6431
|
-
/* @__PURE__ */
|
|
6950
|
+
return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
|
|
6951
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
6432
6952
|
/* @__PURE__ */ jsx25(BodyHeader, { icon: /* @__PURE__ */ jsx25(CheckIcon, {}), title: "Deposit successful" }),
|
|
6433
|
-
/* @__PURE__ */
|
|
6434
|
-
onrampMethod && /* @__PURE__ */
|
|
6953
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-review-details", children: [
|
|
6954
|
+
onrampMethod && /* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6435
6955
|
/* @__PURE__ */ jsx25("span", { children: "Onramp method" }),
|
|
6436
|
-
/* @__PURE__ */
|
|
6956
|
+
/* @__PURE__ */ jsxs18("span", { className: "rs-review-detail-value", children: [
|
|
6437
6957
|
/* @__PURE__ */ jsx25("span", { children: onrampMethod }),
|
|
6438
6958
|
onrampMethodIcon && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon rs-review-detail-icon--square", children: /* @__PURE__ */ jsx25(CdnIcon, { src: onrampMethodIcon }) })
|
|
6439
6959
|
] })
|
|
6440
6960
|
] }),
|
|
6441
|
-
amountPaid && /* @__PURE__ */
|
|
6961
|
+
amountPaid && /* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6442
6962
|
/* @__PURE__ */ jsx25("span", { children: "Amount paid" }),
|
|
6443
6963
|
/* @__PURE__ */ jsx25("span", { className: "rs-review-detail-value", children: amountPaid })
|
|
6444
6964
|
] }),
|
|
6445
|
-
/* @__PURE__ */
|
|
6965
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6446
6966
|
/* @__PURE__ */ jsx25("span", { children: "Deposited amount" }),
|
|
6447
|
-
/* @__PURE__ */
|
|
6967
|
+
/* @__PURE__ */ jsxs18("span", { className: "rs-review-detail-value", children: [
|
|
6448
6968
|
/* @__PURE__ */ jsx25("span", { children: depositedAmount }),
|
|
6449
|
-
depositedSymbol && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx25(TokenIcon, { symbol: depositedSymbol }) })
|
|
6969
|
+
depositedSymbol && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx25(TokenIcon, { token: depositedToken, symbol: depositedSymbol }) })
|
|
6450
6970
|
] })
|
|
6451
6971
|
] }),
|
|
6452
6972
|
feesTotal != null && /* @__PURE__ */ jsx25(
|
|
@@ -6458,7 +6978,7 @@ function SwappedReceipt({
|
|
|
6458
6978
|
}
|
|
6459
6979
|
)
|
|
6460
6980
|
] }),
|
|
6461
|
-
/* @__PURE__ */
|
|
6981
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-button-row", children: [
|
|
6462
6982
|
onNewDeposit && /* @__PURE__ */ jsx25(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: newLabel }),
|
|
6463
6983
|
onClose && /* @__PURE__ */ jsx25(Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
6464
6984
|
] })
|
|
@@ -6644,73 +7164,35 @@ function failureMessageForEvent(event) {
|
|
|
6644
7164
|
}
|
|
6645
7165
|
|
|
6646
7166
|
// src/core/useTokenPrices.ts
|
|
6647
|
-
import {
|
|
6648
|
-
var
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
return lower === "native" || lower === SOL_SYSTEM_PROGRAM;
|
|
6655
|
-
}
|
|
6656
|
-
function isNativeAddress(address) {
|
|
6657
|
-
if (!address) return true;
|
|
6658
|
-
return address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
6659
|
-
}
|
|
6660
|
-
function caip2For(token) {
|
|
6661
|
-
if (token.chainId === "solana") {
|
|
6662
|
-
const mint = isSolanaNativeAddress(token.address) ? WRAPPED_SOL_MINT : token.address;
|
|
6663
|
-
return mint ? `${SOLANA_MAINNET_CAIP2}:${mint}` : void 0;
|
|
6664
|
-
}
|
|
6665
|
-
if (typeof token.chainId !== "number") return void 0;
|
|
6666
|
-
const address = isNativeAddress(token.address) ? PRICE_SERVICE_NATIVE : token.address;
|
|
6667
|
-
return `${toEvmCaip2(token.chainId)}:${address.toLowerCase()}`;
|
|
6668
|
-
}
|
|
6669
|
-
async function fetchTokenPriceUsd(service, token) {
|
|
6670
|
-
const caip2 = caip2For(token);
|
|
6671
|
-
if (!caip2) return null;
|
|
6672
|
-
const prices = await service.fetchPricesByAddress([caip2]);
|
|
6673
|
-
const price = prices[caip2];
|
|
6674
|
-
return typeof price === "number" && price > 0 ? price : null;
|
|
6675
|
-
}
|
|
6676
|
-
function useTokenPrices(service, tokens) {
|
|
6677
|
-
const [prices, setPrices] = useState12({});
|
|
7167
|
+
import { useMemo as useMemo10 } from "react";
|
|
7168
|
+
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
7169
|
+
function addressFor(token) {
|
|
7170
|
+
if (token.address) return token.address;
|
|
7171
|
+
return token.chainId === "solana" ? "native" : ZERO_ADDRESS2;
|
|
7172
|
+
}
|
|
7173
|
+
function useTokenPrices(tokens) {
|
|
6678
7174
|
const defined = tokens.filter((t) => Boolean(t?.symbol));
|
|
6679
|
-
const
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
if (cancelled) return;
|
|
6695
|
-
const merged = {};
|
|
6696
|
-
for (const entry of parsed) {
|
|
6697
|
-
const price = byAddress[entry.caip2];
|
|
6698
|
-
if (typeof price === "number") merged[entry.symbol] = price;
|
|
6699
|
-
}
|
|
6700
|
-
setPrices(merged);
|
|
6701
|
-
}).catch(() => {
|
|
6702
|
-
});
|
|
6703
|
-
return () => {
|
|
6704
|
-
cancelled = true;
|
|
6705
|
-
};
|
|
6706
|
-
}, [service, key]);
|
|
6707
|
-
return prices;
|
|
7175
|
+
const refs = defined.map((token) => ({
|
|
7176
|
+
chain: token.chainId,
|
|
7177
|
+
address: addressFor(token)
|
|
7178
|
+
}));
|
|
7179
|
+
const byId = useAssetPrices(refs);
|
|
7180
|
+
const key = defined.map((t) => `${String(t.chainId)}:${addressFor(t)}:${t.symbol}`).join("|");
|
|
7181
|
+
return useMemo10(() => {
|
|
7182
|
+
const out = {};
|
|
7183
|
+
for (const token of defined) {
|
|
7184
|
+
const id = assetIdFor(token.chainId, addressFor(token));
|
|
7185
|
+
const usd = id ? byId[id] : void 0;
|
|
7186
|
+
if (typeof usd === "number") out[token.symbol.toUpperCase()] = usd;
|
|
7187
|
+
}
|
|
7188
|
+
return out;
|
|
7189
|
+
}, [key, byId]);
|
|
6708
7190
|
}
|
|
6709
7191
|
|
|
6710
7192
|
// src/components/steps/ProcessingStep.tsx
|
|
6711
|
-
import { Fragment as Fragment5, jsx as jsx27, jsxs as
|
|
7193
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6712
7194
|
function SuccessBadge() {
|
|
6713
|
-
return /* @__PURE__ */
|
|
7195
|
+
return /* @__PURE__ */ jsxs19(
|
|
6714
7196
|
"svg",
|
|
6715
7197
|
{
|
|
6716
7198
|
width: "40",
|
|
@@ -6744,7 +7226,7 @@ function SuccessBadge() {
|
|
|
6744
7226
|
);
|
|
6745
7227
|
}
|
|
6746
7228
|
function FailedBadge() {
|
|
6747
|
-
return /* @__PURE__ */
|
|
7229
|
+
return /* @__PURE__ */ jsxs19(
|
|
6748
7230
|
"svg",
|
|
6749
7231
|
{
|
|
6750
7232
|
width: "40",
|
|
@@ -6886,7 +7368,7 @@ function TickerChar({ value }) {
|
|
|
6886
7368
|
const [current, setCurrent] = useState13(value);
|
|
6887
7369
|
const [previous, setPrevious] = useState13(null);
|
|
6888
7370
|
const [animKey, setAnimKey] = useState13(0);
|
|
6889
|
-
|
|
7371
|
+
useEffect13(() => {
|
|
6890
7372
|
if (value === current) return;
|
|
6891
7373
|
setPrevious(current);
|
|
6892
7374
|
setCurrent(value);
|
|
@@ -6894,7 +7376,7 @@ function TickerChar({ value }) {
|
|
|
6894
7376
|
const timeout = setTimeout(() => setPrevious(null), 360);
|
|
6895
7377
|
return () => clearTimeout(timeout);
|
|
6896
7378
|
}, [value, current]);
|
|
6897
|
-
return /* @__PURE__ */
|
|
7379
|
+
return /* @__PURE__ */ jsxs19("span", { className: "rs-ticker-slot", children: [
|
|
6898
7380
|
previous !== null && /* @__PURE__ */ jsx27("span", { className: "rs-ticker-out", children: previous }, `out-${animKey}`),
|
|
6899
7381
|
/* @__PURE__ */ jsx27("span", { className: "rs-ticker-in", children: current }, `in-${animKey}`)
|
|
6900
7382
|
] });
|
|
@@ -7026,10 +7508,10 @@ function ProcessingStep({
|
|
|
7026
7508
|
onSettledChange,
|
|
7027
7509
|
onError
|
|
7028
7510
|
}) {
|
|
7029
|
-
const startTimeRef =
|
|
7030
|
-
const pollIntervalRef =
|
|
7031
|
-
const pollTimeoutRef =
|
|
7032
|
-
const escalatedDelayRef =
|
|
7511
|
+
const startTimeRef = useRef9(Date.now());
|
|
7512
|
+
const pollIntervalRef = useRef9(INITIAL_POLL_INTERVAL);
|
|
7513
|
+
const pollTimeoutRef = useRef9(null);
|
|
7514
|
+
const escalatedDelayRef = useRef9(false);
|
|
7033
7515
|
const processingContextRef = useLatestRef({
|
|
7034
7516
|
amount,
|
|
7035
7517
|
sourceChain,
|
|
@@ -7043,8 +7525,8 @@ function ProcessingStep({
|
|
|
7043
7525
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
7044
7526
|
const onErrorRef = useLatestRef(onError);
|
|
7045
7527
|
const explorerTxUrl = useExplorerTxUrl();
|
|
7046
|
-
const initialTerminalEventRef =
|
|
7047
|
-
const completedDirectTransferTxHashRef =
|
|
7528
|
+
const initialTerminalEventRef = useRef9(null);
|
|
7529
|
+
const completedDirectTransferTxHashRef = useRef9(null);
|
|
7048
7530
|
const [state, setState] = useState13(() => {
|
|
7049
7531
|
if (directTransfer) return { type: "complete" };
|
|
7050
7532
|
const initial = getInitialProcessingState(
|
|
@@ -7074,8 +7556,8 @@ function ProcessingStep({
|
|
|
7074
7556
|
if (latchedTiming === void 0 && quote?.timing !== void 0) {
|
|
7075
7557
|
setLatchedTiming(quote.timing);
|
|
7076
7558
|
}
|
|
7077
|
-
const timingStateRef =
|
|
7078
|
-
const servedTimingLatchRef =
|
|
7559
|
+
const timingStateRef = useRef9("expected");
|
|
7560
|
+
const servedTimingLatchRef = useRef9(false);
|
|
7079
7561
|
const updatePhaseTimings = useCallback10(
|
|
7080
7562
|
(updater) => {
|
|
7081
7563
|
setPhaseTimings((previous) => {
|
|
@@ -7086,7 +7568,7 @@ function ProcessingStep({
|
|
|
7086
7568
|
},
|
|
7087
7569
|
[txHash]
|
|
7088
7570
|
);
|
|
7089
|
-
|
|
7571
|
+
useEffect13(() => {
|
|
7090
7572
|
if (!directTransfer || completedDirectTransferTxHashRef.current === txHash) {
|
|
7091
7573
|
return;
|
|
7092
7574
|
}
|
|
@@ -7120,7 +7602,7 @@ function ProcessingStep({
|
|
|
7120
7602
|
txHash,
|
|
7121
7603
|
updatePhaseTimings
|
|
7122
7604
|
]);
|
|
7123
|
-
|
|
7605
|
+
useEffect13(() => {
|
|
7124
7606
|
const event = initialTerminalEventRef.current;
|
|
7125
7607
|
if (!event) return;
|
|
7126
7608
|
initialTerminalEventRef.current = null;
|
|
@@ -7164,13 +7646,13 @@ function ProcessingStep({
|
|
|
7164
7646
|
processingContextRef,
|
|
7165
7647
|
txHash
|
|
7166
7648
|
]);
|
|
7167
|
-
const onSettledChangeRef =
|
|
7649
|
+
const onSettledChangeRef = useRef9(onSettledChange);
|
|
7168
7650
|
onSettledChangeRef.current = onSettledChange;
|
|
7169
|
-
|
|
7651
|
+
useEffect13(() => {
|
|
7170
7652
|
onSettledChangeRef.current?.(state.type !== "processing");
|
|
7171
7653
|
return () => onSettledChangeRef.current?.(false);
|
|
7172
7654
|
}, [state.type]);
|
|
7173
|
-
|
|
7655
|
+
useEffect13(() => {
|
|
7174
7656
|
if (directTransfer || state.type !== "processing") return;
|
|
7175
7657
|
const updateElapsed = () => {
|
|
7176
7658
|
setElapsedSeconds(
|
|
@@ -7181,7 +7663,7 @@ function ProcessingStep({
|
|
|
7181
7663
|
const intervalId = setInterval(updateElapsed, 1e3);
|
|
7182
7664
|
return () => clearInterval(intervalId);
|
|
7183
7665
|
}, [directTransfer, state.type]);
|
|
7184
|
-
|
|
7666
|
+
useEffect13(() => {
|
|
7185
7667
|
if (state.type === "processing") return;
|
|
7186
7668
|
const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
|
|
7187
7669
|
setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
|
|
@@ -7189,31 +7671,26 @@ function ProcessingStep({
|
|
|
7189
7671
|
(previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
|
|
7190
7672
|
);
|
|
7191
7673
|
}, [phaseTimings.completedAt, state.type, updatePhaseTimings]);
|
|
7192
|
-
|
|
7674
|
+
useEffect13(() => {
|
|
7193
7675
|
if (!state.lastEvent) return;
|
|
7194
7676
|
updatePhaseTimings(
|
|
7195
7677
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
7196
7678
|
);
|
|
7197
7679
|
}, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
|
|
7198
7680
|
const [swappedFiatContext, setSwappedFiatContext] = useState13(null);
|
|
7199
|
-
|
|
7681
|
+
useEffect13(() => {
|
|
7200
7682
|
let cancelled = false;
|
|
7201
7683
|
let timeoutId;
|
|
7202
7684
|
const isFiatSwappedOrder = isSwappedOrder && swappedContext?.variant === "fiat";
|
|
7203
7685
|
const expectedOrderUuid = swappedContext?.expectedOrderUuid ?? null;
|
|
7204
7686
|
setSwappedFiatContext(null);
|
|
7205
|
-
if (
|
|
7687
|
+
if (!isSwappedOrder || !expectedOrderUuid) {
|
|
7206
7688
|
return () => {
|
|
7207
7689
|
cancelled = true;
|
|
7208
7690
|
};
|
|
7209
7691
|
}
|
|
7692
|
+
const orderId = expectedOrderUuid;
|
|
7210
7693
|
let attempts = 0;
|
|
7211
|
-
const matchesCurrentDeposit = (res) => {
|
|
7212
|
-
if (isFiatSwappedOrder) {
|
|
7213
|
-
return res.orderId === expectedOrderUuid;
|
|
7214
|
-
}
|
|
7215
|
-
return res.transactionId != null && res.transactionId.toLowerCase() === txHash.toLowerCase();
|
|
7216
|
-
};
|
|
7217
7694
|
const scheduleRetry = () => {
|
|
7218
7695
|
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
7219
7696
|
return;
|
|
@@ -7226,9 +7703,9 @@ function ProcessingStep({
|
|
|
7226
7703
|
async function fetchContext() {
|
|
7227
7704
|
attempts += 1;
|
|
7228
7705
|
try {
|
|
7229
|
-
const res = await service.
|
|
7706
|
+
const res = await service.fetchSwappedOrder(orderId);
|
|
7230
7707
|
if (cancelled) return;
|
|
7231
|
-
if (!res ||
|
|
7708
|
+
if (!res || res.orderId !== orderId) {
|
|
7232
7709
|
scheduleRetry();
|
|
7233
7710
|
return;
|
|
7234
7711
|
}
|
|
@@ -7247,13 +7724,11 @@ function ProcessingStep({
|
|
|
7247
7724
|
};
|
|
7248
7725
|
}, [
|
|
7249
7726
|
service,
|
|
7250
|
-
smartAccount,
|
|
7251
|
-
txHash,
|
|
7252
7727
|
isSwappedOrder,
|
|
7253
7728
|
swappedContext?.variant,
|
|
7254
7729
|
swappedContext?.expectedOrderUuid
|
|
7255
7730
|
]);
|
|
7256
|
-
|
|
7731
|
+
useEffect13(() => {
|
|
7257
7732
|
if (directTransfer) return;
|
|
7258
7733
|
if (state.type !== "processing") {
|
|
7259
7734
|
pollIntervalRef.current = INITIAL_POLL_INTERVAL;
|
|
@@ -7401,46 +7876,53 @@ function ProcessingStep({
|
|
|
7401
7876
|
const targetChainId = targetChainToChainId(targetChain);
|
|
7402
7877
|
const settledSourceTxHash = lastEvent?.data?.source?.transactionHash;
|
|
7403
7878
|
const sourceExplorerHash = settledSourceTxHash ?? (sourceTxHashPending ? null : sourceTxHash);
|
|
7404
|
-
|
|
7879
|
+
useEffect13(() => {
|
|
7405
7880
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
7406
7881
|
onSourceTransactionObserved?.(settledSourceTxHash);
|
|
7407
7882
|
}
|
|
7408
7883
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
7409
7884
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
7410
7885
|
const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainId, destinationTxHash) : null;
|
|
7411
|
-
const sourceDisplay = (() => {
|
|
7412
|
-
const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
|
|
7413
|
-
symbol: providedSourceSymbol ?? (displaySourceChain === "solana" ? "SOL" : "Token"),
|
|
7414
|
-
decimals: providedSourceDecimals
|
|
7415
|
-
});
|
|
7416
|
-
return {
|
|
7417
|
-
symbol: resolved.symbol,
|
|
7418
|
-
decimals: resolved.decimals ?? (displaySourceChain === "solana" ? 9 : 18)
|
|
7419
|
-
};
|
|
7420
|
-
})();
|
|
7421
|
-
const sourceSymbol = sourceDisplay.symbol;
|
|
7422
|
-
const formattedSentAmount = formatRawTokenAmount(displayAmount, sourceDisplay) ?? // Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7423
|
-
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol) ?? displayAmount;
|
|
7424
7886
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
7425
|
-
const
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7887
|
+
const displayTargetChain = eventDestination.chainId ?? targetChainId;
|
|
7888
|
+
const displayTargetToken = eventDestination.token ?? targetToken;
|
|
7889
|
+
const [sourceDisplay, targetDisplay] = useTokenDisplays([
|
|
7890
|
+
{
|
|
7891
|
+
chain: displaySourceChain,
|
|
7892
|
+
address: displaySourceToken,
|
|
7893
|
+
fallback: {
|
|
7894
|
+
symbol: providedSourceSymbol ?? (displaySourceChain === "solana" ? "SOL" : "Token"),
|
|
7895
|
+
decimals: providedSourceDecimals
|
|
7896
|
+
}
|
|
7897
|
+
},
|
|
7898
|
+
{
|
|
7899
|
+
chain: displayTargetChain,
|
|
7900
|
+
address: displayTargetToken,
|
|
7901
|
+
// Dapp deposits default to USDC targets; mirror the source symbol last
|
|
7902
|
+
// so unresolvable same-token routes still label sensibly.
|
|
7903
|
+
fallback: { symbol: providedSourceSymbol ?? "USDC" }
|
|
7904
|
+
}
|
|
7905
|
+
]);
|
|
7906
|
+
const sourceSymbol = sourceDisplay.symbol;
|
|
7432
7907
|
const targetSymbol = targetDisplay.symbol;
|
|
7908
|
+
const formattedSentAmount = formatRawTokenAmount(displayAmount, sourceDisplay) ?? // Unknown decimals: no figure rather than a guess off by 10^12.
|
|
7909
|
+
(sourceDisplay.decimals === void 0 ? "\u2014" : (
|
|
7910
|
+
// Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7911
|
+
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol) ?? displayAmount
|
|
7912
|
+
));
|
|
7913
|
+
const sourceTokenRef = displaySourceToken ? { chain: displaySourceChain, address: displaySourceToken } : void 0;
|
|
7914
|
+
const targetTokenRef = displayTargetToken ? { chain: displayTargetChain, address: displayTargetToken } : void 0;
|
|
7433
7915
|
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
7434
7916
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
7435
|
-
const prices = useTokenPrices(
|
|
7917
|
+
const prices = useTokenPrices([
|
|
7436
7918
|
{
|
|
7437
7919
|
chainId: displaySourceChain,
|
|
7438
7920
|
address: displaySourceToken,
|
|
7439
7921
|
symbol: sourceDisplay.symbol
|
|
7440
7922
|
},
|
|
7441
7923
|
{
|
|
7442
|
-
chainId:
|
|
7443
|
-
address:
|
|
7924
|
+
chainId: displayTargetChain,
|
|
7925
|
+
address: displayTargetToken,
|
|
7444
7926
|
symbol: targetDisplay.symbol
|
|
7445
7927
|
}
|
|
7446
7928
|
]);
|
|
@@ -7450,7 +7932,7 @@ function ProcessingStep({
|
|
|
7450
7932
|
sourceSymbol: sourceDisplay.symbol,
|
|
7451
7933
|
targetSymbol: targetDisplay.symbol,
|
|
7452
7934
|
sourceAmountUsd: amountUsdNumber,
|
|
7453
|
-
sourceTrusted:
|
|
7935
|
+
sourceTrusted: sourceDisplay.curated,
|
|
7454
7936
|
prices
|
|
7455
7937
|
});
|
|
7456
7938
|
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
@@ -7498,7 +7980,7 @@ function ProcessingStep({
|
|
|
7498
7980
|
) : timingStateRef.current;
|
|
7499
7981
|
timingStateRef.current = timingState;
|
|
7500
7982
|
const expectedDuration = latchedTiming && timingState === "expected" ? formatExpectedDuration(latchedTiming.expectedSeconds) : void 0;
|
|
7501
|
-
|
|
7983
|
+
useEffect13(() => {
|
|
7502
7984
|
if (directTransfer || !isProcessing || timingState !== "escalated") return;
|
|
7503
7985
|
if (escalatedDelayRef.current) return;
|
|
7504
7986
|
escalatedDelayRef.current = true;
|
|
@@ -7529,10 +8011,10 @@ function ProcessingStep({
|
|
|
7529
8011
|
const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
|
|
7530
8012
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
7531
8013
|
const handleRetry = onRetry ?? onNewDeposit;
|
|
7532
|
-
const headerContent = isComplete ? /* @__PURE__ */
|
|
8014
|
+
const headerContent = isComplete ? /* @__PURE__ */ jsxs19("div", { className: "rs-body-header", children: [
|
|
7533
8015
|
/* @__PURE__ */ jsx27(SuccessBadge, {}),
|
|
7534
8016
|
/* @__PURE__ */ jsx27("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx27("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
7535
|
-
] }) : isFailed ? /* @__PURE__ */
|
|
8017
|
+
] }) : isFailed ? /* @__PURE__ */ jsxs19("div", { className: "rs-body-header", children: [
|
|
7536
8018
|
/* @__PURE__ */ jsx27(FailedBadge, {}),
|
|
7537
8019
|
/* @__PURE__ */ jsx27("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx27("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
7538
8020
|
] }) : /* @__PURE__ */ jsx27(BodyHeader, { icon: /* @__PURE__ */ jsx27(WalletIcon, {}), title: stateTitle });
|
|
@@ -7583,6 +8065,7 @@ function ProcessingStep({
|
|
|
7583
8065
|
amountPaid,
|
|
7584
8066
|
depositedAmount,
|
|
7585
8067
|
depositedSymbol: targetSymbol,
|
|
8068
|
+
depositedToken: targetTokenRef,
|
|
7586
8069
|
feesTotal,
|
|
7587
8070
|
feeRows,
|
|
7588
8071
|
feesTooltip,
|
|
@@ -7592,13 +8075,13 @@ function ProcessingStep({
|
|
|
7592
8075
|
}
|
|
7593
8076
|
);
|
|
7594
8077
|
}
|
|
7595
|
-
return /* @__PURE__ */
|
|
7596
|
-
/* @__PURE__ */
|
|
8078
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-screen", children: [
|
|
8079
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
7597
8080
|
headerContent,
|
|
7598
|
-
/* @__PURE__ */
|
|
7599
|
-
/* @__PURE__ */
|
|
8081
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-details", children: [
|
|
8082
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7600
8083
|
/* @__PURE__ */ jsx27("span", { children: "Source chain" }),
|
|
7601
|
-
/* @__PURE__ */
|
|
8084
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7602
8085
|
/* @__PURE__ */ jsx27("span", { children: sourceChainName }),
|
|
7603
8086
|
sourceChainIcon && /* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(CdnIcon, { src: sourceChainIcon }) }),
|
|
7604
8087
|
sourceExplorerUrl && /* @__PURE__ */ jsx27(
|
|
@@ -7614,9 +8097,9 @@ function ProcessingStep({
|
|
|
7614
8097
|
)
|
|
7615
8098
|
] })
|
|
7616
8099
|
] }),
|
|
7617
|
-
/* @__PURE__ */
|
|
8100
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7618
8101
|
/* @__PURE__ */ jsx27("span", { children: "Destination chain" }),
|
|
7619
|
-
/* @__PURE__ */
|
|
8102
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7620
8103
|
/* @__PURE__ */ jsx27("span", { children: targetChainName }),
|
|
7621
8104
|
targetChainIcon && /* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(CdnIcon, { src: targetChainIcon }) }),
|
|
7622
8105
|
destExplorerUrl && /* @__PURE__ */ jsx27(
|
|
@@ -7632,70 +8115,70 @@ function ProcessingStep({
|
|
|
7632
8115
|
)
|
|
7633
8116
|
] })
|
|
7634
8117
|
] }),
|
|
7635
|
-
/* @__PURE__ */
|
|
8118
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7636
8119
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "Time elapsed" : "Total time" }),
|
|
7637
8120
|
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx27(Ticker, { value: timerText }) })
|
|
7638
8121
|
] }),
|
|
7639
|
-
isSwappedOrder ? /* @__PURE__ */
|
|
7640
|
-
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */
|
|
8122
|
+
isSwappedOrder ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
8123
|
+
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7641
8124
|
/* @__PURE__ */ jsx27("span", { children: "You pay" }),
|
|
7642
|
-
/* @__PURE__ */
|
|
8125
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7643
8126
|
"$",
|
|
7644
8127
|
swappedFiatContext.paidAmountUsd.toFixed(2),
|
|
7645
|
-
swappedFiatContext.paymentMethod && /* @__PURE__ */
|
|
8128
|
+
swappedFiatContext.paymentMethod && /* @__PURE__ */ jsxs19("span", { style: { color: "#71717b", marginLeft: 6 }, children: [
|
|
7646
8129
|
"via",
|
|
7647
8130
|
" ",
|
|
7648
8131
|
formatPaymentMethod(swappedFiatContext.paymentMethod)
|
|
7649
8132
|
] })
|
|
7650
8133
|
] })
|
|
7651
8134
|
] }),
|
|
7652
|
-
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */
|
|
8135
|
+
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7653
8136
|
/* @__PURE__ */ jsx27("span", { children: "On-ramp fee" }),
|
|
7654
|
-
/* @__PURE__ */
|
|
8137
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7655
8138
|
"$",
|
|
7656
8139
|
swappedFiatContext.onrampFeeUsd.toFixed(2)
|
|
7657
8140
|
] })
|
|
7658
8141
|
] }),
|
|
7659
|
-
formattedBridgingCost && /* @__PURE__ */
|
|
8142
|
+
formattedBridgingCost && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7660
8143
|
/* @__PURE__ */ jsx27("span", { children: "Bridging cost" }),
|
|
7661
|
-
/* @__PURE__ */
|
|
7662
|
-
/* @__PURE__ */
|
|
8144
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8145
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
7663
8146
|
formattedBridgingCost,
|
|
7664
8147
|
" ",
|
|
7665
8148
|
sourceSymbol
|
|
7666
8149
|
] }),
|
|
7667
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: sourceSymbol }) })
|
|
8150
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7668
8151
|
] })
|
|
7669
8152
|
] })
|
|
7670
|
-
] }) : /* @__PURE__ */
|
|
8153
|
+
] }) : /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7671
8154
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "You send" : "You sent" }),
|
|
7672
|
-
/* @__PURE__ */
|
|
7673
|
-
/* @__PURE__ */
|
|
8155
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8156
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
7674
8157
|
formattedSentAmount,
|
|
7675
8158
|
" ",
|
|
7676
8159
|
sourceSymbol
|
|
7677
8160
|
] }),
|
|
7678
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: sourceSymbol }) })
|
|
8161
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7679
8162
|
] })
|
|
7680
8163
|
] }),
|
|
7681
|
-
/* @__PURE__ */
|
|
8164
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7682
8165
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "Receive" : "Received" }),
|
|
7683
|
-
/* @__PURE__ */
|
|
8166
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7684
8167
|
/* @__PURE__ */ jsx27("span", { children: receiveDisplay }),
|
|
7685
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: targetSymbol }) })
|
|
8168
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: targetTokenRef, symbol: targetSymbol }) })
|
|
7686
8169
|
] })
|
|
7687
8170
|
] }),
|
|
7688
|
-
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */
|
|
8171
|
+
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7689
8172
|
/* @__PURE__ */ jsx27("span", { children: "Balance" }),
|
|
7690
|
-
/* @__PURE__ */
|
|
8173
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7691
8174
|
"$",
|
|
7692
8175
|
balanceAfterUsd.toFixed(2)
|
|
7693
8176
|
] })
|
|
7694
8177
|
] }),
|
|
7695
|
-
isSwappedOrder ? quotedFeeAmount !== void 0 && /* @__PURE__ */
|
|
8178
|
+
isSwappedOrder ? quotedFeeAmount !== void 0 && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7696
8179
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7697
|
-
/* @__PURE__ */
|
|
7698
|
-
/* @__PURE__ */
|
|
8180
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8181
|
+
/* @__PURE__ */ jsxs19(
|
|
7699
8182
|
"span",
|
|
7700
8183
|
{
|
|
7701
8184
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
@@ -7718,7 +8201,7 @@ function ProcessingStep({
|
|
|
7718
8201
|
] }) : (() => {
|
|
7719
8202
|
const { display, struck } = quoteFeeRow(quote?.fees);
|
|
7720
8203
|
if (display !== null) {
|
|
7721
|
-
return /* @__PURE__ */
|
|
8204
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7722
8205
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7723
8206
|
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx27(
|
|
7724
8207
|
"span",
|
|
@@ -7731,9 +8214,9 @@ function ProcessingStep({
|
|
|
7731
8214
|
}
|
|
7732
8215
|
const feeValue = quotedFeeAmount ?? formattedBridgingCost;
|
|
7733
8216
|
if (feeValue === void 0) return null;
|
|
7734
|
-
return /* @__PURE__ */
|
|
8217
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7735
8218
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7736
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */
|
|
8219
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsxs19(
|
|
7737
8220
|
"span",
|
|
7738
8221
|
{
|
|
7739
8222
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
@@ -7748,7 +8231,7 @@ function ProcessingStep({
|
|
|
7748
8231
|
})()
|
|
7749
8232
|
] }),
|
|
7750
8233
|
isFailed && failureMessage && /* @__PURE__ */ jsx27(Callout, { variant: "error", children: failureMessage }),
|
|
7751
|
-
isProcessing && expectedDuration !== void 0 && /* @__PURE__ */
|
|
8234
|
+
isProcessing && expectedDuration !== void 0 && /* @__PURE__ */ jsxs19("p", { className: "rs-pending-expectation", children: [
|
|
7752
8235
|
"Usually arrives in ",
|
|
7753
8236
|
expectedDuration
|
|
7754
8237
|
] }),
|
|
@@ -7763,14 +8246,14 @@ function ProcessingStep({
|
|
|
7763
8246
|
children: "Submitting transaction\u2026"
|
|
7764
8247
|
}
|
|
7765
8248
|
),
|
|
7766
|
-
isComplete && /* @__PURE__ */
|
|
7767
|
-
onNewDeposit && /* @__PURE__ */
|
|
8249
|
+
isComplete && /* @__PURE__ */ jsxs19("div", { className: "rs-screen-button-row", children: [
|
|
8250
|
+
onNewDeposit && /* @__PURE__ */ jsxs19(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: [
|
|
7768
8251
|
"New ",
|
|
7769
8252
|
flowNoun
|
|
7770
8253
|
] }),
|
|
7771
8254
|
onClose && /* @__PURE__ */ jsx27(Button, { onClick: () => onClose("success_done"), fullWidth: true, children: "Done" })
|
|
7772
8255
|
] }),
|
|
7773
|
-
isFailed && /* @__PURE__ */
|
|
8256
|
+
isFailed && /* @__PURE__ */ jsxs19("div", { className: "rs-screen-button-row", children: [
|
|
7774
8257
|
onClose && /* @__PURE__ */ jsx27(
|
|
7775
8258
|
Button,
|
|
7776
8259
|
{
|
|
@@ -7982,36 +8465,21 @@ function mapError(error) {
|
|
|
7982
8465
|
|
|
7983
8466
|
export {
|
|
7984
8467
|
Modal,
|
|
7985
|
-
|
|
7986
|
-
ExternalLinkIcon,
|
|
7987
|
-
CheckIcon,
|
|
7988
|
-
TransferCryptoIcon,
|
|
7989
|
-
ChevronLeftIcon,
|
|
7990
|
-
ChevronDownIcon,
|
|
7991
|
-
CloseIcon,
|
|
7992
|
-
HandCoinsIcon,
|
|
7993
|
-
InfoIcon,
|
|
7994
|
-
CopyIcon,
|
|
7995
|
-
CircleArrowOutUpLeftIcon,
|
|
7996
|
-
CardIcon,
|
|
7997
|
-
BankIcon,
|
|
7998
|
-
UnplugIcon,
|
|
7999
|
-
MigrateAssetsIcon,
|
|
8000
|
-
AppleIcon,
|
|
8001
|
-
BodyHeader,
|
|
8468
|
+
Callout,
|
|
8002
8469
|
CdnIcon,
|
|
8003
8470
|
ListRow,
|
|
8004
8471
|
PoweredBy,
|
|
8005
|
-
Spinner,
|
|
8006
8472
|
catalogKeyForChain,
|
|
8007
8473
|
debugLog,
|
|
8008
8474
|
debugError,
|
|
8475
|
+
SOLANA_TOKENS,
|
|
8476
|
+
resolveSolanaToken,
|
|
8477
|
+
isNativeSol,
|
|
8009
8478
|
getAssetId,
|
|
8010
8479
|
chainIdsByValue,
|
|
8011
8480
|
portfolioToAssets,
|
|
8012
8481
|
isNativeAsset,
|
|
8013
8482
|
quoteFeeRow,
|
|
8014
|
-
SwappedConnectFeeChangedError,
|
|
8015
8483
|
SUPPORTED_CONNECT_EXCHANGE_COUNT,
|
|
8016
8484
|
resolveAppFeeBps,
|
|
8017
8485
|
isDepositPolicyRefusal,
|
|
@@ -8041,10 +8509,15 @@ export {
|
|
|
8041
8509
|
ChainCatalogProvider,
|
|
8042
8510
|
getExchangeLogoSrc,
|
|
8043
8511
|
getExchangeLogo,
|
|
8044
|
-
useLatestRef,
|
|
8045
8512
|
Button,
|
|
8046
|
-
|
|
8513
|
+
assetIdFor,
|
|
8514
|
+
AssetMetadataProvider,
|
|
8515
|
+
useAssetStore,
|
|
8047
8516
|
TokenIcon,
|
|
8517
|
+
resolveCuratedToken,
|
|
8518
|
+
useTokenDisplays,
|
|
8519
|
+
useTokenDisplay,
|
|
8520
|
+
useIsRecognizedToken,
|
|
8048
8521
|
currencyFormatter,
|
|
8049
8522
|
tokenFormatter,
|
|
8050
8523
|
isUnsupportedChainSwitchError,
|
|
@@ -8055,7 +8528,6 @@ export {
|
|
|
8055
8528
|
isSubmissionUncertain,
|
|
8056
8529
|
formatTokenAmount,
|
|
8057
8530
|
isDisplayStablecoinSymbol,
|
|
8058
|
-
isRecognizedToken,
|
|
8059
8531
|
formatQuotedReceive,
|
|
8060
8532
|
formatReceiveEstimate,
|
|
8061
8533
|
getEventTxHash,
|
|
@@ -8064,7 +8536,6 @@ export {
|
|
|
8064
8536
|
isFailedEvent,
|
|
8065
8537
|
txRefsMatch,
|
|
8066
8538
|
failureMessageForEvent,
|
|
8067
|
-
fetchTokenPriceUsd,
|
|
8068
8539
|
useTokenPrices,
|
|
8069
8540
|
ProcessingStep,
|
|
8070
8541
|
AnalyticsSession,
|