@rhinestone/deposit-modal 0.19.0 → 0.20.1
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 +154 -61
- package/dist/BankOnrampStep-3SNUX6V2.cjs +435 -0
- package/dist/BankOnrampStep-4D24HVHV.mjs +435 -0
- package/dist/{DepositModalReown-UITYXJ6W.cjs → DepositModalReown-7EHOJTFW.cjs} +21 -20
- package/dist/{DepositModalReown-XBNY6QCI.mjs → DepositModalReown-SYQ2SCHC.mjs} +6 -5
- package/dist/WithdrawModal-LLJLEYXZ.cjs +12 -0
- package/dist/WithdrawModal-LXDIT4UV.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-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-EG4H7OMC.cjs → chunk-CIVFT5KR.cjs} +171 -130
- package/dist/{chunk-PYOC6K24.cjs → chunk-D3R3O4CY.cjs} +1 -1
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/chunk-EJDBIWNH.mjs +113 -0
- package/dist/chunk-FKJ6EJHH.cjs +346 -0
- package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
- package/dist/{chunk-NITKDXHR.mjs → chunk-FW7ZMXQS.mjs} +849 -674
- package/dist/chunk-G264OM23.cjs +224 -0
- package/dist/chunk-IPHKBBUV.cjs +113 -0
- package/dist/{chunk-BIL4ENC3.mjs → chunk-IPKT3FU6.mjs} +73 -32
- package/dist/chunk-JPX4MEHV.mjs +19 -0
- package/dist/{chunk-HMUGY66O.cjs → chunk-KXSU24RU.cjs} +1569 -1019
- package/dist/{chunk-ISLVD5HQ.cjs → chunk-LVMNNMOZ.cjs} +10 -5
- package/dist/chunk-O5OW4S7L.cjs +19 -0
- package/dist/{chunk-5NWLS5BQ.mjs → chunk-OZPMRTW3.mjs} +1511 -961
- package/dist/{chunk-OCWSMLOP.cjs → chunk-PVFEZ3UG.cjs} +1164 -989
- package/dist/{chunk-ZGHVJ2XM.mjs → chunk-YQCRXJIL.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-X6N2XPTO.mjs → chunk-ZOJMB5TZ.mjs} +1 -1
- 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-BOxa1DE-.d.ts → types-BEEMfNi2.d.cts} +24 -4
- package/dist/{types-BShYNpvO.d.cts → types-DQDUqzsZ.d.ts} +24 -4
- 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-ZOJMB5TZ.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;
|
|
@@ -454,6 +423,54 @@ function catalogExplorerTxUrl(chain, txHash) {
|
|
|
454
423
|
return `${chain.explorer.url}${chain.explorer.txPath}${txHash}`;
|
|
455
424
|
}
|
|
456
425
|
|
|
426
|
+
// src/core/hosted-order.ts
|
|
427
|
+
var RANK = {
|
|
428
|
+
awaiting_payment: 0,
|
|
429
|
+
paying: 1,
|
|
430
|
+
paid: 2,
|
|
431
|
+
sent: 3
|
|
432
|
+
};
|
|
433
|
+
function hostedOrderState(order) {
|
|
434
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
435
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : null;
|
|
436
|
+
const outcome = order.status === "refunded" ? "refunded" : order.status === "failed" && !deliveryTxHash ? receipt.status === "failed" && receipt.reason === "cancelled" ? "cancelled" : "failed" : null;
|
|
437
|
+
const progress = deliveryTxHash ? "sent" : receipt.status === "completed" || conversion.status !== "not_started" ? "paid" : receipt.status === "processing" || receipt.status === "on_hold" ? "paying" : "awaiting_payment";
|
|
438
|
+
return { progress, outcome, deliveryTxHash };
|
|
439
|
+
}
|
|
440
|
+
function hostedOrderStateFromSwapped(status, txHash) {
|
|
441
|
+
const deliveryTxHash = txHash ?? null;
|
|
442
|
+
switch (status) {
|
|
443
|
+
case "payment_pending":
|
|
444
|
+
return { progress: "awaiting_payment", outcome: null, deliveryTxHash };
|
|
445
|
+
case "wallet_order_registered":
|
|
446
|
+
case "wallet_order_confirmed":
|
|
447
|
+
return { progress: "paying", outcome: null, deliveryTxHash };
|
|
448
|
+
case "order_completed":
|
|
449
|
+
return {
|
|
450
|
+
progress: deliveryTxHash ? "sent" : "paid",
|
|
451
|
+
outcome: null,
|
|
452
|
+
deliveryTxHash
|
|
453
|
+
};
|
|
454
|
+
case "order_broadcasted":
|
|
455
|
+
return { progress: "sent", outcome: null, deliveryTxHash };
|
|
456
|
+
case "order_cancelled":
|
|
457
|
+
return { progress: "awaiting_payment", outcome: "cancelled", deliveryTxHash };
|
|
458
|
+
default:
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function mergeHostedOrderState(previous, next) {
|
|
463
|
+
if (!previous) return next;
|
|
464
|
+
return {
|
|
465
|
+
progress: RANK[next.progress] >= RANK[previous.progress] ? next.progress : previous.progress,
|
|
466
|
+
outcome: next.outcome ?? previous.outcome,
|
|
467
|
+
deliveryTxHash: next.deliveryTxHash ?? previous.deliveryTxHash
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function hasReached(state, progress) {
|
|
471
|
+
return state ? RANK[state.progress] >= RANK[progress] : false;
|
|
472
|
+
}
|
|
473
|
+
|
|
457
474
|
// src/core/deposit-asset-helpers.ts
|
|
458
475
|
function getAssetId(asset) {
|
|
459
476
|
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
@@ -719,16 +736,6 @@ function parseFeeLine(raw) {
|
|
|
719
736
|
...line.internal !== void 0 && { internal: line.internal }
|
|
720
737
|
};
|
|
721
738
|
}
|
|
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
739
|
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
733
740
|
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
734
741
|
function isSupportedConnectExchange(exchange) {
|
|
@@ -750,6 +757,10 @@ var DEPOSIT_POLICY_REFUSAL_CODES = [
|
|
|
750
757
|
"BALANCE-3",
|
|
751
758
|
"BALANCE-4"
|
|
752
759
|
];
|
|
760
|
+
var ASSET_LOOKUP_MAX_IDS = 100;
|
|
761
|
+
var ASSET_LOOKUP_MAX_URL_LENGTH = 2e3;
|
|
762
|
+
var ASSET_LOOKUP_TIMEOUT_MS = 8e3;
|
|
763
|
+
var ASSET_LOGO_PREFIX = "https://s3.rhinestone.dev/";
|
|
753
764
|
var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
|
|
754
765
|
async function readPolicyRefusal(response) {
|
|
755
766
|
if (response.status !== 422) return null;
|
|
@@ -790,16 +801,14 @@ function createDepositService(baseUrl, options) {
|
|
|
790
801
|
if (value.length <= 20) return value;
|
|
791
802
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
792
803
|
}
|
|
793
|
-
function withPreflightTimeout(label, fallback, run) {
|
|
804
|
+
function withPreflightTimeout(label, fallback, run, timeoutMs = DEPOSIT_PREFLIGHT_TIMEOUT_MS) {
|
|
794
805
|
const controller = new AbortController();
|
|
795
806
|
return new Promise((resolve) => {
|
|
796
807
|
const timer = setTimeout(() => {
|
|
797
|
-
debugLog(debug, scope, `${label}:timeout`, {
|
|
798
|
-
timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
|
|
799
|
-
});
|
|
808
|
+
debugLog(debug, scope, `${label}:timeout`, { timeoutMs });
|
|
800
809
|
controller.abort();
|
|
801
810
|
resolve(fallback);
|
|
802
|
-
},
|
|
811
|
+
}, timeoutMs);
|
|
803
812
|
run(controller.signal).then(
|
|
804
813
|
(value) => {
|
|
805
814
|
clearTimeout(timer);
|
|
@@ -814,6 +823,85 @@ function createDepositService(baseUrl, options) {
|
|
|
814
823
|
}
|
|
815
824
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
816
825
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
826
|
+
let assetsRouteMissing = false;
|
|
827
|
+
let assetsQueryUnsupported = false;
|
|
828
|
+
function assetsGetUrl(ids, fields) {
|
|
829
|
+
return apiUrl(
|
|
830
|
+
`/assets?${new URLSearchParams({
|
|
831
|
+
ids: ids.join(","),
|
|
832
|
+
fields: fields.join(",")
|
|
833
|
+
}).toString()}`
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
function requestAssets(method, ids, fields) {
|
|
837
|
+
const failed = { ok: false, status: null };
|
|
838
|
+
return withPreflightTimeout(
|
|
839
|
+
`lookupAssets:${method}`,
|
|
840
|
+
failed,
|
|
841
|
+
async (signal) => {
|
|
842
|
+
const response = await fetch(
|
|
843
|
+
method === "GET" ? assetsGetUrl(ids, fields) : apiUrl("/assets"),
|
|
844
|
+
{
|
|
845
|
+
method,
|
|
846
|
+
headers: serviceHeaders(),
|
|
847
|
+
body: method === "QUERY" ? JSON.stringify({ ids, fields }) : void 0,
|
|
848
|
+
cache: "no-store",
|
|
849
|
+
signal
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
if (response.status !== 200) {
|
|
853
|
+
debugError(debug, scope, "lookupAssets:failed", {
|
|
854
|
+
method,
|
|
855
|
+
status: response.status
|
|
856
|
+
});
|
|
857
|
+
return { ok: false, status: response.status };
|
|
858
|
+
}
|
|
859
|
+
const body = await response.json().catch(() => null);
|
|
860
|
+
const data = body?.data;
|
|
861
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
862
|
+
debugError(debug, scope, "lookupAssets:malformed", { method });
|
|
863
|
+
return failed;
|
|
864
|
+
}
|
|
865
|
+
return { ok: true, data };
|
|
866
|
+
},
|
|
867
|
+
ASSET_LOOKUP_TIMEOUT_MS
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
function chunkForGet(ids, fields) {
|
|
871
|
+
const chunks = [];
|
|
872
|
+
let current = [];
|
|
873
|
+
for (const id of ids) {
|
|
874
|
+
const next = [...current, id];
|
|
875
|
+
if (current.length > 0 && assetsGetUrl(next, fields).length > ASSET_LOOKUP_MAX_URL_LENGTH) {
|
|
876
|
+
chunks.push(current);
|
|
877
|
+
current = [id];
|
|
878
|
+
} else {
|
|
879
|
+
current = next;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
if (current.length > 0) chunks.push(current);
|
|
883
|
+
return chunks;
|
|
884
|
+
}
|
|
885
|
+
async function lookupAssetsViaGet(ids, fields) {
|
|
886
|
+
const data = {};
|
|
887
|
+
for (const chunk of chunkForGet(ids, fields)) {
|
|
888
|
+
const outcome = await requestAssets("GET", chunk, fields);
|
|
889
|
+
if (!outcome.ok) return outcome;
|
|
890
|
+
Object.assign(data, outcome.data);
|
|
891
|
+
}
|
|
892
|
+
return { ok: true, data };
|
|
893
|
+
}
|
|
894
|
+
async function lookupAssetsBatch(ids, fields) {
|
|
895
|
+
const fitsGet = assetsGetUrl(ids, fields).length <= ASSET_LOOKUP_MAX_URL_LENGTH;
|
|
896
|
+
if (fitsGet || assetsQueryUnsupported) {
|
|
897
|
+
return lookupAssetsViaGet(ids, fields);
|
|
898
|
+
}
|
|
899
|
+
const viaQuery = await requestAssets("QUERY", ids, fields);
|
|
900
|
+
if (viaQuery.ok) return viaQuery;
|
|
901
|
+
const viaGet = await lookupAssetsViaGet(ids, fields);
|
|
902
|
+
if (viaGet.ok) assetsQueryUnsupported = true;
|
|
903
|
+
return viaGet;
|
|
904
|
+
}
|
|
817
905
|
let topTokensPromise = null;
|
|
818
906
|
let chainsPromise = null;
|
|
819
907
|
function parseDepositOptions(value) {
|
|
@@ -918,6 +1006,39 @@ function createDepositService(baseUrl, options) {
|
|
|
918
1006
|
});
|
|
919
1007
|
return promise;
|
|
920
1008
|
}
|
|
1009
|
+
async function startSwappedCheckout(kind, account, fields) {
|
|
1010
|
+
const label = kind === "fiat" ? "Swapped widget URL" : "Swapped Connect URL";
|
|
1011
|
+
const response = await fetch(apiUrl("/onramp/orders"), {
|
|
1012
|
+
method: "POST",
|
|
1013
|
+
headers: serviceHeaders(),
|
|
1014
|
+
body: JSON.stringify({
|
|
1015
|
+
provider: "swapped",
|
|
1016
|
+
kind,
|
|
1017
|
+
account,
|
|
1018
|
+
...fields
|
|
1019
|
+
})
|
|
1020
|
+
});
|
|
1021
|
+
if (!response.ok) {
|
|
1022
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1023
|
+
debugError(debug, scope, "startSwappedCheckout:failed", error, {
|
|
1024
|
+
status: response.status,
|
|
1025
|
+
kind
|
|
1026
|
+
});
|
|
1027
|
+
throw new Error(
|
|
1028
|
+
typeof error.error === "string" && error.error || `${label} failed: ${response.status}`
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
const body = await response.json().catch(() => null);
|
|
1032
|
+
if (typeof body?.orderId !== "string" || body.nextAction?.type !== "hosted" || typeof body.nextAction.url !== "string") {
|
|
1033
|
+
throw new Error(`${label}: malformed response`);
|
|
1034
|
+
}
|
|
1035
|
+
return {
|
|
1036
|
+
orderId: body.orderId,
|
|
1037
|
+
url: body.nextAction.url,
|
|
1038
|
+
externalCustomerId: `${account.toLowerCase()}:${body.orderId}`,
|
|
1039
|
+
expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : void 0
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
921
1042
|
return {
|
|
922
1043
|
async registerManagedAccount(params) {
|
|
923
1044
|
const url = apiUrl("/register-managed");
|
|
@@ -1292,7 +1413,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1292
1413
|
},
|
|
1293
1414
|
async checkLiquidity(params) {
|
|
1294
1415
|
if (isSolanaCaip2(params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1295
|
-
const token =
|
|
1416
|
+
const token = resolveSolanaToken(params.destinationToken);
|
|
1296
1417
|
return {
|
|
1297
1418
|
hasLiquidity: true,
|
|
1298
1419
|
symbol: token?.symbol ?? "Token",
|
|
@@ -1566,138 +1687,45 @@ function createDepositService(baseUrl, options) {
|
|
|
1566
1687
|
status: result.status ?? "processing"
|
|
1567
1688
|
};
|
|
1568
1689
|
},
|
|
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 {};
|
|
1690
|
+
async lookupAssets(ids, fields) {
|
|
1691
|
+
const unique = [...new Set(ids.filter((id) => id.length > 0))];
|
|
1692
|
+
if (unique.length === 0) return { ok: true, items: {} };
|
|
1693
|
+
if (assetsRouteMissing) return { ok: false, routeMissing: true };
|
|
1694
|
+
const items = {};
|
|
1695
|
+
for (let i = 0; i < unique.length; i += ASSET_LOOKUP_MAX_IDS) {
|
|
1696
|
+
const batch = unique.slice(i, i + ASSET_LOOKUP_MAX_IDS);
|
|
1697
|
+
const outcome = await lookupAssetsBatch(batch, fields);
|
|
1698
|
+
if (!outcome.ok) {
|
|
1699
|
+
const routeMissing = outcome.status === 404 || outcome.status === 405;
|
|
1700
|
+
if (routeMissing) assetsRouteMissing = true;
|
|
1701
|
+
return { ok: false, routeMissing };
|
|
1586
1702
|
}
|
|
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 {};
|
|
1703
|
+
for (const id of batch) {
|
|
1704
|
+
const item = parseAssetItem(outcome.data[id], fields);
|
|
1705
|
+
if (item) items[id] = item;
|
|
1618
1706
|
}
|
|
1619
|
-
const data = await response.json();
|
|
1620
|
-
return data.prices ?? {};
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
debugError(debug, scope, "fetchPricesByAddress:error", err);
|
|
1623
|
-
return {};
|
|
1624
1707
|
}
|
|
1708
|
+
return { ok: true, items };
|
|
1625
1709
|
},
|
|
1626
1710
|
async getSwappedWidgetUrl(params) {
|
|
1627
|
-
const
|
|
1711
|
+
const { smartAccount, ...fields } = params;
|
|
1628
1712
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1629
|
-
smartAccount: shortRef(
|
|
1713
|
+
smartAccount: shortRef(smartAccount),
|
|
1630
1714
|
method: params.method,
|
|
1631
1715
|
methodSelectionSource: params.methodSelectionSource
|
|
1632
1716
|
});
|
|
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
|
-
};
|
|
1717
|
+
return startSwappedCheckout("fiat", smartAccount, fields);
|
|
1658
1718
|
},
|
|
1659
1719
|
async getSwappedConnectUrl(params) {
|
|
1660
|
-
const
|
|
1720
|
+
const { smartAccount, ...fields } = params;
|
|
1661
1721
|
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1662
|
-
smartAccount: shortRef(
|
|
1722
|
+
smartAccount: shortRef(smartAccount),
|
|
1663
1723
|
connection: params.connection
|
|
1664
1724
|
});
|
|
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
|
-
};
|
|
1725
|
+
return startSwappedCheckout("exchange", smartAccount, fields);
|
|
1698
1726
|
},
|
|
1699
1727
|
async getSwappedConnectExchanges() {
|
|
1700
|
-
const url = apiUrl("/onramp/swapped
|
|
1728
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=exchange");
|
|
1701
1729
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1702
1730
|
const response = await fetch(url, {
|
|
1703
1731
|
method: "GET",
|
|
@@ -1714,7 +1742,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1714
1742
|
);
|
|
1715
1743
|
}
|
|
1716
1744
|
const body = await response.json();
|
|
1717
|
-
const rawExchanges = Array.isArray(body.
|
|
1745
|
+
const rawExchanges = Array.isArray(body.connections) ? body.connections : null;
|
|
1718
1746
|
const exchanges = [];
|
|
1719
1747
|
let hasMalformedExchange = rawExchanges === null;
|
|
1720
1748
|
for (const exchange of rawExchanges ?? []) {
|
|
@@ -1732,16 +1760,36 @@ function createDepositService(baseUrl, options) {
|
|
|
1732
1760
|
}
|
|
1733
1761
|
exchanges.push({ connection, name, logoUrl });
|
|
1734
1762
|
}
|
|
1735
|
-
if (hasMalformedExchange
|
|
1763
|
+
if (hasMalformedExchange) {
|
|
1736
1764
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1737
1765
|
}
|
|
1738
|
-
return {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1766
|
+
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1767
|
+
},
|
|
1768
|
+
async getOnrampProviders() {
|
|
1769
|
+
try {
|
|
1770
|
+
const response = await fetch(apiUrl("/onramp/providers"), {
|
|
1771
|
+
method: "GET",
|
|
1772
|
+
headers: serviceHeaders(),
|
|
1773
|
+
cache: "no-store"
|
|
1774
|
+
});
|
|
1775
|
+
if (!response.ok) return null;
|
|
1776
|
+
const body = await response.json();
|
|
1777
|
+
if (!Array.isArray(body.providers)) return null;
|
|
1778
|
+
return body.providers.flatMap((raw) => {
|
|
1779
|
+
const p = raw;
|
|
1780
|
+
return (p.provider === "swapped" || p.provider === "noah") && (p.flow === "hosted" || p.flow === "funding_account") && Array.isArray(p.kinds) ? [
|
|
1781
|
+
{
|
|
1782
|
+
provider: p.provider,
|
|
1783
|
+
flow: p.flow,
|
|
1784
|
+
kinds: p.kinds.filter(
|
|
1785
|
+
(k) => k === "fiat" || k === "exchange"
|
|
1786
|
+
)
|
|
1787
|
+
}
|
|
1788
|
+
] : [];
|
|
1789
|
+
});
|
|
1790
|
+
} catch {
|
|
1791
|
+
return null;
|
|
1792
|
+
}
|
|
1745
1793
|
},
|
|
1746
1794
|
async getSwappedPaymentMethods() {
|
|
1747
1795
|
const empty = {
|
|
@@ -1749,7 +1797,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1749
1797
|
methods: [],
|
|
1750
1798
|
recommendedMethod: null
|
|
1751
1799
|
};
|
|
1752
|
-
const url = apiUrl("/onramp/swapped
|
|
1800
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=fiat");
|
|
1753
1801
|
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1754
1802
|
try {
|
|
1755
1803
|
const response = await fetch(url, {
|
|
@@ -1863,51 +1911,89 @@ function createDepositService(baseUrl, options) {
|
|
|
1863
1911
|
return null;
|
|
1864
1912
|
}
|
|
1865
1913
|
},
|
|
1866
|
-
async
|
|
1867
|
-
const url = apiUrl(
|
|
1868
|
-
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1869
|
-
);
|
|
1914
|
+
async fetchSwappedOrder(orderId) {
|
|
1915
|
+
const url = apiUrl(`/onramp/orders/${encodeURIComponent(orderId)}`);
|
|
1870
1916
|
const response = await fetch(url, {
|
|
1871
1917
|
method: "GET",
|
|
1872
1918
|
headers: serviceHeaders(),
|
|
1873
1919
|
cache: "no-store"
|
|
1874
1920
|
});
|
|
1875
1921
|
if (!response.ok) return null;
|
|
1876
|
-
let body
|
|
1922
|
+
let body;
|
|
1877
1923
|
try {
|
|
1878
1924
|
body = await response.json();
|
|
1879
1925
|
} catch {
|
|
1880
1926
|
return null;
|
|
1881
1927
|
}
|
|
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
|
-
};
|
|
1928
|
+
return swappedOrderFromView(orderId, body);
|
|
1908
1929
|
}
|
|
1909
1930
|
};
|
|
1910
1931
|
}
|
|
1932
|
+
function swappedOrderFromView(orderId, raw) {
|
|
1933
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1934
|
+
const view = raw;
|
|
1935
|
+
if (view.provider !== "swapped" || !isOrderShape(view)) return null;
|
|
1936
|
+
const number = (v) => {
|
|
1937
|
+
const n = typeof v === "string" && v.trim() ? Number(v) : v;
|
|
1938
|
+
return typeof n === "number" && Number.isFinite(n) ? n : null;
|
|
1939
|
+
};
|
|
1940
|
+
const text = (v) => typeof v === "string" && v.length > 0 ? v : null;
|
|
1941
|
+
const railName = (v) => {
|
|
1942
|
+
const name = text(v);
|
|
1943
|
+
return name === "provider_selected" || name === "unknown" ? null : name;
|
|
1944
|
+
};
|
|
1945
|
+
const usdTotal = number(view.fiat?.usd?.total);
|
|
1946
|
+
const usdNet = number(view.fiat?.usd?.net);
|
|
1947
|
+
return {
|
|
1948
|
+
orderId,
|
|
1949
|
+
...hostedOrderState(view),
|
|
1950
|
+
orderCrypto: text(view.crypto?.asset),
|
|
1951
|
+
orderCryptoAmount: text(view.crypto?.amount),
|
|
1952
|
+
receivedAt: text(view.updatedAt),
|
|
1953
|
+
paidAmountUsd: usdTotal ?? usdNet,
|
|
1954
|
+
paidAmountEur: number(view.fiat?.eur?.total) ?? number(view.fiat?.eur?.net),
|
|
1955
|
+
onrampFeeUsd: usdTotal !== null && usdNet !== null && usdTotal > usdNet ? Number((usdTotal - usdNet).toFixed(2)) : null,
|
|
1956
|
+
paymentMethod: railName(view.rail?.method ?? view.rail?.connection)
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
var ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1960
|
+
"pending",
|
|
1961
|
+
"processing",
|
|
1962
|
+
"completed",
|
|
1963
|
+
"failed",
|
|
1964
|
+
"refunded"
|
|
1965
|
+
]);
|
|
1966
|
+
function isOrderShape(view) {
|
|
1967
|
+
const stages = view.stages;
|
|
1968
|
+
return ORDER_STATUSES.has(view.status) && ["receipt", "conversion", "delivery"].every(
|
|
1969
|
+
(name) => typeof stages?.[name]?.status === "string"
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
function parseAssetItem(raw, fields) {
|
|
1973
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
1974
|
+
const record = raw;
|
|
1975
|
+
const item = {};
|
|
1976
|
+
if (fields.includes("symbol")) {
|
|
1977
|
+
const symbol = record.symbol;
|
|
1978
|
+
item.symbol = typeof symbol === "string" && symbol.trim().length > 0 ? symbol.trim() : null;
|
|
1979
|
+
}
|
|
1980
|
+
if (fields.includes("decimals")) {
|
|
1981
|
+
const decimals = record.decimals;
|
|
1982
|
+
item.decimals = typeof decimals === "number" && Number.isInteger(decimals) && decimals >= 0 && decimals <= 255 ? decimals : null;
|
|
1983
|
+
}
|
|
1984
|
+
if (fields.includes("logo")) {
|
|
1985
|
+
const logo = record.logo;
|
|
1986
|
+
item.logo = typeof logo === "string" && logo.startsWith(ASSET_LOGO_PREFIX) ? logo : null;
|
|
1987
|
+
}
|
|
1988
|
+
if (fields.includes("price")) {
|
|
1989
|
+
const price = record.price;
|
|
1990
|
+
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;
|
|
1991
|
+
item.priceUsd = Number.isFinite(usd) && usd > 0 ? usd : null;
|
|
1992
|
+
}
|
|
1993
|
+
const error = record.error;
|
|
1994
|
+
item.error = error && typeof error === "object" && typeof error.code === "string" ? { code: error.code } : null;
|
|
1995
|
+
return item;
|
|
1996
|
+
}
|
|
1911
1997
|
function normalizeDirectPortfolio(data) {
|
|
1912
1998
|
const rawTokens = extractArray(data, "tokens") ?? extractArray(
|
|
1913
1999
|
data?.data,
|
|
@@ -1933,20 +2019,13 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1933
2019
|
const unlocked = chainBalance.balance?.unlocked ?? "0";
|
|
1934
2020
|
const normalizedName = tokenData.tokenName.trim();
|
|
1935
2021
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1936
|
-
const tokenAddress = chainBalance.tokenAddress ?? extractTokenAddress(tokenData, chainBalance.chainId) ??
|
|
2022
|
+
const tokenAddress = chainBalance.tokenAddress ?? extractTokenAddress(tokenData, chainBalance.chainId) ?? runtimeEvmAddress(chainBalance.chainId, normalizedName);
|
|
1937
2023
|
const resolvedTokenAddress = isNativeSymbol ? NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1938
2024
|
if (!resolvedTokenAddress) {
|
|
1939
2025
|
continue;
|
|
1940
2026
|
}
|
|
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;
|
|
2027
|
+
const symbol = normalizedName || "Token";
|
|
2028
|
+
const decimals = tokenData.tokenDecimals ?? 18;
|
|
1950
2029
|
tokens.push({
|
|
1951
2030
|
chainId: chainBalance.chainId,
|
|
1952
2031
|
address: resolvedTokenAddress,
|
|
@@ -1972,7 +2051,6 @@ function normalizeDirectToken(token) {
|
|
|
1972
2051
|
isHyperCoreCaip2(rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : parseEvmChainId(rawChainString)
|
|
1973
2052
|
) : null);
|
|
1974
2053
|
if (chainId === null) return null;
|
|
1975
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? HYPERCORE_CHAIN_ID : void 0;
|
|
1976
2054
|
const symbol = extractString(token, "symbol") ?? extractString(token, "tokenSymbol") ?? extractString(token, "tokenName") ?? extractString(token, "name");
|
|
1977
2055
|
if (!symbol) return null;
|
|
1978
2056
|
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 +2058,13 @@ function normalizeDirectToken(token) {
|
|
|
1980
2058
|
const address = extractString(token, "address") ?? extractString(token, "tokenAddress") ?? extractString(
|
|
1981
2059
|
token.token,
|
|
1982
2060
|
"address"
|
|
1983
|
-
) ?? (
|
|
2061
|
+
) ?? (chainId === "hypercore" ? hyperCoreSourceToken(void 0, symbol)?.address : typeof chainId === "number" ? runtimeEvmAddress(chainId, symbol) : void 0);
|
|
1984
2062
|
if (!address) return null;
|
|
1985
2063
|
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
2064
|
const backendDecimals = extractNumber(token, "decimals") ?? extractNumber(token, "tokenDecimals");
|
|
1990
|
-
const
|
|
2065
|
+
const hyperCore = chainId === "hypercore" ? hyperCoreSourceToken(address, symbol) : void 0;
|
|
2066
|
+
const resolvedSymbol = hyperCore?.symbol ?? symbol;
|
|
2067
|
+
const resolvedDecimals = hyperCore?.decimals ?? backendDecimals ?? 18;
|
|
1991
2068
|
return {
|
|
1992
2069
|
chainId,
|
|
1993
2070
|
address,
|
|
@@ -1998,6 +2075,15 @@ function normalizeDirectToken(token) {
|
|
|
1998
2075
|
balanceUsd
|
|
1999
2076
|
};
|
|
2000
2077
|
}
|
|
2078
|
+
function runtimeEvmAddress(chainId, symbol) {
|
|
2079
|
+
const token = getRuntimeToken(chainId, symbol);
|
|
2080
|
+
return token && /^0x[a-fA-F0-9]{40}$/.test(token.address) ? token.address : void 0;
|
|
2081
|
+
}
|
|
2082
|
+
function hyperCoreSourceToken(address, symbol) {
|
|
2083
|
+
return HYPERCORE_SOURCE_TOKENS.find(
|
|
2084
|
+
(t) => address ? t.address.toLowerCase() === address.toLowerCase() : t.symbol.toUpperCase() === symbol.trim().toUpperCase()
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2001
2087
|
function extractTokenAddress(tokenData, chainId) {
|
|
2002
2088
|
const token = tokenData;
|
|
2003
2089
|
return token.tokenAddress ?? token.address ?? token.addresses?.[chainId] ?? token.token?.address ?? token.token?.addresses?.[chainId];
|
|
@@ -2269,7 +2355,7 @@ function needsViemChains(catalog, overrides) {
|
|
|
2269
2355
|
}
|
|
2270
2356
|
|
|
2271
2357
|
// src/core/chain-catalog-context.tsx
|
|
2272
|
-
import { jsx as
|
|
2358
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2273
2359
|
var EMPTY = {
|
|
2274
2360
|
catalog: null,
|
|
2275
2361
|
viemChains: null,
|
|
@@ -2343,6 +2429,7 @@ function publishRuntimeChainMeta(catalog) {
|
|
|
2343
2429
|
name: chain.name,
|
|
2344
2430
|
iconUrl: chain.iconUrl ?? void 0,
|
|
2345
2431
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2432
|
+
nativeDecimals: chain.nativeToken.decimals,
|
|
2346
2433
|
explorerUrl: chain.explorer?.url,
|
|
2347
2434
|
explorerTxPath: chain.explorer?.txPath,
|
|
2348
2435
|
explorerAddressPath: chain.explorer?.addressPath
|
|
@@ -2504,10 +2591,10 @@ function useRuntimeChainsVersion() {
|
|
|
2504
2591
|
);
|
|
2505
2592
|
}
|
|
2506
2593
|
function useReadClient(chainId, rpcUrls) {
|
|
2507
|
-
const
|
|
2594
|
+
const version2 = useRuntimeChainsVersion();
|
|
2508
2595
|
return useMemo2(
|
|
2509
2596
|
() => getPublicClient(chainId, rpcUrls),
|
|
2510
|
-
[chainId, rpcUrls,
|
|
2597
|
+
[chainId, rpcUrls, version2]
|
|
2511
2598
|
);
|
|
2512
2599
|
}
|
|
2513
2600
|
function useExplorerTxUrl() {
|
|
@@ -2625,27 +2712,303 @@ function ChainCatalogProvider({
|
|
|
2625
2712
|
clientCapableChainIds
|
|
2626
2713
|
]
|
|
2627
2714
|
);
|
|
2628
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsx2(ChainCatalogContext.Provider, { value, children });
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
// src/core/asset-metadata.tsx
|
|
2719
|
+
import {
|
|
2720
|
+
createContext as createContext3,
|
|
2721
|
+
useContext as useContext3,
|
|
2722
|
+
useEffect as useEffect3,
|
|
2723
|
+
useMemo as useMemo3,
|
|
2724
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
2725
|
+
} from "react";
|
|
2726
|
+
|
|
2727
|
+
// src/core/asset-id.ts
|
|
2728
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2729
|
+
var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
2730
|
+
var BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
2731
|
+
var SOLANA_SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
2732
|
+
function isNativeSpelling(chain, address) {
|
|
2733
|
+
if (chain === "solana") {
|
|
2734
|
+
return address === "native" || address === SOLANA_SYSTEM_PROGRAM2;
|
|
2735
|
+
}
|
|
2736
|
+
if (chain === "stellar") return address === "native";
|
|
2737
|
+
if (chain === "tron") return address === "native" || address === ZERO_ADDRESS;
|
|
2738
|
+
return address.toLowerCase() === ZERO_ADDRESS;
|
|
2739
|
+
}
|
|
2740
|
+
function assetIdFor(chain, address) {
|
|
2741
|
+
if (chain === void 0 || !address) return void 0;
|
|
2742
|
+
const native = isNativeSpelling(chain, address);
|
|
2743
|
+
if (chain === "hypercore" || chain === HYPERCORE_CHAIN_ID) {
|
|
2744
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2745
|
+
return `${HYPERCORE_SPOT_CAIP2}:${native ? "native" : address.toLowerCase()}`;
|
|
2746
|
+
}
|
|
2747
|
+
if (typeof chain === "number") {
|
|
2748
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2749
|
+
return `${toEvmCaip2(chain)}:${native ? "native" : address.toLowerCase()}`;
|
|
2750
|
+
}
|
|
2751
|
+
if (chain === "solana") {
|
|
2752
|
+
if (native) return `${SOLANA_MAINNET_CAIP2}:native`;
|
|
2753
|
+
return BASE58_RE.test(address) ? `${SOLANA_MAINNET_CAIP2}:${address}` : void 0;
|
|
2754
|
+
}
|
|
2755
|
+
const caip2 = chain === "tron" ? TRON_MAINNET_CAIP2 : STELLAR_PUBNET_CAIP2;
|
|
2756
|
+
return `${caip2}:${native ? "native" : address}`;
|
|
2757
|
+
}
|
|
2758
|
+
function assetIdForRef(ref) {
|
|
2759
|
+
return ref ? assetIdFor(ref.chain, ref.address) : void 0;
|
|
2629
2760
|
}
|
|
2630
2761
|
|
|
2631
|
-
// src/core/
|
|
2632
|
-
import {
|
|
2633
|
-
|
|
2634
|
-
|
|
2762
|
+
// src/core/asset-metadata.tsx
|
|
2763
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2764
|
+
var ASSET_RETRY_MS = 6e4;
|
|
2765
|
+
var ASSET_PRICE_TTL_MS = 6e4;
|
|
2766
|
+
var META_FIELDS = ["symbol", "decimals", "logo"];
|
|
2767
|
+
var PRICE_FIELDS = ["price"];
|
|
2768
|
+
var TERMINAL_ITEM_ERRORS = /* @__PURE__ */ new Set([
|
|
2769
|
+
"not_found",
|
|
2770
|
+
"unsupported_chain",
|
|
2771
|
+
"invalid_id"
|
|
2772
|
+
]);
|
|
2773
|
+
function createAssetStore(service, now = Date.now) {
|
|
2774
|
+
const meta = /* @__PURE__ */ new Map();
|
|
2775
|
+
const prices = /* @__PURE__ */ new Map();
|
|
2776
|
+
const metaInFlight = /* @__PURE__ */ new Set();
|
|
2777
|
+
const priceInFlight = /* @__PURE__ */ new Set();
|
|
2778
|
+
let metaQueue = /* @__PURE__ */ new Set();
|
|
2779
|
+
let priceQueue = /* @__PURE__ */ new Set();
|
|
2780
|
+
let flushScheduled = false;
|
|
2781
|
+
let routeMissing = false;
|
|
2782
|
+
let version2 = 0;
|
|
2783
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
2784
|
+
function notify() {
|
|
2785
|
+
version2 += 1;
|
|
2786
|
+
for (const listener of [...listeners2]) listener();
|
|
2787
|
+
}
|
|
2788
|
+
function idsFor(refs) {
|
|
2789
|
+
const ids = [];
|
|
2790
|
+
for (const ref of refs) {
|
|
2791
|
+
const id = assetIdForRef(ref);
|
|
2792
|
+
if (!id) continue;
|
|
2793
|
+
ids.push(id);
|
|
2794
|
+
}
|
|
2795
|
+
return ids;
|
|
2796
|
+
}
|
|
2797
|
+
function scheduleFlush() {
|
|
2798
|
+
if (flushScheduled) return;
|
|
2799
|
+
flushScheduled = true;
|
|
2800
|
+
queueMicrotask(() => {
|
|
2801
|
+
flushScheduled = false;
|
|
2802
|
+
const metaIds = [...metaQueue];
|
|
2803
|
+
const priceIds = [...priceQueue];
|
|
2804
|
+
metaQueue = /* @__PURE__ */ new Set();
|
|
2805
|
+
priceQueue = /* @__PURE__ */ new Set();
|
|
2806
|
+
if (metaIds.length > 0) void flushMeta(metaIds);
|
|
2807
|
+
if (priceIds.length > 0) void flushPrices(priceIds);
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
function needsMeta(id) {
|
|
2811
|
+
if (metaInFlight.has(id) || metaQueue.has(id)) return false;
|
|
2812
|
+
const entry = meta.get(id);
|
|
2813
|
+
if (!entry) return true;
|
|
2814
|
+
if (entry.status === "missing" || entry.status === "pending") return false;
|
|
2815
|
+
if (entry.status === "failed" && routeMissing) return false;
|
|
2816
|
+
return entry.retryAt !== void 0 && now() >= entry.retryAt;
|
|
2817
|
+
}
|
|
2818
|
+
function needsPrice(id) {
|
|
2819
|
+
if (priceInFlight.has(id) || priceQueue.has(id)) return false;
|
|
2820
|
+
const entry = prices.get(id);
|
|
2821
|
+
return !entry || now() - entry.at >= ASSET_PRICE_TTL_MS;
|
|
2822
|
+
}
|
|
2823
|
+
async function lookup2(ids, fields) {
|
|
2824
|
+
try {
|
|
2825
|
+
return await service.lookupAssets(ids, fields);
|
|
2826
|
+
} catch {
|
|
2827
|
+
return { ok: false, routeMissing: false };
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
async function flushMeta(ids) {
|
|
2831
|
+
for (const id of ids) metaInFlight.add(id);
|
|
2832
|
+
const result = await lookup2(ids, META_FIELDS);
|
|
2833
|
+
const at = now();
|
|
2834
|
+
for (const id of ids) {
|
|
2835
|
+
metaInFlight.delete(id);
|
|
2836
|
+
const previous = meta.get(id);
|
|
2837
|
+
if (!result.ok) {
|
|
2838
|
+
if (result.routeMissing) routeMissing = true;
|
|
2839
|
+
meta.set(id, {
|
|
2840
|
+
...previous,
|
|
2841
|
+
status: previous?.status === "ready" ? "ready" : "failed",
|
|
2842
|
+
retryAt: at + ASSET_RETRY_MS
|
|
2843
|
+
});
|
|
2844
|
+
continue;
|
|
2845
|
+
}
|
|
2846
|
+
const item = result.items[id];
|
|
2847
|
+
const code = item?.error?.code;
|
|
2848
|
+
if (!item || code && TERMINAL_ITEM_ERRORS.has(code)) {
|
|
2849
|
+
meta.set(id, { status: "missing" });
|
|
2850
|
+
continue;
|
|
2851
|
+
}
|
|
2852
|
+
meta.set(id, {
|
|
2853
|
+
status: "ready",
|
|
2854
|
+
symbol: item.symbol ?? previous?.symbol,
|
|
2855
|
+
decimals: item.decimals ?? previous?.decimals,
|
|
2856
|
+
logo: item.logo ?? previous?.logo,
|
|
2857
|
+
retryAt: code ? at + ASSET_RETRY_MS : void 0
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
notify();
|
|
2861
|
+
}
|
|
2862
|
+
async function flushPrices(ids) {
|
|
2863
|
+
for (const id of ids) priceInFlight.add(id);
|
|
2864
|
+
const result = await lookup2(ids, PRICE_FIELDS);
|
|
2865
|
+
const at = now();
|
|
2866
|
+
for (const id of ids) {
|
|
2867
|
+
priceInFlight.delete(id);
|
|
2868
|
+
prices.set(id, {
|
|
2869
|
+
usd: result.ok ? result.items[id]?.priceUsd ?? null : null,
|
|
2870
|
+
at
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
notify();
|
|
2874
|
+
}
|
|
2875
|
+
function requestMeta(refs) {
|
|
2876
|
+
let queued = false;
|
|
2877
|
+
for (const id of idsFor(refs)) {
|
|
2878
|
+
if (!needsMeta(id)) continue;
|
|
2879
|
+
metaQueue.add(id);
|
|
2880
|
+
queued = true;
|
|
2881
|
+
}
|
|
2882
|
+
if (queued) scheduleFlush();
|
|
2883
|
+
}
|
|
2884
|
+
function requestPrices(refs) {
|
|
2885
|
+
let queued = false;
|
|
2886
|
+
for (const id of idsFor(refs)) {
|
|
2887
|
+
if (!needsPrice(id)) continue;
|
|
2888
|
+
priceQueue.add(id);
|
|
2889
|
+
queued = true;
|
|
2890
|
+
}
|
|
2891
|
+
if (queued) scheduleFlush();
|
|
2892
|
+
}
|
|
2893
|
+
function settled(test) {
|
|
2894
|
+
if (test()) return Promise.resolve();
|
|
2895
|
+
return new Promise((resolve) => {
|
|
2896
|
+
const unsubscribe = subscribe(() => {
|
|
2897
|
+
if (!test()) return;
|
|
2898
|
+
unsubscribe();
|
|
2899
|
+
resolve();
|
|
2900
|
+
});
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
function subscribe(listener) {
|
|
2904
|
+
listeners2.add(listener);
|
|
2905
|
+
return () => {
|
|
2906
|
+
listeners2.delete(listener);
|
|
2907
|
+
};
|
|
2908
|
+
}
|
|
2909
|
+
function peekMeta(id) {
|
|
2910
|
+
const entry = meta.get(id);
|
|
2911
|
+
if (!entry) {
|
|
2912
|
+
return metaInFlight.has(id) || metaQueue.has(id) ? { status: "pending" } : void 0;
|
|
2913
|
+
}
|
|
2914
|
+
const { retryAt: _retryAt, ...rest } = entry;
|
|
2915
|
+
return rest;
|
|
2916
|
+
}
|
|
2917
|
+
return {
|
|
2918
|
+
subscribe,
|
|
2919
|
+
getVersion: () => version2,
|
|
2920
|
+
requestMeta,
|
|
2921
|
+
requestPrices,
|
|
2922
|
+
peekMeta,
|
|
2923
|
+
peekPrice: (id) => prices.get(id)?.usd,
|
|
2924
|
+
async resolveMeta(refs) {
|
|
2925
|
+
const ids = idsFor(refs);
|
|
2926
|
+
requestMeta(refs);
|
|
2927
|
+
await settled(
|
|
2928
|
+
() => ids.every((id) => !metaInFlight.has(id) && !metaQueue.has(id))
|
|
2929
|
+
);
|
|
2930
|
+
return Object.fromEntries(
|
|
2931
|
+
ids.map((id) => [id, peekMeta(id) ?? { status: "missing" }])
|
|
2932
|
+
);
|
|
2933
|
+
},
|
|
2934
|
+
async resolvePrice(ref) {
|
|
2935
|
+
const [id] = idsFor([ref]);
|
|
2936
|
+
if (!id) return null;
|
|
2937
|
+
requestPrices([ref]);
|
|
2938
|
+
await settled(() => !priceInFlight.has(id) && !priceQueue.has(id));
|
|
2939
|
+
return prices.get(id)?.usd ?? null;
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
}
|
|
2943
|
+
var AssetStoreContext = createContext3(null);
|
|
2944
|
+
function AssetMetadataProvider({
|
|
2945
|
+
service,
|
|
2946
|
+
children
|
|
2947
|
+
}) {
|
|
2948
|
+
const store = useMemo3(() => createAssetStore(service), [service]);
|
|
2949
|
+
return /* @__PURE__ */ jsx3(AssetStoreContext.Provider, { value: store, children });
|
|
2950
|
+
}
|
|
2951
|
+
function useAssetStore() {
|
|
2952
|
+
return useContext3(AssetStoreContext);
|
|
2953
|
+
}
|
|
2954
|
+
var noopSubscribe = () => () => {
|
|
2955
|
+
};
|
|
2956
|
+
var zero = () => 0;
|
|
2957
|
+
function useStoreVersion(store) {
|
|
2958
|
+
return useSyncExternalStore2(
|
|
2959
|
+
store ? store.subscribe : noopSubscribe,
|
|
2960
|
+
store ? store.getVersion : zero,
|
|
2961
|
+
store ? store.getVersion : zero
|
|
2962
|
+
);
|
|
2963
|
+
}
|
|
2964
|
+
function refsKey(refs) {
|
|
2965
|
+
return refs.map((ref) => assetIdForRef(ref) ?? "").filter(Boolean).join("|");
|
|
2966
|
+
}
|
|
2967
|
+
function definedRefs(refs) {
|
|
2968
|
+
return refs.filter((ref) => Boolean(ref));
|
|
2969
|
+
}
|
|
2970
|
+
function useAssetMetadata(refs) {
|
|
2971
|
+
const store = useAssetStore();
|
|
2972
|
+
const version2 = useStoreVersion(store);
|
|
2973
|
+
const key = refsKey(refs);
|
|
2974
|
+
useEffect3(() => {
|
|
2975
|
+
if (store && key) store.requestMeta(definedRefs(refs));
|
|
2976
|
+
}, [store, key]);
|
|
2977
|
+
return useMemo3(() => {
|
|
2978
|
+
const out = {};
|
|
2979
|
+
if (!store || !key) return out;
|
|
2980
|
+
for (const id of key.split("|")) {
|
|
2981
|
+
out[id] = store.peekMeta(id) ?? { status: "pending" };
|
|
2982
|
+
}
|
|
2983
|
+
return out;
|
|
2984
|
+
}, [store, key, version2]);
|
|
2985
|
+
}
|
|
2986
|
+
function useAssetPrices(refs) {
|
|
2987
|
+
const store = useAssetStore();
|
|
2988
|
+
const version2 = useStoreVersion(store);
|
|
2989
|
+
const key = refsKey(refs);
|
|
2635
2990
|
useEffect3(() => {
|
|
2636
|
-
|
|
2637
|
-
}, [
|
|
2638
|
-
return
|
|
2991
|
+
if (store && key) store.requestPrices(definedRefs(refs));
|
|
2992
|
+
}, [store, key]);
|
|
2993
|
+
return useMemo3(() => {
|
|
2994
|
+
const out = {};
|
|
2995
|
+
if (!store || !key) return out;
|
|
2996
|
+
for (const id of key.split("|")) {
|
|
2997
|
+
const usd = store.peekPrice(id);
|
|
2998
|
+
if (typeof usd === "number") out[id] = usd;
|
|
2999
|
+
}
|
|
3000
|
+
return out;
|
|
3001
|
+
}, [store, key, version2]);
|
|
2639
3002
|
}
|
|
2640
3003
|
|
|
2641
3004
|
// src/core/analytics.tsx
|
|
2642
3005
|
import {
|
|
2643
|
-
createContext as
|
|
3006
|
+
createContext as createContext4,
|
|
2644
3007
|
useCallback as useCallback3,
|
|
2645
|
-
useContext as
|
|
3008
|
+
useContext as useContext4,
|
|
2646
3009
|
useEffect as useEffect4,
|
|
2647
|
-
useMemo as
|
|
2648
|
-
useRef as
|
|
3010
|
+
useMemo as useMemo4,
|
|
3011
|
+
useRef as useRef2
|
|
2649
3012
|
} from "react";
|
|
2650
3013
|
|
|
2651
3014
|
// src/core/analytics-ingest.ts
|
|
@@ -2994,7 +3357,7 @@ function resolveProxyOrigin(backendUrl) {
|
|
|
2994
3357
|
|
|
2995
3358
|
// src/core/analytics.tsx
|
|
2996
3359
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2997
|
-
var AnalyticsContext =
|
|
3360
|
+
var AnalyticsContext = createContext4(null);
|
|
2998
3361
|
var noopDepositEmitter = () => {
|
|
2999
3362
|
};
|
|
3000
3363
|
var noopWithdrawEmitter = () => {
|
|
@@ -3014,21 +3377,21 @@ function cloneAndFreeze(value) {
|
|
|
3014
3377
|
return value;
|
|
3015
3378
|
}
|
|
3016
3379
|
function AnalyticsSession(props) {
|
|
3017
|
-
const sessionIdRef =
|
|
3380
|
+
const sessionIdRef = useRef2(void 0);
|
|
3018
3381
|
if (sessionIdRef.current === void 0) {
|
|
3019
3382
|
sessionIdRef.current = (props.createSessionId ?? randomUuid)();
|
|
3020
3383
|
}
|
|
3021
|
-
const sessionPropertiesRef =
|
|
3384
|
+
const sessionPropertiesRef = useRef2(void 0);
|
|
3022
3385
|
if (sessionPropertiesRef.current === void 0) {
|
|
3023
3386
|
sessionPropertiesRef.current = cloneAndFreeze(props.sessionProperties);
|
|
3024
3387
|
}
|
|
3025
3388
|
if (props.sessionIdRef) props.sessionIdRef.current = sessionIdRef.current;
|
|
3026
|
-
const onEventRef =
|
|
3389
|
+
const onEventRef = useRef2(props.onEvent);
|
|
3027
3390
|
onEventRef.current = props.onEvent;
|
|
3028
|
-
const nowRef =
|
|
3391
|
+
const nowRef = useRef2(props.now ?? (() => /* @__PURE__ */ new Date()));
|
|
3029
3392
|
nowRef.current = props.now ?? (() => /* @__PURE__ */ new Date());
|
|
3030
3393
|
const modal = props.modal;
|
|
3031
|
-
const reportedFailuresRef =
|
|
3394
|
+
const reportedFailuresRef = useRef2(/* @__PURE__ */ new Set());
|
|
3032
3395
|
const emitFailure = useCallback3(
|
|
3033
3396
|
({ reason, status, droppedEvents }) => {
|
|
3034
3397
|
if (reportedFailuresRef.current.has(reason)) return;
|
|
@@ -3074,11 +3437,11 @@ function AnalyticsSession(props) {
|
|
|
3074
3437
|
initialFailure: null
|
|
3075
3438
|
};
|
|
3076
3439
|
}
|
|
3077
|
-
const ingestRef =
|
|
3440
|
+
const ingestRef = useRef2(void 0);
|
|
3078
3441
|
if (ingestRef.current === void 0) {
|
|
3079
3442
|
ingestRef.current = createIngest();
|
|
3080
3443
|
}
|
|
3081
|
-
const pendingDisposalRef =
|
|
3444
|
+
const pendingDisposalRef = useRef2(null);
|
|
3082
3445
|
const enqueue = useCallback3(
|
|
3083
3446
|
(event) => {
|
|
3084
3447
|
try {
|
|
@@ -3165,24 +3528,24 @@ function AnalyticsSession(props) {
|
|
|
3165
3528
|
},
|
|
3166
3529
|
[enqueue, modal, nowRef, onEventRef]
|
|
3167
3530
|
);
|
|
3168
|
-
const context =
|
|
3531
|
+
const context = useMemo4(
|
|
3169
3532
|
() => modal === "deposit" ? { modal, emit: emitDeposit } : modal === "withdraw" ? { modal, emit: emitWithdraw } : { modal, emit: emitClaim },
|
|
3170
3533
|
[modal, emitDeposit, emitWithdraw, emitClaim]
|
|
3171
3534
|
);
|
|
3172
3535
|
return /* @__PURE__ */ jsx4(AnalyticsContext.Provider, { value: context, children: props.children });
|
|
3173
3536
|
}
|
|
3174
3537
|
function useDepositAnalyticsEmitter() {
|
|
3175
|
-
const context =
|
|
3538
|
+
const context = useContext4(AnalyticsContext);
|
|
3176
3539
|
if (!context || context.modal !== "deposit") return noopDepositEmitter;
|
|
3177
3540
|
return context.emit;
|
|
3178
3541
|
}
|
|
3179
3542
|
function useWithdrawAnalyticsEmitter() {
|
|
3180
|
-
const context =
|
|
3543
|
+
const context = useContext4(AnalyticsContext);
|
|
3181
3544
|
if (!context || context.modal !== "withdraw") return noopWithdrawEmitter;
|
|
3182
3545
|
return context.emit;
|
|
3183
3546
|
}
|
|
3184
3547
|
function useClaimAnalyticsEmitter() {
|
|
3185
|
-
const context =
|
|
3548
|
+
const context = useContext4(AnalyticsContext);
|
|
3186
3549
|
if (!context || context.modal !== "claim") return noopClaimEmitter;
|
|
3187
3550
|
return context.emit;
|
|
3188
3551
|
}
|
|
@@ -3210,7 +3573,6 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3210
3573
|
return {
|
|
3211
3574
|
depositId: row.id,
|
|
3212
3575
|
signer,
|
|
3213
|
-
destinationPrefill: signer,
|
|
3214
3576
|
depositAddress: row.depositAddress,
|
|
3215
3577
|
sourceChainId,
|
|
3216
3578
|
targetChainId,
|
|
@@ -3322,26 +3684,27 @@ function historyBadgeAriaLabel(badge) {
|
|
|
3322
3684
|
}
|
|
3323
3685
|
|
|
3324
3686
|
// src/components/history/HistoryEntryButton.tsx
|
|
3325
|
-
import { jsx as jsx5, jsxs
|
|
3687
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
3326
3688
|
function HistoryEntryButton({
|
|
3327
3689
|
badge,
|
|
3328
3690
|
onClick,
|
|
3329
|
-
disabled
|
|
3691
|
+
disabled,
|
|
3692
|
+
unread = false
|
|
3330
3693
|
}) {
|
|
3331
|
-
return /* @__PURE__ */
|
|
3694
|
+
return /* @__PURE__ */ jsxs(
|
|
3332
3695
|
"button",
|
|
3333
3696
|
{
|
|
3334
3697
|
type: "button",
|
|
3335
3698
|
className: "rs-modal-header-history",
|
|
3336
|
-
"aria-label": historyBadgeAriaLabel(badge),
|
|
3699
|
+
"aria-label": unread ? "Deposit history \u2014 new bank transfer activity" : historyBadgeAriaLabel(badge),
|
|
3337
3700
|
onClick,
|
|
3338
3701
|
disabled,
|
|
3339
3702
|
children: [
|
|
3340
3703
|
/* @__PURE__ */ jsx5(HistoryIcon, {}),
|
|
3341
|
-
badge && /* @__PURE__ */ jsx5(
|
|
3704
|
+
(badge || unread) && /* @__PURE__ */ jsx5(
|
|
3342
3705
|
"span",
|
|
3343
3706
|
{
|
|
3344
|
-
className: `rs-history-dot rs-history-dot--${badge
|
|
3707
|
+
className: `rs-history-dot rs-history-dot--${badge?.state ?? "progress"}`,
|
|
3345
3708
|
"aria-hidden": "true"
|
|
3346
3709
|
}
|
|
3347
3710
|
)
|
|
@@ -3351,16 +3714,16 @@ function HistoryEntryButton({
|
|
|
3351
3714
|
}
|
|
3352
3715
|
|
|
3353
3716
|
// src/components/history/HistoryOverlay.tsx
|
|
3354
|
-
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as
|
|
3717
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as useMemo8, useRef as useRef6, useState as useState9 } from "react";
|
|
3355
3718
|
|
|
3356
3719
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3357
3720
|
import {
|
|
3358
3721
|
useCallback as useCallback4,
|
|
3359
3722
|
useEffect as useEffect5,
|
|
3360
|
-
useId,
|
|
3361
|
-
useMemo as
|
|
3362
|
-
useRef as
|
|
3363
|
-
useState as
|
|
3723
|
+
useId as useId2,
|
|
3724
|
+
useMemo as useMemo6,
|
|
3725
|
+
useRef as useRef3,
|
|
3726
|
+
useState as useState4
|
|
3364
3727
|
} from "react";
|
|
3365
3728
|
|
|
3366
3729
|
// src/components/ui/CdnIcon.tsx
|
|
@@ -3411,65 +3774,8 @@ function CdnIcon({
|
|
|
3411
3774
|
}
|
|
3412
3775
|
CdnIcon.displayName = "CdnIcon";
|
|
3413
3776
|
|
|
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
3777
|
// src/components/ui/Button.tsx
|
|
3472
|
-
import { Fragment as Fragment2, jsx as
|
|
3778
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3473
3779
|
function Button({
|
|
3474
3780
|
children,
|
|
3475
3781
|
variant = "accent",
|
|
@@ -3489,19 +3795,19 @@ function Button({
|
|
|
3489
3795
|
className
|
|
3490
3796
|
].filter(Boolean).join(" ");
|
|
3491
3797
|
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
3492
|
-
return /* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ jsx7(
|
|
3493
3799
|
"button",
|
|
3494
3800
|
{
|
|
3495
3801
|
className: classes,
|
|
3496
3802
|
disabled: disabled || loading,
|
|
3497
3803
|
"aria-busy": loading || void 0,
|
|
3498
3804
|
...props,
|
|
3499
|
-
children: showInlineLoadingText ? /* @__PURE__ */
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3502
|
-
] }) : /* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
loading && /* @__PURE__ */
|
|
3805
|
+
children: showInlineLoadingText ? /* @__PURE__ */ jsxs2("span", { className: "rs-button__loading-row", children: [
|
|
3806
|
+
/* @__PURE__ */ jsx7(Spinner, { className: "rs-spinner--sm" }),
|
|
3807
|
+
/* @__PURE__ */ jsx7("span", { children: loadingText })
|
|
3808
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
3809
|
+
/* @__PURE__ */ jsx7("span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
3810
|
+
loading && /* @__PURE__ */ jsx7("span", { className: "rs-button__spinner", children: /* @__PURE__ */ jsx7(Spinner, { className: "rs-spinner--sm" }) })
|
|
3505
3811
|
] })
|
|
3506
3812
|
}
|
|
3507
3813
|
);
|
|
@@ -3509,9 +3815,9 @@ function Button({
|
|
|
3509
3815
|
Button.displayName = "Button";
|
|
3510
3816
|
|
|
3511
3817
|
// src/components/ui/Callout.tsx
|
|
3512
|
-
import { jsx as
|
|
3818
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3513
3819
|
function CircleAlertIcon() {
|
|
3514
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsx8(
|
|
3515
3821
|
"svg",
|
|
3516
3822
|
{
|
|
3517
3823
|
width: "16",
|
|
@@ -3520,7 +3826,7 @@ function CircleAlertIcon() {
|
|
|
3520
3826
|
fill: "none",
|
|
3521
3827
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3522
3828
|
"aria-hidden": "true",
|
|
3523
|
-
children: /* @__PURE__ */
|
|
3829
|
+
children: /* @__PURE__ */ jsx8(
|
|
3524
3830
|
"path",
|
|
3525
3831
|
{
|
|
3526
3832
|
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 +3840,14 @@ function CircleAlertIcon() {
|
|
|
3534
3840
|
);
|
|
3535
3841
|
}
|
|
3536
3842
|
function Callout({ variant = "error", children, role }) {
|
|
3537
|
-
return /* @__PURE__ */
|
|
3843
|
+
return /* @__PURE__ */ jsxs3(
|
|
3538
3844
|
"div",
|
|
3539
3845
|
{
|
|
3540
3846
|
className: `rs-callout rs-callout--${variant}`,
|
|
3541
3847
|
role: role ?? (variant === "error" ? "alert" : "status"),
|
|
3542
3848
|
children: [
|
|
3543
|
-
/* @__PURE__ */
|
|
3544
|
-
/* @__PURE__ */
|
|
3849
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ jsx8(CircleAlertIcon, {}) : /* @__PURE__ */ jsx8(AlertTriangleIcon, {}) }),
|
|
3850
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-callout-text", children })
|
|
3545
3851
|
]
|
|
3546
3852
|
}
|
|
3547
3853
|
);
|
|
@@ -3549,8 +3855,8 @@ function Callout({ variant = "error", children, role }) {
|
|
|
3549
3855
|
Callout.displayName = "Callout";
|
|
3550
3856
|
|
|
3551
3857
|
// src/components/ui/PoweredBy.tsx
|
|
3552
|
-
import { jsx as
|
|
3553
|
-
var rhinestoneLogo = /* @__PURE__ */
|
|
3858
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3859
|
+
var rhinestoneLogo = /* @__PURE__ */ jsxs4(
|
|
3554
3860
|
"svg",
|
|
3555
3861
|
{
|
|
3556
3862
|
className: "rs-powered-by-logo",
|
|
@@ -3559,8 +3865,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3559
3865
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3560
3866
|
"aria-hidden": "true",
|
|
3561
3867
|
children: [
|
|
3562
|
-
/* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3868
|
+
/* @__PURE__ */ jsxs4("g", { fill: "currentColor", clipPath: "url(#rs-pb-clip)", children: [
|
|
3869
|
+
/* @__PURE__ */ jsx9(
|
|
3564
3870
|
"path",
|
|
3565
3871
|
{
|
|
3566
3872
|
opacity: "0.5",
|
|
@@ -3569,8 +3875,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3569
3875
|
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
3876
|
}
|
|
3571
3877
|
),
|
|
3572
|
-
/* @__PURE__ */
|
|
3573
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__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" }),
|
|
3879
|
+
/* @__PURE__ */ jsx9(
|
|
3574
3880
|
"path",
|
|
3575
3881
|
{
|
|
3576
3882
|
fillRule: "evenodd",
|
|
@@ -3578,8 +3884,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3578
3884
|
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
3885
|
}
|
|
3580
3886
|
),
|
|
3581
|
-
/* @__PURE__ */
|
|
3582
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__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" }),
|
|
3888
|
+
/* @__PURE__ */ jsx9(
|
|
3583
3889
|
"path",
|
|
3584
3890
|
{
|
|
3585
3891
|
fillRule: "evenodd",
|
|
@@ -3587,8 +3893,8 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3587
3893
|
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
3894
|
}
|
|
3589
3895
|
),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__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" }),
|
|
3897
|
+
/* @__PURE__ */ jsx9(
|
|
3592
3898
|
"path",
|
|
3593
3899
|
{
|
|
3594
3900
|
fillRule: "evenodd",
|
|
@@ -3596,38 +3902,280 @@ var rhinestoneLogo = /* @__PURE__ */ jsxs7(
|
|
|
3596
3902
|
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
3903
|
}
|
|
3598
3904
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3905
|
+
/* @__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
3906
|
] }),
|
|
3601
|
-
/* @__PURE__ */
|
|
3907
|
+
/* @__PURE__ */ jsx9("defs", { children: /* @__PURE__ */ jsx9("clipPath", { id: "rs-pb-clip", children: /* @__PURE__ */ jsx9("path", { fill: "#fff", d: "M0 0h72v16H0z" }) }) })
|
|
3602
3908
|
]
|
|
3603
3909
|
}
|
|
3604
3910
|
);
|
|
3605
3911
|
function PoweredBy() {
|
|
3606
|
-
return /* @__PURE__ */
|
|
3607
|
-
/* @__PURE__ */
|
|
3608
|
-
/* @__PURE__ */
|
|
3912
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rs-powered-by", "aria-label": "Powered by Rhinestone", children: [
|
|
3913
|
+
/* @__PURE__ */ jsx9("span", { children: "Powered by" }),
|
|
3914
|
+
/* @__PURE__ */ jsx9(
|
|
3915
|
+
"a",
|
|
3916
|
+
{
|
|
3917
|
+
className: "rs-powered-by-link",
|
|
3918
|
+
href: "https://www.rhinestone.dev",
|
|
3919
|
+
target: "_blank",
|
|
3920
|
+
rel: "noopener noreferrer",
|
|
3921
|
+
children: rhinestoneLogo
|
|
3922
|
+
}
|
|
3923
|
+
)
|
|
3924
|
+
] });
|
|
3925
|
+
}
|
|
3926
|
+
PoweredBy.displayName = "PoweredBy";
|
|
3927
|
+
|
|
3928
|
+
// src/components/history/BankOrderCard.tsx
|
|
3929
|
+
import { useId, useState as useState3 } from "react";
|
|
3930
|
+
|
|
3931
|
+
// src/components/history/HistoryTransactionLink.tsx
|
|
3932
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3933
|
+
function resolveHistoryChainId(value) {
|
|
3934
|
+
if (value === void 0 || value === null) return null;
|
|
3935
|
+
if (typeof value === "number") return value;
|
|
3936
|
+
const display = displayChainIdForCaip2(value);
|
|
3937
|
+
if (display !== null) return display;
|
|
3938
|
+
if (value === "solana" || value === "hypercore") return value;
|
|
3939
|
+
const number = Number(value);
|
|
3940
|
+
return Number.isFinite(number) ? number : null;
|
|
3941
|
+
}
|
|
3942
|
+
function HistoryTransactionLink({
|
|
3943
|
+
chainId,
|
|
3944
|
+
txHash,
|
|
3945
|
+
label = "Transaction details"
|
|
3946
|
+
}) {
|
|
3947
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
3948
|
+
const chain = resolveHistoryChainId(chainId);
|
|
3949
|
+
const url = chain !== null && txHash ? explorerTxUrl(chain, txHash) : void 0;
|
|
3950
|
+
if (!url || !txHash) return null;
|
|
3951
|
+
const text = txHash.length > 14 ? `${txHash.slice(0, 6)}\u2026${txHash.slice(-4)}` : txHash;
|
|
3952
|
+
return /* @__PURE__ */ jsxs5("div", { className: "rs-amount-detail-row", children: [
|
|
3953
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
3954
|
+
/* @__PURE__ */ jsxs5(
|
|
3609
3955
|
"a",
|
|
3610
3956
|
{
|
|
3611
|
-
|
|
3612
|
-
href: "https://www.rhinestone.dev",
|
|
3957
|
+
href: url,
|
|
3613
3958
|
target: "_blank",
|
|
3614
3959
|
rel: "noopener noreferrer",
|
|
3615
|
-
|
|
3960
|
+
className: "rs-history-card-link",
|
|
3961
|
+
"aria-label": `${label}: ${txHash}`,
|
|
3962
|
+
children: [
|
|
3963
|
+
/* @__PURE__ */ jsx10("span", { children: text }),
|
|
3964
|
+
/* @__PURE__ */ jsx10(ArrowUpRightIcon, {})
|
|
3965
|
+
]
|
|
3616
3966
|
}
|
|
3617
3967
|
)
|
|
3618
3968
|
] });
|
|
3619
3969
|
}
|
|
3620
|
-
|
|
3970
|
+
|
|
3971
|
+
// src/core/bank-onramp-progress.ts
|
|
3972
|
+
function toPaymentProgress(order) {
|
|
3973
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
3974
|
+
const stages = [receipt.status, conversion.status, delivery.status];
|
|
3975
|
+
if (stages.includes("on_hold")) return "on_hold";
|
|
3976
|
+
if (order.stages.return.status !== "none") return "returned";
|
|
3977
|
+
if (stages.includes("failed")) return "failed";
|
|
3978
|
+
if (delivery.status === "completed") return "delivered";
|
|
3979
|
+
if (delivery.status !== "not_started") return "sending";
|
|
3980
|
+
if (conversion.status === "completed") return "sending";
|
|
3981
|
+
if (conversion.status !== "not_started") return "converting";
|
|
3982
|
+
if (receipt.status === "completed") return "received";
|
|
3983
|
+
return "awaiting_transfer";
|
|
3984
|
+
}
|
|
3985
|
+
var TERMINAL = /* @__PURE__ */ new Set([
|
|
3986
|
+
"delivered",
|
|
3987
|
+
"returned",
|
|
3988
|
+
"failed"
|
|
3989
|
+
]);
|
|
3990
|
+
function toPaymentView(order) {
|
|
3991
|
+
const progress = toPaymentProgress(order);
|
|
3992
|
+
return {
|
|
3993
|
+
id: order.id,
|
|
3994
|
+
amount: order.fiat.charged?.total ?? "",
|
|
3995
|
+
currency: order.fiat.charged?.currency ?? "",
|
|
3996
|
+
progress,
|
|
3997
|
+
terminal: TERMINAL.has(progress)
|
|
3998
|
+
};
|
|
3999
|
+
}
|
|
4000
|
+
var BANK_ONRAMP_COPY = {
|
|
4001
|
+
awaiting_transfer: {
|
|
4002
|
+
title: "Waiting for your transfer",
|
|
4003
|
+
subtitle: "Send the transfer from your bank using the details above."
|
|
4004
|
+
},
|
|
4005
|
+
received: {
|
|
4006
|
+
title: "Transfer received",
|
|
4007
|
+
subtitle: "Your bank transfer has arrived and is being processed."
|
|
4008
|
+
},
|
|
4009
|
+
converting: {
|
|
4010
|
+
title: "Converting",
|
|
4011
|
+
subtitle: "Your money is being converted to crypto."
|
|
4012
|
+
},
|
|
4013
|
+
sending: {
|
|
4014
|
+
title: "Sending to your account",
|
|
4015
|
+
subtitle: "The crypto is on its way. This usually takes a few minutes."
|
|
4016
|
+
},
|
|
4017
|
+
delivered: {
|
|
4018
|
+
title: "Funds delivered",
|
|
4019
|
+
subtitle: "The crypto has arrived in your account."
|
|
4020
|
+
},
|
|
4021
|
+
on_hold: {
|
|
4022
|
+
title: "Under review",
|
|
4023
|
+
subtitle: "Your provider is reviewing this transfer and may contact you for more information."
|
|
4024
|
+
},
|
|
4025
|
+
returned: {
|
|
4026
|
+
title: "Transfer returned",
|
|
4027
|
+
subtitle: "This transfer was returned. Contact support if unexpected."
|
|
4028
|
+
},
|
|
4029
|
+
failed: {
|
|
4030
|
+
title: "Transfer failed",
|
|
4031
|
+
subtitle: "This transfer could not be completed. Contact support."
|
|
4032
|
+
}
|
|
4033
|
+
};
|
|
4034
|
+
|
|
4035
|
+
// src/components/history/BankOrderCard.tsx
|
|
4036
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4037
|
+
function bankSupportHref(value) {
|
|
4038
|
+
if (!value) return void 0;
|
|
4039
|
+
try {
|
|
4040
|
+
const url = new URL(value);
|
|
4041
|
+
return ["https:", "mailto:"].includes(url.protocol) ? url.href : void 0;
|
|
4042
|
+
} catch {
|
|
4043
|
+
return void 0;
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
function BankOrderCard({
|
|
4047
|
+
order,
|
|
4048
|
+
supportUrl,
|
|
4049
|
+
children,
|
|
4050
|
+
deposit
|
|
4051
|
+
}) {
|
|
4052
|
+
const [expanded, setExpanded] = useState3(false);
|
|
4053
|
+
const panelId = useId();
|
|
4054
|
+
const view = toPaymentView(order);
|
|
4055
|
+
const subFee = [order.stages.conversion, order.stages.delivery].some(
|
|
4056
|
+
(stage) => stage.status === "failed" && stage.reason === "sub_fee"
|
|
4057
|
+
);
|
|
4058
|
+
const support = bankSupportHref(supportUrl);
|
|
4059
|
+
const { delivery } = order.stages;
|
|
4060
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : void 0;
|
|
4061
|
+
const needsHelp = ["failed", "returned", "on_hold"].includes(view.progress);
|
|
4062
|
+
const settlement = deposit ? normalizeStatus(deposit.status, deposit.isSpam) : null;
|
|
4063
|
+
let status = "pending";
|
|
4064
|
+
let label = "Detected";
|
|
4065
|
+
if (view.progress === "failed" || settlement === "failed" || settlement === "spam") {
|
|
4066
|
+
status = "failed";
|
|
4067
|
+
label = "Failed";
|
|
4068
|
+
} else if (view.progress === "returned" || settlement === "refunded") {
|
|
4069
|
+
status = "refunded";
|
|
4070
|
+
label = "Returned";
|
|
4071
|
+
} else if (settlement === "completed") {
|
|
4072
|
+
status = "completed";
|
|
4073
|
+
label = "Completed";
|
|
4074
|
+
} else if (view.progress === "on_hold") {
|
|
4075
|
+
status = "processing";
|
|
4076
|
+
label = "Under review";
|
|
4077
|
+
} else if (view.progress === "delivered") {
|
|
4078
|
+
status = "processing";
|
|
4079
|
+
label = "Settled";
|
|
4080
|
+
} else if (view.progress !== "awaiting_transfer" && view.progress !== "received") {
|
|
4081
|
+
status = "processing";
|
|
4082
|
+
label = "Settling";
|
|
4083
|
+
}
|
|
4084
|
+
const amount = view.amount && Number.isFinite(Number(view.amount)) ? `${Number(view.amount).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${view.currency}` : "\u2014";
|
|
4085
|
+
const date = new Date(order.createdAt).toLocaleDateString(void 0, {
|
|
4086
|
+
day: "numeric",
|
|
4087
|
+
month: "short",
|
|
4088
|
+
year: "numeric"
|
|
4089
|
+
});
|
|
4090
|
+
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;
|
|
4091
|
+
return /* @__PURE__ */ jsxs6(
|
|
4092
|
+
"div",
|
|
4093
|
+
{
|
|
4094
|
+
className: `rs-history-card${expanded ? " rs-history-card--expanded" : ""}`,
|
|
4095
|
+
children: [
|
|
4096
|
+
/* @__PURE__ */ jsx11(
|
|
4097
|
+
"button",
|
|
4098
|
+
{
|
|
4099
|
+
type: "button",
|
|
4100
|
+
className: "rs-history-card-trigger",
|
|
4101
|
+
onClick: () => setExpanded(!expanded),
|
|
4102
|
+
"aria-expanded": expanded,
|
|
4103
|
+
"aria-controls": panelId,
|
|
4104
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "rs-history-card-row", children: [
|
|
4105
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-history-card-icons", children: /* @__PURE__ */ jsx11("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx11(BankIcon, {}) }) }),
|
|
4106
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-history-card-text", children: [
|
|
4107
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-history-card-title", children: "Bank transfer" }),
|
|
4108
|
+
/* @__PURE__ */ jsx11("time", { className: "rs-history-card-date", dateTime: order.createdAt, children: date })
|
|
4109
|
+
] }),
|
|
4110
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-history-card-side", children: [
|
|
4111
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-history-card-amount", children: amount }),
|
|
4112
|
+
/* @__PURE__ */ jsx11("span", { className: `rs-history-badge rs-history-badge--${status}`, children: label })
|
|
4113
|
+
] })
|
|
4114
|
+
] })
|
|
4115
|
+
}
|
|
4116
|
+
),
|
|
4117
|
+
/* @__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: [
|
|
4118
|
+
subFee || status === "failed" ? /* @__PURE__ */ jsx11(Callout, { variant: "error", children: description }) : /* @__PURE__ */ jsx11("p", { className: "rs-history-empty-hint", children: description }),
|
|
4119
|
+
order.crypto && /* @__PURE__ */ jsxs6("div", { className: "rs-amount-detail-row", children: [
|
|
4120
|
+
/* @__PURE__ */ jsx11("span", { children: "Converted amount" }),
|
|
4121
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-amount-detail-value", children: [
|
|
4122
|
+
order.crypto.amount,
|
|
4123
|
+
" ",
|
|
4124
|
+
order.crypto.asset
|
|
4125
|
+
] })
|
|
4126
|
+
] }),
|
|
4127
|
+
/* @__PURE__ */ jsx11(
|
|
4128
|
+
HistoryTransactionLink,
|
|
4129
|
+
{
|
|
4130
|
+
chainId: deposit?.chain ?? order.deliveryChain,
|
|
4131
|
+
txHash: deposit?.txHash ?? deliveryTxHash,
|
|
4132
|
+
label: "Crypto deposit"
|
|
4133
|
+
}
|
|
4134
|
+
),
|
|
4135
|
+
deposit?.destinationTxHash !== deposit?.txHash && /* @__PURE__ */ jsx11(HistoryTransactionLink, { chainId: deposit?.targetChain, txHash: deposit?.destinationTxHash, label: "Final settlement" }),
|
|
4136
|
+
(needsHelp || status === "failed") && support && /* @__PURE__ */ jsxs6(
|
|
4137
|
+
"a",
|
|
4138
|
+
{
|
|
4139
|
+
className: "rs-history-card-link",
|
|
4140
|
+
href: support,
|
|
4141
|
+
target: "_blank",
|
|
4142
|
+
rel: "noopener noreferrer",
|
|
4143
|
+
children: [
|
|
4144
|
+
"Contact support ",
|
|
4145
|
+
/* @__PURE__ */ jsx11(ArrowUpRightIcon, {})
|
|
4146
|
+
]
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
children
|
|
4150
|
+
] }) }) })
|
|
4151
|
+
]
|
|
4152
|
+
}
|
|
4153
|
+
);
|
|
4154
|
+
}
|
|
3621
4155
|
|
|
3622
4156
|
// src/components/ui/TokenIcon.tsx
|
|
3623
4157
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3624
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
4158
|
+
function TokenIcon({ token, symbol, className, fallback }) {
|
|
4159
|
+
const id = assetIdForRef(token);
|
|
4160
|
+
const entry = useAssetMetadata([token])[id ?? ""];
|
|
4161
|
+
const classes = `rs-token-icon ${className ?? ""}`.trimEnd();
|
|
4162
|
+
const badge = fallback ?? /* @__PURE__ */ jsx12("span", { className: "rs-token-initials", "aria-hidden": "true", children: (symbol ?? "").trim().slice(0, 1).toUpperCase() });
|
|
4163
|
+
if (entry?.status === "pending") {
|
|
4164
|
+
return /* @__PURE__ */ jsx12(
|
|
4165
|
+
"span",
|
|
4166
|
+
{
|
|
4167
|
+
className: `${classes} rs-token-icon--pending`,
|
|
4168
|
+
"data-loading": "",
|
|
4169
|
+
"aria-hidden": "true"
|
|
4170
|
+
}
|
|
4171
|
+
);
|
|
4172
|
+
}
|
|
3625
4173
|
return /* @__PURE__ */ jsx12(
|
|
3626
4174
|
CdnIcon,
|
|
3627
4175
|
{
|
|
3628
|
-
src:
|
|
3629
|
-
className:
|
|
3630
|
-
fallback
|
|
4176
|
+
src: entry?.status === "ready" ? entry.logo : void 0,
|
|
4177
|
+
className: classes,
|
|
4178
|
+
fallback: badge
|
|
3631
4179
|
}
|
|
3632
4180
|
);
|
|
3633
4181
|
}
|
|
@@ -3707,8 +4255,84 @@ function resolveHistoryTiming({
|
|
|
3707
4255
|
};
|
|
3708
4256
|
}
|
|
3709
4257
|
|
|
4258
|
+
// src/core/token-display.ts
|
|
4259
|
+
import { useMemo as useMemo5, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
4260
|
+
function isHyperCore(chain) {
|
|
4261
|
+
return chain === "hypercore" || chain === HYPERCORE_CHAIN_ID;
|
|
4262
|
+
}
|
|
4263
|
+
function resolveCuratedToken(token, chain) {
|
|
4264
|
+
if (isHyperCore(chain)) {
|
|
4265
|
+
const listed = HYPERCORE_SOURCE_TOKENS.find(
|
|
4266
|
+
(t) => t.address.toLowerCase() === token.toLowerCase()
|
|
4267
|
+
);
|
|
4268
|
+
return listed ? { symbol: listed.symbol, decimals: listed.decimals } : void 0;
|
|
4269
|
+
}
|
|
4270
|
+
const published = getRuntimeTokenByAddress(chain, token);
|
|
4271
|
+
if (published) {
|
|
4272
|
+
return { symbol: published.symbol, decimals: published.decimals };
|
|
4273
|
+
}
|
|
4274
|
+
if (chain === "solana") return resolveSolanaToken(token);
|
|
4275
|
+
if (isNativeSpelling(chain, token)) {
|
|
4276
|
+
const symbol = getRuntimeNativeSymbol(chain);
|
|
4277
|
+
const decimals = getRuntimeNativeDecimals(chain) ?? (typeof chain === "number" ? 18 : void 0);
|
|
4278
|
+
return symbol ? { symbol, decimals } : void 0;
|
|
4279
|
+
}
|
|
4280
|
+
return void 0;
|
|
4281
|
+
}
|
|
4282
|
+
function resolveTokenDisplay(token, chain, asset, fallback) {
|
|
4283
|
+
const pending = asset?.status === "pending";
|
|
4284
|
+
const curated = token !== void 0 && chain !== void 0 ? resolveCuratedToken(token, chain) : void 0;
|
|
4285
|
+
const fromAsset = asset?.status === "ready" ? asset : void 0;
|
|
4286
|
+
const hyperCore = chain !== void 0 && isHyperCore(chain);
|
|
4287
|
+
const native = token !== void 0 && chain !== void 0 && isNativeSpelling(chain, token);
|
|
4288
|
+
const curatedSymbol = native ? curated?.symbol ?? fromAsset?.symbol : fromAsset?.symbol ?? curated?.symbol;
|
|
4289
|
+
const decimals = fallback?.decimals ?? curated?.decimals ?? (hyperCore ? void 0 : fromAsset?.decimals);
|
|
4290
|
+
return {
|
|
4291
|
+
symbol: curatedSymbol ?? fallback?.symbol ?? "Token",
|
|
4292
|
+
decimals,
|
|
4293
|
+
logo: fromAsset?.logo,
|
|
4294
|
+
curated: curatedSymbol !== void 0,
|
|
4295
|
+
pending
|
|
4296
|
+
};
|
|
4297
|
+
}
|
|
4298
|
+
function toAssetRef(ref) {
|
|
4299
|
+
return ref?.chain !== void 0 && ref.address ? { chain: ref.chain, address: ref.address } : void 0;
|
|
4300
|
+
}
|
|
4301
|
+
function useTokenDisplays(refs) {
|
|
4302
|
+
const { catalog } = useChainCatalog();
|
|
4303
|
+
const tokensVersion = useSyncExternalStore3(
|
|
4304
|
+
subscribeToRuntimeTokens,
|
|
4305
|
+
getRuntimeTokensVersion,
|
|
4306
|
+
getRuntimeTokensVersion
|
|
4307
|
+
);
|
|
4308
|
+
const assets = useAssetMetadata(refs.map(toAssetRef));
|
|
4309
|
+
const key = refs.map(
|
|
4310
|
+
(ref) => `${String(ref?.chain)}:${ref?.address ?? ""}:${ref?.fallback?.symbol ?? ""}:${ref?.fallback?.decimals ?? ""}`
|
|
4311
|
+
).join("|");
|
|
4312
|
+
return useMemo5(
|
|
4313
|
+
() => refs.map((ref) => {
|
|
4314
|
+
const id = assetIdFor(ref?.chain, ref?.address);
|
|
4315
|
+
return resolveTokenDisplay(
|
|
4316
|
+
ref?.address,
|
|
4317
|
+
ref?.chain,
|
|
4318
|
+
id ? assets[id] : void 0,
|
|
4319
|
+
ref?.fallback
|
|
4320
|
+
);
|
|
4321
|
+
}),
|
|
4322
|
+
// `refs` enters through `key`.
|
|
4323
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4324
|
+
[key, assets, catalog, tokensVersion]
|
|
4325
|
+
);
|
|
4326
|
+
}
|
|
4327
|
+
function useTokenDisplay(chain, address, fallback) {
|
|
4328
|
+
return useTokenDisplays([{ chain, address, fallback }])[0];
|
|
4329
|
+
}
|
|
4330
|
+
function useIsRecognizedToken(chain, address) {
|
|
4331
|
+
return useTokenDisplay(chain, address).curated;
|
|
4332
|
+
}
|
|
4333
|
+
|
|
3710
4334
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3711
|
-
import { jsx as jsx13, jsxs as
|
|
4335
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3712
4336
|
var MAX_TIMER_DELAY_MS = 2147e6;
|
|
3713
4337
|
function shortenHash(hash) {
|
|
3714
4338
|
if (hash.length <= 14) return hash;
|
|
@@ -3727,60 +4351,8 @@ function formatDate(iso) {
|
|
|
3727
4351
|
return iso;
|
|
3728
4352
|
}
|
|
3729
4353
|
}
|
|
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
|
-
}
|
|
4354
|
+
function formatAmount(rawAmount, decimals) {
|
|
4355
|
+
if (!rawAmount || decimals === void 0) return null;
|
|
3784
4356
|
try {
|
|
3785
4357
|
const raw = BigInt(rawAmount);
|
|
3786
4358
|
const divisor = 10n ** BigInt(decimals);
|
|
@@ -3795,6 +4367,8 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3795
4367
|
}
|
|
3796
4368
|
}
|
|
3797
4369
|
function DepositHistoryPanel({
|
|
4370
|
+
bankHistory,
|
|
4371
|
+
bankSupportUrl,
|
|
3798
4372
|
deposits,
|
|
3799
4373
|
isLoading,
|
|
3800
4374
|
error,
|
|
@@ -3811,7 +4385,7 @@ function DepositHistoryPanel({
|
|
|
3811
4385
|
onRowView,
|
|
3812
4386
|
obscured
|
|
3813
4387
|
}) {
|
|
3814
|
-
const rootRef =
|
|
4388
|
+
const rootRef = useRef3(null);
|
|
3815
4389
|
useEffect5(() => {
|
|
3816
4390
|
rootRef.current?.toggleAttribute("inert", Boolean(obscured));
|
|
3817
4391
|
}, [obscured]);
|
|
@@ -3825,12 +4399,12 @@ function DepositHistoryPanel({
|
|
|
3825
4399
|
},
|
|
3826
4400
|
[onClose, obscured]
|
|
3827
4401
|
);
|
|
3828
|
-
const visibleDeposits =
|
|
4402
|
+
const visibleDeposits = useMemo6(
|
|
3829
4403
|
() => filterVisibleDeposits(deposits),
|
|
3830
4404
|
[deposits]
|
|
3831
4405
|
);
|
|
3832
|
-
const [nowMs, setNowMs] =
|
|
3833
|
-
const timingPresentations =
|
|
4406
|
+
const [nowMs, setNowMs] = useState4(() => Date.now());
|
|
4407
|
+
const timingPresentations = useMemo6(
|
|
3834
4408
|
() => visibleDeposits.map(
|
|
3835
4409
|
(deposit) => resolveHistoryTiming({
|
|
3836
4410
|
status: deposit.status,
|
|
@@ -3871,7 +4445,7 @@ function DepositHistoryPanel({
|
|
|
3871
4445
|
if (timeout !== void 0) clearTimeout(timeout);
|
|
3872
4446
|
};
|
|
3873
4447
|
}, [timingPresentations]);
|
|
3874
|
-
return /* @__PURE__ */
|
|
4448
|
+
return /* @__PURE__ */ jsxs7(
|
|
3875
4449
|
"div",
|
|
3876
4450
|
{
|
|
3877
4451
|
ref: rootRef,
|
|
@@ -3881,8 +4455,8 @@ function DepositHistoryPanel({
|
|
|
3881
4455
|
"aria-hidden": obscured || void 0,
|
|
3882
4456
|
onKeyDown: handleKeyDown,
|
|
3883
4457
|
children: [
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */
|
|
4458
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-modal-header--redesigned", children: [
|
|
4459
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsxs7(
|
|
3886
4460
|
"button",
|
|
3887
4461
|
{
|
|
3888
4462
|
type: "button",
|
|
@@ -3906,10 +4480,10 @@ function DepositHistoryPanel({
|
|
|
3906
4480
|
}
|
|
3907
4481
|
) })
|
|
3908
4482
|
] }),
|
|
3909
|
-
/* @__PURE__ */
|
|
3910
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-screen", children: [
|
|
4484
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-screen-body", children: [
|
|
3911
4485
|
/* @__PURE__ */ jsx13(BodyHeader, { icon: /* @__PURE__ */ jsx13(HistoryIcon, {}), title }),
|
|
3912
|
-
onFindByTxHash && /* @__PURE__ */
|
|
4486
|
+
onFindByTxHash && /* @__PURE__ */ jsxs7(
|
|
3913
4487
|
"button",
|
|
3914
4488
|
{
|
|
3915
4489
|
type: "button",
|
|
@@ -3921,40 +4495,82 @@ function DepositHistoryPanel({
|
|
|
3921
4495
|
]
|
|
3922
4496
|
}
|
|
3923
4497
|
),
|
|
3924
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
4498
|
+
(isLoading || bankHistory?.loading) && deposits.length === 0 && !bankHistory?.orders.length && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3925
4499
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(HistoryIcon, {}) }),
|
|
3926
|
-
/* @__PURE__ */
|
|
4500
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3927
4501
|
/* @__PURE__ */ jsx13(Spinner, { className: "rs-spinner--sm" }),
|
|
3928
4502
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
3929
4503
|
] })
|
|
3930
4504
|
] }),
|
|
3931
|
-
error && !isLoading && /* @__PURE__ */
|
|
4505
|
+
error && !isLoading && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3932
4506
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(AlertTriangleIcon, {}) }),
|
|
3933
|
-
/* @__PURE__ */
|
|
4507
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3934
4508
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
3935
4509
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: error })
|
|
3936
4510
|
] })
|
|
3937
4511
|
] }),
|
|
3938
|
-
|
|
4512
|
+
bankHistory?.error && /* @__PURE__ */ jsx13("p", { role: "status", children: bankHistory.error }),
|
|
4513
|
+
!isLoading && !error && !bankHistory?.loading && !bankHistory?.error && !bankHistory?.orders.length && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-history-empty", children: [
|
|
3939
4514
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(HistoryIcon, {}) }),
|
|
3940
|
-
/* @__PURE__ */
|
|
4515
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-empty-text", children: [
|
|
3941
4516
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
3942
4517
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
3943
4518
|
] })
|
|
3944
4519
|
] }),
|
|
3945
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
3946
|
-
|
|
3947
|
-
|
|
4520
|
+
(visibleDeposits.length > 0 || Boolean(bankHistory?.orders.length)) && /* @__PURE__ */ jsxs7("div", { className: "rs-history-list", children: [
|
|
4521
|
+
[
|
|
4522
|
+
...visibleDeposits.filter(
|
|
4523
|
+
(deposit) => !bankHistory?.orders.some(
|
|
4524
|
+
(order) => order.stages.delivery.status === "completed" && order.stages.delivery.depositId === deposit.id
|
|
4525
|
+
)
|
|
4526
|
+
).map((deposit, i) => ({
|
|
4527
|
+
id: `deposit:${deposit.id ?? deposit.txHash}`,
|
|
4528
|
+
createdAt: deposit.createdAt ?? "",
|
|
4529
|
+
content: /* @__PURE__ */ jsx13(
|
|
4530
|
+
HistoryCard,
|
|
4531
|
+
{
|
|
4532
|
+
deposit,
|
|
4533
|
+
timing: timingPresentations[visibleDeposits.indexOf(deposit)],
|
|
4534
|
+
position: i,
|
|
4535
|
+
recipient,
|
|
4536
|
+
onRecover,
|
|
4537
|
+
onRowView
|
|
4538
|
+
},
|
|
4539
|
+
deposit.txHash || i
|
|
4540
|
+
)
|
|
4541
|
+
})),
|
|
4542
|
+
...(bankHistory?.orders ?? []).map((order) => {
|
|
4543
|
+
const delivery = order.stages.delivery;
|
|
4544
|
+
const linked = delivery.status === "completed" ? visibleDeposits.find(
|
|
4545
|
+
(deposit) => deposit.id === delivery.depositId
|
|
4546
|
+
) : void 0;
|
|
4547
|
+
return {
|
|
4548
|
+
id: `bank:${order.id}`,
|
|
4549
|
+
createdAt: order.createdAt,
|
|
4550
|
+
content: /* @__PURE__ */ jsx13(BankOrderCard, { order, deposit: linked, supportUrl: bankSupportUrl, children: linked && normalizeStatus(linked.status) === "failed" && /* @__PURE__ */ jsx13(
|
|
4551
|
+
HistoryCard,
|
|
4552
|
+
{
|
|
4553
|
+
deposit: linked,
|
|
4554
|
+
position: visibleDeposits.indexOf(linked),
|
|
4555
|
+
recipient,
|
|
4556
|
+
onRecover,
|
|
4557
|
+
onRowView,
|
|
4558
|
+
timing: timingPresentations[visibleDeposits.indexOf(linked)]
|
|
4559
|
+
}
|
|
4560
|
+
) })
|
|
4561
|
+
};
|
|
4562
|
+
})
|
|
4563
|
+
].sort((a, b) => b.createdAt.localeCompare(a.createdAt)).map((entry) => /* @__PURE__ */ jsx13("div", { children: entry.content }, entry.id)),
|
|
4564
|
+
bankHistory?.hasMore && /* @__PURE__ */ jsx13(
|
|
4565
|
+
"button",
|
|
3948
4566
|
{
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
deposit.txHash || i
|
|
3957
|
-
)),
|
|
4567
|
+
type: "button",
|
|
4568
|
+
className: "rs-history-load-more",
|
|
4569
|
+
disabled: bankHistory.loading,
|
|
4570
|
+
onClick: bankHistory.loadMore,
|
|
4571
|
+
children: "Load older bank transfers"
|
|
4572
|
+
}
|
|
4573
|
+
),
|
|
3958
4574
|
hasMore && /* @__PURE__ */ jsx13(
|
|
3959
4575
|
"button",
|
|
3960
4576
|
{
|
|
@@ -3981,27 +4597,27 @@ function HistoryCard({
|
|
|
3981
4597
|
onRecover,
|
|
3982
4598
|
onRowView
|
|
3983
4599
|
}) {
|
|
3984
|
-
const
|
|
3985
|
-
const
|
|
3986
|
-
const panelId = useId();
|
|
4600
|
+
const [expanded, setExpanded] = useState4(false);
|
|
4601
|
+
const panelId = useId2();
|
|
3987
4602
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
3988
|
-
const sourceChainId =
|
|
3989
|
-
const targetChainId =
|
|
4603
|
+
const sourceChainId = resolveHistoryChainId(deposit.chain);
|
|
4604
|
+
const targetChainId = resolveHistoryChainId(deposit.targetChain);
|
|
3990
4605
|
const sourceChainName = sourceChainId ? getChainName(sourceChainId) : null;
|
|
3991
4606
|
const targetChainName = targetChainId ? getChainName(targetChainId) : null;
|
|
3992
4607
|
const sourceChainIcon = sourceChainId ? getChainIcon(sourceChainId) : void 0;
|
|
3993
4608
|
const targetChainIcon = targetChainId ? getChainIcon(targetChainId) : void 0;
|
|
3994
|
-
const
|
|
4609
|
+
const sourceToken = deposit.token ?? void 0;
|
|
4610
|
+
const tokenDisplay = useTokenDisplay(sourceChainId ?? void 0, sourceToken);
|
|
4611
|
+
const sourceSymbol = !sourceToken ? "" : tokenDisplay.curated ? tokenDisplay.symbol : shortenHash(sourceToken);
|
|
3995
4612
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
3996
|
-
const formattedAmount = rawAmount ? formatAmount(rawAmount,
|
|
4613
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, tokenDisplay.decimals) : null;
|
|
3997
4614
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
3998
4615
|
minimumFractionDigits: 2,
|
|
3999
4616
|
maximumFractionDigits: 2
|
|
4000
|
-
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
4617
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : rawAmount && tokenDisplay.pending ? "\u2026" : "\u2014";
|
|
4001
4618
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
4002
4619
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
4003
4620
|
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
4004
|
-
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
4005
4621
|
const eligible = toRecoverableDeposit(deposit, { recipient });
|
|
4006
4622
|
const recoverable = onRecover ? eligible : null;
|
|
4007
4623
|
const toggleExpanded = () => {
|
|
@@ -4016,7 +4632,7 @@ function HistoryCard({
|
|
|
4016
4632
|
position
|
|
4017
4633
|
});
|
|
4018
4634
|
};
|
|
4019
|
-
return /* @__PURE__ */
|
|
4635
|
+
return /* @__PURE__ */ jsxs7(
|
|
4020
4636
|
"div",
|
|
4021
4637
|
{
|
|
4022
4638
|
className: `rs-history-card ${expanded ? "rs-history-card--expanded" : ""}`,
|
|
@@ -4029,60 +4645,46 @@ function HistoryCard({
|
|
|
4029
4645
|
onClick: toggleExpanded,
|
|
4030
4646
|
"aria-expanded": expanded,
|
|
4031
4647
|
"aria-controls": panelId,
|
|
4032
|
-
children: /* @__PURE__ */
|
|
4033
|
-
/* @__PURE__ */
|
|
4648
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "rs-history-card-row", children: [
|
|
4649
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-icons", children: [
|
|
4034
4650
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx13(
|
|
4035
4651
|
TokenIcon,
|
|
4036
4652
|
{
|
|
4653
|
+
token: sourceChainId !== null && sourceToken ? { chain: sourceChainId, address: sourceToken } : void 0,
|
|
4037
4654
|
symbol: sourceSymbol,
|
|
4038
4655
|
fallback: sourceSymbol.slice(0, 2)
|
|
4039
4656
|
}
|
|
4040
4657
|
) }),
|
|
4041
4658
|
sourceChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx13(CdnIcon, { src: sourceChainIcon }) })
|
|
4042
4659
|
] }),
|
|
4043
|
-
/* @__PURE__ */
|
|
4660
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-text", children: [
|
|
4044
4661
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
4045
4662
|
date && /* @__PURE__ */ jsx13("span", { className: "rs-history-card-date", children: date })
|
|
4046
4663
|
] }),
|
|
4047
|
-
/* @__PURE__ */
|
|
4664
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-history-card-side", children: [
|
|
4048
4665
|
/* @__PURE__ */ jsx13("span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
4049
4666
|
/* @__PURE__ */ jsx13("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
4050
4667
|
] })
|
|
4051
4668
|
] })
|
|
4052
4669
|
}
|
|
4053
4670
|
),
|
|
4054
|
-
/* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel", id: panelId, children: /* @__PURE__ */ jsx13("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */
|
|
4671
|
+
/* @__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
4672
|
(status === "failed" || recoverable) && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: recoveryFailureCause(sourceChainName) }),
|
|
4056
|
-
sourceChainName && /* @__PURE__ */
|
|
4673
|
+
sourceChainName && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
|
|
4057
4674
|
/* @__PURE__ */ jsx13("span", { children: "Source chain" }),
|
|
4058
|
-
/* @__PURE__ */
|
|
4675
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
|
|
4059
4676
|
/* @__PURE__ */ jsx13("span", { children: sourceChainName }),
|
|
4060
4677
|
sourceChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx13(CdnIcon, { src: sourceChainIcon }) })
|
|
4061
4678
|
] })
|
|
4062
4679
|
] }),
|
|
4063
|
-
targetChainName && /* @__PURE__ */
|
|
4680
|
+
targetChainName && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
|
|
4064
4681
|
/* @__PURE__ */ jsx13("span", { children: "Destination chain" }),
|
|
4065
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
|
|
4066
4683
|
/* @__PURE__ */ jsx13("span", { children: targetChainName }),
|
|
4067
4684
|
targetChainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx13(CdnIcon, { src: targetChainIcon }) })
|
|
4068
4685
|
] })
|
|
4069
4686
|
] }),
|
|
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
|
-
] }),
|
|
4687
|
+
/* @__PURE__ */ jsx13(HistoryTransactionLink, { chainId: sourceChainId, txHash: srcTxHash }),
|
|
4086
4688
|
timing && /* @__PURE__ */ jsx13(
|
|
4087
4689
|
"span",
|
|
4088
4690
|
{
|
|
@@ -4093,14 +4695,14 @@ function HistoryCard({
|
|
|
4093
4695
|
children: timing.state === "expected" ? `Usually arrives in ${timing.expectedDuration}` : timing.state === "soft" ? "Taking longer than usual" : "Taking much longer than usual"
|
|
4094
4696
|
}
|
|
4095
4697
|
),
|
|
4096
|
-
recoverable && /* @__PURE__ */
|
|
4698
|
+
recoverable && /* @__PURE__ */ jsxs7(
|
|
4097
4699
|
Button,
|
|
4098
4700
|
{
|
|
4099
4701
|
onClick: () => onRecover?.(recoverable),
|
|
4100
4702
|
fullWidth: true,
|
|
4101
4703
|
className: "rs-history-card-recover",
|
|
4102
4704
|
children: [
|
|
4103
|
-
/* @__PURE__ */
|
|
4705
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
4104
4706
|
"Recover ",
|
|
4105
4707
|
displayAmount
|
|
4106
4708
|
] }),
|
|
@@ -4116,10 +4718,10 @@ function HistoryCard({
|
|
|
4116
4718
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
4117
4719
|
|
|
4118
4720
|
// src/components/history/HistoryFallbackFlow.tsx
|
|
4119
|
-
import { useCallback as useCallback5, useEffect as useEffect7, useRef as
|
|
4721
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef4, useState as useState6 } from "react";
|
|
4120
4722
|
|
|
4121
4723
|
// src/components/ui/ListRow.tsx
|
|
4122
|
-
import { Fragment as Fragment3, jsx as jsx14, jsxs as
|
|
4724
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4123
4725
|
function ListRow({
|
|
4124
4726
|
leading,
|
|
4125
4727
|
leadingMedia,
|
|
@@ -4133,10 +4735,10 @@ function ListRow({
|
|
|
4133
4735
|
disabled,
|
|
4134
4736
|
...props
|
|
4135
4737
|
}) {
|
|
4136
|
-
const inner = /* @__PURE__ */
|
|
4738
|
+
const inner = /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
4137
4739
|
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__ */
|
|
4740
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-list-row-body", children: [
|
|
4741
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-list-row-text", children: [
|
|
4140
4742
|
/* @__PURE__ */ jsx14("span", { className: "rs-list-row-title", children: title }),
|
|
4141
4743
|
subtitle && /* @__PURE__ */ jsx14("span", { className: "rs-list-row-subtitle", children: subtitle })
|
|
4142
4744
|
] }),
|
|
@@ -4192,15 +4794,15 @@ function ListRow({
|
|
|
4192
4794
|
ListRow.displayName = "ListRow";
|
|
4193
4795
|
|
|
4194
4796
|
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
4195
|
-
import { useEffect as useEffect6, useState as
|
|
4797
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
4196
4798
|
|
|
4197
4799
|
// src/components/ui/Input.tsx
|
|
4198
4800
|
import { forwardRef } from "react";
|
|
4199
|
-
import { jsx as jsx15, jsxs as
|
|
4801
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4200
4802
|
var Input = forwardRef(
|
|
4201
4803
|
({ label, error, hint, variant, className = "", ...props }, ref) => {
|
|
4202
4804
|
const inputVariant = error ? "error" : variant || "default";
|
|
4203
|
-
return /* @__PURE__ */
|
|
4805
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-input-wrapper", children: [
|
|
4204
4806
|
label && /* @__PURE__ */ jsx15("label", { className: "rs-input-label", children: label }),
|
|
4205
4807
|
/* @__PURE__ */ jsx15(
|
|
4206
4808
|
"input",
|
|
@@ -4210,7 +4812,7 @@ var Input = forwardRef(
|
|
|
4210
4812
|
...props
|
|
4211
4813
|
}
|
|
4212
4814
|
),
|
|
4213
|
-
error ? /* @__PURE__ */
|
|
4815
|
+
error ? /* @__PURE__ */ jsxs9("p", { className: "rs-input-error", children: [
|
|
4214
4816
|
/* @__PURE__ */ jsx15(AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
4215
4817
|
error
|
|
4216
4818
|
] }) : hint && /* @__PURE__ */ jsx15("p", { className: "rs-input-hint", children: hint })
|
|
@@ -4240,7 +4842,7 @@ function classifyRecoveryLookup(rows, options = {}) {
|
|
|
4240
4842
|
}
|
|
4241
4843
|
|
|
4242
4844
|
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
4243
|
-
import { jsx as jsx16, jsxs as
|
|
4845
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4244
4846
|
function RecoveryLookupScreen({
|
|
4245
4847
|
title,
|
|
4246
4848
|
subtitle,
|
|
@@ -4251,7 +4853,7 @@ function RecoveryLookupScreen({
|
|
|
4251
4853
|
onSubmit,
|
|
4252
4854
|
onInvalid
|
|
4253
4855
|
}) {
|
|
4254
|
-
const [txHash, setTxHash] =
|
|
4856
|
+
const [txHash, setTxHash] = useState5("");
|
|
4255
4857
|
const onInvalidRef = useLatestRef(onInvalid);
|
|
4256
4858
|
const trimmed = txHash.trim();
|
|
4257
4859
|
const valid = isRecoveryTxHash(trimmed);
|
|
@@ -4260,8 +4862,8 @@ function RecoveryLookupScreen({
|
|
|
4260
4862
|
onInvalidRef.current?.();
|
|
4261
4863
|
}
|
|
4262
4864
|
}, [trimmed, valid, onInvalidRef]);
|
|
4263
|
-
return /* @__PURE__ */
|
|
4264
|
-
/* @__PURE__ */
|
|
4865
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", children: [
|
|
4866
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4265
4867
|
/* @__PURE__ */ jsx16(
|
|
4266
4868
|
BodyHeader,
|
|
4267
4869
|
{
|
|
@@ -4319,43 +4921,12 @@ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
|
4319
4921
|
"BUSD",
|
|
4320
4922
|
"USDE"
|
|
4321
4923
|
]);
|
|
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
|
-
};
|
|
4924
|
+
function normalizeStableSymbol(symbol) {
|
|
4925
|
+
return symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
|
|
4355
4926
|
}
|
|
4356
4927
|
function maxFractionDigitsFor(symbol) {
|
|
4357
4928
|
if (!symbol) return 6;
|
|
4358
|
-
return STABLECOIN_SYMBOLS.has(symbol
|
|
4929
|
+
return STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol)) ? 3 : 6;
|
|
4359
4930
|
}
|
|
4360
4931
|
function formatTokenAmount(amount, symbol) {
|
|
4361
4932
|
if (!Number.isFinite(amount)) return void 0;
|
|
@@ -4379,26 +4950,13 @@ function formatRawTokenAmount(rawAmount, token) {
|
|
|
4379
4950
|
return formatTokenAmount(value, token.symbol);
|
|
4380
4951
|
}
|
|
4381
4952
|
function isDisplayStablecoinSymbol(symbol) {
|
|
4382
|
-
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(symbol
|
|
4953
|
+
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol));
|
|
4383
4954
|
}
|
|
4384
4955
|
function priceUsdFor(symbol, prices) {
|
|
4385
4956
|
if (!symbol) return void 0;
|
|
4386
4957
|
const quoted = prices[symbol.toUpperCase()];
|
|
4387
4958
|
return typeof quoted === "number" && quoted > 0 ? quoted : void 0;
|
|
4388
4959
|
}
|
|
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
4960
|
function estimateReceiveAmount(params) {
|
|
4403
4961
|
const {
|
|
4404
4962
|
sourceAmount,
|
|
@@ -4450,20 +5008,14 @@ function formatReceiveEstimate(params) {
|
|
|
4450
5008
|
|
|
4451
5009
|
// src/components/recovery/recovery-display.ts
|
|
4452
5010
|
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
5011
|
return {
|
|
4459
|
-
symbol,
|
|
4460
|
-
decimals,
|
|
4461
|
-
amount: formatTokenAmount(human, symbol) ?? formatUnits3(raw, decimals),
|
|
5012
|
+
amount: formatRecoveryAmount(params.amountRaw, params.decimals, params.symbol),
|
|
4462
5013
|
chainName: getChainName(params.chainId),
|
|
4463
5014
|
chainIcon: getChainIcon(params.chainId)
|
|
4464
5015
|
};
|
|
4465
5016
|
}
|
|
4466
5017
|
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
5018
|
+
if (decimals === void 0) return "\u2014";
|
|
4467
5019
|
const raw = toBigInt(amountRaw);
|
|
4468
5020
|
return formatTokenAmount(Number(formatUnits3(raw, decimals)), symbol) ?? formatUnits3(raw, decimals);
|
|
4469
5021
|
}
|
|
@@ -4483,9 +5035,9 @@ function shortenAddress(addr) {
|
|
|
4483
5035
|
|
|
4484
5036
|
// src/core/claim-analytics.tsx
|
|
4485
5037
|
import {
|
|
4486
|
-
createContext as
|
|
4487
|
-
useContext as
|
|
4488
|
-
useMemo as
|
|
5038
|
+
createContext as createContext5,
|
|
5039
|
+
useContext as useContext5,
|
|
5040
|
+
useMemo as useMemo7
|
|
4489
5041
|
} from "react";
|
|
4490
5042
|
|
|
4491
5043
|
// src/core/recovery.ts
|
|
@@ -4804,7 +5356,7 @@ function createClaimAnalyticsController(emit, correlation) {
|
|
|
4804
5356
|
};
|
|
4805
5357
|
return controller;
|
|
4806
5358
|
}
|
|
4807
|
-
var ClaimAnalyticsControllerContext =
|
|
5359
|
+
var ClaimAnalyticsControllerContext = createContext5(null);
|
|
4808
5360
|
var noopController = createClaimAnalyticsController(() => {
|
|
4809
5361
|
});
|
|
4810
5362
|
function ClaimAnalyticsControllerProvider({
|
|
@@ -4813,7 +5365,7 @@ function ClaimAnalyticsControllerProvider({
|
|
|
4813
5365
|
correlation
|
|
4814
5366
|
}) {
|
|
4815
5367
|
const emit = useClaimAnalyticsEmitter();
|
|
4816
|
-
const controller =
|
|
5368
|
+
const controller = useMemo7(
|
|
4817
5369
|
() => createClaimAnalyticsController(emit, correlation),
|
|
4818
5370
|
[emit, correlation]
|
|
4819
5371
|
);
|
|
@@ -4821,7 +5373,7 @@ function ClaimAnalyticsControllerProvider({
|
|
|
4821
5373
|
return /* @__PURE__ */ jsx17(ClaimAnalyticsControllerContext.Provider, { value: controller, children });
|
|
4822
5374
|
}
|
|
4823
5375
|
function useClaimAnalyticsController() {
|
|
4824
|
-
return
|
|
5376
|
+
return useContext5(ClaimAnalyticsControllerContext) ?? noopController;
|
|
4825
5377
|
}
|
|
4826
5378
|
|
|
4827
5379
|
// src/core/formatters.ts
|
|
@@ -4929,7 +5481,7 @@ function formatUserError(raw) {
|
|
|
4929
5481
|
}
|
|
4930
5482
|
|
|
4931
5483
|
// src/components/history/HistoryFallbackFlow.tsx
|
|
4932
|
-
import { jsx as jsx18, jsxs as
|
|
5484
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4933
5485
|
function HistoryFallbackFlow({
|
|
4934
5486
|
service,
|
|
4935
5487
|
recipient,
|
|
@@ -4938,13 +5490,13 @@ function HistoryFallbackFlow({
|
|
|
4938
5490
|
onFound
|
|
4939
5491
|
}) {
|
|
4940
5492
|
const analytics = useClaimAnalyticsController();
|
|
4941
|
-
const [loading, setLoading] =
|
|
4942
|
-
const [error, setError] =
|
|
4943
|
-
const [matches, setMatches] =
|
|
5493
|
+
const [loading, setLoading] = useState6(false);
|
|
5494
|
+
const [error, setError] = useState6(null);
|
|
5495
|
+
const [matches, setMatches] = useState6(null);
|
|
4944
5496
|
useEffect7(() => {
|
|
4945
5497
|
analytics.openStep("lookup");
|
|
4946
5498
|
}, [analytics]);
|
|
4947
|
-
const epochRef =
|
|
5499
|
+
const epochRef = useRef4(0);
|
|
4948
5500
|
useEffect7(() => {
|
|
4949
5501
|
setMatches(null);
|
|
4950
5502
|
setError(null);
|
|
@@ -5023,7 +5575,13 @@ function HistoryFallbackFlow({
|
|
|
5023
5575
|
},
|
|
5024
5576
|
[onBack]
|
|
5025
5577
|
);
|
|
5026
|
-
|
|
5578
|
+
const matchDisplays = useTokenDisplays(
|
|
5579
|
+
(matches ?? []).map((match) => ({
|
|
5580
|
+
chain: match.sourceChainId,
|
|
5581
|
+
address: match.token
|
|
5582
|
+
}))
|
|
5583
|
+
);
|
|
5584
|
+
return /* @__PURE__ */ jsxs11(
|
|
5027
5585
|
"div",
|
|
5028
5586
|
{
|
|
5029
5587
|
className: "rs-history-lookup",
|
|
@@ -5031,8 +5589,8 @@ function HistoryFallbackFlow({
|
|
|
5031
5589
|
"aria-label": "Find a deposit",
|
|
5032
5590
|
onKeyDown: handleKeyDown,
|
|
5033
5591
|
children: [
|
|
5034
|
-
/* @__PURE__ */
|
|
5035
|
-
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */
|
|
5592
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-modal-header--redesigned", children: [
|
|
5593
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsxs11(
|
|
5036
5594
|
"button",
|
|
5037
5595
|
{
|
|
5038
5596
|
type: "button",
|
|
@@ -5056,8 +5614,8 @@ function HistoryFallbackFlow({
|
|
|
5056
5614
|
}
|
|
5057
5615
|
) })
|
|
5058
5616
|
] }),
|
|
5059
|
-
matches ? /* @__PURE__ */
|
|
5060
|
-
/* @__PURE__ */
|
|
5617
|
+
matches ? /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
5618
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5061
5619
|
/* @__PURE__ */ jsx18(
|
|
5062
5620
|
BodyHeader,
|
|
5063
5621
|
{
|
|
@@ -5066,16 +5624,19 @@ function HistoryFallbackFlow({
|
|
|
5066
5624
|
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
5067
5625
|
}
|
|
5068
5626
|
),
|
|
5069
|
-
/* @__PURE__ */ jsx18("div", { className: "rs-list", children: matches.map((match) => {
|
|
5070
|
-
const
|
|
5627
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-list", children: matches.map((match, i) => {
|
|
5628
|
+
const display = matchDisplays[i];
|
|
5629
|
+
const symbol = display?.symbol ?? "Token";
|
|
5630
|
+
const { amount, chainName } = describeRecoveryDeposit({
|
|
5071
5631
|
chainId: match.sourceChainId,
|
|
5072
|
-
|
|
5073
|
-
|
|
5632
|
+
amountRaw: match.amountRaw,
|
|
5633
|
+
symbol,
|
|
5634
|
+
decimals: display?.decimals
|
|
5074
5635
|
});
|
|
5075
5636
|
return /* @__PURE__ */ jsx18(
|
|
5076
5637
|
ListRow,
|
|
5077
5638
|
{
|
|
5078
|
-
leadingMedia:
|
|
5639
|
+
leadingMedia: display?.logo,
|
|
5079
5640
|
title: `${amount} ${symbol}`,
|
|
5080
5641
|
subtitle: chainName,
|
|
5081
5642
|
onClick: () => selectMatch(match)
|
|
@@ -5109,10 +5670,10 @@ function newestFirst(rows) {
|
|
|
5109
5670
|
HistoryFallbackFlow.displayName = "HistoryFallbackFlow";
|
|
5110
5671
|
|
|
5111
5672
|
// src/components/history/HistoryRecoveryFlow.tsx
|
|
5112
|
-
import { useCallback as useCallback6, useEffect as useEffect9, useRef as
|
|
5673
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
5113
5674
|
|
|
5114
5675
|
// src/components/recovery/RecoveryOutcomeScreen.tsx
|
|
5115
|
-
import { jsx as jsx19, jsxs as
|
|
5676
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5116
5677
|
function RecoveryOutcomeScreen({
|
|
5117
5678
|
result,
|
|
5118
5679
|
error,
|
|
@@ -5121,8 +5682,8 @@ function RecoveryOutcomeScreen({
|
|
|
5121
5682
|
const success = !!result;
|
|
5122
5683
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5123
5684
|
const txUrl = result ? explorerTxUrl(result.chainId, result.txHash) : null;
|
|
5124
|
-
return /* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5685
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
|
|
5686
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5126
5687
|
/* @__PURE__ */ jsx19(
|
|
5127
5688
|
BodyHeader,
|
|
5128
5689
|
{
|
|
@@ -5132,25 +5693,31 @@ function RecoveryOutcomeScreen({
|
|
|
5132
5693
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
5133
5694
|
}
|
|
5134
5695
|
),
|
|
5135
|
-
result ? /* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5696
|
+
result ? /* @__PURE__ */ jsxs12("div", { className: "rs-review-details", children: [
|
|
5697
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5137
5698
|
/* @__PURE__ */ jsx19("span", { children: "Amount" }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5699
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-review-detail-value", children: [
|
|
5700
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
5140
5701
|
result.amountDisplay,
|
|
5141
5702
|
" ",
|
|
5142
5703
|
result.symbol
|
|
5143
5704
|
] }),
|
|
5144
|
-
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx19(
|
|
5705
|
+
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx19(
|
|
5706
|
+
TokenIcon,
|
|
5707
|
+
{
|
|
5708
|
+
token: result.token ? { chain: result.chainId, address: result.token } : void 0,
|
|
5709
|
+
symbol: result.symbol
|
|
5710
|
+
}
|
|
5711
|
+
) })
|
|
5145
5712
|
] })
|
|
5146
5713
|
] }),
|
|
5147
|
-
/* @__PURE__ */
|
|
5714
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5148
5715
|
/* @__PURE__ */ jsx19("span", { children: "Sent to" }),
|
|
5149
5716
|
/* @__PURE__ */ jsx19("span", { className: "rs-review-detail-value", children: shortenAddress(result.destination) })
|
|
5150
5717
|
] }),
|
|
5151
|
-
/* @__PURE__ */
|
|
5718
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-review-detail-row", children: [
|
|
5152
5719
|
/* @__PURE__ */ jsx19("span", { children: "Refund transaction" }),
|
|
5153
|
-
txUrl ? /* @__PURE__ */
|
|
5720
|
+
txUrl ? /* @__PURE__ */ jsxs12(
|
|
5154
5721
|
"a",
|
|
5155
5722
|
{
|
|
5156
5723
|
className: "rs-review-detail-value rs-link",
|
|
@@ -5173,31 +5740,30 @@ function RecoveryOutcomeScreen({
|
|
|
5173
5740
|
RecoveryOutcomeScreen.displayName = "RecoveryOutcomeScreen";
|
|
5174
5741
|
|
|
5175
5742
|
// src/components/recovery/RecoveryReviewScreen.tsx
|
|
5176
|
-
import { useEffect as useEffect8, useState as
|
|
5743
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
5177
5744
|
import { isAddress as isAddress2 } from "viem";
|
|
5178
|
-
import { jsx as jsx20, jsxs as
|
|
5745
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5179
5746
|
function RecoveryReviewScreen({
|
|
5180
5747
|
chainId,
|
|
5181
5748
|
token,
|
|
5182
5749
|
amountRaw,
|
|
5183
5750
|
txHash,
|
|
5184
5751
|
defaultDestination,
|
|
5185
|
-
destinationHint,
|
|
5186
5752
|
depositAddress,
|
|
5187
5753
|
submitting,
|
|
5188
5754
|
onSubmit,
|
|
5189
5755
|
onDestinationInvalid,
|
|
5190
5756
|
onDestinationIsDepositAddress
|
|
5191
5757
|
}) {
|
|
5192
|
-
const { symbol,
|
|
5758
|
+
const { symbol, decimals } = useTokenDisplay(chainId, token);
|
|
5759
|
+
const { amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
5193
5760
|
chainId,
|
|
5194
|
-
|
|
5195
|
-
|
|
5761
|
+
amountRaw,
|
|
5762
|
+
symbol,
|
|
5763
|
+
decimals
|
|
5196
5764
|
});
|
|
5197
5765
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5198
|
-
const [destination, setDestination] =
|
|
5199
|
-
defaultDestination ?? ""
|
|
5200
|
-
);
|
|
5766
|
+
const [destination, setDestination] = useState7(defaultDestination ?? "");
|
|
5201
5767
|
const isSelfDestination = isDepositSelfDestination(
|
|
5202
5768
|
{ depositAddress },
|
|
5203
5769
|
destination
|
|
@@ -5224,8 +5790,8 @@ function RecoveryReviewScreen({
|
|
|
5224
5790
|
const selfDestinationError = `${shortenAddress(destination)} is this deposit's own address. Enter a different address.`;
|
|
5225
5791
|
const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
|
|
5226
5792
|
const txShort = txHash ? shortenHash2(txHash) : "\u2014";
|
|
5227
|
-
return /* @__PURE__ */
|
|
5228
|
-
/* @__PURE__ */
|
|
5793
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
|
|
5794
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5229
5795
|
/* @__PURE__ */ jsx20(
|
|
5230
5796
|
BodyHeader,
|
|
5231
5797
|
{
|
|
@@ -5234,28 +5800,34 @@ function RecoveryReviewScreen({
|
|
|
5234
5800
|
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
5235
5801
|
}
|
|
5236
5802
|
),
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
5803
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
|
|
5804
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5239
5805
|
/* @__PURE__ */ jsx20("span", { children: "Amount" }),
|
|
5240
|
-
/* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5806
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
5807
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
5242
5808
|
amount,
|
|
5243
5809
|
" ",
|
|
5244
5810
|
symbol
|
|
5245
5811
|
] }),
|
|
5246
|
-
/* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(
|
|
5812
|
+
/* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(
|
|
5813
|
+
TokenIcon,
|
|
5814
|
+
{
|
|
5815
|
+
token: token ? { chain: chainId, address: token } : void 0,
|
|
5816
|
+
symbol
|
|
5817
|
+
}
|
|
5818
|
+
) })
|
|
5247
5819
|
] })
|
|
5248
5820
|
] }),
|
|
5249
|
-
/* @__PURE__ */
|
|
5821
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5250
5822
|
/* @__PURE__ */ jsx20("span", { children: "Source chain" }),
|
|
5251
|
-
/* @__PURE__ */
|
|
5823
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
5252
5824
|
/* @__PURE__ */ jsx20("span", { children: chainName }),
|
|
5253
5825
|
chainIcon && /* @__PURE__ */ jsx20("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx20(CdnIcon, { src: chainIcon }) })
|
|
5254
5826
|
] })
|
|
5255
5827
|
] }),
|
|
5256
|
-
/* @__PURE__ */
|
|
5828
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
5257
5829
|
/* @__PURE__ */ jsx20("span", { children: "Deposit transaction" }),
|
|
5258
|
-
txUrl ? /* @__PURE__ */
|
|
5830
|
+
txUrl ? /* @__PURE__ */ jsxs13(
|
|
5259
5831
|
"a",
|
|
5260
5832
|
{
|
|
5261
5833
|
className: "rs-review-detail-value rs-link",
|
|
@@ -5277,7 +5849,7 @@ function RecoveryReviewScreen({
|
|
|
5277
5849
|
placeholder: "0x\u2026",
|
|
5278
5850
|
value: destination,
|
|
5279
5851
|
onChange: (e) => setDestination(e.target.value),
|
|
5280
|
-
hint:
|
|
5852
|
+
hint: `An address you control on ${chainName}.`,
|
|
5281
5853
|
error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5282
5854
|
}
|
|
5283
5855
|
),
|
|
@@ -5299,7 +5871,7 @@ function RecoveryReviewScreen({
|
|
|
5299
5871
|
RecoveryReviewScreen.displayName = "RecoveryReviewScreen";
|
|
5300
5872
|
|
|
5301
5873
|
// src/components/history/HistoryRecoveryFlow.tsx
|
|
5302
|
-
import { jsx as jsx21, jsxs as
|
|
5874
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5303
5875
|
function HistoryRecoveryFlow({
|
|
5304
5876
|
deposit,
|
|
5305
5877
|
entrySource,
|
|
@@ -5312,11 +5884,12 @@ function HistoryRecoveryFlow({
|
|
|
5312
5884
|
onRecovered
|
|
5313
5885
|
}) {
|
|
5314
5886
|
const analytics = useClaimAnalyticsController();
|
|
5315
|
-
const [phase, setPhase] =
|
|
5316
|
-
const [outcome, setOutcome] =
|
|
5317
|
-
const [error, setError] =
|
|
5318
|
-
const [retryable, setRetryable] =
|
|
5319
|
-
const
|
|
5887
|
+
const [phase, setPhase] = useState8("review");
|
|
5888
|
+
const [outcome, setOutcome] = useState8(null);
|
|
5889
|
+
const [error, setError] = useState8(null);
|
|
5890
|
+
const [retryable, setRetryable] = useState8(false);
|
|
5891
|
+
const [destination, setDestination] = useState8();
|
|
5892
|
+
const lastFailureRef = useRef5(null);
|
|
5320
5893
|
useEffect9(() => {
|
|
5321
5894
|
if (entrySource === "history_row") {
|
|
5322
5895
|
analytics.selectDeposit({
|
|
@@ -5327,13 +5900,13 @@ function HistoryRecoveryFlow({
|
|
|
5327
5900
|
}
|
|
5328
5901
|
analytics.openStep("review");
|
|
5329
5902
|
}, [analytics, deposit, entrySource]);
|
|
5330
|
-
const { symbol, decimals } =
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
});
|
|
5903
|
+
const { symbol, decimals } = useTokenDisplay(
|
|
5904
|
+
deposit.sourceChainId,
|
|
5905
|
+
deposit.token
|
|
5906
|
+
);
|
|
5335
5907
|
const submit = useCallback6(
|
|
5336
|
-
async (
|
|
5908
|
+
async (destination2) => {
|
|
5909
|
+
setDestination(destination2);
|
|
5337
5910
|
setPhase("submitting");
|
|
5338
5911
|
onSubmittingChange(true);
|
|
5339
5912
|
analytics.completeStep("review");
|
|
@@ -5346,14 +5919,14 @@ function HistoryRecoveryFlow({
|
|
|
5346
5919
|
chainId: deposit.targetChainId,
|
|
5347
5920
|
depositId: deposit.depositId,
|
|
5348
5921
|
signer: deposit.signer,
|
|
5349
|
-
destination,
|
|
5922
|
+
destination: destination2,
|
|
5350
5923
|
signRecovery,
|
|
5351
5924
|
debug
|
|
5352
5925
|
});
|
|
5353
5926
|
setOutcome({
|
|
5354
5927
|
// No destination to reconcile: it is inside the signed struct, so the
|
|
5355
5928
|
// processor cannot have paid anywhere else.
|
|
5356
|
-
destination,
|
|
5929
|
+
destination: destination2,
|
|
5357
5930
|
txHash: result.transactionHash,
|
|
5358
5931
|
symbol,
|
|
5359
5932
|
amountDisplay: formatRecoveryAmount(
|
|
@@ -5414,15 +5987,15 @@ function HistoryRecoveryFlow({
|
|
|
5414
5987
|
setPhase("review");
|
|
5415
5988
|
}, [analytics]);
|
|
5416
5989
|
const submitting = phase === "submitting";
|
|
5417
|
-
return /* @__PURE__ */
|
|
5990
|
+
return /* @__PURE__ */ jsxs14(
|
|
5418
5991
|
"div",
|
|
5419
5992
|
{
|
|
5420
5993
|
className: "rs-history-recovery",
|
|
5421
5994
|
role: "dialog",
|
|
5422
5995
|
"aria-label": "Recover deposit",
|
|
5423
5996
|
children: [
|
|
5424
|
-
/* @__PURE__ */
|
|
5425
|
-
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: !submitting && /* @__PURE__ */
|
|
5997
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-modal-header--redesigned", children: [
|
|
5998
|
+
/* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: !submitting && /* @__PURE__ */ jsxs14(
|
|
5426
5999
|
"button",
|
|
5427
6000
|
{
|
|
5428
6001
|
type: "button",
|
|
@@ -5454,8 +6027,7 @@ function HistoryRecoveryFlow({
|
|
|
5454
6027
|
token: deposit.token,
|
|
5455
6028
|
amountRaw: deposit.amountRaw,
|
|
5456
6029
|
txHash: deposit.sourceTxHash,
|
|
5457
|
-
defaultDestination:
|
|
5458
|
-
destinationHint: "Prefilled with the account this deposit was for. Editable.",
|
|
6030
|
+
defaultDestination: destination,
|
|
5459
6031
|
depositAddress: deposit.depositAddress,
|
|
5460
6032
|
submitting,
|
|
5461
6033
|
onSubmit: submit,
|
|
@@ -5469,11 +6041,15 @@ function HistoryRecoveryFlow({
|
|
|
5469
6041
|
phase === "success" && outcome && /* @__PURE__ */ jsx21(
|
|
5470
6042
|
RecoveryOutcomeScreen,
|
|
5471
6043
|
{
|
|
5472
|
-
result: {
|
|
6044
|
+
result: {
|
|
6045
|
+
...outcome,
|
|
6046
|
+
chainId: deposit.sourceChainId,
|
|
6047
|
+
token: deposit.token
|
|
6048
|
+
},
|
|
5473
6049
|
children: /* @__PURE__ */ jsx21(Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
5474
6050
|
}
|
|
5475
6051
|
),
|
|
5476
|
-
phase === "failed" && /* @__PURE__ */
|
|
6052
|
+
phase === "failed" && /* @__PURE__ */ jsxs14(RecoveryOutcomeScreen, { error, children: [
|
|
5477
6053
|
/* @__PURE__ */ jsx21(Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" }),
|
|
5478
6054
|
retryable && /* @__PURE__ */ jsx21(Button, { onClick: retry, fullWidth: true, children: "Try again" })
|
|
5479
6055
|
] })
|
|
@@ -5484,9 +6060,11 @@ function HistoryRecoveryFlow({
|
|
|
5484
6060
|
HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
5485
6061
|
|
|
5486
6062
|
// src/components/history/HistoryOverlay.tsx
|
|
5487
|
-
import { Fragment as Fragment4, jsx as jsx22, jsxs as
|
|
6063
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5488
6064
|
function HistoryOverlay({
|
|
5489
6065
|
controller,
|
|
6066
|
+
bankHistory,
|
|
6067
|
+
bankSupportUrl,
|
|
5490
6068
|
backLabel,
|
|
5491
6069
|
title,
|
|
5492
6070
|
recipient,
|
|
@@ -5503,9 +6081,9 @@ function HistoryOverlay({
|
|
|
5503
6081
|
onEvent
|
|
5504
6082
|
}) {
|
|
5505
6083
|
const recovering = signRecovery ? controller.recovering : null;
|
|
5506
|
-
const [fallbackOpen, setFallbackOpen] =
|
|
5507
|
-
const [attempt, setAttempt] =
|
|
5508
|
-
const claimControllerRef =
|
|
6084
|
+
const [fallbackOpen, setFallbackOpen] = useState9(false);
|
|
6085
|
+
const [attempt, setAttempt] = useState9(null);
|
|
6086
|
+
const claimControllerRef = useRef6(null);
|
|
5509
6087
|
const beginAttempt = useCallback7(
|
|
5510
6088
|
(entrySource) => {
|
|
5511
6089
|
const id = randomUuid();
|
|
@@ -5590,15 +6168,15 @@ function HistoryOverlay({
|
|
|
5590
6168
|
claim?.close("host_controlled");
|
|
5591
6169
|
};
|
|
5592
6170
|
}, [attempt]);
|
|
5593
|
-
const claimSessionProperties =
|
|
6171
|
+
const claimSessionProperties = useMemo8(
|
|
5594
6172
|
() => ({
|
|
5595
6173
|
presentation: inline ? "inline" : "overlay",
|
|
5596
6174
|
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
5597
|
-
prefills: { transaction_hash: false, refund_destination:
|
|
6175
|
+
prefills: { transaction_hash: false, refund_destination: false }
|
|
5598
6176
|
}),
|
|
5599
6177
|
[inline, closeOnOverlayClick]
|
|
5600
6178
|
);
|
|
5601
|
-
const layers = /* @__PURE__ */
|
|
6179
|
+
const layers = /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
5602
6180
|
fallbackOpen && recipient && !recovering && /* @__PURE__ */ jsx22(
|
|
5603
6181
|
HistoryFallbackFlow,
|
|
5604
6182
|
{
|
|
@@ -5624,10 +6202,12 @@ function HistoryOverlay({
|
|
|
5624
6202
|
}
|
|
5625
6203
|
)
|
|
5626
6204
|
] });
|
|
5627
|
-
return /* @__PURE__ */
|
|
6205
|
+
return /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
5628
6206
|
/* @__PURE__ */ jsx22(
|
|
5629
6207
|
DepositHistoryPanel,
|
|
5630
6208
|
{
|
|
6209
|
+
bankHistory,
|
|
6210
|
+
bankSupportUrl,
|
|
5631
6211
|
deposits: controller.deposits,
|
|
5632
6212
|
isLoading: controller.isLoading,
|
|
5633
6213
|
error: controller.error,
|
|
@@ -5669,7 +6249,7 @@ function HistoryOverlay({
|
|
|
5669
6249
|
}
|
|
5670
6250
|
|
|
5671
6251
|
// src/components/history/useHistoryPanel.ts
|
|
5672
|
-
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as
|
|
6252
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo9, useRef as useRef7, useState as useState10 } from "react";
|
|
5673
6253
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5674
6254
|
function sortByCreatedAtDesc(items) {
|
|
5675
6255
|
return [...items].sort((a, b) => {
|
|
@@ -5685,19 +6265,19 @@ function useHistoryPanel({
|
|
|
5685
6265
|
canRecover,
|
|
5686
6266
|
analytics
|
|
5687
6267
|
}) {
|
|
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] =
|
|
6268
|
+
const [isPanelOpen, setIsPanelOpen] = useState10(false);
|
|
6269
|
+
const [deposits, setDeposits] = useState10([]);
|
|
6270
|
+
const [hasMore, setHasMore] = useState10(false);
|
|
6271
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
6272
|
+
const [isLoadingMore, setIsLoadingMore] = useState10(false);
|
|
6273
|
+
const [error, setError] = useState10(null);
|
|
6274
|
+
const cursorRef = useRef7(null);
|
|
6275
|
+
const staleRef = useRef7(false);
|
|
6276
|
+
const loadedRef = useRef7(false);
|
|
6277
|
+
const recipientRef = useRef7(recipient);
|
|
6278
|
+
const requestRef = useRef7(0);
|
|
6279
|
+
const [recovering, setRecovering] = useState10(null);
|
|
6280
|
+
const [recoverySubmitting, setRecoverySubmitting] = useState10(false);
|
|
5701
6281
|
const fetchHistory = useCallback8(
|
|
5702
6282
|
async (mode = "initial") => {
|
|
5703
6283
|
if (!recipient) return;
|
|
@@ -5821,7 +6401,7 @@ function useHistoryPanel({
|
|
|
5821
6401
|
staleRef.current = true;
|
|
5822
6402
|
}, []);
|
|
5823
6403
|
const cancelRecovery = useCallback8(() => setRecovering(null), []);
|
|
5824
|
-
return
|
|
6404
|
+
return useMemo9(
|
|
5825
6405
|
() => ({
|
|
5826
6406
|
deposits,
|
|
5827
6407
|
isLoading,
|
|
@@ -6068,6 +6648,9 @@ var REMOVED_UI_CONFIG_KEYS = {
|
|
|
6068
6648
|
checkLiquidity: "removed \u2014 the modal no longer surfaces a liquidity cap. Route capacity is enforced when the deposit is processed.",
|
|
6069
6649
|
showHistoryButton: "removed \u2014 deposit history is always offered, from the modal's home screen. There is no way to hide it."
|
|
6070
6650
|
};
|
|
6651
|
+
var REMOVED_BANK_ONRAMP_KEYS = {
|
|
6652
|
+
currency: "removed \u2014 the currency follows the residence the customer declares at verification: EUR inside SEPA, USD elsewhere."
|
|
6653
|
+
};
|
|
6071
6654
|
var warned = /* @__PURE__ */ new Set();
|
|
6072
6655
|
function warnOnce(component, key, replacement) {
|
|
6073
6656
|
const id = `${component}.${key}`;
|
|
@@ -6085,6 +6668,18 @@ function warnRemovedProps(component, props) {
|
|
|
6085
6668
|
warnOnce(component, key, table[key]);
|
|
6086
6669
|
}
|
|
6087
6670
|
}
|
|
6671
|
+
const bankOnramp = props.bankOnramp;
|
|
6672
|
+
if (bankOnramp && typeof bankOnramp === "object") {
|
|
6673
|
+
for (const key of Object.keys(REMOVED_BANK_ONRAMP_KEYS)) {
|
|
6674
|
+
if (Object.prototype.hasOwnProperty.call(bankOnramp, key)) {
|
|
6675
|
+
warnOnce(
|
|
6676
|
+
component,
|
|
6677
|
+
`bankOnramp.${key}`,
|
|
6678
|
+
REMOVED_BANK_ONRAMP_KEYS[key]
|
|
6679
|
+
);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6088
6683
|
const uiConfig = props.uiConfig;
|
|
6089
6684
|
if (uiConfig && typeof uiConfig === "object") {
|
|
6090
6685
|
for (const key of Object.keys(REMOVED_UI_CONFIG_KEYS)) {
|
|
@@ -6254,22 +6849,22 @@ function isSubmissionUncertain(error) {
|
|
|
6254
6849
|
}
|
|
6255
6850
|
|
|
6256
6851
|
// src/components/steps/ProcessingStep.tsx
|
|
6257
|
-
import { useCallback as useCallback10, useEffect as
|
|
6852
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useRef as useRef9, useState as useState13 } from "react";
|
|
6258
6853
|
|
|
6259
6854
|
// src/components/ui/Tooltip.tsx
|
|
6260
6855
|
import {
|
|
6261
|
-
useState as
|
|
6262
|
-
useRef as
|
|
6856
|
+
useState as useState11,
|
|
6857
|
+
useRef as useRef8,
|
|
6263
6858
|
useEffect as useEffect12,
|
|
6264
6859
|
useCallback as useCallback9
|
|
6265
6860
|
} from "react";
|
|
6266
6861
|
import { createPortal as createPortal2 } from "react-dom";
|
|
6267
|
-
import { jsx as jsx23, jsxs as
|
|
6862
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6268
6863
|
function Tooltip({ content, children, className }) {
|
|
6269
|
-
const [open, setOpen] =
|
|
6270
|
-
const [position, setPosition] =
|
|
6271
|
-
const triggerRef =
|
|
6272
|
-
const bubbleRef =
|
|
6864
|
+
const [open, setOpen] = useState11(false);
|
|
6865
|
+
const [position, setPosition] = useState11(null);
|
|
6866
|
+
const triggerRef = useRef8(null);
|
|
6867
|
+
const bubbleRef = useRef8(null);
|
|
6273
6868
|
const updatePosition = useCallback9(() => {
|
|
6274
6869
|
const trigger = triggerRef.current;
|
|
6275
6870
|
if (!trigger) return;
|
|
@@ -6305,7 +6900,7 @@ function Tooltip({ content, children, className }) {
|
|
|
6305
6900
|
window.removeEventListener("resize", updatePosition);
|
|
6306
6901
|
};
|
|
6307
6902
|
}, [open, updatePosition]);
|
|
6308
|
-
return /* @__PURE__ */
|
|
6903
|
+
return /* @__PURE__ */ jsxs16(
|
|
6309
6904
|
"span",
|
|
6310
6905
|
{
|
|
6311
6906
|
ref: triggerRef,
|
|
@@ -6354,18 +6949,18 @@ function Tooltip({ content, children, className }) {
|
|
|
6354
6949
|
Tooltip.displayName = "Tooltip";
|
|
6355
6950
|
|
|
6356
6951
|
// src/components/ui/FeesAccordion.tsx
|
|
6357
|
-
import { useState as
|
|
6358
|
-
import { jsx as jsx24, jsxs as
|
|
6952
|
+
import { useState as useState12 } from "react";
|
|
6953
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6359
6954
|
function FeesAccordion({ total, rows, tooltip }) {
|
|
6360
|
-
const [open, setOpen] =
|
|
6955
|
+
const [open, setOpen] = useState12(false);
|
|
6361
6956
|
const expandable = rows.length > 0;
|
|
6362
|
-
return /* @__PURE__ */
|
|
6363
|
-
/* @__PURE__ */
|
|
6364
|
-
/* @__PURE__ */
|
|
6957
|
+
return /* @__PURE__ */ jsxs17("div", { className: "rs-fees-accordion", children: [
|
|
6958
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-fees-accordion-summary", children: [
|
|
6959
|
+
/* @__PURE__ */ jsxs17("span", { className: "rs-fees-accordion-label", children: [
|
|
6365
6960
|
/* @__PURE__ */ jsx24("span", { children: "Fees" }),
|
|
6366
6961
|
tooltip && /* @__PURE__ */ jsx24(Tooltip, { content: tooltip, children: /* @__PURE__ */ jsx24("span", { className: "rs-review-detail-info", "aria-label": "Fees info", children: /* @__PURE__ */ jsx24(InfoIcon, {}) }) })
|
|
6367
6962
|
] }),
|
|
6368
|
-
/* @__PURE__ */
|
|
6963
|
+
/* @__PURE__ */ jsxs17(
|
|
6369
6964
|
"button",
|
|
6370
6965
|
{
|
|
6371
6966
|
type: "button",
|
|
@@ -6388,9 +6983,9 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6388
6983
|
}
|
|
6389
6984
|
)
|
|
6390
6985
|
] }),
|
|
6391
|
-
expandable && open && /* @__PURE__ */ jsx24("div", { className: "rs-fees-accordion-rows", children: rows.map((row, i) => /* @__PURE__ */
|
|
6986
|
+
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
6987
|
/* @__PURE__ */ jsx24("span", { children: row.label }),
|
|
6393
|
-
/* @__PURE__ */
|
|
6988
|
+
/* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
|
|
6394
6989
|
/* @__PURE__ */ jsx24(
|
|
6395
6990
|
"span",
|
|
6396
6991
|
{
|
|
@@ -6413,13 +7008,14 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6413
7008
|
FeesAccordion.displayName = "FeesAccordion";
|
|
6414
7009
|
|
|
6415
7010
|
// src/components/steps/SwappedReceipt.tsx
|
|
6416
|
-
import { jsx as jsx25, jsxs as
|
|
7011
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6417
7012
|
function SwappedReceipt({
|
|
6418
7013
|
onrampMethod,
|
|
6419
7014
|
onrampMethodIcon,
|
|
6420
7015
|
amountPaid,
|
|
6421
7016
|
depositedAmount,
|
|
6422
7017
|
depositedSymbol,
|
|
7018
|
+
depositedToken,
|
|
6423
7019
|
feesTotal,
|
|
6424
7020
|
feeRows,
|
|
6425
7021
|
feesTooltip,
|
|
@@ -6427,26 +7023,26 @@ function SwappedReceipt({
|
|
|
6427
7023
|
onNewDeposit,
|
|
6428
7024
|
onClose
|
|
6429
7025
|
}) {
|
|
6430
|
-
return /* @__PURE__ */
|
|
6431
|
-
/* @__PURE__ */
|
|
7026
|
+
return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
|
|
7027
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
6432
7028
|
/* @__PURE__ */ jsx25(BodyHeader, { icon: /* @__PURE__ */ jsx25(CheckIcon, {}), title: "Deposit successful" }),
|
|
6433
|
-
/* @__PURE__ */
|
|
6434
|
-
onrampMethod && /* @__PURE__ */
|
|
7029
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-review-details", children: [
|
|
7030
|
+
onrampMethod && /* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6435
7031
|
/* @__PURE__ */ jsx25("span", { children: "Onramp method" }),
|
|
6436
|
-
/* @__PURE__ */
|
|
7032
|
+
/* @__PURE__ */ jsxs18("span", { className: "rs-review-detail-value", children: [
|
|
6437
7033
|
/* @__PURE__ */ jsx25("span", { children: onrampMethod }),
|
|
6438
7034
|
onrampMethodIcon && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon rs-review-detail-icon--square", children: /* @__PURE__ */ jsx25(CdnIcon, { src: onrampMethodIcon }) })
|
|
6439
7035
|
] })
|
|
6440
7036
|
] }),
|
|
6441
|
-
amountPaid && /* @__PURE__ */
|
|
7037
|
+
amountPaid && /* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6442
7038
|
/* @__PURE__ */ jsx25("span", { children: "Amount paid" }),
|
|
6443
7039
|
/* @__PURE__ */ jsx25("span", { className: "rs-review-detail-value", children: amountPaid })
|
|
6444
7040
|
] }),
|
|
6445
|
-
/* @__PURE__ */
|
|
7041
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-review-detail-row", children: [
|
|
6446
7042
|
/* @__PURE__ */ jsx25("span", { children: "Deposited amount" }),
|
|
6447
|
-
/* @__PURE__ */
|
|
7043
|
+
/* @__PURE__ */ jsxs18("span", { className: "rs-review-detail-value", children: [
|
|
6448
7044
|
/* @__PURE__ */ jsx25("span", { children: depositedAmount }),
|
|
6449
|
-
depositedSymbol && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx25(TokenIcon, { symbol: depositedSymbol }) })
|
|
7045
|
+
depositedSymbol && /* @__PURE__ */ jsx25("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx25(TokenIcon, { token: depositedToken, symbol: depositedSymbol }) })
|
|
6450
7046
|
] })
|
|
6451
7047
|
] }),
|
|
6452
7048
|
feesTotal != null && /* @__PURE__ */ jsx25(
|
|
@@ -6458,7 +7054,7 @@ function SwappedReceipt({
|
|
|
6458
7054
|
}
|
|
6459
7055
|
)
|
|
6460
7056
|
] }),
|
|
6461
|
-
/* @__PURE__ */
|
|
7057
|
+
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-button-row", children: [
|
|
6462
7058
|
onNewDeposit && /* @__PURE__ */ jsx25(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: newLabel }),
|
|
6463
7059
|
onClose && /* @__PURE__ */ jsx25(Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
6464
7060
|
] })
|
|
@@ -6644,73 +7240,35 @@ function failureMessageForEvent(event) {
|
|
|
6644
7240
|
}
|
|
6645
7241
|
|
|
6646
7242
|
// 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({});
|
|
7243
|
+
import { useMemo as useMemo10 } from "react";
|
|
7244
|
+
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
7245
|
+
function addressFor(token) {
|
|
7246
|
+
if (token.address) return token.address;
|
|
7247
|
+
return token.chainId === "solana" ? "native" : ZERO_ADDRESS2;
|
|
7248
|
+
}
|
|
7249
|
+
function useTokenPrices(tokens) {
|
|
6678
7250
|
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;
|
|
7251
|
+
const refs = defined.map((token) => ({
|
|
7252
|
+
chain: token.chainId,
|
|
7253
|
+
address: addressFor(token)
|
|
7254
|
+
}));
|
|
7255
|
+
const byId = useAssetPrices(refs);
|
|
7256
|
+
const key = defined.map((t) => `${String(t.chainId)}:${addressFor(t)}:${t.symbol}`).join("|");
|
|
7257
|
+
return useMemo10(() => {
|
|
7258
|
+
const out = {};
|
|
7259
|
+
for (const token of defined) {
|
|
7260
|
+
const id = assetIdFor(token.chainId, addressFor(token));
|
|
7261
|
+
const usd = id ? byId[id] : void 0;
|
|
7262
|
+
if (typeof usd === "number") out[token.symbol.toUpperCase()] = usd;
|
|
7263
|
+
}
|
|
7264
|
+
return out;
|
|
7265
|
+
}, [key, byId]);
|
|
6708
7266
|
}
|
|
6709
7267
|
|
|
6710
7268
|
// src/components/steps/ProcessingStep.tsx
|
|
6711
|
-
import { Fragment as Fragment5, jsx as jsx27, jsxs as
|
|
7269
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6712
7270
|
function SuccessBadge() {
|
|
6713
|
-
return /* @__PURE__ */
|
|
7271
|
+
return /* @__PURE__ */ jsxs19(
|
|
6714
7272
|
"svg",
|
|
6715
7273
|
{
|
|
6716
7274
|
width: "40",
|
|
@@ -6744,7 +7302,7 @@ function SuccessBadge() {
|
|
|
6744
7302
|
);
|
|
6745
7303
|
}
|
|
6746
7304
|
function FailedBadge() {
|
|
6747
|
-
return /* @__PURE__ */
|
|
7305
|
+
return /* @__PURE__ */ jsxs19(
|
|
6748
7306
|
"svg",
|
|
6749
7307
|
{
|
|
6750
7308
|
width: "40",
|
|
@@ -6886,7 +7444,7 @@ function TickerChar({ value }) {
|
|
|
6886
7444
|
const [current, setCurrent] = useState13(value);
|
|
6887
7445
|
const [previous, setPrevious] = useState13(null);
|
|
6888
7446
|
const [animKey, setAnimKey] = useState13(0);
|
|
6889
|
-
|
|
7447
|
+
useEffect13(() => {
|
|
6890
7448
|
if (value === current) return;
|
|
6891
7449
|
setPrevious(current);
|
|
6892
7450
|
setCurrent(value);
|
|
@@ -6894,7 +7452,7 @@ function TickerChar({ value }) {
|
|
|
6894
7452
|
const timeout = setTimeout(() => setPrevious(null), 360);
|
|
6895
7453
|
return () => clearTimeout(timeout);
|
|
6896
7454
|
}, [value, current]);
|
|
6897
|
-
return /* @__PURE__ */
|
|
7455
|
+
return /* @__PURE__ */ jsxs19("span", { className: "rs-ticker-slot", children: [
|
|
6898
7456
|
previous !== null && /* @__PURE__ */ jsx27("span", { className: "rs-ticker-out", children: previous }, `out-${animKey}`),
|
|
6899
7457
|
/* @__PURE__ */ jsx27("span", { className: "rs-ticker-in", children: current }, `in-${animKey}`)
|
|
6900
7458
|
] });
|
|
@@ -7026,10 +7584,10 @@ function ProcessingStep({
|
|
|
7026
7584
|
onSettledChange,
|
|
7027
7585
|
onError
|
|
7028
7586
|
}) {
|
|
7029
|
-
const startTimeRef =
|
|
7030
|
-
const pollIntervalRef =
|
|
7031
|
-
const pollTimeoutRef =
|
|
7032
|
-
const escalatedDelayRef =
|
|
7587
|
+
const startTimeRef = useRef9(Date.now());
|
|
7588
|
+
const pollIntervalRef = useRef9(INITIAL_POLL_INTERVAL);
|
|
7589
|
+
const pollTimeoutRef = useRef9(null);
|
|
7590
|
+
const escalatedDelayRef = useRef9(false);
|
|
7033
7591
|
const processingContextRef = useLatestRef({
|
|
7034
7592
|
amount,
|
|
7035
7593
|
sourceChain,
|
|
@@ -7043,8 +7601,8 @@ function ProcessingStep({
|
|
|
7043
7601
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
7044
7602
|
const onErrorRef = useLatestRef(onError);
|
|
7045
7603
|
const explorerTxUrl = useExplorerTxUrl();
|
|
7046
|
-
const initialTerminalEventRef =
|
|
7047
|
-
const completedDirectTransferTxHashRef =
|
|
7604
|
+
const initialTerminalEventRef = useRef9(null);
|
|
7605
|
+
const completedDirectTransferTxHashRef = useRef9(null);
|
|
7048
7606
|
const [state, setState] = useState13(() => {
|
|
7049
7607
|
if (directTransfer) return { type: "complete" };
|
|
7050
7608
|
const initial = getInitialProcessingState(
|
|
@@ -7074,8 +7632,8 @@ function ProcessingStep({
|
|
|
7074
7632
|
if (latchedTiming === void 0 && quote?.timing !== void 0) {
|
|
7075
7633
|
setLatchedTiming(quote.timing);
|
|
7076
7634
|
}
|
|
7077
|
-
const timingStateRef =
|
|
7078
|
-
const servedTimingLatchRef =
|
|
7635
|
+
const timingStateRef = useRef9("expected");
|
|
7636
|
+
const servedTimingLatchRef = useRef9(false);
|
|
7079
7637
|
const updatePhaseTimings = useCallback10(
|
|
7080
7638
|
(updater) => {
|
|
7081
7639
|
setPhaseTimings((previous) => {
|
|
@@ -7086,7 +7644,7 @@ function ProcessingStep({
|
|
|
7086
7644
|
},
|
|
7087
7645
|
[txHash]
|
|
7088
7646
|
);
|
|
7089
|
-
|
|
7647
|
+
useEffect13(() => {
|
|
7090
7648
|
if (!directTransfer || completedDirectTransferTxHashRef.current === txHash) {
|
|
7091
7649
|
return;
|
|
7092
7650
|
}
|
|
@@ -7120,7 +7678,7 @@ function ProcessingStep({
|
|
|
7120
7678
|
txHash,
|
|
7121
7679
|
updatePhaseTimings
|
|
7122
7680
|
]);
|
|
7123
|
-
|
|
7681
|
+
useEffect13(() => {
|
|
7124
7682
|
const event = initialTerminalEventRef.current;
|
|
7125
7683
|
if (!event) return;
|
|
7126
7684
|
initialTerminalEventRef.current = null;
|
|
@@ -7164,13 +7722,13 @@ function ProcessingStep({
|
|
|
7164
7722
|
processingContextRef,
|
|
7165
7723
|
txHash
|
|
7166
7724
|
]);
|
|
7167
|
-
const onSettledChangeRef =
|
|
7725
|
+
const onSettledChangeRef = useRef9(onSettledChange);
|
|
7168
7726
|
onSettledChangeRef.current = onSettledChange;
|
|
7169
|
-
|
|
7727
|
+
useEffect13(() => {
|
|
7170
7728
|
onSettledChangeRef.current?.(state.type !== "processing");
|
|
7171
7729
|
return () => onSettledChangeRef.current?.(false);
|
|
7172
7730
|
}, [state.type]);
|
|
7173
|
-
|
|
7731
|
+
useEffect13(() => {
|
|
7174
7732
|
if (directTransfer || state.type !== "processing") return;
|
|
7175
7733
|
const updateElapsed = () => {
|
|
7176
7734
|
setElapsedSeconds(
|
|
@@ -7181,7 +7739,7 @@ function ProcessingStep({
|
|
|
7181
7739
|
const intervalId = setInterval(updateElapsed, 1e3);
|
|
7182
7740
|
return () => clearInterval(intervalId);
|
|
7183
7741
|
}, [directTransfer, state.type]);
|
|
7184
|
-
|
|
7742
|
+
useEffect13(() => {
|
|
7185
7743
|
if (state.type === "processing") return;
|
|
7186
7744
|
const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
|
|
7187
7745
|
setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
|
|
@@ -7189,31 +7747,26 @@ function ProcessingStep({
|
|
|
7189
7747
|
(previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
|
|
7190
7748
|
);
|
|
7191
7749
|
}, [phaseTimings.completedAt, state.type, updatePhaseTimings]);
|
|
7192
|
-
|
|
7750
|
+
useEffect13(() => {
|
|
7193
7751
|
if (!state.lastEvent) return;
|
|
7194
7752
|
updatePhaseTimings(
|
|
7195
7753
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
7196
7754
|
);
|
|
7197
7755
|
}, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
|
|
7198
7756
|
const [swappedFiatContext, setSwappedFiatContext] = useState13(null);
|
|
7199
|
-
|
|
7757
|
+
useEffect13(() => {
|
|
7200
7758
|
let cancelled = false;
|
|
7201
7759
|
let timeoutId;
|
|
7202
7760
|
const isFiatSwappedOrder = isSwappedOrder && swappedContext?.variant === "fiat";
|
|
7203
7761
|
const expectedOrderUuid = swappedContext?.expectedOrderUuid ?? null;
|
|
7204
7762
|
setSwappedFiatContext(null);
|
|
7205
|
-
if (
|
|
7763
|
+
if (!isSwappedOrder || !expectedOrderUuid) {
|
|
7206
7764
|
return () => {
|
|
7207
7765
|
cancelled = true;
|
|
7208
7766
|
};
|
|
7209
7767
|
}
|
|
7768
|
+
const orderId = expectedOrderUuid;
|
|
7210
7769
|
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
7770
|
const scheduleRetry = () => {
|
|
7218
7771
|
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
7219
7772
|
return;
|
|
@@ -7226,9 +7779,9 @@ function ProcessingStep({
|
|
|
7226
7779
|
async function fetchContext() {
|
|
7227
7780
|
attempts += 1;
|
|
7228
7781
|
try {
|
|
7229
|
-
const res = await service.
|
|
7782
|
+
const res = await service.fetchSwappedOrder(orderId);
|
|
7230
7783
|
if (cancelled) return;
|
|
7231
|
-
if (!res ||
|
|
7784
|
+
if (!res || res.orderId !== orderId) {
|
|
7232
7785
|
scheduleRetry();
|
|
7233
7786
|
return;
|
|
7234
7787
|
}
|
|
@@ -7247,13 +7800,11 @@ function ProcessingStep({
|
|
|
7247
7800
|
};
|
|
7248
7801
|
}, [
|
|
7249
7802
|
service,
|
|
7250
|
-
smartAccount,
|
|
7251
|
-
txHash,
|
|
7252
7803
|
isSwappedOrder,
|
|
7253
7804
|
swappedContext?.variant,
|
|
7254
7805
|
swappedContext?.expectedOrderUuid
|
|
7255
7806
|
]);
|
|
7256
|
-
|
|
7807
|
+
useEffect13(() => {
|
|
7257
7808
|
if (directTransfer) return;
|
|
7258
7809
|
if (state.type !== "processing") {
|
|
7259
7810
|
pollIntervalRef.current = INITIAL_POLL_INTERVAL;
|
|
@@ -7401,46 +7952,53 @@ function ProcessingStep({
|
|
|
7401
7952
|
const targetChainId = targetChainToChainId(targetChain);
|
|
7402
7953
|
const settledSourceTxHash = lastEvent?.data?.source?.transactionHash;
|
|
7403
7954
|
const sourceExplorerHash = settledSourceTxHash ?? (sourceTxHashPending ? null : sourceTxHash);
|
|
7404
|
-
|
|
7955
|
+
useEffect13(() => {
|
|
7405
7956
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
7406
7957
|
onSourceTransactionObserved?.(settledSourceTxHash);
|
|
7407
7958
|
}
|
|
7408
7959
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
7409
7960
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
7410
7961
|
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
7962
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
7425
|
-
const
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7963
|
+
const displayTargetChain = eventDestination.chainId ?? targetChainId;
|
|
7964
|
+
const displayTargetToken = eventDestination.token ?? targetToken;
|
|
7965
|
+
const [sourceDisplay, targetDisplay] = useTokenDisplays([
|
|
7966
|
+
{
|
|
7967
|
+
chain: displaySourceChain,
|
|
7968
|
+
address: displaySourceToken,
|
|
7969
|
+
fallback: {
|
|
7970
|
+
symbol: providedSourceSymbol ?? (displaySourceChain === "solana" ? "SOL" : "Token"),
|
|
7971
|
+
decimals: providedSourceDecimals
|
|
7972
|
+
}
|
|
7973
|
+
},
|
|
7974
|
+
{
|
|
7975
|
+
chain: displayTargetChain,
|
|
7976
|
+
address: displayTargetToken,
|
|
7977
|
+
// Dapp deposits default to USDC targets; mirror the source symbol last
|
|
7978
|
+
// so unresolvable same-token routes still label sensibly.
|
|
7979
|
+
fallback: { symbol: providedSourceSymbol ?? "USDC" }
|
|
7980
|
+
}
|
|
7981
|
+
]);
|
|
7982
|
+
const sourceSymbol = sourceDisplay.symbol;
|
|
7432
7983
|
const targetSymbol = targetDisplay.symbol;
|
|
7984
|
+
const formattedSentAmount = formatRawTokenAmount(displayAmount, sourceDisplay) ?? // Unknown decimals: no figure rather than a guess off by 10^12.
|
|
7985
|
+
(sourceDisplay.decimals === void 0 ? "\u2014" : (
|
|
7986
|
+
// Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7987
|
+
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol) ?? displayAmount
|
|
7988
|
+
));
|
|
7989
|
+
const sourceTokenRef = displaySourceToken ? { chain: displaySourceChain, address: displaySourceToken } : void 0;
|
|
7990
|
+
const targetTokenRef = displayTargetToken ? { chain: displayTargetChain, address: displayTargetToken } : void 0;
|
|
7433
7991
|
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
7434
7992
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
7435
|
-
const prices = useTokenPrices(
|
|
7993
|
+
const prices = useTokenPrices([
|
|
7436
7994
|
{
|
|
7437
7995
|
chainId: displaySourceChain,
|
|
7438
7996
|
address: displaySourceToken,
|
|
7439
7997
|
symbol: sourceDisplay.symbol
|
|
7440
7998
|
},
|
|
7441
7999
|
{
|
|
7442
|
-
chainId:
|
|
7443
|
-
address:
|
|
8000
|
+
chainId: displayTargetChain,
|
|
8001
|
+
address: displayTargetToken,
|
|
7444
8002
|
symbol: targetDisplay.symbol
|
|
7445
8003
|
}
|
|
7446
8004
|
]);
|
|
@@ -7450,7 +8008,7 @@ function ProcessingStep({
|
|
|
7450
8008
|
sourceSymbol: sourceDisplay.symbol,
|
|
7451
8009
|
targetSymbol: targetDisplay.symbol,
|
|
7452
8010
|
sourceAmountUsd: amountUsdNumber,
|
|
7453
|
-
sourceTrusted:
|
|
8011
|
+
sourceTrusted: sourceDisplay.curated,
|
|
7454
8012
|
prices
|
|
7455
8013
|
});
|
|
7456
8014
|
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
@@ -7498,7 +8056,7 @@ function ProcessingStep({
|
|
|
7498
8056
|
) : timingStateRef.current;
|
|
7499
8057
|
timingStateRef.current = timingState;
|
|
7500
8058
|
const expectedDuration = latchedTiming && timingState === "expected" ? formatExpectedDuration(latchedTiming.expectedSeconds) : void 0;
|
|
7501
|
-
|
|
8059
|
+
useEffect13(() => {
|
|
7502
8060
|
if (directTransfer || !isProcessing || timingState !== "escalated") return;
|
|
7503
8061
|
if (escalatedDelayRef.current) return;
|
|
7504
8062
|
escalatedDelayRef.current = true;
|
|
@@ -7529,10 +8087,10 @@ function ProcessingStep({
|
|
|
7529
8087
|
const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
|
|
7530
8088
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
7531
8089
|
const handleRetry = onRetry ?? onNewDeposit;
|
|
7532
|
-
const headerContent = isComplete ? /* @__PURE__ */
|
|
8090
|
+
const headerContent = isComplete ? /* @__PURE__ */ jsxs19("div", { className: "rs-body-header", children: [
|
|
7533
8091
|
/* @__PURE__ */ jsx27(SuccessBadge, {}),
|
|
7534
8092
|
/* @__PURE__ */ jsx27("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx27("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
7535
|
-
] }) : isFailed ? /* @__PURE__ */
|
|
8093
|
+
] }) : isFailed ? /* @__PURE__ */ jsxs19("div", { className: "rs-body-header", children: [
|
|
7536
8094
|
/* @__PURE__ */ jsx27(FailedBadge, {}),
|
|
7537
8095
|
/* @__PURE__ */ jsx27("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx27("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
7538
8096
|
] }) : /* @__PURE__ */ jsx27(BodyHeader, { icon: /* @__PURE__ */ jsx27(WalletIcon, {}), title: stateTitle });
|
|
@@ -7583,6 +8141,7 @@ function ProcessingStep({
|
|
|
7583
8141
|
amountPaid,
|
|
7584
8142
|
depositedAmount,
|
|
7585
8143
|
depositedSymbol: targetSymbol,
|
|
8144
|
+
depositedToken: targetTokenRef,
|
|
7586
8145
|
feesTotal,
|
|
7587
8146
|
feeRows,
|
|
7588
8147
|
feesTooltip,
|
|
@@ -7592,13 +8151,13 @@ function ProcessingStep({
|
|
|
7592
8151
|
}
|
|
7593
8152
|
);
|
|
7594
8153
|
}
|
|
7595
|
-
return /* @__PURE__ */
|
|
7596
|
-
/* @__PURE__ */
|
|
8154
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-screen", children: [
|
|
8155
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
7597
8156
|
headerContent,
|
|
7598
|
-
/* @__PURE__ */
|
|
7599
|
-
/* @__PURE__ */
|
|
8157
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-details", children: [
|
|
8158
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7600
8159
|
/* @__PURE__ */ jsx27("span", { children: "Source chain" }),
|
|
7601
|
-
/* @__PURE__ */
|
|
8160
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7602
8161
|
/* @__PURE__ */ jsx27("span", { children: sourceChainName }),
|
|
7603
8162
|
sourceChainIcon && /* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(CdnIcon, { src: sourceChainIcon }) }),
|
|
7604
8163
|
sourceExplorerUrl && /* @__PURE__ */ jsx27(
|
|
@@ -7614,9 +8173,9 @@ function ProcessingStep({
|
|
|
7614
8173
|
)
|
|
7615
8174
|
] })
|
|
7616
8175
|
] }),
|
|
7617
|
-
/* @__PURE__ */
|
|
8176
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7618
8177
|
/* @__PURE__ */ jsx27("span", { children: "Destination chain" }),
|
|
7619
|
-
/* @__PURE__ */
|
|
8178
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7620
8179
|
/* @__PURE__ */ jsx27("span", { children: targetChainName }),
|
|
7621
8180
|
targetChainIcon && /* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(CdnIcon, { src: targetChainIcon }) }),
|
|
7622
8181
|
destExplorerUrl && /* @__PURE__ */ jsx27(
|
|
@@ -7632,70 +8191,70 @@ function ProcessingStep({
|
|
|
7632
8191
|
)
|
|
7633
8192
|
] })
|
|
7634
8193
|
] }),
|
|
7635
|
-
/* @__PURE__ */
|
|
8194
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7636
8195
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "Time elapsed" : "Total time" }),
|
|
7637
8196
|
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx27(Ticker, { value: timerText }) })
|
|
7638
8197
|
] }),
|
|
7639
|
-
isSwappedOrder ? /* @__PURE__ */
|
|
7640
|
-
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */
|
|
8198
|
+
isSwappedOrder ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
8199
|
+
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7641
8200
|
/* @__PURE__ */ jsx27("span", { children: "You pay" }),
|
|
7642
|
-
/* @__PURE__ */
|
|
8201
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7643
8202
|
"$",
|
|
7644
8203
|
swappedFiatContext.paidAmountUsd.toFixed(2),
|
|
7645
|
-
swappedFiatContext.paymentMethod && /* @__PURE__ */
|
|
8204
|
+
swappedFiatContext.paymentMethod && /* @__PURE__ */ jsxs19("span", { style: { color: "#71717b", marginLeft: 6 }, children: [
|
|
7646
8205
|
"via",
|
|
7647
8206
|
" ",
|
|
7648
8207
|
formatPaymentMethod(swappedFiatContext.paymentMethod)
|
|
7649
8208
|
] })
|
|
7650
8209
|
] })
|
|
7651
8210
|
] }),
|
|
7652
|
-
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */
|
|
8211
|
+
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7653
8212
|
/* @__PURE__ */ jsx27("span", { children: "On-ramp fee" }),
|
|
7654
|
-
/* @__PURE__ */
|
|
8213
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7655
8214
|
"$",
|
|
7656
8215
|
swappedFiatContext.onrampFeeUsd.toFixed(2)
|
|
7657
8216
|
] })
|
|
7658
8217
|
] }),
|
|
7659
|
-
formattedBridgingCost && /* @__PURE__ */
|
|
8218
|
+
formattedBridgingCost && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7660
8219
|
/* @__PURE__ */ jsx27("span", { children: "Bridging cost" }),
|
|
7661
|
-
/* @__PURE__ */
|
|
7662
|
-
/* @__PURE__ */
|
|
8220
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8221
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
7663
8222
|
formattedBridgingCost,
|
|
7664
8223
|
" ",
|
|
7665
8224
|
sourceSymbol
|
|
7666
8225
|
] }),
|
|
7667
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: sourceSymbol }) })
|
|
8226
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7668
8227
|
] })
|
|
7669
8228
|
] })
|
|
7670
|
-
] }) : /* @__PURE__ */
|
|
8229
|
+
] }) : /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7671
8230
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "You send" : "You sent" }),
|
|
7672
|
-
/* @__PURE__ */
|
|
7673
|
-
/* @__PURE__ */
|
|
8231
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8232
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
7674
8233
|
formattedSentAmount,
|
|
7675
8234
|
" ",
|
|
7676
8235
|
sourceSymbol
|
|
7677
8236
|
] }),
|
|
7678
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: sourceSymbol }) })
|
|
8237
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7679
8238
|
] })
|
|
7680
8239
|
] }),
|
|
7681
|
-
/* @__PURE__ */
|
|
8240
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7682
8241
|
/* @__PURE__ */ jsx27("span", { children: isProcessing ? "Receive" : "Received" }),
|
|
7683
|
-
/* @__PURE__ */
|
|
8242
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7684
8243
|
/* @__PURE__ */ jsx27("span", { children: receiveDisplay }),
|
|
7685
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { symbol: targetSymbol }) })
|
|
8244
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx27(TokenIcon, { token: targetTokenRef, symbol: targetSymbol }) })
|
|
7686
8245
|
] })
|
|
7687
8246
|
] }),
|
|
7688
|
-
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */
|
|
8247
|
+
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7689
8248
|
/* @__PURE__ */ jsx27("span", { children: "Balance" }),
|
|
7690
|
-
/* @__PURE__ */
|
|
8249
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
7691
8250
|
"$",
|
|
7692
8251
|
balanceAfterUsd.toFixed(2)
|
|
7693
8252
|
] })
|
|
7694
8253
|
] }),
|
|
7695
|
-
isSwappedOrder ? quotedFeeAmount !== void 0 && /* @__PURE__ */
|
|
8254
|
+
isSwappedOrder ? quotedFeeAmount !== void 0 && /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7696
8255
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7697
|
-
/* @__PURE__ */
|
|
7698
|
-
/* @__PURE__ */
|
|
8256
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
8257
|
+
/* @__PURE__ */ jsxs19(
|
|
7699
8258
|
"span",
|
|
7700
8259
|
{
|
|
7701
8260
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
@@ -7718,7 +8277,7 @@ function ProcessingStep({
|
|
|
7718
8277
|
] }) : (() => {
|
|
7719
8278
|
const { display, struck } = quoteFeeRow(quote?.fees);
|
|
7720
8279
|
if (display !== null) {
|
|
7721
|
-
return /* @__PURE__ */
|
|
8280
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7722
8281
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7723
8282
|
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx27(
|
|
7724
8283
|
"span",
|
|
@@ -7731,9 +8290,9 @@ function ProcessingStep({
|
|
|
7731
8290
|
}
|
|
7732
8291
|
const feeValue = quotedFeeAmount ?? formattedBridgingCost;
|
|
7733
8292
|
if (feeValue === void 0) return null;
|
|
7734
|
-
return /* @__PURE__ */
|
|
8293
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rs-review-detail-row", children: [
|
|
7735
8294
|
/* @__PURE__ */ jsx27("span", { children: "Fees" }),
|
|
7736
|
-
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */
|
|
8295
|
+
/* @__PURE__ */ jsx27("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsxs19(
|
|
7737
8296
|
"span",
|
|
7738
8297
|
{
|
|
7739
8298
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
@@ -7748,7 +8307,7 @@ function ProcessingStep({
|
|
|
7748
8307
|
})()
|
|
7749
8308
|
] }),
|
|
7750
8309
|
isFailed && failureMessage && /* @__PURE__ */ jsx27(Callout, { variant: "error", children: failureMessage }),
|
|
7751
|
-
isProcessing && expectedDuration !== void 0 && /* @__PURE__ */
|
|
8310
|
+
isProcessing && expectedDuration !== void 0 && /* @__PURE__ */ jsxs19("p", { className: "rs-pending-expectation", children: [
|
|
7752
8311
|
"Usually arrives in ",
|
|
7753
8312
|
expectedDuration
|
|
7754
8313
|
] }),
|
|
@@ -7763,14 +8322,14 @@ function ProcessingStep({
|
|
|
7763
8322
|
children: "Submitting transaction\u2026"
|
|
7764
8323
|
}
|
|
7765
8324
|
),
|
|
7766
|
-
isComplete && /* @__PURE__ */
|
|
7767
|
-
onNewDeposit && /* @__PURE__ */
|
|
8325
|
+
isComplete && /* @__PURE__ */ jsxs19("div", { className: "rs-screen-button-row", children: [
|
|
8326
|
+
onNewDeposit && /* @__PURE__ */ jsxs19(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: [
|
|
7768
8327
|
"New ",
|
|
7769
8328
|
flowNoun
|
|
7770
8329
|
] }),
|
|
7771
8330
|
onClose && /* @__PURE__ */ jsx27(Button, { onClick: () => onClose("success_done"), fullWidth: true, children: "Done" })
|
|
7772
8331
|
] }),
|
|
7773
|
-
isFailed && /* @__PURE__ */
|
|
8332
|
+
isFailed && /* @__PURE__ */ jsxs19("div", { className: "rs-screen-button-row", children: [
|
|
7774
8333
|
onClose && /* @__PURE__ */ jsx27(
|
|
7775
8334
|
Button,
|
|
7776
8335
|
{
|
|
@@ -7982,36 +8541,24 @@ function mapError(error) {
|
|
|
7982
8541
|
|
|
7983
8542
|
export {
|
|
7984
8543
|
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,
|
|
8544
|
+
Callout,
|
|
8002
8545
|
CdnIcon,
|
|
8003
8546
|
ListRow,
|
|
8004
8547
|
PoweredBy,
|
|
8005
|
-
Spinner,
|
|
8006
8548
|
catalogKeyForChain,
|
|
8007
8549
|
debugLog,
|
|
8008
8550
|
debugError,
|
|
8551
|
+
SOLANA_TOKENS,
|
|
8552
|
+
resolveSolanaToken,
|
|
8553
|
+
isNativeSol,
|
|
8554
|
+
hostedOrderStateFromSwapped,
|
|
8555
|
+
mergeHostedOrderState,
|
|
8556
|
+
hasReached,
|
|
8009
8557
|
getAssetId,
|
|
8010
8558
|
chainIdsByValue,
|
|
8011
8559
|
portfolioToAssets,
|
|
8012
8560
|
isNativeAsset,
|
|
8013
8561
|
quoteFeeRow,
|
|
8014
|
-
SwappedConnectFeeChangedError,
|
|
8015
8562
|
SUPPORTED_CONNECT_EXCHANGE_COUNT,
|
|
8016
8563
|
resolveAppFeeBps,
|
|
8017
8564
|
isDepositPolicyRefusal,
|
|
@@ -8041,10 +8588,15 @@ export {
|
|
|
8041
8588
|
ChainCatalogProvider,
|
|
8042
8589
|
getExchangeLogoSrc,
|
|
8043
8590
|
getExchangeLogo,
|
|
8044
|
-
useLatestRef,
|
|
8045
8591
|
Button,
|
|
8046
|
-
|
|
8592
|
+
assetIdFor,
|
|
8593
|
+
AssetMetadataProvider,
|
|
8594
|
+
useAssetStore,
|
|
8047
8595
|
TokenIcon,
|
|
8596
|
+
resolveCuratedToken,
|
|
8597
|
+
useTokenDisplays,
|
|
8598
|
+
useTokenDisplay,
|
|
8599
|
+
useIsRecognizedToken,
|
|
8048
8600
|
currencyFormatter,
|
|
8049
8601
|
tokenFormatter,
|
|
8050
8602
|
isUnsupportedChainSwitchError,
|
|
@@ -8055,7 +8607,6 @@ export {
|
|
|
8055
8607
|
isSubmissionUncertain,
|
|
8056
8608
|
formatTokenAmount,
|
|
8057
8609
|
isDisplayStablecoinSymbol,
|
|
8058
|
-
isRecognizedToken,
|
|
8059
8610
|
formatQuotedReceive,
|
|
8060
8611
|
formatReceiveEstimate,
|
|
8061
8612
|
getEventTxHash,
|
|
@@ -8064,7 +8615,6 @@ export {
|
|
|
8064
8615
|
isFailedEvent,
|
|
8065
8616
|
txRefsMatch,
|
|
8066
8617
|
failureMessageForEvent,
|
|
8067
|
-
fetchTokenPriceUsd,
|
|
8068
8618
|
useTokenPrices,
|
|
8069
8619
|
ProcessingStep,
|
|
8070
8620
|
AnalyticsSession,
|