@rhinestone/deposit-modal 0.18.0 → 0.20.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 +179 -48
- package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
- package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
- package/dist/{DepositModalReown-VCY65DJX.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
- package/dist/{DepositModalReown-TVO3ZQQK.cjs → DepositModalReown-ALVWADG7.cjs} +21 -20
- package/dist/WithdrawModal-5YWFJSYY.cjs +12 -0
- package/dist/WithdrawModal-LL4Z5WZP.mjs +12 -0
- package/dist/{bearer-transport-CVHNBgoV.d.cts → bearer-transport-DZyeDG64.d.cts} +5 -1
- package/dist/{bearer-transport-CVHNBgoV.d.ts → bearer-transport-DZyeDG64.d.ts} +5 -1
- package/dist/{caip-BMi-9t09.d.cts → caip-nwFFL46o.d.cts} +2 -2
- package/dist/{caip-BMi-9t09.d.ts → caip-nwFFL46o.d.ts} +2 -2
- package/dist/{chunk-EKC2IRQG.mjs → chunk-247GJH57.mjs} +687 -299
- package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-AIZKGFVA.mjs → chunk-32ERBFMO.mjs} +1499 -978
- package/dist/chunk-5QUWEFD4.mjs +19 -0
- package/dist/chunk-6CTJFR3T.mjs +113 -0
- package/dist/{chunk-3TEVMP76.mjs → chunk-B2LZQIGB.mjs} +1 -1
- package/dist/{chunk-34JVJZEZ.cjs → chunk-BTEG2VNZ.cjs} +171 -130
- package/dist/{chunk-N3AAT6BS.cjs → chunk-CXRH5MKO.cjs} +1556 -1035
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/{chunk-N6JJG57R.cjs → chunk-EKFXUF5A.cjs} +1 -1
- package/dist/chunk-FKJ6EJHH.cjs +346 -0
- package/dist/chunk-FMUSY563.cjs +19 -0
- package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
- package/dist/chunk-G264OM23.cjs +224 -0
- package/dist/{chunk-R2B6VD4E.mjs → chunk-HP7S7AD6.mjs} +73 -32
- package/dist/{chunk-O4JZKKCZ.cjs → chunk-OPT5EW6L.cjs} +10 -5
- package/dist/chunk-PYRXOP2Y.cjs +113 -0
- package/dist/{chunk-X4EUXBHJ.mjs → chunk-XBJCZYBX.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-JV5OGG53.cjs → chunk-Z4RBTNKX.cjs} +1202 -814
- package/dist/compliance.cjs +4 -7
- package/dist/compliance.d.cts +26 -3
- package/dist/compliance.d.ts +26 -3
- package/dist/compliance.mjs +6 -9
- package/dist/constants-BQDxVNgr.d.cts +29 -0
- package/dist/constants-DjGQW5N5.d.ts +29 -0
- package/dist/constants.cjs +3 -37
- package/dist/constants.d.cts +4 -20
- package/dist/constants.d.ts +4 -20
- package/dist/constants.mjs +4 -38
- package/dist/deposit.cjs +7 -6
- package/dist/deposit.d.cts +5 -3
- package/dist/deposit.d.ts +5 -3
- package/dist/deposit.mjs +6 -5
- package/dist/embed.cjs +21 -20
- package/dist/embed.d.cts +3 -2
- package/dist/embed.d.ts +3 -2
- package/dist/embed.mjs +7 -6
- package/dist/index.cjs +8 -35
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +9 -36
- package/dist/onramp.cjs +4 -20
- package/dist/onramp.d.cts +59 -23
- package/dist/onramp.d.ts +59 -23
- package/dist/onramp.mjs +5 -21
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/ramp-types-HYWd7CW0.d.cts +108 -0
- package/dist/ramp-types-HYWd7CW0.d.ts +108 -0
- package/dist/styles.css +280 -0
- package/dist/{types-CbUs4boj.d.cts → types-BxSrazbq.d.ts} +56 -3
- package/dist/{types-CZYypODQ.d.ts → types-CixUBhrM.d.cts} +56 -3
- package/dist/withdraw.cjs +6 -5
- package/dist/withdraw.d.cts +4 -3
- package/dist/withdraw.d.ts +4 -3
- package/dist/withdraw.mjs +5 -4
- package/package.json +9 -17
- package/dist/WithdrawModal-GR3HLYXU.cjs +0 -11
- package/dist/WithdrawModal-RMCYJJ4S.mjs +0 -11
- package/dist/chunk-ADEWTBSN.cjs +0 -19
- package/dist/chunk-EAGMY3QE.mjs +0 -962
- package/dist/chunk-OY5N3E6L.cjs +0 -962
- package/dist/chunk-PP4QE32S.mjs +0 -19
- package/dist/constants-BT4ctuHo.d.cts +0 -64
- package/dist/constants-D21ZdNOP.d.ts +0 -64
- package/dist/offramp.cjs +0 -25
- package/dist/offramp.d.cts +0 -28
- package/dist/offramp.d.ts +0 -28
- package/dist/offramp.mjs +0 -25
- package/dist/ramp-types-C6aUz4SZ.d.cts +0 -43
- package/dist/ramp-types-C6aUz4SZ.d.ts +0 -43
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBearerTransport
|
|
3
|
+
} from "./chunk-XBJCZYBX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/core/compliance-service.ts
|
|
6
|
+
function getComplianceStatus(options) {
|
|
7
|
+
return createBearerTransport(options)("/compliance/status");
|
|
8
|
+
}
|
|
9
|
+
function startComplianceVerification(options) {
|
|
10
|
+
return createBearerTransport(options)(
|
|
11
|
+
"/compliance/verification",
|
|
12
|
+
{}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
getComplianceStatus,
|
|
18
|
+
startComplianceVerification
|
|
19
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBearerTransport
|
|
3
|
+
} from "./chunk-XBJCZYBX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/core/ramp-utils.ts
|
|
6
|
+
function rampQuery(value) {
|
|
7
|
+
return new URLSearchParams(
|
|
8
|
+
Object.entries(value).filter(([, value2]) => value2 !== void 0).map(([key, value2]) => [key, String(value2)])
|
|
9
|
+
).toString();
|
|
10
|
+
}
|
|
11
|
+
function rampResourceId(value) {
|
|
12
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
|
|
13
|
+
value
|
|
14
|
+
)) {
|
|
15
|
+
throw new Error("Invalid ramp resource ID");
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/core/onramp-service.ts
|
|
21
|
+
var RAIL_TYPES = ["BankAch", "BankFedwire", "BankSwift", "BankSepa"];
|
|
22
|
+
var text = (value) => typeof value === "string" && value.length > 0;
|
|
23
|
+
var decimal = (value) => text(value) && /^\+?(?:\d+(?:\.\d*)?|\.\d+)$/.test(value);
|
|
24
|
+
var optionalText = (value) => value === void 0 ? void 0 : text(value) ? value : false;
|
|
25
|
+
function projectBankDetails(input) {
|
|
26
|
+
if (typeof input !== "object" || input === null) return null;
|
|
27
|
+
const d = input;
|
|
28
|
+
if (d.schemaVersion !== 1 || !text(d.capturedAt) || !Number.isFinite(Date.parse(d.capturedAt))) return null;
|
|
29
|
+
if (d.currency !== "USD" && d.currency !== "EUR") return null;
|
|
30
|
+
if (!text(d.accountHolderName)) return null;
|
|
31
|
+
const bankName = optionalText(d.bankName);
|
|
32
|
+
const reference = optionalText(d.reference);
|
|
33
|
+
if (bankName === false || reference === false) return null;
|
|
34
|
+
let bankAddress;
|
|
35
|
+
if (d.bankAddress !== void 0) {
|
|
36
|
+
if (typeof d.bankAddress !== "object" || d.bankAddress === null) return null;
|
|
37
|
+
const a = d.bankAddress;
|
|
38
|
+
const street2 = optionalText(a.street2);
|
|
39
|
+
if (![a.street, a.city, a.postCode, a.state, a.country].every(text) || street2 === false) return null;
|
|
40
|
+
bankAddress = {
|
|
41
|
+
street: a.street,
|
|
42
|
+
city: a.city,
|
|
43
|
+
postCode: a.postCode,
|
|
44
|
+
state: a.state,
|
|
45
|
+
country: a.country,
|
|
46
|
+
...street2 !== void 0 ? { street2 } : {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (!Array.isArray(d.rails) || d.rails.length === 0) return null;
|
|
50
|
+
const rails = [];
|
|
51
|
+
for (const r of d.rails) {
|
|
52
|
+
if (typeof r !== "object" || r === null) return null;
|
|
53
|
+
const type = RAIL_TYPES.find((t) => t === r.type);
|
|
54
|
+
if (!type || !text(r.accountNumber) || !text(r.bankCode)) return null;
|
|
55
|
+
if (typeof r.fee !== "object" || r.fee === null) return null;
|
|
56
|
+
const f = r.fee;
|
|
57
|
+
if (f.currency !== d.currency || !decimal(f.base) || !decimal(f.percent) || !decimal(f.minimum)) return null;
|
|
58
|
+
if (Number(f.percent) > 100) return null;
|
|
59
|
+
rails.push({
|
|
60
|
+
type,
|
|
61
|
+
accountNumber: r.accountNumber,
|
|
62
|
+
bankCode: r.bankCode,
|
|
63
|
+
fee: { currency: d.currency, base: f.base, percent: f.percent, minimum: f.minimum }
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (new Set(rails.map((rail) => rail.type)).size !== rails.length) return null;
|
|
67
|
+
return {
|
|
68
|
+
schemaVersion: 1,
|
|
69
|
+
capturedAt: d.capturedAt,
|
|
70
|
+
currency: d.currency,
|
|
71
|
+
accountHolderName: d.accountHolderName,
|
|
72
|
+
...bankName !== void 0 ? { bankName } : {},
|
|
73
|
+
...bankAddress ? { bankAddress } : {},
|
|
74
|
+
...reference !== void 0 ? { reference } : {},
|
|
75
|
+
rails
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function createOnrampService(options) {
|
|
79
|
+
const request = createBearerTransport(options);
|
|
80
|
+
return {
|
|
81
|
+
// Named fields only, never a spread: this client is Noah's, whatever a
|
|
82
|
+
// caller passes.
|
|
83
|
+
getOptions: ({ currency } = {}) => request(
|
|
84
|
+
`/onramp/options?${rampQuery({ provider: "noah", currency })}`
|
|
85
|
+
),
|
|
86
|
+
createAccount: ({ currency, optionId }) => request("/onramp/accounts", {
|
|
87
|
+
provider: "noah",
|
|
88
|
+
currency,
|
|
89
|
+
optionId
|
|
90
|
+
}),
|
|
91
|
+
listAccounts: (page = {}) => request(`/onramp/accounts?${rampQuery(page)}`),
|
|
92
|
+
getAccount: (id) => request(`/onramp/accounts/${rampResourceId(id)}`),
|
|
93
|
+
getAccountDetails: async (id) => {
|
|
94
|
+
const result = await request(
|
|
95
|
+
`/onramp/accounts/${rampResourceId(id)}/details`
|
|
96
|
+
);
|
|
97
|
+
const bankDetails = result ? projectBankDetails(result.bankDetails) : null;
|
|
98
|
+
if (!bankDetails) throw new Error("Invalid bank details response");
|
|
99
|
+
return { bankDetails };
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* The customer's Noah orders, newest first. Filtered on the server, before
|
|
103
|
+
* `limit`, so another provider's orders can never crowd one out of a page.
|
|
104
|
+
*/
|
|
105
|
+
listOrders: ({ cursor, limit } = {}) => request(
|
|
106
|
+
`/onramp/orders?${rampQuery({ provider: "noah", cursor, limit })}`
|
|
107
|
+
)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
createOnrampService
|
|
113
|
+
};
|