@rhinestone/deposit-modal 0.2.4 → 0.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -211
- package/dist/{DepositModalReown-CY5MSQGK.mjs → DepositModalReown-GXY65HZP.mjs} +3 -3
- package/dist/{DepositModalReown-2UMPITRN.cjs → DepositModalReown-HVIEA6YA.cjs} +4 -4
- package/dist/QRCode-SMMYPUQC.cjs +58 -0
- package/dist/QRCode-YMQTKSSK.mjs +58 -0
- package/dist/{WithdrawModalReown-Z5BUZQ4Z.cjs → WithdrawModalReown-4M3PBY2T.cjs} +4 -4
- package/dist/{WithdrawModalReown-YSRO5ZTA.mjs → WithdrawModalReown-O6V6KRH6.mjs} +3 -3
- package/dist/{chunk-ARGMXV6E.cjs → chunk-7SYZG47X.cjs} +1723 -1881
- package/dist/{chunk-WHW3ZMOT.mjs → chunk-EEHUOFIW.mjs} +107 -90
- package/dist/{chunk-KJEHVIPZ.mjs → chunk-FKPTIHU7.mjs} +631 -423
- package/dist/{chunk-HFQV7EHS.mjs → chunk-U5QIFNG4.mjs} +1774 -1932
- package/dist/{chunk-WNFGZS56.mjs → chunk-UIHAYD7J.mjs} +1079 -784
- package/dist/{chunk-R2HP743T.cjs → chunk-XCAF6B3D.cjs} +51 -34
- package/dist/{chunk-NFXJEOE6.cjs → chunk-Y3RA3YGA.cjs} +1101 -806
- package/dist/{chunk-QUOP5C6V.cjs → chunk-Z2SIC2TH.cjs} +686 -478
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -3
- package/dist/deposit.d.ts +2 -3
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +4 -4
- package/dist/styles.css +1068 -752
- package/dist/{types-DGQzvl6v.d.ts → types-DRou84ZM.d.cts} +147 -33
- package/dist/{types-DJ1fzNC7.d.cts → types-DRou84ZM.d.ts} +147 -33
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -3
- package/dist/withdraw.d.ts +2 -3
- package/dist/withdraw.mjs +3 -3
- package/package.json +13 -12
- package/dist/reown.cjs +0 -16
- package/dist/reown.d.cts +0 -10
- package/dist/reown.d.ts +0 -10
- package/dist/reown.mjs +0 -16
- package/dist/safe.cjs +0 -1
- package/dist/safe.d.cts +0 -62
- package/dist/safe.d.ts +0 -62
- package/dist/safe.mjs +0 -0
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
getChainIcon,
|
|
5
5
|
getChainName,
|
|
6
6
|
getExplorerTxUrl,
|
|
7
|
+
getSupportedChainIds,
|
|
7
8
|
getTokenAddress,
|
|
8
9
|
getTokenDecimalsByAddress,
|
|
9
10
|
getTokenIcon,
|
|
10
11
|
getTokenSymbol
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EEHUOFIW.mjs";
|
|
12
13
|
|
|
13
14
|
// src/components/ui/Modal.tsx
|
|
14
15
|
import {
|
|
@@ -141,6 +142,46 @@ function Modal({
|
|
|
141
142
|
}
|
|
142
143
|
Modal.displayName = "Modal";
|
|
143
144
|
|
|
145
|
+
// src/components/ui/Icons.tsx
|
|
146
|
+
import {
|
|
147
|
+
Wallet,
|
|
148
|
+
ExternalLink,
|
|
149
|
+
Coins,
|
|
150
|
+
Check,
|
|
151
|
+
ChevronRight,
|
|
152
|
+
ChevronLeft,
|
|
153
|
+
ChevronDown,
|
|
154
|
+
X,
|
|
155
|
+
HandCoins,
|
|
156
|
+
History,
|
|
157
|
+
Info,
|
|
158
|
+
Copy,
|
|
159
|
+
ArrowRight,
|
|
160
|
+
AlertTriangle,
|
|
161
|
+
Percent,
|
|
162
|
+
Clock,
|
|
163
|
+
CirclePlus,
|
|
164
|
+
CircleArrowOutUpLeft
|
|
165
|
+
} from "lucide-react";
|
|
166
|
+
var WalletIcon = Wallet;
|
|
167
|
+
var ExternalLinkIcon = ExternalLink;
|
|
168
|
+
var CheckIcon = Check;
|
|
169
|
+
var ChevronRightIcon = ChevronRight;
|
|
170
|
+
var ChevronLeftIcon = ChevronLeft;
|
|
171
|
+
var ChevronDownIcon = ChevronDown;
|
|
172
|
+
var CloseIcon = X;
|
|
173
|
+
var HandCoinsIcon = HandCoins;
|
|
174
|
+
var CoinsIcon = Coins;
|
|
175
|
+
var HistoryIcon = History;
|
|
176
|
+
var InfoIcon = Info;
|
|
177
|
+
var CopyIcon = Copy;
|
|
178
|
+
var ArrowRightIcon = ArrowRight;
|
|
179
|
+
var AlertTriangleIcon = AlertTriangle;
|
|
180
|
+
var PercentIcon = Percent;
|
|
181
|
+
var ClockIcon = Clock;
|
|
182
|
+
var PlusCircleIcon = CirclePlus;
|
|
183
|
+
var CircleArrowOutUpLeftIcon = CircleArrowOutUpLeft;
|
|
184
|
+
|
|
144
185
|
// src/core/debug.ts
|
|
145
186
|
function truncateString(value, max = 240) {
|
|
146
187
|
if (value.length <= max) return value;
|
|
@@ -214,6 +255,48 @@ function isSolanaCaip2(value) {
|
|
|
214
255
|
return typeof value === "string" && value.startsWith("solana:");
|
|
215
256
|
}
|
|
216
257
|
|
|
258
|
+
// src/core/deposit-asset-helpers.ts
|
|
259
|
+
function getAssetId(asset) {
|
|
260
|
+
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
261
|
+
}
|
|
262
|
+
function isEvmAddress(value) {
|
|
263
|
+
return /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
264
|
+
}
|
|
265
|
+
function portfolioTokenToAsset(token) {
|
|
266
|
+
if (typeof token.chainId !== "number") return null;
|
|
267
|
+
if (!isEvmAddress(token.address)) return null;
|
|
268
|
+
return {
|
|
269
|
+
id: getAssetId({ chainId: token.chainId, token: token.address }),
|
|
270
|
+
chainId: token.chainId,
|
|
271
|
+
token: token.address,
|
|
272
|
+
symbol: token.symbol,
|
|
273
|
+
name: token.name,
|
|
274
|
+
decimals: token.decimals,
|
|
275
|
+
balance: token.balance,
|
|
276
|
+
balanceUsd: token.balanceUsd
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function safeBigInt(value) {
|
|
280
|
+
if (!value) return BigInt(0);
|
|
281
|
+
try {
|
|
282
|
+
return BigInt(value);
|
|
283
|
+
} catch {
|
|
284
|
+
return BigInt(0);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function portfolioToAssets(tokens) {
|
|
288
|
+
return tokens.map(portfolioTokenToAsset).filter((token) => token !== null).sort((a, b) => {
|
|
289
|
+
const balanceA = safeBigInt(a.balance);
|
|
290
|
+
const balanceB = safeBigInt(b.balance);
|
|
291
|
+
if (balanceB > balanceA) return 1;
|
|
292
|
+
if (balanceB < balanceA) return -1;
|
|
293
|
+
return 0;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function isNativeAsset(asset) {
|
|
297
|
+
return asset.token.toLowerCase() === "0x0000000000000000000000000000000000000000";
|
|
298
|
+
}
|
|
299
|
+
|
|
217
300
|
// src/core/deposit-service.ts
|
|
218
301
|
function depositRowToEvent(row) {
|
|
219
302
|
const status = row.status;
|
|
@@ -359,6 +442,25 @@ function createDepositService(baseUrl, options) {
|
|
|
359
442
|
if (value.length <= 20) return value;
|
|
360
443
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
361
444
|
}
|
|
445
|
+
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
446
|
+
const portfolioCache = /* @__PURE__ */ new Map();
|
|
447
|
+
function cachedPortfolio(key, fetcher) {
|
|
448
|
+
const now = Date.now();
|
|
449
|
+
const entry = portfolioCache.get(key);
|
|
450
|
+
if (entry && entry.expiresAt > now) {
|
|
451
|
+
debugLog(debug, scope, "portfolio:cache-hit", { key });
|
|
452
|
+
return entry.promise;
|
|
453
|
+
}
|
|
454
|
+
const promise = fetcher().catch((err) => {
|
|
455
|
+
portfolioCache.delete(key);
|
|
456
|
+
throw err;
|
|
457
|
+
});
|
|
458
|
+
portfolioCache.set(key, {
|
|
459
|
+
promise,
|
|
460
|
+
expiresAt: now + PORTFOLIO_CACHE_TTL_MS
|
|
461
|
+
});
|
|
462
|
+
return promise;
|
|
463
|
+
}
|
|
362
464
|
return {
|
|
363
465
|
async setupAccount(params) {
|
|
364
466
|
const url = apiUrl("/setup-account");
|
|
@@ -443,78 +545,82 @@ function createDepositService(baseUrl, options) {
|
|
|
443
545
|
return result;
|
|
444
546
|
},
|
|
445
547
|
async fetchPortfolio(address) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
548
|
+
return cachedPortfolio(`evm:${address.toLowerCase()}`, async () => {
|
|
549
|
+
const url = apiUrl(`/portfolio/${address}`);
|
|
550
|
+
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
551
|
+
const response = await fetch(url, {
|
|
552
|
+
method: "GET",
|
|
553
|
+
headers: { "Content-Type": "application/json" }
|
|
554
|
+
});
|
|
555
|
+
if (!response.ok) {
|
|
556
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
557
|
+
debugError(
|
|
558
|
+
debug,
|
|
559
|
+
scope,
|
|
560
|
+
"fetchPortfolio:failed",
|
|
561
|
+
error,
|
|
562
|
+
{ status: response.status, address }
|
|
563
|
+
);
|
|
564
|
+
throw new Error(
|
|
565
|
+
error.error || `Portfolio fetch failed: ${response.status}`
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
const data = await response.json();
|
|
569
|
+
const direct = normalizeDirectPortfolio(data);
|
|
570
|
+
if (direct.tokens.length > 0) {
|
|
571
|
+
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
572
|
+
address,
|
|
573
|
+
source: "direct",
|
|
574
|
+
tokenCount: direct.tokens.length,
|
|
575
|
+
totalUsd: direct.totalUsd
|
|
576
|
+
});
|
|
577
|
+
return direct;
|
|
578
|
+
}
|
|
579
|
+
const portfolioData = extractOrchestratorPortfolio(data);
|
|
580
|
+
if (portfolioData) {
|
|
581
|
+
const normalized = normalizeOrchestratorPortfolio(portfolioData);
|
|
582
|
+
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
583
|
+
address,
|
|
584
|
+
source: "orchestrator",
|
|
585
|
+
tokenCount: normalized.tokens.length,
|
|
586
|
+
totalUsd: normalized.totalUsd
|
|
587
|
+
});
|
|
588
|
+
return normalized;
|
|
589
|
+
}
|
|
590
|
+
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
591
|
+
return { tokens: [], totalUsd: 0 };
|
|
451
592
|
});
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
{
|
|
460
|
-
);
|
|
461
|
-
throw new Error(
|
|
462
|
-
error.error || `Portfolio fetch failed: ${response.status}`
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
const data = await response.json();
|
|
466
|
-
const direct = normalizeDirectPortfolio(data);
|
|
467
|
-
if (direct.tokens.length > 0) {
|
|
468
|
-
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
469
|
-
address,
|
|
470
|
-
source: "direct",
|
|
471
|
-
tokenCount: direct.tokens.length,
|
|
472
|
-
totalUsd: direct.totalUsd
|
|
593
|
+
},
|
|
594
|
+
async fetchSolanaPortfolio(address) {
|
|
595
|
+
return cachedPortfolio(`sol:${address}`, async () => {
|
|
596
|
+
const url = apiUrl(`/portfolio/solana/${address}`);
|
|
597
|
+
debugLog(debug, scope, "fetchSolanaPortfolio:request", { url, address });
|
|
598
|
+
const response = await fetch(url, {
|
|
599
|
+
method: "GET",
|
|
600
|
+
headers: { "Content-Type": "application/json" }
|
|
473
601
|
});
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
602
|
+
if (!response.ok) {
|
|
603
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
604
|
+
debugError(
|
|
605
|
+
debug,
|
|
606
|
+
scope,
|
|
607
|
+
"fetchSolanaPortfolio:failed",
|
|
608
|
+
error,
|
|
609
|
+
{ status: response.status, address }
|
|
610
|
+
);
|
|
611
|
+
throw new Error(
|
|
612
|
+
error.error || `Solana portfolio fetch failed: ${response.status}`
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
const data = await response.json();
|
|
616
|
+
const normalized = normalizeDirectPortfolio(data);
|
|
617
|
+
debugLog(debug, scope, "fetchSolanaPortfolio:success", {
|
|
480
618
|
address,
|
|
481
|
-
source: "orchestrator",
|
|
482
619
|
tokenCount: normalized.tokens.length,
|
|
483
620
|
totalUsd: normalized.totalUsd
|
|
484
621
|
});
|
|
485
622
|
return normalized;
|
|
486
|
-
}
|
|
487
|
-
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
488
|
-
return { tokens: [], totalUsd: 0 };
|
|
489
|
-
},
|
|
490
|
-
async fetchSolanaPortfolio(address) {
|
|
491
|
-
const url = apiUrl(`/portfolio/solana/${address}`);
|
|
492
|
-
debugLog(debug, scope, "fetchSolanaPortfolio:request", { url, address });
|
|
493
|
-
const response = await fetch(url, {
|
|
494
|
-
method: "GET",
|
|
495
|
-
headers: { "Content-Type": "application/json" }
|
|
496
623
|
});
|
|
497
|
-
if (!response.ok) {
|
|
498
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
499
|
-
debugError(
|
|
500
|
-
debug,
|
|
501
|
-
scope,
|
|
502
|
-
"fetchSolanaPortfolio:failed",
|
|
503
|
-
error,
|
|
504
|
-
{ status: response.status, address }
|
|
505
|
-
);
|
|
506
|
-
throw new Error(
|
|
507
|
-
error.error || `Solana portfolio fetch failed: ${response.status}`
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
const data = await response.json();
|
|
511
|
-
const normalized = normalizeDirectPortfolio(data);
|
|
512
|
-
debugLog(debug, scope, "fetchSolanaPortfolio:success", {
|
|
513
|
-
address,
|
|
514
|
-
tokenCount: normalized.tokens.length,
|
|
515
|
-
totalUsd: normalized.totalUsd
|
|
516
|
-
});
|
|
517
|
-
return normalized;
|
|
518
624
|
},
|
|
519
625
|
async checkAccount(address) {
|
|
520
626
|
const url = apiUrl(`/check/${address}`);
|
|
@@ -857,111 +963,6 @@ function extractNumericString(data, key) {
|
|
|
857
963
|
const parsed = Number(value);
|
|
858
964
|
return Number.isFinite(parsed) ? parsed : null;
|
|
859
965
|
}
|
|
860
|
-
function getAssetId(asset) {
|
|
861
|
-
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
862
|
-
}
|
|
863
|
-
function isEvmAddress(value) {
|
|
864
|
-
return /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
865
|
-
}
|
|
866
|
-
function portfolioTokenToAsset(token) {
|
|
867
|
-
if (typeof token.chainId !== "number") return null;
|
|
868
|
-
if (!isEvmAddress(token.address)) return null;
|
|
869
|
-
return {
|
|
870
|
-
id: getAssetId({ chainId: token.chainId, token: token.address }),
|
|
871
|
-
chainId: token.chainId,
|
|
872
|
-
token: token.address,
|
|
873
|
-
symbol: token.symbol,
|
|
874
|
-
name: token.name,
|
|
875
|
-
decimals: token.decimals,
|
|
876
|
-
balance: token.balance,
|
|
877
|
-
balanceUsd: token.balanceUsd
|
|
878
|
-
};
|
|
879
|
-
}
|
|
880
|
-
function portfolioToAssets(tokens) {
|
|
881
|
-
return tokens.map(portfolioTokenToAsset).filter((token) => token !== null).sort((a, b) => {
|
|
882
|
-
const balanceA = safeBigInt(a.balance);
|
|
883
|
-
const balanceB = safeBigInt(b.balance);
|
|
884
|
-
if (balanceB > balanceA) return 1;
|
|
885
|
-
if (balanceB < balanceA) return -1;
|
|
886
|
-
return 0;
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
function safeBigInt(value) {
|
|
890
|
-
if (!value) return BigInt(0);
|
|
891
|
-
try {
|
|
892
|
-
return BigInt(value);
|
|
893
|
-
} catch {
|
|
894
|
-
return BigInt(0);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
function isNativeAsset(asset) {
|
|
898
|
-
return asset.token.toLowerCase() === "0x0000000000000000000000000000000000000000";
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
// src/core/formatters.ts
|
|
902
|
-
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
903
|
-
style: "currency",
|
|
904
|
-
currency: "USD",
|
|
905
|
-
maximumFractionDigits: 2
|
|
906
|
-
});
|
|
907
|
-
var tokenFormatter = new Intl.NumberFormat("en-US", {
|
|
908
|
-
maximumFractionDigits: 6
|
|
909
|
-
});
|
|
910
|
-
function formatUserError(raw) {
|
|
911
|
-
const lower = raw.toLowerCase();
|
|
912
|
-
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
913
|
-
return "Transaction cancelled";
|
|
914
|
-
}
|
|
915
|
-
if (lower.includes("insufficient funds")) {
|
|
916
|
-
return "Insufficient funds for this transaction";
|
|
917
|
-
}
|
|
918
|
-
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
919
|
-
return "Transaction conflict \u2014 please try again";
|
|
920
|
-
}
|
|
921
|
-
if (lower.includes("execution reverted")) {
|
|
922
|
-
return "Transaction would fail on-chain";
|
|
923
|
-
}
|
|
924
|
-
if (lower.includes("timed out") || lower.includes("took too long")) {
|
|
925
|
-
return "Request timed out \u2014 please try again";
|
|
926
|
-
}
|
|
927
|
-
if (lower.includes("econnrefused") || lower.includes("econnreset") || lower.includes("enotfound") || lower.includes("fetch failed")) {
|
|
928
|
-
return "Service unavailable \u2014 please try again";
|
|
929
|
-
}
|
|
930
|
-
if (lower.includes("recent blockhash") || lower.includes("latest blockhash")) {
|
|
931
|
-
return "Solana RPC unavailable \u2014 please retry";
|
|
932
|
-
}
|
|
933
|
-
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
934
|
-
return "Network error \u2014 check your connection";
|
|
935
|
-
}
|
|
936
|
-
if (lower.includes("rate limit") || lower.includes("429")) {
|
|
937
|
-
return "Rate limited \u2014 please try again shortly";
|
|
938
|
-
}
|
|
939
|
-
let cleaned = raw;
|
|
940
|
-
const stripMarkers = [
|
|
941
|
-
"\n\nRequest Arguments:",
|
|
942
|
-
"\nRaw Call Arguments:",
|
|
943
|
-
"\nRequest body:",
|
|
944
|
-
"\nContract Call:",
|
|
945
|
-
"\nDocs:",
|
|
946
|
-
"\nDetails:",
|
|
947
|
-
"\nVersion:",
|
|
948
|
-
"\nURL:"
|
|
949
|
-
];
|
|
950
|
-
for (const marker of stripMarkers) {
|
|
951
|
-
const idx = cleaned.indexOf(marker);
|
|
952
|
-
if (idx !== -1) {
|
|
953
|
-
cleaned = cleaned.slice(0, idx).trim();
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
cleaned = cleaned.replace(/https?:\/\/\S+/g, "").trim();
|
|
957
|
-
if (cleaned.length === 0) {
|
|
958
|
-
return "An unexpected error occurred";
|
|
959
|
-
}
|
|
960
|
-
if (cleaned.length > 120) {
|
|
961
|
-
return cleaned.slice(0, 120) + "...";
|
|
962
|
-
}
|
|
963
|
-
return cleaned;
|
|
964
|
-
}
|
|
965
966
|
|
|
966
967
|
// src/core/useLatestRef.ts
|
|
967
968
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
@@ -986,14 +987,100 @@ function setVar(targets, prop, value) {
|
|
|
986
987
|
el.style.setProperty(prop, value);
|
|
987
988
|
}
|
|
988
989
|
}
|
|
990
|
+
function clearVar(targets, prop) {
|
|
991
|
+
for (const el of targets) {
|
|
992
|
+
el.style.removeProperty(prop);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
function normalizeHex(input) {
|
|
996
|
+
const v = input.trim().replace(/^#/, "");
|
|
997
|
+
if (/^[0-9a-fA-F]{3}$/.test(v)) {
|
|
998
|
+
return v.split("").map((c) => c + c).join("").toLowerCase();
|
|
999
|
+
}
|
|
1000
|
+
if (/^[0-9a-fA-F]{6}$/.test(v)) return v.toLowerCase();
|
|
1001
|
+
return null;
|
|
1002
|
+
}
|
|
1003
|
+
function hexToHsl(hex) {
|
|
1004
|
+
const normalized = normalizeHex(hex);
|
|
1005
|
+
if (!normalized) return null;
|
|
1006
|
+
const r = parseInt(normalized.slice(0, 2), 16) / 255;
|
|
1007
|
+
const g = parseInt(normalized.slice(2, 4), 16) / 255;
|
|
1008
|
+
const b = parseInt(normalized.slice(4, 6), 16) / 255;
|
|
1009
|
+
const max = Math.max(r, g, b);
|
|
1010
|
+
const min = Math.min(r, g, b);
|
|
1011
|
+
const l = (max + min) / 2;
|
|
1012
|
+
let h = 0;
|
|
1013
|
+
let s = 0;
|
|
1014
|
+
if (max !== min) {
|
|
1015
|
+
const d = max - min;
|
|
1016
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1017
|
+
switch (max) {
|
|
1018
|
+
case r:
|
|
1019
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1020
|
+
break;
|
|
1021
|
+
case g:
|
|
1022
|
+
h = (b - r) / d + 2;
|
|
1023
|
+
break;
|
|
1024
|
+
case b:
|
|
1025
|
+
h = (r - g) / d + 4;
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
h *= 60;
|
|
1029
|
+
}
|
|
1030
|
+
return { h, s: s * 100, l: l * 100 };
|
|
1031
|
+
}
|
|
1032
|
+
var clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
1033
|
+
var hsl = ({ h, s, l }) => `hsl(${h.toFixed(1)} ${clamp(s, 0, 100).toFixed(1)}% ${clamp(l, 0, 100).toFixed(1)}%)`;
|
|
1034
|
+
function deriveCustomPrimary(baseHex) {
|
|
1035
|
+
const base = hexToHsl(baseHex);
|
|
1036
|
+
if (!base) return null;
|
|
1037
|
+
const { h, s, l } = base;
|
|
1038
|
+
const direction = l < 25 ? 1 : -1;
|
|
1039
|
+
const hoverL = clamp(l + 8 * direction, 4, 96);
|
|
1040
|
+
const activeL = clamp(l + 14 * direction, 2, 98);
|
|
1041
|
+
const disabledBg = {
|
|
1042
|
+
h,
|
|
1043
|
+
s: clamp(s * 0.25, 0, 20),
|
|
1044
|
+
l: clamp(l > 75 ? l - 15 : 88, 12, 92)
|
|
1045
|
+
};
|
|
1046
|
+
const disabledFg = {
|
|
1047
|
+
h,
|
|
1048
|
+
s: clamp(s * 0.35, 0, 25),
|
|
1049
|
+
l: clamp(l > 75 ? 35 : 45, 30, 60)
|
|
1050
|
+
};
|
|
1051
|
+
const norm = normalizeHex(baseHex);
|
|
1052
|
+
const ch = (i) => {
|
|
1053
|
+
const v = parseInt(norm.slice(i, i + 2), 16) / 255;
|
|
1054
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
1055
|
+
};
|
|
1056
|
+
const y = 0.2126 * ch(0) + 0.7152 * ch(2) + 0.0722 * ch(4);
|
|
1057
|
+
const foreground = y > 0.45 ? "#18181b" : "#fafafa";
|
|
1058
|
+
return {
|
|
1059
|
+
base: hsl({ h, s, l }),
|
|
1060
|
+
hover: hsl({ h, s, l: hoverL }),
|
|
1061
|
+
active: hsl({ h, s, l: activeL }),
|
|
1062
|
+
disabledBg: hsl(disabledBg),
|
|
1063
|
+
disabledFg: hsl(disabledFg),
|
|
1064
|
+
foreground
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
var CUSTOM_PRIMARY_VARS = [
|
|
1068
|
+
"--rs-primary",
|
|
1069
|
+
"--rs-primary-hover",
|
|
1070
|
+
"--rs-primary-active",
|
|
1071
|
+
"--rs-primary-disabled-bg",
|
|
1072
|
+
"--rs-primary-disabled-fg",
|
|
1073
|
+
"--rs-primary-foreground",
|
|
1074
|
+
"--rs-border-accent"
|
|
1075
|
+
];
|
|
989
1076
|
function applyTheme(element, theme) {
|
|
990
1077
|
if (!element) return;
|
|
991
1078
|
const parent = element.parentElement;
|
|
992
1079
|
const targets = parent?.classList.contains("rs-modal-content") ? [element, parent] : [element];
|
|
993
1080
|
if (theme?.mode) {
|
|
994
|
-
|
|
1081
|
+
for (const t of targets) t.setAttribute("data-theme", theme.mode);
|
|
995
1082
|
} else {
|
|
996
|
-
|
|
1083
|
+
for (const t of targets) t.removeAttribute("data-theme");
|
|
997
1084
|
}
|
|
998
1085
|
if (theme?.fontColor) {
|
|
999
1086
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
@@ -1002,15 +1089,33 @@ function applyTheme(element, theme) {
|
|
|
1002
1089
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
1003
1090
|
}
|
|
1004
1091
|
if (theme?.ctaColor) {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1092
|
+
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
1093
|
+
if (derived) {
|
|
1094
|
+
setVar(targets, "--rs-primary", derived.base);
|
|
1095
|
+
setVar(
|
|
1096
|
+
targets,
|
|
1097
|
+
"--rs-primary-hover",
|
|
1098
|
+
theme.ctaHoverColor ?? derived.hover
|
|
1099
|
+
);
|
|
1100
|
+
setVar(targets, "--rs-primary-active", derived.active);
|
|
1101
|
+
setVar(targets, "--rs-primary-disabled-bg", derived.disabledBg);
|
|
1102
|
+
setVar(targets, "--rs-primary-disabled-fg", derived.disabledFg);
|
|
1103
|
+
setVar(targets, "--rs-primary-foreground", derived.foreground);
|
|
1104
|
+
setVar(targets, "--rs-border-accent", derived.base);
|
|
1105
|
+
} else {
|
|
1106
|
+
setVar(targets, "--rs-primary", theme.ctaColor);
|
|
1107
|
+
setVar(targets, "--rs-border-accent", theme.ctaColor);
|
|
1108
|
+
setVar(
|
|
1109
|
+
targets,
|
|
1110
|
+
"--rs-primary-hover",
|
|
1111
|
+
theme.ctaHoverColor ?? theme.ctaColor
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
1116
|
+
if (theme?.ctaHoverColor) {
|
|
1117
|
+
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
1118
|
+
}
|
|
1014
1119
|
}
|
|
1015
1120
|
if (theme?.borderColor) {
|
|
1016
1121
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
@@ -1028,355 +1133,494 @@ function applyTheme(element, theme) {
|
|
|
1028
1133
|
}
|
|
1029
1134
|
}
|
|
1030
1135
|
|
|
1031
|
-
// src/components/ui/
|
|
1136
|
+
// src/components/ui/BodyHeader.tsx
|
|
1032
1137
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1033
|
-
function
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1138
|
+
function BodyHeader({
|
|
1139
|
+
icon,
|
|
1140
|
+
title,
|
|
1141
|
+
subtitle,
|
|
1142
|
+
variant = "default"
|
|
1143
|
+
}) {
|
|
1144
|
+
const iconClasses = [
|
|
1145
|
+
"rs-body-header-icon",
|
|
1146
|
+
variant === "success" ? "rs-body-header-icon--success" : "",
|
|
1147
|
+
variant === "error" ? "rs-body-header-icon--error" : ""
|
|
1148
|
+
].filter(Boolean).join(" ");
|
|
1149
|
+
return /* @__PURE__ */ jsxs("div", { className: "rs-body-header", children: [
|
|
1150
|
+
/* @__PURE__ */ jsx2("div", { className: iconClasses, children: icon }),
|
|
1151
|
+
/* @__PURE__ */ jsxs("div", { className: "rs-body-header-text", children: [
|
|
1152
|
+
/* @__PURE__ */ jsx2("h2", { className: "rs-body-header-title", children: title }),
|
|
1153
|
+
subtitle && /* @__PURE__ */ jsx2("p", { className: "rs-body-header-subtitle", children: subtitle })
|
|
1154
|
+
] })
|
|
1155
|
+
] });
|
|
1156
|
+
}
|
|
1157
|
+
BodyHeader.displayName = "BodyHeader";
|
|
1158
|
+
|
|
1159
|
+
// src/components/ui/PoweredBy.tsx
|
|
1160
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1161
|
+
var rhinestoneLogo = /* @__PURE__ */ jsxs2(
|
|
1162
|
+
"svg",
|
|
1163
|
+
{
|
|
1164
|
+
className: "rs-powered-by-logo",
|
|
1165
|
+
viewBox: "0 0 72 16",
|
|
1166
|
+
fill: "none",
|
|
1167
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1168
|
+
"aria-hidden": "true",
|
|
1169
|
+
children: [
|
|
1170
|
+
/* @__PURE__ */ jsxs2("g", { fill: "currentColor", clipPath: "url(#rs-pb-clip)", children: [
|
|
1171
|
+
/* @__PURE__ */ jsx3(
|
|
1042
1172
|
"path",
|
|
1043
1173
|
{
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1174
|
+
opacity: "0.5",
|
|
1175
|
+
fillRule: "evenodd",
|
|
1176
|
+
clipRule: "evenodd",
|
|
1177
|
+
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"
|
|
1047
1178
|
}
|
|
1048
1179
|
),
|
|
1049
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx3("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" }),
|
|
1181
|
+
/* @__PURE__ */ jsx3(
|
|
1050
1182
|
"path",
|
|
1051
1183
|
{
|
|
1052
|
-
|
|
1053
|
-
|
|
1184
|
+
fillRule: "evenodd",
|
|
1185
|
+
clipRule: "evenodd",
|
|
1186
|
+
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"
|
|
1054
1187
|
}
|
|
1055
|
-
)
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ jsx3("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" }),
|
|
1190
|
+
/* @__PURE__ */ jsx3(
|
|
1191
|
+
"path",
|
|
1192
|
+
{
|
|
1193
|
+
fillRule: "evenodd",
|
|
1194
|
+
clipRule: "evenodd",
|
|
1195
|
+
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"
|
|
1196
|
+
}
|
|
1197
|
+
),
|
|
1198
|
+
/* @__PURE__ */ jsx3("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" }),
|
|
1199
|
+
/* @__PURE__ */ jsx3(
|
|
1200
|
+
"path",
|
|
1201
|
+
{
|
|
1202
|
+
fillRule: "evenodd",
|
|
1203
|
+
clipRule: "evenodd",
|
|
1204
|
+
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"
|
|
1205
|
+
}
|
|
1206
|
+
),
|
|
1207
|
+
/* @__PURE__ */ jsx3("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" })
|
|
1208
|
+
] }),
|
|
1209
|
+
/* @__PURE__ */ jsx3("defs", { children: /* @__PURE__ */ jsx3("clipPath", { id: "rs-pb-clip", children: /* @__PURE__ */ jsx3("path", { fill: "#fff", d: "M0 0h72v16H0z" }) }) })
|
|
1210
|
+
]
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
function PoweredBy() {
|
|
1214
|
+
return /* @__PURE__ */ jsxs2("div", { className: "rs-powered-by", "aria-label": "Powered by Rhinestone", children: [
|
|
1215
|
+
/* @__PURE__ */ jsx3("span", { children: "Powered by" }),
|
|
1216
|
+
/* @__PURE__ */ jsx3(
|
|
1217
|
+
"a",
|
|
1218
|
+
{
|
|
1219
|
+
className: "rs-powered-by-link",
|
|
1220
|
+
href: "https://www.rhinestone.dev",
|
|
1221
|
+
target: "_blank",
|
|
1222
|
+
rel: "noopener noreferrer",
|
|
1223
|
+
children: rhinestoneLogo
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
] });
|
|
1227
|
+
}
|
|
1228
|
+
PoweredBy.displayName = "PoweredBy";
|
|
1229
|
+
|
|
1230
|
+
// src/components/ui/ListRow.tsx
|
|
1231
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1232
|
+
function ListRow({
|
|
1233
|
+
leading,
|
|
1234
|
+
leadingMedia,
|
|
1235
|
+
title,
|
|
1236
|
+
subtitle,
|
|
1237
|
+
meta,
|
|
1238
|
+
trailing,
|
|
1239
|
+
className = "",
|
|
1240
|
+
...props
|
|
1072
1241
|
}) {
|
|
1073
|
-
|
|
1074
|
-
"rs-button",
|
|
1075
|
-
`rs-button--${variant}`,
|
|
1076
|
-
`rs-button--size-${size}`,
|
|
1077
|
-
fullWidth ? "rs-button--full-width" : "",
|
|
1078
|
-
className
|
|
1079
|
-
].filter(Boolean).join(" ");
|
|
1080
|
-
return /* @__PURE__ */ jsxs2(
|
|
1242
|
+
return /* @__PURE__ */ jsxs3(
|
|
1081
1243
|
"button",
|
|
1082
1244
|
{
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
"aria-busy": loading || void 0,
|
|
1245
|
+
type: "button",
|
|
1246
|
+
className: `rs-list-row ${className}`.trim(),
|
|
1086
1247
|
...props,
|
|
1087
1248
|
children: [
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
|
|
1249
|
+
leadingMedia ? /* @__PURE__ */ jsx4("span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ jsx4("img", { src: leadingMedia, alt: "" }) }) : leading ? /* @__PURE__ */ jsx4("span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
1250
|
+
/* @__PURE__ */ jsxs3("div", { className: "rs-list-row-body", children: [
|
|
1251
|
+
/* @__PURE__ */ jsxs3("div", { className: "rs-list-row-text", children: [
|
|
1252
|
+
/* @__PURE__ */ jsx4("span", { className: "rs-list-row-title", children: title }),
|
|
1253
|
+
subtitle && /* @__PURE__ */ jsx4("span", { className: "rs-list-row-subtitle", children: subtitle })
|
|
1254
|
+
] }),
|
|
1255
|
+
meta && /* @__PURE__ */ jsx4("div", { className: "rs-list-row-meta", children: meta })
|
|
1256
|
+
] }),
|
|
1257
|
+
/* @__PURE__ */ jsx4("span", { className: "rs-list-row-chevron", children: trailing ?? /* @__PURE__ */ jsx4(ChevronRightIcon, {}) })
|
|
1090
1258
|
]
|
|
1091
1259
|
}
|
|
1092
1260
|
);
|
|
1093
1261
|
}
|
|
1094
|
-
|
|
1262
|
+
ListRow.displayName = "ListRow";
|
|
1095
1263
|
|
|
1096
|
-
// src/components/ui/
|
|
1097
|
-
import { jsx as
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
"
|
|
1264
|
+
// src/components/ui/WalletBadgeIcons.tsx
|
|
1265
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1266
|
+
var RabbyIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1267
|
+
/* @__PURE__ */ jsxs4("g", { clipPath: "url(#rs-rabby-clip)", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx5(
|
|
1269
|
+
"mask",
|
|
1270
|
+
{
|
|
1271
|
+
id: "rs-rabby-mask",
|
|
1272
|
+
style: { maskType: "luminance" },
|
|
1273
|
+
maskUnits: "userSpaceOnUse",
|
|
1274
|
+
x: "0",
|
|
1275
|
+
y: "0",
|
|
1276
|
+
width: "20",
|
|
1277
|
+
height: "20",
|
|
1278
|
+
children: /* @__PURE__ */ jsx5(
|
|
1279
|
+
"path",
|
|
1280
|
+
{
|
|
1281
|
+
d: "M20 10C20 4.47688 15.5231 0 10 0C4.47688 0 0 4.47688 0 10C0 15.5231 4.47688 20 10 20C15.5231 20 20 15.5231 20 10Z",
|
|
1282
|
+
fill: "white"
|
|
1283
|
+
}
|
|
1284
|
+
)
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
/* @__PURE__ */ jsxs4("g", { mask: "url(#rs-rabby-mask)", children: [
|
|
1288
|
+
/* @__PURE__ */ jsx5(
|
|
1289
|
+
"path",
|
|
1290
|
+
{
|
|
1291
|
+
d: "M20 10C20 4.47688 15.5231 0 10 0C4.47688 0 0 4.47688 0 10C0 15.5231 4.47688 20 10 20C15.5231 20 20 15.5231 20 10Z",
|
|
1292
|
+
fill: "#7084FF"
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ jsx5(
|
|
1296
|
+
"path",
|
|
1297
|
+
{
|
|
1298
|
+
d: "M17.2515 10.8675C17.8265 9.57871 14.9847 5.97871 12.2697 4.47934C10.5584 3.31684 8.77529 3.47684 8.41404 3.98684C7.62154 5.10684 11.039 6.05559 13.3234 7.16184C12.8322 7.37621 12.3697 7.76059 12.0972 8.25184C11.2453 7.31871 9.37529 6.51434 7.18154 7.16246C5.70279 7.59871 4.47404 8.62684 3.99904 10.18C3.85708 10.1175 3.70178 10.0914 3.5472 10.1041C3.39262 10.1168 3.24365 10.1678 3.11376 10.2526C2.98388 10.3373 2.87719 10.4532 2.80336 10.5896C2.72952 10.726 2.69088 10.8786 2.69092 11.0337C2.69092 11.55 3.10717 11.9681 3.62154 11.9681C3.71654 11.9681 4.01467 11.9037 4.01467 11.9037L8.77529 11.9387C6.87154 14.9687 5.36654 15.4118 5.36654 15.9368C5.36654 16.4618 6.80654 16.32 7.34717 16.1243C9.93467 15.1868 12.714 12.2675 13.1909 11.4268C15.1934 11.6775 16.8765 11.7075 17.2515 10.8675Z",
|
|
1299
|
+
fill: "url(#rs-rabby-grad0)"
|
|
1300
|
+
}
|
|
1301
|
+
),
|
|
1302
|
+
/* @__PURE__ */ jsx5(
|
|
1303
|
+
"path",
|
|
1304
|
+
{
|
|
1305
|
+
fillRule: "evenodd",
|
|
1306
|
+
clipRule: "evenodd",
|
|
1307
|
+
d: "M13.3147 7.15865L13.3216 7.16177C13.4279 7.1199 13.4104 6.96302 13.3816 6.8399C13.3147 6.55615 12.161 5.41365 11.0779 4.90177C9.60224 4.20427 8.51536 4.2399 8.35474 4.56177C8.65474 5.18052 10.0485 5.76052 11.5047 6.3674C12.1235 6.6249 12.7529 6.88677 13.3147 7.15865Z",
|
|
1308
|
+
fill: "url(#rs-rabby-grad1)"
|
|
1309
|
+
}
|
|
1310
|
+
),
|
|
1311
|
+
/* @__PURE__ */ jsx5(
|
|
1312
|
+
"path",
|
|
1313
|
+
{
|
|
1314
|
+
fillRule: "evenodd",
|
|
1315
|
+
clipRule: "evenodd",
|
|
1316
|
+
d: "M11.4522 13.3856C11.1193 13.26 10.7791 13.1548 10.4335 13.0706C10.8422 12.3369 10.9278 11.2506 10.5416 10.5644C10.0003 9.60001 9.32033 9.08688 7.73971 9.08688C6.87096 9.08688 4.53096 9.38063 4.48971 11.3406C4.48471 11.5456 4.4895 11.7346 4.50408 11.9075L8.77721 11.9388C8.20096 12.8556 7.66158 13.5363 7.18908 14.0531C7.75596 14.1994 8.22408 14.3219 8.65408 14.4344C9.06158 14.5406 9.43471 14.6381 9.82471 14.7381C10.4141 14.3069 10.9685 13.8381 11.4522 13.3856Z",
|
|
1317
|
+
fill: "url(#rs-rabby-grad2)"
|
|
1318
|
+
}
|
|
1319
|
+
),
|
|
1320
|
+
/* @__PURE__ */ jsx5(
|
|
1321
|
+
"path",
|
|
1322
|
+
{
|
|
1323
|
+
d: "M3.94351 11.7048C4.11789 13.1936 4.96101 13.7773 6.68476 13.9498C8.40851 14.1223 9.39664 14.0067 10.7123 14.1273C11.8116 14.2273 12.7929 14.7898 13.1573 14.5954C13.4848 14.4204 13.301 13.7892 12.8629 13.3836C12.2941 12.8586 11.5079 12.4936 10.1241 12.3642C10.3998 11.6061 10.3223 10.5436 9.89414 9.96543C9.27476 9.1298 8.13164 8.7523 6.68476 8.9173C5.17226 9.0898 3.72414 9.83605 3.94351 11.7048Z",
|
|
1324
|
+
fill: "url(#rs-rabby-grad3)"
|
|
1325
|
+
}
|
|
1326
|
+
)
|
|
1327
|
+
] })
|
|
1328
|
+
] }),
|
|
1329
|
+
/* @__PURE__ */ jsxs4("defs", { children: [
|
|
1330
|
+
/* @__PURE__ */ jsxs4(
|
|
1331
|
+
"linearGradient",
|
|
1102
1332
|
{
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1333
|
+
id: "rs-rabby-grad0",
|
|
1334
|
+
x1: "7.00904",
|
|
1335
|
+
y1: "9.72621",
|
|
1336
|
+
x2: "17.1328",
|
|
1337
|
+
y2: "12.5875",
|
|
1338
|
+
gradientUnits: "userSpaceOnUse",
|
|
1339
|
+
children: [
|
|
1340
|
+
/* @__PURE__ */ jsx5("stop", { stopColor: "white" }),
|
|
1341
|
+
/* @__PURE__ */ jsx5("stop", { offset: "1", stopColor: "white" })
|
|
1342
|
+
]
|
|
1110
1343
|
}
|
|
1111
1344
|
),
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
"
|
|
1345
|
+
/* @__PURE__ */ jsxs4(
|
|
1346
|
+
"linearGradient",
|
|
1114
1347
|
{
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1348
|
+
id: "rs-rabby-grad1",
|
|
1349
|
+
x1: "15.4216",
|
|
1350
|
+
y1: "9.5324",
|
|
1351
|
+
x2: "8.09661",
|
|
1352
|
+
y2: "2.21365",
|
|
1353
|
+
gradientUnits: "userSpaceOnUse",
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ jsx5("stop", { stopColor: "#8697FF" }),
|
|
1356
|
+
/* @__PURE__ */ jsx5("stop", { offset: "1", stopColor: "#8697FF", stopOpacity: "0" })
|
|
1357
|
+
]
|
|
1118
1358
|
}
|
|
1119
1359
|
),
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
function ExternalLinkIcon() {
|
|
1124
|
-
return /* @__PURE__ */ jsxs3("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
1125
|
-
/* @__PURE__ */ jsx4(
|
|
1126
|
-
"path",
|
|
1360
|
+
/* @__PURE__ */ jsxs4(
|
|
1361
|
+
"linearGradient",
|
|
1127
1362
|
{
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1363
|
+
id: "rs-rabby-grad2",
|
|
1364
|
+
x1: "11.6553",
|
|
1365
|
+
y1: "13.6413",
|
|
1366
|
+
x2: "4.63033",
|
|
1367
|
+
y2: "9.61626",
|
|
1368
|
+
gradientUnits: "userSpaceOnUse",
|
|
1369
|
+
children: [
|
|
1370
|
+
/* @__PURE__ */ jsx5("stop", { stopColor: "#8697FF" }),
|
|
1371
|
+
/* @__PURE__ */ jsx5("stop", { offset: "1", stopColor: "#8697FF", stopOpacity: "0" })
|
|
1372
|
+
]
|
|
1131
1373
|
}
|
|
1132
1374
|
),
|
|
1133
|
-
/* @__PURE__ */
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1375
|
+
/* @__PURE__ */ jsxs4(
|
|
1376
|
+
"linearGradient",
|
|
1377
|
+
{
|
|
1378
|
+
id: "rs-rabby-grad3",
|
|
1379
|
+
x1: "7.61476",
|
|
1380
|
+
y1: "9.64918",
|
|
1381
|
+
x2: "12.3748",
|
|
1382
|
+
y2: "15.6773",
|
|
1383
|
+
gradientUnits: "userSpaceOnUse",
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ jsx5("stop", { stopColor: "white" }),
|
|
1386
|
+
/* @__PURE__ */ jsx5("stop", { offset: "0.984", stopColor: "#D1D8FF" })
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1389
|
+
),
|
|
1390
|
+
/* @__PURE__ */ jsx5("clipPath", { id: "rs-rabby-clip", children: /* @__PURE__ */ jsx5("rect", { width: "20", height: "20", fill: "white" }) })
|
|
1391
|
+
] })
|
|
1392
|
+
] });
|
|
1393
|
+
var PhantomIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1394
|
+
/* @__PURE__ */ jsx5(
|
|
1139
1395
|
"path",
|
|
1140
1396
|
{
|
|
1141
|
-
d: "
|
|
1142
|
-
|
|
1143
|
-
strokeWidth: "1.5",
|
|
1144
|
-
strokeLinecap: "round",
|
|
1145
|
-
strokeLinejoin: "round"
|
|
1397
|
+
d: "M15.1852 0H4.81481C2.15567 0 0 2.15567 0 4.81481V15.1852C0 17.8443 2.15567 20 4.81481 20H15.1852C17.8443 20 20 17.8443 20 15.1852V4.81481C20 2.15567 17.8443 0 15.1852 0Z",
|
|
1398
|
+
fill: "#AB9FF2"
|
|
1146
1399
|
}
|
|
1147
|
-
)
|
|
1148
|
-
|
|
1149
|
-
function CheckIcon() {
|
|
1150
|
-
return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx4(
|
|
1400
|
+
),
|
|
1401
|
+
/* @__PURE__ */ jsx5(
|
|
1151
1402
|
"path",
|
|
1152
1403
|
{
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1404
|
+
fillRule: "evenodd",
|
|
1405
|
+
clipRule: "evenodd",
|
|
1406
|
+
d: "M8.61617 12.9486C7.77876 14.2315 6.37579 15.855 4.50894 15.855C3.62635 15.855 2.77783 15.4917 2.77783 13.9136C2.77783 9.89449 8.26542 3.67264 13.3569 3.67264C16.2534 3.67264 17.4075 5.68227 17.4075 7.9643C17.4075 10.8936 15.5067 14.2428 13.6171 14.2428C13.0175 14.2428 12.7232 13.9136 12.7232 13.3913C12.7232 13.255 12.7459 13.1075 12.7912 12.9486C12.1462 14.0499 10.9015 15.0717 9.73617 15.0717C8.88765 15.0717 8.45765 14.538 8.45765 13.7887C8.45765 13.5162 8.51431 13.2325 8.61617 12.9486ZM15.4958 7.88486C15.4958 8.54986 15.1032 8.88245 14.6643 8.88245C14.2189 8.88245 13.8332 8.54986 13.8332 7.88486C13.8332 7.21986 14.2189 6.88745 14.6645 6.88745C15.1034 6.88745 15.4958 7.22004 15.4958 7.88486ZM13.0017 7.88486C13.0017 8.54986 12.6095 8.88245 12.1706 8.88245C11.7251 8.88245 11.3393 8.54986 11.3393 7.88505C11.3393 7.22005 11.7251 6.88745 12.1706 6.88745C12.6095 6.88745 13.0017 7.22005 13.0017 7.88505",
|
|
1407
|
+
fill: "#FFFDF8"
|
|
1156
1408
|
}
|
|
1157
|
-
)
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1409
|
+
)
|
|
1410
|
+
] });
|
|
1411
|
+
var WalletConnectIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1412
|
+
/* @__PURE__ */ jsx5("rect", { width: "20", height: "20", rx: "2.5", fill: "#3B99FC" }),
|
|
1413
|
+
/* @__PURE__ */ jsx5(
|
|
1161
1414
|
"path",
|
|
1162
1415
|
{
|
|
1163
|
-
d: "
|
|
1164
|
-
|
|
1165
|
-
strokeLinejoin: "round"
|
|
1416
|
+
d: "M6.18 7.96a5.36 5.36 0 0 1 7.64 0l.25.26a.26.26 0 0 1 0 .37l-.87.87a.13.13 0 0 1-.19 0l-.35-.35a3.74 3.74 0 0 0-5.32 0l-.38.37a.13.13 0 0 1-.19 0l-.86-.86a.26.26 0 0 1 0-.37l.27-.29Zm9.43 1.79.78.78a.26.26 0 0 1 0 .37l-3.54 3.54a.26.26 0 0 1-.37 0l-2.51-2.5a.07.07 0 0 0-.09 0l-2.51 2.5a.26.26 0 0 1-.37 0L3.46 10.9a.26.26 0 0 1 0-.37l.78-.78a.26.26 0 0 1 .37 0l2.5 2.5a.07.07 0 0 0 .1 0L9.72 9.75a.26.26 0 0 1 .37 0l2.5 2.5a.07.07 0 0 0 .1 0l2.5-2.5a.26.26 0 0 1 .37 0Z",
|
|
1417
|
+
fill: "#fff"
|
|
1166
1418
|
}
|
|
1167
|
-
)
|
|
1168
|
-
}
|
|
1419
|
+
)
|
|
1420
|
+
] });
|
|
1421
|
+
var EthBadgeIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1422
|
+
/* @__PURE__ */ jsx5(
|
|
1423
|
+
"path",
|
|
1424
|
+
{
|
|
1425
|
+
d: "M9.99987 19.9319C15.4852 19.9319 19.9319 15.4852 19.9319 9.9999C19.9319 4.51461 15.4852 0.0679016 9.99987 0.0679016C4.51458 0.0679016 0.0678711 4.51461 0.0678711 9.9999C0.0678711 15.4852 4.51458 19.9319 9.99987 19.9319Z",
|
|
1426
|
+
fill: "#E3E3E3"
|
|
1427
|
+
}
|
|
1428
|
+
),
|
|
1429
|
+
/* @__PURE__ */ jsx5("path", { d: "M10.0073 2.18121L14.6948 9.99371L10.0247 7.98052L10.0073 2.18121Z", fill: "#2F3030" }),
|
|
1430
|
+
/* @__PURE__ */ jsx5("path", { d: "M5.31982 9.99371L9.98998 2.18121L10.0073 7.98052L5.31982 9.99371Z", fill: "#828384" }),
|
|
1431
|
+
/* @__PURE__ */ jsx5("path", { d: "M9.98998 12.8062L5.31982 10.047L10.0073 8.11871L9.98998 12.8062Z", fill: "#343535" }),
|
|
1432
|
+
/* @__PURE__ */ jsx5("path", { d: "M14.6948 10.047L10.0247 8.11871L10.0073 12.8062L14.6948 10.047Z", fill: "#131313" }),
|
|
1433
|
+
/* @__PURE__ */ jsx5("path", { d: "M10.0073 14.0046L14.6948 11.2437L10.0073 17.8062V14.0046Z", fill: "#2F3030" }),
|
|
1434
|
+
/* @__PURE__ */ jsx5("path", { d: "M10.0073 14.0046L5.31982 11.2437L10.0073 17.8062V14.0046Z", fill: "#828384" })
|
|
1435
|
+
] });
|
|
1436
|
+
var SolBadgeIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1437
|
+
/* @__PURE__ */ jsx5("rect", { width: "20", height: "20", rx: "10", fill: "#0C0C0C" }),
|
|
1438
|
+
/* @__PURE__ */ jsx5(
|
|
1439
|
+
"path",
|
|
1440
|
+
{
|
|
1441
|
+
fillRule: "evenodd",
|
|
1442
|
+
clipRule: "evenodd",
|
|
1443
|
+
d: "M4.62391 9.04404H13.8799C13.9959 9.04404 14.1039 9.08804 14.1839 9.17204L15.6479 10.644C15.9199 10.916 15.7279 11.38 15.3439 11.38H6.08791C5.97191 11.38 5.86391 11.336 5.78391 11.252L4.31991 9.78004C4.04791 9.51203 4.23991 9.04404 4.62391 9.04404ZM4.31591 7.09204L5.77991 5.62003C5.86391 5.53603 5.97191 5.49203 6.08391 5.49203H15.3359C15.7199 5.49203 15.9159 5.95603 15.6399 6.22803L14.1799 7.70003C14.0999 7.78403 13.9879 7.82803 13.8759 7.82803H4.62391C4.23991 7.82803 4.04791 7.36404 4.31591 7.09204ZM15.6439 13.34L14.1799 14.816C14.0999 14.896 13.9879 14.944 13.8759 14.944H4.62391C4.23991 14.944 4.04791 14.48 4.31591 14.208L5.77991 12.732C5.86391 12.652 5.97191 12.604 6.08391 12.604H15.3359C15.7239 12.6 15.9199 13.064 15.6439 13.34Z",
|
|
1444
|
+
fill: "url(#rs-sol-badge-grad)"
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
/* @__PURE__ */ jsx5("defs", { children: /* @__PURE__ */ jsxs4(
|
|
1448
|
+
"linearGradient",
|
|
1449
|
+
{
|
|
1450
|
+
id: "rs-sol-badge-grad",
|
|
1451
|
+
x1: "4.85031",
|
|
1452
|
+
y1: "15.3466",
|
|
1453
|
+
x2: "15.1135",
|
|
1454
|
+
y2: "5.08343",
|
|
1455
|
+
gradientUnits: "userSpaceOnUse",
|
|
1456
|
+
children: [
|
|
1457
|
+
/* @__PURE__ */ jsx5("stop", { stopColor: "#CB4EE8" }),
|
|
1458
|
+
/* @__PURE__ */ jsx5("stop", { offset: "1", stopColor: "#10F4B1" })
|
|
1459
|
+
]
|
|
1460
|
+
}
|
|
1461
|
+
) })
|
|
1462
|
+
] });
|
|
1463
|
+
var BaseBadgeIcon = () => /* @__PURE__ */ jsxs4("svg", { width: "20", height: "20", viewBox: "0 0 111 111", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1464
|
+
/* @__PURE__ */ jsx5("circle", { cx: "55.5", cy: "55.5", r: "55.5", fill: "#0052FF" }),
|
|
1465
|
+
/* @__PURE__ */ jsx5(
|
|
1466
|
+
"path",
|
|
1467
|
+
{
|
|
1468
|
+
d: "M54.921 93.4c20.942 0 37.92-16.978 37.92-37.921S75.863 17.558 54.92 17.558c-19.498 0-35.57 14.725-37.655 33.647h49.82v5.548h-49.82C19.351 75.675 35.423 93.4 54.921 93.4z",
|
|
1469
|
+
fill: "#fff"
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1472
|
+
] });
|
|
1473
|
+
var walletBadge = /* @__PURE__ */ jsxs4("span", { className: "rs-list-row-meta-icons", children: [
|
|
1474
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(RabbyIcon, {}) }),
|
|
1475
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(PhantomIcon, {}) }),
|
|
1476
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(WalletConnectIcon, {}) })
|
|
1477
|
+
] });
|
|
1478
|
+
var chainBadge = /* @__PURE__ */ jsxs4("span", { className: "rs-list-row-meta-icons", children: [
|
|
1479
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(EthBadgeIcon, {}) }),
|
|
1480
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(SolBadgeIcon, {}) }),
|
|
1481
|
+
/* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(BaseBadgeIcon, {}) })
|
|
1482
|
+
] });
|
|
1483
|
+
function WalletBadgeIcons() {
|
|
1484
|
+
return walletBadge;
|
|
1485
|
+
}
|
|
1486
|
+
WalletBadgeIcons.displayName = "WalletBadgeIcons";
|
|
1487
|
+
function ChainBadgeIcons() {
|
|
1488
|
+
return chainBadge;
|
|
1489
|
+
}
|
|
1490
|
+
ChainBadgeIcons.displayName = "ChainBadgeIcons";
|
|
1169
1491
|
|
|
1170
1492
|
// src/components/steps/ConnectStep.tsx
|
|
1171
|
-
import { jsx as
|
|
1172
|
-
function
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1493
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1494
|
+
function shorten(addr) {
|
|
1495
|
+
return addr.length > 12 ? `${addr.slice(0, 6)}...${addr.slice(-4)}` : addr;
|
|
1496
|
+
}
|
|
1497
|
+
function renderWalletLeading(option) {
|
|
1498
|
+
if (option.icon) {
|
|
1499
|
+
return /* @__PURE__ */ jsx6(
|
|
1500
|
+
"img",
|
|
1501
|
+
{
|
|
1502
|
+
src: option.icon,
|
|
1503
|
+
alt: "",
|
|
1504
|
+
style: { width: 24, height: 24, borderRadius: 6 }
|
|
1505
|
+
}
|
|
1506
|
+
);
|
|
1507
|
+
}
|
|
1508
|
+
return /* @__PURE__ */ jsx6(WalletIcon, {});
|
|
1176
1509
|
}
|
|
1177
1510
|
function ConnectStep({
|
|
1178
1511
|
walletOptions,
|
|
1179
|
-
|
|
1180
|
-
onSelectWallet,
|
|
1512
|
+
onConfirmWallet,
|
|
1181
1513
|
onSelectTransferCrypto,
|
|
1182
1514
|
onRequestConnect,
|
|
1183
1515
|
onConnect,
|
|
1184
1516
|
onDisconnect,
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
connectButtonLabel = "Connect external wallet"
|
|
1517
|
+
title = "Deposit",
|
|
1518
|
+
subtitle
|
|
1188
1519
|
}) {
|
|
1189
|
-
const
|
|
1190
|
-
if (hasWalletOptions) {
|
|
1191
|
-
const hasReownWallet = walletOptions?.some(
|
|
1192
|
-
(option) => option.kind === "external" || option.kind === "solana"
|
|
1193
|
-
) ?? false;
|
|
1194
|
-
const showConnectDifferentWalletOption = Boolean(onConnect) && !hasReownWallet;
|
|
1195
|
-
return /* @__PURE__ */ jsxs4("div", { className: "rs-step", children: [
|
|
1196
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
|
|
1197
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-list", children: [
|
|
1198
|
-
walletOptions?.map((option) => {
|
|
1199
|
-
const isSelected = option.id === selectedWalletId;
|
|
1200
|
-
const rawAddress = option.address ?? option.solanaAddress ?? option.id;
|
|
1201
|
-
const shortAddress = rawAddress.length > 12 ? `${rawAddress.slice(0, 6)}...${rawAddress.slice(-4)}` : rawAddress;
|
|
1202
|
-
return /* @__PURE__ */ jsxs4(
|
|
1203
|
-
"button",
|
|
1204
|
-
{
|
|
1205
|
-
type: "button",
|
|
1206
|
-
className: `rs-connect-wallet-row ${isSelected ? "rs-connect-wallet-row--selected" : ""}`,
|
|
1207
|
-
onClick: () => onSelectWallet?.(option.id),
|
|
1208
|
-
children: [
|
|
1209
|
-
/* @__PURE__ */ jsx5(
|
|
1210
|
-
"div",
|
|
1211
|
-
{
|
|
1212
|
-
className: `rs-connect-wallet-icon ${isSelected ? "rs-connect-wallet-icon--selected" : ""}`,
|
|
1213
|
-
children: option.icon ? /* @__PURE__ */ jsx5(
|
|
1214
|
-
"img",
|
|
1215
|
-
{
|
|
1216
|
-
src: option.icon,
|
|
1217
|
-
alt: option.label,
|
|
1218
|
-
style: { width: 24, height: 24, borderRadius: 6 }
|
|
1219
|
-
}
|
|
1220
|
-
) : rowIcon(option.kind)
|
|
1221
|
-
}
|
|
1222
|
-
),
|
|
1223
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
1224
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: option.label }),
|
|
1225
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: shortAddress })
|
|
1226
|
-
] }),
|
|
1227
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: isSelected ? /* @__PURE__ */ jsx5(CheckIcon, {}) : /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
1228
|
-
]
|
|
1229
|
-
},
|
|
1230
|
-
option.id
|
|
1231
|
-
);
|
|
1232
|
-
}),
|
|
1233
|
-
showConnectDifferentWalletOption && /* @__PURE__ */ jsxs4(
|
|
1234
|
-
"button",
|
|
1235
|
-
{
|
|
1236
|
-
type: "button",
|
|
1237
|
-
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1238
|
-
onClick: onConnect,
|
|
1239
|
-
children: [
|
|
1240
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(ExternalLinkIcon, {}) }),
|
|
1241
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
1242
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "External Wallet" }),
|
|
1243
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "Connect different wallet" })
|
|
1244
|
-
] }),
|
|
1245
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
1246
|
-
]
|
|
1247
|
-
}
|
|
1248
|
-
),
|
|
1249
|
-
onSelectTransferCrypto && /* @__PURE__ */ jsxs4(
|
|
1250
|
-
"button",
|
|
1251
|
-
{
|
|
1252
|
-
type: "button",
|
|
1253
|
-
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1254
|
-
onClick: onSelectTransferCrypto,
|
|
1255
|
-
children: [
|
|
1256
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(TransferIcon, {}) }),
|
|
1257
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
1258
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "Transfer Crypto" }),
|
|
1259
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "No limit instant transfer" })
|
|
1260
|
-
] }),
|
|
1261
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
1262
|
-
]
|
|
1263
|
-
}
|
|
1264
|
-
)
|
|
1265
|
-
] }),
|
|
1266
|
-
(onDisconnect || onConnect) && walletOptions?.some(
|
|
1267
|
-
(option) => option.kind === "external" || option.kind === "solana"
|
|
1268
|
-
) && /* @__PURE__ */ jsx5(
|
|
1269
|
-
"button",
|
|
1270
|
-
{
|
|
1271
|
-
type: "button",
|
|
1272
|
-
className: "rs-connect-wallet-manage",
|
|
1273
|
-
onClick: onDisconnect ?? onConnect,
|
|
1274
|
-
children: "Disconnect Wallet"
|
|
1275
|
-
}
|
|
1276
|
-
)
|
|
1277
|
-
] }),
|
|
1278
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-step-footer rs-step-footer--connect-empty", children: /* @__PURE__ */ jsx5(
|
|
1279
|
-
Button,
|
|
1280
|
-
{
|
|
1281
|
-
onClick: onContinue,
|
|
1282
|
-
variant: "accent",
|
|
1283
|
-
fullWidth: true,
|
|
1284
|
-
disabled: !selectedWalletId || !onContinue,
|
|
1285
|
-
children: continueButtonLabel
|
|
1286
|
-
}
|
|
1287
|
-
) })
|
|
1288
|
-
] });
|
|
1289
|
-
}
|
|
1520
|
+
const options = walletOptions ?? [];
|
|
1290
1521
|
const handleConnect = onConnect ?? onRequestConnect;
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1522
|
+
const hasReownWallet = options.some(
|
|
1523
|
+
(option) => option.kind === "external" || option.kind === "solana"
|
|
1524
|
+
);
|
|
1525
|
+
const extraChainCount = Math.max(0, getSupportedChainIds().length - 3);
|
|
1526
|
+
const chainBadge2 = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1527
|
+
/* @__PURE__ */ jsx6(ChainBadgeIcons, {}),
|
|
1528
|
+
extraChainCount > 0 ? `+${extraChainCount} chains` : "All chains"
|
|
1529
|
+
] });
|
|
1530
|
+
const defaultSubtitle = onSelectTransferCrypto ? "Add money to your balance" : "Choose a wallet to continue";
|
|
1531
|
+
return /* @__PURE__ */ jsxs5("div", { className: "rs-screen", children: [
|
|
1532
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
1533
|
+
/* @__PURE__ */ jsx6(
|
|
1534
|
+
BodyHeader,
|
|
1295
1535
|
{
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
children: [
|
|
1300
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(TransferIcon, {}) }),
|
|
1301
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
1302
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "Transfer Crypto" }),
|
|
1303
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "No limit instant transfer" })
|
|
1304
|
-
] }),
|
|
1305
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
1306
|
-
]
|
|
1536
|
+
icon: /* @__PURE__ */ jsx6(HandCoinsIcon, {}),
|
|
1537
|
+
title,
|
|
1538
|
+
subtitle: subtitle ?? defaultSubtitle
|
|
1307
1539
|
}
|
|
1308
1540
|
),
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
type: "button",
|
|
1313
|
-
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1314
|
-
onClick: handleConnect,
|
|
1315
|
-
children: [
|
|
1316
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ jsx5(WalletIcon, {}) }),
|
|
1317
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-wallet-meta", children: [
|
|
1318
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-label", children: "Connect Wallet" }),
|
|
1319
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-address", children: "Connect your wallet to deposit" })
|
|
1320
|
-
] }),
|
|
1321
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ jsx5(ChevronRightIcon, {}) })
|
|
1322
|
-
]
|
|
1323
|
-
}
|
|
1324
|
-
)
|
|
1325
|
-
] }) }) });
|
|
1326
|
-
}
|
|
1327
|
-
return /* @__PURE__ */ jsxs4("div", { className: "rs-step", children: [
|
|
1328
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-centered rs-connect-centered--minimal", children: /* @__PURE__ */ jsxs4("div", { className: "rs-connect-empty", children: [
|
|
1329
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-connect-empty-graphic", "aria-hidden": "true", children: [
|
|
1330
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-orbit rs-connect-empty-orbit--outer" }),
|
|
1331
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-orbit rs-connect-empty-orbit--inner" }),
|
|
1332
|
-
/* @__PURE__ */ jsx5("div", { className: "rs-connect-empty-core", children: /* @__PURE__ */ jsxs4(
|
|
1333
|
-
"svg",
|
|
1541
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-list", children: [
|
|
1542
|
+
onSelectTransferCrypto && /* @__PURE__ */ jsx6(
|
|
1543
|
+
ListRow,
|
|
1334
1544
|
{
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
/* @__PURE__ */ jsx5(
|
|
1341
|
-
"path",
|
|
1342
|
-
{
|
|
1343
|
-
strokeLinecap: "round",
|
|
1344
|
-
strokeLinejoin: "round",
|
|
1345
|
-
d: "M4 8.25A2.25 2.25 0 016.25 6h11.5A2.25 2.25 0 0120 8.25v7.5A2.25 2.25 0 0117.75 18H6.25A2.25 2.25 0 014 15.75v-7.5z"
|
|
1346
|
-
}
|
|
1347
|
-
),
|
|
1348
|
-
/* @__PURE__ */ jsx5(
|
|
1349
|
-
"path",
|
|
1350
|
-
{
|
|
1351
|
-
strokeLinecap: "round",
|
|
1352
|
-
strokeLinejoin: "round",
|
|
1353
|
-
d: "M20 10.5h-3.75a2.25 2.25 0 100 4.5H20"
|
|
1354
|
-
}
|
|
1355
|
-
),
|
|
1356
|
-
/* @__PURE__ */ jsx5("circle", { cx: "16.25", cy: "12.75", r: "0.85", fill: "currentColor" })
|
|
1357
|
-
]
|
|
1545
|
+
leading: /* @__PURE__ */ jsx6(CoinsIcon, {}),
|
|
1546
|
+
title: "Transfer crypto",
|
|
1547
|
+
subtitle: "Instant - No limit",
|
|
1548
|
+
meta: chainBadge2,
|
|
1549
|
+
onClick: onSelectTransferCrypto
|
|
1358
1550
|
}
|
|
1359
|
-
)
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1551
|
+
),
|
|
1552
|
+
options.map((option) => {
|
|
1553
|
+
const rawAddress = option.address ?? option.solanaAddress ?? option.id;
|
|
1554
|
+
return /* @__PURE__ */ jsx6(
|
|
1555
|
+
ListRow,
|
|
1556
|
+
{
|
|
1557
|
+
leading: renderWalletLeading(option),
|
|
1558
|
+
title: onSelectTransferCrypto ? "External wallet" : option.label,
|
|
1559
|
+
subtitle: shorten(rawAddress),
|
|
1560
|
+
onClick: () => onConfirmWallet?.(option.id)
|
|
1561
|
+
},
|
|
1562
|
+
option.id
|
|
1563
|
+
);
|
|
1564
|
+
}),
|
|
1565
|
+
!hasReownWallet && handleConnect && /* @__PURE__ */ jsx6(
|
|
1566
|
+
ListRow,
|
|
1567
|
+
{
|
|
1568
|
+
leading: /* @__PURE__ */ jsx6(WalletIcon, {}),
|
|
1569
|
+
title: "Connect wallet",
|
|
1570
|
+
subtitle: "Instant - No limit",
|
|
1571
|
+
meta: /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1572
|
+
/* @__PURE__ */ jsx6(WalletBadgeIcons, {}),
|
|
1573
|
+
"+100 wallets"
|
|
1574
|
+
] }),
|
|
1575
|
+
onClick: handleConnect
|
|
1576
|
+
}
|
|
1577
|
+
)
|
|
1578
|
+
] })
|
|
1579
|
+
] }),
|
|
1580
|
+
onDisconnect && hasReownWallet && /* @__PURE__ */ jsx6("div", { className: "rs-screen-tight-row", children: /* @__PURE__ */ jsx6(
|
|
1581
|
+
"button",
|
|
1368
1582
|
{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
children: connectButtonLabel
|
|
1583
|
+
type: "button",
|
|
1584
|
+
className: "rs-connect-wallet-manage",
|
|
1585
|
+
onClick: onDisconnect,
|
|
1586
|
+
children: "Disconnect wallet"
|
|
1374
1587
|
}
|
|
1375
|
-
) })
|
|
1588
|
+
) }),
|
|
1589
|
+
/* @__PURE__ */ jsx6(PoweredBy, {})
|
|
1376
1590
|
] });
|
|
1377
1591
|
}
|
|
1378
1592
|
ConnectStep.displayName = "ConnectStep";
|
|
1379
1593
|
|
|
1594
|
+
// src/components/ui/Spinner.tsx
|
|
1595
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1596
|
+
function Spinner({ className }) {
|
|
1597
|
+
return /* @__PURE__ */ jsxs6(
|
|
1598
|
+
"svg",
|
|
1599
|
+
{
|
|
1600
|
+
className: `rs-spinner ${className || ""}`,
|
|
1601
|
+
fill: "none",
|
|
1602
|
+
viewBox: "0 0 20 21",
|
|
1603
|
+
children: [
|
|
1604
|
+
/* @__PURE__ */ jsx7(
|
|
1605
|
+
"path",
|
|
1606
|
+
{
|
|
1607
|
+
d: "M10 0.5C8.02219 0.5 6.08879 1.08649 4.4443 2.1853C2.79981 3.28412 1.51809 4.8459 0.761209 6.67316C0.00433288 8.50043 -0.1937 10.5111 0.192152 12.4509C0.578004 14.3907 1.53041 16.1725 2.92894 17.5711C4.32746 18.9696 6.10929 19.922 8.0491 20.3078C9.98891 20.6937 11.9996 20.4957 13.8268 19.7388C15.6541 18.9819 17.2159 17.7002 18.3147 16.0557C19.4135 14.4112 20 12.4778 20 10.5C20 7.84783 18.9464 5.3043 17.0711 3.42893C15.1957 1.55357 12.6522 0.5 10 0.5ZM10 17.7727C8.56159 17.7727 7.15549 17.3462 5.95949 16.547C4.7635 15.7479 3.83134 14.6121 3.28088 13.2831C2.73042 11.9542 2.5864 10.4919 2.86702 9.08116C3.14764 7.67039 3.8403 6.37451 4.85741 5.3574C5.87452 4.3403 7.17039 3.64764 8.58116 3.36702C9.99193 3.0864 11.4542 3.23042 12.7832 3.78088C14.1121 4.33133 15.2479 5.26349 16.0471 6.45949C16.8462 7.65548 17.2727 9.06159 17.2727 10.5C17.2727 12.4288 16.5065 14.2787 15.1426 15.6426C13.7787 17.0065 11.9288 17.7727 10 17.7727Z",
|
|
1608
|
+
fill: "currentColor",
|
|
1609
|
+
opacity: 0.3
|
|
1610
|
+
}
|
|
1611
|
+
),
|
|
1612
|
+
/* @__PURE__ */ jsx7(
|
|
1613
|
+
"path",
|
|
1614
|
+
{
|
|
1615
|
+
d: "M10 3.22767C11.7423 3.22846 13.4276 3.8412 14.7556 4.95667C16.0837 6.07214 16.9681 7.61784 17.2512 9.31825C17.3012 9.64364 17.4662 9.94096 17.7169 10.1573C17.9677 10.3737 18.2878 10.4951 18.6205 10.5C18.8211 10.5001 19.0193 10.457 19.2012 10.3735C19.3832 10.2901 19.5445 10.1684 19.674 10.017C19.8036 9.86549 19.8981 9.68789 19.9511 9.49656C20.004 9.30523 20.0141 9.10478 19.9807 8.90918C19.5986 6.56305 18.3843 4.42821 16.5554 2.88726C14.7265 1.34631 12.4025 0.5 10 0.5C7.59751 0.5 5.27354 1.34631 3.44461 2.88726C1.61569 4.42821 0.401366 6.56305 0.0192815 8.90918C-0.0141442 9.10478 -0.00402016 9.30523 0.0489472 9.49656C0.101914 9.68789 0.196449 9.86549 0.325956 10.017C0.455463 10.1684 0.616823 10.2901 0.798778 10.3735C0.980732 10.457 1.1789 10.5001 1.37945 10.5C1.71216 10.4951 2.03235 10.3737 2.28307 10.1573C2.5338 9.94096 2.69883 9.64364 2.74882 9.31825C3.03193 7.61784 3.91633 6.07214 5.24436 4.95667C6.57239 3.8412 8.25775 3.22846 10 3.22767Z",
|
|
1616
|
+
fill: "currentColor"
|
|
1617
|
+
}
|
|
1618
|
+
)
|
|
1619
|
+
]
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1380
1624
|
// src/core/session-owner.ts
|
|
1381
1625
|
import { isAddress } from "viem";
|
|
1382
1626
|
import {
|
|
@@ -1426,46 +1670,211 @@ function accountFromPrivateKey(privateKey) {
|
|
|
1426
1670
|
return privateKeyToAccount(privateKey);
|
|
1427
1671
|
}
|
|
1428
1672
|
|
|
1673
|
+
// src/core/formatters.ts
|
|
1674
|
+
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
1675
|
+
style: "currency",
|
|
1676
|
+
currency: "USD",
|
|
1677
|
+
maximumFractionDigits: 2
|
|
1678
|
+
});
|
|
1679
|
+
var tokenFormatter = new Intl.NumberFormat("en-US", {
|
|
1680
|
+
maximumFractionDigits: 6
|
|
1681
|
+
});
|
|
1682
|
+
function formatUserError(raw) {
|
|
1683
|
+
const lower = raw.toLowerCase();
|
|
1684
|
+
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
1685
|
+
return "Transaction cancelled";
|
|
1686
|
+
}
|
|
1687
|
+
if (lower.includes("insufficient funds")) {
|
|
1688
|
+
return "Insufficient funds for this transaction";
|
|
1689
|
+
}
|
|
1690
|
+
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1691
|
+
return "Transaction conflict \u2014 please try again";
|
|
1692
|
+
}
|
|
1693
|
+
if (lower.includes("execution reverted")) {
|
|
1694
|
+
return "Transaction would fail on-chain";
|
|
1695
|
+
}
|
|
1696
|
+
if (lower.includes("timed out") || lower.includes("took too long")) {
|
|
1697
|
+
return "Request timed out \u2014 please try again";
|
|
1698
|
+
}
|
|
1699
|
+
if (lower.includes("econnrefused") || lower.includes("econnreset") || lower.includes("enotfound") || lower.includes("fetch failed")) {
|
|
1700
|
+
return "Service unavailable \u2014 please try again";
|
|
1701
|
+
}
|
|
1702
|
+
if (lower.includes("recent blockhash") || lower.includes("latest blockhash")) {
|
|
1703
|
+
return "Solana RPC unavailable \u2014 please retry";
|
|
1704
|
+
}
|
|
1705
|
+
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
1706
|
+
return "Network error \u2014 check your connection";
|
|
1707
|
+
}
|
|
1708
|
+
if (lower.includes("rate limit") || lower.includes("429")) {
|
|
1709
|
+
return "Rate limited \u2014 please try again shortly";
|
|
1710
|
+
}
|
|
1711
|
+
let cleaned = raw;
|
|
1712
|
+
const stripMarkers = [
|
|
1713
|
+
"\n\nRequest Arguments:",
|
|
1714
|
+
"\nRaw Call Arguments:",
|
|
1715
|
+
"\nRequest body:",
|
|
1716
|
+
"\nContract Call:",
|
|
1717
|
+
"\nDocs:",
|
|
1718
|
+
"\nDetails:",
|
|
1719
|
+
"\nVersion:",
|
|
1720
|
+
"\nURL:"
|
|
1721
|
+
];
|
|
1722
|
+
for (const marker of stripMarkers) {
|
|
1723
|
+
const idx = cleaned.indexOf(marker);
|
|
1724
|
+
if (idx !== -1) {
|
|
1725
|
+
cleaned = cleaned.slice(0, idx).trim();
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
cleaned = cleaned.replace(/https?:\/\/\S+/g, "").trim();
|
|
1729
|
+
if (cleaned.length === 0) {
|
|
1730
|
+
return "An unexpected error occurred";
|
|
1731
|
+
}
|
|
1732
|
+
if (cleaned.length > 120) {
|
|
1733
|
+
return cleaned.slice(0, 120) + "...";
|
|
1734
|
+
}
|
|
1735
|
+
return cleaned;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1429
1738
|
// src/components/steps/ProcessingStep.tsx
|
|
1430
|
-
import { useEffect as
|
|
1739
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState2 } from "react";
|
|
1431
1740
|
import { formatUnits } from "viem";
|
|
1432
1741
|
|
|
1433
|
-
// src/components/ui/
|
|
1434
|
-
import { jsx as
|
|
1435
|
-
function
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1742
|
+
// src/components/ui/Button.tsx
|
|
1743
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1744
|
+
function Button({
|
|
1745
|
+
children,
|
|
1746
|
+
variant = "accent",
|
|
1747
|
+
size = "default",
|
|
1748
|
+
loading = false,
|
|
1749
|
+
loadingText,
|
|
1750
|
+
fullWidth = false,
|
|
1751
|
+
disabled,
|
|
1752
|
+
className = "",
|
|
1753
|
+
...props
|
|
1754
|
+
}) {
|
|
1755
|
+
const classes = [
|
|
1756
|
+
"rs-button",
|
|
1757
|
+
`rs-button--${variant}`,
|
|
1758
|
+
`rs-button--size-${size}`,
|
|
1759
|
+
fullWidth ? "rs-button--full-width" : "",
|
|
1760
|
+
className
|
|
1761
|
+
].filter(Boolean).join(" ");
|
|
1762
|
+
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
1763
|
+
return /* @__PURE__ */ jsx8(
|
|
1764
|
+
"button",
|
|
1765
|
+
{
|
|
1766
|
+
className: classes,
|
|
1767
|
+
disabled: disabled || loading,
|
|
1768
|
+
"aria-busy": loading || void 0,
|
|
1769
|
+
...props,
|
|
1770
|
+
children: showInlineLoadingText ? /* @__PURE__ */ jsxs7("span", { className: "rs-button__loading-row", children: [
|
|
1771
|
+
/* @__PURE__ */ jsx8(Spinner, { className: "rs-spinner--sm" }),
|
|
1772
|
+
/* @__PURE__ */ jsx8("span", { children: loadingText })
|
|
1773
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1774
|
+
/* @__PURE__ */ jsx8("span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
1775
|
+
loading && /* @__PURE__ */ jsx8("span", { className: "rs-button__spinner", children: /* @__PURE__ */ jsx8(Spinner, { className: "rs-spinner--sm" }) })
|
|
1776
|
+
] })
|
|
1777
|
+
}
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
1780
|
+
Button.displayName = "Button";
|
|
1781
|
+
|
|
1782
|
+
// src/components/ui/Tooltip.tsx
|
|
1783
|
+
import {
|
|
1784
|
+
useState,
|
|
1785
|
+
useRef as useRef3,
|
|
1786
|
+
useEffect as useEffect3,
|
|
1787
|
+
useCallback as useCallback2
|
|
1788
|
+
} from "react";
|
|
1789
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
1790
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1791
|
+
function Tooltip({ content, children, className }) {
|
|
1792
|
+
const [open, setOpen] = useState(false);
|
|
1793
|
+
const [position, setPosition] = useState(null);
|
|
1794
|
+
const triggerRef = useRef3(null);
|
|
1795
|
+
const bubbleRef = useRef3(null);
|
|
1796
|
+
const updatePosition = useCallback2(() => {
|
|
1797
|
+
const trigger = triggerRef.current;
|
|
1798
|
+
if (!trigger) return;
|
|
1799
|
+
const rect = trigger.getBoundingClientRect();
|
|
1800
|
+
setPosition({
|
|
1801
|
+
top: rect.top,
|
|
1802
|
+
left: rect.left + rect.width / 2
|
|
1803
|
+
});
|
|
1804
|
+
}, []);
|
|
1805
|
+
useEffect3(() => {
|
|
1806
|
+
if (!open) return;
|
|
1807
|
+
updatePosition();
|
|
1808
|
+
function handleOutside(event) {
|
|
1809
|
+
const target = event.target;
|
|
1810
|
+
if (!target) return;
|
|
1811
|
+
if (triggerRef.current?.contains(target)) return;
|
|
1812
|
+
if (bubbleRef.current?.contains(target)) return;
|
|
1813
|
+
setOpen(false);
|
|
1814
|
+
}
|
|
1815
|
+
function handleKey(event) {
|
|
1816
|
+
if (event.key === "Escape") setOpen(false);
|
|
1817
|
+
}
|
|
1818
|
+
document.addEventListener("mousedown", handleOutside);
|
|
1819
|
+
document.addEventListener("touchstart", handleOutside);
|
|
1820
|
+
document.addEventListener("keydown", handleKey);
|
|
1821
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
1822
|
+
window.addEventListener("resize", updatePosition);
|
|
1823
|
+
return () => {
|
|
1824
|
+
document.removeEventListener("mousedown", handleOutside);
|
|
1825
|
+
document.removeEventListener("touchstart", handleOutside);
|
|
1826
|
+
document.removeEventListener("keydown", handleKey);
|
|
1827
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
1828
|
+
window.removeEventListener("resize", updatePosition);
|
|
1829
|
+
};
|
|
1830
|
+
}, [open, updatePosition]);
|
|
1831
|
+
return /* @__PURE__ */ jsxs8(
|
|
1832
|
+
"span",
|
|
1833
|
+
{
|
|
1834
|
+
ref: triggerRef,
|
|
1835
|
+
className: `rs-tooltip ${className ?? ""}`,
|
|
1836
|
+
onMouseEnter: () => setOpen(true),
|
|
1837
|
+
onMouseLeave: () => setOpen(false),
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ jsx9(
|
|
1840
|
+
"span",
|
|
1446
1841
|
{
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1842
|
+
className: "rs-tooltip-trigger",
|
|
1843
|
+
role: "button",
|
|
1844
|
+
tabIndex: 0,
|
|
1845
|
+
"aria-label": content,
|
|
1846
|
+
onClick: (event) => {
|
|
1847
|
+
event.stopPropagation();
|
|
1848
|
+
event.preventDefault();
|
|
1849
|
+
setOpen((value) => !value);
|
|
1850
|
+
},
|
|
1851
|
+
onKeyDown: (event) => {
|
|
1852
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1853
|
+
event.preventDefault();
|
|
1854
|
+
setOpen((value) => !value);
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
children
|
|
1450
1858
|
}
|
|
1859
|
+
),
|
|
1860
|
+
open && position && typeof document !== "undefined" && createPortal2(
|
|
1861
|
+
/* @__PURE__ */ jsx9(
|
|
1862
|
+
"span",
|
|
1863
|
+
{
|
|
1864
|
+
ref: bubbleRef,
|
|
1865
|
+
className: "rs-tooltip-bubble",
|
|
1866
|
+
role: "tooltip",
|
|
1867
|
+
style: { top: position.top, left: position.left },
|
|
1868
|
+
children: content
|
|
1869
|
+
}
|
|
1870
|
+
),
|
|
1871
|
+
document.body
|
|
1451
1872
|
)
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
"Powered by",
|
|
1456
|
-
" ",
|
|
1457
|
-
/* @__PURE__ */ jsx6(
|
|
1458
|
-
"a",
|
|
1459
|
-
{
|
|
1460
|
-
href: "https://www.rhinestone.dev",
|
|
1461
|
-
target: "_blank",
|
|
1462
|
-
rel: "noopener noreferrer",
|
|
1463
|
-
children: "Rhinestone"
|
|
1464
|
-
}
|
|
1465
|
-
)
|
|
1466
|
-
] })
|
|
1467
|
-
] });
|
|
1873
|
+
]
|
|
1874
|
+
}
|
|
1875
|
+
);
|
|
1468
1876
|
}
|
|
1877
|
+
Tooltip.displayName = "Tooltip";
|
|
1469
1878
|
|
|
1470
1879
|
// src/core/webhook.ts
|
|
1471
1880
|
function isRecord(value) {
|
|
@@ -1553,7 +1962,7 @@ function txRefsMatch(a, b) {
|
|
|
1553
1962
|
}
|
|
1554
1963
|
|
|
1555
1964
|
// src/components/steps/ProcessingStep.tsx
|
|
1556
|
-
import { jsx as
|
|
1965
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1557
1966
|
var INITIAL_POLL_INTERVAL = 3e3;
|
|
1558
1967
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1559
1968
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
@@ -1586,9 +1995,6 @@ function savePhaseTimings(txHash, timings) {
|
|
|
1586
1995
|
} catch {
|
|
1587
1996
|
}
|
|
1588
1997
|
}
|
|
1589
|
-
function truncateHash(hash) {
|
|
1590
|
-
return `${hash.slice(0, 10)}...${hash.slice(-8)}`;
|
|
1591
|
-
}
|
|
1592
1998
|
function isEventForTx(event, txHash) {
|
|
1593
1999
|
const eventTxHash = getEventTxHash(event);
|
|
1594
2000
|
if (!eventTxHash) return false;
|
|
@@ -1695,16 +2101,22 @@ function ProcessingStep({
|
|
|
1695
2101
|
flowLabel = "deposit",
|
|
1696
2102
|
debug,
|
|
1697
2103
|
targetToken,
|
|
2104
|
+
uiConfig,
|
|
2105
|
+
estimatedTime = "< 1 min",
|
|
2106
|
+
quotedFeeAmount = "0.1",
|
|
2107
|
+
quotedFeeSymbol,
|
|
2108
|
+
balanceAfterUsd,
|
|
1698
2109
|
onClose,
|
|
1699
2110
|
onNewDeposit,
|
|
2111
|
+
onRetry,
|
|
1700
2112
|
onDepositComplete,
|
|
1701
2113
|
onDepositFailed,
|
|
1702
2114
|
onError
|
|
1703
2115
|
}) {
|
|
1704
|
-
const startTimeRef =
|
|
1705
|
-
const pollIntervalRef =
|
|
1706
|
-
const pollTimeoutRef =
|
|
1707
|
-
const escalatedDelayRef =
|
|
2116
|
+
const startTimeRef = useRef4(Date.now());
|
|
2117
|
+
const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
|
|
2118
|
+
const pollTimeoutRef = useRef4(null);
|
|
2119
|
+
const escalatedDelayRef = useRef4(false);
|
|
1708
2120
|
const processingContextRef = useLatestRef({
|
|
1709
2121
|
amount,
|
|
1710
2122
|
sourceChain,
|
|
@@ -1717,11 +2129,11 @@ function ProcessingStep({
|
|
|
1717
2129
|
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
1718
2130
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
1719
2131
|
const onErrorRef = useLatestRef(onError);
|
|
1720
|
-
const [state, setState] =
|
|
2132
|
+
const [state, setState] = useState2(
|
|
1721
2133
|
directTransfer ? { type: "complete" } : { type: "processing" }
|
|
1722
2134
|
);
|
|
1723
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
1724
|
-
const [phaseTimings, setPhaseTimings] =
|
|
2135
|
+
const [elapsedSeconds, setElapsedSeconds] = useState2(0);
|
|
2136
|
+
const [phaseTimings, setPhaseTimings] = useState2(() => {
|
|
1725
2137
|
const saved = loadPhaseTimings(txHash);
|
|
1726
2138
|
if (saved) {
|
|
1727
2139
|
startTimeRef.current = saved.startedAt;
|
|
@@ -1729,8 +2141,8 @@ function ProcessingStep({
|
|
|
1729
2141
|
}
|
|
1730
2142
|
return { startedAt: startTimeRef.current };
|
|
1731
2143
|
});
|
|
1732
|
-
const [hasEscalatedDelay, setHasEscalatedDelay] =
|
|
1733
|
-
|
|
2144
|
+
const [hasEscalatedDelay, setHasEscalatedDelay] = useState2(false);
|
|
2145
|
+
useEffect4(() => {
|
|
1734
2146
|
if (!directTransfer) return;
|
|
1735
2147
|
const completedAt = Date.now();
|
|
1736
2148
|
setPhaseTimings({
|
|
@@ -1758,7 +2170,7 @@ function ProcessingStep({
|
|
|
1758
2170
|
processingContextRef,
|
|
1759
2171
|
txHash
|
|
1760
2172
|
]);
|
|
1761
|
-
|
|
2173
|
+
useEffect4(() => {
|
|
1762
2174
|
if (directTransfer || state.type !== "processing") return;
|
|
1763
2175
|
const updateElapsed = () => {
|
|
1764
2176
|
setElapsedSeconds(
|
|
@@ -1769,7 +2181,7 @@ function ProcessingStep({
|
|
|
1769
2181
|
const intervalId = setInterval(updateElapsed, 1e3);
|
|
1770
2182
|
return () => clearInterval(intervalId);
|
|
1771
2183
|
}, [directTransfer, state.type]);
|
|
1772
|
-
|
|
2184
|
+
useEffect4(() => {
|
|
1773
2185
|
if (state.type === "processing") return;
|
|
1774
2186
|
const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
|
|
1775
2187
|
setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
|
|
@@ -1777,14 +2189,14 @@ function ProcessingStep({
|
|
|
1777
2189
|
(previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
|
|
1778
2190
|
);
|
|
1779
2191
|
}, [phaseTimings.completedAt, state.type]);
|
|
1780
|
-
|
|
2192
|
+
useEffect4(() => {
|
|
1781
2193
|
if (!state.lastEvent) return;
|
|
1782
2194
|
setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
|
|
1783
2195
|
}, [state.lastEvent?.time, state.lastEvent?.type]);
|
|
1784
|
-
|
|
2196
|
+
useEffect4(() => {
|
|
1785
2197
|
savePhaseTimings(txHash, phaseTimings);
|
|
1786
2198
|
}, [txHash, phaseTimings]);
|
|
1787
|
-
|
|
2199
|
+
useEffect4(() => {
|
|
1788
2200
|
if (directTransfer) return;
|
|
1789
2201
|
if (state.type !== "processing") {
|
|
1790
2202
|
pollIntervalRef.current = INITIAL_POLL_INTERVAL;
|
|
@@ -1956,7 +2368,7 @@ function ProcessingStep({
|
|
|
1956
2368
|
state.type,
|
|
1957
2369
|
txHash
|
|
1958
2370
|
]);
|
|
1959
|
-
|
|
2371
|
+
useEffect4(() => {
|
|
1960
2372
|
if (directTransfer || state.type !== "processing") return;
|
|
1961
2373
|
const timeoutId = setTimeout(() => {
|
|
1962
2374
|
if (escalatedDelayRef.current) return;
|
|
@@ -1982,13 +2394,11 @@ function ProcessingStep({
|
|
|
1982
2394
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1983
2395
|
const isPostBridgeSwapEvent = lastEvent?.type === "post-bridge-swap-complete" || lastEvent?.type === "post-bridge-swap-failed";
|
|
1984
2396
|
const destinationTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.swap?.transactionHash || null : lastEvent?.data?.destination?.transactionHash || null;
|
|
1985
|
-
const bridgeTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.bridge?.transactionHash || null : null;
|
|
1986
2397
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
1987
2398
|
const displaySourceChain = sourceDetails.chainId ?? sourceChain;
|
|
1988
2399
|
const displaySourceToken = sourceDetails.token ?? sourceToken;
|
|
1989
2400
|
const displayAmount = sourceDetails.amount ?? amount;
|
|
1990
2401
|
const sourceExplorerUrl = getExplorerTxUrl(displaySourceChain, txHash);
|
|
1991
|
-
const bridgeExplorerUrl = bridgeTxHash ? getExplorerTxUrl(targetChain, bridgeTxHash) : null;
|
|
1992
2402
|
const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1993
2403
|
const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
|
|
1994
2404
|
const sourceSymbol = displaySourceChain === "solana" ? providedSourceSymbol ?? "SOL" : isEvmSourceToken ? getTokenSymbol(displaySourceToken, displaySourceChain) : providedSourceSymbol ?? "Token";
|
|
@@ -2012,278 +2422,145 @@ function ProcessingStep({
|
|
|
2012
2422
|
const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
|
|
2013
2423
|
const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
|
|
2014
2424
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
const fillStatusClass = isComplete ? "rs-card-value--success" : isFailed ? "rs-card-value--error" : "";
|
|
2021
|
-
const [detailsExpanded, setDetailsExpanded] = useState(false);
|
|
2022
|
-
const txLinkIcon = /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx7(
|
|
2023
|
-
"path",
|
|
2024
|
-
{
|
|
2025
|
-
strokeLinecap: "round",
|
|
2026
|
-
strokeLinejoin: "round",
|
|
2027
|
-
d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
|
|
2425
|
+
void delayPhaseId;
|
|
2426
|
+
void hasEscalatedDelay;
|
|
2427
|
+
const targetSymbol = (() => {
|
|
2428
|
+
if (typeof targetToken === "string" && /^0x[a-fA-F0-9]{40}$/.test(targetToken)) {
|
|
2429
|
+
return getTokenSymbol(targetToken, targetChain);
|
|
2028
2430
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2431
|
+
return providedSourceSymbol ?? "USDC";
|
|
2432
|
+
})();
|
|
2433
|
+
const targetTokenIcon = getTokenIcon(targetSymbol);
|
|
2434
|
+
const sourceChainIcon = getChainIcon(displaySourceChain);
|
|
2435
|
+
const targetChainIcon = getChainIcon(targetChain);
|
|
2436
|
+
const sourceTokenIcon = getTokenIcon(sourceSymbol);
|
|
2437
|
+
const sourceChainName = getChainName(displaySourceChain);
|
|
2438
|
+
const targetChainName = getChainName(targetChain);
|
|
2439
|
+
const totalTimeText = formatElapsedTime(elapsedSeconds);
|
|
2440
|
+
const feeSymbol = quotedFeeSymbol ?? sourceSymbol;
|
|
2441
|
+
const feeSponsored = uiConfig?.feeSponsored ?? false;
|
|
2442
|
+
const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
|
|
2443
|
+
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
2444
|
+
const stateVariant = isComplete ? "success" : isFailed ? "error" : "default";
|
|
2445
|
+
const stateIcon = isComplete ? /* @__PURE__ */ jsx10(CheckIcon, {}) : isFailed ? /* @__PURE__ */ jsx10(CloseIcon, {}) : /* @__PURE__ */ jsx10(WalletIcon, {});
|
|
2446
|
+
const handleRetry = onRetry ?? onNewDeposit;
|
|
2447
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
|
|
2448
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2449
|
+
/* @__PURE__ */ jsx10(
|
|
2450
|
+
BodyHeader,
|
|
2034
2451
|
{
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2452
|
+
variant: stateVariant,
|
|
2453
|
+
icon: stateIcon,
|
|
2454
|
+
title: stateTitle
|
|
2455
|
+
}
|
|
2456
|
+
),
|
|
2457
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-details", children: [
|
|
2458
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2459
|
+
/* @__PURE__ */ jsx10("span", { children: "Source chain" }),
|
|
2460
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2461
|
+
/* @__PURE__ */ jsx10("span", { children: sourceChainName }),
|
|
2462
|
+
sourceChainIcon && /* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx10("img", { src: sourceChainIcon, alt: "" }) }),
|
|
2463
|
+
sourceExplorerUrl && /* @__PURE__ */ jsx10(
|
|
2464
|
+
"a",
|
|
2042
2465
|
{
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2466
|
+
href: sourceExplorerUrl,
|
|
2467
|
+
target: "_blank",
|
|
2468
|
+
rel: "noopener noreferrer",
|
|
2469
|
+
className: "rs-amount-detail-link",
|
|
2470
|
+
"aria-label": "View source transaction",
|
|
2471
|
+
children: /* @__PURE__ */ jsx10(ExternalLinkIcon, {})
|
|
2046
2472
|
}
|
|
2047
|
-
)
|
|
2048
|
-
|
|
2049
|
-
|
|
2473
|
+
)
|
|
2474
|
+
] })
|
|
2475
|
+
] }),
|
|
2476
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2477
|
+
/* @__PURE__ */ jsx10("span", { children: "Destination chain" }),
|
|
2478
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2479
|
+
/* @__PURE__ */ jsx10("span", { children: targetChainName }),
|
|
2480
|
+
targetChainIcon && /* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx10("img", { src: targetChainIcon, alt: "" }) }),
|
|
2481
|
+
destExplorerUrl && /* @__PURE__ */ jsx10(
|
|
2482
|
+
"a",
|
|
2050
2483
|
{
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2484
|
+
href: destExplorerUrl,
|
|
2485
|
+
target: "_blank",
|
|
2486
|
+
rel: "noopener noreferrer",
|
|
2487
|
+
className: "rs-amount-detail-link",
|
|
2488
|
+
"aria-label": "View destination transaction",
|
|
2489
|
+
children: /* @__PURE__ */ jsx10(ExternalLinkIcon, {})
|
|
2054
2490
|
}
|
|
2055
2491
|
)
|
|
2056
|
-
]
|
|
2057
|
-
}
|
|
2058
|
-
) }) : isComplete ? /* @__PURE__ */ jsx7("div", { className: "rs-success-badge", children: /* @__PURE__ */ jsx7(
|
|
2059
|
-
"svg",
|
|
2060
|
-
{
|
|
2061
|
-
viewBox: "0 0 24 24",
|
|
2062
|
-
fill: "none",
|
|
2063
|
-
stroke: "currentColor",
|
|
2064
|
-
strokeWidth: "2.5",
|
|
2065
|
-
children: /* @__PURE__ */ jsx7(
|
|
2066
|
-
"path",
|
|
2067
|
-
{
|
|
2068
|
-
strokeLinecap: "round",
|
|
2069
|
-
strokeLinejoin: "round",
|
|
2070
|
-
d: "M5 12l5 5L20 7"
|
|
2071
|
-
}
|
|
2072
|
-
)
|
|
2073
|
-
}
|
|
2074
|
-
) }) : /* @__PURE__ */ jsx7("div", { className: "rs-processing-badge", children: /* @__PURE__ */ jsx7(Spinner, {}) }),
|
|
2075
|
-
/* @__PURE__ */ jsx7("div", { className: "rs-step-title", children: headerTitle }),
|
|
2076
|
-
/* @__PURE__ */ jsx7("div", { className: "rs-step-description rs-text-secondary", children: headerDescription })
|
|
2077
|
-
] }),
|
|
2078
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-step-body rs-space-y-3", children: [
|
|
2079
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-card", children: [
|
|
2080
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2081
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Fill status" }),
|
|
2082
|
-
/* @__PURE__ */ jsx7("span", { className: `rs-card-value ${fillStatusClass}`, children: fillStatus })
|
|
2492
|
+
] })
|
|
2083
2493
|
] }),
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
] })
|
|
2088
|
-
] }),
|
|
2089
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-card", children: [
|
|
2090
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2091
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Source" }),
|
|
2092
|
-
/* @__PURE__ */ jsxs6(
|
|
2093
|
-
"span",
|
|
2094
|
-
{
|
|
2095
|
-
className: "rs-card-value",
|
|
2096
|
-
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2097
|
-
children: [
|
|
2098
|
-
getChainIcon(displaySourceChain) && /* @__PURE__ */ jsx7(
|
|
2099
|
-
"img",
|
|
2100
|
-
{
|
|
2101
|
-
src: getChainIcon(displaySourceChain),
|
|
2102
|
-
alt: "",
|
|
2103
|
-
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2104
|
-
}
|
|
2105
|
-
),
|
|
2106
|
-
getChainName(displaySourceChain),
|
|
2107
|
-
sourceExplorerUrl && /* @__PURE__ */ jsx7(
|
|
2108
|
-
"a",
|
|
2109
|
-
{
|
|
2110
|
-
href: sourceExplorerUrl,
|
|
2111
|
-
target: "_blank",
|
|
2112
|
-
rel: "noopener noreferrer",
|
|
2113
|
-
className: "rs-card-external-link",
|
|
2114
|
-
children: txLinkIcon
|
|
2115
|
-
}
|
|
2116
|
-
)
|
|
2117
|
-
]
|
|
2118
|
-
}
|
|
2119
|
-
)
|
|
2494
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2495
|
+
/* @__PURE__ */ jsx10("span", { children: isProcessing ? "Estimated time" : "Total time" }),
|
|
2496
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-value", children: isProcessing ? estimatedTime : totalTimeText })
|
|
2120
2497
|
] }),
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
"span",
|
|
2125
|
-
{
|
|
2126
|
-
className: "rs-card-value",
|
|
2127
|
-
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2128
|
-
children: [
|
|
2129
|
-
getChainIcon(targetChain) && /* @__PURE__ */ jsx7(
|
|
2130
|
-
"img",
|
|
2131
|
-
{
|
|
2132
|
-
src: getChainIcon(targetChain),
|
|
2133
|
-
alt: "",
|
|
2134
|
-
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2135
|
-
}
|
|
2136
|
-
),
|
|
2137
|
-
getChainName(targetChain),
|
|
2138
|
-
destExplorerUrl && /* @__PURE__ */ jsx7(
|
|
2139
|
-
"a",
|
|
2140
|
-
{
|
|
2141
|
-
href: destExplorerUrl,
|
|
2142
|
-
target: "_blank",
|
|
2143
|
-
rel: "noopener noreferrer",
|
|
2144
|
-
className: "rs-card-external-link",
|
|
2145
|
-
children: txLinkIcon
|
|
2146
|
-
}
|
|
2147
|
-
)
|
|
2148
|
-
]
|
|
2149
|
-
}
|
|
2150
|
-
)
|
|
2151
|
-
] })
|
|
2152
|
-
] }),
|
|
2153
|
-
/* @__PURE__ */ jsx7("div", { className: "rs-card", children: /* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2154
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "You receive" }),
|
|
2155
|
-
/* @__PURE__ */ jsxs6(
|
|
2156
|
-
"span",
|
|
2157
|
-
{
|
|
2158
|
-
className: "rs-card-value",
|
|
2159
|
-
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2160
|
-
children: [
|
|
2161
|
-
getTokenIcon(sourceSymbol) && /* @__PURE__ */ jsx7(
|
|
2162
|
-
"img",
|
|
2163
|
-
{
|
|
2164
|
-
src: getTokenIcon(sourceSymbol),
|
|
2165
|
-
alt: "",
|
|
2166
|
-
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2167
|
-
}
|
|
2168
|
-
),
|
|
2498
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2499
|
+
/* @__PURE__ */ jsx10("span", { children: "You send" }),
|
|
2500
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2501
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
2169
2502
|
formattedReceivedAmount,
|
|
2170
2503
|
" ",
|
|
2171
2504
|
sourceSymbol
|
|
2172
|
-
]
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
] }) }),
|
|
2176
|
-
/* @__PURE__ */ jsxs6(
|
|
2177
|
-
"button",
|
|
2178
|
-
{
|
|
2179
|
-
type: "button",
|
|
2180
|
-
className: `rs-details-toggle ${detailsExpanded ? "rs-details-toggle--open" : ""}`,
|
|
2181
|
-
onClick: () => setDetailsExpanded(!detailsExpanded),
|
|
2182
|
-
children: [
|
|
2183
|
-
detailsExpanded ? "Less details" : "More details",
|
|
2184
|
-
/* @__PURE__ */ jsx7(
|
|
2185
|
-
"svg",
|
|
2186
|
-
{
|
|
2187
|
-
viewBox: "0 0 24 24",
|
|
2188
|
-
fill: "none",
|
|
2189
|
-
stroke: "currentColor",
|
|
2190
|
-
strokeWidth: "2",
|
|
2191
|
-
children: /* @__PURE__ */ jsx7(
|
|
2192
|
-
"path",
|
|
2193
|
-
{
|
|
2194
|
-
strokeLinecap: "round",
|
|
2195
|
-
strokeLinejoin: "round",
|
|
2196
|
-
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
2197
|
-
}
|
|
2198
|
-
)
|
|
2199
|
-
}
|
|
2200
|
-
)
|
|
2201
|
-
]
|
|
2202
|
-
}
|
|
2203
|
-
),
|
|
2204
|
-
detailsExpanded && /* @__PURE__ */ jsxs6("div", { className: "rs-card", children: [
|
|
2205
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2206
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Source tx" }),
|
|
2207
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs6(
|
|
2208
|
-
"a",
|
|
2209
|
-
{
|
|
2210
|
-
href: sourceExplorerUrl,
|
|
2211
|
-
target: "_blank",
|
|
2212
|
-
rel: "noopener noreferrer",
|
|
2213
|
-
className: "rs-card-external-link",
|
|
2214
|
-
style: { gap: 4, fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 },
|
|
2215
|
-
children: [
|
|
2216
|
-
truncateHash(txHash),
|
|
2217
|
-
txLinkIcon
|
|
2218
|
-
]
|
|
2219
|
-
}
|
|
2220
|
-
) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(txHash) }) })
|
|
2505
|
+
] }),
|
|
2506
|
+
sourceTokenIcon && /* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx10("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2507
|
+
] })
|
|
2221
2508
|
] }),
|
|
2222
|
-
|
|
2223
|
-
/* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
"
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
truncateHash(bridgeTxHash),
|
|
2234
|
-
txLinkIcon
|
|
2235
|
-
]
|
|
2236
|
-
}
|
|
2237
|
-
) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(bridgeTxHash) }) })
|
|
2509
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2510
|
+
/* @__PURE__ */ jsx10("span", { children: "Receive" }),
|
|
2511
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2512
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
2513
|
+
"~",
|
|
2514
|
+
formattedReceivedAmount,
|
|
2515
|
+
" ",
|
|
2516
|
+
targetSymbol
|
|
2517
|
+
] }),
|
|
2518
|
+
targetTokenIcon && /* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx10("img", { src: targetTokenIcon, alt: "" }) })
|
|
2519
|
+
] })
|
|
2238
2520
|
] }),
|
|
2239
|
-
|
|
2240
|
-
/* @__PURE__ */
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
"
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
txLinkIcon
|
|
2252
|
-
]
|
|
2253
|
-
}
|
|
2254
|
-
) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(destinationTxHash) }) })
|
|
2255
|
-
] })
|
|
2256
|
-
] }),
|
|
2257
|
-
showAlert && /* @__PURE__ */ jsxs6("div", { className: "rs-alert rs-alert--warning", children: [
|
|
2258
|
-
/* @__PURE__ */ jsx7(
|
|
2259
|
-
"svg",
|
|
2260
|
-
{
|
|
2261
|
-
className: "rs-alert-icon",
|
|
2262
|
-
viewBox: "0 0 24 24",
|
|
2263
|
-
fill: "none",
|
|
2264
|
-
stroke: "currentColor",
|
|
2265
|
-
strokeWidth: "2",
|
|
2266
|
-
children: /* @__PURE__ */ jsx7(
|
|
2267
|
-
"path",
|
|
2521
|
+
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2522
|
+
/* @__PURE__ */ jsx10("span", { children: "Balance" }),
|
|
2523
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2524
|
+
"$",
|
|
2525
|
+
balanceAfterUsd.toFixed(2)
|
|
2526
|
+
] })
|
|
2527
|
+
] }),
|
|
2528
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-amount-detail-row", children: [
|
|
2529
|
+
/* @__PURE__ */ jsx10("span", { children: "Fees" }),
|
|
2530
|
+
/* @__PURE__ */ jsxs9("span", { className: "rs-amount-detail-value", children: [
|
|
2531
|
+
/* @__PURE__ */ jsxs9(
|
|
2532
|
+
"span",
|
|
2268
2533
|
{
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2534
|
+
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2535
|
+
children: [
|
|
2536
|
+
quotedFeeAmount,
|
|
2537
|
+
" ",
|
|
2538
|
+
feeSymbol
|
|
2539
|
+
]
|
|
2272
2540
|
}
|
|
2273
|
-
)
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
] })
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2541
|
+
),
|
|
2542
|
+
/* @__PURE__ */ jsx10(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx10("span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx10(InfoIcon, {}) }) })
|
|
2543
|
+
] })
|
|
2544
|
+
] })
|
|
2545
|
+
] }),
|
|
2546
|
+
isFailed && failureMessage && /* @__PURE__ */ jsxs9("div", { className: "rs-amount-error", role: "alert", children: [
|
|
2547
|
+
/* @__PURE__ */ jsx10(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
2548
|
+
/* @__PURE__ */ jsx10("span", { children: failureMessage })
|
|
2549
|
+
] }),
|
|
2550
|
+
isProcessing && /* @__PURE__ */ jsx10(Button, { fullWidth: true, disabled: true, loading: true, children: "Submitting transaction..." }),
|
|
2551
|
+
isComplete && /* @__PURE__ */ jsxs9("div", { className: "rs-screen-button-row", children: [
|
|
2552
|
+
onNewDeposit && /* @__PURE__ */ jsxs9(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: [
|
|
2553
|
+
"New ",
|
|
2554
|
+
flowNoun
|
|
2555
|
+
] }),
|
|
2556
|
+
onClose && /* @__PURE__ */ jsx10(Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
2557
|
+
] }),
|
|
2558
|
+
isFailed && /* @__PURE__ */ jsxs9("div", { className: "rs-screen-button-row", children: [
|
|
2559
|
+
onClose && /* @__PURE__ */ jsx10(Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
|
|
2560
|
+
handleRetry && /* @__PURE__ */ jsx10(Button, { onClick: handleRetry, fullWidth: true, children: "Try again" })
|
|
2284
2561
|
] })
|
|
2285
2562
|
] }),
|
|
2286
|
-
/* @__PURE__ */
|
|
2563
|
+
/* @__PURE__ */ jsx10(PoweredBy, {})
|
|
2287
2564
|
] });
|
|
2288
2565
|
}
|
|
2289
2566
|
|
|
@@ -2305,27 +2582,45 @@ function getPublicClient(chainId) {
|
|
|
2305
2582
|
|
|
2306
2583
|
export {
|
|
2307
2584
|
Modal,
|
|
2585
|
+
WalletIcon,
|
|
2586
|
+
ExternalLinkIcon,
|
|
2587
|
+
CheckIcon,
|
|
2588
|
+
ChevronLeftIcon,
|
|
2589
|
+
ChevronDownIcon,
|
|
2590
|
+
CloseIcon,
|
|
2591
|
+
CoinsIcon,
|
|
2592
|
+
HistoryIcon,
|
|
2593
|
+
InfoIcon,
|
|
2594
|
+
CopyIcon,
|
|
2595
|
+
ArrowRightIcon,
|
|
2596
|
+
AlertTriangleIcon,
|
|
2597
|
+
PercentIcon,
|
|
2598
|
+
ClockIcon,
|
|
2599
|
+
PlusCircleIcon,
|
|
2600
|
+
CircleArrowOutUpLeftIcon,
|
|
2601
|
+
BodyHeader,
|
|
2602
|
+
PoweredBy,
|
|
2603
|
+
ConnectStep,
|
|
2308
2604
|
Spinner,
|
|
2309
2605
|
Button,
|
|
2310
|
-
ConnectStep,
|
|
2311
2606
|
debugLog,
|
|
2312
2607
|
debugError,
|
|
2313
2608
|
toEvmCaip2,
|
|
2314
2609
|
parseEvmChainId,
|
|
2315
2610
|
isSolanaCaip2,
|
|
2316
|
-
buildSessionDetails,
|
|
2317
|
-
createDepositService,
|
|
2318
2611
|
getAssetId,
|
|
2319
2612
|
portfolioToAssets,
|
|
2320
2613
|
isNativeAsset,
|
|
2614
|
+
buildSessionDetails,
|
|
2615
|
+
createDepositService,
|
|
2321
2616
|
loadSessionOwnerFromStorage,
|
|
2322
2617
|
saveSessionOwnerToStorage,
|
|
2323
2618
|
createSessionOwnerKey,
|
|
2324
2619
|
accountFromPrivateKey,
|
|
2325
|
-
PoweredBy,
|
|
2326
2620
|
currencyFormatter,
|
|
2327
2621
|
tokenFormatter,
|
|
2328
2622
|
formatUserError,
|
|
2623
|
+
Tooltip,
|
|
2329
2624
|
getEventTxHash,
|
|
2330
2625
|
isDepositEvent,
|
|
2331
2626
|
txRefsMatch,
|