@cowriepay/sdk 0.1.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 +99 -0
- package/dist/index.cjs +475 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2934 -0
- package/dist/index.d.ts +2934 -0
- package/dist/index.js +424 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2934 @@
|
|
|
1
|
+
interface CowriePayConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Public API key id: `cpk_live_...` (Live / mainnet) or `cpk_test_...` (Sandbox / testnet). The key
|
|
4
|
+
* selects the network on the server; there is a single base URL for both, you never switch hosts to
|
|
5
|
+
* test. Swap the prefix to go from Sandbox to Live.
|
|
6
|
+
*/
|
|
7
|
+
apiKey: string;
|
|
8
|
+
/** The API key secret. Never logged. */
|
|
9
|
+
apiSecret: string;
|
|
10
|
+
/**
|
|
11
|
+
* Base URL override (e.g. a dev host `https://api-dev.cowriepay.io`). Defaults to
|
|
12
|
+
* `https://api.cowriepay.io` for both Sandbox and Live.
|
|
13
|
+
*/
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
/** Per-request timeout in ms (default 30_000). */
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
/** Max automatic retries for idempotent/keyed requests on 429/5xx/network (default 2). */
|
|
18
|
+
maxRetries?: number;
|
|
19
|
+
/** Base backoff in ms; delay ≈ min(base·2^attempt, 8000) + jitter (default 1000). */
|
|
20
|
+
retryBaseMs?: number;
|
|
21
|
+
/** Injectable fetch (tests); defaults to global fetch (Node 18+). */
|
|
22
|
+
fetch?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
interface RequestOptions {
|
|
25
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
26
|
+
/** Resource path WITHOUT the `/v2` prefix, e.g. `/wallets` or `/wallets/${id}`. */
|
|
27
|
+
path: string;
|
|
28
|
+
query?: Record<string, string | number | boolean | undefined | null>;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
/** Idempotency-Key for mutating requests; also makes the request safe to auto-retry. */
|
|
31
|
+
idempotencyKey?: string;
|
|
32
|
+
/** AbortSignal to cancel from the caller. */
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The signed HTTP transport shared by every resource method. Handles: canonical signing (full `/v2`
|
|
37
|
+
* path + query + raw body), JSON encoding, timeouts, typed-error mapping, and safe retries (idempotent
|
|
38
|
+
* methods, or any request carrying an Idempotency-Key).
|
|
39
|
+
*/
|
|
40
|
+
declare class HttpClient {
|
|
41
|
+
private readonly cfg;
|
|
42
|
+
private readonly baseUrl;
|
|
43
|
+
private readonly doFetch;
|
|
44
|
+
constructor(cfg: CowriePayConfig);
|
|
45
|
+
request<T>(opts: RequestOptions): Promise<T>;
|
|
46
|
+
private sendOnce;
|
|
47
|
+
private parse;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Compute the expected webhook signature hex for a (secret, timestamp, rawBody). */
|
|
51
|
+
declare function computeWebhookSignature(secret: string, timestamp: string, rawBody: string): string;
|
|
52
|
+
interface VerifyWebhookOptions {
|
|
53
|
+
/** The raw request body EXACTLY as received (string or Buffer). */
|
|
54
|
+
payload: string | Buffer;
|
|
55
|
+
/** The `X-CowriePay-Signature` header value (with or without the `sha256=` prefix). */
|
|
56
|
+
signatureHeader: string;
|
|
57
|
+
/** The `X-CowriePay-Timestamp` header value (unix seconds). */
|
|
58
|
+
timestamp: string;
|
|
59
|
+
/**
|
|
60
|
+
* One or more signing secrets to accept. Pass BOTH current and previous during a rotation overlap.
|
|
61
|
+
* A single string is also accepted.
|
|
62
|
+
*/
|
|
63
|
+
secrets: string | string[];
|
|
64
|
+
/**
|
|
65
|
+
* Optional: also try the `X-CowriePay-Signature-Previous` header (rotation). Convenience for callers
|
|
66
|
+
* that forward both headers rather than both secrets.
|
|
67
|
+
*/
|
|
68
|
+
previousSignatureHeader?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Optional replay guard: reject if `Date.now()` is more than `toleranceSeconds` away from the
|
|
71
|
+
* signed timestamp. Omit to skip the freshness check (verify signature only).
|
|
72
|
+
*/
|
|
73
|
+
toleranceSeconds?: number;
|
|
74
|
+
/** Injectable clock (unix seconds) for tests; defaults to real time. */
|
|
75
|
+
nowSeconds?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Verify a CowriePay webhook. Returns true iff at least one (secret × provided-signature) pair matches
|
|
79
|
+
* and (when `toleranceSeconds` is set) the timestamp is fresh. Never throws on a bad signature.
|
|
80
|
+
*/
|
|
81
|
+
declare function verifyWebhook(opts: VerifyWebhookOptions): boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* This file was auto-generated by openapi-typescript.
|
|
85
|
+
* Do not make direct changes to the file.
|
|
86
|
+
*/
|
|
87
|
+
interface paths {
|
|
88
|
+
"/health": {
|
|
89
|
+
parameters: {
|
|
90
|
+
query?: never;
|
|
91
|
+
header?: never;
|
|
92
|
+
path?: never;
|
|
93
|
+
cookie?: never;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Health check
|
|
97
|
+
* @description Returns the health status of all infrastructure dependencies: database, Vault, and Redis. Returns HTTP 200 when all components are ok; HTTP 503 when any component is degraded.
|
|
98
|
+
*/
|
|
99
|
+
get: operations["getHealth"];
|
|
100
|
+
put?: never;
|
|
101
|
+
post?: never;
|
|
102
|
+
delete?: never;
|
|
103
|
+
options?: never;
|
|
104
|
+
head?: never;
|
|
105
|
+
patch?: never;
|
|
106
|
+
trace?: never;
|
|
107
|
+
};
|
|
108
|
+
"/wallets": {
|
|
109
|
+
parameters: {
|
|
110
|
+
query?: never;
|
|
111
|
+
header?: never;
|
|
112
|
+
path?: never;
|
|
113
|
+
cookie?: never;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* List wallets
|
|
117
|
+
* @description Returns paginated wallets for the workspace, ordered by creation date descending.
|
|
118
|
+
*/
|
|
119
|
+
get: operations["listWallets"];
|
|
120
|
+
put?: never;
|
|
121
|
+
/**
|
|
122
|
+
* Create a deposit wallet
|
|
123
|
+
* @description Derives a new HD wallet address for the workspace on the specified chain/asset pair. Chain and asset must be compatible (TRON_MAINNET/TRON_TESTNET: USDT_TRON; BSC_MAINNET/BSC_TESTNET: USDT_BSC, BNB; ETH_MAINNET/ETH_TESTNET: USDT_ETH, USDC_ETH, ETH). Requires a key with the matching `:write` scope.
|
|
124
|
+
*
|
|
125
|
+
* Supports the optional `Idempotency-Key` header, a retried create with the same key returns the original wallet instead of deriving a new one.
|
|
126
|
+
*/
|
|
127
|
+
post: operations["createWallet"];
|
|
128
|
+
delete?: never;
|
|
129
|
+
options?: never;
|
|
130
|
+
head?: never;
|
|
131
|
+
patch?: never;
|
|
132
|
+
trace?: never;
|
|
133
|
+
};
|
|
134
|
+
"/wallets/{id}": {
|
|
135
|
+
parameters: {
|
|
136
|
+
query?: never;
|
|
137
|
+
header?: never;
|
|
138
|
+
path?: never;
|
|
139
|
+
cookie?: never;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Get a wallet
|
|
143
|
+
* @description Returns a single wallet including its HD derivation index and decrypted external_ref (null if none was provided at creation). The encrypted_external_ref is never returned.
|
|
144
|
+
*/
|
|
145
|
+
get: operations["getWallet"];
|
|
146
|
+
put?: never;
|
|
147
|
+
post?: never;
|
|
148
|
+
delete?: never;
|
|
149
|
+
options?: never;
|
|
150
|
+
head?: never;
|
|
151
|
+
patch?: never;
|
|
152
|
+
trace?: never;
|
|
153
|
+
};
|
|
154
|
+
"/customers": {
|
|
155
|
+
parameters: {
|
|
156
|
+
query?: never;
|
|
157
|
+
header?: never;
|
|
158
|
+
path?: never;
|
|
159
|
+
cookie?: never;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* List customers
|
|
163
|
+
* @description Paginated, newest first. Scoped to the API key's network. Requires `customers:read`.
|
|
164
|
+
*/
|
|
165
|
+
get: operations["listCustomers"];
|
|
166
|
+
put?: never;
|
|
167
|
+
/**
|
|
168
|
+
* Create a customer (sub-account)
|
|
169
|
+
* @description Creates a sub-account for one of your end-users. `external_ref` is YOUR opaque id and is unique within your workspace + network, a duplicate returns 409. Supports `Idempotency-Key`. Requires `customers:write`.
|
|
170
|
+
*/
|
|
171
|
+
post: operations["createCustomer"];
|
|
172
|
+
delete?: never;
|
|
173
|
+
options?: never;
|
|
174
|
+
head?: never;
|
|
175
|
+
patch?: never;
|
|
176
|
+
trace?: never;
|
|
177
|
+
};
|
|
178
|
+
"/customers/{id}": {
|
|
179
|
+
parameters: {
|
|
180
|
+
query?: never;
|
|
181
|
+
header?: never;
|
|
182
|
+
path?: never;
|
|
183
|
+
cookie?: never;
|
|
184
|
+
};
|
|
185
|
+
/** Get a customer */
|
|
186
|
+
get: operations["getCustomer"];
|
|
187
|
+
put?: never;
|
|
188
|
+
post?: never;
|
|
189
|
+
delete?: never;
|
|
190
|
+
options?: never;
|
|
191
|
+
head?: never;
|
|
192
|
+
/**
|
|
193
|
+
* Update a customer
|
|
194
|
+
* @description Update `label`, `metadata`, or `status` (set ARCHIVED to retire the sub-account label, this does NOT stop monitoring its addresses). `external_ref` is immutable. Requires `customers:write`.
|
|
195
|
+
*/
|
|
196
|
+
patch: operations["updateCustomer"];
|
|
197
|
+
trace?: never;
|
|
198
|
+
};
|
|
199
|
+
"/transactions": {
|
|
200
|
+
parameters: {
|
|
201
|
+
query?: never;
|
|
202
|
+
header?: never;
|
|
203
|
+
path?: never;
|
|
204
|
+
cookie?: never;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* List deposits and withdrawals combined
|
|
208
|
+
* @description Returns deposits and withdrawals in separate arrays, optionally filtered by type. This endpoint does not return pagination metadata (total/page/limit), use GET /transactions/deposits or GET /transactions/withdrawals for individually paginated lists. Each item includes a `type` field (`"deposit"` or `"withdrawal"`).
|
|
209
|
+
*/
|
|
210
|
+
get: operations["listTransactions"];
|
|
211
|
+
put?: never;
|
|
212
|
+
post?: never;
|
|
213
|
+
delete?: never;
|
|
214
|
+
options?: never;
|
|
215
|
+
head?: never;
|
|
216
|
+
patch?: never;
|
|
217
|
+
trace?: never;
|
|
218
|
+
};
|
|
219
|
+
"/transactions/deposits": {
|
|
220
|
+
parameters: {
|
|
221
|
+
query?: never;
|
|
222
|
+
header?: never;
|
|
223
|
+
path?: never;
|
|
224
|
+
cookie?: never;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* List deposits
|
|
228
|
+
* @description Returns paginated deposits for the workspace, ordered by detection date descending. All amounts are in human-readable units. Example: "100.000000" for 100 USDT, "1.500000000000000000" for 1.5 ETH.
|
|
229
|
+
*/
|
|
230
|
+
get: operations["listDeposits"];
|
|
231
|
+
put?: never;
|
|
232
|
+
post?: never;
|
|
233
|
+
delete?: never;
|
|
234
|
+
options?: never;
|
|
235
|
+
head?: never;
|
|
236
|
+
patch?: never;
|
|
237
|
+
trace?: never;
|
|
238
|
+
};
|
|
239
|
+
"/transactions/deposits/{id}": {
|
|
240
|
+
parameters: {
|
|
241
|
+
query?: never;
|
|
242
|
+
header?: never;
|
|
243
|
+
path?: never;
|
|
244
|
+
cookie?: never;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Get a single deposit
|
|
248
|
+
* @description Returns a deposit by its ID.
|
|
249
|
+
*/
|
|
250
|
+
get: operations["getDeposit"];
|
|
251
|
+
put?: never;
|
|
252
|
+
post?: never;
|
|
253
|
+
delete?: never;
|
|
254
|
+
options?: never;
|
|
255
|
+
head?: never;
|
|
256
|
+
patch?: never;
|
|
257
|
+
trace?: never;
|
|
258
|
+
};
|
|
259
|
+
"/transactions/withdrawals": {
|
|
260
|
+
parameters: {
|
|
261
|
+
query?: never;
|
|
262
|
+
header?: never;
|
|
263
|
+
path?: never;
|
|
264
|
+
cookie?: never;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* List withdrawals (with fee records)
|
|
268
|
+
* @description Returns paginated withdrawals for the workspace, ordered by request date descending. This endpoint includes fee_record in each item; use GET /withdrawals for a view that includes idempotency_key instead. All amounts are in human-readable units. Example: "50.000000" for 50 USDT, "0.500000000000000000" for 0.5 ETH.
|
|
269
|
+
*/
|
|
270
|
+
get: operations["listTransactionWithdrawals"];
|
|
271
|
+
put?: never;
|
|
272
|
+
post?: never;
|
|
273
|
+
delete?: never;
|
|
274
|
+
options?: never;
|
|
275
|
+
head?: never;
|
|
276
|
+
patch?: never;
|
|
277
|
+
trace?: never;
|
|
278
|
+
};
|
|
279
|
+
"/transactions/balances": {
|
|
280
|
+
parameters: {
|
|
281
|
+
query?: never;
|
|
282
|
+
header?: never;
|
|
283
|
+
path?: never;
|
|
284
|
+
cookie?: never;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Get workspace balances
|
|
288
|
+
* @description Returns per-asset balances for the workspace, scoped to the API key's network: a live key (cpk_live_…) returns mainnet balances, a test key (cpk_test_…) returns testnet balances. Mainnet and testnet are separate ledgers and never commingle. All amounts are in human-readable units. Example: "100.000000" for 100 USDT, "1.500000000000000000" for 1.5 ETH.
|
|
289
|
+
*/
|
|
290
|
+
get: operations["getBalances"];
|
|
291
|
+
put?: never;
|
|
292
|
+
post?: never;
|
|
293
|
+
delete?: never;
|
|
294
|
+
options?: never;
|
|
295
|
+
head?: never;
|
|
296
|
+
patch?: never;
|
|
297
|
+
trace?: never;
|
|
298
|
+
};
|
|
299
|
+
"/withdrawals": {
|
|
300
|
+
parameters: {
|
|
301
|
+
query?: never;
|
|
302
|
+
header?: never;
|
|
303
|
+
path?: never;
|
|
304
|
+
cookie?: never;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* List withdrawals
|
|
308
|
+
* @description Returns paginated withdrawals for the workspace, ordered by request date descending. Includes idempotency_key in each item. Does not include fee_record, use GET /transactions/withdrawals for a view with fee records.
|
|
309
|
+
*/
|
|
310
|
+
get: operations["listWithdrawals"];
|
|
311
|
+
put?: never;
|
|
312
|
+
/**
|
|
313
|
+
* Request a withdrawal
|
|
314
|
+
* @description Immediately locks the requested amount from available balance. Fee is deducted from balance at broadcast time. Chain and asset must be compatible (TRON: USDT_TRON; BSC: USDT_BSC, BNB; ETH: USDT_ETH, USDC_ETH, ETH). Requires a key with the matching `:write` scope.
|
|
315
|
+
*
|
|
316
|
+
* **Idempotency:** send the standard `Idempotency-Key` header (recommended). A retried request with the same key returns the ORIGINAL withdrawal (header `Idempotent-Replay: true`) without locking funds again. The legacy body field `idempotency_key` is still accepted (now optional) for backward compatibility; if neither is provided, the request is not deduplicated.
|
|
317
|
+
* All amounts are in human-readable units. Example: "50.000000" for 50 USDT, "0.500000000000000000" for 0.5 ETH. Do not send raw blockchain units.
|
|
318
|
+
*/
|
|
319
|
+
post: operations["createWithdrawal"];
|
|
320
|
+
delete?: never;
|
|
321
|
+
options?: never;
|
|
322
|
+
head?: never;
|
|
323
|
+
patch?: never;
|
|
324
|
+
trace?: never;
|
|
325
|
+
};
|
|
326
|
+
"/withdrawals/{id}": {
|
|
327
|
+
parameters: {
|
|
328
|
+
query?: never;
|
|
329
|
+
header?: never;
|
|
330
|
+
path?: never;
|
|
331
|
+
cookie?: never;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Get a single withdrawal
|
|
335
|
+
* @description Returns a withdrawal by its ID, including fee record if available.
|
|
336
|
+
*/
|
|
337
|
+
get: operations["getWithdrawal"];
|
|
338
|
+
put?: never;
|
|
339
|
+
post?: never;
|
|
340
|
+
/**
|
|
341
|
+
* Cancel a pending withdrawal
|
|
342
|
+
* @description Only withdrawals in PENDING status can be cancelled. Locked funds are returned to available balance atomically. Requires a key with the matching `:write` scope.
|
|
343
|
+
*/
|
|
344
|
+
delete: operations["cancelWithdrawal"];
|
|
345
|
+
options?: never;
|
|
346
|
+
head?: never;
|
|
347
|
+
patch?: never;
|
|
348
|
+
trace?: never;
|
|
349
|
+
};
|
|
350
|
+
"/fees/quote": {
|
|
351
|
+
parameters: {
|
|
352
|
+
query?: never;
|
|
353
|
+
header?: never;
|
|
354
|
+
path?: never;
|
|
355
|
+
cookie?: never;
|
|
356
|
+
};
|
|
357
|
+
get?: never;
|
|
358
|
+
put?: never;
|
|
359
|
+
/**
|
|
360
|
+
* Quote the fee for a deposit or withdrawal (indicative)
|
|
361
|
+
* @description Returns the effective fee, gross and net for a deposit or withdrawal, using the same engine as settlement (tiers, per-workspace overrides, per-chain minimum fee), so a preview matches what is actually charged. The network (mainnet/testnet) is taken from your API key, never from the request.
|
|
362
|
+
*
|
|
363
|
+
* `mode` controls the meaning of `amount`:
|
|
364
|
+
* - `charge` (default): `amount` is the **gross** (what the customer sends / what is
|
|
365
|
+
* debited). The response `net` is what you receive.
|
|
366
|
+
*
|
|
367
|
+
* - `gross_up`: `amount` is the **net you want to receive**. The response `gross` is what
|
|
368
|
+
* the customer must send / what is debited so you net that amount.
|
|
369
|
+
*
|
|
370
|
+
*
|
|
371
|
+
* Quotes are **indicative**, the binding fee is computed at settlement (a fee tier can change with your 30-day volume, and an override can expire). For valid input the endpoint always returns `200`; an amount too small to leave a positive net is reported as `viable: false` with an `AMOUNT_TOO_SMALL` warning, not an error. Read-only, a READ key is sufficient.
|
|
372
|
+
*/
|
|
373
|
+
post: operations["quoteFee"];
|
|
374
|
+
delete?: never;
|
|
375
|
+
options?: never;
|
|
376
|
+
head?: never;
|
|
377
|
+
patch?: never;
|
|
378
|
+
trace?: never;
|
|
379
|
+
};
|
|
380
|
+
"/webhooks": {
|
|
381
|
+
parameters: {
|
|
382
|
+
query?: never;
|
|
383
|
+
header?: never;
|
|
384
|
+
path?: never;
|
|
385
|
+
cookie?: never;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* List webhook endpoints
|
|
389
|
+
* @description Returns paginated webhook endpoints for the workspace.
|
|
390
|
+
*/
|
|
391
|
+
get: operations["listWebhookEndpoints"];
|
|
392
|
+
put?: never;
|
|
393
|
+
/**
|
|
394
|
+
* Create a webhook endpoint
|
|
395
|
+
* @description The `secret` field is returned only at creation time and cannot be retrieved again. Store it securely, it is used to verify the HMAC signature on incoming webhook payloads. Only HTTPS URLs pointing to publicly reachable addresses are accepted. Maximum 10 webhook endpoints per workspace. Requires a key with the matching `:write` scope.
|
|
396
|
+
*/
|
|
397
|
+
post: operations["createWebhookEndpoint"];
|
|
398
|
+
delete?: never;
|
|
399
|
+
options?: never;
|
|
400
|
+
head?: never;
|
|
401
|
+
patch?: never;
|
|
402
|
+
trace?: never;
|
|
403
|
+
};
|
|
404
|
+
"/webhooks/{id}": {
|
|
405
|
+
parameters: {
|
|
406
|
+
query?: never;
|
|
407
|
+
header?: never;
|
|
408
|
+
path?: never;
|
|
409
|
+
cookie?: never;
|
|
410
|
+
};
|
|
411
|
+
get?: never;
|
|
412
|
+
put?: never;
|
|
413
|
+
post?: never;
|
|
414
|
+
/**
|
|
415
|
+
* Delete a webhook endpoint
|
|
416
|
+
* @description Deletes the endpoint and all its delivery history. Cannot delete an endpoint that has PENDING deliveries, wait for them to complete or fail, then retry. Requires a key with the matching `:write` scope.
|
|
417
|
+
*/
|
|
418
|
+
delete: operations["deleteWebhookEndpoint"];
|
|
419
|
+
options?: never;
|
|
420
|
+
head?: never;
|
|
421
|
+
/**
|
|
422
|
+
* Update a webhook endpoint
|
|
423
|
+
* @description All fields are optional; only provided fields are updated. Requires a key with the matching `:write` scope.
|
|
424
|
+
*/
|
|
425
|
+
patch: operations["updateWebhookEndpoint"];
|
|
426
|
+
trace?: never;
|
|
427
|
+
};
|
|
428
|
+
"/webhooks/{id}/rotate-secret": {
|
|
429
|
+
parameters: {
|
|
430
|
+
query?: never;
|
|
431
|
+
header?: never;
|
|
432
|
+
path?: never;
|
|
433
|
+
cookie?: never;
|
|
434
|
+
};
|
|
435
|
+
get?: never;
|
|
436
|
+
put?: never;
|
|
437
|
+
/**
|
|
438
|
+
* Rotate a webhook signing secret
|
|
439
|
+
* @description Generates a new signing secret (returned ONCE in this response) and keeps the previous secret valid for an overlap window (24h) so no delivery is missed while you update. During the window each delivery carries both `X-CowriePay-Signature` (new) and `X-CowriePay-Signature-Previous` (old), verify against whichever you currently hold. Requires the `webhooks:write` scope.
|
|
440
|
+
*/
|
|
441
|
+
post: operations["rotateWebhookSecret"];
|
|
442
|
+
delete?: never;
|
|
443
|
+
options?: never;
|
|
444
|
+
head?: never;
|
|
445
|
+
patch?: never;
|
|
446
|
+
trace?: never;
|
|
447
|
+
};
|
|
448
|
+
"/webhooks/{id}/deliveries": {
|
|
449
|
+
parameters: {
|
|
450
|
+
query?: never;
|
|
451
|
+
header?: never;
|
|
452
|
+
path?: never;
|
|
453
|
+
cookie?: never;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Get delivery history for a webhook endpoint
|
|
457
|
+
* @description Returns paginated delivery attempts for the endpoint, ordered by creation date descending. Delivery records older than 90 days are automatically purged.
|
|
458
|
+
*/
|
|
459
|
+
get: operations["listWebhookDeliveries"];
|
|
460
|
+
put?: never;
|
|
461
|
+
post?: never;
|
|
462
|
+
delete?: never;
|
|
463
|
+
options?: never;
|
|
464
|
+
head?: never;
|
|
465
|
+
patch?: never;
|
|
466
|
+
trace?: never;
|
|
467
|
+
};
|
|
468
|
+
"/api-keys": {
|
|
469
|
+
parameters: {
|
|
470
|
+
query?: never;
|
|
471
|
+
header?: never;
|
|
472
|
+
path?: never;
|
|
473
|
+
cookie?: never;
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* List active API keys
|
|
477
|
+
* @description Returns paginated active (non-revoked) API keys for the workspace.
|
|
478
|
+
*/
|
|
479
|
+
get: operations["listApiKeys"];
|
|
480
|
+
put?: never;
|
|
481
|
+
/**
|
|
482
|
+
* Create an API key
|
|
483
|
+
* @description The `secret` field is returned only at creation time and cannot be retrieved again. Store it securely, it is used as the HMAC signing secret for all subsequent requests. Requires the `api_keys:write` scope.
|
|
484
|
+
*
|
|
485
|
+
* **Scopes (recommended):** pass `scopes` to mint a least-privilege key. A key may only grant scopes it itself holds (no privilege escalation). Omit `scopes` to fall back to the legacy coarse `permission`. Available scopes: `wallets:read|write`, `customers:read|write`, `payment_intents:read|write`, `refunds:read|write`, `transactions:read`, `withdrawals:read|write`, `webhooks:read|write`, `fees:read`, `api_keys:read|write`.
|
|
486
|
+
*/
|
|
487
|
+
post: operations["createApiKey"];
|
|
488
|
+
delete?: never;
|
|
489
|
+
options?: never;
|
|
490
|
+
head?: never;
|
|
491
|
+
patch?: never;
|
|
492
|
+
trace?: never;
|
|
493
|
+
};
|
|
494
|
+
"/api-keys/{id}": {
|
|
495
|
+
parameters: {
|
|
496
|
+
query?: never;
|
|
497
|
+
header?: never;
|
|
498
|
+
path?: never;
|
|
499
|
+
cookie?: never;
|
|
500
|
+
};
|
|
501
|
+
get?: never;
|
|
502
|
+
put?: never;
|
|
503
|
+
post?: never;
|
|
504
|
+
/**
|
|
505
|
+
* Revoke an API key
|
|
506
|
+
* @description Marks the key as REVOKED. Revoked keys are rejected immediately on next use. Requires a key with the matching `:write` scope.
|
|
507
|
+
*/
|
|
508
|
+
delete: operations["revokeApiKey"];
|
|
509
|
+
options?: never;
|
|
510
|
+
head?: never;
|
|
511
|
+
patch?: never;
|
|
512
|
+
trace?: never;
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
interface components {
|
|
516
|
+
schemas: {
|
|
517
|
+
Error: {
|
|
518
|
+
/**
|
|
519
|
+
* @description Human-readable message, for display/logging. Do NOT branch on this text.
|
|
520
|
+
* @example Insufficient balance. Available: 10.000000, Requested: 50.000000
|
|
521
|
+
*/
|
|
522
|
+
error: string;
|
|
523
|
+
/**
|
|
524
|
+
* @description Stable, machine-readable error code, branch on this, not the message. Common values: `VALIDATION_ERROR`, `INVALID_JSON`, `PAYLOAD_TOO_LARGE`, `MISSING_AUTH_HEADERS`, `INVALID_SIGNATURE`, `TIMESTAMP_EXPIRED`, `REPLAY_DETECTED`, `INVALID_API_KEY`, `IP_NOT_ALLOWED`, `API_KEY_EXPIRED`, `WORKSPACE_INACTIVE`, `INSUFFICIENT_SCOPE`, `NOT_FOUND`, `CONFLICT`, `UNPROCESSABLE`, `INSUFFICIENT_BALANCE`, `INVALID_DESTINATION_ADDRESS`, `WITHDRAWAL_NOT_CANCELLABLE`, `IDEMPOTENCY_CONFLICT`, `IDEMPOTENCY_MISMATCH`, `IDEMPOTENCY_KEY_INVALID`, `FEATURE_NOT_AVAILABLE`, `RATE_LIMITED`, `DATABASE_ERROR`, `INTERNAL_ERROR`.
|
|
525
|
+
* @example INSUFFICIENT_BALANCE
|
|
526
|
+
*/
|
|
527
|
+
code: string;
|
|
528
|
+
};
|
|
529
|
+
/** @description Indicative fee quote. All monetary fields are decimal strings (6 dp). The object is open, clients should ignore unknown fields (new fields/warning codes are additive). */
|
|
530
|
+
FeeQuote: {
|
|
531
|
+
/** @enum {string} */
|
|
532
|
+
direction?: "deposit" | "withdrawal";
|
|
533
|
+
/**
|
|
534
|
+
* @description Full resolved chain (network from the API key).
|
|
535
|
+
* @enum {string}
|
|
536
|
+
*/
|
|
537
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
538
|
+
/** @enum {string} */
|
|
539
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
540
|
+
/** @enum {string} */
|
|
541
|
+
mode?: "charge" | "gross_up";
|
|
542
|
+
/** @description Echo of the requested amount. */
|
|
543
|
+
input_amount?: string;
|
|
544
|
+
/** @description Amount sent by the customer / debited from balance. */
|
|
545
|
+
gross?: string;
|
|
546
|
+
/** @description CowriePay fee. */
|
|
547
|
+
fee?: string;
|
|
548
|
+
/** @description Amount you receive / the recipient gets. null when not viable. */
|
|
549
|
+
net?: string | null;
|
|
550
|
+
/** @description fee / gross, the realised rate (higher than applied_rate when the minimum fee dominates). */
|
|
551
|
+
effective_rate?: string;
|
|
552
|
+
/** @description Percentage rate used ("0" for withdrawals). */
|
|
553
|
+
applied_rate?: string;
|
|
554
|
+
/** @description Minimum fee (deposit) or flat fee (withdrawal) used. */
|
|
555
|
+
applied_min_fee?: string;
|
|
556
|
+
/**
|
|
557
|
+
* @description Which rule produced the fee.
|
|
558
|
+
* @enum {string}
|
|
559
|
+
*/
|
|
560
|
+
fee_basis?: "percentage" | "minimum" | "flat";
|
|
561
|
+
/** @description true when a per-workspace fee override was used. */
|
|
562
|
+
override_applied?: boolean;
|
|
563
|
+
/** @description Fee tier used (null when an override applied). */
|
|
564
|
+
tier?: {
|
|
565
|
+
label?: string;
|
|
566
|
+
} | null;
|
|
567
|
+
/** @description false when the fee is >= the amount (nothing would be credited/sent). */
|
|
568
|
+
viable?: boolean;
|
|
569
|
+
/** @description Always true, the binding fee is computed at settlement. */
|
|
570
|
+
indicative?: boolean;
|
|
571
|
+
/** @description Open list of advisory codes. Known codes: BELOW_SWEEP_MINIMUM, MIN_FEE_DOMINATES, AMOUNT_TOO_SMALL, OVERRIDE_EXPIRES_SOON. Treat unknown codes leniently. */
|
|
572
|
+
warnings?: {
|
|
573
|
+
code?: string;
|
|
574
|
+
message?: string;
|
|
575
|
+
}[];
|
|
576
|
+
};
|
|
577
|
+
PaginationMeta: {
|
|
578
|
+
/** @description Total number of matching records */
|
|
579
|
+
total?: number;
|
|
580
|
+
/** @description Current page number */
|
|
581
|
+
page?: number;
|
|
582
|
+
/** @description Items per page */
|
|
583
|
+
limit?: number;
|
|
584
|
+
};
|
|
585
|
+
Wallet: {
|
|
586
|
+
/** Format: uuid */
|
|
587
|
+
id?: string;
|
|
588
|
+
/** @enum {string} */
|
|
589
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
590
|
+
/** @enum {string} */
|
|
591
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
592
|
+
/**
|
|
593
|
+
* @description On-chain address. Format depends on chain: TRON = base58 (Txxxx), BSC/ETH = checksummed hex (0xxxxx).
|
|
594
|
+
* @example TExample1234567890ABCDEFGHIJKLMNOPxxx
|
|
595
|
+
*/
|
|
596
|
+
address?: string;
|
|
597
|
+
/** @enum {string} */
|
|
598
|
+
status?: "ACTIVE" | "SWEPT" | "ARCHIVED";
|
|
599
|
+
/**
|
|
600
|
+
* Format: uuid
|
|
601
|
+
* @description Optional Customer (sub-account) this address is attributed to, or null if it belongs to the workspace itself. See the Customers resource.
|
|
602
|
+
*/
|
|
603
|
+
customer_id?: string | null;
|
|
604
|
+
/** Format: date-time */
|
|
605
|
+
created_at?: string;
|
|
606
|
+
};
|
|
607
|
+
WalletDetail: components["schemas"]["Wallet"] & {
|
|
608
|
+
/** @description HD derivation index for this wallet address. */
|
|
609
|
+
derivation_index?: number;
|
|
610
|
+
external_ref?: string | null;
|
|
611
|
+
};
|
|
612
|
+
Customer: {
|
|
613
|
+
/** Format: uuid */
|
|
614
|
+
id?: string;
|
|
615
|
+
/**
|
|
616
|
+
* @description Your opaque identifier for this end-user (never PII). Unique within your workspace + mode.
|
|
617
|
+
* @example user_8f3a2c
|
|
618
|
+
*/
|
|
619
|
+
external_ref?: string;
|
|
620
|
+
/** @description Optional display name you chose (e.g. "Alice"). Not for PII. */
|
|
621
|
+
label?: string | null;
|
|
622
|
+
/** @description Optional free-form object, opaque to CowriePay. */
|
|
623
|
+
metadata?: {
|
|
624
|
+
[key: string]: unknown;
|
|
625
|
+
} | null;
|
|
626
|
+
/**
|
|
627
|
+
* @description ARCHIVED retires the sub-account label; it does NOT stop monitoring its addresses.
|
|
628
|
+
* @enum {string}
|
|
629
|
+
*/
|
|
630
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
631
|
+
/** Format: date-time */
|
|
632
|
+
created_at?: string;
|
|
633
|
+
/** Format: date-time */
|
|
634
|
+
updated_at?: string;
|
|
635
|
+
};
|
|
636
|
+
Balance: {
|
|
637
|
+
/** @enum {string} */
|
|
638
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
639
|
+
/**
|
|
640
|
+
* @description Available balance in human-readable units. Example: "100.000000" for 100 USDT, "1.500000000000000000" for 1.5 ETH.
|
|
641
|
+
* @example 100.000000
|
|
642
|
+
*/
|
|
643
|
+
available?: string;
|
|
644
|
+
/**
|
|
645
|
+
* @description Balance in transit (deposited but not yet swept to master wallet).
|
|
646
|
+
* @example 0.000000
|
|
647
|
+
*/
|
|
648
|
+
pending?: string;
|
|
649
|
+
/**
|
|
650
|
+
* @description Balance reserved for pending withdrawal requests.
|
|
651
|
+
* @example 0.000000
|
|
652
|
+
*/
|
|
653
|
+
locked?: string;
|
|
654
|
+
};
|
|
655
|
+
FeeRecord: {
|
|
656
|
+
/**
|
|
657
|
+
* @description Fee deducted in human-readable units.
|
|
658
|
+
* @example 0.900000
|
|
659
|
+
*/
|
|
660
|
+
fee_amount?: string;
|
|
661
|
+
/**
|
|
662
|
+
* @description Amount after fee in human-readable units.
|
|
663
|
+
* @example 99.100000
|
|
664
|
+
*/
|
|
665
|
+
net_amount?: string;
|
|
666
|
+
};
|
|
667
|
+
Deposit: {
|
|
668
|
+
/** Format: uuid */
|
|
669
|
+
id?: string;
|
|
670
|
+
/**
|
|
671
|
+
* Format: uuid
|
|
672
|
+
* @description ID of the wallet that received this deposit. Use this to link the deposit back to your own order or customer record.
|
|
673
|
+
*/
|
|
674
|
+
wallet_id?: string;
|
|
675
|
+
/** @enum {string} */
|
|
676
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
677
|
+
/** @enum {string} */
|
|
678
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
679
|
+
txid?: string | null;
|
|
680
|
+
/**
|
|
681
|
+
* @description Deposit amount in human-readable units. Example: "100.000000" for 100 USDT, "1.500000000000000000" for 1.5 ETH.
|
|
682
|
+
* @example 100.000000
|
|
683
|
+
*/
|
|
684
|
+
amount?: string;
|
|
685
|
+
/** @enum {string} */
|
|
686
|
+
status?: "DETECTED" | "CONFIRMING" | "CONFIRMED" | "SWEPT" | "FAILED" | "FLAGGED" | "REJECTED";
|
|
687
|
+
/** @example 0 */
|
|
688
|
+
confirmations?: number;
|
|
689
|
+
/** Format: date-time */
|
|
690
|
+
detected_at?: string;
|
|
691
|
+
confirmed_at?: string | null;
|
|
692
|
+
swept_at?: string | null;
|
|
693
|
+
fee_record?: components["schemas"]["FeeRecord"] | null;
|
|
694
|
+
};
|
|
695
|
+
/** @description Withdrawal record as returned by GET /withdrawals. Includes idempotency_key; fee_record is not included in this view. */
|
|
696
|
+
Withdrawal: {
|
|
697
|
+
/** Format: uuid */
|
|
698
|
+
id?: string;
|
|
699
|
+
/** @enum {string} */
|
|
700
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
701
|
+
/** @enum {string} */
|
|
702
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
703
|
+
/**
|
|
704
|
+
* @description Withdrawal amount in human-readable units. Example: "50.000000" for 50 USDT, "0.500000000000000000" for 0.5 ETH.
|
|
705
|
+
* @example 50.000000
|
|
706
|
+
*/
|
|
707
|
+
amount?: string;
|
|
708
|
+
/** @enum {string} */
|
|
709
|
+
status?: "PENDING_APPROVAL" | "PENDING" | "UNDER_REVIEW" | "PROCESSING" | "CONFIRMING" | "CONFIRMED" | "FAILED" | "CANCELLED";
|
|
710
|
+
txid?: string | null;
|
|
711
|
+
idempotency_key?: string;
|
|
712
|
+
/** Format: date-time */
|
|
713
|
+
requested_at?: string;
|
|
714
|
+
confirmed_at?: string | null;
|
|
715
|
+
};
|
|
716
|
+
/** @description Response body from POST /withdrawals. */
|
|
717
|
+
WithdrawalCreated: {
|
|
718
|
+
/** Format: uuid */
|
|
719
|
+
id?: string;
|
|
720
|
+
/** @enum {string} */
|
|
721
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
722
|
+
/** @enum {string} */
|
|
723
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
724
|
+
/**
|
|
725
|
+
* @description Requested amount in human-readable units. Example: "50.000000" for 50 USDT, "0.500000000000000000" for 0.5 ETH.
|
|
726
|
+
* @example 50.000000
|
|
727
|
+
*/
|
|
728
|
+
amount?: string;
|
|
729
|
+
/**
|
|
730
|
+
* @description Estimated fee in human-readable units. Deducted from available balance at broadcast.
|
|
731
|
+
* @example 0.900000
|
|
732
|
+
*/
|
|
733
|
+
fee?: string;
|
|
734
|
+
/**
|
|
735
|
+
* @description Estimated amount after fee in human-readable units.
|
|
736
|
+
* @example 49.100000
|
|
737
|
+
*/
|
|
738
|
+
net_amount?: string;
|
|
739
|
+
/** @enum {string} */
|
|
740
|
+
status?: "PENDING";
|
|
741
|
+
idempotency_key?: string;
|
|
742
|
+
/** Format: date-time */
|
|
743
|
+
requested_at?: string;
|
|
744
|
+
};
|
|
745
|
+
/** @description Withdrawal record as returned by GET /transactions and GET /transactions/withdrawals. Includes fee_record; idempotency_key is not included. */
|
|
746
|
+
WithdrawalTransaction: {
|
|
747
|
+
/** Format: uuid */
|
|
748
|
+
id?: string;
|
|
749
|
+
/** @enum {string} */
|
|
750
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
751
|
+
/** @enum {string} */
|
|
752
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
753
|
+
txid?: string | null;
|
|
754
|
+
/**
|
|
755
|
+
* @description Withdrawal amount in human-readable units.
|
|
756
|
+
* @example 50.000000
|
|
757
|
+
*/
|
|
758
|
+
amount?: string;
|
|
759
|
+
/** @enum {string} */
|
|
760
|
+
status?: "PENDING_APPROVAL" | "PENDING" | "UNDER_REVIEW" | "PROCESSING" | "CONFIRMING" | "CONFIRMED" | "FAILED" | "CANCELLED";
|
|
761
|
+
/** Format: date-time */
|
|
762
|
+
requested_at?: string;
|
|
763
|
+
confirmed_at?: string | null;
|
|
764
|
+
fee_record?: components["schemas"]["FeeRecord"] | null;
|
|
765
|
+
};
|
|
766
|
+
WebhookEndpoint: {
|
|
767
|
+
/** Format: uuid */
|
|
768
|
+
id?: string;
|
|
769
|
+
/** Format: uri */
|
|
770
|
+
url?: string;
|
|
771
|
+
events?: ("DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED")[];
|
|
772
|
+
is_active?: boolean;
|
|
773
|
+
/** Format: date-time */
|
|
774
|
+
created_at?: string;
|
|
775
|
+
};
|
|
776
|
+
WebhookDelivery: {
|
|
777
|
+
/** Format: uuid */
|
|
778
|
+
id?: string;
|
|
779
|
+
/** @enum {string} */
|
|
780
|
+
event?: "DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED";
|
|
781
|
+
/** @enum {string} */
|
|
782
|
+
status?: "PENDING" | "SUCCESS" | "FAILED";
|
|
783
|
+
http_status?: number | null;
|
|
784
|
+
attempts?: number;
|
|
785
|
+
last_error?: string | null;
|
|
786
|
+
delivered_at?: string | null;
|
|
787
|
+
/** Format: date-time */
|
|
788
|
+
created_at?: string;
|
|
789
|
+
};
|
|
790
|
+
ApiKey: {
|
|
791
|
+
/** Format: uuid */
|
|
792
|
+
id?: string;
|
|
793
|
+
label?: string;
|
|
794
|
+
/** @example cpk_live_xxxxxxxxxxxxxxxxxxxx */
|
|
795
|
+
key_id?: string;
|
|
796
|
+
/** @description Fine-grained scopes granted to this key. Empty means a legacy key whose access is derived from `permission` (READ_WRITE → all scopes, READ_ONLY → all :read scopes). */
|
|
797
|
+
scopes?: ("wallets:read" | "wallets:write" | "customers:read" | "customers:write" | "payment_intents:read" | "payment_intents:write" | "refunds:read" | "refunds:write" | "transactions:read" | "withdrawals:read" | "withdrawals:write" | "webhooks:read" | "webhooks:write" | "fees:read" | "api_keys:read" | "api_keys:write")[];
|
|
798
|
+
/**
|
|
799
|
+
* @description Legacy coarse permission. Retained for display and as the fallback when `scopes` is empty.
|
|
800
|
+
* @enum {string}
|
|
801
|
+
*/
|
|
802
|
+
permission?: "READ_ONLY" | "READ_WRITE";
|
|
803
|
+
/**
|
|
804
|
+
* @description Optional source-IP allowlist. When non-empty, a request from a source IP outside this list is rejected with 403 `IP_NOT_ALLOWED` (checked before the HMAC signature). Empty means no restriction. Each entry is a single IP or CIDR range (IPv4 or IPv6).
|
|
805
|
+
* @example [
|
|
806
|
+
* "203.0.113.4",
|
|
807
|
+
* "198.51.100.0/24"
|
|
808
|
+
* ]
|
|
809
|
+
*/
|
|
810
|
+
allowed_ips?: string[];
|
|
811
|
+
is_test?: boolean;
|
|
812
|
+
last_used_at?: string | null;
|
|
813
|
+
expires_at?: string | null;
|
|
814
|
+
/** Format: date-time */
|
|
815
|
+
created_at?: string;
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
responses: never;
|
|
819
|
+
parameters: {
|
|
820
|
+
/** @description Optional client-chosen key (1–255 chars, A–Z a–z 0–9 _ -; a UUIDv4 is recommended) to make this POST safe to retry. The first request executes; any later request with the SAME key returns the original response unchanged (with header `Idempotent-Replay: true`) WITHOUT re-running the operation, so a retried request never double-creates. Reusing a key with a different request body returns `422` (`code: IDEMPOTENCY_MISMATCH`); a key whose first request is still in flight returns `409` (`code: IDEMPOTENCY_CONFLICT`). Stored for 24h. */
|
|
821
|
+
IdempotencyKeyHeader: string;
|
|
822
|
+
/** @description Page number (1-based) */
|
|
823
|
+
PageParam: number;
|
|
824
|
+
/** @description Items per page (max 100) */
|
|
825
|
+
LimitParam: number;
|
|
826
|
+
};
|
|
827
|
+
requestBodies: never;
|
|
828
|
+
headers: never;
|
|
829
|
+
pathItems: never;
|
|
830
|
+
}
|
|
831
|
+
interface operations {
|
|
832
|
+
getHealth: {
|
|
833
|
+
parameters: {
|
|
834
|
+
query?: never;
|
|
835
|
+
header?: never;
|
|
836
|
+
path?: never;
|
|
837
|
+
cookie?: never;
|
|
838
|
+
};
|
|
839
|
+
requestBody?: never;
|
|
840
|
+
responses: {
|
|
841
|
+
/** @description All components healthy */
|
|
842
|
+
200: {
|
|
843
|
+
headers: {
|
|
844
|
+
[name: string]: unknown;
|
|
845
|
+
};
|
|
846
|
+
content: {
|
|
847
|
+
"application/json": {
|
|
848
|
+
/** @enum {string} */
|
|
849
|
+
status?: "ok" | "degraded";
|
|
850
|
+
components?: {
|
|
851
|
+
/** @enum {string} */
|
|
852
|
+
database?: "ok" | "degraded";
|
|
853
|
+
/** @enum {string} */
|
|
854
|
+
vault?: "ok" | "degraded";
|
|
855
|
+
/** @enum {string} */
|
|
856
|
+
redis?: "ok" | "degraded";
|
|
857
|
+
};
|
|
858
|
+
/** Format: date-time */
|
|
859
|
+
timestamp?: string;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
/** @description One or more components degraded */
|
|
864
|
+
503: {
|
|
865
|
+
headers: {
|
|
866
|
+
[name: string]: unknown;
|
|
867
|
+
};
|
|
868
|
+
content: {
|
|
869
|
+
"application/json": {
|
|
870
|
+
/** @enum {string} */
|
|
871
|
+
status?: "degraded";
|
|
872
|
+
components?: {
|
|
873
|
+
/** @enum {string} */
|
|
874
|
+
database?: "ok" | "degraded";
|
|
875
|
+
/** @enum {string} */
|
|
876
|
+
vault?: "ok" | "degraded";
|
|
877
|
+
/** @enum {string} */
|
|
878
|
+
redis?: "ok" | "degraded";
|
|
879
|
+
};
|
|
880
|
+
/** Format: date-time */
|
|
881
|
+
timestamp?: string;
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
listWallets: {
|
|
888
|
+
parameters: {
|
|
889
|
+
query?: {
|
|
890
|
+
/** @description Filter by chain */
|
|
891
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
892
|
+
/** @description Filter by asset */
|
|
893
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
894
|
+
/** @description Filter by wallet status */
|
|
895
|
+
status?: "ACTIVE" | "SWEPT" | "ARCHIVED";
|
|
896
|
+
/** @description Page number (1-based) */
|
|
897
|
+
page?: components["parameters"]["PageParam"];
|
|
898
|
+
/** @description Items per page (max 100) */
|
|
899
|
+
limit?: components["parameters"]["LimitParam"];
|
|
900
|
+
};
|
|
901
|
+
header?: never;
|
|
902
|
+
path?: never;
|
|
903
|
+
cookie?: never;
|
|
904
|
+
};
|
|
905
|
+
requestBody?: never;
|
|
906
|
+
responses: {
|
|
907
|
+
/** @description Paginated wallet list */
|
|
908
|
+
200: {
|
|
909
|
+
headers: {
|
|
910
|
+
[name: string]: unknown;
|
|
911
|
+
};
|
|
912
|
+
content: {
|
|
913
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
914
|
+
data?: components["schemas"]["Wallet"][];
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
919
|
+
401: {
|
|
920
|
+
headers: {
|
|
921
|
+
[name: string]: unknown;
|
|
922
|
+
};
|
|
923
|
+
content: {
|
|
924
|
+
"application/json": components["schemas"]["Error"];
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
/** @description Rate limit exceeded */
|
|
928
|
+
429: {
|
|
929
|
+
headers: {
|
|
930
|
+
[name: string]: unknown;
|
|
931
|
+
};
|
|
932
|
+
content: {
|
|
933
|
+
"application/json": components["schemas"]["Error"];
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
createWallet: {
|
|
939
|
+
parameters: {
|
|
940
|
+
query?: never;
|
|
941
|
+
header?: {
|
|
942
|
+
/** @description Optional client-chosen key (1–255 chars, A–Z a–z 0–9 _ -; a UUIDv4 is recommended) to make this POST safe to retry. The first request executes; any later request with the SAME key returns the original response unchanged (with header `Idempotent-Replay: true`) WITHOUT re-running the operation, so a retried request never double-creates. Reusing a key with a different request body returns `422` (`code: IDEMPOTENCY_MISMATCH`); a key whose first request is still in flight returns `409` (`code: IDEMPOTENCY_CONFLICT`). Stored for 24h. */
|
|
943
|
+
"Idempotency-Key"?: components["parameters"]["IdempotencyKeyHeader"];
|
|
944
|
+
};
|
|
945
|
+
path?: never;
|
|
946
|
+
cookie?: never;
|
|
947
|
+
};
|
|
948
|
+
requestBody: {
|
|
949
|
+
content: {
|
|
950
|
+
"application/json": {
|
|
951
|
+
/**
|
|
952
|
+
* @description Base protocol. The network (mainnet vs testnet) is derived from your API key, a live key (`cpk_live_`) creates mainnet addresses, a test key (`cpk_test_`) testnet ones. The response echoes the full resolved chain (e.g. TRON_MAINNET).
|
|
953
|
+
* @enum {string}
|
|
954
|
+
*/
|
|
955
|
+
chain: "TRON" | "BSC" | "ETH";
|
|
956
|
+
/**
|
|
957
|
+
* @description Must be compatible with the chain. TRON_MAINNET/TRON_TESTNET: USDT_TRON | BSC_MAINNET/BSC_TESTNET: USDT_BSC, BNB | ETH_MAINNET/ETH_TESTNET: USDT_ETH, USDC_ETH, ETH. For native assets (ETH, BNB) the wallet monitors native transfers only.
|
|
958
|
+
* @enum {string}
|
|
959
|
+
*/
|
|
960
|
+
asset: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
961
|
+
/** @description Your reference for this wallet (e.g. an order id), stored encrypted at rest. Returned (decrypted) by GET /wallets/{id}; omitted from list responses. */
|
|
962
|
+
external_ref?: string;
|
|
963
|
+
/**
|
|
964
|
+
* Format: uuid
|
|
965
|
+
* @description Optional. Attribute this address to a Customer (sub-account). Must reference an ACTIVE customer in the same workspace and network (mode) as the API key, else 400.
|
|
966
|
+
*/
|
|
967
|
+
customer_id?: string;
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
};
|
|
971
|
+
responses: {
|
|
972
|
+
/** @description Wallet created */
|
|
973
|
+
201: {
|
|
974
|
+
headers: {
|
|
975
|
+
[name: string]: unknown;
|
|
976
|
+
};
|
|
977
|
+
content: {
|
|
978
|
+
"application/json": components["schemas"]["Wallet"];
|
|
979
|
+
};
|
|
980
|
+
};
|
|
981
|
+
/** @description Validation error or incompatible chain/asset pair */
|
|
982
|
+
400: {
|
|
983
|
+
headers: {
|
|
984
|
+
[name: string]: unknown;
|
|
985
|
+
};
|
|
986
|
+
content: {
|
|
987
|
+
"application/json": components["schemas"]["Error"];
|
|
988
|
+
};
|
|
989
|
+
};
|
|
990
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
991
|
+
401: {
|
|
992
|
+
headers: {
|
|
993
|
+
[name: string]: unknown;
|
|
994
|
+
};
|
|
995
|
+
content: {
|
|
996
|
+
"application/json": components["schemas"]["Error"];
|
|
997
|
+
};
|
|
998
|
+
};
|
|
999
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
1000
|
+
403: {
|
|
1001
|
+
headers: {
|
|
1002
|
+
[name: string]: unknown;
|
|
1003
|
+
};
|
|
1004
|
+
content: {
|
|
1005
|
+
"application/json": components["schemas"]["Error"];
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
/** @description An in-flight request with the same Idempotency-Key is still processing */
|
|
1009
|
+
409: {
|
|
1010
|
+
headers: {
|
|
1011
|
+
[name: string]: unknown;
|
|
1012
|
+
};
|
|
1013
|
+
content: {
|
|
1014
|
+
"application/json": components["schemas"]["Error"];
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
/** @description Idempotency-Key already used with a different request body */
|
|
1018
|
+
422: {
|
|
1019
|
+
headers: {
|
|
1020
|
+
[name: string]: unknown;
|
|
1021
|
+
};
|
|
1022
|
+
content: {
|
|
1023
|
+
"application/json": components["schemas"]["Error"];
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
/** @description Rate limit exceeded */
|
|
1027
|
+
429: {
|
|
1028
|
+
headers: {
|
|
1029
|
+
[name: string]: unknown;
|
|
1030
|
+
};
|
|
1031
|
+
content: {
|
|
1032
|
+
"application/json": components["schemas"]["Error"];
|
|
1033
|
+
};
|
|
1034
|
+
};
|
|
1035
|
+
/** @description Internal error */
|
|
1036
|
+
500: {
|
|
1037
|
+
headers: {
|
|
1038
|
+
[name: string]: unknown;
|
|
1039
|
+
};
|
|
1040
|
+
content: {
|
|
1041
|
+
"application/json": components["schemas"]["Error"];
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1046
|
+
getWallet: {
|
|
1047
|
+
parameters: {
|
|
1048
|
+
query?: never;
|
|
1049
|
+
header?: never;
|
|
1050
|
+
path: {
|
|
1051
|
+
id: string;
|
|
1052
|
+
};
|
|
1053
|
+
cookie?: never;
|
|
1054
|
+
};
|
|
1055
|
+
requestBody?: never;
|
|
1056
|
+
responses: {
|
|
1057
|
+
/** @description Wallet detail */
|
|
1058
|
+
200: {
|
|
1059
|
+
headers: {
|
|
1060
|
+
[name: string]: unknown;
|
|
1061
|
+
};
|
|
1062
|
+
content: {
|
|
1063
|
+
"application/json": components["schemas"]["WalletDetail"];
|
|
1064
|
+
};
|
|
1065
|
+
};
|
|
1066
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1067
|
+
401: {
|
|
1068
|
+
headers: {
|
|
1069
|
+
[name: string]: unknown;
|
|
1070
|
+
};
|
|
1071
|
+
content: {
|
|
1072
|
+
"application/json": components["schemas"]["Error"];
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1075
|
+
/** @description Wallet not found (or not owned by this workspace) */
|
|
1076
|
+
404: {
|
|
1077
|
+
headers: {
|
|
1078
|
+
[name: string]: unknown;
|
|
1079
|
+
};
|
|
1080
|
+
content: {
|
|
1081
|
+
"application/json": components["schemas"]["Error"];
|
|
1082
|
+
};
|
|
1083
|
+
};
|
|
1084
|
+
/** @description Rate limit exceeded */
|
|
1085
|
+
429: {
|
|
1086
|
+
headers: {
|
|
1087
|
+
[name: string]: unknown;
|
|
1088
|
+
};
|
|
1089
|
+
content: {
|
|
1090
|
+
"application/json": components["schemas"]["Error"];
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
};
|
|
1094
|
+
};
|
|
1095
|
+
listCustomers: {
|
|
1096
|
+
parameters: {
|
|
1097
|
+
query?: {
|
|
1098
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
1099
|
+
/** @description Exact-match lookup by your id. */
|
|
1100
|
+
external_ref?: string;
|
|
1101
|
+
page?: number;
|
|
1102
|
+
limit?: number;
|
|
1103
|
+
};
|
|
1104
|
+
header?: never;
|
|
1105
|
+
path?: never;
|
|
1106
|
+
cookie?: never;
|
|
1107
|
+
};
|
|
1108
|
+
requestBody?: never;
|
|
1109
|
+
responses: {
|
|
1110
|
+
/** @description Paginated customers */
|
|
1111
|
+
200: {
|
|
1112
|
+
headers: {
|
|
1113
|
+
[name: string]: unknown;
|
|
1114
|
+
};
|
|
1115
|
+
content: {
|
|
1116
|
+
"application/json": {
|
|
1117
|
+
data?: components["schemas"]["Customer"][];
|
|
1118
|
+
total?: number;
|
|
1119
|
+
page?: number;
|
|
1120
|
+
limit?: number;
|
|
1121
|
+
};
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
createCustomer: {
|
|
1127
|
+
parameters: {
|
|
1128
|
+
query?: never;
|
|
1129
|
+
header?: {
|
|
1130
|
+
/** @description Optional client-chosen key (1–255 chars, A–Z a–z 0–9 _ -; a UUIDv4 is recommended) to make this POST safe to retry. The first request executes; any later request with the SAME key returns the original response unchanged (with header `Idempotent-Replay: true`) WITHOUT re-running the operation, so a retried request never double-creates. Reusing a key with a different request body returns `422` (`code: IDEMPOTENCY_MISMATCH`); a key whose first request is still in flight returns `409` (`code: IDEMPOTENCY_CONFLICT`). Stored for 24h. */
|
|
1131
|
+
"Idempotency-Key"?: components["parameters"]["IdempotencyKeyHeader"];
|
|
1132
|
+
};
|
|
1133
|
+
path?: never;
|
|
1134
|
+
cookie?: never;
|
|
1135
|
+
};
|
|
1136
|
+
requestBody: {
|
|
1137
|
+
content: {
|
|
1138
|
+
"application/json": {
|
|
1139
|
+
/** @description Your opaque id for this end-user (never PII). */
|
|
1140
|
+
external_ref: string;
|
|
1141
|
+
/** @description Optional display name. */
|
|
1142
|
+
label?: string;
|
|
1143
|
+
metadata?: {
|
|
1144
|
+
[key: string]: unknown;
|
|
1145
|
+
};
|
|
1146
|
+
};
|
|
1147
|
+
};
|
|
1148
|
+
};
|
|
1149
|
+
responses: {
|
|
1150
|
+
/** @description Customer created */
|
|
1151
|
+
201: {
|
|
1152
|
+
headers: {
|
|
1153
|
+
[name: string]: unknown;
|
|
1154
|
+
};
|
|
1155
|
+
content: {
|
|
1156
|
+
"application/json": components["schemas"]["Customer"];
|
|
1157
|
+
};
|
|
1158
|
+
};
|
|
1159
|
+
/** @description Validation error */
|
|
1160
|
+
400: {
|
|
1161
|
+
headers: {
|
|
1162
|
+
[name: string]: unknown;
|
|
1163
|
+
};
|
|
1164
|
+
content: {
|
|
1165
|
+
"application/json": components["schemas"]["Error"];
|
|
1166
|
+
};
|
|
1167
|
+
};
|
|
1168
|
+
/** @description Invalid API key / signature */
|
|
1169
|
+
401: {
|
|
1170
|
+
headers: {
|
|
1171
|
+
[name: string]: unknown;
|
|
1172
|
+
};
|
|
1173
|
+
content: {
|
|
1174
|
+
"application/json": components["schemas"]["Error"];
|
|
1175
|
+
};
|
|
1176
|
+
};
|
|
1177
|
+
/** @description Missing customers:write scope */
|
|
1178
|
+
403: {
|
|
1179
|
+
headers: {
|
|
1180
|
+
[name: string]: unknown;
|
|
1181
|
+
};
|
|
1182
|
+
content: {
|
|
1183
|
+
"application/json": components["schemas"]["Error"];
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
/** @description A customer with this external_ref already exists in this mode */
|
|
1187
|
+
409: {
|
|
1188
|
+
headers: {
|
|
1189
|
+
[name: string]: unknown;
|
|
1190
|
+
};
|
|
1191
|
+
content: {
|
|
1192
|
+
"application/json": components["schemas"]["Error"];
|
|
1193
|
+
};
|
|
1194
|
+
};
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1197
|
+
getCustomer: {
|
|
1198
|
+
parameters: {
|
|
1199
|
+
query?: never;
|
|
1200
|
+
header?: never;
|
|
1201
|
+
path: {
|
|
1202
|
+
id: string;
|
|
1203
|
+
};
|
|
1204
|
+
cookie?: never;
|
|
1205
|
+
};
|
|
1206
|
+
requestBody?: never;
|
|
1207
|
+
responses: {
|
|
1208
|
+
/** @description Customer */
|
|
1209
|
+
200: {
|
|
1210
|
+
headers: {
|
|
1211
|
+
[name: string]: unknown;
|
|
1212
|
+
};
|
|
1213
|
+
content: {
|
|
1214
|
+
"application/json": components["schemas"]["Customer"];
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
/** @description Not found */
|
|
1218
|
+
404: {
|
|
1219
|
+
headers: {
|
|
1220
|
+
[name: string]: unknown;
|
|
1221
|
+
};
|
|
1222
|
+
content: {
|
|
1223
|
+
"application/json": components["schemas"]["Error"];
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
};
|
|
1228
|
+
updateCustomer: {
|
|
1229
|
+
parameters: {
|
|
1230
|
+
query?: never;
|
|
1231
|
+
header?: never;
|
|
1232
|
+
path: {
|
|
1233
|
+
id: string;
|
|
1234
|
+
};
|
|
1235
|
+
cookie?: never;
|
|
1236
|
+
};
|
|
1237
|
+
requestBody: {
|
|
1238
|
+
content: {
|
|
1239
|
+
"application/json": {
|
|
1240
|
+
label?: string | null;
|
|
1241
|
+
metadata?: {
|
|
1242
|
+
[key: string]: unknown;
|
|
1243
|
+
} | null;
|
|
1244
|
+
/** @enum {string} */
|
|
1245
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
1246
|
+
};
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
responses: {
|
|
1250
|
+
/** @description Updated customer */
|
|
1251
|
+
200: {
|
|
1252
|
+
headers: {
|
|
1253
|
+
[name: string]: unknown;
|
|
1254
|
+
};
|
|
1255
|
+
content: {
|
|
1256
|
+
"application/json": components["schemas"]["Customer"];
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
/** @description Validation error */
|
|
1260
|
+
400: {
|
|
1261
|
+
headers: {
|
|
1262
|
+
[name: string]: unknown;
|
|
1263
|
+
};
|
|
1264
|
+
content: {
|
|
1265
|
+
"application/json": components["schemas"]["Error"];
|
|
1266
|
+
};
|
|
1267
|
+
};
|
|
1268
|
+
/** @description Not found */
|
|
1269
|
+
404: {
|
|
1270
|
+
headers: {
|
|
1271
|
+
[name: string]: unknown;
|
|
1272
|
+
};
|
|
1273
|
+
content: {
|
|
1274
|
+
"application/json": components["schemas"]["Error"];
|
|
1275
|
+
};
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1279
|
+
listTransactions: {
|
|
1280
|
+
parameters: {
|
|
1281
|
+
query?: {
|
|
1282
|
+
/** @description Filter by transaction type. Omit to return both. */
|
|
1283
|
+
type?: "deposit" | "withdrawal";
|
|
1284
|
+
/** @description Filter by status string */
|
|
1285
|
+
status?: string;
|
|
1286
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
1287
|
+
page?: number;
|
|
1288
|
+
limit?: number;
|
|
1289
|
+
};
|
|
1290
|
+
header?: never;
|
|
1291
|
+
path?: never;
|
|
1292
|
+
cookie?: never;
|
|
1293
|
+
};
|
|
1294
|
+
requestBody?: never;
|
|
1295
|
+
responses: {
|
|
1296
|
+
/** @description Combined transaction list */
|
|
1297
|
+
200: {
|
|
1298
|
+
headers: {
|
|
1299
|
+
[name: string]: unknown;
|
|
1300
|
+
};
|
|
1301
|
+
content: {
|
|
1302
|
+
"application/json": {
|
|
1303
|
+
data?: {
|
|
1304
|
+
deposits?: (components["schemas"]["Deposit"] & {
|
|
1305
|
+
/** @enum {string} */
|
|
1306
|
+
type?: "deposit";
|
|
1307
|
+
})[];
|
|
1308
|
+
withdrawals?: (components["schemas"]["WithdrawalTransaction"] & {
|
|
1309
|
+
/** @enum {string} */
|
|
1310
|
+
type?: "withdrawal";
|
|
1311
|
+
})[];
|
|
1312
|
+
};
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
};
|
|
1316
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1317
|
+
401: {
|
|
1318
|
+
headers: {
|
|
1319
|
+
[name: string]: unknown;
|
|
1320
|
+
};
|
|
1321
|
+
content: {
|
|
1322
|
+
"application/json": components["schemas"]["Error"];
|
|
1323
|
+
};
|
|
1324
|
+
};
|
|
1325
|
+
/** @description Rate limit exceeded */
|
|
1326
|
+
429: {
|
|
1327
|
+
headers: {
|
|
1328
|
+
[name: string]: unknown;
|
|
1329
|
+
};
|
|
1330
|
+
content: {
|
|
1331
|
+
"application/json": components["schemas"]["Error"];
|
|
1332
|
+
};
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
};
|
|
1336
|
+
listDeposits: {
|
|
1337
|
+
parameters: {
|
|
1338
|
+
query?: {
|
|
1339
|
+
/** @description Filter by deposit status */
|
|
1340
|
+
status?: "DETECTED" | "CONFIRMING" | "CONFIRMED" | "SWEPT" | "FAILED" | "FLAGGED" | "REJECTED";
|
|
1341
|
+
/** @description Filter by chain */
|
|
1342
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
1343
|
+
/** @description Filter deposits by wallet. Use this to retrieve all deposits received on a specific wallet address. */
|
|
1344
|
+
wallet_id?: string;
|
|
1345
|
+
/** @description Page number (1-based) */
|
|
1346
|
+
page?: components["parameters"]["PageParam"];
|
|
1347
|
+
/** @description Items per page (max 100) */
|
|
1348
|
+
limit?: components["parameters"]["LimitParam"];
|
|
1349
|
+
};
|
|
1350
|
+
header?: never;
|
|
1351
|
+
path?: never;
|
|
1352
|
+
cookie?: never;
|
|
1353
|
+
};
|
|
1354
|
+
requestBody?: never;
|
|
1355
|
+
responses: {
|
|
1356
|
+
/** @description Paginated deposit list */
|
|
1357
|
+
200: {
|
|
1358
|
+
headers: {
|
|
1359
|
+
[name: string]: unknown;
|
|
1360
|
+
};
|
|
1361
|
+
content: {
|
|
1362
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
1363
|
+
data?: components["schemas"]["Deposit"][];
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
};
|
|
1367
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1368
|
+
401: {
|
|
1369
|
+
headers: {
|
|
1370
|
+
[name: string]: unknown;
|
|
1371
|
+
};
|
|
1372
|
+
content: {
|
|
1373
|
+
"application/json": components["schemas"]["Error"];
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
/** @description Rate limit exceeded */
|
|
1377
|
+
429: {
|
|
1378
|
+
headers: {
|
|
1379
|
+
[name: string]: unknown;
|
|
1380
|
+
};
|
|
1381
|
+
content: {
|
|
1382
|
+
"application/json": components["schemas"]["Error"];
|
|
1383
|
+
};
|
|
1384
|
+
};
|
|
1385
|
+
};
|
|
1386
|
+
};
|
|
1387
|
+
getDeposit: {
|
|
1388
|
+
parameters: {
|
|
1389
|
+
query?: never;
|
|
1390
|
+
header?: never;
|
|
1391
|
+
path: {
|
|
1392
|
+
id: string;
|
|
1393
|
+
};
|
|
1394
|
+
cookie?: never;
|
|
1395
|
+
};
|
|
1396
|
+
requestBody?: never;
|
|
1397
|
+
responses: {
|
|
1398
|
+
/** @description Deposit detail */
|
|
1399
|
+
200: {
|
|
1400
|
+
headers: {
|
|
1401
|
+
[name: string]: unknown;
|
|
1402
|
+
};
|
|
1403
|
+
content: {
|
|
1404
|
+
"application/json": components["schemas"]["Deposit"];
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1407
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1408
|
+
401: {
|
|
1409
|
+
headers: {
|
|
1410
|
+
[name: string]: unknown;
|
|
1411
|
+
};
|
|
1412
|
+
content: {
|
|
1413
|
+
"application/json": components["schemas"]["Error"];
|
|
1414
|
+
};
|
|
1415
|
+
};
|
|
1416
|
+
/** @description Deposit not found */
|
|
1417
|
+
404: {
|
|
1418
|
+
headers: {
|
|
1419
|
+
[name: string]: unknown;
|
|
1420
|
+
};
|
|
1421
|
+
content: {
|
|
1422
|
+
"application/json": components["schemas"]["Error"];
|
|
1423
|
+
};
|
|
1424
|
+
};
|
|
1425
|
+
/** @description Rate limit exceeded */
|
|
1426
|
+
429: {
|
|
1427
|
+
headers: {
|
|
1428
|
+
[name: string]: unknown;
|
|
1429
|
+
};
|
|
1430
|
+
content: {
|
|
1431
|
+
"application/json": components["schemas"]["Error"];
|
|
1432
|
+
};
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
listTransactionWithdrawals: {
|
|
1437
|
+
parameters: {
|
|
1438
|
+
query?: {
|
|
1439
|
+
/** @description Filter by withdrawal status */
|
|
1440
|
+
status?: "PENDING_APPROVAL" | "PENDING" | "UNDER_REVIEW" | "PROCESSING" | "CONFIRMING" | "CONFIRMED" | "FAILED" | "CANCELLED";
|
|
1441
|
+
/** @description Filter by chain */
|
|
1442
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
1443
|
+
/** @description Page number (1-based) */
|
|
1444
|
+
page?: components["parameters"]["PageParam"];
|
|
1445
|
+
/** @description Items per page (max 100) */
|
|
1446
|
+
limit?: components["parameters"]["LimitParam"];
|
|
1447
|
+
};
|
|
1448
|
+
header?: never;
|
|
1449
|
+
path?: never;
|
|
1450
|
+
cookie?: never;
|
|
1451
|
+
};
|
|
1452
|
+
requestBody?: never;
|
|
1453
|
+
responses: {
|
|
1454
|
+
/** @description Paginated withdrawal list with fee records */
|
|
1455
|
+
200: {
|
|
1456
|
+
headers: {
|
|
1457
|
+
[name: string]: unknown;
|
|
1458
|
+
};
|
|
1459
|
+
content: {
|
|
1460
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
1461
|
+
data?: components["schemas"]["WithdrawalTransaction"][];
|
|
1462
|
+
};
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1466
|
+
401: {
|
|
1467
|
+
headers: {
|
|
1468
|
+
[name: string]: unknown;
|
|
1469
|
+
};
|
|
1470
|
+
content: {
|
|
1471
|
+
"application/json": components["schemas"]["Error"];
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1474
|
+
/** @description Rate limit exceeded */
|
|
1475
|
+
429: {
|
|
1476
|
+
headers: {
|
|
1477
|
+
[name: string]: unknown;
|
|
1478
|
+
};
|
|
1479
|
+
content: {
|
|
1480
|
+
"application/json": components["schemas"]["Error"];
|
|
1481
|
+
};
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
};
|
|
1485
|
+
getBalances: {
|
|
1486
|
+
parameters: {
|
|
1487
|
+
query?: never;
|
|
1488
|
+
header?: never;
|
|
1489
|
+
path?: never;
|
|
1490
|
+
cookie?: never;
|
|
1491
|
+
};
|
|
1492
|
+
requestBody?: never;
|
|
1493
|
+
responses: {
|
|
1494
|
+
/** @description Balances per asset */
|
|
1495
|
+
200: {
|
|
1496
|
+
headers: {
|
|
1497
|
+
[name: string]: unknown;
|
|
1498
|
+
};
|
|
1499
|
+
content: {
|
|
1500
|
+
"application/json": {
|
|
1501
|
+
data?: components["schemas"]["Balance"][];
|
|
1502
|
+
};
|
|
1503
|
+
};
|
|
1504
|
+
};
|
|
1505
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1506
|
+
401: {
|
|
1507
|
+
headers: {
|
|
1508
|
+
[name: string]: unknown;
|
|
1509
|
+
};
|
|
1510
|
+
content: {
|
|
1511
|
+
"application/json": components["schemas"]["Error"];
|
|
1512
|
+
};
|
|
1513
|
+
};
|
|
1514
|
+
/** @description Rate limit exceeded */
|
|
1515
|
+
429: {
|
|
1516
|
+
headers: {
|
|
1517
|
+
[name: string]: unknown;
|
|
1518
|
+
};
|
|
1519
|
+
content: {
|
|
1520
|
+
"application/json": components["schemas"]["Error"];
|
|
1521
|
+
};
|
|
1522
|
+
};
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
listWithdrawals: {
|
|
1526
|
+
parameters: {
|
|
1527
|
+
query?: {
|
|
1528
|
+
/** @description Filter by withdrawal status */
|
|
1529
|
+
status?: "PENDING_APPROVAL" | "PENDING" | "UNDER_REVIEW" | "PROCESSING" | "CONFIRMING" | "CONFIRMED" | "FAILED" | "CANCELLED";
|
|
1530
|
+
/** @description Page number (1-based) */
|
|
1531
|
+
page?: components["parameters"]["PageParam"];
|
|
1532
|
+
/** @description Items per page (max 100) */
|
|
1533
|
+
limit?: components["parameters"]["LimitParam"];
|
|
1534
|
+
};
|
|
1535
|
+
header?: never;
|
|
1536
|
+
path?: never;
|
|
1537
|
+
cookie?: never;
|
|
1538
|
+
};
|
|
1539
|
+
requestBody?: never;
|
|
1540
|
+
responses: {
|
|
1541
|
+
/** @description Paginated withdrawal list */
|
|
1542
|
+
200: {
|
|
1543
|
+
headers: {
|
|
1544
|
+
[name: string]: unknown;
|
|
1545
|
+
};
|
|
1546
|
+
content: {
|
|
1547
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
1548
|
+
data?: components["schemas"]["Withdrawal"][];
|
|
1549
|
+
};
|
|
1550
|
+
};
|
|
1551
|
+
};
|
|
1552
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1553
|
+
401: {
|
|
1554
|
+
headers: {
|
|
1555
|
+
[name: string]: unknown;
|
|
1556
|
+
};
|
|
1557
|
+
content: {
|
|
1558
|
+
"application/json": components["schemas"]["Error"];
|
|
1559
|
+
};
|
|
1560
|
+
};
|
|
1561
|
+
/** @description Rate limit exceeded */
|
|
1562
|
+
429: {
|
|
1563
|
+
headers: {
|
|
1564
|
+
[name: string]: unknown;
|
|
1565
|
+
};
|
|
1566
|
+
content: {
|
|
1567
|
+
"application/json": components["schemas"]["Error"];
|
|
1568
|
+
};
|
|
1569
|
+
};
|
|
1570
|
+
};
|
|
1571
|
+
};
|
|
1572
|
+
createWithdrawal: {
|
|
1573
|
+
parameters: {
|
|
1574
|
+
query?: never;
|
|
1575
|
+
header?: {
|
|
1576
|
+
/** @description Optional client-chosen key (1–255 chars, A–Z a–z 0–9 _ -; a UUIDv4 is recommended) to make this POST safe to retry. The first request executes; any later request with the SAME key returns the original response unchanged (with header `Idempotent-Replay: true`) WITHOUT re-running the operation, so a retried request never double-creates. Reusing a key with a different request body returns `422` (`code: IDEMPOTENCY_MISMATCH`); a key whose first request is still in flight returns `409` (`code: IDEMPOTENCY_CONFLICT`). Stored for 24h. */
|
|
1577
|
+
"Idempotency-Key"?: components["parameters"]["IdempotencyKeyHeader"];
|
|
1578
|
+
};
|
|
1579
|
+
path?: never;
|
|
1580
|
+
cookie?: never;
|
|
1581
|
+
};
|
|
1582
|
+
requestBody: {
|
|
1583
|
+
content: {
|
|
1584
|
+
"application/json": {
|
|
1585
|
+
/**
|
|
1586
|
+
* @description Base protocol. The network is derived from your API key.
|
|
1587
|
+
* @enum {string}
|
|
1588
|
+
*/
|
|
1589
|
+
chain: "TRON" | "BSC" | "ETH";
|
|
1590
|
+
/**
|
|
1591
|
+
* @description Must be compatible with the chain. TRON_MAINNET/TRON_TESTNET: USDT_TRON | BSC_MAINNET/BSC_TESTNET: USDT_BSC, BNB | ETH_MAINNET/ETH_TESTNET: USDT_ETH, USDC_ETH, ETH.
|
|
1592
|
+
* @enum {string}
|
|
1593
|
+
*/
|
|
1594
|
+
asset: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
1595
|
+
/**
|
|
1596
|
+
* @description Amount to withdraw in human-readable units. Example: "50.000000" for 50 USDT, "0.500000000000000000" for 0.5 ETH. Do not send raw blockchain units.
|
|
1597
|
+
* @example 50.000000
|
|
1598
|
+
*/
|
|
1599
|
+
amount: string;
|
|
1600
|
+
/** @description On-chain recipient address matching the chain. TRON: base58 format (Txxxx). BSC/ETH: checksummed hex (0xxxxx). */
|
|
1601
|
+
destination_address: string;
|
|
1602
|
+
/**
|
|
1603
|
+
* @deprecated
|
|
1604
|
+
* @description DEPRECATED, prefer the `Idempotency-Key` header. Still accepted (optional) for backward compatibility. The header takes precedence when both are sent.
|
|
1605
|
+
*/
|
|
1606
|
+
idempotency_key?: string;
|
|
1607
|
+
};
|
|
1608
|
+
};
|
|
1609
|
+
};
|
|
1610
|
+
responses: {
|
|
1611
|
+
/** @description Idempotent replay, the original withdrawal for this key (response header `Idempotent-Replay: true`). */
|
|
1612
|
+
200: {
|
|
1613
|
+
headers: {
|
|
1614
|
+
[name: string]: unknown;
|
|
1615
|
+
};
|
|
1616
|
+
content: {
|
|
1617
|
+
"application/json": components["schemas"]["WithdrawalCreated"];
|
|
1618
|
+
};
|
|
1619
|
+
};
|
|
1620
|
+
/** @description Withdrawal created and amount locked */
|
|
1621
|
+
201: {
|
|
1622
|
+
headers: {
|
|
1623
|
+
[name: string]: unknown;
|
|
1624
|
+
};
|
|
1625
|
+
content: {
|
|
1626
|
+
"application/json": components["schemas"]["WithdrawalCreated"];
|
|
1627
|
+
};
|
|
1628
|
+
};
|
|
1629
|
+
/** @description Validation error, incompatible chain/asset pair, or malformed destination address for the chain */
|
|
1630
|
+
400: {
|
|
1631
|
+
headers: {
|
|
1632
|
+
[name: string]: unknown;
|
|
1633
|
+
};
|
|
1634
|
+
content: {
|
|
1635
|
+
"application/json": components["schemas"]["Error"];
|
|
1636
|
+
};
|
|
1637
|
+
};
|
|
1638
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1639
|
+
401: {
|
|
1640
|
+
headers: {
|
|
1641
|
+
[name: string]: unknown;
|
|
1642
|
+
};
|
|
1643
|
+
content: {
|
|
1644
|
+
"application/json": components["schemas"]["Error"];
|
|
1645
|
+
};
|
|
1646
|
+
};
|
|
1647
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
1648
|
+
403: {
|
|
1649
|
+
headers: {
|
|
1650
|
+
[name: string]: unknown;
|
|
1651
|
+
};
|
|
1652
|
+
content: {
|
|
1653
|
+
"application/json": components["schemas"]["Error"];
|
|
1654
|
+
};
|
|
1655
|
+
};
|
|
1656
|
+
/** @description An in-flight request with the same Idempotency-Key is still processing */
|
|
1657
|
+
409: {
|
|
1658
|
+
headers: {
|
|
1659
|
+
[name: string]: unknown;
|
|
1660
|
+
};
|
|
1661
|
+
content: {
|
|
1662
|
+
"application/json": components["schemas"]["Error"];
|
|
1663
|
+
};
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* @description Insufficient available balance, amount too small, or the Idempotency-Key was already used with a different request body (a replay of the SAME request returns 200, not 422).
|
|
1667
|
+
*
|
|
1668
|
+
* Also returned (MAINNET only) when the workspace's withdrawal security blocks the request: the destination is not in the workspace allowlist (or still in its cooling-off period), the amount exceeds the per-transaction limit, or it would exceed the rolling-24h limit. These are managed by the workspace OWNER from the dashboard.
|
|
1669
|
+
*/
|
|
1670
|
+
422: {
|
|
1671
|
+
headers: {
|
|
1672
|
+
[name: string]: unknown;
|
|
1673
|
+
};
|
|
1674
|
+
content: {
|
|
1675
|
+
"application/json": components["schemas"]["Error"];
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1678
|
+
/** @description Rate limit exceeded */
|
|
1679
|
+
429: {
|
|
1680
|
+
headers: {
|
|
1681
|
+
[name: string]: unknown;
|
|
1682
|
+
};
|
|
1683
|
+
content: {
|
|
1684
|
+
"application/json": components["schemas"]["Error"];
|
|
1685
|
+
};
|
|
1686
|
+
};
|
|
1687
|
+
/** @description Internal error */
|
|
1688
|
+
500: {
|
|
1689
|
+
headers: {
|
|
1690
|
+
[name: string]: unknown;
|
|
1691
|
+
};
|
|
1692
|
+
content: {
|
|
1693
|
+
"application/json": components["schemas"]["Error"];
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
getWithdrawal: {
|
|
1699
|
+
parameters: {
|
|
1700
|
+
query?: never;
|
|
1701
|
+
header?: never;
|
|
1702
|
+
path: {
|
|
1703
|
+
id: string;
|
|
1704
|
+
};
|
|
1705
|
+
cookie?: never;
|
|
1706
|
+
};
|
|
1707
|
+
requestBody?: never;
|
|
1708
|
+
responses: {
|
|
1709
|
+
/** @description Withdrawal detail */
|
|
1710
|
+
200: {
|
|
1711
|
+
headers: {
|
|
1712
|
+
[name: string]: unknown;
|
|
1713
|
+
};
|
|
1714
|
+
content: {
|
|
1715
|
+
"application/json": components["schemas"]["Withdrawal"] & {
|
|
1716
|
+
fee_record?: components["schemas"]["FeeRecord"] | null;
|
|
1717
|
+
};
|
|
1718
|
+
};
|
|
1719
|
+
};
|
|
1720
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1721
|
+
401: {
|
|
1722
|
+
headers: {
|
|
1723
|
+
[name: string]: unknown;
|
|
1724
|
+
};
|
|
1725
|
+
content: {
|
|
1726
|
+
"application/json": components["schemas"]["Error"];
|
|
1727
|
+
};
|
|
1728
|
+
};
|
|
1729
|
+
/** @description Withdrawal not found */
|
|
1730
|
+
404: {
|
|
1731
|
+
headers: {
|
|
1732
|
+
[name: string]: unknown;
|
|
1733
|
+
};
|
|
1734
|
+
content: {
|
|
1735
|
+
"application/json": components["schemas"]["Error"];
|
|
1736
|
+
};
|
|
1737
|
+
};
|
|
1738
|
+
/** @description Rate limit exceeded */
|
|
1739
|
+
429: {
|
|
1740
|
+
headers: {
|
|
1741
|
+
[name: string]: unknown;
|
|
1742
|
+
};
|
|
1743
|
+
content: {
|
|
1744
|
+
"application/json": components["schemas"]["Error"];
|
|
1745
|
+
};
|
|
1746
|
+
};
|
|
1747
|
+
};
|
|
1748
|
+
};
|
|
1749
|
+
cancelWithdrawal: {
|
|
1750
|
+
parameters: {
|
|
1751
|
+
query?: never;
|
|
1752
|
+
header?: never;
|
|
1753
|
+
path: {
|
|
1754
|
+
id: string;
|
|
1755
|
+
};
|
|
1756
|
+
cookie?: never;
|
|
1757
|
+
};
|
|
1758
|
+
requestBody?: never;
|
|
1759
|
+
responses: {
|
|
1760
|
+
/** @description Withdrawal cancelled and balance restored */
|
|
1761
|
+
200: {
|
|
1762
|
+
headers: {
|
|
1763
|
+
[name: string]: unknown;
|
|
1764
|
+
};
|
|
1765
|
+
content: {
|
|
1766
|
+
"application/json": {
|
|
1767
|
+
/** @example Withdrawal cancelled successfully. */
|
|
1768
|
+
message?: string;
|
|
1769
|
+
};
|
|
1770
|
+
};
|
|
1771
|
+
};
|
|
1772
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1773
|
+
401: {
|
|
1774
|
+
headers: {
|
|
1775
|
+
[name: string]: unknown;
|
|
1776
|
+
};
|
|
1777
|
+
content: {
|
|
1778
|
+
"application/json": components["schemas"]["Error"];
|
|
1779
|
+
};
|
|
1780
|
+
};
|
|
1781
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
1782
|
+
403: {
|
|
1783
|
+
headers: {
|
|
1784
|
+
[name: string]: unknown;
|
|
1785
|
+
};
|
|
1786
|
+
content: {
|
|
1787
|
+
"application/json": components["schemas"]["Error"];
|
|
1788
|
+
};
|
|
1789
|
+
};
|
|
1790
|
+
/** @description Withdrawal not found (or not owned by this workspace) */
|
|
1791
|
+
404: {
|
|
1792
|
+
headers: {
|
|
1793
|
+
[name: string]: unknown;
|
|
1794
|
+
};
|
|
1795
|
+
content: {
|
|
1796
|
+
"application/json": components["schemas"]["Error"];
|
|
1797
|
+
};
|
|
1798
|
+
};
|
|
1799
|
+
/** @description Withdrawal is not in PENDING status and cannot be cancelled */
|
|
1800
|
+
422: {
|
|
1801
|
+
headers: {
|
|
1802
|
+
[name: string]: unknown;
|
|
1803
|
+
};
|
|
1804
|
+
content: {
|
|
1805
|
+
"application/json": components["schemas"]["Error"];
|
|
1806
|
+
};
|
|
1807
|
+
};
|
|
1808
|
+
/** @description Rate limit exceeded */
|
|
1809
|
+
429: {
|
|
1810
|
+
headers: {
|
|
1811
|
+
[name: string]: unknown;
|
|
1812
|
+
};
|
|
1813
|
+
content: {
|
|
1814
|
+
"application/json": components["schemas"]["Error"];
|
|
1815
|
+
};
|
|
1816
|
+
};
|
|
1817
|
+
};
|
|
1818
|
+
};
|
|
1819
|
+
quoteFee: {
|
|
1820
|
+
parameters: {
|
|
1821
|
+
query?: never;
|
|
1822
|
+
header?: never;
|
|
1823
|
+
path?: never;
|
|
1824
|
+
cookie?: never;
|
|
1825
|
+
};
|
|
1826
|
+
requestBody: {
|
|
1827
|
+
content: {
|
|
1828
|
+
"application/json": {
|
|
1829
|
+
/** @enum {string} */
|
|
1830
|
+
direction: "deposit" | "withdrawal";
|
|
1831
|
+
/**
|
|
1832
|
+
* @description Base protocol. Network derives from the API key.
|
|
1833
|
+
* @enum {string}
|
|
1834
|
+
*/
|
|
1835
|
+
chain: "TRON" | "BSC" | "ETH";
|
|
1836
|
+
/** @enum {string} */
|
|
1837
|
+
asset: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
1838
|
+
/**
|
|
1839
|
+
* @description Positive decimal string. In `charge` mode = gross; in `gross_up` mode = desired net.
|
|
1840
|
+
* @example 50.000000
|
|
1841
|
+
*/
|
|
1842
|
+
amount: string;
|
|
1843
|
+
/**
|
|
1844
|
+
* @default charge
|
|
1845
|
+
* @enum {string}
|
|
1846
|
+
*/
|
|
1847
|
+
mode?: "charge" | "gross_up";
|
|
1848
|
+
};
|
|
1849
|
+
};
|
|
1850
|
+
};
|
|
1851
|
+
responses: {
|
|
1852
|
+
/** @description Fee quote computed. */
|
|
1853
|
+
200: {
|
|
1854
|
+
headers: {
|
|
1855
|
+
[name: string]: unknown;
|
|
1856
|
+
};
|
|
1857
|
+
content: {
|
|
1858
|
+
"application/json": components["schemas"]["FeeQuote"];
|
|
1859
|
+
};
|
|
1860
|
+
};
|
|
1861
|
+
/** @description Validation error (bad direction/chain/asset/mode, or asset not supported on chain) */
|
|
1862
|
+
400: {
|
|
1863
|
+
headers: {
|
|
1864
|
+
[name: string]: unknown;
|
|
1865
|
+
};
|
|
1866
|
+
content: {
|
|
1867
|
+
"application/json": components["schemas"]["Error"];
|
|
1868
|
+
};
|
|
1869
|
+
};
|
|
1870
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1871
|
+
401: {
|
|
1872
|
+
headers: {
|
|
1873
|
+
[name: string]: unknown;
|
|
1874
|
+
};
|
|
1875
|
+
content: {
|
|
1876
|
+
"application/json": components["schemas"]["Error"];
|
|
1877
|
+
};
|
|
1878
|
+
};
|
|
1879
|
+
/** @description Rate limit exceeded */
|
|
1880
|
+
429: {
|
|
1881
|
+
headers: {
|
|
1882
|
+
[name: string]: unknown;
|
|
1883
|
+
};
|
|
1884
|
+
content: {
|
|
1885
|
+
"application/json": components["schemas"]["Error"];
|
|
1886
|
+
};
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
};
|
|
1890
|
+
listWebhookEndpoints: {
|
|
1891
|
+
parameters: {
|
|
1892
|
+
query?: {
|
|
1893
|
+
/** @description Page number (1-based) */
|
|
1894
|
+
page?: components["parameters"]["PageParam"];
|
|
1895
|
+
/** @description Items per page (max 100) */
|
|
1896
|
+
limit?: components["parameters"]["LimitParam"];
|
|
1897
|
+
};
|
|
1898
|
+
header?: never;
|
|
1899
|
+
path?: never;
|
|
1900
|
+
cookie?: never;
|
|
1901
|
+
};
|
|
1902
|
+
requestBody?: never;
|
|
1903
|
+
responses: {
|
|
1904
|
+
/** @description Paginated endpoint list */
|
|
1905
|
+
200: {
|
|
1906
|
+
headers: {
|
|
1907
|
+
[name: string]: unknown;
|
|
1908
|
+
};
|
|
1909
|
+
content: {
|
|
1910
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
1911
|
+
data?: components["schemas"]["WebhookEndpoint"][];
|
|
1912
|
+
};
|
|
1913
|
+
};
|
|
1914
|
+
};
|
|
1915
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1916
|
+
401: {
|
|
1917
|
+
headers: {
|
|
1918
|
+
[name: string]: unknown;
|
|
1919
|
+
};
|
|
1920
|
+
content: {
|
|
1921
|
+
"application/json": components["schemas"]["Error"];
|
|
1922
|
+
};
|
|
1923
|
+
};
|
|
1924
|
+
/** @description Rate limit exceeded */
|
|
1925
|
+
429: {
|
|
1926
|
+
headers: {
|
|
1927
|
+
[name: string]: unknown;
|
|
1928
|
+
};
|
|
1929
|
+
content: {
|
|
1930
|
+
"application/json": components["schemas"]["Error"];
|
|
1931
|
+
};
|
|
1932
|
+
};
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
createWebhookEndpoint: {
|
|
1936
|
+
parameters: {
|
|
1937
|
+
query?: never;
|
|
1938
|
+
header?: never;
|
|
1939
|
+
path?: never;
|
|
1940
|
+
cookie?: never;
|
|
1941
|
+
};
|
|
1942
|
+
requestBody: {
|
|
1943
|
+
content: {
|
|
1944
|
+
"application/json": {
|
|
1945
|
+
/**
|
|
1946
|
+
* Format: uri
|
|
1947
|
+
* @description Publicly reachable HTTPS URL only. Private/local addresses are rejected.
|
|
1948
|
+
*/
|
|
1949
|
+
url: string;
|
|
1950
|
+
events: ("DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED")[];
|
|
1951
|
+
};
|
|
1952
|
+
};
|
|
1953
|
+
};
|
|
1954
|
+
responses: {
|
|
1955
|
+
/** @description Endpoint created. `secret` shown only at creation, store it securely. */
|
|
1956
|
+
201: {
|
|
1957
|
+
headers: {
|
|
1958
|
+
[name: string]: unknown;
|
|
1959
|
+
};
|
|
1960
|
+
content: {
|
|
1961
|
+
"application/json": components["schemas"]["WebhookEndpoint"] & {
|
|
1962
|
+
/** @description HMAC signing secret, shown once only. */
|
|
1963
|
+
secret?: string;
|
|
1964
|
+
};
|
|
1965
|
+
};
|
|
1966
|
+
};
|
|
1967
|
+
/** @description Validation error or private/local URL rejected */
|
|
1968
|
+
400: {
|
|
1969
|
+
headers: {
|
|
1970
|
+
[name: string]: unknown;
|
|
1971
|
+
};
|
|
1972
|
+
content: {
|
|
1973
|
+
"application/json": components["schemas"]["Error"];
|
|
1974
|
+
};
|
|
1975
|
+
};
|
|
1976
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
1977
|
+
401: {
|
|
1978
|
+
headers: {
|
|
1979
|
+
[name: string]: unknown;
|
|
1980
|
+
};
|
|
1981
|
+
content: {
|
|
1982
|
+
"application/json": components["schemas"]["Error"];
|
|
1983
|
+
};
|
|
1984
|
+
};
|
|
1985
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
1986
|
+
403: {
|
|
1987
|
+
headers: {
|
|
1988
|
+
[name: string]: unknown;
|
|
1989
|
+
};
|
|
1990
|
+
content: {
|
|
1991
|
+
"application/json": components["schemas"]["Error"];
|
|
1992
|
+
};
|
|
1993
|
+
};
|
|
1994
|
+
/** @description Maximum webhook endpoints per workspace (10) reached */
|
|
1995
|
+
422: {
|
|
1996
|
+
headers: {
|
|
1997
|
+
[name: string]: unknown;
|
|
1998
|
+
};
|
|
1999
|
+
content: {
|
|
2000
|
+
"application/json": components["schemas"]["Error"];
|
|
2001
|
+
};
|
|
2002
|
+
};
|
|
2003
|
+
/** @description Rate limit exceeded */
|
|
2004
|
+
429: {
|
|
2005
|
+
headers: {
|
|
2006
|
+
[name: string]: unknown;
|
|
2007
|
+
};
|
|
2008
|
+
content: {
|
|
2009
|
+
"application/json": components["schemas"]["Error"];
|
|
2010
|
+
};
|
|
2011
|
+
};
|
|
2012
|
+
};
|
|
2013
|
+
};
|
|
2014
|
+
deleteWebhookEndpoint: {
|
|
2015
|
+
parameters: {
|
|
2016
|
+
query?: never;
|
|
2017
|
+
header?: never;
|
|
2018
|
+
path: {
|
|
2019
|
+
id: string;
|
|
2020
|
+
};
|
|
2021
|
+
cookie?: never;
|
|
2022
|
+
};
|
|
2023
|
+
requestBody?: never;
|
|
2024
|
+
responses: {
|
|
2025
|
+
/** @description Endpoint deleted */
|
|
2026
|
+
200: {
|
|
2027
|
+
headers: {
|
|
2028
|
+
[name: string]: unknown;
|
|
2029
|
+
};
|
|
2030
|
+
content: {
|
|
2031
|
+
"application/json": {
|
|
2032
|
+
/** @example Webhook endpoint deleted. */
|
|
2033
|
+
message?: string;
|
|
2034
|
+
};
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
2037
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2038
|
+
401: {
|
|
2039
|
+
headers: {
|
|
2040
|
+
[name: string]: unknown;
|
|
2041
|
+
};
|
|
2042
|
+
content: {
|
|
2043
|
+
"application/json": components["schemas"]["Error"];
|
|
2044
|
+
};
|
|
2045
|
+
};
|
|
2046
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
2047
|
+
403: {
|
|
2048
|
+
headers: {
|
|
2049
|
+
[name: string]: unknown;
|
|
2050
|
+
};
|
|
2051
|
+
content: {
|
|
2052
|
+
"application/json": components["schemas"]["Error"];
|
|
2053
|
+
};
|
|
2054
|
+
};
|
|
2055
|
+
/** @description Webhook endpoint not found */
|
|
2056
|
+
404: {
|
|
2057
|
+
headers: {
|
|
2058
|
+
[name: string]: unknown;
|
|
2059
|
+
};
|
|
2060
|
+
content: {
|
|
2061
|
+
"application/json": components["schemas"]["Error"];
|
|
2062
|
+
};
|
|
2063
|
+
};
|
|
2064
|
+
/** @description Endpoint has PENDING deliveries, cannot delete yet */
|
|
2065
|
+
422: {
|
|
2066
|
+
headers: {
|
|
2067
|
+
[name: string]: unknown;
|
|
2068
|
+
};
|
|
2069
|
+
content: {
|
|
2070
|
+
"application/json": components["schemas"]["Error"];
|
|
2071
|
+
};
|
|
2072
|
+
};
|
|
2073
|
+
/** @description Rate limit exceeded */
|
|
2074
|
+
429: {
|
|
2075
|
+
headers: {
|
|
2076
|
+
[name: string]: unknown;
|
|
2077
|
+
};
|
|
2078
|
+
content: {
|
|
2079
|
+
"application/json": components["schemas"]["Error"];
|
|
2080
|
+
};
|
|
2081
|
+
};
|
|
2082
|
+
};
|
|
2083
|
+
};
|
|
2084
|
+
updateWebhookEndpoint: {
|
|
2085
|
+
parameters: {
|
|
2086
|
+
query?: never;
|
|
2087
|
+
header?: never;
|
|
2088
|
+
path: {
|
|
2089
|
+
id: string;
|
|
2090
|
+
};
|
|
2091
|
+
cookie?: never;
|
|
2092
|
+
};
|
|
2093
|
+
requestBody: {
|
|
2094
|
+
content: {
|
|
2095
|
+
"application/json": {
|
|
2096
|
+
/**
|
|
2097
|
+
* Format: uri
|
|
2098
|
+
* @description Publicly reachable HTTPS URL only.
|
|
2099
|
+
*/
|
|
2100
|
+
url?: string;
|
|
2101
|
+
events?: ("DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED")[];
|
|
2102
|
+
is_active?: boolean;
|
|
2103
|
+
};
|
|
2104
|
+
};
|
|
2105
|
+
};
|
|
2106
|
+
responses: {
|
|
2107
|
+
/** @description Updated endpoint */
|
|
2108
|
+
200: {
|
|
2109
|
+
headers: {
|
|
2110
|
+
[name: string]: unknown;
|
|
2111
|
+
};
|
|
2112
|
+
content: {
|
|
2113
|
+
"application/json": components["schemas"]["WebhookEndpoint"];
|
|
2114
|
+
};
|
|
2115
|
+
};
|
|
2116
|
+
/** @description Validation error */
|
|
2117
|
+
400: {
|
|
2118
|
+
headers: {
|
|
2119
|
+
[name: string]: unknown;
|
|
2120
|
+
};
|
|
2121
|
+
content: {
|
|
2122
|
+
"application/json": components["schemas"]["Error"];
|
|
2123
|
+
};
|
|
2124
|
+
};
|
|
2125
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2126
|
+
401: {
|
|
2127
|
+
headers: {
|
|
2128
|
+
[name: string]: unknown;
|
|
2129
|
+
};
|
|
2130
|
+
content: {
|
|
2131
|
+
"application/json": components["schemas"]["Error"];
|
|
2132
|
+
};
|
|
2133
|
+
};
|
|
2134
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
2135
|
+
403: {
|
|
2136
|
+
headers: {
|
|
2137
|
+
[name: string]: unknown;
|
|
2138
|
+
};
|
|
2139
|
+
content: {
|
|
2140
|
+
"application/json": components["schemas"]["Error"];
|
|
2141
|
+
};
|
|
2142
|
+
};
|
|
2143
|
+
/** @description Webhook endpoint not found */
|
|
2144
|
+
404: {
|
|
2145
|
+
headers: {
|
|
2146
|
+
[name: string]: unknown;
|
|
2147
|
+
};
|
|
2148
|
+
content: {
|
|
2149
|
+
"application/json": components["schemas"]["Error"];
|
|
2150
|
+
};
|
|
2151
|
+
};
|
|
2152
|
+
/** @description Rate limit exceeded */
|
|
2153
|
+
429: {
|
|
2154
|
+
headers: {
|
|
2155
|
+
[name: string]: unknown;
|
|
2156
|
+
};
|
|
2157
|
+
content: {
|
|
2158
|
+
"application/json": components["schemas"]["Error"];
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
};
|
|
2162
|
+
};
|
|
2163
|
+
rotateWebhookSecret: {
|
|
2164
|
+
parameters: {
|
|
2165
|
+
query?: never;
|
|
2166
|
+
header?: never;
|
|
2167
|
+
path: {
|
|
2168
|
+
id: string;
|
|
2169
|
+
};
|
|
2170
|
+
cookie?: never;
|
|
2171
|
+
};
|
|
2172
|
+
requestBody?: never;
|
|
2173
|
+
responses: {
|
|
2174
|
+
/** @description Secret rotated. `secret` shown only once. */
|
|
2175
|
+
200: {
|
|
2176
|
+
headers: {
|
|
2177
|
+
[name: string]: unknown;
|
|
2178
|
+
};
|
|
2179
|
+
content: {
|
|
2180
|
+
"application/json": {
|
|
2181
|
+
/** Format: uuid */
|
|
2182
|
+
id?: string;
|
|
2183
|
+
url?: string;
|
|
2184
|
+
events?: string[];
|
|
2185
|
+
is_active?: boolean;
|
|
2186
|
+
/** Format: date-time */
|
|
2187
|
+
created_at?: string;
|
|
2188
|
+
/** @description New signing secret, shown once only. */
|
|
2189
|
+
secret?: string;
|
|
2190
|
+
/**
|
|
2191
|
+
* Format: date-time
|
|
2192
|
+
* @description When the previous secret (and its second signature header) stops being valid.
|
|
2193
|
+
*/
|
|
2194
|
+
previous_secret_expires_at?: string;
|
|
2195
|
+
};
|
|
2196
|
+
};
|
|
2197
|
+
};
|
|
2198
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2199
|
+
401: {
|
|
2200
|
+
headers: {
|
|
2201
|
+
[name: string]: unknown;
|
|
2202
|
+
};
|
|
2203
|
+
content: {
|
|
2204
|
+
"application/json": components["schemas"]["Error"];
|
|
2205
|
+
};
|
|
2206
|
+
};
|
|
2207
|
+
/** @description Missing the webhooks:write scope */
|
|
2208
|
+
403: {
|
|
2209
|
+
headers: {
|
|
2210
|
+
[name: string]: unknown;
|
|
2211
|
+
};
|
|
2212
|
+
content: {
|
|
2213
|
+
"application/json": components["schemas"]["Error"];
|
|
2214
|
+
};
|
|
2215
|
+
};
|
|
2216
|
+
/** @description Webhook endpoint not found */
|
|
2217
|
+
404: {
|
|
2218
|
+
headers: {
|
|
2219
|
+
[name: string]: unknown;
|
|
2220
|
+
};
|
|
2221
|
+
content: {
|
|
2222
|
+
"application/json": components["schemas"]["Error"];
|
|
2223
|
+
};
|
|
2224
|
+
};
|
|
2225
|
+
};
|
|
2226
|
+
};
|
|
2227
|
+
listWebhookDeliveries: {
|
|
2228
|
+
parameters: {
|
|
2229
|
+
query?: {
|
|
2230
|
+
/** @description Page number (1-based) */
|
|
2231
|
+
page?: components["parameters"]["PageParam"];
|
|
2232
|
+
/** @description Items per page (max 100) */
|
|
2233
|
+
limit?: components["parameters"]["LimitParam"];
|
|
2234
|
+
};
|
|
2235
|
+
header?: never;
|
|
2236
|
+
path: {
|
|
2237
|
+
id: string;
|
|
2238
|
+
};
|
|
2239
|
+
cookie?: never;
|
|
2240
|
+
};
|
|
2241
|
+
requestBody?: never;
|
|
2242
|
+
responses: {
|
|
2243
|
+
/** @description Paginated delivery log */
|
|
2244
|
+
200: {
|
|
2245
|
+
headers: {
|
|
2246
|
+
[name: string]: unknown;
|
|
2247
|
+
};
|
|
2248
|
+
content: {
|
|
2249
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
2250
|
+
data?: components["schemas"]["WebhookDelivery"][];
|
|
2251
|
+
};
|
|
2252
|
+
};
|
|
2253
|
+
};
|
|
2254
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2255
|
+
401: {
|
|
2256
|
+
headers: {
|
|
2257
|
+
[name: string]: unknown;
|
|
2258
|
+
};
|
|
2259
|
+
content: {
|
|
2260
|
+
"application/json": components["schemas"]["Error"];
|
|
2261
|
+
};
|
|
2262
|
+
};
|
|
2263
|
+
/** @description Webhook endpoint not found */
|
|
2264
|
+
404: {
|
|
2265
|
+
headers: {
|
|
2266
|
+
[name: string]: unknown;
|
|
2267
|
+
};
|
|
2268
|
+
content: {
|
|
2269
|
+
"application/json": components["schemas"]["Error"];
|
|
2270
|
+
};
|
|
2271
|
+
};
|
|
2272
|
+
/** @description Rate limit exceeded */
|
|
2273
|
+
429: {
|
|
2274
|
+
headers: {
|
|
2275
|
+
[name: string]: unknown;
|
|
2276
|
+
};
|
|
2277
|
+
content: {
|
|
2278
|
+
"application/json": components["schemas"]["Error"];
|
|
2279
|
+
};
|
|
2280
|
+
};
|
|
2281
|
+
};
|
|
2282
|
+
};
|
|
2283
|
+
listApiKeys: {
|
|
2284
|
+
parameters: {
|
|
2285
|
+
query?: {
|
|
2286
|
+
/** @description Page number (1-based) */
|
|
2287
|
+
page?: components["parameters"]["PageParam"];
|
|
2288
|
+
/** @description Items per page (max 100) */
|
|
2289
|
+
limit?: components["parameters"]["LimitParam"];
|
|
2290
|
+
};
|
|
2291
|
+
header?: never;
|
|
2292
|
+
path?: never;
|
|
2293
|
+
cookie?: never;
|
|
2294
|
+
};
|
|
2295
|
+
requestBody?: never;
|
|
2296
|
+
responses: {
|
|
2297
|
+
/** @description Paginated key list (secrets are never returned) */
|
|
2298
|
+
200: {
|
|
2299
|
+
headers: {
|
|
2300
|
+
[name: string]: unknown;
|
|
2301
|
+
};
|
|
2302
|
+
content: {
|
|
2303
|
+
"application/json": components["schemas"]["PaginationMeta"] & {
|
|
2304
|
+
data?: components["schemas"]["ApiKey"][];
|
|
2305
|
+
};
|
|
2306
|
+
};
|
|
2307
|
+
};
|
|
2308
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2309
|
+
401: {
|
|
2310
|
+
headers: {
|
|
2311
|
+
[name: string]: unknown;
|
|
2312
|
+
};
|
|
2313
|
+
content: {
|
|
2314
|
+
"application/json": components["schemas"]["Error"];
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
/** @description Rate limit exceeded */
|
|
2318
|
+
429: {
|
|
2319
|
+
headers: {
|
|
2320
|
+
[name: string]: unknown;
|
|
2321
|
+
};
|
|
2322
|
+
content: {
|
|
2323
|
+
"application/json": components["schemas"]["Error"];
|
|
2324
|
+
};
|
|
2325
|
+
};
|
|
2326
|
+
};
|
|
2327
|
+
};
|
|
2328
|
+
createApiKey: {
|
|
2329
|
+
parameters: {
|
|
2330
|
+
query?: never;
|
|
2331
|
+
header?: never;
|
|
2332
|
+
path?: never;
|
|
2333
|
+
cookie?: never;
|
|
2334
|
+
};
|
|
2335
|
+
requestBody: {
|
|
2336
|
+
content: {
|
|
2337
|
+
"application/json": {
|
|
2338
|
+
label: string;
|
|
2339
|
+
/** @description Fine-grained scopes (preferred over `permission`). Must be a subset of the calling key's own scopes. Omit to use `permission`. */
|
|
2340
|
+
scopes?: ("wallets:read" | "wallets:write" | "customers:read" | "customers:write" | "payment_intents:read" | "payment_intents:write" | "refunds:read" | "refunds:write" | "transactions:read" | "withdrawals:read" | "withdrawals:write" | "webhooks:read" | "webhooks:write" | "fees:read" | "api_keys:read" | "api_keys:write")[];
|
|
2341
|
+
/**
|
|
2342
|
+
* @description Legacy. Used only when `scopes` is omitted.
|
|
2343
|
+
* @default READ_WRITE
|
|
2344
|
+
* @enum {string}
|
|
2345
|
+
*/
|
|
2346
|
+
permission?: "READ_ONLY" | "READ_WRITE";
|
|
2347
|
+
/**
|
|
2348
|
+
* @description Optional source-IP allowlist. When set, requests from a source IP outside this list are rejected with 403 `IP_NOT_ALLOWED`. Each entry is a single IP or CIDR range (IPv4 or IPv6). Omit or pass an empty array for no restriction.
|
|
2349
|
+
* @example [
|
|
2350
|
+
* "203.0.113.4",
|
|
2351
|
+
* "198.51.100.0/24"
|
|
2352
|
+
* ]
|
|
2353
|
+
*/
|
|
2354
|
+
allowed_ips?: string[];
|
|
2355
|
+
/**
|
|
2356
|
+
* Format: date-time
|
|
2357
|
+
* @description ISO 8601 expiry datetime. Omit for a non-expiring key.
|
|
2358
|
+
*/
|
|
2359
|
+
expires_at?: string;
|
|
2360
|
+
};
|
|
2361
|
+
};
|
|
2362
|
+
};
|
|
2363
|
+
responses: {
|
|
2364
|
+
/** @description Key created. `secret` shown only at creation, store it securely. */
|
|
2365
|
+
201: {
|
|
2366
|
+
headers: {
|
|
2367
|
+
[name: string]: unknown;
|
|
2368
|
+
};
|
|
2369
|
+
content: {
|
|
2370
|
+
"application/json": components["schemas"]["ApiKey"] & {
|
|
2371
|
+
/** @description HMAC signing secret, shown once only. */
|
|
2372
|
+
secret?: string;
|
|
2373
|
+
};
|
|
2374
|
+
};
|
|
2375
|
+
};
|
|
2376
|
+
/** @description Validation error (e.g. an unknown scope) */
|
|
2377
|
+
400: {
|
|
2378
|
+
headers: {
|
|
2379
|
+
[name: string]: unknown;
|
|
2380
|
+
};
|
|
2381
|
+
content: {
|
|
2382
|
+
"application/json": components["schemas"]["Error"];
|
|
2383
|
+
};
|
|
2384
|
+
};
|
|
2385
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2386
|
+
401: {
|
|
2387
|
+
headers: {
|
|
2388
|
+
[name: string]: unknown;
|
|
2389
|
+
};
|
|
2390
|
+
content: {
|
|
2391
|
+
"application/json": components["schemas"]["Error"];
|
|
2392
|
+
};
|
|
2393
|
+
};
|
|
2394
|
+
/** @description Missing the `api_keys:write` scope, or attempting to grant scopes the calling key does not hold */
|
|
2395
|
+
403: {
|
|
2396
|
+
headers: {
|
|
2397
|
+
[name: string]: unknown;
|
|
2398
|
+
};
|
|
2399
|
+
content: {
|
|
2400
|
+
"application/json": components["schemas"]["Error"];
|
|
2401
|
+
};
|
|
2402
|
+
};
|
|
2403
|
+
/** @description Rate limit exceeded */
|
|
2404
|
+
429: {
|
|
2405
|
+
headers: {
|
|
2406
|
+
[name: string]: unknown;
|
|
2407
|
+
};
|
|
2408
|
+
content: {
|
|
2409
|
+
"application/json": components["schemas"]["Error"];
|
|
2410
|
+
};
|
|
2411
|
+
};
|
|
2412
|
+
};
|
|
2413
|
+
};
|
|
2414
|
+
revokeApiKey: {
|
|
2415
|
+
parameters: {
|
|
2416
|
+
query?: never;
|
|
2417
|
+
header?: never;
|
|
2418
|
+
path: {
|
|
2419
|
+
id: string;
|
|
2420
|
+
};
|
|
2421
|
+
cookie?: never;
|
|
2422
|
+
};
|
|
2423
|
+
requestBody?: never;
|
|
2424
|
+
responses: {
|
|
2425
|
+
/** @description Key revoked */
|
|
2426
|
+
200: {
|
|
2427
|
+
headers: {
|
|
2428
|
+
[name: string]: unknown;
|
|
2429
|
+
};
|
|
2430
|
+
content: {
|
|
2431
|
+
"application/json": {
|
|
2432
|
+
/** @example API key revoked. */
|
|
2433
|
+
message?: string;
|
|
2434
|
+
};
|
|
2435
|
+
};
|
|
2436
|
+
};
|
|
2437
|
+
/** @description Invalid or revoked API key / HMAC signature mismatch */
|
|
2438
|
+
401: {
|
|
2439
|
+
headers: {
|
|
2440
|
+
[name: string]: unknown;
|
|
2441
|
+
};
|
|
2442
|
+
content: {
|
|
2443
|
+
"application/json": components["schemas"]["Error"];
|
|
2444
|
+
};
|
|
2445
|
+
};
|
|
2446
|
+
/** @description The API key lacks the required write scope (code: INSUFFICIENT_SCOPE). */
|
|
2447
|
+
403: {
|
|
2448
|
+
headers: {
|
|
2449
|
+
[name: string]: unknown;
|
|
2450
|
+
};
|
|
2451
|
+
content: {
|
|
2452
|
+
"application/json": components["schemas"]["Error"];
|
|
2453
|
+
};
|
|
2454
|
+
};
|
|
2455
|
+
/** @description API key not found (or not owned by this workspace) */
|
|
2456
|
+
404: {
|
|
2457
|
+
headers: {
|
|
2458
|
+
[name: string]: unknown;
|
|
2459
|
+
};
|
|
2460
|
+
content: {
|
|
2461
|
+
"application/json": components["schemas"]["Error"];
|
|
2462
|
+
};
|
|
2463
|
+
};
|
|
2464
|
+
/** @description Rate limit exceeded */
|
|
2465
|
+
429: {
|
|
2466
|
+
headers: {
|
|
2467
|
+
[name: string]: unknown;
|
|
2468
|
+
};
|
|
2469
|
+
content: {
|
|
2470
|
+
"application/json": components["schemas"]["Error"];
|
|
2471
|
+
};
|
|
2472
|
+
};
|
|
2473
|
+
};
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
type Op = operations;
|
|
2478
|
+
type JsonOf<T> = T extends {
|
|
2479
|
+
content: {
|
|
2480
|
+
'application/json': infer B;
|
|
2481
|
+
};
|
|
2482
|
+
} ? B : void;
|
|
2483
|
+
/** The 2xx JSON response body for an operation (void for 204/no-content). */
|
|
2484
|
+
type Result<K extends keyof Op> = Op[K] extends {
|
|
2485
|
+
responses: infer R;
|
|
2486
|
+
} ? 200 extends keyof R ? JsonOf<R[200]> : 201 extends keyof R ? JsonOf<R[201]> : void : void;
|
|
2487
|
+
/** The JSON request body for an operation. */
|
|
2488
|
+
type Body<K extends keyof Op> = Op[K] extends {
|
|
2489
|
+
requestBody: {
|
|
2490
|
+
content: {
|
|
2491
|
+
'application/json': infer B;
|
|
2492
|
+
};
|
|
2493
|
+
};
|
|
2494
|
+
} ? B : Op[K] extends {
|
|
2495
|
+
requestBody?: {
|
|
2496
|
+
content: {
|
|
2497
|
+
'application/json': infer B;
|
|
2498
|
+
};
|
|
2499
|
+
};
|
|
2500
|
+
} ? B : never;
|
|
2501
|
+
/** The query parameters for an operation. */
|
|
2502
|
+
type Query<K extends keyof Op> = Op[K] extends {
|
|
2503
|
+
parameters: {
|
|
2504
|
+
query?: infer Q;
|
|
2505
|
+
};
|
|
2506
|
+
} ? NonNullable<Q> : never;
|
|
2507
|
+
type Wallet = components['schemas']['Wallet'];
|
|
2508
|
+
type WalletDetail = components['schemas']['WalletDetail'];
|
|
2509
|
+
type Customer = components['schemas']['Customer'];
|
|
2510
|
+
type Deposit = components['schemas']['Deposit'];
|
|
2511
|
+
type Withdrawal = components['schemas']['Withdrawal'];
|
|
2512
|
+
type WithdrawalTransaction = components['schemas']['WithdrawalTransaction'];
|
|
2513
|
+
type Balance = components['schemas']['Balance'];
|
|
2514
|
+
type FeeQuote = components['schemas']['FeeQuote'];
|
|
2515
|
+
type WebhookEndpoint = components['schemas']['WebhookEndpoint'];
|
|
2516
|
+
type WebhookDelivery = components['schemas']['WebhookDelivery'];
|
|
2517
|
+
type ApiKey = components['schemas']['ApiKey'];
|
|
2518
|
+
/** Options accepted by mutating (create) calls. */
|
|
2519
|
+
interface WriteOptions {
|
|
2520
|
+
/** Idempotency-Key: makes the write safe to auto-retry and dedupes duplicate submissions. */
|
|
2521
|
+
idempotencyKey?: string;
|
|
2522
|
+
signal?: AbortSignal;
|
|
2523
|
+
}
|
|
2524
|
+
declare class Base {
|
|
2525
|
+
protected readonly http: HttpClient;
|
|
2526
|
+
constructor(http: HttpClient);
|
|
2527
|
+
protected req<K extends keyof Op>(opts: RequestOptions): Promise<Result<K>>;
|
|
2528
|
+
}
|
|
2529
|
+
declare class Health extends Base {
|
|
2530
|
+
check(): Promise<{
|
|
2531
|
+
status?: "ok" | "degraded";
|
|
2532
|
+
components?: {
|
|
2533
|
+
database?: "ok" | "degraded";
|
|
2534
|
+
vault?: "ok" | "degraded";
|
|
2535
|
+
redis?: "ok" | "degraded";
|
|
2536
|
+
};
|
|
2537
|
+
timestamp?: string;
|
|
2538
|
+
}>;
|
|
2539
|
+
}
|
|
2540
|
+
declare class Wallets extends Base {
|
|
2541
|
+
create(body: Body<'createWallet'>, opts?: WriteOptions): Promise<{
|
|
2542
|
+
id?: string;
|
|
2543
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2544
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2545
|
+
address?: string;
|
|
2546
|
+
status?: "ACTIVE" | "SWEPT" | "ARCHIVED";
|
|
2547
|
+
customer_id?: string | null;
|
|
2548
|
+
created_at?: string;
|
|
2549
|
+
}>;
|
|
2550
|
+
list(query?: Query<'listWallets'>): Promise<{
|
|
2551
|
+
total?: number;
|
|
2552
|
+
page?: number;
|
|
2553
|
+
limit?: number;
|
|
2554
|
+
} & {
|
|
2555
|
+
data?: components["schemas"]["Wallet"][];
|
|
2556
|
+
}>;
|
|
2557
|
+
get(id: string): Promise<{
|
|
2558
|
+
id?: string;
|
|
2559
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2560
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2561
|
+
address?: string;
|
|
2562
|
+
status?: "ACTIVE" | "SWEPT" | "ARCHIVED";
|
|
2563
|
+
customer_id?: string | null;
|
|
2564
|
+
created_at?: string;
|
|
2565
|
+
} & {
|
|
2566
|
+
derivation_index?: number;
|
|
2567
|
+
external_ref?: string | null;
|
|
2568
|
+
}>;
|
|
2569
|
+
}
|
|
2570
|
+
declare class Customers extends Base {
|
|
2571
|
+
create(body: Body<'createCustomer'>, opts?: WriteOptions): Promise<{
|
|
2572
|
+
id?: string;
|
|
2573
|
+
external_ref?: string;
|
|
2574
|
+
label?: string | null;
|
|
2575
|
+
metadata?: {
|
|
2576
|
+
[key: string]: unknown;
|
|
2577
|
+
} | null;
|
|
2578
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
2579
|
+
created_at?: string;
|
|
2580
|
+
updated_at?: string;
|
|
2581
|
+
}>;
|
|
2582
|
+
list(query?: Query<'listCustomers'>): Promise<{
|
|
2583
|
+
data?: components["schemas"]["Customer"][];
|
|
2584
|
+
total?: number;
|
|
2585
|
+
page?: number;
|
|
2586
|
+
limit?: number;
|
|
2587
|
+
}>;
|
|
2588
|
+
get(id: string): Promise<{
|
|
2589
|
+
id?: string;
|
|
2590
|
+
external_ref?: string;
|
|
2591
|
+
label?: string | null;
|
|
2592
|
+
metadata?: {
|
|
2593
|
+
[key: string]: unknown;
|
|
2594
|
+
} | null;
|
|
2595
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
2596
|
+
created_at?: string;
|
|
2597
|
+
updated_at?: string;
|
|
2598
|
+
}>;
|
|
2599
|
+
update(id: string, body: Body<'updateCustomer'>): Promise<{
|
|
2600
|
+
id?: string;
|
|
2601
|
+
external_ref?: string;
|
|
2602
|
+
label?: string | null;
|
|
2603
|
+
metadata?: {
|
|
2604
|
+
[key: string]: unknown;
|
|
2605
|
+
} | null;
|
|
2606
|
+
status?: "ACTIVE" | "ARCHIVED";
|
|
2607
|
+
created_at?: string;
|
|
2608
|
+
updated_at?: string;
|
|
2609
|
+
}>;
|
|
2610
|
+
}
|
|
2611
|
+
declare class Transactions extends Base {
|
|
2612
|
+
list(query?: Query<'listTransactions'>): Promise<{
|
|
2613
|
+
data?: {
|
|
2614
|
+
deposits?: (components["schemas"]["Deposit"] & {
|
|
2615
|
+
type?: "deposit";
|
|
2616
|
+
})[];
|
|
2617
|
+
withdrawals?: (components["schemas"]["WithdrawalTransaction"] & {
|
|
2618
|
+
type?: "withdrawal";
|
|
2619
|
+
})[];
|
|
2620
|
+
};
|
|
2621
|
+
}>;
|
|
2622
|
+
listDeposits(query?: Query<'listDeposits'>): Promise<{
|
|
2623
|
+
total?: number;
|
|
2624
|
+
page?: number;
|
|
2625
|
+
limit?: number;
|
|
2626
|
+
} & {
|
|
2627
|
+
data?: components["schemas"]["Deposit"][];
|
|
2628
|
+
}>;
|
|
2629
|
+
getDeposit(id: string): Promise<{
|
|
2630
|
+
id?: string;
|
|
2631
|
+
wallet_id?: string;
|
|
2632
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2633
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2634
|
+
txid?: string | null;
|
|
2635
|
+
amount?: string;
|
|
2636
|
+
status?: "DETECTED" | "CONFIRMING" | "CONFIRMED" | "SWEPT" | "FAILED" | "FLAGGED" | "REJECTED";
|
|
2637
|
+
confirmations?: number;
|
|
2638
|
+
detected_at?: string;
|
|
2639
|
+
confirmed_at?: string | null;
|
|
2640
|
+
swept_at?: string | null;
|
|
2641
|
+
fee_record?: components["schemas"]["FeeRecord"] | null;
|
|
2642
|
+
}>;
|
|
2643
|
+
listWithdrawals(query?: Query<'listTransactionWithdrawals'>): Promise<{
|
|
2644
|
+
total?: number;
|
|
2645
|
+
page?: number;
|
|
2646
|
+
limit?: number;
|
|
2647
|
+
} & {
|
|
2648
|
+
data?: components["schemas"]["WithdrawalTransaction"][];
|
|
2649
|
+
}>;
|
|
2650
|
+
balances(): Promise<{
|
|
2651
|
+
data?: components["schemas"]["Balance"][];
|
|
2652
|
+
}>;
|
|
2653
|
+
}
|
|
2654
|
+
declare class Withdrawals extends Base {
|
|
2655
|
+
create(body: Body<'createWithdrawal'>, opts?: WriteOptions): Promise<{
|
|
2656
|
+
id?: string;
|
|
2657
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2658
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2659
|
+
amount?: string;
|
|
2660
|
+
fee?: string;
|
|
2661
|
+
net_amount?: string;
|
|
2662
|
+
status?: "PENDING";
|
|
2663
|
+
idempotency_key?: string;
|
|
2664
|
+
requested_at?: string;
|
|
2665
|
+
}>;
|
|
2666
|
+
list(query?: Query<'listWithdrawals'>): Promise<{
|
|
2667
|
+
total?: number;
|
|
2668
|
+
page?: number;
|
|
2669
|
+
limit?: number;
|
|
2670
|
+
} & {
|
|
2671
|
+
data?: components["schemas"]["Withdrawal"][];
|
|
2672
|
+
}>;
|
|
2673
|
+
get(id: string): Promise<{
|
|
2674
|
+
id?: string;
|
|
2675
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2676
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2677
|
+
amount?: string;
|
|
2678
|
+
status?: "PENDING_APPROVAL" | "PENDING" | "UNDER_REVIEW" | "PROCESSING" | "CONFIRMING" | "CONFIRMED" | "FAILED" | "CANCELLED";
|
|
2679
|
+
txid?: string | null;
|
|
2680
|
+
idempotency_key?: string;
|
|
2681
|
+
requested_at?: string;
|
|
2682
|
+
confirmed_at?: string | null;
|
|
2683
|
+
} & {
|
|
2684
|
+
fee_record?: components["schemas"]["FeeRecord"] | null;
|
|
2685
|
+
}>;
|
|
2686
|
+
cancel(id: string): Promise<{
|
|
2687
|
+
message?: string;
|
|
2688
|
+
}>;
|
|
2689
|
+
}
|
|
2690
|
+
declare class Fees extends Base {
|
|
2691
|
+
quote(body: Body<'quoteFee'>): Promise<{
|
|
2692
|
+
direction?: "deposit" | "withdrawal";
|
|
2693
|
+
chain?: "TRON_MAINNET" | "TRON_TESTNET" | "BSC_MAINNET" | "BSC_TESTNET" | "ETH_MAINNET" | "ETH_TESTNET";
|
|
2694
|
+
asset?: "USDT_TRON" | "USDT_BSC" | "USDT_ETH" | "USDC_ETH" | "ETH" | "BNB";
|
|
2695
|
+
mode?: "charge" | "gross_up";
|
|
2696
|
+
input_amount?: string;
|
|
2697
|
+
gross?: string;
|
|
2698
|
+
fee?: string;
|
|
2699
|
+
net?: string | null;
|
|
2700
|
+
effective_rate?: string;
|
|
2701
|
+
applied_rate?: string;
|
|
2702
|
+
applied_min_fee?: string;
|
|
2703
|
+
fee_basis?: "percentage" | "minimum" | "flat";
|
|
2704
|
+
override_applied?: boolean;
|
|
2705
|
+
tier?: {
|
|
2706
|
+
label?: string;
|
|
2707
|
+
} | null;
|
|
2708
|
+
viable?: boolean;
|
|
2709
|
+
indicative?: boolean;
|
|
2710
|
+
warnings?: {
|
|
2711
|
+
code?: string;
|
|
2712
|
+
message?: string;
|
|
2713
|
+
}[];
|
|
2714
|
+
}>;
|
|
2715
|
+
}
|
|
2716
|
+
declare class Webhooks extends Base {
|
|
2717
|
+
create(body: Body<'createWebhookEndpoint'>, opts?: WriteOptions): Promise<{
|
|
2718
|
+
id?: string;
|
|
2719
|
+
url?: string;
|
|
2720
|
+
events?: ("DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED")[];
|
|
2721
|
+
is_active?: boolean;
|
|
2722
|
+
created_at?: string;
|
|
2723
|
+
} & {
|
|
2724
|
+
secret?: string;
|
|
2725
|
+
}>;
|
|
2726
|
+
list(query?: Query<'listWebhookEndpoints'>): Promise<{
|
|
2727
|
+
total?: number;
|
|
2728
|
+
page?: number;
|
|
2729
|
+
limit?: number;
|
|
2730
|
+
} & {
|
|
2731
|
+
data?: components["schemas"]["WebhookEndpoint"][];
|
|
2732
|
+
}>;
|
|
2733
|
+
update(id: string, body: Body<'updateWebhookEndpoint'>): Promise<{
|
|
2734
|
+
id?: string;
|
|
2735
|
+
url?: string;
|
|
2736
|
+
events?: ("DEPOSIT_DETECTED" | "DEPOSIT_CONFIRMED" | "DEPOSIT_SWEPT" | "DEPOSIT_FLAGGED" | "WITHDRAWAL_PROCESSING" | "WITHDRAWAL_CONFIRMED" | "WITHDRAWAL_FAILED" | "WITHDRAWAL_CANCELLED" | "WITHDRAWAL_HELD" | "WITHDRAWAL_PENDING_APPROVAL" | "BENEFICIARY_ADDED" | "BENEFICIARY_REMOVED" | "WITHDRAWAL_POLICY_CHANGED")[];
|
|
2737
|
+
is_active?: boolean;
|
|
2738
|
+
created_at?: string;
|
|
2739
|
+
}>;
|
|
2740
|
+
delete(id: string): Promise<{
|
|
2741
|
+
message?: string;
|
|
2742
|
+
}>;
|
|
2743
|
+
rotateSecret(id: string): Promise<{
|
|
2744
|
+
id?: string;
|
|
2745
|
+
url?: string;
|
|
2746
|
+
events?: string[];
|
|
2747
|
+
is_active?: boolean;
|
|
2748
|
+
created_at?: string;
|
|
2749
|
+
secret?: string;
|
|
2750
|
+
previous_secret_expires_at?: string;
|
|
2751
|
+
}>;
|
|
2752
|
+
listDeliveries(id: string, query?: Query<'listWebhookDeliveries'>): Promise<{
|
|
2753
|
+
total?: number;
|
|
2754
|
+
page?: number;
|
|
2755
|
+
limit?: number;
|
|
2756
|
+
} & {
|
|
2757
|
+
data?: components["schemas"]["WebhookDelivery"][];
|
|
2758
|
+
}>;
|
|
2759
|
+
}
|
|
2760
|
+
declare class ApiKeys extends Base {
|
|
2761
|
+
create(body: Body<'createApiKey'>, opts?: WriteOptions): Promise<{
|
|
2762
|
+
id?: string;
|
|
2763
|
+
label?: string;
|
|
2764
|
+
key_id?: string;
|
|
2765
|
+
scopes?: ("wallets:read" | "wallets:write" | "customers:read" | "customers:write" | "payment_intents:read" | "payment_intents:write" | "refunds:read" | "refunds:write" | "transactions:read" | "withdrawals:read" | "withdrawals:write" | "webhooks:read" | "webhooks:write" | "fees:read" | "api_keys:read" | "api_keys:write")[];
|
|
2766
|
+
permission?: "READ_ONLY" | "READ_WRITE";
|
|
2767
|
+
allowed_ips?: string[];
|
|
2768
|
+
is_test?: boolean;
|
|
2769
|
+
last_used_at?: string | null;
|
|
2770
|
+
expires_at?: string | null;
|
|
2771
|
+
created_at?: string;
|
|
2772
|
+
} & {
|
|
2773
|
+
secret?: string;
|
|
2774
|
+
}>;
|
|
2775
|
+
list(query?: Query<'listApiKeys'>): Promise<{
|
|
2776
|
+
total?: number;
|
|
2777
|
+
page?: number;
|
|
2778
|
+
limit?: number;
|
|
2779
|
+
} & {
|
|
2780
|
+
data?: components["schemas"]["ApiKey"][];
|
|
2781
|
+
}>;
|
|
2782
|
+
revoke(id: string): Promise<{
|
|
2783
|
+
message?: string;
|
|
2784
|
+
}>;
|
|
2785
|
+
}
|
|
2786
|
+
/** All typed resource namespaces, bound to one signed HTTP client. */
|
|
2787
|
+
interface Resources {
|
|
2788
|
+
health: Health;
|
|
2789
|
+
wallets: Wallets;
|
|
2790
|
+
customers: Customers;
|
|
2791
|
+
transactions: Transactions;
|
|
2792
|
+
withdrawals: Withdrawals;
|
|
2793
|
+
fees: Fees;
|
|
2794
|
+
webhooks: Webhooks;
|
|
2795
|
+
apiKeys: ApiKeys;
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* Canonical HMAC request signing for the CowriePay Developer API (`/v2`).
|
|
2800
|
+
*
|
|
2801
|
+
* This implements the documented CowriePay request-signing recipe (https://docs.cowriepay.io). It is
|
|
2802
|
+
* proven identical to the server by the shared golden vectors in `vectors/conformance.json` and,
|
|
2803
|
+
* end-to-end, by the sandbox contract test. Do NOT "improve" the shape here without updating the
|
|
2804
|
+
* published spec and the vectors in lockstep.
|
|
2805
|
+
*
|
|
2806
|
+
* signing_string = `${timestamp}.${METHOD}.${path}.${bodyHash}`
|
|
2807
|
+
* signature = HMAC_SHA256(secret, signing_string) → lowercase hex
|
|
2808
|
+
*
|
|
2809
|
+
* - timestamp : unix seconds, also sent as `X-CowriePay-Timestamp`; server accepts ±300s.
|
|
2810
|
+
* - METHOD : upper-cased HTTP method.
|
|
2811
|
+
* - path : the FULL request target exactly as sent, incl. the `/v2` prefix AND query string.
|
|
2812
|
+
* - bodyHash : lowercase SHA-256 hex of the RAW body bytes; sha256('') when there is no body.
|
|
2813
|
+
*/
|
|
2814
|
+
/** Lowercase SHA-256 hex of a UTF-8 string. */
|
|
2815
|
+
declare function sha256Hex(input: string): string;
|
|
2816
|
+
/** Assemble the canonical signing string from an already-hashed body. */
|
|
2817
|
+
declare function buildRequestSigningString(params: {
|
|
2818
|
+
timestamp: string;
|
|
2819
|
+
method: string;
|
|
2820
|
+
path: string;
|
|
2821
|
+
bodyHash: string;
|
|
2822
|
+
}): string;
|
|
2823
|
+
interface SignedHeaders {
|
|
2824
|
+
'X-CowriePay-Key': string;
|
|
2825
|
+
'X-CowriePay-Timestamp': string;
|
|
2826
|
+
'X-CowriePay-Signature': string;
|
|
2827
|
+
}
|
|
2828
|
+
/** Compute the request signature (lowercase hex) from the raw body string. */
|
|
2829
|
+
declare function signRequest(params: {
|
|
2830
|
+
secret: string;
|
|
2831
|
+
timestamp: string;
|
|
2832
|
+
method: string;
|
|
2833
|
+
/** Full path incl. `/v2` and query string. */
|
|
2834
|
+
path: string;
|
|
2835
|
+
/** Raw request body string; '' for no body. */
|
|
2836
|
+
rawBody: string;
|
|
2837
|
+
}): string;
|
|
2838
|
+
/** Build the three auth headers for a request. `timestamp` defaults to now (unix seconds). */
|
|
2839
|
+
declare function buildAuthHeaders(params: {
|
|
2840
|
+
apiKey: string;
|
|
2841
|
+
secret: string;
|
|
2842
|
+
method: string;
|
|
2843
|
+
path: string;
|
|
2844
|
+
rawBody: string;
|
|
2845
|
+
timestamp?: string;
|
|
2846
|
+
}): SignedHeaders;
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Typed errors mapped from the CowriePay error envelope: { "error": { "code", "message", ... } }
|
|
2850
|
+
* (cowriepay-core `Error` schema). One base class carries the machine-readable `code` + HTTP status;
|
|
2851
|
+
* a few subclasses exist for the codes callers most often branch on.
|
|
2852
|
+
*/
|
|
2853
|
+
interface CowriePayErrorBody {
|
|
2854
|
+
error?: {
|
|
2855
|
+
code?: string;
|
|
2856
|
+
message?: string;
|
|
2857
|
+
[k: string]: unknown;
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
declare class CowriePayError extends Error {
|
|
2861
|
+
/** Machine-readable error code from the envelope (e.g. `INVALID_SIGNATURE`), or a synthetic one. */
|
|
2862
|
+
readonly code: string;
|
|
2863
|
+
/** HTTP status, or 0 for transport/connection errors. */
|
|
2864
|
+
readonly status: number;
|
|
2865
|
+
/** The `X-CowriePay-Request-Id` / delivery id, when present, for support. */
|
|
2866
|
+
readonly requestId?: string;
|
|
2867
|
+
/** The parsed response body, when there was one. */
|
|
2868
|
+
readonly body?: CowriePayErrorBody;
|
|
2869
|
+
constructor(params: {
|
|
2870
|
+
message: string;
|
|
2871
|
+
code: string;
|
|
2872
|
+
status: number;
|
|
2873
|
+
requestId?: string;
|
|
2874
|
+
body?: CowriePayErrorBody;
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
/** 401: signing/auth problem (INVALID_SIGNATURE, TIMESTAMP_EXPIRED, REPLAY_DETECTED, MISSING_AUTH_HEADERS). */
|
|
2878
|
+
declare class AuthenticationError extends CowriePayError {
|
|
2879
|
+
}
|
|
2880
|
+
/** 403: the API key lacks the required scope (INSUFFICIENT_SCOPE). */
|
|
2881
|
+
declare class PermissionError extends CowriePayError {
|
|
2882
|
+
}
|
|
2883
|
+
/** 404: not found, or a feature disabled for the workspace (FEATURE_NOT_AVAILABLE, NOT_FOUND). */
|
|
2884
|
+
declare class NotFoundError extends CowriePayError {
|
|
2885
|
+
}
|
|
2886
|
+
/** 409 / 422 idempotency conflicts (IDEMPOTENCY_CONFLICT, IDEMPOTENCY_MISMATCH) and other 4xx. */
|
|
2887
|
+
declare class InvalidRequestError extends CowriePayError {
|
|
2888
|
+
}
|
|
2889
|
+
/** 429: rate limited. */
|
|
2890
|
+
declare class RateLimitError extends CowriePayError {
|
|
2891
|
+
}
|
|
2892
|
+
/** 5xx: server-side error (retryable). */
|
|
2893
|
+
declare class ApiError extends CowriePayError {
|
|
2894
|
+
}
|
|
2895
|
+
/** Network/transport failure before any HTTP status (retryable). status = 0. */
|
|
2896
|
+
declare class ConnectionError extends CowriePayError {
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* The CowriePay Developer API client.
|
|
2901
|
+
*
|
|
2902
|
+
* ```ts
|
|
2903
|
+
* import { CowriePay } from '@cowriepay/sdk';
|
|
2904
|
+
* const cowriepay = new CowriePay({ apiKey: process.env.CPK_KEY!, apiSecret: process.env.CPK_SECRET! });
|
|
2905
|
+
* // Same base URL for Sandbox and Live; the key selects the network server-side
|
|
2906
|
+
* // (cpk_test_ -> testnet/Sandbox, cpk_live_ -> mainnet/Live).
|
|
2907
|
+
* ```
|
|
2908
|
+
*
|
|
2909
|
+
* Typed resource namespaces are attached: `cowriepay.wallets.create(...)`,
|
|
2910
|
+
* `cowriepay.withdrawals.list(...)`, `cowriepay.transactions.balances()`, etc.
|
|
2911
|
+
*/
|
|
2912
|
+
declare class CowriePay {
|
|
2913
|
+
/** The signed HTTP transport. Every resource method calls through this. */
|
|
2914
|
+
readonly http: HttpClient;
|
|
2915
|
+
readonly health: Health;
|
|
2916
|
+
readonly wallets: Wallets;
|
|
2917
|
+
readonly customers: Customers;
|
|
2918
|
+
readonly transactions: Transactions;
|
|
2919
|
+
readonly withdrawals: Withdrawals;
|
|
2920
|
+
readonly fees: Fees;
|
|
2921
|
+
readonly webhooks: Webhooks;
|
|
2922
|
+
readonly apiKeys: ApiKeys;
|
|
2923
|
+
constructor(config: CowriePayConfig);
|
|
2924
|
+
/** Low-level escape hatch: issue a signed request to any `/v2` path. */
|
|
2925
|
+
request<T = unknown>(opts: RequestOptions): Promise<T>;
|
|
2926
|
+
/**
|
|
2927
|
+
* Verify an incoming webhook against your endpoint secret(s). Pass the RAW request body, the
|
|
2928
|
+
* `X-CowriePay-Signature` header, and the `X-CowriePay-Timestamp` header. During a secret rotation,
|
|
2929
|
+
* pass both the new and previous secrets.
|
|
2930
|
+
*/
|
|
2931
|
+
static verifyWebhook(opts: VerifyWebhookOptions): boolean;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
export { ApiError, type ApiKey, AuthenticationError, type Balance, type Body, ConnectionError, CowriePay, type CowriePayConfig, CowriePayError, type Customer, type Deposit, type FeeQuote, InvalidRequestError, NotFoundError, PermissionError, type Query, RateLimitError, type RequestOptions, type Resources, type Result, type SignedHeaders, type VerifyWebhookOptions, type Wallet, type WalletDetail, type WebhookDelivery, type WebhookEndpoint, type Withdrawal, type WithdrawalTransaction, type WriteOptions, buildAuthHeaders, buildRequestSigningString, type components, computeWebhookSignature, CowriePay as default, type operations, type paths, sha256Hex, signRequest, verifyWebhook };
|