better-bitkub-client 0.1.0 → 0.1.2
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 +4 -4
- package/dist/v3-client.d.ts +282 -0
- package/dist/v3-client.js +282 -0
- package/dist/v4-client.d.ts +110 -0
- package/dist/v4-client.js +110 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# better-bitkub-client
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
TypeScript client for working with Bitkub V3 and V4 APIs, based on Bitkub's official API documentation.
|
|
4
4
|
|
|
5
5
|
## What it includes
|
|
6
6
|
|
|
@@ -12,14 +12,13 @@ TypeScript rewrite of the repository's C# `bitkubwrapper` library.
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install
|
|
16
|
-
npm run build
|
|
15
|
+
npm install better-bitkub-client
|
|
17
16
|
```
|
|
18
17
|
|
|
19
18
|
## Usage
|
|
20
19
|
|
|
21
20
|
```ts
|
|
22
|
-
import { BitkubV3Client, BitkubV4Client } from "
|
|
21
|
+
import { BitkubV3Client, BitkubV4Client } from "better-bitkub-client";
|
|
23
22
|
|
|
24
23
|
const v3 = new BitkubV3Client({
|
|
25
24
|
apiKey: process.env.BITKUB_KEY!,
|
|
@@ -40,3 +39,4 @@ const withdraws = await v4.getCryptoWithdraws({ limit: 50 });
|
|
|
40
39
|
- Requires Node 18+ for the built-in `fetch` API.
|
|
41
40
|
- The default base URL is `https://api.bitkub.com`.
|
|
42
41
|
- DTOs keep Bitkub's field names to make request/response handling predictable.
|
|
42
|
+
- Official API reference: [bitkub/bitkub-official-api-docs](https://github.com/bitkub/bitkub-official-api-docs)
|
package/dist/v3-client.d.ts
CHANGED
|
@@ -2,26 +2,308 @@ import { BitkubBaseClient, type BitkubClientOptions } from "./base-client.js";
|
|
|
2
2
|
import type { BalanceInfo, BankAccount, BitkubV3Response, CancelOrderRequest, CoinConvertHistoryItem, CoinConvertHistoryOptions, Depth, FiatDepositHistoryItem, FiatWithdrawHistoryItem, FiatWithdrawRequest, FiatWithdrawResponse, LimitsResponse, OpenOrder, OrderBookEntry, OrderHistoryItem, OrderHistoryOptions, OrderInfo, PlaceOrderRequest, PlaceOrderResponse, RawTrade, StatusResponse, SymbolInfo, Ticker } from "./types/v3.js";
|
|
3
3
|
export declare class BitkubV3Client extends BitkubBaseClient {
|
|
4
4
|
constructor(options: BitkubClientOptions);
|
|
5
|
+
/**
|
|
6
|
+
* Get Bitkub service status information.
|
|
7
|
+
*
|
|
8
|
+
* Endpoint: `GET /api/status`
|
|
9
|
+
* Auth: none
|
|
10
|
+
*
|
|
11
|
+
* Returns exchange service components and their current status.
|
|
12
|
+
*
|
|
13
|
+
* @see https://api.bitkub.com/docs
|
|
14
|
+
*/
|
|
5
15
|
getStatus(): Promise<StatusResponse[]>;
|
|
16
|
+
/**
|
|
17
|
+
* List tradable market symbols and symbol metadata.
|
|
18
|
+
*
|
|
19
|
+
* Endpoint: `GET /api/v3/market/symbols`
|
|
20
|
+
* Auth: none
|
|
21
|
+
*
|
|
22
|
+
* Includes symbol-level configuration such as price step, quantity step,
|
|
23
|
+
* scaling, trading status, and freeze flags.
|
|
24
|
+
*
|
|
25
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/symbols?method=GET
|
|
26
|
+
*/
|
|
6
27
|
getSymbols(): Promise<BitkubV3Response<SymbolInfo[]>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get 24h ticker data for one symbol or all symbols.
|
|
30
|
+
*
|
|
31
|
+
* Endpoint: `GET /api/v3/market/ticker`
|
|
32
|
+
* Auth: none
|
|
33
|
+
*
|
|
34
|
+
* Query:
|
|
35
|
+
* - `sym` optional market symbol such as `BTC_THB`
|
|
36
|
+
*
|
|
37
|
+
* Returns latest price, best bid/ask, 24h high/low, and volume fields.
|
|
38
|
+
*
|
|
39
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/ticker?method=GET
|
|
40
|
+
*/
|
|
7
41
|
getTicker(symbol?: string): Promise<Ticker[]>;
|
|
42
|
+
/**
|
|
43
|
+
* List open buy orders from the public order book.
|
|
44
|
+
*
|
|
45
|
+
* Endpoint: `GET /api/v3/market/bids`
|
|
46
|
+
* Auth: none
|
|
47
|
+
*
|
|
48
|
+
* Query:
|
|
49
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
50
|
+
* - `lmt` optional number of rows to return
|
|
51
|
+
*
|
|
52
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/bids?method=GET
|
|
53
|
+
*/
|
|
8
54
|
getBids(symbol: string, limit?: number): Promise<BitkubV3Response<OrderBookEntry[]>>;
|
|
55
|
+
/**
|
|
56
|
+
* List open sell orders from the public order book.
|
|
57
|
+
*
|
|
58
|
+
* Endpoint: `GET /api/v3/market/asks`
|
|
59
|
+
* Auth: none
|
|
60
|
+
*
|
|
61
|
+
* Query:
|
|
62
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
63
|
+
* - `lmt` optional number of rows to return
|
|
64
|
+
*
|
|
65
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/asks?method=GET
|
|
66
|
+
*/
|
|
9
67
|
getAsks(symbol: string, limit?: number): Promise<BitkubV3Response<OrderBookEntry[]>>;
|
|
68
|
+
/**
|
|
69
|
+
* Get aggregated market depth for a symbol.
|
|
70
|
+
*
|
|
71
|
+
* Endpoint: `GET /api/v3/market/depth`
|
|
72
|
+
* Auth: none
|
|
73
|
+
*
|
|
74
|
+
* Query:
|
|
75
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
76
|
+
* - `lmt` optional depth size
|
|
77
|
+
*
|
|
78
|
+
* Returns bid and ask levels as `[price, size]` tuples.
|
|
79
|
+
*
|
|
80
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/depth?method=GET
|
|
81
|
+
*/
|
|
10
82
|
getDepth(symbol: string, limit?: number): Promise<BitkubV3Response<Depth>>;
|
|
83
|
+
/**
|
|
84
|
+
* List recent public trades for a symbol.
|
|
85
|
+
*
|
|
86
|
+
* Endpoint: `GET /api/v3/market/trades`
|
|
87
|
+
* Auth: none
|
|
88
|
+
*
|
|
89
|
+
* Query:
|
|
90
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
91
|
+
* - `lmt` optional number of trades to return
|
|
92
|
+
*
|
|
93
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/trades?method=GET
|
|
94
|
+
*/
|
|
11
95
|
getTrades(symbol: string, limit?: number): Promise<BitkubV3Response<RawTrade[]>>;
|
|
96
|
+
/**
|
|
97
|
+
* Check the remaining trading credit balance on the account.
|
|
98
|
+
*
|
|
99
|
+
* Endpoint: `POST /api/v3/user/trading-credits`
|
|
100
|
+
* Auth: secure endpoint
|
|
101
|
+
*
|
|
102
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/trading-credits?method=POST
|
|
103
|
+
*/
|
|
12
104
|
getTradingCredits(): Promise<BitkubV3Response<number>>;
|
|
105
|
+
/**
|
|
106
|
+
* Get fiat and crypto deposit/withdraw limits together with current usage.
|
|
107
|
+
*
|
|
108
|
+
* Endpoint: `POST /api/v3/user/limits`
|
|
109
|
+
* Auth: secure endpoint
|
|
110
|
+
*
|
|
111
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/limits?method=POST
|
|
112
|
+
*/
|
|
13
113
|
getLimits(): Promise<BitkubV3Response<LimitsResponse>>;
|
|
114
|
+
/**
|
|
115
|
+
* List coin conversion history for the authenticated user.
|
|
116
|
+
*
|
|
117
|
+
* Endpoint: `GET /api/v3/user/coin-convert-history`
|
|
118
|
+
* Auth: secure endpoint
|
|
119
|
+
*
|
|
120
|
+
* Query:
|
|
121
|
+
* - `p`, `lmt` pagination
|
|
122
|
+
* - `sort` sort direction
|
|
123
|
+
* - `status` conversion status
|
|
124
|
+
* - `sym` symbol filter
|
|
125
|
+
* - `start`, `end` timestamp range
|
|
126
|
+
*
|
|
127
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/coin-convert-history?method=GET
|
|
128
|
+
*/
|
|
14
129
|
getCoinConvertHistory(options?: CoinConvertHistoryOptions): Promise<BitkubV3Response<CoinConvertHistoryItem[]>>;
|
|
130
|
+
/**
|
|
131
|
+
* Get currently available balances by asset.
|
|
132
|
+
*
|
|
133
|
+
* Endpoint: `POST /api/v3/market/wallet`
|
|
134
|
+
* Auth: secure endpoint
|
|
135
|
+
*
|
|
136
|
+
* This endpoint returns available balances only. Use `getBalances()` for
|
|
137
|
+
* available plus reserved balances.
|
|
138
|
+
*
|
|
139
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/wallet?method=POST
|
|
140
|
+
*/
|
|
15
141
|
getWallet(): Promise<BitkubV3Response<Record<string, number>>>;
|
|
142
|
+
/**
|
|
143
|
+
* Get available and reserved balances by asset.
|
|
144
|
+
*
|
|
145
|
+
* Endpoint: `POST /api/v3/market/balances`
|
|
146
|
+
* Auth: secure endpoint
|
|
147
|
+
*
|
|
148
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/balances?method=POST
|
|
149
|
+
*/
|
|
16
150
|
getBalances(): Promise<BitkubV3Response<Record<string, BalanceInfo>>>;
|
|
151
|
+
/**
|
|
152
|
+
* Create a buy order.
|
|
153
|
+
*
|
|
154
|
+
* Endpoint: `POST /api/v3/market/place-bid`
|
|
155
|
+
* Auth: secure endpoint, trading permission required
|
|
156
|
+
*
|
|
157
|
+
* Body:
|
|
158
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
159
|
+
* - `amt` quote amount to spend
|
|
160
|
+
* - `rat` order rate; use `0` for market orders
|
|
161
|
+
* - `typ` `limit` or `market` (defaults to `limit` when omitted)
|
|
162
|
+
* - `client_id` optional client reference
|
|
163
|
+
* - `post_only` optional post-only flag
|
|
164
|
+
*
|
|
165
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/place-bid?method=POST
|
|
166
|
+
*/
|
|
17
167
|
placeBid(request: PlaceOrderRequest): Promise<BitkubV3Response<PlaceOrderResponse>>;
|
|
168
|
+
/**
|
|
169
|
+
* Create a sell order.
|
|
170
|
+
*
|
|
171
|
+
* Endpoint: `POST /api/v3/market/place-ask`
|
|
172
|
+
* Auth: secure endpoint, trading permission required
|
|
173
|
+
*
|
|
174
|
+
* Body:
|
|
175
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
176
|
+
* - `amt` base asset amount to sell
|
|
177
|
+
* - `rat` order rate; use `0` for market orders
|
|
178
|
+
* - `typ` `limit` or `market` (defaults to `limit` when omitted)
|
|
179
|
+
* - `client_id` optional client reference
|
|
180
|
+
* - `post_only` optional post-only flag
|
|
181
|
+
*
|
|
182
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/place-ask?method=POST
|
|
183
|
+
*/
|
|
18
184
|
placeAsk(request: PlaceOrderRequest): Promise<BitkubV3Response<PlaceOrderResponse>>;
|
|
185
|
+
/**
|
|
186
|
+
* Cancel an existing order.
|
|
187
|
+
*
|
|
188
|
+
* Endpoint: `POST /api/v3/market/cancel-order`
|
|
189
|
+
* Auth: secure endpoint, trading permission required
|
|
190
|
+
*
|
|
191
|
+
* Body:
|
|
192
|
+
* - `sym` market symbol
|
|
193
|
+
* - `id` order id
|
|
194
|
+
* - `sd` order side: `buy` or `sell`
|
|
195
|
+
*
|
|
196
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/cancel-order?method=POST
|
|
197
|
+
*/
|
|
19
198
|
cancelOrder(request: CancelOrderRequest): Promise<BitkubV3Response<unknown>>;
|
|
199
|
+
/**
|
|
200
|
+
* List current open orders for a symbol.
|
|
201
|
+
*
|
|
202
|
+
* Endpoint: `GET /api/v3/market/my-open-orders`
|
|
203
|
+
* Auth: secure endpoint
|
|
204
|
+
*
|
|
205
|
+
* Query:
|
|
206
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
207
|
+
*
|
|
208
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/my-open-orders?method=GET
|
|
209
|
+
*/
|
|
20
210
|
getMyOpenOrders(symbol: string): Promise<BitkubV3Response<OpenOrder[]>>;
|
|
211
|
+
/**
|
|
212
|
+
* List the authenticated user's order history for a symbol.
|
|
213
|
+
*
|
|
214
|
+
* Endpoint: `GET /api/v3/market/my-order-history`
|
|
215
|
+
* Auth: secure endpoint
|
|
216
|
+
*
|
|
217
|
+
* Query:
|
|
218
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
219
|
+
* - `p`, `lmt` page-based pagination
|
|
220
|
+
* - `cursor`, `pagination_type` cursor-based pagination
|
|
221
|
+
* - `start`, `end` date-time range
|
|
222
|
+
*
|
|
223
|
+
* Note: Bitkub announced page-based pagination deprecation for this
|
|
224
|
+
* endpoint on 2025-09-08, and order history older than 90 days is archived.
|
|
225
|
+
*
|
|
226
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/my-order-history?method=GET
|
|
227
|
+
*/
|
|
21
228
|
getMyOrderHistory(symbol: string, options?: OrderHistoryOptions): Promise<BitkubV3Response<OrderHistoryItem[]>>;
|
|
229
|
+
/**
|
|
230
|
+
* Get detailed information for a specific order.
|
|
231
|
+
*
|
|
232
|
+
* Endpoint: `GET /api/v3/market/order-info`
|
|
233
|
+
* Auth: secure endpoint
|
|
234
|
+
*
|
|
235
|
+
* Query:
|
|
236
|
+
* - `sym` market symbol
|
|
237
|
+
* - `id` order id
|
|
238
|
+
* - `sd` order side: `buy` or `sell`
|
|
239
|
+
*
|
|
240
|
+
* Returns order status, fill progress, remaining quantity, and fill history.
|
|
241
|
+
*
|
|
242
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/order-info?method=GET
|
|
243
|
+
*/
|
|
22
244
|
getOrderInfo(symbol: string, orderId: string, side: string): Promise<BitkubV3Response<OrderInfo>>;
|
|
245
|
+
/**
|
|
246
|
+
* List approved fiat withdrawal bank accounts.
|
|
247
|
+
*
|
|
248
|
+
* Endpoint: `POST /api/v3/fiat/accounts`
|
|
249
|
+
* Auth: secure endpoint, withdraw permission typically required
|
|
250
|
+
*
|
|
251
|
+
* Query:
|
|
252
|
+
* - `p` optional page number
|
|
253
|
+
* - `lmt` optional page size
|
|
254
|
+
*
|
|
255
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
256
|
+
* favor of Fiat v4 endpoints.
|
|
257
|
+
*
|
|
258
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/accounts?method=POST
|
|
259
|
+
*/
|
|
23
260
|
getFiatAccounts(page?: number, limit?: number): Promise<BitkubV3Response<BankAccount[]>>;
|
|
261
|
+
/**
|
|
262
|
+
* Withdraw fiat to an approved bank account.
|
|
263
|
+
*
|
|
264
|
+
* Endpoint: `POST /api/v3/fiat/withdraw`
|
|
265
|
+
* Auth: secure endpoint
|
|
266
|
+
*
|
|
267
|
+
* Body:
|
|
268
|
+
* - `id` approved bank account id
|
|
269
|
+
* - `amt` amount to withdraw
|
|
270
|
+
*
|
|
271
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
272
|
+
* favor of Fiat v4 endpoints.
|
|
273
|
+
*
|
|
274
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/withdraw?method=POST
|
|
275
|
+
*/
|
|
24
276
|
fiatWithdraw(request: FiatWithdrawRequest): Promise<BitkubV3Response<FiatWithdrawResponse>>;
|
|
277
|
+
/**
|
|
278
|
+
* List fiat deposit history.
|
|
279
|
+
*
|
|
280
|
+
* Endpoint: `POST /api/v3/fiat/deposit-history`
|
|
281
|
+
* Auth: secure endpoint
|
|
282
|
+
*
|
|
283
|
+
* Query:
|
|
284
|
+
* - `p` optional page number
|
|
285
|
+
* - `lmt` optional page size
|
|
286
|
+
*
|
|
287
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
288
|
+
* favor of Fiat v4 endpoints.
|
|
289
|
+
*
|
|
290
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/deposit-history?method=POST
|
|
291
|
+
*/
|
|
25
292
|
getFiatDepositHistory(page?: number, limit?: number): Promise<BitkubV3Response<FiatDepositHistoryItem[]>>;
|
|
293
|
+
/**
|
|
294
|
+
* List fiat withdrawal history.
|
|
295
|
+
*
|
|
296
|
+
* Endpoint: `POST /api/v3/fiat/withdraw-history`
|
|
297
|
+
* Auth: secure endpoint
|
|
298
|
+
*
|
|
299
|
+
* Query:
|
|
300
|
+
* - `p` optional page number
|
|
301
|
+
* - `lmt` optional page size
|
|
302
|
+
*
|
|
303
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
304
|
+
* favor of Fiat v4 endpoints.
|
|
305
|
+
*
|
|
306
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/withdraw-history?method=POST
|
|
307
|
+
*/
|
|
26
308
|
getFiatWithdrawHistory(page?: number, limit?: number): Promise<BitkubV3Response<FiatWithdrawHistoryItem[]>>;
|
|
27
309
|
}
|
package/dist/v3-client.js
CHANGED
|
@@ -3,43 +3,158 @@ export class BitkubV3Client extends BitkubBaseClient {
|
|
|
3
3
|
constructor(options) {
|
|
4
4
|
super(options);
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Get Bitkub service status information.
|
|
8
|
+
*
|
|
9
|
+
* Endpoint: `GET /api/status`
|
|
10
|
+
* Auth: none
|
|
11
|
+
*
|
|
12
|
+
* Returns exchange service components and their current status.
|
|
13
|
+
*
|
|
14
|
+
* @see https://api.bitkub.com/docs
|
|
15
|
+
*/
|
|
6
16
|
async getStatus() {
|
|
7
17
|
return this.sendRequest("GET", "/api/status");
|
|
8
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* List tradable market symbols and symbol metadata.
|
|
21
|
+
*
|
|
22
|
+
* Endpoint: `GET /api/v3/market/symbols`
|
|
23
|
+
* Auth: none
|
|
24
|
+
*
|
|
25
|
+
* Includes symbol-level configuration such as price step, quantity step,
|
|
26
|
+
* scaling, trading status, and freeze flags.
|
|
27
|
+
*
|
|
28
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/symbols?method=GET
|
|
29
|
+
*/
|
|
9
30
|
async getSymbols() {
|
|
10
31
|
return this.sendRequest("GET", "/api/v3/market/symbols");
|
|
11
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get 24h ticker data for one symbol or all symbols.
|
|
35
|
+
*
|
|
36
|
+
* Endpoint: `GET /api/v3/market/ticker`
|
|
37
|
+
* Auth: none
|
|
38
|
+
*
|
|
39
|
+
* Query:
|
|
40
|
+
* - `sym` optional market symbol such as `BTC_THB`
|
|
41
|
+
*
|
|
42
|
+
* Returns latest price, best bid/ask, 24h high/low, and volume fields.
|
|
43
|
+
*
|
|
44
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/ticker?method=GET
|
|
45
|
+
*/
|
|
12
46
|
async getTicker(symbol) {
|
|
13
47
|
return this.sendRequest("GET", "/api/v3/market/ticker", {
|
|
14
48
|
queryParams: symbol ? { sym: symbol } : undefined
|
|
15
49
|
});
|
|
16
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* List open buy orders from the public order book.
|
|
53
|
+
*
|
|
54
|
+
* Endpoint: `GET /api/v3/market/bids`
|
|
55
|
+
* Auth: none
|
|
56
|
+
*
|
|
57
|
+
* Query:
|
|
58
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
59
|
+
* - `lmt` optional number of rows to return
|
|
60
|
+
*
|
|
61
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/bids?method=GET
|
|
62
|
+
*/
|
|
17
63
|
async getBids(symbol, limit) {
|
|
18
64
|
return this.sendRequest("GET", "/api/v3/market/bids", {
|
|
19
65
|
queryParams: { sym: symbol, lmt: limit }
|
|
20
66
|
});
|
|
21
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* List open sell orders from the public order book.
|
|
70
|
+
*
|
|
71
|
+
* Endpoint: `GET /api/v3/market/asks`
|
|
72
|
+
* Auth: none
|
|
73
|
+
*
|
|
74
|
+
* Query:
|
|
75
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
76
|
+
* - `lmt` optional number of rows to return
|
|
77
|
+
*
|
|
78
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/asks?method=GET
|
|
79
|
+
*/
|
|
22
80
|
async getAsks(symbol, limit) {
|
|
23
81
|
return this.sendRequest("GET", "/api/v3/market/asks", {
|
|
24
82
|
queryParams: { sym: symbol, lmt: limit }
|
|
25
83
|
});
|
|
26
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Get aggregated market depth for a symbol.
|
|
87
|
+
*
|
|
88
|
+
* Endpoint: `GET /api/v3/market/depth`
|
|
89
|
+
* Auth: none
|
|
90
|
+
*
|
|
91
|
+
* Query:
|
|
92
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
93
|
+
* - `lmt` optional depth size
|
|
94
|
+
*
|
|
95
|
+
* Returns bid and ask levels as `[price, size]` tuples.
|
|
96
|
+
*
|
|
97
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/depth?method=GET
|
|
98
|
+
*/
|
|
27
99
|
async getDepth(symbol, limit) {
|
|
28
100
|
return this.sendRequest("GET", "/api/v3/market/depth", {
|
|
29
101
|
queryParams: { sym: symbol, lmt: limit }
|
|
30
102
|
});
|
|
31
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* List recent public trades for a symbol.
|
|
106
|
+
*
|
|
107
|
+
* Endpoint: `GET /api/v3/market/trades`
|
|
108
|
+
* Auth: none
|
|
109
|
+
*
|
|
110
|
+
* Query:
|
|
111
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
112
|
+
* - `lmt` optional number of trades to return
|
|
113
|
+
*
|
|
114
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/trades?method=GET
|
|
115
|
+
*/
|
|
32
116
|
async getTrades(symbol, limit) {
|
|
33
117
|
return this.sendRequest("GET", "/api/v3/market/trades", {
|
|
34
118
|
queryParams: { sym: symbol, lmt: limit }
|
|
35
119
|
});
|
|
36
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Check the remaining trading credit balance on the account.
|
|
123
|
+
*
|
|
124
|
+
* Endpoint: `POST /api/v3/user/trading-credits`
|
|
125
|
+
* Auth: secure endpoint
|
|
126
|
+
*
|
|
127
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/trading-credits?method=POST
|
|
128
|
+
*/
|
|
37
129
|
async getTradingCredits() {
|
|
38
130
|
return this.sendSecureRequest("POST", "/api/v3/user/trading-credits");
|
|
39
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Get fiat and crypto deposit/withdraw limits together with current usage.
|
|
134
|
+
*
|
|
135
|
+
* Endpoint: `POST /api/v3/user/limits`
|
|
136
|
+
* Auth: secure endpoint
|
|
137
|
+
*
|
|
138
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/limits?method=POST
|
|
139
|
+
*/
|
|
40
140
|
async getLimits() {
|
|
41
141
|
return this.sendSecureRequest("POST", "/api/v3/user/limits");
|
|
42
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* List coin conversion history for the authenticated user.
|
|
145
|
+
*
|
|
146
|
+
* Endpoint: `GET /api/v3/user/coin-convert-history`
|
|
147
|
+
* Auth: secure endpoint
|
|
148
|
+
*
|
|
149
|
+
* Query:
|
|
150
|
+
* - `p`, `lmt` pagination
|
|
151
|
+
* - `sort` sort direction
|
|
152
|
+
* - `status` conversion status
|
|
153
|
+
* - `sym` symbol filter
|
|
154
|
+
* - `start`, `end` timestamp range
|
|
155
|
+
*
|
|
156
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/user/coin-convert-history?method=GET
|
|
157
|
+
*/
|
|
43
158
|
async getCoinConvertHistory(options = {}) {
|
|
44
159
|
return this.sendSecureRequest("GET", "/api/v3/user/coin-convert-history", {
|
|
45
160
|
queryParams: {
|
|
@@ -53,32 +168,124 @@ export class BitkubV3Client extends BitkubBaseClient {
|
|
|
53
168
|
}
|
|
54
169
|
});
|
|
55
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Get currently available balances by asset.
|
|
173
|
+
*
|
|
174
|
+
* Endpoint: `POST /api/v3/market/wallet`
|
|
175
|
+
* Auth: secure endpoint
|
|
176
|
+
*
|
|
177
|
+
* This endpoint returns available balances only. Use `getBalances()` for
|
|
178
|
+
* available plus reserved balances.
|
|
179
|
+
*
|
|
180
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/wallet?method=POST
|
|
181
|
+
*/
|
|
56
182
|
async getWallet() {
|
|
57
183
|
return this.sendSecureRequest("POST", "/api/v3/market/wallet");
|
|
58
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Get available and reserved balances by asset.
|
|
187
|
+
*
|
|
188
|
+
* Endpoint: `POST /api/v3/market/balances`
|
|
189
|
+
* Auth: secure endpoint
|
|
190
|
+
*
|
|
191
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/balances?method=POST
|
|
192
|
+
*/
|
|
59
193
|
async getBalances() {
|
|
60
194
|
return this.sendSecureRequest("POST", "/api/v3/market/balances");
|
|
61
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Create a buy order.
|
|
198
|
+
*
|
|
199
|
+
* Endpoint: `POST /api/v3/market/place-bid`
|
|
200
|
+
* Auth: secure endpoint, trading permission required
|
|
201
|
+
*
|
|
202
|
+
* Body:
|
|
203
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
204
|
+
* - `amt` quote amount to spend
|
|
205
|
+
* - `rat` order rate; use `0` for market orders
|
|
206
|
+
* - `typ` `limit` or `market` (defaults to `limit` when omitted)
|
|
207
|
+
* - `client_id` optional client reference
|
|
208
|
+
* - `post_only` optional post-only flag
|
|
209
|
+
*
|
|
210
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/place-bid?method=POST
|
|
211
|
+
*/
|
|
62
212
|
async placeBid(request) {
|
|
63
213
|
return this.sendSecureRequest("POST", "/api/v3/market/place-bid", {
|
|
64
214
|
body: { typ: "limit", ...request }
|
|
65
215
|
});
|
|
66
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Create a sell order.
|
|
219
|
+
*
|
|
220
|
+
* Endpoint: `POST /api/v3/market/place-ask`
|
|
221
|
+
* Auth: secure endpoint, trading permission required
|
|
222
|
+
*
|
|
223
|
+
* Body:
|
|
224
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
225
|
+
* - `amt` base asset amount to sell
|
|
226
|
+
* - `rat` order rate; use `0` for market orders
|
|
227
|
+
* - `typ` `limit` or `market` (defaults to `limit` when omitted)
|
|
228
|
+
* - `client_id` optional client reference
|
|
229
|
+
* - `post_only` optional post-only flag
|
|
230
|
+
*
|
|
231
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/place-ask?method=POST
|
|
232
|
+
*/
|
|
67
233
|
async placeAsk(request) {
|
|
68
234
|
return this.sendSecureRequest("POST", "/api/v3/market/place-ask", {
|
|
69
235
|
body: { typ: "limit", ...request }
|
|
70
236
|
});
|
|
71
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Cancel an existing order.
|
|
240
|
+
*
|
|
241
|
+
* Endpoint: `POST /api/v3/market/cancel-order`
|
|
242
|
+
* Auth: secure endpoint, trading permission required
|
|
243
|
+
*
|
|
244
|
+
* Body:
|
|
245
|
+
* - `sym` market symbol
|
|
246
|
+
* - `id` order id
|
|
247
|
+
* - `sd` order side: `buy` or `sell`
|
|
248
|
+
*
|
|
249
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/cancel-order?method=POST
|
|
250
|
+
*/
|
|
72
251
|
async cancelOrder(request) {
|
|
73
252
|
return this.sendSecureRequest("POST", "/api/v3/market/cancel-order", {
|
|
74
253
|
body: request
|
|
75
254
|
});
|
|
76
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* List current open orders for a symbol.
|
|
258
|
+
*
|
|
259
|
+
* Endpoint: `GET /api/v3/market/my-open-orders`
|
|
260
|
+
* Auth: secure endpoint
|
|
261
|
+
*
|
|
262
|
+
* Query:
|
|
263
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
264
|
+
*
|
|
265
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/my-open-orders?method=GET
|
|
266
|
+
*/
|
|
77
267
|
async getMyOpenOrders(symbol) {
|
|
78
268
|
return this.sendSecureRequest("GET", "/api/v3/market/my-open-orders", {
|
|
79
269
|
queryParams: { sym: symbol }
|
|
80
270
|
});
|
|
81
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* List the authenticated user's order history for a symbol.
|
|
274
|
+
*
|
|
275
|
+
* Endpoint: `GET /api/v3/market/my-order-history`
|
|
276
|
+
* Auth: secure endpoint
|
|
277
|
+
*
|
|
278
|
+
* Query:
|
|
279
|
+
* - `sym` market symbol such as `BTC_THB`
|
|
280
|
+
* - `p`, `lmt` page-based pagination
|
|
281
|
+
* - `cursor`, `pagination_type` cursor-based pagination
|
|
282
|
+
* - `start`, `end` date-time range
|
|
283
|
+
*
|
|
284
|
+
* Note: Bitkub announced page-based pagination deprecation for this
|
|
285
|
+
* endpoint on 2025-09-08, and order history older than 90 days is archived.
|
|
286
|
+
*
|
|
287
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/my-order-history?method=GET
|
|
288
|
+
*/
|
|
82
289
|
async getMyOrderHistory(symbol, options = {}) {
|
|
83
290
|
return this.sendSecureRequest("GET", "/api/v3/market/my-order-history", {
|
|
84
291
|
queryParams: {
|
|
@@ -92,6 +299,21 @@ export class BitkubV3Client extends BitkubBaseClient {
|
|
|
92
299
|
}
|
|
93
300
|
});
|
|
94
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Get detailed information for a specific order.
|
|
304
|
+
*
|
|
305
|
+
* Endpoint: `GET /api/v3/market/order-info`
|
|
306
|
+
* Auth: secure endpoint
|
|
307
|
+
*
|
|
308
|
+
* Query:
|
|
309
|
+
* - `sym` market symbol
|
|
310
|
+
* - `id` order id
|
|
311
|
+
* - `sd` order side: `buy` or `sell`
|
|
312
|
+
*
|
|
313
|
+
* Returns order status, fill progress, remaining quantity, and fill history.
|
|
314
|
+
*
|
|
315
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/market/order-info?method=GET
|
|
316
|
+
*/
|
|
95
317
|
async getOrderInfo(symbol, orderId, side) {
|
|
96
318
|
return this.sendSecureRequest("GET", "/api/v3/market/order-info", {
|
|
97
319
|
queryParams: {
|
|
@@ -101,21 +323,81 @@ export class BitkubV3Client extends BitkubBaseClient {
|
|
|
101
323
|
}
|
|
102
324
|
});
|
|
103
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* List approved fiat withdrawal bank accounts.
|
|
328
|
+
*
|
|
329
|
+
* Endpoint: `POST /api/v3/fiat/accounts`
|
|
330
|
+
* Auth: secure endpoint, withdraw permission typically required
|
|
331
|
+
*
|
|
332
|
+
* Query:
|
|
333
|
+
* - `p` optional page number
|
|
334
|
+
* - `lmt` optional page size
|
|
335
|
+
*
|
|
336
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
337
|
+
* favor of Fiat v4 endpoints.
|
|
338
|
+
*
|
|
339
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/accounts?method=POST
|
|
340
|
+
*/
|
|
104
341
|
async getFiatAccounts(page, limit) {
|
|
105
342
|
return this.sendSecureRequest("POST", "/api/v3/fiat/accounts", {
|
|
106
343
|
queryParams: { p: page, lmt: limit }
|
|
107
344
|
});
|
|
108
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Withdraw fiat to an approved bank account.
|
|
348
|
+
*
|
|
349
|
+
* Endpoint: `POST /api/v3/fiat/withdraw`
|
|
350
|
+
* Auth: secure endpoint
|
|
351
|
+
*
|
|
352
|
+
* Body:
|
|
353
|
+
* - `id` approved bank account id
|
|
354
|
+
* - `amt` amount to withdraw
|
|
355
|
+
*
|
|
356
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
357
|
+
* favor of Fiat v4 endpoints.
|
|
358
|
+
*
|
|
359
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/withdraw?method=POST
|
|
360
|
+
*/
|
|
109
361
|
async fiatWithdraw(request) {
|
|
110
362
|
return this.sendSecureRequest("POST", "/api/v3/fiat/withdraw", {
|
|
111
363
|
body: request
|
|
112
364
|
});
|
|
113
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* List fiat deposit history.
|
|
368
|
+
*
|
|
369
|
+
* Endpoint: `POST /api/v3/fiat/deposit-history`
|
|
370
|
+
* Auth: secure endpoint
|
|
371
|
+
*
|
|
372
|
+
* Query:
|
|
373
|
+
* - `p` optional page number
|
|
374
|
+
* - `lmt` optional page size
|
|
375
|
+
*
|
|
376
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
377
|
+
* favor of Fiat v4 endpoints.
|
|
378
|
+
*
|
|
379
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/deposit-history?method=POST
|
|
380
|
+
*/
|
|
114
381
|
async getFiatDepositHistory(page, limit) {
|
|
115
382
|
return this.sendSecureRequest("POST", "/api/v3/fiat/deposit-history", {
|
|
116
383
|
queryParams: { p: page, lmt: limit }
|
|
117
384
|
});
|
|
118
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* List fiat withdrawal history.
|
|
388
|
+
*
|
|
389
|
+
* Endpoint: `POST /api/v3/fiat/withdraw-history`
|
|
390
|
+
* Auth: secure endpoint
|
|
391
|
+
*
|
|
392
|
+
* Query:
|
|
393
|
+
* - `p` optional page number
|
|
394
|
+
* - `lmt` optional page size
|
|
395
|
+
*
|
|
396
|
+
* Note: Bitkub announced v3 fiat endpoint deprecation on 2026-06-09 in
|
|
397
|
+
* favor of Fiat v4 endpoints.
|
|
398
|
+
*
|
|
399
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v3/fiat/withdraw-history?method=POST
|
|
400
|
+
*/
|
|
119
401
|
async getFiatWithdrawHistory(page, limit) {
|
|
120
402
|
return this.sendSecureRequest("POST", "/api/v3/fiat/withdraw-history", {
|
|
121
403
|
queryParams: { p: page, lmt: limit }
|
package/dist/v4-client.d.ts
CHANGED
|
@@ -2,11 +2,121 @@ import { BitkubBaseClient, type BitkubClientOptions } from "./base-client.js";
|
|
|
2
2
|
import type { BitkubV4Response, CoinsOptions, CoinsResponse, CompensationsOptions, CompensationsResponse, CreateCryptoAddressRequest, CreateCryptoWithdrawRequest, CreateCryptoWithdrawResponse, CryptoAddress, CryptoAddressesOptions, CryptoAddressesResponse, CryptoDepositsOptions, CryptoDepositsResponse, CryptoWithdrawsOptions, CryptoWithdrawsResponse } from "./types/v4.js";
|
|
3
3
|
export declare class BitkubV4Client extends BitkubBaseClient {
|
|
4
4
|
constructor(options: BitkubClientOptions);
|
|
5
|
+
/**
|
|
6
|
+
* List crypto deposit addresses for the authenticated account.
|
|
7
|
+
*
|
|
8
|
+
* Endpoint: `GET /api/v4/crypto/addresses`
|
|
9
|
+
* Auth: secure endpoint
|
|
10
|
+
*
|
|
11
|
+
* Query:
|
|
12
|
+
* - `page` optional page number, default `1`
|
|
13
|
+
* - `limit` optional page size, default `100`, max `200`
|
|
14
|
+
* - `symbol` optional coin symbol such as `ATOM`
|
|
15
|
+
* - `network` optional network such as `ATOM`
|
|
16
|
+
* - `memo` optional memo filter
|
|
17
|
+
*
|
|
18
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/addresses?method=GET
|
|
19
|
+
*/
|
|
5
20
|
getCryptoAddresses(options?: CryptoAddressesOptions): Promise<BitkubV4Response<CryptoAddressesResponse>>;
|
|
21
|
+
/**
|
|
22
|
+
* Generate or return an existing crypto deposit address.
|
|
23
|
+
*
|
|
24
|
+
* Endpoint: `POST /api/v4/crypto/addresses`
|
|
25
|
+
* Auth: secure endpoint, `is_deposit` permission required
|
|
26
|
+
*
|
|
27
|
+
* Body:
|
|
28
|
+
* - `symbol` coin symbol such as `ETH`
|
|
29
|
+
* - `network` network such as `ETH`
|
|
30
|
+
*
|
|
31
|
+
* Per the official docs, if an address already exists Bitkub returns the
|
|
32
|
+
* existing address instead of creating a new one.
|
|
33
|
+
*
|
|
34
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/addresses?method=POST
|
|
35
|
+
*/
|
|
6
36
|
createCryptoAddress(request: CreateCryptoAddressRequest): Promise<BitkubV4Response<CryptoAddress[]>>;
|
|
37
|
+
/**
|
|
38
|
+
* List crypto deposit history.
|
|
39
|
+
*
|
|
40
|
+
* Endpoint: `GET /api/v4/crypto/deposits`
|
|
41
|
+
* Auth: secure endpoint
|
|
42
|
+
*
|
|
43
|
+
* Query:
|
|
44
|
+
* - `page` optional page number
|
|
45
|
+
* - `limit` optional page size, max `200`
|
|
46
|
+
* - `symbol` optional coin symbol
|
|
47
|
+
* - `status` optional deposit status: `pending`, `rejected`, `complete`
|
|
48
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
49
|
+
*
|
|
50
|
+
* Note: the official docs state only the last 90 days of deposit history are
|
|
51
|
+
* returned.
|
|
52
|
+
*
|
|
53
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/deposits?method=GET
|
|
54
|
+
*/
|
|
7
55
|
getCryptoDeposits(options?: CryptoDepositsOptions): Promise<BitkubV4Response<CryptoDepositsResponse>>;
|
|
56
|
+
/**
|
|
57
|
+
* List crypto withdrawal history.
|
|
58
|
+
*
|
|
59
|
+
* Endpoint: `GET /api/v4/crypto/withdraws`
|
|
60
|
+
* Auth: secure endpoint
|
|
61
|
+
*
|
|
62
|
+
* Query:
|
|
63
|
+
* - `page` optional page number
|
|
64
|
+
* - `limit` optional page size, max `200`
|
|
65
|
+
* - `symbol` optional coin symbol
|
|
66
|
+
* - `status` optional withdrawal status: `pending`, `processing`,
|
|
67
|
+
* `reported`, `rejected`, `complete`
|
|
68
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
69
|
+
*
|
|
70
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/withdraws?method=GET
|
|
71
|
+
*/
|
|
8
72
|
getCryptoWithdraws(options?: CryptoWithdrawsOptions): Promise<BitkubV4Response<CryptoWithdrawsResponse>>;
|
|
73
|
+
/**
|
|
74
|
+
* Withdraw crypto to a trusted address.
|
|
75
|
+
*
|
|
76
|
+
* Endpoint: `POST /api/v4/crypto/withdraws`
|
|
77
|
+
* Auth: secure endpoint, `is_withdraw` permission required
|
|
78
|
+
*
|
|
79
|
+
* Body:
|
|
80
|
+
* - `symbol` coin symbol such as `BTC`
|
|
81
|
+
* - `amount` amount to withdraw
|
|
82
|
+
* - `address` trusted destination address
|
|
83
|
+
* - `memo` optional memo or destination tag
|
|
84
|
+
* - `network` withdrawal network
|
|
85
|
+
*
|
|
86
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/withdraws?method=POST
|
|
87
|
+
*/
|
|
9
88
|
createCryptoWithdraw(request: CreateCryptoWithdrawRequest): Promise<BitkubV4Response<CreateCryptoWithdrawResponse>>;
|
|
89
|
+
/**
|
|
90
|
+
* List coin metadata and deposit/withdraw availability.
|
|
91
|
+
*
|
|
92
|
+
* Endpoint: `GET /api/v4/crypto/coins`
|
|
93
|
+
* Auth: secure endpoint
|
|
94
|
+
*
|
|
95
|
+
* Query:
|
|
96
|
+
* - `symbol` optional coin symbol
|
|
97
|
+
* - `network` optional network
|
|
98
|
+
*
|
|
99
|
+
* Returns coin/network settings such as regex validation, explorer URL,
|
|
100
|
+
* fees, minimums, confirmations, and enablement flags.
|
|
101
|
+
*
|
|
102
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/coins?method=GET
|
|
103
|
+
*/
|
|
10
104
|
getCoins(options?: CoinsOptions): Promise<BitkubV4Response<CoinsResponse>>;
|
|
105
|
+
/**
|
|
106
|
+
* List crypto compensation history.
|
|
107
|
+
*
|
|
108
|
+
* Endpoint: `GET /api/v4/crypto/compensations`
|
|
109
|
+
* Auth: secure endpoint
|
|
110
|
+
*
|
|
111
|
+
* Query:
|
|
112
|
+
* - `page` optional page number
|
|
113
|
+
* - `limit` optional page size, max `200`
|
|
114
|
+
* - `symbol` optional coin symbol
|
|
115
|
+
* - `type` optional compensation type: `COMPENSATE` or `DECOMPENSATE`
|
|
116
|
+
* - `status` optional status; current docs show `complete`
|
|
117
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
118
|
+
*
|
|
119
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/compensations?method=GET
|
|
120
|
+
*/
|
|
11
121
|
getCompensations(options?: CompensationsOptions): Promise<BitkubV4Response<CompensationsResponse>>;
|
|
12
122
|
}
|
package/dist/v4-client.js
CHANGED
|
@@ -3,6 +3,21 @@ export class BitkubV4Client extends BitkubBaseClient {
|
|
|
3
3
|
constructor(options) {
|
|
4
4
|
super(options);
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* List crypto deposit addresses for the authenticated account.
|
|
8
|
+
*
|
|
9
|
+
* Endpoint: `GET /api/v4/crypto/addresses`
|
|
10
|
+
* Auth: secure endpoint
|
|
11
|
+
*
|
|
12
|
+
* Query:
|
|
13
|
+
* - `page` optional page number, default `1`
|
|
14
|
+
* - `limit` optional page size, default `100`, max `200`
|
|
15
|
+
* - `symbol` optional coin symbol such as `ATOM`
|
|
16
|
+
* - `network` optional network such as `ATOM`
|
|
17
|
+
* - `memo` optional memo filter
|
|
18
|
+
*
|
|
19
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/addresses?method=GET
|
|
20
|
+
*/
|
|
6
21
|
async getCryptoAddresses(options = {}) {
|
|
7
22
|
return this.sendSecureRequest("GET", "/api/v4/crypto/addresses", {
|
|
8
23
|
queryParams: {
|
|
@@ -14,11 +29,44 @@ export class BitkubV4Client extends BitkubBaseClient {
|
|
|
14
29
|
}
|
|
15
30
|
});
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Generate or return an existing crypto deposit address.
|
|
34
|
+
*
|
|
35
|
+
* Endpoint: `POST /api/v4/crypto/addresses`
|
|
36
|
+
* Auth: secure endpoint, `is_deposit` permission required
|
|
37
|
+
*
|
|
38
|
+
* Body:
|
|
39
|
+
* - `symbol` coin symbol such as `ETH`
|
|
40
|
+
* - `network` network such as `ETH`
|
|
41
|
+
*
|
|
42
|
+
* Per the official docs, if an address already exists Bitkub returns the
|
|
43
|
+
* existing address instead of creating a new one.
|
|
44
|
+
*
|
|
45
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/addresses?method=POST
|
|
46
|
+
*/
|
|
17
47
|
async createCryptoAddress(request) {
|
|
18
48
|
return this.sendSecureRequest("POST", "/api/v4/crypto/addresses", {
|
|
19
49
|
body: request
|
|
20
50
|
});
|
|
21
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* List crypto deposit history.
|
|
54
|
+
*
|
|
55
|
+
* Endpoint: `GET /api/v4/crypto/deposits`
|
|
56
|
+
* Auth: secure endpoint
|
|
57
|
+
*
|
|
58
|
+
* Query:
|
|
59
|
+
* - `page` optional page number
|
|
60
|
+
* - `limit` optional page size, max `200`
|
|
61
|
+
* - `symbol` optional coin symbol
|
|
62
|
+
* - `status` optional deposit status: `pending`, `rejected`, `complete`
|
|
63
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
64
|
+
*
|
|
65
|
+
* Note: the official docs state only the last 90 days of deposit history are
|
|
66
|
+
* returned.
|
|
67
|
+
*
|
|
68
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/deposits?method=GET
|
|
69
|
+
*/
|
|
22
70
|
async getCryptoDeposits(options = {}) {
|
|
23
71
|
return this.sendSecureRequest("GET", "/api/v4/crypto/deposits", {
|
|
24
72
|
queryParams: {
|
|
@@ -31,6 +79,22 @@ export class BitkubV4Client extends BitkubBaseClient {
|
|
|
31
79
|
}
|
|
32
80
|
});
|
|
33
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* List crypto withdrawal history.
|
|
84
|
+
*
|
|
85
|
+
* Endpoint: `GET /api/v4/crypto/withdraws`
|
|
86
|
+
* Auth: secure endpoint
|
|
87
|
+
*
|
|
88
|
+
* Query:
|
|
89
|
+
* - `page` optional page number
|
|
90
|
+
* - `limit` optional page size, max `200`
|
|
91
|
+
* - `symbol` optional coin symbol
|
|
92
|
+
* - `status` optional withdrawal status: `pending`, `processing`,
|
|
93
|
+
* `reported`, `rejected`, `complete`
|
|
94
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
95
|
+
*
|
|
96
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/withdraws?method=GET
|
|
97
|
+
*/
|
|
34
98
|
async getCryptoWithdraws(options = {}) {
|
|
35
99
|
return this.sendSecureRequest("GET", "/api/v4/crypto/withdraws", {
|
|
36
100
|
queryParams: {
|
|
@@ -43,11 +107,41 @@ export class BitkubV4Client extends BitkubBaseClient {
|
|
|
43
107
|
}
|
|
44
108
|
});
|
|
45
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Withdraw crypto to a trusted address.
|
|
112
|
+
*
|
|
113
|
+
* Endpoint: `POST /api/v4/crypto/withdraws`
|
|
114
|
+
* Auth: secure endpoint, `is_withdraw` permission required
|
|
115
|
+
*
|
|
116
|
+
* Body:
|
|
117
|
+
* - `symbol` coin symbol such as `BTC`
|
|
118
|
+
* - `amount` amount to withdraw
|
|
119
|
+
* - `address` trusted destination address
|
|
120
|
+
* - `memo` optional memo or destination tag
|
|
121
|
+
* - `network` withdrawal network
|
|
122
|
+
*
|
|
123
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/withdraws?method=POST
|
|
124
|
+
*/
|
|
46
125
|
async createCryptoWithdraw(request) {
|
|
47
126
|
return this.sendSecureRequest("POST", "/api/v4/crypto/withdraws", {
|
|
48
127
|
body: request
|
|
49
128
|
});
|
|
50
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* List coin metadata and deposit/withdraw availability.
|
|
132
|
+
*
|
|
133
|
+
* Endpoint: `GET /api/v4/crypto/coins`
|
|
134
|
+
* Auth: secure endpoint
|
|
135
|
+
*
|
|
136
|
+
* Query:
|
|
137
|
+
* - `symbol` optional coin symbol
|
|
138
|
+
* - `network` optional network
|
|
139
|
+
*
|
|
140
|
+
* Returns coin/network settings such as regex validation, explorer URL,
|
|
141
|
+
* fees, minimums, confirmations, and enablement flags.
|
|
142
|
+
*
|
|
143
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/coins?method=GET
|
|
144
|
+
*/
|
|
51
145
|
async getCoins(options = {}) {
|
|
52
146
|
return this.sendSecureRequest("GET", "/api/v4/crypto/coins", {
|
|
53
147
|
queryParams: {
|
|
@@ -56,6 +150,22 @@ export class BitkubV4Client extends BitkubBaseClient {
|
|
|
56
150
|
}
|
|
57
151
|
});
|
|
58
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* List crypto compensation history.
|
|
155
|
+
*
|
|
156
|
+
* Endpoint: `GET /api/v4/crypto/compensations`
|
|
157
|
+
* Auth: secure endpoint
|
|
158
|
+
*
|
|
159
|
+
* Query:
|
|
160
|
+
* - `page` optional page number
|
|
161
|
+
* - `limit` optional page size, max `200`
|
|
162
|
+
* - `symbol` optional coin symbol
|
|
163
|
+
* - `type` optional compensation type: `COMPENSATE` or `DECOMPENSATE`
|
|
164
|
+
* - `status` optional status; current docs show `complete`
|
|
165
|
+
* - `created_start`, `created_end` optional ISO 8601 time range
|
|
166
|
+
*
|
|
167
|
+
* @see https://api.bitkub.com/docs/endpoint/api/v4/crypto/compensations?method=GET
|
|
168
|
+
*/
|
|
59
169
|
async getCompensations(options = {}) {
|
|
60
170
|
return this.sendSecureRequest("GET", "/api/v4/crypto/compensations", {
|
|
61
171
|
queryParams: {
|