@blindpay/node 3.2.0 → 3.3.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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/api-client-Cu0yYexQ.d.ts +16 -0
  3. package/dist/api-client-DV5jG52T.d.mts +16 -0
  4. package/dist/chunk-ALHMJWQN.mjs +21 -0
  5. package/dist/{chunk-VOB7TMKL.mjs → chunk-F5Z45GCA.mjs} +8 -0
  6. package/dist/chunk-ISHZTBAN.mjs +39 -0
  7. package/dist/{chunk-AFXWEXL6.mjs → chunk-JOHWDSDM.mjs} +44 -20
  8. package/dist/chunk-KMU6V4LW.mjs +50 -0
  9. package/dist/chunk-UDRMLZWT.mjs +53 -0
  10. package/dist/{chunk-CPOSU35L.mjs → chunk-UOAM7SX3.mjs} +43 -25
  11. package/dist/{chunk-U7CKUUO7.mjs → chunk-WE73MTQL.mjs} +3 -0
  12. package/dist/{chunk-67XECGMJ.mjs → chunk-YIZJM2GU.mjs} +4 -3
  13. package/dist/{api-client-CIPV5zmo.d.mts → index.d-yOiKSwHO.d.mts} +6 -19
  14. package/dist/{api-client-CIPV5zmo.d.ts → index.d-yOiKSwHO.d.ts} +6 -19
  15. package/dist/index.d.mts +19 -6
  16. package/dist/index.d.ts +19 -6
  17. package/dist/index.js +183 -30
  18. package/dist/index.mjs +43 -19
  19. package/dist/resources/api-keys/api-keys.test.js +175 -30
  20. package/dist/resources/api-keys/api-keys.test.mjs +12 -8
  21. package/dist/resources/api-keys/index.d.mts +2 -1
  22. package/dist/resources/api-keys/index.d.ts +2 -1
  23. package/dist/resources/available/available.test.js +199 -30
  24. package/dist/resources/available/available.test.mjs +36 -8
  25. package/dist/resources/available/index.d.mts +8 -2
  26. package/dist/resources/available/index.d.ts +8 -2
  27. package/dist/resources/available/index.js +3 -0
  28. package/dist/resources/available/index.mjs +1 -1
  29. package/dist/resources/bank-accounts/bank-accounts.test.js +230 -32
  30. package/dist/resources/bank-accounts/bank-accounts.test.mjs +67 -10
  31. package/dist/resources/bank-accounts/index.d.mts +83 -9
  32. package/dist/resources/bank-accounts/index.d.ts +83 -9
  33. package/dist/resources/bank-accounts/index.js +43 -25
  34. package/dist/resources/bank-accounts/index.mjs +1 -1
  35. package/dist/resources/fees/fees.test.d.mts +2 -0
  36. package/dist/resources/fees/fees.test.d.ts +2 -0
  37. package/dist/resources/fees/fees.test.js +19845 -0
  38. package/dist/resources/fees/fees.test.mjs +85 -0
  39. package/dist/resources/fees/index.d.mts +36 -0
  40. package/dist/resources/fees/index.d.ts +36 -0
  41. package/dist/resources/fees/index.js +36 -0
  42. package/dist/resources/fees/index.mjs +9 -0
  43. package/dist/resources/instances/index.d.mts +2 -1
  44. package/dist/resources/instances/index.d.ts +2 -1
  45. package/dist/resources/instances/instances.test.js +175 -30
  46. package/dist/resources/instances/instances.test.mjs +12 -8
  47. package/dist/resources/partner-fees/index.d.mts +2 -1
  48. package/dist/resources/partner-fees/index.d.ts +2 -1
  49. package/dist/resources/partner-fees/partner-fees.test.js +175 -30
  50. package/dist/resources/partner-fees/partner-fees.test.mjs +12 -8
  51. package/dist/resources/payins/index.d.mts +2 -1
  52. package/dist/resources/payins/index.d.ts +2 -1
  53. package/dist/resources/payins/payins-quotes.test.js +175 -30
  54. package/dist/resources/payins/payins-quotes.test.mjs +12 -8
  55. package/dist/resources/payins/payins.test.js +175 -30
  56. package/dist/resources/payins/payins.test.mjs +12 -8
  57. package/dist/resources/payins/quotes.d.mts +2 -1
  58. package/dist/resources/payins/quotes.d.ts +2 -1
  59. package/dist/resources/payouts/index.d.mts +15 -3
  60. package/dist/resources/payouts/index.d.ts +15 -3
  61. package/dist/resources/payouts/index.js +8 -0
  62. package/dist/resources/payouts/index.mjs +1 -1
  63. package/dist/resources/payouts/payouts.test.js +194 -30
  64. package/dist/resources/payouts/payouts.test.mjs +31 -8
  65. package/dist/resources/quotes/index.d.mts +2 -1
  66. package/dist/resources/quotes/index.d.ts +2 -1
  67. package/dist/resources/quotes/quotes.test.js +175 -30
  68. package/dist/resources/quotes/quotes.test.mjs +12 -8
  69. package/dist/resources/receivers/index.d.mts +16 -4
  70. package/dist/resources/receivers/index.d.ts +16 -4
  71. package/dist/resources/receivers/index.js +4 -3
  72. package/dist/resources/receivers/index.mjs +1 -1
  73. package/dist/resources/receivers/receivers.test.js +331 -179
  74. package/dist/resources/receivers/receivers.test.mjs +168 -157
  75. package/dist/resources/terms-of-service/index.d.mts +2 -1
  76. package/dist/resources/terms-of-service/index.d.ts +2 -1
  77. package/dist/resources/terms-of-service/terms-of-service.test.js +175 -30
  78. package/dist/resources/terms-of-service/terms-of-service.test.mjs +12 -8
  79. package/dist/resources/transfers/index.d.mts +94 -0
  80. package/dist/resources/transfers/index.d.ts +94 -0
  81. package/dist/resources/transfers/index.js +67 -0
  82. package/dist/resources/transfers/index.mjs +9 -0
  83. package/dist/resources/transfers/transfers.test.d.mts +2 -0
  84. package/dist/resources/transfers/transfers.test.d.ts +2 -0
  85. package/dist/resources/transfers/transfers.test.js +19931 -0
  86. package/dist/resources/transfers/transfers.test.mjs +171 -0
  87. package/dist/resources/upload/index.d.mts +16 -0
  88. package/dist/resources/upload/index.d.ts +16 -0
  89. package/dist/resources/upload/index.js +100 -0
  90. package/dist/resources/upload/index.mjs +9 -0
  91. package/dist/resources/upload/upload.test.d.mts +2 -0
  92. package/dist/resources/upload/upload.test.d.ts +2 -0
  93. package/dist/resources/upload/upload.test.js +19840 -0
  94. package/dist/resources/upload/upload.test.mjs +80 -0
  95. package/dist/resources/virtual-accounts/index.d.mts +2 -1
  96. package/dist/resources/virtual-accounts/index.d.ts +2 -1
  97. package/dist/resources/virtual-accounts/virtual-accounts.test.js +175 -30
  98. package/dist/resources/virtual-accounts/virtual-accounts.test.mjs +12 -8
  99. package/dist/resources/wallets/blockchain.d.mts +2 -1
  100. package/dist/resources/wallets/blockchain.d.ts +2 -1
  101. package/dist/resources/wallets/blockchain.test.js +175 -30
  102. package/dist/resources/wallets/blockchain.test.mjs +12 -8
  103. package/dist/resources/wallets/custodial.d.mts +55 -0
  104. package/dist/resources/wallets/custodial.d.ts +55 -0
  105. package/dist/resources/wallets/custodial.js +78 -0
  106. package/dist/resources/wallets/custodial.mjs +9 -0
  107. package/dist/resources/wallets/custodial.test.d.mts +2 -0
  108. package/dist/resources/wallets/custodial.test.d.ts +2 -0
  109. package/dist/resources/wallets/custodial.test.js +19901 -0
  110. package/dist/resources/wallets/custodial.test.mjs +141 -0
  111. package/dist/resources/wallets/offramp.d.mts +2 -1
  112. package/dist/resources/wallets/offramp.d.ts +2 -1
  113. package/dist/resources/wallets/offramp.test.js +175 -30
  114. package/dist/resources/wallets/offramp.test.mjs +12 -8
  115. package/dist/resources/webhooks/index.d.mts +3 -2
  116. package/dist/resources/webhooks/index.d.ts +3 -2
  117. package/dist/resources/webhooks/webhooks.test.js +175 -30
  118. package/dist/resources/webhooks/webhooks.test.mjs +12 -8
  119. package/package.json +2 -2
@@ -0,0 +1,171 @@
1
+ import {
2
+ afterEach,
3
+ describe,
4
+ globalExpect,
5
+ init_dist,
6
+ it
7
+ } from "../../chunk-D6N3USMR.mjs";
8
+ import {
9
+ BlindPay,
10
+ init_client
11
+ } from "../../chunk-JOHWDSDM.mjs";
12
+ import "../../chunk-FG25JHDX.mjs";
13
+ import "../../chunk-KMU6V4LW.mjs";
14
+ import "../../chunk-QGNLMN6Z.mjs";
15
+ import "../../chunk-UC57SCKQ.mjs";
16
+ import "../../chunk-ISHZTBAN.mjs";
17
+ import "../../chunk-UDRMLZWT.mjs";
18
+ import "../../chunk-LEPGLH7Q.mjs";
19
+ import "../../chunk-E7M4CJKR.mjs";
20
+ import "../../chunk-F5Z45GCA.mjs";
21
+ import "../../chunk-TBTA7A2P.mjs";
22
+ import "../../chunk-YIZJM2GU.mjs";
23
+ import "../../chunk-Z6EYX4D3.mjs";
24
+ import "../../chunk-ALHMJWQN.mjs";
25
+ import "../../chunk-B5T7AQLH.mjs";
26
+ import "../../chunk-RC5NN5UF.mjs";
27
+ import "../../chunk-VGU72ZNI.mjs";
28
+ import "../../chunk-LRHWT4JU.mjs";
29
+ import "../../chunk-WE73MTQL.mjs";
30
+ import "../../chunk-UOAM7SX3.mjs";
31
+ import {
32
+ __async,
33
+ __commonJS
34
+ } from "../../chunk-OBKEW4AQ.mjs";
35
+
36
+ // src/resources/transfers/transfers.test.ts
37
+ var require_transfers_test = __commonJS({
38
+ "src/resources/transfers/transfers.test.ts"(exports) {
39
+ init_dist();
40
+ init_client();
41
+ var mockTrackingStep = {
42
+ step: "processing",
43
+ transaction_hash: null,
44
+ gas_fee: null,
45
+ completed_at: null,
46
+ error_message: null
47
+ };
48
+ var mockTrackingMonitoring = {
49
+ step: "processing",
50
+ blockchain_screening: null,
51
+ risk_score: null,
52
+ completed_at: null
53
+ };
54
+ var mockTransfer = {
55
+ id: "tr_000000000000",
56
+ status: "processing",
57
+ transfer_quote_id: "tq_000000000000",
58
+ instance_id: "in_000000000000",
59
+ tracking_transaction_monitoring: mockTrackingMonitoring,
60
+ tracking_paymaster: mockTrackingStep,
61
+ tracking_bridge_swap: mockTrackingStep,
62
+ tracking_complete: mockTrackingStep,
63
+ tracking_partner_fee: mockTrackingStep,
64
+ created_at: "2025-01-01T00:00:00Z",
65
+ updated_at: "2025-01-01T00:00:00Z",
66
+ wallet_id: "wa_000000000000",
67
+ sender_token: "USDC",
68
+ sender_amount: 1e4,
69
+ receiver_amount: 9950,
70
+ receiver_network: "polygon",
71
+ receiver_token: "USDC",
72
+ receiver_wallet_address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
73
+ partner_fee_amount: null
74
+ };
75
+ describe("Transfers", () => {
76
+ afterEach(() => fetchMock.resetMocks());
77
+ const blindpay = new BlindPay({ apiKey: "test-key", instanceId: "in_000000000000" });
78
+ describe("Create transfer quote", () => {
79
+ it("should create a transfer quote", () => __async(null, null, function* () {
80
+ const mockedQuote = {
81
+ id: "tq_000000000000",
82
+ expires_at: 17e8,
83
+ commercial_quotation: 100,
84
+ blindpay_quotation: 100,
85
+ receiver_amount: 9950,
86
+ sender_amount: 1e4,
87
+ partner_fee_amount: null,
88
+ flat_fee: 50
89
+ };
90
+ fetchMock.mockResponseOnce(JSON.stringify(mockedQuote), {
91
+ headers: { "Content-Type": "application/json" }
92
+ });
93
+ const { data, error } = yield blindpay.transfers.quotes.create({
94
+ wallet_id: "wa_000000000000",
95
+ sender_token: "USDC",
96
+ receiver_wallet_address: "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C",
97
+ receiver_token: "USDC",
98
+ receiver_network: "polygon",
99
+ request_amount: 1e4,
100
+ cover_fees: true,
101
+ amount_reference: "sender"
102
+ });
103
+ globalExpect(error).toBeNull();
104
+ globalExpect(data).toEqual(mockedQuote);
105
+ }));
106
+ });
107
+ describe("Create transfer", () => {
108
+ it("should create a transfer", () => __async(null, null, function* () {
109
+ const mockedTransfer = {
110
+ id: "tr_000000000000",
111
+ status: "processing",
112
+ tracking_bridge_swap: mockTrackingStep,
113
+ tracking_complete: mockTrackingStep,
114
+ tracking_paymaster: mockTrackingStep,
115
+ tracking_transaction_monitoring: mockTrackingMonitoring,
116
+ tracking_partner_fee: mockTrackingStep
117
+ };
118
+ fetchMock.mockResponseOnce(JSON.stringify(mockedTransfer), {
119
+ headers: { "Content-Type": "application/json" }
120
+ });
121
+ const { data, error } = yield blindpay.transfers.create({
122
+ transfer_quote_id: "tq_000000000000"
123
+ });
124
+ globalExpect(error).toBeNull();
125
+ globalExpect(data).toEqual(mockedTransfer);
126
+ }));
127
+ });
128
+ describe("List transfers", () => {
129
+ it("should list transfers", () => __async(null, null, function* () {
130
+ const mockedTransfers = {
131
+ data: [mockTransfer],
132
+ pagination: {
133
+ has_more: false,
134
+ next_page: "",
135
+ prev_page: ""
136
+ }
137
+ };
138
+ fetchMock.mockResponseOnce(JSON.stringify(mockedTransfers), {
139
+ headers: { "Content-Type": "application/json" }
140
+ });
141
+ const { data, error } = yield blindpay.transfers.list();
142
+ globalExpect(error).toBeNull();
143
+ globalExpect(data).toEqual(mockedTransfers);
144
+ }));
145
+ });
146
+ describe("Get transfer", () => {
147
+ it("should get a transfer", () => __async(null, null, function* () {
148
+ const mockedTransfer = mockTransfer;
149
+ fetchMock.mockResponseOnce(JSON.stringify(mockedTransfer), {
150
+ headers: { "Content-Type": "application/json" }
151
+ });
152
+ const { data, error } = yield blindpay.transfers.get("tr_000000000000");
153
+ globalExpect(error).toBeNull();
154
+ globalExpect(data).toEqual(mockedTransfer);
155
+ }));
156
+ });
157
+ describe("Get transfer track", () => {
158
+ it("should get transfer tracking information", () => __async(null, null, function* () {
159
+ const mockedTrack = mockTransfer;
160
+ fetchMock.mockResponseOnce(JSON.stringify(mockedTrack), {
161
+ headers: { "Content-Type": "application/json" }
162
+ });
163
+ const { data, error } = yield blindpay.transfers.getTrack("tr_000000000000");
164
+ globalExpect(error).toBeNull();
165
+ globalExpect(data).toEqual(mockedTrack);
166
+ }));
167
+ });
168
+ });
169
+ }
170
+ });
171
+ export default require_transfers_test();
@@ -0,0 +1,16 @@
1
+ import { B as BlindpayApiResponse } from '../../index.d-yOiKSwHO.mjs';
2
+
3
+ type UploadBucket = "avatar" | "onboarding" | "limit_increase";
4
+ type UploadInput = {
5
+ file: File | Blob;
6
+ bucket: UploadBucket;
7
+ instance_id?: string;
8
+ };
9
+ type UploadResponse = {
10
+ file_url: string;
11
+ };
12
+ declare function createUploadResource(baseUrl: string, headers: Record<string, string>): {
13
+ upload({ file, bucket, instance_id, }: UploadInput): Promise<BlindpayApiResponse<UploadResponse>>;
14
+ };
15
+
16
+ export { type UploadBucket, type UploadInput, type UploadResponse, createUploadResource };
@@ -0,0 +1,16 @@
1
+ import { B as BlindpayApiResponse } from '../../index.d-yOiKSwHO.js';
2
+
3
+ type UploadBucket = "avatar" | "onboarding" | "limit_increase";
4
+ type UploadInput = {
5
+ file: File | Blob;
6
+ bucket: UploadBucket;
7
+ instance_id?: string;
8
+ };
9
+ type UploadResponse = {
10
+ file_url: string;
11
+ };
12
+ declare function createUploadResource(baseUrl: string, headers: Record<string, string>): {
13
+ upload({ file, bucket, instance_id, }: UploadInput): Promise<BlindpayApiResponse<UploadResponse>>;
14
+ };
15
+
16
+ export { type UploadBucket, type UploadInput, type UploadResponse, createUploadResource };
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __objRest = (source, exclude) => {
9
+ var target = {};
10
+ for (var prop in source)
11
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
12
+ target[prop] = source[prop];
13
+ if (source != null && __getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(source)) {
15
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
16
+ target[prop] = source[prop];
17
+ }
18
+ return target;
19
+ };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, { get: all[name], enumerable: true });
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
+ }
30
+ return to;
31
+ };
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
53
+
54
+ // src/resources/upload/index.ts
55
+ var upload_exports = {};
56
+ __export(upload_exports, {
57
+ createUploadResource: () => createUploadResource
58
+ });
59
+ module.exports = __toCommonJS(upload_exports);
60
+ function createUploadResource(baseUrl, headers) {
61
+ return {
62
+ upload(_0) {
63
+ return __async(this, arguments, function* ({
64
+ file,
65
+ bucket,
66
+ instance_id
67
+ }) {
68
+ var _b;
69
+ const formData = new FormData();
70
+ formData.append("file", file);
71
+ formData.append("bucket", bucket);
72
+ const queryParams = instance_id ? `?instance_id=${instance_id}` : "";
73
+ const _a2 = headers, { "Content-Type": _ } = _a2, headersWithoutContentType = __objRest(_a2, ["Content-Type"]);
74
+ const response = yield fetch(`${baseUrl}/upload${queryParams}`, {
75
+ method: "POST",
76
+ headers: headersWithoutContentType,
77
+ body: formData
78
+ });
79
+ if (!response.ok) {
80
+ const error = yield response.json();
81
+ return {
82
+ data: null,
83
+ error: {
84
+ message: (_b = error == null ? void 0 : error.message) != null ? _b : "Unknown error"
85
+ }
86
+ };
87
+ }
88
+ const data = yield response.json();
89
+ return {
90
+ data,
91
+ error: null
92
+ };
93
+ });
94
+ }
95
+ };
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ createUploadResource
100
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ createUploadResource,
3
+ init_upload
4
+ } from "../../chunk-UDRMLZWT.mjs";
5
+ import "../../chunk-OBKEW4AQ.mjs";
6
+ init_upload();
7
+ export {
8
+ createUploadResource
9
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }