@rhinestone/deposit-modal 0.0.0-dev-20260728154835 → 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-YI7DF7QJ.cjs → DepositModalReown-7IKZUY34.cjs} +9 -9
- package/dist/{DepositModalReown-RSIMZS46.mjs → DepositModalReown-RLSGDANC.mjs} +5 -5
- package/dist/{chunk-SJQ2FBFQ.mjs → chunk-2APKKVQK.mjs} +1 -1
- package/dist/{chunk-SCKWQJA2.cjs → chunk-AA37G5O2.cjs} +1 -1
- package/dist/{chunk-TJQHU34K.mjs → chunk-CUSYITEG.mjs} +75 -2
- package/dist/{chunk-2WK442YB.cjs → chunk-D52L6CAO.cjs} +3 -3
- package/dist/{chunk-OCXY3HWX.mjs → chunk-FBMNVFEH.mjs} +2 -2
- package/dist/{chunk-3YZIW6YE.cjs → chunk-HDZUPOUJ.cjs} +62 -62
- package/dist/{chunk-7O3RASQV.mjs → chunk-IQ6P2TBV.mjs} +1 -1
- package/dist/{chunk-J32NCUX6.mjs → chunk-JT2VAH2D.mjs} +2 -2
- package/dist/{chunk-CAMKSHDZ.cjs → chunk-KWXEW5SV.cjs} +76 -3
- package/dist/{chunk-YPCIRIE4.cjs → chunk-M3HAQUVO.cjs} +664 -366
- package/dist/{chunk-O3DACFVJ.cjs → chunk-R62N7VSH.cjs} +49 -49
- package/dist/{chunk-P2STW62C.mjs → chunk-SLAJQ5BS.mjs} +374 -76
- package/dist/{chunk-B3BPI2DL.cjs → chunk-X4ZOJMRY.cjs} +56 -56
- package/dist/{chunk-LDCOMIW2.mjs → chunk-X73URRGG.mjs} +1 -1
- 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,
|
|
@@ -1368,7 +1368,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1368
1368
|
const url = apiUrl("/onramp/swapped/widget-url");
|
|
1369
1369
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1370
1370
|
smartAccount: shortRef(params.smartAccount),
|
|
1371
|
-
method: params.method
|
|
1371
|
+
method: params.method,
|
|
1372
|
+
methodSelectionSource: params.methodSelectionSource
|
|
1372
1373
|
});
|
|
1373
1374
|
const response = await fetch(url, {
|
|
1374
1375
|
method: "POST",
|
|
@@ -1483,6 +1484,78 @@ function createDepositService(baseUrl, options) {
|
|
|
1483
1484
|
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1484
1485
|
};
|
|
1485
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
|
+
},
|
|
1486
1559
|
getTopTokens() {
|
|
1487
1560
|
if (!topTokensPromise) {
|
|
1488
1561
|
topTokensPromise = (async () => {
|
|
@@ -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,
|