@rhinestone/deposit-modal 0.0.0-dev-20260728154009 → 0.0.0-dev-20260729013445
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 +16 -5
- package/dist/{DepositModalReown-2M3RDABA.cjs → DepositModalReown-7IKZUY34.cjs} +9 -9
- package/dist/{DepositModalReown-VDJRAAQC.mjs → DepositModalReown-RLSGDANC.mjs} +5 -5
- package/dist/{chunk-B24CWXUV.mjs → chunk-2APKKVQK.mjs} +1 -1
- package/dist/{chunk-UVK7ZEE6.cjs → chunk-AA37G5O2.cjs} +1 -1
- package/dist/{chunk-AZADXA6N.mjs → chunk-CUSYITEG.mjs} +196 -4
- package/dist/{chunk-AUE2C5AB.cjs → chunk-D52L6CAO.cjs} +3 -3
- package/dist/{chunk-UAS6M6PR.mjs → chunk-FBMNVFEH.mjs} +2 -2
- package/dist/{chunk-HSCBIOGQ.cjs → chunk-HDZUPOUJ.cjs} +120 -90
- package/dist/{chunk-ETSBSEXK.mjs → chunk-IQ6P2TBV.mjs} +1 -1
- package/dist/{chunk-PPMAHM7R.mjs → chunk-JT2VAH2D.mjs} +2 -2
- package/dist/{chunk-Z7O5DEZ7.cjs → chunk-KWXEW5SV.cjs} +241 -49
- package/dist/{chunk-HTROQQRT.cjs → chunk-M3HAQUVO.cjs} +879 -508
- package/dist/{chunk-MWPAXB5V.cjs → chunk-R62N7VSH.cjs} +49 -49
- package/dist/{chunk-W77NC6G7.mjs → chunk-SLAJQ5BS.mjs} +485 -114
- package/dist/{chunk-T4NWARPL.cjs → chunk-X4ZOJMRY.cjs} +56 -56
- package/dist/{chunk-OZUFYMYX.mjs → chunk-X73URRGG.mjs} +57 -27
- package/dist/claim.cjs +5 -5
- package/dist/claim.d.cts +2 -2
- package/dist/claim.d.ts +2 -2
- package/dist/claim.mjs +4 -4
- 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 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -7
- package/dist/styles.css +80 -0
- package/dist/{types-DJbqT_3H.d.cts → types-DF9MnowK.d.cts} +14 -3
- package/dist/{types-DJbqT_3H.d.ts → types-DF9MnowK.d.ts} +14 -3
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,10 +165,10 @@ Pass `enableFiatOnramp` to expose Swapped's iframe as a funding option alongside
|
|
|
165
165
|
```tsx
|
|
166
166
|
<DepositModal
|
|
167
167
|
enableFiatOnramp
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
// `payment_group` values —
|
|
171
|
-
//
|
|
168
|
+
// Optional: restrict Cash to these standard Swapped payment groups.
|
|
169
|
+
// Omit this prop to use regional personalization. Keys are exact
|
|
170
|
+
// `payment_group` values — Apple Pay is `apple-pay`, not `applepay`.
|
|
171
|
+
// An empty or all-false object offers no fiat methods.
|
|
172
172
|
fiatMethods={{ creditcard: true, "apple-pay": true }}
|
|
173
173
|
// Hide the Transfer Crypto QR row if you only want fiat options:
|
|
174
174
|
// enableQrTransfer={false}
|
|
@@ -176,6 +176,17 @@ Pass `enableFiatOnramp` to expose Swapped's iframe as a funding option alongside
|
|
|
176
176
|
/>
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
+
When `fiatMethods` is omitted, the modal personalizes payment methods for the
|
|
180
|
+
user's region. One configured local favorite may appear first with a
|
|
181
|
+
**Popular** badge, followed by the supported subset of card, bank transfer, and
|
|
182
|
+
Apple Pay. Method names, icons, and EUR limits come from the regional response.
|
|
183
|
+
Personalization never blocks the flow: after 500 ms the default methods render,
|
|
184
|
+
and a later regional result only replaces an untouched picker.
|
|
185
|
+
|
|
186
|
+
Set `fiatMethods` to restrict Cash to the selected standard payment groups and
|
|
187
|
+
opt that modal instance out of regional personalization. An empty or all-false
|
|
188
|
+
object shows no Cash option.
|
|
189
|
+
|
|
179
190
|
The flow: user picks a fiat option → modal registers a Rhinestone smart account → backend mints a server-signed Swapped iframe URL → user completes purchase → Swapped sends crypto on-chain to the smart account → the existing on-chain detection fires `onLifecycle({ type: "complete" })`.
|
|
180
191
|
|
|
181
192
|
**Destination guarantees.** The user picks the fiat amount inside Swapped's widget, but the destination is fixed server-side: every order receives **USDC on Base** delivered to the **registered Rhinestone smart account**. The frontend cannot override these; the backend signs the Swapped URL with `currencyCode=USDC_BASE` and `walletAddress=<smartAccount>`.
|
|
@@ -196,7 +207,7 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
196
207
|
| -------------------- | ----------------------------- | ------- | ----------- |
|
|
197
208
|
| `enableFiatOnramp` | `boolean` | `false` | Show fiat on-ramp option(s). Requires backend Swapped keys. Needs no wallet. |
|
|
198
209
|
| `enableQrTransfer` | `boolean` | `true` | Show the Transfer Crypto / QR row. Set false for fiat-only. |
|
|
199
|
-
| `fiatMethods` | `FiatMethodsConfig` |
|
|
210
|
+
| `fiatMethods` | `FiatMethodsConfig` | regional | Optional exact subset of standard `payment_group`s. Providing it opts out of regional personalization; empty means none. |
|
|
200
211
|
|
|
201
212
|
## Fund from Exchange (Swapped Connect)
|
|
202
213
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunkM3HAQUVOcjs = require('./chunk-M3HAQUVO.cjs');
|
|
4
|
+
require('./chunk-HDZUPOUJ.cjs');
|
|
5
|
+
require('./chunk-D52L6CAO.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('./chunk-
|
|
9
|
+
var _chunkKWXEW5SVcjs = require('./chunk-KWXEW5SV.cjs');
|
|
10
|
+
require('./chunk-AA37G5O2.cjs');
|
|
11
11
|
require('./chunk-W3WWC4LD.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
@@ -88,14 +88,14 @@ function buildTransports(rpcUrls) {
|
|
|
88
88
|
const transports = {};
|
|
89
89
|
for (const network of EVM_NETWORKS) {
|
|
90
90
|
const id = Number(network.id);
|
|
91
|
-
transports[id] = _viem.http.call(void 0,
|
|
91
|
+
transports[id] = _viem.http.call(void 0, _chunkKWXEW5SVcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
92
92
|
}
|
|
93
93
|
return transports;
|
|
94
94
|
}
|
|
95
95
|
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
96
|
return EVM_NETWORKS.map((network) => {
|
|
97
97
|
const id = Number(network.id);
|
|
98
|
-
return `${id}=${_nullishCoalesce(
|
|
98
|
+
return `${id}=${_nullishCoalesce(_chunkKWXEW5SVcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
99
99
|
}).join("|");
|
|
100
100
|
}
|
|
101
101
|
var cachedAdapter = null;
|
|
@@ -189,7 +189,7 @@ function useReownWallet() {
|
|
|
189
189
|
await switchChainAsync({ chainId });
|
|
190
190
|
}
|
|
191
191
|
} catch (err) {
|
|
192
|
-
if (
|
|
192
|
+
if (_chunkKWXEW5SVcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
193
193
|
throw new Error(
|
|
194
194
|
`Switch to ${_chunkEGB3NWMLcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
|
|
195
195
|
);
|
|
@@ -223,7 +223,7 @@ function DepositModalWithReown(props) {
|
|
|
223
223
|
reown.disconnect();
|
|
224
224
|
}, [reown.disconnect]);
|
|
225
225
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
|
|
226
|
+
_chunkM3HAQUVOcjs.DepositModalInner,
|
|
227
227
|
{
|
|
228
228
|
...props,
|
|
229
229
|
reownWallet: reownWithSolana,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SLAJQ5BS.mjs";
|
|
4
|
+
import "./chunk-X73URRGG.mjs";
|
|
5
|
+
import "./chunk-2APKKVQK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isUnsupportedChainSwitchError,
|
|
8
8
|
rpcUrlFor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-CUSYITEG.mjs";
|
|
10
|
+
import "./chunk-IQ6P2TBV.mjs";
|
|
11
11
|
import "./chunk-YJP274QC.mjs";
|
|
12
12
|
import {
|
|
13
13
|
SUPPORTED_CHAINS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MODAL_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IQ6P2TBV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
HYPERCORE_CHAIN_ID,
|
|
6
6
|
HYPERCORE_MAINNET_CAIP2,
|
|
@@ -747,6 +747,110 @@ function normalizeEvmAddress(value) {
|
|
|
747
747
|
return value;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
+
function userPaidUsd(fees) {
|
|
751
|
+
let sum = 0;
|
|
752
|
+
for (const line of Object.values(fees.breakdown)) {
|
|
753
|
+
if (line.sponsored || line.internal) continue;
|
|
754
|
+
if (Number.isFinite(line.usd) && line.usd > 0) sum += line.usd;
|
|
755
|
+
}
|
|
756
|
+
return sum;
|
|
757
|
+
}
|
|
758
|
+
function quoteFeeGroups(breakdown) {
|
|
759
|
+
const groups = /* @__PURE__ */ new Map();
|
|
760
|
+
for (const [category, line] of Object.entries(breakdown)) {
|
|
761
|
+
if (line.internal || !Number.isFinite(line.usd) || line.usd < 0) continue;
|
|
762
|
+
const label = line.label?.trim() || titleCaseFeeCategory(category);
|
|
763
|
+
const group = groups.get(label) ?? {
|
|
764
|
+
label,
|
|
765
|
+
chargedUsd: 0,
|
|
766
|
+
sponsoredUsd: 0
|
|
767
|
+
};
|
|
768
|
+
if (line.sponsored) group.sponsoredUsd += line.usd;
|
|
769
|
+
else group.chargedUsd += line.usd;
|
|
770
|
+
groups.set(label, group);
|
|
771
|
+
}
|
|
772
|
+
return [...groups.values()];
|
|
773
|
+
}
|
|
774
|
+
function titleCaseFeeCategory(category) {
|
|
775
|
+
return category.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").split(" ").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
776
|
+
}
|
|
777
|
+
function parseQuotePreview(raw) {
|
|
778
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
779
|
+
const obj = raw;
|
|
780
|
+
if (typeof obj.settlementLayer !== "string") return null;
|
|
781
|
+
if (typeof obj.expiresAt !== "number" || !Number.isFinite(obj.expiresAt)) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
if (typeof obj.estimatedFillTimeSeconds !== "number" || !Number.isFinite(obj.estimatedFillTimeSeconds)) {
|
|
785
|
+
return null;
|
|
786
|
+
}
|
|
787
|
+
const output = parseQuoteOutput(obj.output);
|
|
788
|
+
if (!output) return null;
|
|
789
|
+
const fees = obj.fees;
|
|
790
|
+
if (typeof fees !== "object" || fees === null) return null;
|
|
791
|
+
const total = fees.total;
|
|
792
|
+
if (typeof total !== "object" || total === null) return null;
|
|
793
|
+
const totalUsd = total.usd;
|
|
794
|
+
if (typeof totalUsd !== "number" || !Number.isFinite(totalUsd) || totalUsd < 0) {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
const rawBreakdown = fees.breakdown;
|
|
798
|
+
if (typeof rawBreakdown !== "object" || rawBreakdown === null || Array.isArray(rawBreakdown)) {
|
|
799
|
+
return null;
|
|
800
|
+
}
|
|
801
|
+
const entries = Object.entries(rawBreakdown);
|
|
802
|
+
const parsedEntries = [];
|
|
803
|
+
for (const [key, value] of entries) {
|
|
804
|
+
const line = parseFeeLine(value);
|
|
805
|
+
if (!line) return null;
|
|
806
|
+
parsedEntries.push([key, line]);
|
|
807
|
+
}
|
|
808
|
+
const breakdownTotalUsd = parsedEntries.reduce(
|
|
809
|
+
(sum, [, line]) => sum + line.usd,
|
|
810
|
+
0
|
|
811
|
+
);
|
|
812
|
+
if (Math.abs(totalUsd - breakdownTotalUsd) > 1e-6) return null;
|
|
813
|
+
const breakdown = Object.fromEntries(parsedEntries);
|
|
814
|
+
return {
|
|
815
|
+
settlementLayer: obj.settlementLayer,
|
|
816
|
+
expiresAt: obj.expiresAt,
|
|
817
|
+
estimatedFillTimeSeconds: obj.estimatedFillTimeSeconds,
|
|
818
|
+
fees: { total: { usd: totalUsd }, breakdown },
|
|
819
|
+
output
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function parseQuoteOutput(raw) {
|
|
823
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
824
|
+
const o = raw;
|
|
825
|
+
if (typeof o.token !== "string") return null;
|
|
826
|
+
if (typeof o.amount !== "string") return null;
|
|
827
|
+
if (o.symbol !== null && typeof o.symbol !== "string") return null;
|
|
828
|
+
if (o.decimals !== null && typeof o.decimals !== "number") return null;
|
|
829
|
+
return {
|
|
830
|
+
token: o.token,
|
|
831
|
+
amount: o.amount,
|
|
832
|
+
symbol: o.symbol,
|
|
833
|
+
decimals: o.decimals
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function parseFeeLine(raw) {
|
|
837
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
|
|
838
|
+
const line = raw;
|
|
839
|
+
const usd = line.usd;
|
|
840
|
+
if (typeof usd !== "number" || !Number.isFinite(usd) || usd < 0) return null;
|
|
841
|
+
const sponsored = line.sponsored;
|
|
842
|
+
if (typeof sponsored !== "boolean") return null;
|
|
843
|
+
if (line.label !== void 0 && typeof line.label !== "string") return null;
|
|
844
|
+
if (line.internal !== void 0 && typeof line.internal !== "boolean") {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
usd,
|
|
849
|
+
sponsored,
|
|
850
|
+
...line.label !== void 0 && { label: line.label },
|
|
851
|
+
...line.internal !== void 0 && { internal: line.internal }
|
|
852
|
+
};
|
|
853
|
+
}
|
|
750
854
|
var SwappedConnectFeeChangedError = class extends Error {
|
|
751
855
|
constructor(exchangeFeeBps, message = "The Exchange Fee changed") {
|
|
752
856
|
super(message);
|
|
@@ -757,6 +861,11 @@ var SwappedConnectFeeChangedError = class extends Error {
|
|
|
757
861
|
function parseExchangeFeeBps(value) {
|
|
758
862
|
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
|
|
759
863
|
}
|
|
864
|
+
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
865
|
+
const override = appFees?.tokens?.[sourceChainCaip2]?.[sourceToken.toLowerCase()];
|
|
866
|
+
const bps = override ?? appFees?.feeBps ?? 0;
|
|
867
|
+
return bps > 0 ? bps : 0;
|
|
868
|
+
}
|
|
760
869
|
function createDepositService(baseUrl, options) {
|
|
761
870
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
762
871
|
const debug = options?.debug === true;
|
|
@@ -1182,10 +1291,17 @@ function createDepositService(baseUrl, options) {
|
|
|
1182
1291
|
});
|
|
1183
1292
|
return null;
|
|
1184
1293
|
}
|
|
1185
|
-
const quote = await response.json();
|
|
1294
|
+
const quote = parseQuotePreview(await response.json());
|
|
1295
|
+
if (!quote) {
|
|
1296
|
+
debugLog(debug, scope, "getQuotePreview:unavailable", {
|
|
1297
|
+
status: response.status,
|
|
1298
|
+
reason: "malformed"
|
|
1299
|
+
});
|
|
1300
|
+
return null;
|
|
1301
|
+
}
|
|
1186
1302
|
debugLog(debug, scope, "getQuotePreview:success", {
|
|
1187
1303
|
settlementLayer: quote.settlementLayer,
|
|
1188
|
-
totalUsd: quote.fees
|
|
1304
|
+
totalUsd: quote.fees.total.usd
|
|
1189
1305
|
});
|
|
1190
1306
|
return quote;
|
|
1191
1307
|
} catch (error) {
|
|
@@ -1252,7 +1368,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1252
1368
|
const url = apiUrl("/onramp/swapped/widget-url");
|
|
1253
1369
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1254
1370
|
smartAccount: shortRef(params.smartAccount),
|
|
1255
|
-
method: params.method
|
|
1371
|
+
method: params.method,
|
|
1372
|
+
methodSelectionSource: params.methodSelectionSource
|
|
1256
1373
|
});
|
|
1257
1374
|
const response = await fetch(url, {
|
|
1258
1375
|
method: "POST",
|
|
@@ -1367,6 +1484,78 @@ function createDepositService(baseUrl, options) {
|
|
|
1367
1484
|
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1368
1485
|
};
|
|
1369
1486
|
},
|
|
1487
|
+
async getSwappedPaymentMethods() {
|
|
1488
|
+
const empty = {
|
|
1489
|
+
country: null,
|
|
1490
|
+
methods: [],
|
|
1491
|
+
recommendedMethod: null
|
|
1492
|
+
};
|
|
1493
|
+
const url = apiUrl("/onramp/swapped/payment-methods");
|
|
1494
|
+
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1495
|
+
try {
|
|
1496
|
+
const response = await fetch(url, {
|
|
1497
|
+
method: "GET",
|
|
1498
|
+
headers: SERVICE_HEADERS,
|
|
1499
|
+
cache: "no-store"
|
|
1500
|
+
});
|
|
1501
|
+
if (!response.ok) {
|
|
1502
|
+
debugLog(debug, scope, "getSwappedPaymentMethods:unavailable", {
|
|
1503
|
+
status: response.status
|
|
1504
|
+
});
|
|
1505
|
+
return empty;
|
|
1506
|
+
}
|
|
1507
|
+
const body = await response.json();
|
|
1508
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
1509
|
+
return empty;
|
|
1510
|
+
}
|
|
1511
|
+
const rawBody = body;
|
|
1512
|
+
const rawCountry = rawBody.country;
|
|
1513
|
+
const country = typeof rawCountry === "string" ? rawCountry.trim().toUpperCase() : rawCountry === null ? null : void 0;
|
|
1514
|
+
if (country === void 0 || country !== null && !/^[A-Z]{2}$/.test(country)) {
|
|
1515
|
+
return empty;
|
|
1516
|
+
}
|
|
1517
|
+
const rawRecommendedMethod = rawBody.recommendedMethod;
|
|
1518
|
+
const recommendedMethod = typeof rawRecommendedMethod === "string" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(rawRecommendedMethod) ? rawRecommendedMethod : rawRecommendedMethod === null ? null : void 0;
|
|
1519
|
+
if (recommendedMethod === void 0 || !Array.isArray(rawBody.methods)) {
|
|
1520
|
+
return empty;
|
|
1521
|
+
}
|
|
1522
|
+
const methods = [];
|
|
1523
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1524
|
+
for (const raw of rawBody.methods) {
|
|
1525
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1526
|
+
return empty;
|
|
1527
|
+
}
|
|
1528
|
+
const m = raw;
|
|
1529
|
+
const method = typeof m.method === "string" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(m.method) ? m.method : null;
|
|
1530
|
+
const label = typeof m.label === "string" && m.label.trim().length > 0 ? m.label.trim() : null;
|
|
1531
|
+
const iconUrl = typeof m.iconUrl === "string" ? m.iconUrl : m.iconUrl === null ? null : void 0;
|
|
1532
|
+
const iconUrlLight = typeof m.iconUrlLight === "string" ? m.iconUrlLight : m.iconUrlLight === null ? null : void 0;
|
|
1533
|
+
const minAmount = typeof m.minAmount === "number" && Number.isFinite(m.minAmount) && m.minAmount >= 0 ? m.minAmount : m.minAmount === null ? null : void 0;
|
|
1534
|
+
const maxAmount = typeof m.maxAmount === "number" && Number.isFinite(m.maxAmount) && m.maxAmount >= 0 ? m.maxAmount : m.maxAmount === null ? null : void 0;
|
|
1535
|
+
const badge = m.badge === "Popular" ? "Popular" : m.badge === null ? null : void 0;
|
|
1536
|
+
if (!method || !label || iconUrl === void 0 || iconUrlLight === void 0 || minAmount === void 0 || maxAmount === void 0 || badge === void 0 || seen.has(method)) {
|
|
1537
|
+
return empty;
|
|
1538
|
+
}
|
|
1539
|
+
seen.add(method);
|
|
1540
|
+
methods.push({
|
|
1541
|
+
method,
|
|
1542
|
+
label,
|
|
1543
|
+
iconUrl,
|
|
1544
|
+
iconUrlLight,
|
|
1545
|
+
minAmount,
|
|
1546
|
+
maxAmount,
|
|
1547
|
+
badge
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
if (country === null && (methods.length > 0 || recommendedMethod !== null) || recommendedMethod !== null && !seen.has(recommendedMethod)) {
|
|
1551
|
+
return empty;
|
|
1552
|
+
}
|
|
1553
|
+
return { country, methods, recommendedMethod };
|
|
1554
|
+
} catch (error) {
|
|
1555
|
+
debugError(debug, scope, "getSwappedPaymentMethods:error", error);
|
|
1556
|
+
return empty;
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1370
1559
|
getTopTokens() {
|
|
1371
1560
|
if (!topTokensPromise) {
|
|
1372
1561
|
topTokensPromise = (async () => {
|
|
@@ -2008,7 +2197,10 @@ export {
|
|
|
2008
2197
|
chainIdsByValue,
|
|
2009
2198
|
portfolioToAssets,
|
|
2010
2199
|
isNativeAsset,
|
|
2200
|
+
userPaidUsd,
|
|
2201
|
+
quoteFeeGroups,
|
|
2011
2202
|
SwappedConnectFeeChangedError,
|
|
2203
|
+
resolveAppFeeBps,
|
|
2012
2204
|
createDepositService,
|
|
2013
2205
|
currencyFormatter,
|
|
2014
2206
|
tokenFormatter,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkKWXEW5SVcjs = require('./chunk-KWXEW5SV.cjs');
|
|
5
5
|
|
|
6
6
|
// src/components/ui/ListRow.tsx
|
|
7
7
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -19,7 +19,7 @@ function ListRow({
|
|
|
19
19
|
...props
|
|
20
20
|
}) {
|
|
21
21
|
const inner = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
22
|
-
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
22
|
+
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKWXEW5SVcjs.CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
23
23
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-body", children: [
|
|
24
24
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-text", children: [
|
|
25
25
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-title", children: title }),
|
|
@@ -39,7 +39,7 @@ function ListRow({
|
|
|
39
39
|
}
|
|
40
40
|
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
41
41
|
] }),
|
|
42
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
42
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKWXEW5SVcjs.ChevronRightIcon, {}))) })
|
|
43
43
|
] });
|
|
44
44
|
if (action) {
|
|
45
45
|
const handleKey = (e) => {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getPublicClient,
|
|
5
5
|
useTokenPrices,
|
|
6
6
|
warnRemovedProps
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X73URRGG.mjs";
|
|
8
8
|
import {
|
|
9
9
|
BodyHeader,
|
|
10
10
|
Button,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
useLatestRef,
|
|
34
34
|
useRpcUrls,
|
|
35
35
|
useStableRpcUrls
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-CUSYITEG.mjs";
|
|
37
37
|
import {
|
|
38
38
|
DEFAULT_BACKEND_URL,
|
|
39
39
|
NATIVE_TOKEN_ADDRESS,
|