@rhinestone/deposit-modal 0.3.0 → 0.4.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/dist/{DepositModalReown-DNW4GH6L.cjs → DepositModalReown-KFTMS2WX.cjs} +9 -7
- package/dist/{DepositModalReown-6SUEC5IU.mjs → DepositModalReown-PC7EX5VK.mjs} +6 -4
- package/dist/{WithdrawModalReown-7UAGSOSU.mjs → WithdrawModalReown-BE23LUMT.mjs} +5 -4
- package/dist/{WithdrawModalReown-OUWBSKSM.cjs → WithdrawModalReown-Z2YF2FSJ.cjs} +8 -7
- package/dist/{caip-CrQ2KKU-.d.cts → caip-CsslyHGL.d.cts} +1 -1
- package/dist/{caip-CrQ2KKU-.d.ts → caip-CsslyHGL.d.ts} +1 -1
- package/dist/{chunk-33H6O5UU.cjs → chunk-3MXWIYAT.cjs} +16 -6
- package/dist/{chunk-KJ2RR2D4.mjs → chunk-3PVDRSJ7.mjs} +930 -682
- package/dist/{chunk-VVJAIMKB.cjs → chunk-7MP2UWIQ.cjs} +1091 -843
- package/dist/{chunk-MILJQWPT.cjs → chunk-ABVRVW3P.cjs} +133 -8
- package/dist/{chunk-2SMS542Q.cjs → chunk-AE5LHTPM.cjs} +122 -100
- package/dist/chunk-F7P4MV72.mjs +295 -0
- package/dist/chunk-FJWLC4AM.mjs +212 -0
- package/dist/{chunk-KAWJABTW.mjs → chunk-GKC22JC4.mjs} +901 -717
- package/dist/chunk-NRNJAQUA.cjs +212 -0
- package/dist/{chunk-RABZINV3.cjs → chunk-OQVLEVNR.cjs} +758 -574
- package/dist/chunk-UEKPBRBY.cjs +295 -0
- package/dist/{chunk-GPSBM66J.mjs → chunk-UFKFSGT3.mjs} +14 -4
- package/dist/{chunk-TKQYTBU6.mjs → chunk-WCIGOV34.mjs} +36 -14
- package/dist/{chunk-6YRDD462.mjs → chunk-WJX3TJFK.mjs} +135 -10
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -4
- package/dist/deposit.d.cts +4 -4
- package/dist/deposit.d.ts +4 -4
- package/dist/deposit.mjs +5 -3
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +6 -4
- package/dist/polymarket.cjs +64 -0
- package/dist/polymarket.d.cts +57 -0
- package/dist/polymarket.d.ts +57 -0
- package/dist/polymarket.mjs +64 -0
- package/dist/styles.css +252 -9
- package/dist/{types-BMcGO5k_.d.cts → types-CFRuisqK.d.cts} +10 -1
- package/dist/{types-BMcGO5k_.d.ts → types-CFRuisqK.d.ts} +10 -1
- package/dist/withdraw.cjs +5 -4
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +4 -3
- package/package.json +15 -2
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkABVRVW3Pcjs = require('./chunk-ABVRVW3P.cjs');
|
|
17
17
|
|
|
18
18
|
// src/components/ui/Modal.tsx
|
|
19
19
|
|
|
@@ -214,7 +214,40 @@ var PlusCircleIcon = _lucidereact.CirclePlus;
|
|
|
214
214
|
var CircleArrowOutUpLeftIcon = _lucidereact.CircleArrowOutUpLeft;
|
|
215
215
|
var CardIcon = _lucidereact.CreditCard;
|
|
216
216
|
var BankIcon = _lucidereact.Landmark;
|
|
217
|
-
var
|
|
217
|
+
var UnplugIcon = _lucidereact.Unplug;
|
|
218
|
+
function AppleIcon() {
|
|
219
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
220
|
+
"svg",
|
|
221
|
+
{
|
|
222
|
+
width: "24",
|
|
223
|
+
height: "24",
|
|
224
|
+
viewBox: "0 0 24 24",
|
|
225
|
+
fill: "none",
|
|
226
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
227
|
+
"aria-hidden": "true",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
230
|
+
"path",
|
|
231
|
+
{
|
|
232
|
+
d: "M16.36 1.43c0 1.14-.49 2.27-1.18 3.08-.74.9-1.99 1.57-2.98 1.57-.12 0-.23-.02-.3-.03-.01-.06-.04-.22-.04-.39 0-1.15.57-2.27 1.2-2.98.8-.94 2.15-1.64 3.25-1.68.03.13.05.28.05.43z",
|
|
233
|
+
stroke: "currentColor",
|
|
234
|
+
strokeWidth: "1.6",
|
|
235
|
+
strokeLinejoin: "round"
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
+
"path",
|
|
240
|
+
{
|
|
241
|
+
d: "M20.93 17.14c-.03.07-.46 1.58-1.52 3.12-.94 1.34-1.94 2.71-3.43 2.71-1.51 0-1.9-.88-3.63-.88-1.7 0-2.3.91-3.67.91-1.38 0-2.33-1.26-3.43-2.8-1.29-1.82-2.32-4.63-2.32-7.28 0-4.28 2.8-6.55 5.55-6.55 1.45 0 2.68.95 3.6.95.86 0 2.22-1.01 3.9-1.01.61 0 2.89.06 4.37 2.19-.13.09-2.38 1.37-2.38 4.19 0 3.26 2.85 4.42 2.96 4.45z",
|
|
242
|
+
stroke: "currentColor",
|
|
243
|
+
strokeWidth: "1.6",
|
|
244
|
+
strokeLinejoin: "round"
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
218
251
|
|
|
219
252
|
// src/components/ui/Callout.tsx
|
|
220
253
|
|
|
@@ -916,7 +949,7 @@ function createDepositService(baseUrl, options) {
|
|
|
916
949
|
},
|
|
917
950
|
async checkLiquidity(params) {
|
|
918
951
|
if (params.destinationChainId === "solana") {
|
|
919
|
-
const token =
|
|
952
|
+
const token = _chunkABVRVW3Pcjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
920
953
|
return {
|
|
921
954
|
hasLiquidity: true,
|
|
922
955
|
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _22 => _22.symbol]), () => ( "Token")),
|
|
@@ -1207,14 +1240,14 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1207
1240
|
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _29 => _29.balance, 'optionalAccess', _30 => _30.unlocked]), () => ( "0"));
|
|
1208
1241
|
const normalizedName = tokenData.tokenName.trim();
|
|
1209
1242
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1210
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1211
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
1243
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkABVRVW3Pcjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
1244
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkABVRVW3Pcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1212
1245
|
if (!resolvedTokenAddress) {
|
|
1213
1246
|
continue;
|
|
1214
1247
|
}
|
|
1215
|
-
const registrySymbol =
|
|
1248
|
+
const registrySymbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
1216
1249
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1217
|
-
const decimals = registrySymbol !== "Token" ?
|
|
1250
|
+
const decimals = registrySymbol !== "Token" ? _chunkABVRVW3Pcjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1218
1251
|
tokens.push({
|
|
1219
1252
|
chainId: chainBalance.chainId,
|
|
1220
1253
|
address: resolvedTokenAddress,
|
|
@@ -1234,7 +1267,7 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1234
1267
|
function normalizeDirectToken(token) {
|
|
1235
1268
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1236
1269
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1237
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1270
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkABVRVW3Pcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : _chunkABVRVW3Pcjs.parseEvmChainId.call(void 0, rawChainString) : null)));
|
|
1238
1271
|
if (chainId === null) return null;
|
|
1239
1272
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1240
1273
|
if (!symbol) return null;
|
|
@@ -1243,14 +1276,14 @@ function normalizeDirectToken(token) {
|
|
|
1243
1276
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1244
1277
|
token.token,
|
|
1245
1278
|
"address"
|
|
1246
|
-
))), () => ( (typeof chainId === "number" ?
|
|
1279
|
+
))), () => ( (typeof chainId === "number" ? _chunkABVRVW3Pcjs.getTokenAddress.call(void 0, symbol, chainId) : void 0)));
|
|
1247
1280
|
if (!address) return null;
|
|
1248
1281
|
const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
|
|
1249
1282
|
const isSolanaToken = chainId === "solana";
|
|
1250
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
1283
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, address, chainId);
|
|
1251
1284
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1252
1285
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1253
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
1286
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkABVRVW3Pcjs.getTokenDecimalsByAddress.call(void 0, address, chainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
1254
1287
|
return {
|
|
1255
1288
|
chainId,
|
|
1256
1289
|
address,
|
|
@@ -1369,7 +1402,7 @@ var clientCache = /* @__PURE__ */ new Map();
|
|
|
1369
1402
|
function getPublicClient(chainId) {
|
|
1370
1403
|
let client = clientCache.get(chainId);
|
|
1371
1404
|
if (!client) {
|
|
1372
|
-
const chain =
|
|
1405
|
+
const chain = _chunkABVRVW3Pcjs.CHAIN_BY_ID[chainId];
|
|
1373
1406
|
client = _viem.createPublicClient.call(void 0, {
|
|
1374
1407
|
chain,
|
|
1375
1408
|
transport: _viem.http.call(void 0, )
|
|
@@ -1554,7 +1587,8 @@ function BodyHeader({
|
|
|
1554
1587
|
icon,
|
|
1555
1588
|
title,
|
|
1556
1589
|
subtitle,
|
|
1557
|
-
variant = "default"
|
|
1590
|
+
variant = "default",
|
|
1591
|
+
aside
|
|
1558
1592
|
}) {
|
|
1559
1593
|
const iconClasses = [
|
|
1560
1594
|
"rs-body-header-icon",
|
|
@@ -1563,9 +1597,12 @@ function BodyHeader({
|
|
|
1563
1597
|
].filter(Boolean).join(" ");
|
|
1564
1598
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
1565
1599
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: iconClasses, children: icon }),
|
|
1566
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-
|
|
1567
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1568
|
-
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-main", children: [
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-text", children: [
|
|
1602
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: title }),
|
|
1603
|
+
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-body-header-subtitle", children: subtitle })
|
|
1604
|
+
] }),
|
|
1605
|
+
aside && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-aside", children: aside })
|
|
1569
1606
|
] })
|
|
1570
1607
|
] });
|
|
1571
1608
|
}
|
|
@@ -1672,6 +1709,9 @@ function Spinner({ className }) {
|
|
|
1672
1709
|
);
|
|
1673
1710
|
}
|
|
1674
1711
|
|
|
1712
|
+
// src/components/steps/ConnectStep.tsx
|
|
1713
|
+
|
|
1714
|
+
|
|
1675
1715
|
// src/components/ui/ListRow.tsx
|
|
1676
1716
|
|
|
1677
1717
|
function ListRow({
|
|
@@ -1745,6 +1785,32 @@ function ListRow({
|
|
|
1745
1785
|
}
|
|
1746
1786
|
ListRow.displayName = "ListRow";
|
|
1747
1787
|
|
|
1788
|
+
// src/components/ui/SegmentedToggle.tsx
|
|
1789
|
+
|
|
1790
|
+
function SegmentedToggle({
|
|
1791
|
+
options,
|
|
1792
|
+
value,
|
|
1793
|
+
onChange,
|
|
1794
|
+
ariaLabel
|
|
1795
|
+
}) {
|
|
1796
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-segmented", role: "tablist", "aria-label": ariaLabel, children: options.map((opt) => {
|
|
1797
|
+
const active = opt.value === value;
|
|
1798
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1799
|
+
"button",
|
|
1800
|
+
{
|
|
1801
|
+
type: "button",
|
|
1802
|
+
role: "tab",
|
|
1803
|
+
"aria-selected": active,
|
|
1804
|
+
className: `rs-segmented-option${active ? " rs-segmented-option--active" : ""}`,
|
|
1805
|
+
onClick: () => onChange(opt.value),
|
|
1806
|
+
children: opt.label
|
|
1807
|
+
},
|
|
1808
|
+
opt.value
|
|
1809
|
+
);
|
|
1810
|
+
}) });
|
|
1811
|
+
}
|
|
1812
|
+
SegmentedToggle.displayName = "SegmentedToggle";
|
|
1813
|
+
|
|
1748
1814
|
// src/components/ui/WalletBadgeIcons/RabbyIcon.tsx
|
|
1749
1815
|
|
|
1750
1816
|
function RabbyIcon() {
|
|
@@ -2061,6 +2127,104 @@ function ChainBadgeIcons() {
|
|
|
2061
2127
|
}
|
|
2062
2128
|
ChainBadgeIcons.displayName = "ChainBadgeIcons";
|
|
2063
2129
|
|
|
2130
|
+
// src/components/ui/BrandIcons.tsx
|
|
2131
|
+
|
|
2132
|
+
function VisaMark() {
|
|
2133
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 7.4 24 9", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2134
|
+
"path",
|
|
2135
|
+
{
|
|
2136
|
+
fill: "#1A1F71",
|
|
2137
|
+
d: "M9.112 8.262 5.97 15.758H3.92L2.374 9.775c-.094-.368-.175-.503-.461-.658C1.447 8.864.677 8.627 0 8.479l.046-.217h3.3a.904.904 0 0 1 .894.764l.817 4.338 2.018-5.102zm8.033 5.049c.008-1.979-2.736-2.088-2.717-2.972.006-.269.262-.555.822-.628a3.66 3.66 0 0 1 1.913.336l.34-1.59a5.207 5.207 0 0 0-1.814-.333c-1.917 0-3.266 1.02-3.278 2.479-.012 1.079.963 1.68 1.698 2.04.756.367 1.01.603 1.006.931-.005.504-.602.725-1.16.734-.975.015-1.54-.263-1.992-.473l-.351 1.642c.453.208 1.289.39 2.156.398 2.037 0 3.37-1.006 3.377-2.564m5.061 2.447H24l-1.565-7.496h-1.656a.883.883 0 0 0-.826.55l-2.909 6.946h2.036l.405-1.12h2.488zm-2.163-2.656 1.02-2.815.588 2.815zm-8.16-4.84-1.603 7.496H8.34l1.605-7.496z"
|
|
2138
|
+
}
|
|
2139
|
+
) });
|
|
2140
|
+
}
|
|
2141
|
+
function MastercardMark() {
|
|
2142
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 3.5 24 17", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
2143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2144
|
+
"path",
|
|
2145
|
+
{
|
|
2146
|
+
fill: "#EB001B",
|
|
2147
|
+
d: "M11.343 18.031c.058.049.12.098.181.146-1.177.783-2.59 1.238-4.107 1.238C3.32 19.416 0 16.096 0 12c0-4.095 3.32-7.416 7.416-7.416 1.518 0 2.931.456 4.105 1.238-.06.051-.12.098-.165.15C9.6 7.489 8.595 9.688 8.595 12c0 2.311 1.001 4.51 2.748 6.031z"
|
|
2148
|
+
}
|
|
2149
|
+
),
|
|
2150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2151
|
+
"path",
|
|
2152
|
+
{
|
|
2153
|
+
fill: "#F79E1B",
|
|
2154
|
+
d: "M16.584 4.584c-1.52 0-2.931.456-4.105 1.238.06.051.12.098.165.15C14.4 7.489 15.405 9.688 15.405 12c0 2.31-1.001 4.507-2.748 6.031-.058.049-.12.098-.181.146 1.177.783 2.588 1.238 4.107 1.238C20.68 19.416 24 16.096 24 12c0-4.094-3.32-7.416-7.416-7.416z"
|
|
2155
|
+
}
|
|
2156
|
+
),
|
|
2157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2158
|
+
"path",
|
|
2159
|
+
{
|
|
2160
|
+
fill: "#FF5F00",
|
|
2161
|
+
d: "M12 6.174c-.096.075-.189.15-.28.231C10.156 7.764 9.169 9.765 9.169 12c0 2.236.987 4.236 2.551 5.595.09.08.185.158.28.232.096-.074.189-.152.28-.232 1.563-1.359 2.551-3.359 2.551-5.595 0-2.235-.987-4.236-2.551-5.595-.09-.08-.184-.156-.28-.231z"
|
|
2162
|
+
}
|
|
2163
|
+
)
|
|
2164
|
+
] });
|
|
2165
|
+
}
|
|
2166
|
+
function AmexMark() {
|
|
2167
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2168
|
+
"path",
|
|
2169
|
+
{
|
|
2170
|
+
fill: "#2E77BC",
|
|
2171
|
+
d: "M16.015 14.378c0-.32-.135-.496-.344-.622-.21-.12-.464-.135-.81-.135h-1.543v2.82h.675v-1.027h.72c.24 0 .39.024.478.125.12.13.104.38.104.55v.35h.66v-.555c-.002-.25-.017-.376-.108-.516-.06-.08-.18-.18-.33-.234l.02-.008c.18-.072.48-.297.48-.747zm-.87.407-.028-.002c-.09.053-.195.058-.33.058h-.81v-.63h.824c.12 0 .24 0 .33.05.098.048.156.147.15.255 0 .12-.045.215-.134.27zM20.297 15.837H19v.6h1.304c.676 0 1.05-.278 1.05-.884 0-.28-.066-.448-.187-.582-.153-.133-.392-.193-.73-.207l-.376-.015c-.104 0-.18 0-.255-.03-.09-.03-.15-.105-.15-.21 0-.09.017-.166.09-.21.083-.046.177-.066.272-.06h1.23v-.602h-1.35c-.704 0-.958.437-.958.84 0 .9.776.855 1.407.87.104 0 .18.015.225.06.046.03.082.106.082.18 0 .077-.035.15-.08.18-.06.053-.15.07-.277.07zM0 0v10.096L.81 8.22h1.75l.225.464V8.22h2.043l.45 1.02.437-1.013h6.502c.295 0 .56.057.756.236v-.23h1.787v.23c.307-.17.686-.23 1.12-.23h2.606l.24.466v-.466h1.918l.254.465v-.466h1.858v3.948H20.87l-.36-.6v.585h-2.353l-.256-.63h-.583l-.27.614h-1.213c-.48 0-.84-.104-1.08-.24v.24h-2.89v-.884c0-.12-.03-.12-.105-.135h-.105v1.036H6.067v-.48l-.21.48H4.69l-.202-.48v.465H2.235l-.256-.624H1.4l-.256.624H0V24h23.786v-7.108c-.27.135-.613.18-.973.18H21.09v-.255c-.21.165-.57.255-.914.255H14.71v-.9c0-.12-.018-.12-.12-.12h-.075v1.022h-1.8v-1.066c-.298.136-.643.15-.928.136h-.214v.915h-2.18l-.54-.617-.57.6H4.742v-3.93h3.61l.518.602.554-.6h2.412c.28 0 .74.03.942.225v-.24h2.177c.202 0 .644.045.903.225v-.24h3.265v.24c.163-.164.508-.24.803-.24h1.89v.24c.194-.15.464-.24.84-.24h1.176V0H0zM18.597 14.208v-.583h-2.235v2.833h2.235v-.585h-1.57v-.57h1.533v-.584h-1.532v-.51M13.51 8.787h.685V11.6h-.684zM13.126 9.543l-.007.006c0-.314-.13-.5-.34-.624-.217-.125-.47-.135-.81-.135H10.43v2.82h.674v-1.034h.72c.24 0 .39.03.487.12.122.136.107.378.107.548v.354h.677v-.553c0-.25-.016-.375-.11-.516-.09-.107-.202-.19-.33-.237.172-.07.472-.3.472-.75zm-.855.396h-.015c-.09.054-.195.056-.33.056H11.1v-.623h.825c.12 0 .24.004.33.05.09.04.15.128.15.25s-.047.22-.134.266zM15.92 9.373h.632v-.6h-.644c-.464 0-.804.105-1.02.33-.286.3-.362.69-.362 1.11 0 .512.123.833.36 1.074.232.238.645.31.97.31h.78l.255-.627h1.39l.262.627h1.36v-2.11l1.272 2.11h.95l.002.002V8.786h-.684v1.963l-1.18-1.96h-1.02V11.4L18.11 8.744h-1.004l-.943 2.22h-.3c-.177 0-.362-.03-.468-.134-.125-.15-.186-.36-.186-.662 0-.285.08-.51.194-.63.133-.135.272-.165.516-.165zm1.668-.108.464 1.118v.002h-.93l.466-1.12zM2.38 10.97l.254.628H4V9.393l.972 2.205h.584l.973-2.202.015 2.202h.69v-2.81H6.118l-.807 1.904-.876-1.905H3.343v2.663L2.205 8.787h-.997L.01 11.597h.72l.26-.626h1.39zm-.688-1.705.46 1.118-.003.002h-.915l.457-1.12zM11.856 13.62H9.714l-.85.923-.825-.922H5.346v2.82H8l.855-.932.824.93h1.302v-.94h.838c.6 0 1.17-.164 1.17-.945l-.006-.003c0-.78-.598-.93-1.128-.93zM7.67 15.853l-.014-.002H6.02v-.557h1.47v-.574H6.02v-.51H7.7l.733.82-.764.824zm2.642.33-1.03-1.147 1.03-1.108v2.253zm1.553-1.258h-.885v-.717h.885c.24 0 .42.098.42.344 0 .243-.15.372-.42.372zM9.967 9.373v-.586H7.73V11.6h2.237v-.58H8.4v-.564h1.527V9.88H8.4v-.507"
|
|
2172
|
+
}
|
|
2173
|
+
) });
|
|
2174
|
+
}
|
|
2175
|
+
function CoinbaseMark() {
|
|
2176
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
2177
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { width: "20", height: "20", rx: "5", fill: "#0052FF" }),
|
|
2178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2179
|
+
"path",
|
|
2180
|
+
{
|
|
2181
|
+
d: "M10.029 13.247a3.188 3.188 0 1 1 3.137-3.747h3.207A6.375 6.375 0 1 0 16.373 10.5h-3.211a3.19 3.19 0 0 1-3.133 2.747Z",
|
|
2182
|
+
fill: "#fff"
|
|
2183
|
+
}
|
|
2184
|
+
)
|
|
2185
|
+
] });
|
|
2186
|
+
}
|
|
2187
|
+
function BinanceMark() {
|
|
2188
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
2189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "10", cy: "10", r: "10", fill: "#181A20" }),
|
|
2190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { x: "3", y: "3", width: "14", height: "14", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2191
|
+
"path",
|
|
2192
|
+
{
|
|
2193
|
+
fill: "#F0B90B",
|
|
2194
|
+
d: "m16.624 13.920 2.718 2.716-7.353 7.353-7.353-7.353 2.717-2.716 4.636 4.66zm4.637-4.636L24 12l-2.715 2.716L18.568 12zm-9.272.001 2.716 2.691-2.716 2.717L9.272 12zm-9.273-.001L5.409 12l-2.692 2.692L0 12zM11.989.012l7.353 7.329-2.718 2.715-4.635-4.636-4.636 4.66-2.717-2.716z"
|
|
2195
|
+
}
|
|
2196
|
+
) })
|
|
2197
|
+
] });
|
|
2198
|
+
}
|
|
2199
|
+
function KrakenMark() {
|
|
2200
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
2201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "10", cy: "10", r: "10", fill: "#7133F5" }),
|
|
2202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { x: "3", y: "3", width: "14", height: "14", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2203
|
+
"path",
|
|
2204
|
+
{
|
|
2205
|
+
fill: "#fff",
|
|
2206
|
+
d: "M11.998 4.5C7.028 4.5 3 8.774 3 14.047v4.09c0 .753.575 1.363 1.285 1.363s1.288-.61 1.288-1.362v-4.091c0-.755.573-1.365 1.285-1.365.71 0 1.284.61 1.284 1.365v4.09c0 .753.575 1.363 1.285 1.363.712 0 1.286-.61 1.286-1.362v-4.091c0-.755.575-1.365 1.285-1.365.712 0 1.289.61 1.289 1.365v4.09c0 .753.574 1.363 1.284 1.363s1.285-.61 1.285-1.362v-4.091c0-.755.574-1.365 1.288-1.365.71 0 1.285.61 1.285 1.365v4.09c0 .753.575 1.363 1.287 1.363.71 0 1.284-.61 1.284-1.362v-4.091C21 8.774 16.97 4.5 11.998 4.5"
|
|
2207
|
+
}
|
|
2208
|
+
) })
|
|
2209
|
+
] });
|
|
2210
|
+
}
|
|
2211
|
+
function CardNetworkIcons() {
|
|
2212
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-list-row-meta-icons rs-list-row-meta-icons--cards", children: [
|
|
2213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AmexMark, {}) }),
|
|
2214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, VisaMark, {}) }),
|
|
2215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MastercardMark, {}) })
|
|
2216
|
+
] });
|
|
2217
|
+
}
|
|
2218
|
+
CardNetworkIcons.displayName = "CardNetworkIcons";
|
|
2219
|
+
function ExchangeBadgeIcons() {
|
|
2220
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-list-row-meta-icons", children: [
|
|
2221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CoinbaseMark, {}) }),
|
|
2222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BinanceMark, {}) }),
|
|
2223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KrakenMark, {}) })
|
|
2224
|
+
] });
|
|
2225
|
+
}
|
|
2226
|
+
ExchangeBadgeIcons.displayName = "ExchangeBadgeIcons";
|
|
2227
|
+
|
|
2064
2228
|
// src/components/steps/ConnectStep.tsx
|
|
2065
2229
|
|
|
2066
2230
|
function formatBalanceUsd(value) {
|
|
@@ -2072,6 +2236,10 @@ function fiatIcon(name) {
|
|
|
2072
2236
|
if (name === "bank") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BankIcon, {});
|
|
2073
2237
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardIcon, {});
|
|
2074
2238
|
}
|
|
2239
|
+
function fiatMeta(name) {
|
|
2240
|
+
if (name === "apple" || name === "bank") return void 0;
|
|
2241
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardNetworkIcons, {});
|
|
2242
|
+
}
|
|
2075
2243
|
function shorten(addr) {
|
|
2076
2244
|
return addr.length > 12 ? `${addr.slice(0, 6)}...${addr.slice(-4)}` : addr;
|
|
2077
2245
|
}
|
|
@@ -2090,15 +2258,20 @@ function renderWalletLeading(row) {
|
|
|
2090
2258
|
}
|
|
2091
2259
|
var TRANSFER_CRYPTO_LEADING = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TransferCryptoIcon, {});
|
|
2092
2260
|
var WALLET_LEADING = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WalletIcon, {});
|
|
2261
|
+
var EXCHANGE_LEADING = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UnplugIcon, {});
|
|
2093
2262
|
var SMALL_SPINNER = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" });
|
|
2094
2263
|
var CONNECT_META = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2095
2264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WalletBadgeIcons, {}),
|
|
2096
|
-
"+100
|
|
2265
|
+
"+100"
|
|
2097
2266
|
] });
|
|
2098
|
-
var
|
|
2267
|
+
var EXCHANGE_META = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExchangeBadgeIcons, {}),
|
|
2269
|
+
"+6"
|
|
2270
|
+
] });
|
|
2271
|
+
var EXTRA_CHAIN_COUNT = Math.max(0, _chunkABVRVW3Pcjs.getSupportedChainIds.call(void 0, ).length - 3);
|
|
2099
2272
|
var CHAIN_BADGE_META = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2100
2273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainBadgeIcons, {}),
|
|
2101
|
-
EXTRA_CHAIN_COUNT > 0 ? `+${EXTRA_CHAIN_COUNT}
|
|
2274
|
+
EXTRA_CHAIN_COUNT > 0 ? `+${EXTRA_CHAIN_COUNT}` : null
|
|
2102
2275
|
] });
|
|
2103
2276
|
function renderRowTrailing(state) {
|
|
2104
2277
|
if (state === "loading") {
|
|
@@ -2122,7 +2295,8 @@ function ConnectStep({
|
|
|
2122
2295
|
dappImports,
|
|
2123
2296
|
onSelectDappImport,
|
|
2124
2297
|
title = "Deposit",
|
|
2125
|
-
subtitle
|
|
2298
|
+
subtitle,
|
|
2299
|
+
defaultMethodTab = "crypto"
|
|
2126
2300
|
}) {
|
|
2127
2301
|
const rows = _nullishCoalesce(walletRows, () => ( []));
|
|
2128
2302
|
const handleConnect = _nullishCoalesce(onConnect, () => ( onRequestConnect));
|
|
@@ -2131,143 +2305,209 @@ function ConnectStep({
|
|
|
2131
2305
|
);
|
|
2132
2306
|
const showDappImports = (_nullishCoalesce(_optionalChain([dappImports, 'optionalAccess', _63 => _63.length]), () => ( 0))) > 0;
|
|
2133
2307
|
const defaultSubtitle = onSelectTransferCrypto ? "Add money to your balance" : "Choose a wallet to continue";
|
|
2134
|
-
|
|
2135
|
-
|
|
2308
|
+
const cryptoRows = [];
|
|
2309
|
+
if (onSelectTransferCrypto) {
|
|
2310
|
+
cryptoRows.push(
|
|
2136
2311
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2137
|
-
|
|
2312
|
+
ListRow,
|
|
2138
2313
|
{
|
|
2139
|
-
|
|
2140
|
-
title,
|
|
2141
|
-
subtitle: _nullishCoalesce(
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2314
|
+
leading: TRANSFER_CRYPTO_LEADING,
|
|
2315
|
+
title: "Transfer crypto",
|
|
2316
|
+
subtitle: transferCryptoState === "error" ? _nullishCoalesce(transferCryptoErrorReason, () => ( "Couldn't prepare account \u2014 tap to retry")) : "Instant - No limit",
|
|
2317
|
+
meta: CHAIN_BADGE_META,
|
|
2318
|
+
onClick: onSelectTransferCrypto
|
|
2319
|
+
},
|
|
2320
|
+
"transfer-crypto"
|
|
2321
|
+
)
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
for (const row of rows) {
|
|
2325
|
+
const collapseToExternal = Boolean(onSelectTransferCrypto) && row.kind !== "solana";
|
|
2326
|
+
const subtitleText = row.state === "loading" ? "Preparing\u2026" : row.state === "error" ? _nullishCoalesce(row.errorReason, () => ( "Couldn't prepare wallet \u2014 tap to retry")) : shorten(row.address);
|
|
2327
|
+
cryptoRows.push(
|
|
2328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2329
|
+
ListRow,
|
|
2330
|
+
{
|
|
2331
|
+
leading: renderWalletLeading(row),
|
|
2332
|
+
title: collapseToExternal ? "External wallet" : row.label,
|
|
2333
|
+
subtitle: subtitleText,
|
|
2334
|
+
onClick: () => _optionalChain([onConfirmWallet, 'optionalCall', _64 => _64(row.id)]),
|
|
2335
|
+
disabled: row.state === "loading",
|
|
2336
|
+
trailing: renderRowTrailing(row.state)
|
|
2337
|
+
},
|
|
2338
|
+
row.id
|
|
2339
|
+
)
|
|
2340
|
+
);
|
|
2341
|
+
}
|
|
2342
|
+
if (!hasReownWallet && handleConnect) {
|
|
2343
|
+
cryptoRows.push(
|
|
2344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2345
|
+
ListRow,
|
|
2346
|
+
{
|
|
2347
|
+
leading: WALLET_LEADING,
|
|
2348
|
+
title: "Connect wallet",
|
|
2349
|
+
subtitle: "Instant - No limit",
|
|
2350
|
+
meta: CONNECT_META,
|
|
2351
|
+
onClick: handleConnect
|
|
2352
|
+
},
|
|
2353
|
+
"connect-wallet"
|
|
2354
|
+
)
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
if (onSelectFundFromExchange) {
|
|
2358
|
+
cryptoRows.push(
|
|
2359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2360
|
+
ListRow,
|
|
2361
|
+
{
|
|
2362
|
+
leading: EXCHANGE_LEADING,
|
|
2363
|
+
title: "Connect exchange",
|
|
2364
|
+
subtitle: "Instant - No limit",
|
|
2365
|
+
meta: EXCHANGE_META,
|
|
2366
|
+
onClick: onSelectFundFromExchange
|
|
2367
|
+
},
|
|
2368
|
+
"connect-exchange"
|
|
2369
|
+
)
|
|
2370
|
+
);
|
|
2371
|
+
}
|
|
2372
|
+
if (showDappImports) {
|
|
2373
|
+
for (const row of _nullishCoalesce(dappImports, () => ( []))) {
|
|
2374
|
+
if (!hasReownWallet) {
|
|
2375
|
+
cryptoRows.push(
|
|
2376
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2186
2377
|
ListRow,
|
|
2187
2378
|
{
|
|
2188
|
-
leading:
|
|
2189
|
-
title:
|
|
2190
|
-
subtitle:
|
|
2191
|
-
onClick:
|
|
2192
|
-
disabled:
|
|
2193
|
-
trailing: renderRowTrailing(row.state)
|
|
2379
|
+
leading: row.icon,
|
|
2380
|
+
title: row.label,
|
|
2381
|
+
subtitle: "Connect wallet to view balance",
|
|
2382
|
+
onClick: handleConnect,
|
|
2383
|
+
disabled: !handleConnect
|
|
2194
2384
|
},
|
|
2195
2385
|
row.id
|
|
2196
|
-
)
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
}
|
|
2235
|
-
if (row.status.enabled) {
|
|
2236
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2237
|
-
ListRow,
|
|
2238
|
-
{
|
|
2239
|
-
leading: row.icon,
|
|
2240
|
-
title: row.label,
|
|
2241
|
-
subtitle: formatBalanceUsd(row.status.balanceUsd),
|
|
2242
|
-
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _67 => _67(row.id)])
|
|
2243
|
-
},
|
|
2244
|
-
row.id
|
|
2245
|
-
);
|
|
2246
|
-
}
|
|
2247
|
-
if (row.status.retryable) {
|
|
2248
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2249
|
-
ListRow,
|
|
2250
|
-
{
|
|
2251
|
-
leading: row.icon,
|
|
2252
|
-
title: row.label,
|
|
2253
|
-
subtitle: row.status.reason,
|
|
2254
|
-
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _68 => _68(row.id)])
|
|
2255
|
-
},
|
|
2256
|
-
row.id
|
|
2257
|
-
);
|
|
2258
|
-
}
|
|
2259
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2386
|
+
)
|
|
2387
|
+
);
|
|
2388
|
+
continue;
|
|
2389
|
+
}
|
|
2390
|
+
if (row.status === "loading" || row.status === "needs-connect") {
|
|
2391
|
+
cryptoRows.push(
|
|
2392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2393
|
+
ListRow,
|
|
2394
|
+
{
|
|
2395
|
+
leading: row.icon,
|
|
2396
|
+
title: row.label,
|
|
2397
|
+
subtitle: "Checking balance\u2026",
|
|
2398
|
+
disabled: true,
|
|
2399
|
+
trailing: SMALL_SPINNER
|
|
2400
|
+
},
|
|
2401
|
+
row.id
|
|
2402
|
+
)
|
|
2403
|
+
);
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
if (row.status.enabled) {
|
|
2407
|
+
cryptoRows.push(
|
|
2408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2409
|
+
ListRow,
|
|
2410
|
+
{
|
|
2411
|
+
leading: row.icon,
|
|
2412
|
+
title: row.label,
|
|
2413
|
+
subtitle: formatBalanceUsd(row.status.balanceUsd),
|
|
2414
|
+
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _65 => _65(row.id)])
|
|
2415
|
+
},
|
|
2416
|
+
row.id
|
|
2417
|
+
)
|
|
2418
|
+
);
|
|
2419
|
+
continue;
|
|
2420
|
+
}
|
|
2421
|
+
if (row.status.retryable) {
|
|
2422
|
+
cryptoRows.push(
|
|
2423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2260
2424
|
ListRow,
|
|
2261
2425
|
{
|
|
2262
2426
|
leading: row.icon,
|
|
2263
2427
|
title: row.label,
|
|
2264
2428
|
subtitle: row.status.reason,
|
|
2265
|
-
|
|
2429
|
+
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _66 => _66(row.id)])
|
|
2266
2430
|
},
|
|
2267
2431
|
row.id
|
|
2268
|
-
)
|
|
2269
|
-
|
|
2270
|
-
|
|
2432
|
+
)
|
|
2433
|
+
);
|
|
2434
|
+
continue;
|
|
2435
|
+
}
|
|
2436
|
+
cryptoRows.push(
|
|
2437
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2438
|
+
ListRow,
|
|
2439
|
+
{
|
|
2440
|
+
leading: row.icon,
|
|
2441
|
+
title: row.label,
|
|
2442
|
+
subtitle: row.status.reason,
|
|
2443
|
+
disabled: true
|
|
2444
|
+
},
|
|
2445
|
+
row.id
|
|
2446
|
+
)
|
|
2447
|
+
);
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
const cashRows = [];
|
|
2451
|
+
if (fiatPaymentMethods && fiatPaymentMethods.length > 0 && onSelectFiatMethod) {
|
|
2452
|
+
for (const opt of fiatPaymentMethods) {
|
|
2453
|
+
cashRows.push(
|
|
2454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2455
|
+
ListRow,
|
|
2456
|
+
{
|
|
2457
|
+
leading: fiatIcon(opt.icon),
|
|
2458
|
+
title: opt.label,
|
|
2459
|
+
subtitle: opt.sublabel,
|
|
2460
|
+
meta: fiatMeta(opt.icon),
|
|
2461
|
+
onClick: () => onSelectFiatMethod(opt.method)
|
|
2462
|
+
},
|
|
2463
|
+
opt.method
|
|
2464
|
+
)
|
|
2465
|
+
);
|
|
2466
|
+
}
|
|
2467
|
+
} else if (onSelectPayWithCard) {
|
|
2468
|
+
cashRows.push(
|
|
2469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2470
|
+
ListRow,
|
|
2471
|
+
{
|
|
2472
|
+
leading: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardIcon, {}),
|
|
2473
|
+
title: "Debit/Credit card",
|
|
2474
|
+
subtitle: "Instant - $10,000 limit",
|
|
2475
|
+
meta: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardNetworkIcons, {}),
|
|
2476
|
+
onClick: onSelectPayWithCard
|
|
2477
|
+
},
|
|
2478
|
+
"pay-with-card"
|
|
2479
|
+
)
|
|
2480
|
+
);
|
|
2481
|
+
}
|
|
2482
|
+
const hasCrypto = cryptoRows.length > 0;
|
|
2483
|
+
const hasCash = cashRows.length > 0;
|
|
2484
|
+
const showToggle = hasCrypto && hasCash;
|
|
2485
|
+
const [tab, setTab] = _react.useState.call(void 0, defaultMethodTab);
|
|
2486
|
+
const activeTab = showToggle ? tab : hasCash && !hasCrypto ? "cash" : "crypto";
|
|
2487
|
+
const activeRows = activeTab === "cash" ? cashRows : cryptoRows;
|
|
2488
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2489
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2490
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2491
|
+
BodyHeader,
|
|
2492
|
+
{
|
|
2493
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
2494
|
+
title,
|
|
2495
|
+
subtitle: _nullishCoalesce(subtitle, () => ( defaultSubtitle)),
|
|
2496
|
+
aside: showToggle ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2497
|
+
SegmentedToggle,
|
|
2498
|
+
{
|
|
2499
|
+
ariaLabel: "Deposit method type",
|
|
2500
|
+
value: activeTab,
|
|
2501
|
+
onChange: setTab,
|
|
2502
|
+
options: [
|
|
2503
|
+
{ value: "crypto", label: "Crypto" },
|
|
2504
|
+
{ value: "cash", label: "Cash" }
|
|
2505
|
+
]
|
|
2506
|
+
}
|
|
2507
|
+
) : void 0
|
|
2508
|
+
}
|
|
2509
|
+
),
|
|
2510
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: activeRows })
|
|
2271
2511
|
] }),
|
|
2272
2512
|
onDisconnect && hasReownWallet && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-tight-row", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2273
2513
|
"button",
|
|
@@ -2286,7 +2526,6 @@ ConnectStep.displayName = "ConnectStep";
|
|
|
2286
2526
|
// src/components/steps/ProcessingStep.tsx
|
|
2287
2527
|
|
|
2288
2528
|
|
|
2289
|
-
|
|
2290
2529
|
// src/components/ui/Button.tsx
|
|
2291
2530
|
|
|
2292
2531
|
function Button({
|
|
@@ -2356,8 +2595,8 @@ function Tooltip({ content, children, className }) {
|
|
|
2356
2595
|
function handleOutside(event) {
|
|
2357
2596
|
const target = event.target;
|
|
2358
2597
|
if (!target) return;
|
|
2359
|
-
if (_optionalChain([triggerRef, 'access',
|
|
2360
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
2598
|
+
if (_optionalChain([triggerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.contains, 'call', _69 => _69(target)])) return;
|
|
2599
|
+
if (_optionalChain([bubbleRef, 'access', _70 => _70.current, 'optionalAccess', _71 => _71.contains, 'call', _72 => _72(target)])) return;
|
|
2361
2600
|
setOpen(false);
|
|
2362
2601
|
}
|
|
2363
2602
|
function handleKey(event) {
|
|
@@ -2424,6 +2663,89 @@ function Tooltip({ content, children, className }) {
|
|
|
2424
2663
|
}
|
|
2425
2664
|
Tooltip.displayName = "Tooltip";
|
|
2426
2665
|
|
|
2666
|
+
// src/components/ui/FeesAccordion.tsx
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
function FeesAccordion({ total, rows }) {
|
|
2670
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
2671
|
+
const expandable = rows.length > 0;
|
|
2672
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion", children: [
|
|
2673
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2674
|
+
"button",
|
|
2675
|
+
{
|
|
2676
|
+
type: "button",
|
|
2677
|
+
className: "rs-fees-accordion-summary",
|
|
2678
|
+
"aria-expanded": expandable ? open : void 0,
|
|
2679
|
+
disabled: !expandable,
|
|
2680
|
+
onClick: () => expandable && setOpen((o) => !o),
|
|
2681
|
+
children: [
|
|
2682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
2683
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2684
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: total }),
|
|
2685
|
+
expandable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2686
|
+
"span",
|
|
2687
|
+
{
|
|
2688
|
+
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
2689
|
+
"aria-hidden": "true",
|
|
2690
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronDownIcon, {})
|
|
2691
|
+
}
|
|
2692
|
+
)
|
|
2693
|
+
] })
|
|
2694
|
+
]
|
|
2695
|
+
}
|
|
2696
|
+
),
|
|
2697
|
+
expandable && open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-fees-accordion-rows", children: rows.map((row, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion-row", children: [
|
|
2698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: row.label }),
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: row.value })
|
|
2700
|
+
] }, `${row.label}-${i}`)) })
|
|
2701
|
+
] });
|
|
2702
|
+
}
|
|
2703
|
+
FeesAccordion.displayName = "FeesAccordion";
|
|
2704
|
+
|
|
2705
|
+
// src/components/steps/SwappedReceipt.tsx
|
|
2706
|
+
|
|
2707
|
+
function SwappedReceipt({
|
|
2708
|
+
onrampMethod,
|
|
2709
|
+
amountPaid,
|
|
2710
|
+
depositedAmount,
|
|
2711
|
+
depositedIcon,
|
|
2712
|
+
feesTotal,
|
|
2713
|
+
feeRows,
|
|
2714
|
+
newLabel,
|
|
2715
|
+
onNewDeposit,
|
|
2716
|
+
onClose
|
|
2717
|
+
}) {
|
|
2718
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2719
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}), title: "Deposit successful" }),
|
|
2721
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
2722
|
+
onrampMethod && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2723
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Onramp method" }),
|
|
2724
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: onrampMethod })
|
|
2725
|
+
] }),
|
|
2726
|
+
amountPaid && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount paid" }),
|
|
2728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: amountPaid })
|
|
2729
|
+
] }),
|
|
2730
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2731
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposited amount" }),
|
|
2732
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2733
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: depositedAmount }),
|
|
2734
|
+
depositedIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: depositedIcon, alt: "" }) })
|
|
2735
|
+
] })
|
|
2736
|
+
] }),
|
|
2737
|
+
feesTotal != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FeesAccordion, { total: feesTotal, rows: _nullishCoalesce(feeRows, () => ( [])) })
|
|
2738
|
+
] }),
|
|
2739
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-button-row", children: [
|
|
2740
|
+
onNewDeposit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: newLabel }),
|
|
2741
|
+
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
2742
|
+
] })
|
|
2743
|
+
] }),
|
|
2744
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
|
|
2745
|
+
] });
|
|
2746
|
+
}
|
|
2747
|
+
SwappedReceipt.displayName = "SwappedReceipt";
|
|
2748
|
+
|
|
2427
2749
|
// src/core/webhook.ts
|
|
2428
2750
|
function isRecord(value) {
|
|
2429
2751
|
return typeof value === "object" && value !== null;
|
|
@@ -2437,7 +2759,7 @@ function asNumber(value) {
|
|
|
2437
2759
|
const trimmed = value.trim();
|
|
2438
2760
|
if (!trimmed) return void 0;
|
|
2439
2761
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
2440
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
2762
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _73 => _73[1]])) {
|
|
2441
2763
|
const parsed2 = Number(caipMatch[1]);
|
|
2442
2764
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
2443
2765
|
}
|
|
@@ -2456,28 +2778,28 @@ function asAddress(value) {
|
|
|
2456
2778
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
2457
2779
|
}
|
|
2458
2780
|
function getEventTxHash(event) {
|
|
2459
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2781
|
+
if (!_optionalChain([event, 'optionalAccess', _74 => _74.type])) return void 0;
|
|
2460
2782
|
if (event.type === "deposit-received") {
|
|
2461
|
-
return asString(_optionalChain([event, 'access',
|
|
2783
|
+
return asString(_optionalChain([event, 'access', _75 => _75.data, 'optionalAccess', _76 => _76.transactionHash]));
|
|
2462
2784
|
}
|
|
2463
2785
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
2464
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
2465
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
2466
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
2786
|
+
const deposit = isRecord(_optionalChain([event, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.deposit])) ? event.data.deposit : void 0;
|
|
2787
|
+
const source = isRecord(_optionalChain([event, 'access', _79 => _79.data, 'optionalAccess', _80 => _80.source])) ? event.data.source : void 0;
|
|
2788
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _81 => _81.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _82 => _82.transactionHash]))));
|
|
2467
2789
|
}
|
|
2468
2790
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
2469
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
2470
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
2471
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
2791
|
+
const deposit = isRecord(_optionalChain([event, 'access', _83 => _83.data, 'optionalAccess', _84 => _84.deposit])) ? event.data.deposit : void 0;
|
|
2792
|
+
const source = isRecord(_optionalChain([event, 'access', _85 => _85.data, 'optionalAccess', _86 => _86.source])) ? event.data.source : void 0;
|
|
2793
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _87 => _87.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _88 => _88.transactionHash]))));
|
|
2472
2794
|
}
|
|
2473
2795
|
if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
2474
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
2475
|
-
return asString(_optionalChain([deposit, 'optionalAccess',
|
|
2796
|
+
const deposit = isRecord(_optionalChain([event, 'access', _89 => _89.data, 'optionalAccess', _90 => _90.deposit])) ? event.data.deposit : void 0;
|
|
2797
|
+
return asString(_optionalChain([deposit, 'optionalAccess', _91 => _91.transactionHash]));
|
|
2476
2798
|
}
|
|
2477
2799
|
return void 0;
|
|
2478
2800
|
}
|
|
2479
2801
|
function getEventSourceDetails(event) {
|
|
2480
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2802
|
+
if (!_optionalChain([event, 'optionalAccess', _92 => _92.type]) || !isRecord(event.data)) return {};
|
|
2481
2803
|
if (event.type === "deposit-received") {
|
|
2482
2804
|
return {
|
|
2483
2805
|
chainId: asNumber(event.data.chain),
|
|
@@ -2489,18 +2811,38 @@ function getEventSourceDetails(event) {
|
|
|
2489
2811
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
2490
2812
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
2491
2813
|
return {
|
|
2492
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
2493
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
2494
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
2814
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _93 => _93.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _94 => _94.chain])))),
|
|
2815
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _95 => _95.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _96 => _96.amount])))),
|
|
2816
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _97 => _97.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _98 => _98.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _99 => _99.token]))))
|
|
2495
2817
|
};
|
|
2496
2818
|
}
|
|
2497
2819
|
return {};
|
|
2498
2820
|
}
|
|
2821
|
+
function asChain(value) {
|
|
2822
|
+
if (typeof value === "string" && value.trim().startsWith("solana")) {
|
|
2823
|
+
return "solana";
|
|
2824
|
+
}
|
|
2825
|
+
return asNumber(value);
|
|
2826
|
+
}
|
|
2827
|
+
function getEventDestinationDetails(event) {
|
|
2828
|
+
if (!_optionalChain([event, 'optionalAccess', _100 => _100.type]) || !isRecord(event.data)) return {};
|
|
2829
|
+
if (event.type !== "bridge-started" && event.type !== "bridge-complete" && event.type !== "post-bridge-swap-complete") {
|
|
2830
|
+
return {};
|
|
2831
|
+
}
|
|
2832
|
+
const destination = isRecord(event.data.destination) ? event.data.destination : void 0;
|
|
2833
|
+
if (!destination) return {};
|
|
2834
|
+
const token = asString(destination.asset);
|
|
2835
|
+
return {
|
|
2836
|
+
chainId: asChain(destination.chain),
|
|
2837
|
+
amount: asAmount(destination.amount),
|
|
2838
|
+
token: _optionalChain([token, 'optionalAccess', _101 => _101.trim, 'call', _102 => _102()]) || void 0
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2499
2841
|
function isDepositEvent(event) {
|
|
2500
|
-
return _optionalChain([event, 'optionalAccess',
|
|
2842
|
+
return _optionalChain([event, 'optionalAccess', _103 => _103.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _104 => _104.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _105 => _105.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _106 => _106.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _107 => _107.type]) === "post-bridge-swap-complete" || _optionalChain([event, 'optionalAccess', _108 => _108.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _109 => _109.type]) === "error";
|
|
2501
2843
|
}
|
|
2502
2844
|
function isFailedEvent(event) {
|
|
2503
|
-
return _optionalChain([event, 'optionalAccess',
|
|
2845
|
+
return _optionalChain([event, 'optionalAccess', _110 => _110.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _111 => _111.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _112 => _112.type]) === "error";
|
|
2504
2846
|
}
|
|
2505
2847
|
function isHexString(value) {
|
|
2506
2848
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -2512,7 +2854,7 @@ function txRefsMatch(a, b) {
|
|
|
2512
2854
|
return a === b;
|
|
2513
2855
|
}
|
|
2514
2856
|
function formatBridgeFailedMessage(event) {
|
|
2515
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
2857
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _113 => _113.data]), () => ( {}));
|
|
2516
2858
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
2517
2859
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
2518
2860
|
function toUserFacingFailure(raw) {
|
|
@@ -2540,13 +2882,134 @@ function formatBridgeFailedMessage(event) {
|
|
|
2540
2882
|
return { message: "Bridge failed" };
|
|
2541
2883
|
}
|
|
2542
2884
|
function failureMessageForEvent(event) {
|
|
2543
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2885
|
+
if (_optionalChain([event, 'optionalAccess', _114 => _114.type]) === "error") {
|
|
2544
2886
|
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
2545
2887
|
return _nullishCoalesce(message, () => ( "Unknown error"));
|
|
2546
2888
|
}
|
|
2547
2889
|
return formatBridgeFailedMessage(event).message;
|
|
2548
2890
|
}
|
|
2549
2891
|
|
|
2892
|
+
// src/core/token-amount.ts
|
|
2893
|
+
|
|
2894
|
+
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
2895
|
+
"USDC",
|
|
2896
|
+
"USDT",
|
|
2897
|
+
"USDT0",
|
|
2898
|
+
"DAI",
|
|
2899
|
+
"FRAX",
|
|
2900
|
+
"PYUSD",
|
|
2901
|
+
"USDP",
|
|
2902
|
+
"TUSD",
|
|
2903
|
+
"GUSD",
|
|
2904
|
+
"USDS",
|
|
2905
|
+
"LUSD",
|
|
2906
|
+
"BUSD",
|
|
2907
|
+
"USDE"
|
|
2908
|
+
]);
|
|
2909
|
+
var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
2910
|
+
function resolveTokenDisplay(token, chain, fallback) {
|
|
2911
|
+
if (token !== void 0) {
|
|
2912
|
+
if (chain === "solana") {
|
|
2913
|
+
const solanaToken = _chunkABVRVW3Pcjs.getSolanaTokenByMint.call(void 0, token);
|
|
2914
|
+
if (solanaToken) {
|
|
2915
|
+
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
2916
|
+
}
|
|
2917
|
+
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
2918
|
+
const symbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, token, chain);
|
|
2919
|
+
const decimals = _chunkABVRVW3Pcjs.findTokenDecimals.call(void 0, token, chain);
|
|
2920
|
+
if (symbol !== "Token" || decimals !== void 0) {
|
|
2921
|
+
return {
|
|
2922
|
+
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _115 => _115.symbol]), () => ( symbol)),
|
|
2923
|
+
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _116 => _116.decimals])))
|
|
2924
|
+
};
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
return {
|
|
2929
|
+
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _117 => _117.symbol]), () => ( "Token")),
|
|
2930
|
+
decimals: _optionalChain([fallback, 'optionalAccess', _118 => _118.decimals])
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2933
|
+
function maxFractionDigitsFor(symbol) {
|
|
2934
|
+
if (!symbol) return 6;
|
|
2935
|
+
return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
|
|
2936
|
+
}
|
|
2937
|
+
function formatTokenAmount(amount, symbol) {
|
|
2938
|
+
if (!Number.isFinite(amount)) return void 0;
|
|
2939
|
+
return amount.toLocaleString("en-US", {
|
|
2940
|
+
minimumFractionDigits: 2,
|
|
2941
|
+
maximumFractionDigits: maxFractionDigitsFor(symbol)
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
function tokenAmountToNumber(rawAmount, decimals) {
|
|
2945
|
+
if (decimals === void 0) return void 0;
|
|
2946
|
+
try {
|
|
2947
|
+
const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
|
|
2948
|
+
return Number.isFinite(value) ? value : void 0;
|
|
2949
|
+
} catch (e4) {
|
|
2950
|
+
return void 0;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
function formatRawTokenAmount(rawAmount, token) {
|
|
2954
|
+
const value = tokenAmountToNumber(rawAmount, token.decimals);
|
|
2955
|
+
if (value === void 0) return void 0;
|
|
2956
|
+
return formatTokenAmount(value, token.symbol);
|
|
2957
|
+
}
|
|
2958
|
+
function priceUsdFor(symbol, prices) {
|
|
2959
|
+
if (!symbol) return void 0;
|
|
2960
|
+
const upper = symbol.toUpperCase();
|
|
2961
|
+
const quoted = prices[upper];
|
|
2962
|
+
if (typeof quoted === "number" && quoted > 0) return quoted;
|
|
2963
|
+
return STABLECOIN_SYMBOLS.has(upper) ? 1 : void 0;
|
|
2964
|
+
}
|
|
2965
|
+
function estimateReceiveAmount(params) {
|
|
2966
|
+
const { sourceAmount, sourceSymbol, targetSymbol, sourceAmountUsd, prices } = params;
|
|
2967
|
+
if (sourceSymbol !== void 0 && sourceSymbol.toUpperCase() === targetSymbol.toUpperCase()) {
|
|
2968
|
+
return sourceAmount;
|
|
2969
|
+
}
|
|
2970
|
+
const usdValue = sourceAmountUsd !== void 0 && Number.isFinite(sourceAmountUsd) ? sourceAmountUsd : sourceAmount !== void 0 ? (() => {
|
|
2971
|
+
const sourcePrice = priceUsdFor(sourceSymbol, prices);
|
|
2972
|
+
return sourcePrice !== void 0 ? sourceAmount * sourcePrice : void 0;
|
|
2973
|
+
})() : void 0;
|
|
2974
|
+
if (usdValue === void 0) return void 0;
|
|
2975
|
+
const targetPrice = priceUsdFor(targetSymbol, prices);
|
|
2976
|
+
if (targetPrice === void 0) return void 0;
|
|
2977
|
+
return usdValue / targetPrice;
|
|
2978
|
+
}
|
|
2979
|
+
function formatReceiveEstimate(params) {
|
|
2980
|
+
const estimate = estimateReceiveAmount(params);
|
|
2981
|
+
if (estimate === void 0) return void 0;
|
|
2982
|
+
const formatted = formatTokenAmount(estimate, params.targetSymbol);
|
|
2983
|
+
if (formatted === void 0) return void 0;
|
|
2984
|
+
const sameSymbol = params.sourceSymbol.toUpperCase() === params.targetSymbol.toUpperCase();
|
|
2985
|
+
return sameSymbol ? `${formatted} ${params.targetSymbol}` : `~${formatted} ${params.targetSymbol}`;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
// src/core/useTokenPrices.ts
|
|
2989
|
+
|
|
2990
|
+
function useTokenPrices(service, symbols) {
|
|
2991
|
+
const [prices, setPrices] = _react.useState.call(void 0, {});
|
|
2992
|
+
const symbolsKey = [
|
|
2993
|
+
...new Set(
|
|
2994
|
+
symbols.filter((symbol) => Boolean(symbol)).map((symbol) => symbol.toUpperCase())
|
|
2995
|
+
)
|
|
2996
|
+
].sort().join(",");
|
|
2997
|
+
_react.useEffect.call(void 0, () => {
|
|
2998
|
+
if (!symbolsKey) return;
|
|
2999
|
+
let cancelled = false;
|
|
3000
|
+
service.fetchPrices(symbolsKey.split(",")).then((result) => {
|
|
3001
|
+
if (!cancelled && result && Object.keys(result).length > 0) {
|
|
3002
|
+
setPrices(result);
|
|
3003
|
+
}
|
|
3004
|
+
}).catch(() => {
|
|
3005
|
+
});
|
|
3006
|
+
return () => {
|
|
3007
|
+
cancelled = true;
|
|
3008
|
+
};
|
|
3009
|
+
}, [service, symbolsKey]);
|
|
3010
|
+
return prices;
|
|
3011
|
+
}
|
|
3012
|
+
|
|
2550
3013
|
// src/components/steps/ProcessingStep.tsx
|
|
2551
3014
|
|
|
2552
3015
|
function SuccessBadge() {
|
|
@@ -2619,24 +3082,6 @@ var SOFT_DELAY_MS = {
|
|
|
2619
3082
|
bridging: 4 * 60 * 1e3
|
|
2620
3083
|
};
|
|
2621
3084
|
var PHASE_TIMINGS_PREFIX = "rhinestone:phase-timings";
|
|
2622
|
-
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
2623
|
-
"USDC",
|
|
2624
|
-
"USDT",
|
|
2625
|
-
"DAI",
|
|
2626
|
-
"FRAX",
|
|
2627
|
-
"PYUSD",
|
|
2628
|
-
"USDP",
|
|
2629
|
-
"TUSD",
|
|
2630
|
-
"GUSD",
|
|
2631
|
-
"USDS",
|
|
2632
|
-
"LUSD",
|
|
2633
|
-
"BUSD",
|
|
2634
|
-
"USDE"
|
|
2635
|
-
]);
|
|
2636
|
-
function maxFractionDigitsFor(symbol) {
|
|
2637
|
-
if (!symbol) return 6;
|
|
2638
|
-
return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
|
|
2639
|
-
}
|
|
2640
3085
|
var PAYMENT_METHOD_LABELS = {
|
|
2641
3086
|
creditcard: "Card",
|
|
2642
3087
|
debitcard: "Card",
|
|
@@ -2668,7 +3113,7 @@ function loadPhaseTimings(txHash) {
|
|
|
2668
3113
|
const parsed = JSON.parse(raw);
|
|
2669
3114
|
if (typeof parsed.startedAt !== "number") return null;
|
|
2670
3115
|
return parsed;
|
|
2671
|
-
} catch (
|
|
3116
|
+
} catch (e5) {
|
|
2672
3117
|
return null;
|
|
2673
3118
|
}
|
|
2674
3119
|
}
|
|
@@ -2679,7 +3124,7 @@ function savePhaseTimings(txHash, timings) {
|
|
|
2679
3124
|
`${PHASE_TIMINGS_PREFIX}:${txHash}`,
|
|
2680
3125
|
JSON.stringify(timings)
|
|
2681
3126
|
);
|
|
2682
|
-
} catch (
|
|
3127
|
+
} catch (e6) {
|
|
2683
3128
|
}
|
|
2684
3129
|
}
|
|
2685
3130
|
function isEventForTx(event, txHash) {
|
|
@@ -2688,12 +3133,12 @@ function isEventForTx(event, txHash) {
|
|
|
2688
3133
|
return txRefsMatch(eventTxHash, txHash);
|
|
2689
3134
|
}
|
|
2690
3135
|
function parseWebhookTimestamp(event) {
|
|
2691
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
3136
|
+
if (typeof _optionalChain([event, 'optionalAccess', _119 => _119.time]) !== "string") return void 0;
|
|
2692
3137
|
const timestamp = Date.parse(event.time);
|
|
2693
3138
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
2694
3139
|
}
|
|
2695
3140
|
function syncPhaseTimings(previous, event) {
|
|
2696
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
3141
|
+
if (!_optionalChain([event, 'optionalAccess', _120 => _120.type])) return previous;
|
|
2697
3142
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
2698
3143
|
const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed" || event.type === "error") && previous.receivedAt === void 0;
|
|
2699
3144
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
|
|
@@ -2755,9 +3200,9 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
2755
3200
|
if (state.type === "complete") {
|
|
2756
3201
|
return void 0;
|
|
2757
3202
|
}
|
|
2758
|
-
if (_optionalChain([state, 'access',
|
|
3203
|
+
if (_optionalChain([state, 'access', _121 => _121.lastEvent, 'optionalAccess', _122 => _122.type]) === "bridge-started" || _optionalChain([state, 'access', _123 => _123.lastEvent, 'optionalAccess', _124 => _124.type]) === "bridge-complete")
|
|
2759
3204
|
return "bridging";
|
|
2760
|
-
if (_optionalChain([state, 'access',
|
|
3205
|
+
if (_optionalChain([state, 'access', _125 => _125.lastEvent, 'optionalAccess', _126 => _126.type]) === "deposit-received") return "received";
|
|
2761
3206
|
return "confirming";
|
|
2762
3207
|
}
|
|
2763
3208
|
function ProcessingStep({
|
|
@@ -2842,7 +3287,7 @@ function ProcessingStep({
|
|
|
2842
3287
|
flowLabel
|
|
2843
3288
|
});
|
|
2844
3289
|
const context = processingContextRef.current;
|
|
2845
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
3290
|
+
_optionalChain([onDepositCompleteRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128(txHash, void 0, {
|
|
2846
3291
|
amount: context.amount,
|
|
2847
3292
|
sourceChain: context.sourceChain,
|
|
2848
3293
|
sourceToken: context.sourceToken,
|
|
@@ -2884,7 +3329,7 @@ function ProcessingStep({
|
|
|
2884
3329
|
updatePhaseTimings(
|
|
2885
3330
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
2886
3331
|
);
|
|
2887
|
-
}, [_optionalChain([state, 'access',
|
|
3332
|
+
}, [_optionalChain([state, 'access', _129 => _129.lastEvent, 'optionalAccess', _130 => _130.time]), _optionalChain([state, 'access', _131 => _131.lastEvent, 'optionalAccess', _132 => _132.type]), updatePhaseTimings]);
|
|
2888
3333
|
const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
|
|
2889
3334
|
_react.useEffect.call(void 0, () => {
|
|
2890
3335
|
let cancelled = false;
|
|
@@ -2931,21 +3376,21 @@ function ProcessingStep({
|
|
|
2931
3376
|
debugLog(debug, "processing", "poll:event", {
|
|
2932
3377
|
type: lastEvent2.type,
|
|
2933
3378
|
matchesTx: eventMatchesTx,
|
|
2934
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
3379
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _133 => _133.intentId])
|
|
2935
3380
|
});
|
|
2936
3381
|
}
|
|
2937
3382
|
if (!isMounted) return;
|
|
2938
3383
|
const awaitingPostBridgeSwap = processingContextRef.current.hasPostBridgeActions;
|
|
2939
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
3384
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _134 => _134.type]) === "post-bridge-swap-complete") {
|
|
2940
3385
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
2941
|
-
const swapTxHash = _optionalChain([eventForCurrentTx, 'access',
|
|
3386
|
+
const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _135 => _135.data, 'optionalAccess', _136 => _136.swap, 'optionalAccess', _137 => _137.transactionHash]);
|
|
2942
3387
|
debugLog(debug, "processing", "state:complete", {
|
|
2943
3388
|
txHash,
|
|
2944
3389
|
destinationTxHash: swapTxHash,
|
|
2945
3390
|
event: eventForCurrentTx.type
|
|
2946
3391
|
});
|
|
2947
3392
|
const context = processingContextRef.current;
|
|
2948
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
3393
|
+
_optionalChain([onDepositCompleteRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(txHash, swapTxHash, {
|
|
2949
3394
|
amount: context.amount,
|
|
2950
3395
|
sourceChain: context.sourceChain,
|
|
2951
3396
|
sourceToken: context.sourceToken,
|
|
@@ -2956,7 +3401,7 @@ function ProcessingStep({
|
|
|
2956
3401
|
})]);
|
|
2957
3402
|
return;
|
|
2958
3403
|
}
|
|
2959
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
3404
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _140 => _140.type]) === "post-bridge-swap-failed") {
|
|
2960
3405
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
2961
3406
|
setState({
|
|
2962
3407
|
type: "failed",
|
|
@@ -2968,19 +3413,19 @@ function ProcessingStep({
|
|
|
2968
3413
|
message: formatted.message,
|
|
2969
3414
|
code: formatted.code
|
|
2970
3415
|
});
|
|
2971
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
3416
|
+
_optionalChain([onDepositFailedRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142(txHash, formatted.message)]);
|
|
2972
3417
|
return;
|
|
2973
3418
|
}
|
|
2974
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
3419
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _143 => _143.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
2975
3420
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
2976
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
3421
|
+
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _144 => _144.data, 'optionalAccess', _145 => _145.destination, 'optionalAccess', _146 => _146.transactionHash]);
|
|
2977
3422
|
debugLog(debug, "processing", "state:complete", {
|
|
2978
3423
|
txHash,
|
|
2979
3424
|
destinationTxHash: destinationTxHash2,
|
|
2980
3425
|
event: eventForCurrentTx.type
|
|
2981
3426
|
});
|
|
2982
3427
|
const context = processingContextRef.current;
|
|
2983
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
3428
|
+
_optionalChain([onDepositCompleteRef, 'access', _147 => _147.current, 'optionalCall', _148 => _148(txHash, destinationTxHash2, {
|
|
2984
3429
|
amount: context.amount,
|
|
2985
3430
|
sourceChain: context.sourceChain,
|
|
2986
3431
|
sourceToken: context.sourceToken,
|
|
@@ -2991,7 +3436,7 @@ function ProcessingStep({
|
|
|
2991
3436
|
})]);
|
|
2992
3437
|
return;
|
|
2993
3438
|
}
|
|
2994
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
3439
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _149 => _149.type]) === "bridge-failed") {
|
|
2995
3440
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
2996
3441
|
setState({
|
|
2997
3442
|
type: "failed",
|
|
@@ -3003,11 +3448,11 @@ function ProcessingStep({
|
|
|
3003
3448
|
message: formatted.message,
|
|
3004
3449
|
code: formatted.code
|
|
3005
3450
|
});
|
|
3006
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
3451
|
+
_optionalChain([onDepositFailedRef, 'access', _150 => _150.current, 'optionalCall', _151 => _151(txHash, formatted.message)]);
|
|
3007
3452
|
return;
|
|
3008
3453
|
}
|
|
3009
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
3010
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
3454
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _152 => _152.type]) === "error") {
|
|
3455
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _153 => _153.data, 'optionalAccess', _154 => _154.message]), () => ( "Unknown error"));
|
|
3011
3456
|
setState({
|
|
3012
3457
|
type: "failed",
|
|
3013
3458
|
message: errorMessage,
|
|
@@ -3017,7 +3462,7 @@ function ProcessingStep({
|
|
|
3017
3462
|
txHash,
|
|
3018
3463
|
message: errorMessage
|
|
3019
3464
|
});
|
|
3020
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
3465
|
+
_optionalChain([onDepositFailedRef, 'access', _155 => _155.current, 'optionalCall', _156 => _156(txHash, errorMessage)]);
|
|
3021
3466
|
return;
|
|
3022
3467
|
}
|
|
3023
3468
|
setState((previous) => ({
|
|
@@ -3078,7 +3523,7 @@ function ProcessingStep({
|
|
|
3078
3523
|
txHash,
|
|
3079
3524
|
timeoutMs: ESCALATED_DELAY_MS
|
|
3080
3525
|
});
|
|
3081
|
-
_optionalChain([onErrorRef, 'access',
|
|
3526
|
+
_optionalChain([onErrorRef, 'access', _157 => _157.current, 'optionalCall', _158 => _158(message, "PROCESS_TIMEOUT")]);
|
|
3082
3527
|
}, ESCALATED_DELAY_MS);
|
|
3083
3528
|
return () => clearTimeout(timeoutId);
|
|
3084
3529
|
}, [debug, directTransfer, onErrorRef, state.type, txHash]);
|
|
@@ -3090,99 +3535,88 @@ function ProcessingStep({
|
|
|
3090
3535
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
3091
3536
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
3092
3537
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
3093
|
-
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess',
|
|
3094
|
-
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess',
|
|
3538
|
+
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _159 => _159.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _160 => _160.type]) === "post-bridge-swap-failed";
|
|
3539
|
+
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _161 => _161.data, 'optionalAccess', _162 => _162.swap, 'optionalAccess', _163 => _163.transactionHash]) || null : _optionalChain([lastEvent, 'optionalAccess', _164 => _164.data, 'optionalAccess', _165 => _165.destination, 'optionalAccess', _166 => _166.transactionHash]) || null;
|
|
3095
3540
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
3096
3541
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
3097
3542
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
3098
3543
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
3099
|
-
const sourceExplorerUrl =
|
|
3100
|
-
const destExplorerUrl = destinationTxHash ?
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
const raw = _viem.formatUnits.call(void 0, BigInt(displayAmount), sourceDecimals);
|
|
3111
|
-
const numeric = Number(raw);
|
|
3112
|
-
if (!Number.isFinite(numeric)) return raw;
|
|
3113
|
-
return numeric.toLocaleString("en-US", {
|
|
3114
|
-
minimumFractionDigits: 2,
|
|
3115
|
-
maximumFractionDigits: amountMaxDigits
|
|
3116
|
-
});
|
|
3117
|
-
} catch (e6) {
|
|
3118
|
-
return Number(displayAmount).toLocaleString("en-US", {
|
|
3119
|
-
minimumFractionDigits: 2,
|
|
3120
|
-
maximumFractionDigits: amountMaxDigits
|
|
3121
|
-
});
|
|
3122
|
-
}
|
|
3544
|
+
const sourceExplorerUrl = _chunkABVRVW3Pcjs.getExplorerTxUrl.call(void 0, displaySourceChain, txHash);
|
|
3545
|
+
const destExplorerUrl = destinationTxHash ? _chunkABVRVW3Pcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
3546
|
+
const sourceDisplay = (() => {
|
|
3547
|
+
const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
|
|
3548
|
+
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
3549
|
+
decimals: providedSourceDecimals
|
|
3550
|
+
});
|
|
3551
|
+
return {
|
|
3552
|
+
symbol: resolved.symbol,
|
|
3553
|
+
decimals: _nullishCoalesce(resolved.decimals, () => ( (displaySourceChain === "solana" ? 9 : 18)))
|
|
3554
|
+
};
|
|
3123
3555
|
})();
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3556
|
+
const sourceSymbol = sourceDisplay.symbol;
|
|
3557
|
+
const formattedSentAmount = _nullishCoalesce(_nullishCoalesce(formatRawTokenAmount(displayAmount, sourceDisplay), () => ( // Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
3558
|
+
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol))), () => ( displayAmount));
|
|
3559
|
+
const isBridgeHopDestination = hasPostBridgeActions && (_optionalChain([lastEvent, 'optionalAccess', _167 => _167.type]) === "bridge-started" || _optionalChain([lastEvent, 'optionalAccess', _168 => _168.type]) === "bridge-complete");
|
|
3560
|
+
const eventDestination = isBridgeHopDestination ? {} : getEventDestinationDetails(lastEvent);
|
|
3561
|
+
const targetDisplay = resolveTokenDisplay(
|
|
3562
|
+
_nullishCoalesce(eventDestination.token, () => ( targetToken)),
|
|
3563
|
+
_nullishCoalesce(eventDestination.chainId, () => ( targetChain)),
|
|
3564
|
+
// Dapp deposits default to USDC targets; mirror the source symbol last so
|
|
3565
|
+
// unresolvable same-token routes still label sensibly.
|
|
3566
|
+
{ symbol: _nullishCoalesce(providedSourceSymbol, () => ( "USDC")) }
|
|
3567
|
+
);
|
|
3568
|
+
const targetSymbol = targetDisplay.symbol;
|
|
3569
|
+
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
3570
|
+
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
3571
|
+
const prices = useTokenPrices(service, [
|
|
3572
|
+
sourceDisplay.symbol,
|
|
3573
|
+
targetDisplay.symbol
|
|
3574
|
+
]);
|
|
3575
|
+
const estimatedReceiveAmount = (() => {
|
|
3576
|
+
const estimate = estimateReceiveAmount({
|
|
3577
|
+
sourceAmount: tokenAmountToNumber(displayAmount, sourceDisplay.decimals),
|
|
3578
|
+
sourceSymbol: sourceDisplay.symbol,
|
|
3579
|
+
targetSymbol: targetDisplay.symbol,
|
|
3580
|
+
sourceAmountUsd: amountUsdNumber,
|
|
3581
|
+
prices
|
|
3582
|
+
});
|
|
3583
|
+
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
3132
3584
|
})();
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3585
|
+
const receiveDisplay = formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : estimatedReceiveAmount !== void 0 ? `~${estimatedReceiveAmount} ${targetSymbol}` : amountUsdNumber !== void 0 ? `~$${amountUsdNumber.toFixed(2)}` : (
|
|
3586
|
+
// Cross-token with no price and no USD context (rare QR case):
|
|
3587
|
+
// an honest dash beats a wrong number.
|
|
3588
|
+
"\u2014"
|
|
3589
|
+
);
|
|
3590
|
+
const formattedBridgingCost = (() => {
|
|
3591
|
+
if (sourceSymbol.toUpperCase() !== targetSymbol.toUpperCase()) {
|
|
3137
3592
|
return void 0;
|
|
3138
3593
|
}
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
try {
|
|
3143
|
-
const raw = _viem.formatUnits.call(void 0, destinationAmountRaw, sourceDecimals);
|
|
3144
|
-
const numeric = Number(raw);
|
|
3145
|
-
if (!Number.isFinite(numeric)) return raw;
|
|
3146
|
-
return numeric.toLocaleString("en-US", {
|
|
3147
|
-
minimumFractionDigits: 2,
|
|
3148
|
-
maximumFractionDigits: amountMaxDigits
|
|
3149
|
-
});
|
|
3150
|
-
} catch (e9) {
|
|
3594
|
+
const sentValue = tokenAmountToNumber(displayAmount, sourceDisplay.decimals);
|
|
3595
|
+
const receivedValue = eventDestination.amount !== void 0 ? tokenAmountToNumber(eventDestination.amount, targetDisplay.decimals) : void 0;
|
|
3596
|
+
if (sentValue === void 0 || receivedValue === void 0 || sentValue <= receivedValue) {
|
|
3151
3597
|
return void 0;
|
|
3152
3598
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
try {
|
|
3156
|
-
const raw = _viem.formatUnits.call(void 0, bridgingCostRaw, sourceDecimals);
|
|
3157
|
-
const numeric = Number(raw);
|
|
3158
|
-
if (!Number.isFinite(numeric)) return raw;
|
|
3159
|
-
return numeric.toLocaleString("en-US", {
|
|
3160
|
-
minimumFractionDigits: 2,
|
|
3161
|
-
maximumFractionDigits: amountMaxDigits
|
|
3162
|
-
});
|
|
3163
|
-
} catch (e10) {
|
|
3599
|
+
const formatted = formatTokenAmount(sentValue - receivedValue, sourceSymbol);
|
|
3600
|
+
if (formatted === void 0 || Number(formatted.replace(/,/g, "")) === 0) {
|
|
3164
3601
|
return void 0;
|
|
3165
3602
|
}
|
|
3166
|
-
|
|
3603
|
+
return formatted;
|
|
3604
|
+
})();
|
|
3167
3605
|
const currentPhaseId = getCurrentPhaseId(state, phaseTimings);
|
|
3168
3606
|
const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
|
|
3169
3607
|
const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
|
|
3170
3608
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
3171
3609
|
void delayPhaseId;
|
|
3172
3610
|
void hasEscalatedDelay;
|
|
3173
|
-
const
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
const
|
|
3178
|
-
const
|
|
3179
|
-
const targetChainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, targetChain);
|
|
3180
|
-
const sourceTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, sourceSymbol);
|
|
3181
|
-
const sourceChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, displaySourceChain);
|
|
3182
|
-
const targetChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
3611
|
+
const targetTokenIcon = _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
3612
|
+
const sourceChainIcon = _chunkABVRVW3Pcjs.getChainIcon.call(void 0, displaySourceChain);
|
|
3613
|
+
const targetChainIcon = _chunkABVRVW3Pcjs.getChainIcon.call(void 0, targetChain);
|
|
3614
|
+
const sourceTokenIcon = _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, sourceSymbol);
|
|
3615
|
+
const sourceChainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, displaySourceChain);
|
|
3616
|
+
const targetChainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
3183
3617
|
const timerText = formatTimer(elapsedSeconds);
|
|
3184
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3185
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3618
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _169 => _169.feeSponsored]), () => ( false));
|
|
3619
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _170 => _170.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
3186
3620
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
3187
3621
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
3188
3622
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -3192,6 +3626,41 @@ function ProcessingStep({
|
|
|
3192
3626
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FailedBadge, {}),
|
|
3193
3627
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
3194
3628
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WalletIcon, {}), title: stateTitle });
|
|
3629
|
+
if (isComplete && isSwappedOrder) {
|
|
3630
|
+
const onrampMethod = _optionalChain([swappedFiatContext, 'optionalAccess', _171 => _171.paymentMethod]) ? formatPaymentMethod(swappedFiatContext.paymentMethod) : null;
|
|
3631
|
+
const amountPaid = _optionalChain([swappedFiatContext, 'optionalAccess', _172 => _172.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null;
|
|
3632
|
+
const depositedAmount = receiveDisplay;
|
|
3633
|
+
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _173 => _173.onrampFeeUsd]), () => ( null));
|
|
3634
|
+
const networkFeeUsd = quotedFeeAmount !== void 0 && Number.isFinite(Number(quotedFeeAmount)) ? Number(quotedFeeAmount) : null;
|
|
3635
|
+
const feeRows = [];
|
|
3636
|
+
if (onrampFeeUsd != null) {
|
|
3637
|
+
feeRows.push({
|
|
3638
|
+
label: "On-ramp fee",
|
|
3639
|
+
value: `$${onrampFeeUsd.toFixed(2)}`
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
if (networkFeeUsd != null) {
|
|
3643
|
+
feeRows.push({
|
|
3644
|
+
label: "Network fee",
|
|
3645
|
+
value: `$${networkFeeUsd.toFixed(2)}`
|
|
3646
|
+
});
|
|
3647
|
+
}
|
|
3648
|
+
const feesTotal = feeRows.length > 0 ? `$${((_nullishCoalesce(onrampFeeUsd, () => ( 0))) + (_nullishCoalesce(networkFeeUsd, () => ( 0)))).toFixed(2)}` : null;
|
|
3649
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3650
|
+
SwappedReceipt,
|
|
3651
|
+
{
|
|
3652
|
+
onrampMethod,
|
|
3653
|
+
amountPaid,
|
|
3654
|
+
depositedAmount,
|
|
3655
|
+
depositedIcon: targetTokenIcon,
|
|
3656
|
+
feesTotal,
|
|
3657
|
+
feeRows,
|
|
3658
|
+
newLabel: `New ${flowNoun}`,
|
|
3659
|
+
onNewDeposit,
|
|
3660
|
+
onClose
|
|
3661
|
+
}
|
|
3662
|
+
);
|
|
3663
|
+
}
|
|
3195
3664
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
3196
3665
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3197
3666
|
headerContent,
|
|
@@ -3201,7 +3670,7 @@ function ProcessingStep({
|
|
|
3201
3670
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3202
3671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
3203
3672
|
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: sourceChainIcon, alt: "" }) }),
|
|
3204
|
-
|
|
3673
|
+
sourceExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3205
3674
|
"a",
|
|
3206
3675
|
{
|
|
3207
3676
|
href: sourceExplorerUrl,
|
|
@@ -3219,7 +3688,7 @@ function ProcessingStep({
|
|
|
3219
3688
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3220
3689
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
3221
3690
|
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetChainIcon, alt: "" }) }),
|
|
3222
|
-
|
|
3691
|
+
destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3223
3692
|
"a",
|
|
3224
3693
|
{
|
|
3225
3694
|
href: destExplorerUrl,
|
|
@@ -3237,7 +3706,7 @@ function ProcessingStep({
|
|
|
3237
3706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
|
|
3238
3707
|
] }),
|
|
3239
3708
|
isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3240
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
3709
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _174 => _174.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
3241
3710
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
|
|
3242
3711
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3243
3712
|
"$",
|
|
@@ -3249,7 +3718,7 @@ function ProcessingStep({
|
|
|
3249
3718
|
] })
|
|
3250
3719
|
] })
|
|
3251
3720
|
] }),
|
|
3252
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
3721
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _175 => _175.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
3253
3722
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
|
|
3254
3723
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3255
3724
|
"$",
|
|
@@ -3271,7 +3740,7 @@ function ProcessingStep({
|
|
|
3271
3740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "You send" : "You sent" }),
|
|
3272
3741
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3273
3742
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
3274
|
-
|
|
3743
|
+
formattedSentAmount,
|
|
3275
3744
|
" ",
|
|
3276
3745
|
sourceSymbol
|
|
3277
3746
|
] }),
|
|
@@ -3281,7 +3750,7 @@ function ProcessingStep({
|
|
|
3281
3750
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
3282
3751
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "Receive" : "Received" }),
|
|
3283
3752
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
3284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
3753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
3285
3754
|
targetTokenIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetTokenIcon, alt: "" }) })
|
|
3286
3755
|
] })
|
|
3287
3756
|
] }),
|
|
@@ -3371,291 +3840,6 @@ function ProcessingStep({
|
|
|
3371
3840
|
] });
|
|
3372
3841
|
}
|
|
3373
3842
|
|
|
3374
|
-
// src/core/safe.ts
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
var SAFE_ABI = [
|
|
3386
|
-
{
|
|
3387
|
-
type: "function",
|
|
3388
|
-
name: "isOwner",
|
|
3389
|
-
stateMutability: "view",
|
|
3390
|
-
inputs: [{ name: "owner", type: "address" }],
|
|
3391
|
-
outputs: [{ name: "", type: "bool" }]
|
|
3392
|
-
},
|
|
3393
|
-
{
|
|
3394
|
-
type: "function",
|
|
3395
|
-
name: "nonce",
|
|
3396
|
-
stateMutability: "view",
|
|
3397
|
-
inputs: [],
|
|
3398
|
-
outputs: [{ type: "uint256" }]
|
|
3399
|
-
},
|
|
3400
|
-
{
|
|
3401
|
-
type: "function",
|
|
3402
|
-
name: "execTransaction",
|
|
3403
|
-
stateMutability: "payable",
|
|
3404
|
-
inputs: [
|
|
3405
|
-
{ name: "to", type: "address" },
|
|
3406
|
-
{ name: "value", type: "uint256" },
|
|
3407
|
-
{ name: "data", type: "bytes" },
|
|
3408
|
-
{ name: "operation", type: "uint8" },
|
|
3409
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
3410
|
-
{ name: "baseGas", type: "uint256" },
|
|
3411
|
-
{ name: "gasPrice", type: "uint256" },
|
|
3412
|
-
{ name: "gasToken", type: "address" },
|
|
3413
|
-
{ name: "refundReceiver", type: "address" },
|
|
3414
|
-
{ name: "signatures", type: "bytes" }
|
|
3415
|
-
],
|
|
3416
|
-
outputs: [{ name: "success", type: "bool" }]
|
|
3417
|
-
},
|
|
3418
|
-
{
|
|
3419
|
-
type: "event",
|
|
3420
|
-
name: "ExecutionSuccess",
|
|
3421
|
-
inputs: [
|
|
3422
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
3423
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
3424
|
-
],
|
|
3425
|
-
anonymous: false
|
|
3426
|
-
},
|
|
3427
|
-
{
|
|
3428
|
-
type: "event",
|
|
3429
|
-
name: "ExecutionFailure",
|
|
3430
|
-
inputs: [
|
|
3431
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
3432
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
3433
|
-
],
|
|
3434
|
-
anonymous: false
|
|
3435
|
-
}
|
|
3436
|
-
];
|
|
3437
|
-
async function executeSafeEthTransfer(params) {
|
|
3438
|
-
const {
|
|
3439
|
-
walletClient,
|
|
3440
|
-
publicClient,
|
|
3441
|
-
safeAddress,
|
|
3442
|
-
recipient,
|
|
3443
|
-
amount,
|
|
3444
|
-
chainId
|
|
3445
|
-
} = params;
|
|
3446
|
-
const account = walletClient.account;
|
|
3447
|
-
const chain = walletClient.chain;
|
|
3448
|
-
if (!account || !chain) {
|
|
3449
|
-
throw new Error("Wallet not connected");
|
|
3450
|
-
}
|
|
3451
|
-
if (chain.id !== chainId) {
|
|
3452
|
-
throw new Error(`Switch to ${_chunkMILJQWPTcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
3453
|
-
}
|
|
3454
|
-
const isOwner = await publicClient.readContract({
|
|
3455
|
-
address: safeAddress,
|
|
3456
|
-
abi: SAFE_ABI,
|
|
3457
|
-
functionName: "isOwner",
|
|
3458
|
-
args: [account.address]
|
|
3459
|
-
});
|
|
3460
|
-
if (!isOwner) {
|
|
3461
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
3462
|
-
}
|
|
3463
|
-
const safeTx = {
|
|
3464
|
-
to: recipient,
|
|
3465
|
-
value: amount,
|
|
3466
|
-
data: "0x",
|
|
3467
|
-
operation: 0,
|
|
3468
|
-
safeTxGas: 0n,
|
|
3469
|
-
baseGas: 0n,
|
|
3470
|
-
gasPrice: 0n,
|
|
3471
|
-
gasToken: _viem.zeroAddress,
|
|
3472
|
-
refundReceiver: _viem.zeroAddress
|
|
3473
|
-
};
|
|
3474
|
-
const signature = _viem.concat.call(void 0, [
|
|
3475
|
-
_viem.pad.call(void 0, account.address, { size: 32 }),
|
|
3476
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
|
|
3477
|
-
_viem.toHex.call(void 0, 1, { size: 1 })
|
|
3478
|
-
]);
|
|
3479
|
-
const txHash = await walletClient.writeContract({
|
|
3480
|
-
account,
|
|
3481
|
-
chain,
|
|
3482
|
-
address: safeAddress,
|
|
3483
|
-
abi: SAFE_ABI,
|
|
3484
|
-
functionName: "execTransaction",
|
|
3485
|
-
args: [
|
|
3486
|
-
safeTx.to,
|
|
3487
|
-
safeTx.value,
|
|
3488
|
-
safeTx.data,
|
|
3489
|
-
safeTx.operation,
|
|
3490
|
-
safeTx.safeTxGas,
|
|
3491
|
-
safeTx.baseGas,
|
|
3492
|
-
safeTx.gasPrice,
|
|
3493
|
-
safeTx.gasToken,
|
|
3494
|
-
safeTx.refundReceiver,
|
|
3495
|
-
signature
|
|
3496
|
-
]
|
|
3497
|
-
});
|
|
3498
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
3499
|
-
hash: txHash
|
|
3500
|
-
});
|
|
3501
|
-
const safeLogs = receipt.logs.filter(
|
|
3502
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3503
|
-
);
|
|
3504
|
-
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
3505
|
-
abi: SAFE_ABI,
|
|
3506
|
-
logs: safeLogs,
|
|
3507
|
-
strict: false
|
|
3508
|
-
});
|
|
3509
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
3510
|
-
if (failed) {
|
|
3511
|
-
throw new Error("Safe transaction failed");
|
|
3512
|
-
}
|
|
3513
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
3514
|
-
if (!succeeded) {
|
|
3515
|
-
throw new Error("Safe transaction status unavailable");
|
|
3516
|
-
}
|
|
3517
|
-
return { txHash };
|
|
3518
|
-
}
|
|
3519
|
-
async function executeSafeErc20Transfer(params) {
|
|
3520
|
-
const {
|
|
3521
|
-
walletClient,
|
|
3522
|
-
publicClient,
|
|
3523
|
-
safeAddress,
|
|
3524
|
-
tokenAddress,
|
|
3525
|
-
recipient,
|
|
3526
|
-
amount,
|
|
3527
|
-
chainId
|
|
3528
|
-
} = params;
|
|
3529
|
-
const account = walletClient.account;
|
|
3530
|
-
const chain = walletClient.chain;
|
|
3531
|
-
if (!account || !chain) {
|
|
3532
|
-
throw new Error("Wallet not connected");
|
|
3533
|
-
}
|
|
3534
|
-
if (chain.id !== chainId) {
|
|
3535
|
-
throw new Error(`Switch to ${_chunkMILJQWPTcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
3536
|
-
}
|
|
3537
|
-
const isOwner = await publicClient.readContract({
|
|
3538
|
-
address: safeAddress,
|
|
3539
|
-
abi: SAFE_ABI,
|
|
3540
|
-
functionName: "isOwner",
|
|
3541
|
-
args: [account.address]
|
|
3542
|
-
});
|
|
3543
|
-
if (!isOwner) {
|
|
3544
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
3545
|
-
}
|
|
3546
|
-
const data = _viem.encodeFunctionData.call(void 0, {
|
|
3547
|
-
abi: _viem.erc20Abi,
|
|
3548
|
-
functionName: "transfer",
|
|
3549
|
-
args: [recipient, amount]
|
|
3550
|
-
});
|
|
3551
|
-
const safeTx = {
|
|
3552
|
-
to: tokenAddress,
|
|
3553
|
-
value: 0n,
|
|
3554
|
-
data,
|
|
3555
|
-
operation: 0,
|
|
3556
|
-
safeTxGas: 0n,
|
|
3557
|
-
baseGas: 0n,
|
|
3558
|
-
gasPrice: 0n,
|
|
3559
|
-
gasToken: _viem.zeroAddress,
|
|
3560
|
-
refundReceiver: _viem.zeroAddress
|
|
3561
|
-
};
|
|
3562
|
-
const signature = _viem.concat.call(void 0, [
|
|
3563
|
-
_viem.pad.call(void 0, account.address, { size: 32 }),
|
|
3564
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
|
|
3565
|
-
_viem.toHex.call(void 0, 1, { size: 1 })
|
|
3566
|
-
]);
|
|
3567
|
-
const txHash = await walletClient.writeContract({
|
|
3568
|
-
account,
|
|
3569
|
-
chain,
|
|
3570
|
-
address: safeAddress,
|
|
3571
|
-
abi: SAFE_ABI,
|
|
3572
|
-
functionName: "execTransaction",
|
|
3573
|
-
args: [
|
|
3574
|
-
safeTx.to,
|
|
3575
|
-
safeTx.value,
|
|
3576
|
-
safeTx.data,
|
|
3577
|
-
safeTx.operation,
|
|
3578
|
-
safeTx.safeTxGas,
|
|
3579
|
-
safeTx.baseGas,
|
|
3580
|
-
safeTx.gasPrice,
|
|
3581
|
-
safeTx.gasToken,
|
|
3582
|
-
safeTx.refundReceiver,
|
|
3583
|
-
signature
|
|
3584
|
-
]
|
|
3585
|
-
});
|
|
3586
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
3587
|
-
hash: txHash
|
|
3588
|
-
});
|
|
3589
|
-
const safeLogs = receipt.logs.filter(
|
|
3590
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3591
|
-
);
|
|
3592
|
-
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
3593
|
-
abi: SAFE_ABI,
|
|
3594
|
-
logs: safeLogs,
|
|
3595
|
-
strict: false
|
|
3596
|
-
});
|
|
3597
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
3598
|
-
if (failed) {
|
|
3599
|
-
throw new Error("Safe transaction failed");
|
|
3600
|
-
}
|
|
3601
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
3602
|
-
if (!succeeded) {
|
|
3603
|
-
throw new Error("Safe transaction status unavailable");
|
|
3604
|
-
}
|
|
3605
|
-
return { txHash };
|
|
3606
|
-
}
|
|
3607
|
-
var SAFE_TX_TYPES = {
|
|
3608
|
-
SafeTx: [
|
|
3609
|
-
{ name: "to", type: "address" },
|
|
3610
|
-
{ name: "value", type: "uint256" },
|
|
3611
|
-
{ name: "data", type: "bytes" },
|
|
3612
|
-
{ name: "operation", type: "uint8" },
|
|
3613
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
3614
|
-
{ name: "baseGas", type: "uint256" },
|
|
3615
|
-
{ name: "gasPrice", type: "uint256" },
|
|
3616
|
-
{ name: "gasToken", type: "address" },
|
|
3617
|
-
{ name: "refundReceiver", type: "address" },
|
|
3618
|
-
{ name: "nonce", type: "uint256" }
|
|
3619
|
-
]
|
|
3620
|
-
};
|
|
3621
|
-
async function buildSafeTransaction(params) {
|
|
3622
|
-
const { publicClient, safeAddress, to, value, data, chainId } = params;
|
|
3623
|
-
const nonce = await publicClient.readContract({
|
|
3624
|
-
address: safeAddress,
|
|
3625
|
-
abi: SAFE_ABI,
|
|
3626
|
-
functionName: "nonce"
|
|
3627
|
-
});
|
|
3628
|
-
const message = {
|
|
3629
|
-
to,
|
|
3630
|
-
value,
|
|
3631
|
-
data,
|
|
3632
|
-
operation: 0,
|
|
3633
|
-
safeTxGas: 0n,
|
|
3634
|
-
baseGas: 0n,
|
|
3635
|
-
gasPrice: 0n,
|
|
3636
|
-
gasToken: _viem.zeroAddress,
|
|
3637
|
-
refundReceiver: _viem.zeroAddress,
|
|
3638
|
-
nonce
|
|
3639
|
-
};
|
|
3640
|
-
const safeTxHash = _viem.hashTypedData.call(void 0, {
|
|
3641
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
3642
|
-
types: SAFE_TX_TYPES,
|
|
3643
|
-
primaryType: "SafeTx",
|
|
3644
|
-
message
|
|
3645
|
-
});
|
|
3646
|
-
return {
|
|
3647
|
-
chainId,
|
|
3648
|
-
safeAddress,
|
|
3649
|
-
safeTxHash,
|
|
3650
|
-
typedData: {
|
|
3651
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
3652
|
-
types: SAFE_TX_TYPES,
|
|
3653
|
-
primaryType: "SafeTx",
|
|
3654
|
-
message
|
|
3655
|
-
}
|
|
3656
|
-
};
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
3843
|
// src/core/session-owner.ts
|
|
3660
3844
|
|
|
3661
3845
|
|
|
@@ -3678,7 +3862,7 @@ function loadSessionOwnerFromStorage(eoaAddress) {
|
|
|
3678
3862
|
privateKey: parsed.privateKey,
|
|
3679
3863
|
address: account.address
|
|
3680
3864
|
};
|
|
3681
|
-
} catch (
|
|
3865
|
+
} catch (e7) {
|
|
3682
3866
|
return null;
|
|
3683
3867
|
}
|
|
3684
3868
|
}
|
|
@@ -3762,4 +3946,4 @@ function accountFromPrivateKey(privateKey) {
|
|
|
3762
3946
|
|
|
3763
3947
|
|
|
3764
3948
|
|
|
3765
|
-
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.PercentIcon = PercentIcon; exports.ClockIcon = ClockIcon; exports.PlusCircleIcon = PlusCircleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.BankIcon = BankIcon; exports.Callout = Callout; exports.BodyHeader = BodyHeader; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.ConnectStep = ConnectStep; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.
|
|
3949
|
+
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.PercentIcon = PercentIcon; exports.ClockIcon = ClockIcon; exports.PlusCircleIcon = PlusCircleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.Callout = Callout; exports.BodyHeader = BodyHeader; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.ConnectStep = ConnectStep; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.formatTokenAmount = formatTokenAmount; exports.formatReceiveEstimate = formatReceiveEstimate; exports.getEventTxHash = getEventTxHash; exports.getEventSourceDetails = getEventSourceDetails; exports.isDepositEvent = isDepositEvent; exports.isFailedEvent = isFailedEvent; exports.txRefsMatch = txRefsMatch; exports.failureMessageForEvent = failureMessageForEvent; exports.useTokenPrices = useTokenPrices; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.getHyperEvmReadClient = getHyperEvmReadClient; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.applyTheme = applyTheme;
|