@rhinestone/deposit-modal 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/dist/{DepositModalReown-6CXXGQ7X.cjs → DepositModalReown-TVO3ZQQK.cjs} +17 -17
- package/dist/{DepositModalReown-ELDSTIME.mjs → DepositModalReown-VCY65DJX.mjs} +4 -4
- package/dist/WithdrawModal-GR3HLYXU.cjs +11 -0
- package/dist/{WithdrawModal-QRMDR5T4.mjs → WithdrawModal-RMCYJJ4S.mjs} +3 -3
- package/dist/bearer-transport-CVHNBgoV.d.cts +14 -0
- package/dist/bearer-transport-CVHNBgoV.d.ts +14 -0
- package/dist/{chunk-2W4BJ5I3.cjs → chunk-34JVJZEZ.cjs} +71 -71
- package/dist/{chunk-XCBDJPBD.mjs → chunk-3TEVMP76.mjs} +1 -1
- package/dist/chunk-ADEWTBSN.cjs +19 -0
- package/dist/{chunk-QMGEK623.mjs → chunk-AIZKGFVA.mjs} +468 -207
- package/dist/{chunk-H66WM5AO.mjs → chunk-EKC2IRQG.mjs} +180 -67
- package/dist/{chunk-XJMDCBHS.cjs → chunk-JV5OGG53.cjs} +629 -516
- package/dist/{chunk-QGNJFDEO.cjs → chunk-N3AAT6BS.cjs} +623 -362
- package/dist/{chunk-JCWJ6HW7.cjs → chunk-N6JJG57R.cjs} +1 -1
- package/dist/chunk-O4JZKKCZ.cjs +41 -0
- package/dist/chunk-PP4QE32S.mjs +19 -0
- package/dist/{chunk-ZHX4QROC.mjs → chunk-R2B6VD4E.mjs} +1 -1
- package/dist/chunk-X4EUXBHJ.mjs +41 -0
- package/dist/compliance.cjs +14 -0
- package/dist/compliance.d.cts +10 -0
- package/dist/compliance.d.ts +10 -0
- package/dist/compliance.mjs +14 -0
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +3 -3
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/embed.cjs +16 -16
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +8 -8
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/offramp.cjs +25 -0
- package/dist/offramp.d.cts +28 -0
- package/dist/offramp.d.ts +28 -0
- package/dist/offramp.mjs +25 -0
- package/dist/onramp.cjs +27 -0
- package/dist/onramp.d.cts +37 -0
- package/dist/onramp.d.ts +37 -0
- package/dist/onramp.mjs +27 -0
- package/dist/ramp-types-C6aUz4SZ.d.cts +43 -0
- package/dist/ramp-types-C6aUz4SZ.d.ts +43 -0
- package/dist/server.cjs +54 -2
- package/dist/server.d.cts +13 -1
- package/dist/server.d.ts +13 -1
- package/dist/server.mjs +52 -0
- package/dist/{types-B9SbZQIG.d.ts → types-CZYypODQ.d.ts} +3 -2
- package/dist/{types-SwGGf0eH.d.cts → types-CbUs4boj.d.cts} +3 -2
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +35 -5
- package/dist/WithdrawModal-QB2U756L.cjs +0 -11
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MULTICALL3_ADDRESS,
|
|
3
|
+
POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
|
|
4
|
+
POLYMARKET_ICON_URL,
|
|
5
|
+
POLYMARKET_POLYGON_CHAIN_ID,
|
|
6
|
+
POLYMARKET_PUSD_ADDRESS,
|
|
7
|
+
POLYMARKET_USDCE_ADDRESS,
|
|
8
|
+
SAFE_ABI,
|
|
9
|
+
executePolymarketSafeTransfer,
|
|
10
|
+
fetchPolymarketProxyWallet,
|
|
11
|
+
readPolymarketBalances
|
|
12
|
+
} from "./chunk-FTWKAJGN.mjs";
|
|
1
13
|
import {
|
|
2
14
|
AnalyticsSession,
|
|
3
15
|
AppleIcon,
|
|
@@ -47,6 +59,8 @@ import {
|
|
|
47
59
|
currencyFormatter,
|
|
48
60
|
debugError,
|
|
49
61
|
debugLog,
|
|
62
|
+
depositBoundsViolation,
|
|
63
|
+
describePolicyRefusal,
|
|
50
64
|
failureMessageForEvent,
|
|
51
65
|
fetchTokenPriceUsd,
|
|
52
66
|
formatExpectedDuration,
|
|
@@ -61,6 +75,7 @@ import {
|
|
|
61
75
|
getExchangeLogoSrc,
|
|
62
76
|
getPublicClient,
|
|
63
77
|
isDepositEvent,
|
|
78
|
+
isDepositPolicyRefusal,
|
|
64
79
|
isDisplayStablecoinSymbol,
|
|
65
80
|
isFailedEvent,
|
|
66
81
|
isHistoryEntryVisible,
|
|
@@ -79,27 +94,18 @@ import {
|
|
|
79
94
|
useChainCatalog,
|
|
80
95
|
useChainName,
|
|
81
96
|
useDepositAnalyticsEmitter,
|
|
97
|
+
useDepositBounds,
|
|
82
98
|
useDepositChainIds,
|
|
99
|
+
useDepositOffer,
|
|
83
100
|
useExplorerTxUrl,
|
|
84
101
|
useHistoryPanel,
|
|
85
102
|
useIsDepositChain,
|
|
86
103
|
useLatestRef,
|
|
104
|
+
useRestrictedListExclusion,
|
|
87
105
|
useRpcUrls,
|
|
88
106
|
useStableRpcUrls,
|
|
89
107
|
warnRemovedProps
|
|
90
|
-
} from "./chunk-
|
|
91
|
-
import {
|
|
92
|
-
MULTICALL3_ADDRESS,
|
|
93
|
-
POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
|
|
94
|
-
POLYMARKET_ICON_URL,
|
|
95
|
-
POLYMARKET_POLYGON_CHAIN_ID,
|
|
96
|
-
POLYMARKET_PUSD_ADDRESS,
|
|
97
|
-
POLYMARKET_USDCE_ADDRESS,
|
|
98
|
-
SAFE_ABI,
|
|
99
|
-
executePolymarketSafeTransfer,
|
|
100
|
-
fetchPolymarketProxyWallet,
|
|
101
|
-
readPolymarketBalances
|
|
102
|
-
} from "./chunk-FTWKAJGN.mjs";
|
|
108
|
+
} from "./chunk-AIZKGFVA.mjs";
|
|
103
109
|
import {
|
|
104
110
|
HYPERCORE_CHAIN_ID,
|
|
105
111
|
HYPERCORE_MIN_DEPOSIT_USD,
|
|
@@ -123,7 +129,6 @@ import {
|
|
|
123
129
|
isStablecoinSymbol,
|
|
124
130
|
isVirtualDestination,
|
|
125
131
|
parseEvmChainId,
|
|
126
|
-
publishShortlistTokens,
|
|
127
132
|
targetChainToChainId,
|
|
128
133
|
toEvmCaip2
|
|
129
134
|
} from "./chunk-EAGMY3QE.mjs";
|
|
@@ -723,6 +728,7 @@ function AssetSelectStep({
|
|
|
723
728
|
const [loading, setLoading] = useState2(true);
|
|
724
729
|
const [error, setError] = useState2(null);
|
|
725
730
|
const isDepositChain = useIsDepositChain();
|
|
731
|
+
const isExcludedByRestrictedList = useRestrictedListExclusion();
|
|
726
732
|
const { catalog } = useChainCatalog();
|
|
727
733
|
const chainName = useChainName();
|
|
728
734
|
const defaultAssetId = useMemo(() => {
|
|
@@ -804,6 +810,9 @@ function AssetSelectStep({
|
|
|
804
810
|
return false;
|
|
805
811
|
}
|
|
806
812
|
const isNativeToken = a.token.toLowerCase() === NATIVE_TOKEN_ADDRESS;
|
|
813
|
+
if (isNativeToken && isExcludedByRestrictedList(a.chainId, a.token)) {
|
|
814
|
+
return false;
|
|
815
|
+
}
|
|
807
816
|
if (!isNativeToken && !(typeof a.balanceUsd === "number" && a.balanceUsd >= 0.01))
|
|
808
817
|
return false;
|
|
809
818
|
return true;
|
|
@@ -817,7 +826,7 @@ function AssetSelectStep({
|
|
|
817
826
|
if (balB < balA) return -1;
|
|
818
827
|
return 0;
|
|
819
828
|
});
|
|
820
|
-
}, [assets, isDepositChain]);
|
|
829
|
+
}, [assets, isDepositChain, isExcludedByRestrictedList]);
|
|
821
830
|
useEffect2(() => {
|
|
822
831
|
if (!defaultAssetId || selectedAssetId) return;
|
|
823
832
|
if (rows.some((asset) => asset.id === defaultAssetId)) {
|
|
@@ -1248,6 +1257,11 @@ function AmountStep({
|
|
|
1248
1257
|
const exceedsBalance = Boolean(
|
|
1249
1258
|
sourceAmountUnits !== null && balance !== null && sourceAmountUnits > balance
|
|
1250
1259
|
);
|
|
1260
|
+
const boundsFor = useDepositBounds();
|
|
1261
|
+
const boundViolation = depositBoundsViolation(
|
|
1262
|
+
boundsFor(asset.chainId, asset.token),
|
|
1263
|
+
sourceAmountUnits
|
|
1264
|
+
);
|
|
1251
1265
|
const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
|
|
1252
1266
|
const handlePresetClick = (percentage) => {
|
|
1253
1267
|
if (balance === null) return;
|
|
@@ -1271,7 +1285,7 @@ function AmountStep({
|
|
|
1271
1285
|
if (error) setError(null);
|
|
1272
1286
|
};
|
|
1273
1287
|
const handleContinue = async () => {
|
|
1274
|
-
if (chainMismatch) return;
|
|
1288
|
+
if (chainMismatch || boundViolation) return;
|
|
1275
1289
|
let effectiveAmount = numericAmount;
|
|
1276
1290
|
if (isBelowMin && minDepositUsd !== null) {
|
|
1277
1291
|
effectiveAmount = minDepositUsd;
|
|
@@ -1305,11 +1319,11 @@ function AmountStep({
|
|
|
1305
1319
|
balance ?? void 0
|
|
1306
1320
|
);
|
|
1307
1321
|
};
|
|
1308
|
-
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
1322
|
+
const continueLabel = exceedsBalance ? "Insufficient balance" : boundViolation ?? (isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue");
|
|
1309
1323
|
const knowsBalance = address !== void 0;
|
|
1310
1324
|
const needsPricing = !knowsBalance && !isSourceStablecoin;
|
|
1311
1325
|
const blockedOnPricing = needsPricing && !hasPricing;
|
|
1312
|
-
const continueDisabled = chainMismatch || exceedsBalance || blockedOnPricing || numericAmount === 0 && !isBelowMin || knowsBalance && balance === null;
|
|
1326
|
+
const continueDisabled = chainMismatch || exceedsBalance || boundViolation !== null || blockedOnPricing || numericAmount === 0 && !isBelowMin || knowsBalance && balance === null;
|
|
1313
1327
|
const chainName = useChainName();
|
|
1314
1328
|
const sourceChainName = chainName(asset.chainId);
|
|
1315
1329
|
const targetChainName = chainName(targetChainId);
|
|
@@ -1651,6 +1665,14 @@ function ConfirmStep({
|
|
|
1651
1665
|
const [permitUnavailable, setPermitUnavailable] = useState4(null);
|
|
1652
1666
|
const [permitDisabled, setPermitDisabled] = useState4(false);
|
|
1653
1667
|
const [submissionUncertain, setSubmissionUncertain] = useState4(false);
|
|
1668
|
+
const [previewRefusal, setPreviewRefusal] = useState4(null);
|
|
1669
|
+
const [permitRefusal, setPermitRefusal] = useState4(null);
|
|
1670
|
+
const [previewSettledKey, setPreviewSettledKey] = useState4(
|
|
1671
|
+
null
|
|
1672
|
+
);
|
|
1673
|
+
const [permitSettledKey, setPermitSettledKey] = useState4(
|
|
1674
|
+
null
|
|
1675
|
+
);
|
|
1654
1676
|
const hasAttemptedSwitch = useRef3(false);
|
|
1655
1677
|
const onSubmittingChangeRef = useRef3(onSubmittingChange);
|
|
1656
1678
|
onSubmittingChangeRef.current = onSubmittingChange;
|
|
@@ -1701,6 +1723,21 @@ function ConfirmStep({
|
|
|
1701
1723
|
address.toLowerCase()
|
|
1702
1724
|
]);
|
|
1703
1725
|
const permit = permitEligible && !permitDisabled && permitResult?.requestKey === permitRequestKey ? permitResult.prepared : null;
|
|
1726
|
+
const boundsFor = useDepositBounds();
|
|
1727
|
+
const activeRefusal = (previewRefusal?.requestKey === quoteRequestKey ? previewRefusal.refusal : null) ?? (permitRefusal?.requestKey === permitRequestKey ? permitRefusal.refusal : null);
|
|
1728
|
+
const blockedReason = activeRefusal ? describePolicyRefusal(
|
|
1729
|
+
activeRefusal,
|
|
1730
|
+
boundsFor(quoteSource.chainId, quoteSource.token)
|
|
1731
|
+
) : null;
|
|
1732
|
+
const requestsAmount = (() => {
|
|
1733
|
+
try {
|
|
1734
|
+
return parseUnits2(amount, asset.decimals) > 0n;
|
|
1735
|
+
} catch {
|
|
1736
|
+
return false;
|
|
1737
|
+
}
|
|
1738
|
+
})();
|
|
1739
|
+
const previewPending = setupReady && requestsAmount && previewSettledKey !== quoteRequestKey;
|
|
1740
|
+
const permitPending = permitEligible && !permitDisabled && requestsAmount && permitSettledKey !== permitRequestKey;
|
|
1704
1741
|
const receiveDisplay = (() => {
|
|
1705
1742
|
if (directTransfer) return `${formattedSendAmount} ${asset.symbol}`;
|
|
1706
1743
|
if (quote) {
|
|
@@ -1757,11 +1794,22 @@ function ConfirmStep({
|
|
|
1757
1794
|
amount: units.toString()
|
|
1758
1795
|
}).then((result) => {
|
|
1759
1796
|
if (cancelled) return;
|
|
1797
|
+
setPreviewSettledKey(quoteRequestKey);
|
|
1798
|
+
if (isDepositPolicyRefusal(result)) {
|
|
1799
|
+
setQuoteResult(null);
|
|
1800
|
+
setPreviewRefusal({
|
|
1801
|
+
requestKey: quoteRequestKey,
|
|
1802
|
+
refusal: result.policyRefusal
|
|
1803
|
+
});
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1806
|
+
setPreviewRefusal(null);
|
|
1760
1807
|
setQuoteResult(
|
|
1761
1808
|
result === null ? null : { requestKey: quoteRequestKey, quote: result }
|
|
1762
1809
|
);
|
|
1763
1810
|
}).catch(() => {
|
|
1764
1811
|
if (cancelled) return;
|
|
1812
|
+
setPreviewSettledKey(quoteRequestKey);
|
|
1765
1813
|
setQuoteResult(null);
|
|
1766
1814
|
});
|
|
1767
1815
|
return () => {
|
|
@@ -1794,7 +1842,16 @@ function ConfirmStep({
|
|
|
1794
1842
|
amount: units.toString(),
|
|
1795
1843
|
owner: address
|
|
1796
1844
|
}).then((prepared) => {
|
|
1797
|
-
if (cancelled
|
|
1845
|
+
if (cancelled) return;
|
|
1846
|
+
setPermitSettledKey(permitRequestKey);
|
|
1847
|
+
if (prepared === null) return;
|
|
1848
|
+
if (isDepositPolicyRefusal(prepared)) {
|
|
1849
|
+
setPermitRefusal({
|
|
1850
|
+
requestKey: permitRequestKey,
|
|
1851
|
+
refusal: prepared.policyRefusal
|
|
1852
|
+
});
|
|
1853
|
+
return;
|
|
1854
|
+
}
|
|
1798
1855
|
if (!prepared.available) {
|
|
1799
1856
|
setPermitUnavailable(prepared.reason);
|
|
1800
1857
|
return;
|
|
@@ -1819,6 +1876,7 @@ function ConfirmStep({
|
|
|
1819
1876
|
prepared: authorization
|
|
1820
1877
|
});
|
|
1821
1878
|
}).catch(() => {
|
|
1879
|
+
if (!cancelled) setPermitSettledKey(permitRequestKey);
|
|
1822
1880
|
});
|
|
1823
1881
|
return () => {
|
|
1824
1882
|
cancelled = true;
|
|
@@ -1860,6 +1918,11 @@ function ConfirmStep({
|
|
|
1860
1918
|
setError("Insufficient balance");
|
|
1861
1919
|
return;
|
|
1862
1920
|
}
|
|
1921
|
+
if (previewPending || permitPending) return;
|
|
1922
|
+
if (blockedReason) {
|
|
1923
|
+
setError(blockedReason);
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1863
1926
|
if (!quote && mustHaveQuote) {
|
|
1864
1927
|
setError("Quote unavailable \u2014 please try again");
|
|
1865
1928
|
return;
|
|
@@ -1998,7 +2061,7 @@ function ConfirmStep({
|
|
|
1998
2061
|
fee: { display: feeDisplay, struck: feesFullySponsored }
|
|
1999
2062
|
}
|
|
2000
2063
|
),
|
|
2001
|
-
error && /* @__PURE__ */ jsx10(Callout, { variant: "error", children: error }),
|
|
2064
|
+
(error ?? blockedReason) && /* @__PURE__ */ jsx10(Callout, { variant: "error", children: error ?? blockedReason }),
|
|
2002
2065
|
/* @__PURE__ */ jsx10(
|
|
2003
2066
|
Button,
|
|
2004
2067
|
{
|
|
@@ -2007,7 +2070,9 @@ function ConfirmStep({
|
|
|
2007
2070
|
loadingText: permit ? "Waiting for signature..." : "Submitting transaction...",
|
|
2008
2071
|
disabled: (
|
|
2009
2072
|
// An earlier send whose outcome is unknown. Never re-offered.
|
|
2010
|
-
submissionUncertain || //
|
|
2073
|
+
submissionUncertain || // The deposit on screen would be rejected at ingest.
|
|
2074
|
+
blockedReason !== null || // A refusal for what is on screen may still be in flight.
|
|
2075
|
+
previewPending || permitPending || // Signing is off-chain, so a chain mismatch only blocks the
|
|
2011
2076
|
// transfer path.
|
|
2012
2077
|
chainMismatch && !permit || !amount || Number(amount) <= 0 || // Fee-charging route: block until the authoritative quote resolves
|
|
2013
2078
|
// (covers both loading and an unavailable preview). Fee-free routes
|
|
@@ -2049,6 +2114,7 @@ function QrReviewStep({
|
|
|
2049
2114
|
const [quote, setQuote] = useState5({ state: "loading", value: null });
|
|
2050
2115
|
const targetChainId = targetChainToChainId(targetChain);
|
|
2051
2116
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
|
|
2117
|
+
const boundsFor = useDepositBounds();
|
|
2052
2118
|
useEffect5(() => {
|
|
2053
2119
|
let cancelled = false;
|
|
2054
2120
|
let units;
|
|
@@ -2070,6 +2136,14 @@ function QrReviewStep({
|
|
|
2070
2136
|
amount: units.toString()
|
|
2071
2137
|
}).then((result) => {
|
|
2072
2138
|
if (cancelled) return;
|
|
2139
|
+
if (isDepositPolicyRefusal(result)) {
|
|
2140
|
+
setQuote({
|
|
2141
|
+
state: "refused",
|
|
2142
|
+
value: null,
|
|
2143
|
+
refusal: result.policyRefusal
|
|
2144
|
+
});
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2073
2147
|
setQuote(
|
|
2074
2148
|
result ? { state: "ready", value: result } : { state: "unavailable", value: null }
|
|
2075
2149
|
);
|
|
@@ -2100,7 +2174,7 @@ function QrReviewStep({
|
|
|
2100
2174
|
const expectedSeconds = quote.value?.timing?.expectedSeconds ?? (quote.value && Number.isFinite(quote.value.estimatedFillTimeSeconds) ? quote.value.estimatedFillTimeSeconds : void 0);
|
|
2101
2175
|
const estimatedTime = expectedSeconds !== void 0 ? formatExpectedDuration(expectedSeconds) : quote.state === "loading" ? "\u2026" : "\u2014";
|
|
2102
2176
|
const { display: quotedFee, struck } = quoteFeeRow(quote.value?.fees);
|
|
2103
|
-
const feeDisplay = quote.state === "unavailable" ? "\u2014" : quotedFee;
|
|
2177
|
+
const feeDisplay = quote.state === "unavailable" || quote.state === "refused" ? "\u2014" : quotedFee;
|
|
2104
2178
|
return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
|
|
2105
2179
|
/* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2106
2180
|
/* @__PURE__ */ jsx11(BodyHeader, { icon: /* @__PURE__ */ jsx11(TransferCryptoIcon, {}), title: "Fee estimate" }),
|
|
@@ -2119,6 +2193,10 @@ function QrReviewStep({
|
|
|
2119
2193
|
fee: { display: feeDisplay, struck }
|
|
2120
2194
|
}
|
|
2121
2195
|
),
|
|
2196
|
+
quote.state === "refused" && quote.refusal && /* @__PURE__ */ jsx11(Callout, { variant: "error", children: describePolicyRefusal(
|
|
2197
|
+
quote.refusal,
|
|
2198
|
+
boundsFor(asset.chainId, asset.token)
|
|
2199
|
+
) }),
|
|
2122
2200
|
/* @__PURE__ */ jsx11(Button, { onClick: onClose, fullWidth: true, children: "Close" })
|
|
2123
2201
|
] }),
|
|
2124
2202
|
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
@@ -2653,17 +2731,15 @@ function chainLabel(chainId, catalogChain) {
|
|
|
2653
2731
|
const name = catalogChain?.name ?? getChainName(chainId);
|
|
2654
2732
|
return name.replace(/\s+(One|Mainnet|Smart Chain|Chain)$/i, "");
|
|
2655
2733
|
}
|
|
2656
|
-
function computeTokensForChain(chainId,
|
|
2657
|
-
const
|
|
2658
|
-
if (
|
|
2734
|
+
function computeTokensForChain(chainId, offer, catalogChain) {
|
|
2735
|
+
const listed = offer.tokensFor(chainId)?.map((t) => t.symbol);
|
|
2736
|
+
if (listed) return listed;
|
|
2659
2737
|
return Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.map((t) => t.symbol) : [];
|
|
2660
2738
|
}
|
|
2661
|
-
function selectionAsAsset(chainId, symbol,
|
|
2739
|
+
function selectionAsAsset(chainId, symbol, offer, catalogChain) {
|
|
2662
2740
|
if (typeof chainId !== "number" || !symbol) return void 0;
|
|
2663
|
-
const fromShortlist =
|
|
2664
|
-
|
|
2665
|
-
);
|
|
2666
|
-
const fromCatalog = Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.find((t) => t.symbol === symbol) : void 0;
|
|
2741
|
+
const fromShortlist = offer.tokensFor(chainId)?.find((t) => t.symbol === symbol);
|
|
2742
|
+
const fromCatalog = !offer.restricted && Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.find((t) => t.symbol === symbol) : void 0;
|
|
2667
2743
|
const address = fromShortlist?.address ?? fromCatalog?.address;
|
|
2668
2744
|
const decimals = fromShortlist?.decimals ?? fromCatalog?.decimals;
|
|
2669
2745
|
if (!address || decimals === void 0) return void 0;
|
|
@@ -2708,25 +2784,10 @@ function DepositAddressStep({
|
|
|
2708
2784
|
onError
|
|
2709
2785
|
}) {
|
|
2710
2786
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
2711
|
-
const
|
|
2712
|
-
const [topTokensSettled, setTopTokensSettled] = useState7(false);
|
|
2713
|
-
useEffect7(() => {
|
|
2714
|
-
let active = true;
|
|
2715
|
-
setTopTokens(null);
|
|
2716
|
-
setTopTokensSettled(false);
|
|
2717
|
-
service.getTopTokens().then((t) => {
|
|
2718
|
-
if (!active) return;
|
|
2719
|
-
setTopTokens(t);
|
|
2720
|
-
setTopTokensSettled(true);
|
|
2721
|
-
if (t) publishShortlistTokens(t);
|
|
2722
|
-
});
|
|
2723
|
-
return () => {
|
|
2724
|
-
active = false;
|
|
2725
|
-
};
|
|
2726
|
-
}, [service]);
|
|
2787
|
+
const offer = useDepositOffer();
|
|
2727
2788
|
const BASE_CHAIN_ID2 = 8453;
|
|
2728
2789
|
const evmChainIds = useDepositChainIds();
|
|
2729
|
-
const { catalog, isLoading: catalogLoading } = useChainCatalog();
|
|
2790
|
+
const { catalog, isLoading: catalogLoading, shortlist } = useChainCatalog();
|
|
2730
2791
|
const catalogFor = useCallback2(
|
|
2731
2792
|
(chain) => {
|
|
2732
2793
|
if (!catalog) return void 0;
|
|
@@ -2743,9 +2804,9 @@ function DepositAddressStep({
|
|
|
2743
2804
|
if (acceptsDeposits("hypercore")) extras.push("hypercore");
|
|
2744
2805
|
options.splice(1, 0, ...extras);
|
|
2745
2806
|
return options.filter(
|
|
2746
|
-
(chain) =>
|
|
2807
|
+
(chain) => offer.isChainOffered(chain) && computeTokensForChain(chain, offer, catalogFor(chain)).length > 0
|
|
2747
2808
|
);
|
|
2748
|
-
}, [evmChainIds, hasSolana,
|
|
2809
|
+
}, [evmChainIds, hasSolana, offer, catalogFor]);
|
|
2749
2810
|
const preferredChainId = (options) => options.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : options[0] ?? BASE_CHAIN_ID2;
|
|
2750
2811
|
const [sourceChainId, setSourceChainId] = useState7(() => initialSource?.chainId ?? preferredChainId(chainOptions));
|
|
2751
2812
|
const chainChosenByUser = useRef5(initialSource !== void 0);
|
|
@@ -2759,17 +2820,17 @@ function DepositAddressStep({
|
|
|
2759
2820
|
setSourceChainId(pendingChain2);
|
|
2760
2821
|
return;
|
|
2761
2822
|
}
|
|
2762
|
-
if (catalogLoading ||
|
|
2823
|
+
if (catalogLoading || offer.status !== "ready") return;
|
|
2763
2824
|
pendingChainRef.current = void 0;
|
|
2764
2825
|
}
|
|
2765
2826
|
const stale = chainChosenByUser.current ? !chainOptions.includes(sourceChainId) : sourceChainId !== preferredChainId(chainOptions);
|
|
2766
2827
|
if (stale) setSourceChainId(preferredChainId(chainOptions));
|
|
2767
|
-
}, [chainOptions, sourceChainId, catalogLoading,
|
|
2828
|
+
}, [chainOptions, sourceChainId, catalogLoading, offer.status]);
|
|
2768
2829
|
const isSolana = sourceChainId === "solana";
|
|
2769
2830
|
const isHyperCore = sourceChainId === "hypercore";
|
|
2770
2831
|
const tokensForChain = useMemo3(
|
|
2771
|
-
() => computeTokensForChain(sourceChainId,
|
|
2772
|
-
[sourceChainId,
|
|
2832
|
+
() => computeTokensForChain(sourceChainId, offer, catalogFor(sourceChainId)),
|
|
2833
|
+
[sourceChainId, offer, catalogFor]
|
|
2773
2834
|
);
|
|
2774
2835
|
const defaultToken = pickFallbackToken(
|
|
2775
2836
|
tokensForChain,
|
|
@@ -2807,13 +2868,13 @@ function DepositAddressStep({
|
|
|
2807
2868
|
() => resolveSourceTokenIdentity({
|
|
2808
2869
|
chain: sourceChainId,
|
|
2809
2870
|
symbol: sourceTokenSymbol,
|
|
2810
|
-
shortlist
|
|
2811
|
-
catalogTokens: catalogFor(sourceChainId)?.supportedTokens
|
|
2871
|
+
shortlist,
|
|
2872
|
+
catalogTokens: offer.restricted ? void 0 : catalogFor(sourceChainId)?.supportedTokens
|
|
2812
2873
|
}),
|
|
2813
|
-
[sourceChainId, sourceTokenSymbol,
|
|
2874
|
+
[sourceChainId, sourceTokenSymbol, shortlist, offer.restricted, catalogFor]
|
|
2814
2875
|
);
|
|
2815
2876
|
const pendingChain = pendingChainRef.current;
|
|
2816
|
-
const sourceSelectionSettled = !catalogLoading &&
|
|
2877
|
+
const sourceSelectionSettled = !catalogLoading && offer.status === "ready" && chainOptions.length > 0 && (pendingChain === void 0 || pendingChain === sourceChainId) && (chainChosenByUser.current ? chainOptions.includes(sourceChainId) : sourceChainId === preferredChainId(chainOptions));
|
|
2817
2878
|
useEffect7(() => {
|
|
2818
2879
|
if (!sourceTokenIdentity) return;
|
|
2819
2880
|
if (!sourceSelectionSettled) return;
|
|
@@ -2873,7 +2934,7 @@ function DepositAddressStep({
|
|
|
2873
2934
|
(nextChain) => {
|
|
2874
2935
|
const nextTokens = computeTokensForChain(
|
|
2875
2936
|
nextChain,
|
|
2876
|
-
|
|
2937
|
+
offer,
|
|
2877
2938
|
catalogFor(nextChain)
|
|
2878
2939
|
);
|
|
2879
2940
|
chainChosenByUser.current = true;
|
|
@@ -2883,7 +2944,7 @@ function DepositAddressStep({
|
|
|
2883
2944
|
setTokenDropdownOpen(false);
|
|
2884
2945
|
setCopied(false);
|
|
2885
2946
|
},
|
|
2886
|
-
[sourceTokenSymbol,
|
|
2947
|
+
[sourceTokenSymbol, offer, catalogFor]
|
|
2887
2948
|
);
|
|
2888
2949
|
const onDepositSubmittedRef = useRef5(onDepositSubmitted);
|
|
2889
2950
|
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
@@ -3016,14 +3077,23 @@ function DepositAddressStep({
|
|
|
3016
3077
|
const reviewAsset = selectionAsAsset(
|
|
3017
3078
|
sourceChainId,
|
|
3018
3079
|
sourceTokenSymbol,
|
|
3019
|
-
|
|
3080
|
+
offer,
|
|
3020
3081
|
catalogFor(sourceChainId)
|
|
3021
3082
|
);
|
|
3083
|
+
if (offer.status === "error") {
|
|
3084
|
+
return /* @__PURE__ */ jsx14("div", { className: "rs-screen", children: /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body", children: [
|
|
3085
|
+
/* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
3086
|
+
/* @__PURE__ */ jsx14(Callout, { variant: "error", children: "The tokens this app accepts could not be loaded, so there is no deposit address to show." }),
|
|
3087
|
+
/* @__PURE__ */ jsx14(Button, { onClick: offer.retry, fullWidth: true, children: "Try again" })
|
|
3088
|
+
] }) });
|
|
3089
|
+
}
|
|
3022
3090
|
if (chainOptions.length === 0) {
|
|
3023
|
-
if (catalogLoading
|
|
3091
|
+
if (catalogLoading || offer.status === "loading") {
|
|
3092
|
+
return /* @__PURE__ */ jsx14(DepositAddressSkeleton, { uiConfig });
|
|
3093
|
+
}
|
|
3024
3094
|
return /* @__PURE__ */ jsx14("div", { className: "rs-screen", children: /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body", children: [
|
|
3025
3095
|
/* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
3026
|
-
/* @__PURE__ */ jsx14(Callout, { variant: "error", children: "Supported chains are unavailable right now, so there is no deposit address to show. Close and try again in a moment." })
|
|
3096
|
+
/* @__PURE__ */ jsx14(Callout, { variant: "error", children: catalog ? "This app does not accept deposits from any chain available here." : "Supported chains are unavailable right now, so there is no deposit address to show. Close and try again in a moment." })
|
|
3027
3097
|
] }) });
|
|
3028
3098
|
}
|
|
3029
3099
|
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen rs-step--with-notifications", children: [
|
|
@@ -4550,6 +4620,11 @@ function SolanaAmountStep({
|
|
|
4550
4620
|
const exceedsBalance = Boolean(
|
|
4551
4621
|
sourceAmountUnits !== null && sourceAmountUnits > spendableBalance
|
|
4552
4622
|
);
|
|
4623
|
+
const boundsFor = useDepositBounds();
|
|
4624
|
+
const boundViolation = depositBoundsViolation(
|
|
4625
|
+
boundsFor("solana", token.mint),
|
|
4626
|
+
sourceAmountUnits
|
|
4627
|
+
);
|
|
4553
4628
|
const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
|
|
4554
4629
|
const handlePresetClick = (percentage) => {
|
|
4555
4630
|
const formatted = computePresetAmount(percentage);
|
|
@@ -4570,6 +4645,7 @@ function SolanaAmountStep({
|
|
|
4570
4645
|
if (error) setError(null);
|
|
4571
4646
|
};
|
|
4572
4647
|
const handleContinue = () => {
|
|
4648
|
+
if (boundViolation) return;
|
|
4573
4649
|
let effective = numericAmount;
|
|
4574
4650
|
if (isBelowMin && minDepositUsd !== null) {
|
|
4575
4651
|
effective = minDepositUsd;
|
|
@@ -4613,8 +4689,8 @@ function SolanaAmountStep({
|
|
|
4613
4689
|
setError(null);
|
|
4614
4690
|
onContinue(token, sourceAmountStr, effective.toString());
|
|
4615
4691
|
};
|
|
4616
|
-
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
4617
|
-
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
4692
|
+
const continueLabel = exceedsBalance ? "Insufficient balance" : boundViolation ?? (isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue");
|
|
4693
|
+
const continueDisabled = exceedsBalance || boundViolation !== null || numericAmount === 0 && !isBelowMin;
|
|
4618
4694
|
return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
|
|
4619
4695
|
/* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4620
4696
|
/* @__PURE__ */ jsx22(BodyHeader, { icon: /* @__PURE__ */ jsx22(WalletIcon, {}), title: "Wallet deposit" }),
|
|
@@ -5753,6 +5829,33 @@ function getEnabledProviders(config) {
|
|
|
5753
5829
|
}
|
|
5754
5830
|
|
|
5755
5831
|
// src/core/dapp-imports/status.ts
|
|
5832
|
+
function narrowDappImportAvailability(availability, isExcluded) {
|
|
5833
|
+
let changed = false;
|
|
5834
|
+
const narrowed = {};
|
|
5835
|
+
for (const [providerId, entry] of Object.entries(availability)) {
|
|
5836
|
+
if (!entry || entry === "loading" || entry === "error") {
|
|
5837
|
+
narrowed[providerId] = entry;
|
|
5838
|
+
continue;
|
|
5839
|
+
}
|
|
5840
|
+
const assets = entry.assets.filter(
|
|
5841
|
+
(asset) => !isExcluded(asset.depositChainId, asset.depositToken)
|
|
5842
|
+
);
|
|
5843
|
+
if (assets.length === entry.assets.length) {
|
|
5844
|
+
narrowed[providerId] = entry;
|
|
5845
|
+
continue;
|
|
5846
|
+
}
|
|
5847
|
+
changed = true;
|
|
5848
|
+
narrowed[providerId] = assets.length === 0 ? null : {
|
|
5849
|
+
...entry,
|
|
5850
|
+
assets,
|
|
5851
|
+
totalUsd: assets.reduce(
|
|
5852
|
+
(sum, asset) => sum + (asset.balanceUsd ?? 0),
|
|
5853
|
+
0
|
|
5854
|
+
)
|
|
5855
|
+
};
|
|
5856
|
+
}
|
|
5857
|
+
return changed ? narrowed : availability;
|
|
5858
|
+
}
|
|
5756
5859
|
function computeDappImportStatus(providerId, inputs) {
|
|
5757
5860
|
const { owner, availability, availabilityOwner, setup } = inputs;
|
|
5758
5861
|
if (!owner) return "needs-connect";
|
|
@@ -7180,7 +7283,7 @@ async function fetchPinnedQuote(params) {
|
|
|
7180
7283
|
timeoutId = setTimeout(resolve, SWAPPED_QUOTE_FEE_TIMEOUT_MS, null);
|
|
7181
7284
|
})
|
|
7182
7285
|
]);
|
|
7183
|
-
return quote
|
|
7286
|
+
return quote && !isDepositPolicyRefusal(quote) ? quote : void 0;
|
|
7184
7287
|
} catch {
|
|
7185
7288
|
return void 0;
|
|
7186
7289
|
} finally {
|
|
@@ -8090,7 +8193,17 @@ function DepositFlow({
|
|
|
8090
8193
|
providerId: initialAssetMigrationProvider.id
|
|
8091
8194
|
});
|
|
8092
8195
|
}, [analytics, initialAssetMigrationProvider, flowSlice, storeApi]);
|
|
8093
|
-
const
|
|
8196
|
+
const storedDappImportAvailability = useDepositStore(
|
|
8197
|
+
(s) => s.dappImport.availability
|
|
8198
|
+
);
|
|
8199
|
+
const isExcludedByRestrictedList = useRestrictedListExclusion();
|
|
8200
|
+
const dappImportAvailability = useMemo8(
|
|
8201
|
+
() => narrowDappImportAvailability(
|
|
8202
|
+
storedDappImportAvailability,
|
|
8203
|
+
isExcludedByRestrictedList
|
|
8204
|
+
),
|
|
8205
|
+
[storedDappImportAvailability, isExcludedByRestrictedList]
|
|
8206
|
+
);
|
|
8094
8207
|
const dappImportAvailabilityOwner = useDepositStore(
|
|
8095
8208
|
(s) => s.dappImport.availabilityOwner
|
|
8096
8209
|
);
|
|
@@ -9646,7 +9759,7 @@ function DepositFlow({
|
|
|
9646
9759
|
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
9647
9760
|
var ReownDepositInner = lazy2(async () => {
|
|
9648
9761
|
await loadReownDependencies();
|
|
9649
|
-
const module = await import("./DepositModalReown-
|
|
9762
|
+
const module = await import("./DepositModalReown-VCY65DJX.mjs");
|
|
9650
9763
|
return { default: module.DepositModalReown };
|
|
9651
9764
|
});
|
|
9652
9765
|
function buildDepositAnalyticsSessionProperties({
|