@rhinestone/deposit-modal 0.20.0 → 0.20.1
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 +3 -0
- package/dist/{BankOnrampStep-NPGXAA7U.cjs → BankOnrampStep-3SNUX6V2.cjs} +11 -11
- package/dist/{BankOnrampStep-JG32OCM2.mjs → BankOnrampStep-4D24HVHV.mjs} +4 -4
- package/dist/{DepositModalReown-ALVWADG7.cjs → DepositModalReown-7EHOJTFW.cjs} +16 -16
- package/dist/{DepositModalReown-3FGTPER6.mjs → DepositModalReown-SYQ2SCHC.mjs} +3 -3
- package/dist/WithdrawModal-LLJLEYXZ.cjs +12 -0
- package/dist/{WithdrawModal-LL4Z5WZP.mjs → WithdrawModal-LXDIT4UV.mjs} +3 -3
- package/dist/{chunk-BTEG2VNZ.cjs → chunk-CIVFT5KR.cjs} +58 -58
- package/dist/{chunk-EKFXUF5A.cjs → chunk-D3R3O4CY.cjs} +1 -1
- package/dist/{chunk-6CTJFR3T.mjs → chunk-EJDBIWNH.mjs} +1 -1
- package/dist/{chunk-247GJH57.mjs → chunk-FW7ZMXQS.mjs} +444 -477
- package/dist/{chunk-PYRXOP2Y.cjs → chunk-IPHKBBUV.cjs} +2 -2
- package/dist/{chunk-HP7S7AD6.mjs → chunk-IPKT3FU6.mjs} +1 -1
- package/dist/{chunk-5QUWEFD4.mjs → chunk-JPX4MEHV.mjs} +1 -1
- package/dist/{chunk-CXRH5MKO.cjs → chunk-KXSU24RU.cjs} +354 -275
- package/dist/{chunk-OPT5EW6L.cjs → chunk-LVMNNMOZ.cjs} +2 -2
- package/dist/{chunk-FMUSY563.cjs → chunk-O5OW4S7L.cjs} +3 -3
- package/dist/{chunk-32ERBFMO.mjs → chunk-OZPMRTW3.mjs} +93 -14
- package/dist/{chunk-Z4RBTNKX.cjs → chunk-PVFEZ3UG.cjs} +596 -629
- package/dist/{chunk-XBJCZYBX.mjs → chunk-YQCRXJIL.mjs} +1 -1
- package/dist/{chunk-B2LZQIGB.mjs → chunk-ZOJMB5TZ.mjs} +1 -1
- package/dist/compliance.cjs +4 -4
- package/dist/compliance.mjs +3 -3
- 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 +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 +14 -14
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +4 -4
- 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/onramp.cjs +4 -4
- package/dist/onramp.mjs +3 -3
- package/dist/{types-CixUBhrM.d.cts → types-BEEMfNi2.d.cts} +4 -2
- package/dist/{types-BxSrazbq.d.ts → types-DQDUqzsZ.d.ts} +4 -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 +5 -5
- package/dist/WithdrawModal-5YWFJSYY.cjs +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
|
3
|
+
var _chunkD3R3O4CYcjs = require('./chunk-D3R3O4CY.cjs');
|
|
4
4
|
|
|
5
5
|
// src/core/bearer-transport.ts
|
|
6
6
|
var ScopedRequestError = class extends Error {
|
|
@@ -23,7 +23,7 @@ function createBearerTransport(options) {
|
|
|
23
23
|
const response = await fetch(`${base}${path}`, {
|
|
24
24
|
method: body === void 0 ? "GET" : "POST",
|
|
25
25
|
headers: {
|
|
26
|
-
...
|
|
26
|
+
..._chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
27
27
|
Authorization: `Bearer ${session.token}`
|
|
28
28
|
},
|
|
29
29
|
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLVMNNMOZcjs = require('./chunk-LVMNNMOZ.cjs');
|
|
4
4
|
|
|
5
5
|
// src/core/compliance-service.ts
|
|
6
6
|
function getComplianceStatus(options) {
|
|
7
|
-
return
|
|
7
|
+
return _chunkLVMNNMOZcjs.createBearerTransport.call(void 0, options)("/compliance/status");
|
|
8
8
|
}
|
|
9
9
|
function startComplianceVerification(options) {
|
|
10
|
-
return
|
|
10
|
+
return _chunkLVMNNMOZcjs.createBearerTransport.call(void 0, options)(
|
|
11
11
|
"/compliance/verification",
|
|
12
12
|
{}
|
|
13
13
|
);
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
import {
|
|
46
46
|
MODAL_VERSION,
|
|
47
47
|
serviceHeaders
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-ZOJMB5TZ.mjs";
|
|
49
49
|
|
|
50
50
|
// src/components/ui/Modal.tsx
|
|
51
51
|
import {
|
|
@@ -423,6 +423,54 @@ function catalogExplorerTxUrl(chain, txHash) {
|
|
|
423
423
|
return `${chain.explorer.url}${chain.explorer.txPath}${txHash}`;
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
// src/core/hosted-order.ts
|
|
427
|
+
var RANK = {
|
|
428
|
+
awaiting_payment: 0,
|
|
429
|
+
paying: 1,
|
|
430
|
+
paid: 2,
|
|
431
|
+
sent: 3
|
|
432
|
+
};
|
|
433
|
+
function hostedOrderState(order) {
|
|
434
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
435
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : null;
|
|
436
|
+
const outcome = order.status === "refunded" ? "refunded" : order.status === "failed" && !deliveryTxHash ? receipt.status === "failed" && receipt.reason === "cancelled" ? "cancelled" : "failed" : null;
|
|
437
|
+
const progress = deliveryTxHash ? "sent" : receipt.status === "completed" || conversion.status !== "not_started" ? "paid" : receipt.status === "processing" || receipt.status === "on_hold" ? "paying" : "awaiting_payment";
|
|
438
|
+
return { progress, outcome, deliveryTxHash };
|
|
439
|
+
}
|
|
440
|
+
function hostedOrderStateFromSwapped(status, txHash) {
|
|
441
|
+
const deliveryTxHash = txHash ?? null;
|
|
442
|
+
switch (status) {
|
|
443
|
+
case "payment_pending":
|
|
444
|
+
return { progress: "awaiting_payment", outcome: null, deliveryTxHash };
|
|
445
|
+
case "wallet_order_registered":
|
|
446
|
+
case "wallet_order_confirmed":
|
|
447
|
+
return { progress: "paying", outcome: null, deliveryTxHash };
|
|
448
|
+
case "order_completed":
|
|
449
|
+
return {
|
|
450
|
+
progress: deliveryTxHash ? "sent" : "paid",
|
|
451
|
+
outcome: null,
|
|
452
|
+
deliveryTxHash
|
|
453
|
+
};
|
|
454
|
+
case "order_broadcasted":
|
|
455
|
+
return { progress: "sent", outcome: null, deliveryTxHash };
|
|
456
|
+
case "order_cancelled":
|
|
457
|
+
return { progress: "awaiting_payment", outcome: "cancelled", deliveryTxHash };
|
|
458
|
+
default:
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function mergeHostedOrderState(previous, next) {
|
|
463
|
+
if (!previous) return next;
|
|
464
|
+
return {
|
|
465
|
+
progress: RANK[next.progress] >= RANK[previous.progress] ? next.progress : previous.progress,
|
|
466
|
+
outcome: next.outcome ?? previous.outcome,
|
|
467
|
+
deliveryTxHash: next.deliveryTxHash ?? previous.deliveryTxHash
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function hasReached(state, progress) {
|
|
471
|
+
return state ? RANK[state.progress] >= RANK[progress] : false;
|
|
472
|
+
}
|
|
473
|
+
|
|
426
474
|
// src/core/deposit-asset-helpers.ts
|
|
427
475
|
function getAssetId(asset) {
|
|
428
476
|
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
@@ -1717,6 +1765,32 @@ function createDepositService(baseUrl, options) {
|
|
|
1717
1765
|
}
|
|
1718
1766
|
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1719
1767
|
},
|
|
1768
|
+
async getOnrampProviders() {
|
|
1769
|
+
try {
|
|
1770
|
+
const response = await fetch(apiUrl("/onramp/providers"), {
|
|
1771
|
+
method: "GET",
|
|
1772
|
+
headers: serviceHeaders(),
|
|
1773
|
+
cache: "no-store"
|
|
1774
|
+
});
|
|
1775
|
+
if (!response.ok) return null;
|
|
1776
|
+
const body = await response.json();
|
|
1777
|
+
if (!Array.isArray(body.providers)) return null;
|
|
1778
|
+
return body.providers.flatMap((raw) => {
|
|
1779
|
+
const p = raw;
|
|
1780
|
+
return (p.provider === "swapped" || p.provider === "noah") && (p.flow === "hosted" || p.flow === "funding_account") && Array.isArray(p.kinds) ? [
|
|
1781
|
+
{
|
|
1782
|
+
provider: p.provider,
|
|
1783
|
+
flow: p.flow,
|
|
1784
|
+
kinds: p.kinds.filter(
|
|
1785
|
+
(k) => k === "fiat" || k === "exchange"
|
|
1786
|
+
)
|
|
1787
|
+
}
|
|
1788
|
+
] : [];
|
|
1789
|
+
});
|
|
1790
|
+
} catch {
|
|
1791
|
+
return null;
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1720
1794
|
async getSwappedPaymentMethods() {
|
|
1721
1795
|
const empty = {
|
|
1722
1796
|
country: null,
|
|
@@ -1855,20 +1929,10 @@ function createDepositService(baseUrl, options) {
|
|
|
1855
1929
|
}
|
|
1856
1930
|
};
|
|
1857
1931
|
}
|
|
1858
|
-
var SWAPPED_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1859
|
-
"payment_pending",
|
|
1860
|
-
"order_completed",
|
|
1861
|
-
"order_broadcasted",
|
|
1862
|
-
"order_cancelled"
|
|
1863
|
-
]);
|
|
1864
1932
|
function swappedOrderFromView(orderId, raw) {
|
|
1865
1933
|
if (!raw || typeof raw !== "object") return null;
|
|
1866
1934
|
const view = raw;
|
|
1867
|
-
if (view.provider !== "swapped") return null;
|
|
1868
|
-
const status = view.providerStatus;
|
|
1869
|
-
if (typeof status !== "string" || !SWAPPED_ORDER_STATUSES.has(status)) {
|
|
1870
|
-
return null;
|
|
1871
|
-
}
|
|
1935
|
+
if (view.provider !== "swapped" || !isOrderShape(view)) return null;
|
|
1872
1936
|
const number = (v) => {
|
|
1873
1937
|
const n = typeof v === "string" && v.trim() ? Number(v) : v;
|
|
1874
1938
|
return typeof n === "number" && Number.isFinite(n) ? n : null;
|
|
@@ -1882,10 +1946,9 @@ function swappedOrderFromView(orderId, raw) {
|
|
|
1882
1946
|
const usdNet = number(view.fiat?.usd?.net);
|
|
1883
1947
|
return {
|
|
1884
1948
|
orderId,
|
|
1885
|
-
|
|
1949
|
+
...hostedOrderState(view),
|
|
1886
1950
|
orderCrypto: text(view.crypto?.asset),
|
|
1887
1951
|
orderCryptoAmount: text(view.crypto?.amount),
|
|
1888
|
-
transactionId: text(view.stages?.delivery?.txHash),
|
|
1889
1952
|
receivedAt: text(view.updatedAt),
|
|
1890
1953
|
paidAmountUsd: usdTotal ?? usdNet,
|
|
1891
1954
|
paidAmountEur: number(view.fiat?.eur?.total) ?? number(view.fiat?.eur?.net),
|
|
@@ -1893,6 +1956,19 @@ function swappedOrderFromView(orderId, raw) {
|
|
|
1893
1956
|
paymentMethod: railName(view.rail?.method ?? view.rail?.connection)
|
|
1894
1957
|
};
|
|
1895
1958
|
}
|
|
1959
|
+
var ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1960
|
+
"pending",
|
|
1961
|
+
"processing",
|
|
1962
|
+
"completed",
|
|
1963
|
+
"failed",
|
|
1964
|
+
"refunded"
|
|
1965
|
+
]);
|
|
1966
|
+
function isOrderShape(view) {
|
|
1967
|
+
const stages = view.stages;
|
|
1968
|
+
return ORDER_STATUSES.has(view.status) && ["receipt", "conversion", "delivery"].every(
|
|
1969
|
+
(name) => typeof stages?.[name]?.status === "string"
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1896
1972
|
function parseAssetItem(raw, fields) {
|
|
1897
1973
|
if (!raw || typeof raw !== "object") return void 0;
|
|
1898
1974
|
const record = raw;
|
|
@@ -8475,6 +8551,9 @@ export {
|
|
|
8475
8551
|
SOLANA_TOKENS,
|
|
8476
8552
|
resolveSolanaToken,
|
|
8477
8553
|
isNativeSol,
|
|
8554
|
+
hostedOrderStateFromSwapped,
|
|
8555
|
+
mergeHostedOrderState,
|
|
8556
|
+
hasReached,
|
|
8478
8557
|
getAssetId,
|
|
8479
8558
|
chainIdsByValue,
|
|
8480
8559
|
portfolioToAssets,
|