@blindpay/node 1.0.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/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/api-client-Cw2mNJeR.d.mts +349 -0
- package/dist/api-client-Cw2mNJeR.d.ts +349 -0
- package/dist/chunk-2DAKB5XK.mjs +212 -0
- package/dist/chunk-3CZJEDS5.mjs +41 -0
- package/dist/chunk-CNNEROQ7.mjs +46 -0
- package/dist/chunk-ES7RXEM7.mjs +245 -0
- package/dist/chunk-GCCHFONX.mjs +17893 -0
- package/dist/chunk-GEDDLCJY.mjs +77 -0
- package/dist/chunk-GNDAATIJ.mjs +35 -0
- package/dist/chunk-HKFAJXJG.mjs +65 -0
- package/dist/chunk-LK3JPQ6I.mjs +49 -0
- package/dist/chunk-LLWEHHKB.mjs +47 -0
- package/dist/chunk-LUDGZPXY.mjs +51 -0
- package/dist/chunk-M6IYYMRW.mjs +35 -0
- package/dist/chunk-OBKEW4AQ.mjs +91 -0
- package/dist/chunk-QHMIK7U3.mjs +24 -0
- package/dist/chunk-QVOSGLUO.mjs +36 -0
- package/dist/chunk-UCAW3RTZ.mjs +47 -0
- package/dist/chunk-VKN2AMCW.mjs +57 -0
- package/dist/index.d.mts +81 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +895 -0
- package/dist/index.mjs +95 -0
- package/dist/magic-string.es-6D2DRE4K.mjs +1325 -0
- package/dist/resources/api-keys/api-keys.test.d.mts +2 -0
- package/dist/resources/api-keys/api-keys.test.d.ts +2 -0
- package/dist/resources/api-keys/api-keys.test.js +19881 -0
- package/dist/resources/api-keys/api-keys.test.mjs +130 -0
- package/dist/resources/api-keys/index.d.mts +45 -0
- package/dist/resources/api-keys/index.d.ts +45 -0
- package/dist/resources/api-keys/index.js +64 -0
- package/dist/resources/api-keys/index.mjs +9 -0
- package/dist/resources/available/available.test.d.mts +2 -0
- package/dist/resources/available/available.test.d.ts +2 -0
- package/dist/resources/available/available.test.js +19877 -0
- package/dist/resources/available/available.test.mjs +122 -0
- package/dist/resources/available/index.d.mts +25 -0
- package/dist/resources/available/index.d.ts +25 -0
- package/dist/resources/available/index.js +39 -0
- package/dist/resources/available/index.mjs +9 -0
- package/dist/resources/bank-accounts/bank-accounts.test.d.mts +2 -0
- package/dist/resources/bank-accounts/bank-accounts.test.d.ts +2 -0
- package/dist/resources/bank-accounts/bank-accounts.test.js +20173 -0
- package/dist/resources/bank-accounts/bank-accounts.test.mjs +418 -0
- package/dist/resources/bank-accounts/index.d.mts +414 -0
- package/dist/resources/bank-accounts/index.d.ts +414 -0
- package/dist/resources/bank-accounts/index.js +227 -0
- package/dist/resources/bank-accounts/index.mjs +9 -0
- package/dist/resources/instances/index.d.mts +42 -0
- package/dist/resources/instances/index.d.ts +42 -0
- package/dist/resources/instances/index.js +75 -0
- package/dist/resources/instances/index.mjs +9 -0
- package/dist/resources/instances/instances.test.d.mts +2 -0
- package/dist/resources/instances/instances.test.d.ts +2 -0
- package/dist/resources/instances/instances.test.js +19873 -0
- package/dist/resources/instances/instances.test.mjs +118 -0
- package/dist/resources/partner-fees/index.d.mts +65 -0
- package/dist/resources/partner-fees/index.d.ts +65 -0
- package/dist/resources/partner-fees/index.js +69 -0
- package/dist/resources/partner-fees/index.mjs +9 -0
- package/dist/resources/partner-fees/partner-fees.test.d.mts +2 -0
- package/dist/resources/partner-fees/partner-fees.test.d.ts +2 -0
- package/dist/resources/partner-fees/partner-fees.test.js +19889 -0
- package/dist/resources/partner-fees/partner-fees.test.mjs +134 -0
- package/dist/resources/payins/index.d.mts +200 -0
- package/dist/resources/payins/index.d.ts +200 -0
- package/dist/resources/payins/index.js +75 -0
- package/dist/resources/payins/index.mjs +9 -0
- package/dist/resources/payins/payins-quotes.test.d.mts +2 -0
- package/dist/resources/payins/payins-quotes.test.d.ts +2 -0
- package/dist/resources/payins/payins-quotes.test.js +19852 -0
- package/dist/resources/payins/payins-quotes.test.mjs +97 -0
- package/dist/resources/payins/payins.test.d.mts +2 -0
- package/dist/resources/payins/payins.test.d.ts +2 -0
- package/dist/resources/payins/payins.test.js +20268 -0
- package/dist/resources/payins/payins.test.mjs +513 -0
- package/dist/resources/payins/quotes.d.mts +45 -0
- package/dist/resources/payins/quotes.d.ts +45 -0
- package/dist/resources/payins/quotes.js +63 -0
- package/dist/resources/payins/quotes.mjs +9 -0
- package/dist/resources/payouts/index.d.mts +155 -0
- package/dist/resources/payouts/index.d.ts +155 -0
- package/dist/resources/payouts/index.js +93 -0
- package/dist/resources/payouts/index.mjs +9 -0
- package/dist/resources/payouts/payouts.test.d.mts +2 -0
- package/dist/resources/payouts/payouts.test.d.ts +2 -0
- package/dist/resources/payouts/payouts.test.js +20346 -0
- package/dist/resources/payouts/payouts.test.mjs +591 -0
- package/dist/resources/quotes/index.d.mts +59 -0
- package/dist/resources/quotes/index.d.ts +59 -0
- package/dist/resources/quotes/index.js +63 -0
- package/dist/resources/quotes/index.mjs +9 -0
- package/dist/resources/quotes/quotes.test.d.mts +2 -0
- package/dist/resources/quotes/quotes.test.d.ts +2 -0
- package/dist/resources/quotes/quotes.test.js +19866 -0
- package/dist/resources/quotes/quotes.test.mjs +111 -0
- package/dist/resources/receivers/index.d.mts +205 -0
- package/dist/resources/receivers/index.d.ts +205 -0
- package/dist/resources/receivers/index.js +85 -0
- package/dist/resources/receivers/index.mjs +9 -0
- package/dist/resources/receivers/receivers.test.d.mts +2 -0
- package/dist/resources/receivers/receivers.test.d.ts +2 -0
- package/dist/resources/receivers/receivers.test.js +20145 -0
- package/dist/resources/receivers/receivers.test.mjs +390 -0
- package/dist/resources/virtual-accounts/index.d.mts +58 -0
- package/dist/resources/virtual-accounts/index.d.ts +58 -0
- package/dist/resources/virtual-accounts/index.js +79 -0
- package/dist/resources/virtual-accounts/index.mjs +9 -0
- package/dist/resources/virtual-accounts/virtual-accounts.test.d.mts +2 -0
- package/dist/resources/virtual-accounts/virtual-accounts.test.d.ts +2 -0
- package/dist/resources/virtual-accounts/virtual-accounts.test.js +19902 -0
- package/dist/resources/virtual-accounts/virtual-accounts.test.mjs +147 -0
- package/dist/resources/wallets/blockchain.d.mts +83 -0
- package/dist/resources/wallets/blockchain.d.ts +83 -0
- package/dist/resources/wallets/blockchain.js +105 -0
- package/dist/resources/wallets/blockchain.mjs +9 -0
- package/dist/resources/wallets/blockchain.test.d.mts +2 -0
- package/dist/resources/wallets/blockchain.test.d.ts +2 -0
- package/dist/resources/wallets/blockchain.test.js +19897 -0
- package/dist/resources/wallets/blockchain.test.mjs +142 -0
- package/dist/resources/wallets/offramp.d.mts +46 -0
- package/dist/resources/wallets/offramp.d.ts +46 -0
- package/dist/resources/wallets/offramp.js +77 -0
- package/dist/resources/wallets/offramp.mjs +9 -0
- package/dist/resources/wallets/offramp.test.d.mts +2 -0
- package/dist/resources/wallets/offramp.test.d.ts +2 -0
- package/dist/resources/wallets/offramp.test.js +19872 -0
- package/dist/resources/wallets/offramp.test.mjs +117 -0
- package/dist/resources/webhooks/index.d.mts +49 -0
- package/dist/resources/webhooks/index.d.ts +49 -0
- package/dist/resources/webhooks/index.js +74 -0
- package/dist/resources/webhooks/index.mjs +9 -0
- package/dist/resources/webhooks/webhooks.test.d.mts +2 -0
- package/dist/resources/webhooks/webhooks.test.d.ts +2 -0
- package/dist/resources/webhooks/webhooks.test.js +19878 -0
- package/dist/resources/webhooks/webhooks.test.mjs +123 -0
- package/package.json +65 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBlockchainWalletsResource,
|
|
3
|
+
init_blockchain
|
|
4
|
+
} from "./chunk-GEDDLCJY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
createOfframpWalletsResource,
|
|
7
|
+
init_offramp
|
|
8
|
+
} from "./chunk-LK3JPQ6I.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createWebhookEndpointsResource,
|
|
11
|
+
init_webhooks
|
|
12
|
+
} from "./chunk-CNNEROQ7.mjs";
|
|
13
|
+
import {
|
|
14
|
+
createQuotesResource,
|
|
15
|
+
init_quotes as init_quotes2
|
|
16
|
+
} from "./chunk-GNDAATIJ.mjs";
|
|
17
|
+
import {
|
|
18
|
+
createReceiversResource,
|
|
19
|
+
init_receivers
|
|
20
|
+
} from "./chunk-VKN2AMCW.mjs";
|
|
21
|
+
import {
|
|
22
|
+
createVirtualAccountsResource,
|
|
23
|
+
init_virtual_accounts
|
|
24
|
+
} from "./chunk-LUDGZPXY.mjs";
|
|
25
|
+
import {
|
|
26
|
+
createPartnerFeesResource,
|
|
27
|
+
init_partner_fees
|
|
28
|
+
} from "./chunk-3CZJEDS5.mjs";
|
|
29
|
+
import {
|
|
30
|
+
createPayinsResource,
|
|
31
|
+
init_payins
|
|
32
|
+
} from "./chunk-UCAW3RTZ.mjs";
|
|
33
|
+
import {
|
|
34
|
+
createPayinQuotesResource,
|
|
35
|
+
init_quotes
|
|
36
|
+
} from "./chunk-M6IYYMRW.mjs";
|
|
37
|
+
import {
|
|
38
|
+
createPayoutsResource,
|
|
39
|
+
init_payouts
|
|
40
|
+
} from "./chunk-HKFAJXJG.mjs";
|
|
41
|
+
import {
|
|
42
|
+
createApiKeysResource,
|
|
43
|
+
init_api_keys
|
|
44
|
+
} from "./chunk-QVOSGLUO.mjs";
|
|
45
|
+
import {
|
|
46
|
+
createBankAccountsResource,
|
|
47
|
+
init_bank_accounts
|
|
48
|
+
} from "./chunk-2DAKB5XK.mjs";
|
|
49
|
+
import {
|
|
50
|
+
createAvailableResource,
|
|
51
|
+
init_available
|
|
52
|
+
} from "./chunk-QHMIK7U3.mjs";
|
|
53
|
+
import {
|
|
54
|
+
createInstancesResource,
|
|
55
|
+
init_instances
|
|
56
|
+
} from "./chunk-LLWEHHKB.mjs";
|
|
57
|
+
import {
|
|
58
|
+
__async,
|
|
59
|
+
__esm,
|
|
60
|
+
__spreadProps,
|
|
61
|
+
__spreadValues
|
|
62
|
+
} from "./chunk-OBKEW4AQ.mjs";
|
|
63
|
+
|
|
64
|
+
// package.json
|
|
65
|
+
var version;
|
|
66
|
+
var init_package = __esm({
|
|
67
|
+
"package.json"() {
|
|
68
|
+
version = "1.0.0";
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// src/internal/blindpay-error.ts
|
|
73
|
+
var BlindpayError;
|
|
74
|
+
var init_blindpay_error = __esm({
|
|
75
|
+
"src/internal/blindpay-error.ts"() {
|
|
76
|
+
"use strict";
|
|
77
|
+
BlindpayError = class extends Error {
|
|
78
|
+
constructor(message) {
|
|
79
|
+
super(message);
|
|
80
|
+
this.name = "BlindpayError";
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// src/client.ts
|
|
87
|
+
import { createHmac, timingSafeEqual } from "crypto";
|
|
88
|
+
var Blindpay;
|
|
89
|
+
var init_client = __esm({
|
|
90
|
+
"src/client.ts"() {
|
|
91
|
+
"use strict";
|
|
92
|
+
init_package();
|
|
93
|
+
init_blindpay_error();
|
|
94
|
+
init_api_keys();
|
|
95
|
+
init_available();
|
|
96
|
+
init_bank_accounts();
|
|
97
|
+
init_instances();
|
|
98
|
+
init_partner_fees();
|
|
99
|
+
init_payins();
|
|
100
|
+
init_quotes();
|
|
101
|
+
init_payouts();
|
|
102
|
+
init_quotes2();
|
|
103
|
+
init_receivers();
|
|
104
|
+
init_virtual_accounts();
|
|
105
|
+
init_blockchain();
|
|
106
|
+
init_offramp();
|
|
107
|
+
init_webhooks();
|
|
108
|
+
Blindpay = class {
|
|
109
|
+
constructor(apiKey) {
|
|
110
|
+
// Options
|
|
111
|
+
this.baseUrl = "https://api.blindpay.com/v1";
|
|
112
|
+
if (!apiKey) {
|
|
113
|
+
throw new BlindpayError("Api key not provided, get your api key on blindpay dashboard");
|
|
114
|
+
}
|
|
115
|
+
this.apiKey = apiKey;
|
|
116
|
+
this.headers = {
|
|
117
|
+
"Content-Type": "application/json",
|
|
118
|
+
Accept: "application/json",
|
|
119
|
+
"User-Agent": `blindpay-node/${version}`,
|
|
120
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
121
|
+
};
|
|
122
|
+
this.api = {
|
|
123
|
+
get: this.get.bind(this),
|
|
124
|
+
post: this.post.bind(this),
|
|
125
|
+
put: this.put.bind(this),
|
|
126
|
+
patch: this.patch.bind(this),
|
|
127
|
+
delete: this.delete.bind(this)
|
|
128
|
+
};
|
|
129
|
+
this.available = createAvailableResource(this.api);
|
|
130
|
+
this.instances = __spreadProps(__spreadValues({}, createInstancesResource(this.api)), {
|
|
131
|
+
apiKeys: createApiKeysResource(this.api),
|
|
132
|
+
webhookEndpoints: createWebhookEndpointsResource(this.api)
|
|
133
|
+
});
|
|
134
|
+
this.partnerFees = createPartnerFeesResource(this.api);
|
|
135
|
+
this.payins = __spreadProps(__spreadValues({}, createPayinsResource(this.api)), {
|
|
136
|
+
quotes: createPayinQuotesResource(this.api)
|
|
137
|
+
});
|
|
138
|
+
this.quotes = createQuotesResource(this.api);
|
|
139
|
+
this.payouts = createPayoutsResource(this.api);
|
|
140
|
+
this.receivers = __spreadProps(__spreadValues({}, createReceiversResource(this.api)), {
|
|
141
|
+
bankAccounts: createBankAccountsResource(this.api)
|
|
142
|
+
});
|
|
143
|
+
this.virtualAccounts = createVirtualAccountsResource(this.api);
|
|
144
|
+
this.wallets = {
|
|
145
|
+
blockchain: createBlockchainWalletsResource(this.api),
|
|
146
|
+
offramp: createOfframpWalletsResource(this.api)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
request(method, path, body) {
|
|
150
|
+
return __async(this, null, function* () {
|
|
151
|
+
var _a;
|
|
152
|
+
try {
|
|
153
|
+
const response = yield fetch(`${this.baseUrl}${path}`, {
|
|
154
|
+
method,
|
|
155
|
+
headers: this.headers,
|
|
156
|
+
body: body ? JSON.stringify(body) : void 0
|
|
157
|
+
});
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
const error = yield response.json();
|
|
160
|
+
return {
|
|
161
|
+
data: null,
|
|
162
|
+
error: {
|
|
163
|
+
message: (_a = error == null ? void 0 : error.message) != null ? _a : "Unknown error"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const data = yield response.json();
|
|
168
|
+
return {
|
|
169
|
+
data,
|
|
170
|
+
error: null
|
|
171
|
+
};
|
|
172
|
+
} catch (error) {
|
|
173
|
+
if (error instanceof Error) {
|
|
174
|
+
return {
|
|
175
|
+
data: null,
|
|
176
|
+
error: {
|
|
177
|
+
message: error.message
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const errorMessage = error && typeof error === "object" && "message" in error && typeof error.message === "string" ? error.message : "Unknown error";
|
|
182
|
+
return {
|
|
183
|
+
data: null,
|
|
184
|
+
error: {
|
|
185
|
+
message: errorMessage
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
get(path) {
|
|
192
|
+
return __async(this, null, function* () {
|
|
193
|
+
return this.request("GET", path);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
post(path, body) {
|
|
197
|
+
return __async(this, null, function* () {
|
|
198
|
+
return this.request("POST", path, body);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
put(path, body) {
|
|
202
|
+
return __async(this, null, function* () {
|
|
203
|
+
return this.request("PUT", path, body);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
patch(path, body) {
|
|
207
|
+
return __async(this, null, function* () {
|
|
208
|
+
return this.request("PATCH", path, body);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
delete(path, body) {
|
|
212
|
+
return __async(this, null, function* () {
|
|
213
|
+
return this.request("DELETE", path, body);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Verifies the BlindPay webhook signature
|
|
218
|
+
*
|
|
219
|
+
* @param params.secret The webhook secret from BlindPay dashboard
|
|
220
|
+
* @param params.id The value of the `svix-id` header
|
|
221
|
+
* @param params.timestamp The value of the `svix-timestamp` header
|
|
222
|
+
* @param params.payload The raw request body
|
|
223
|
+
* @param params.svixSignature The value of the `svix-signature` header
|
|
224
|
+
* @returns {boolean} True if the signature is valid, false otherwise
|
|
225
|
+
*/
|
|
226
|
+
verifyWebhookSignature({
|
|
227
|
+
secret,
|
|
228
|
+
id,
|
|
229
|
+
timestamp,
|
|
230
|
+
payload,
|
|
231
|
+
svixSignature
|
|
232
|
+
}) {
|
|
233
|
+
const signedContent = `${id}.${timestamp}.${payload}`;
|
|
234
|
+
const secretBytes = Buffer.from(secret.split("_")[1], "base64");
|
|
235
|
+
const expectedSignature = createHmac("sha256", secretBytes).update(signedContent).digest("base64");
|
|
236
|
+
return svixSignature.length === expectedSignature.length && timingSafeEqual(Buffer.from(svixSignature), Buffer.from(expectedSignature));
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export {
|
|
243
|
+
Blindpay,
|
|
244
|
+
init_client
|
|
245
|
+
};
|