cloreai 0.1.16 → 0.1.17
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/build/{cloreai/CloreAI.d.ts → CloreAI.d.ts} +9 -0
- package/build/{cloreai/CloreAI.js → CloreAI.js} +59 -14
- package/build/{common/constants.d.ts → constants.d.ts} +4 -0
- package/build/{common/constants.js → constants.js} +4 -0
- package/build/endpoints/cancelOrder.d.ts +6 -0
- package/build/endpoints/cancelOrders.d.ts +7 -0
- package/build/endpoints/createGigaspotOrders.d.ts +22 -0
- package/build/{common/endpoints → endpoints}/createOrder.d.ts +3 -2
- package/build/endpoints/editGigaspotOrders.d.ts +19 -0
- package/build/endpoints/getGigaspot.d.ts +46 -0
- package/build/endpoints/marketplace.d.ts +24 -0
- package/build/{common/endpoints → endpoints}/myOrders.d.ts +9 -2
- package/build/{cloreai/endpoints → endpoints}/myServers.d.ts +1 -2
- package/build/{cloreai/endpoints → endpoints}/serverConfig.d.ts +1 -2
- package/build/endpoints/setSpotPrice.d.ts +17 -0
- package/build/endpoints/spotMarketplace.d.ts +26 -0
- package/build/{cloreai/endpoints → endpoints}/wallets.d.ts +1 -2
- package/build/index.d.ts +14 -3
- package/build/index.js +3 -3
- package/build/{common/types.d.ts → types.d.ts} +5 -3
- package/package.json +6 -18
- package/build/cloreai/endpoints/cancelOrder.d.ts +0 -6
- package/build/cloreai/endpoints/createOrder.d.ts +0 -4
- package/build/cloreai/endpoints/marketplace.d.ts +0 -6
- package/build/cloreai/endpoints/myOrders.d.ts +0 -9
- package/build/cloreai/endpoints/setSpotPrice.d.ts +0 -4
- package/build/cloreai/endpoints/spotMarketplace.d.ts +0 -9
- package/build/cloreai/index.d.ts +0 -13
- package/build/cloreai/index.js +0 -2
- package/build/cloreai/types.d.ts +0 -7
- package/build/common/endpoints/cancelOrder.d.ts +0 -3
- package/build/common/endpoints/cancelOrder.js +0 -2
- package/build/common/endpoints/marketplace.d.ts +0 -19
- package/build/common/endpoints/setSpotPrice.d.ts +0 -16
- package/build/common/endpoints/spotMarketplace.d.ts +0 -19
- package/build/common/endpoints/spotMarketplace.js +0 -1
- package/build/common/helpers.d.ts +0 -6
- package/build/common/helpers.js +0 -25
- package/build/common/index.d.ts +0 -10
- package/build/common/index.js +0 -3
- package/build/common/types.js +0 -1
- package/build/webapi/WebAPI.d.ts +0 -22
- package/build/webapi/WebAPI.js +0 -80
- package/build/webapi/endpoints/cancelOrder.d.ts +0 -6
- package/build/webapi/endpoints/cancelOrder.js +0 -1
- package/build/webapi/endpoints/createOrder.d.ts +0 -4
- package/build/webapi/endpoints/createOrder.js +0 -1
- package/build/webapi/endpoints/marketplace.d.ts +0 -10
- package/build/webapi/endpoints/marketplace.js +0 -1
- package/build/webapi/endpoints/myOrders.d.ts +0 -15
- package/build/webapi/endpoints/myOrders.js +0 -1
- package/build/webapi/endpoints/setSpotPrice.d.ts +0 -4
- package/build/webapi/endpoints/setSpotPrice.js +0 -1
- package/build/webapi/endpoints/spotMarketplace.d.ts +0 -8
- package/build/webapi/endpoints/spotMarketplace.js +0 -1
- package/build/webapi/index.d.ts +0 -9
- package/build/webapi/index.js +0 -2
- package/build/webapi/types.d.ts +0 -7
- package/build/webapi/types.js +0 -1
- package/build/webapi.d.ts +0 -4
- package/build/webapi.js +0 -4
- /package/build/{cloreai/endpoints → endpoints}/cancelOrder.js +0 -0
- /package/build/{cloreai/endpoints/createOrder.js → endpoints/cancelOrders.js} +0 -0
- /package/build/{cloreai/endpoints/marketplace.js → endpoints/createGigaspotOrders.js} +0 -0
- /package/build/{common/endpoints → endpoints}/createOrder.js +0 -0
- /package/build/{cloreai/endpoints/myOrders.js → endpoints/editGigaspotOrders.js} +0 -0
- /package/build/{cloreai/endpoints/myServers.js → endpoints/getGigaspot.js} +0 -0
- /package/build/{common/endpoints → endpoints}/marketplace.js +0 -0
- /package/build/{common/endpoints → endpoints}/myOrders.js +0 -0
- /package/build/{cloreai/endpoints/serverConfig.js → endpoints/myServers.js} +0 -0
- /package/build/{cloreai/endpoints/setServerSettings.js → endpoints/serverConfig.js} +0 -0
- /package/build/{cloreai/endpoints → endpoints}/setServerSettings.d.ts +0 -0
- /package/build/{cloreai/endpoints/setSpotPrice.js → endpoints/setServerSettings.js} +0 -0
- /package/build/{common/endpoints → endpoints}/setSpotPrice.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/spotMarketplace.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/wallets.js +0 -0
- /package/build/{common/errors.d.ts → errors.d.ts} +0 -0
- /package/build/{common/errors.js → errors.js} +0 -0
- /package/build/{cloreai/types.js → types.js} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
3
|
import type { CancelOrderRequestData, CancelOrderResponseData } from './endpoints/cancelOrder.js';
|
|
4
|
+
import type { CancelOrdersRequestData, CancelOrdersResponseData } from './endpoints/cancelOrders.js';
|
|
5
|
+
import type { CreateGigaspotOrdersRequestData, CreateGigaspotOrdersResponseData } from './endpoints/createGigaspotOrders.js';
|
|
4
6
|
import type { CreateOrderRequestData, CreateOrderResponseData } from './endpoints/createOrder.js';
|
|
7
|
+
import type { EditGigaspotOrdersRequestData, EditGigaspotOrdersResponseData } from './endpoints/editGigaspotOrders.js';
|
|
8
|
+
import type { GetGigaspotResponseData } from './endpoints/getGigaspot.js';
|
|
5
9
|
import type { MarketplaceResponseData } from './endpoints/marketplace.js';
|
|
6
10
|
import type { MyOrdersRequestParams, MyOrdersResponseData } from './endpoints/myOrders.js';
|
|
7
11
|
import type { MyServersResponseData } from './endpoints/myServers.js';
|
|
@@ -16,6 +20,7 @@ declare class CloreAI {
|
|
|
16
20
|
rateLimitQueue: PQueue;
|
|
17
21
|
rateLimitQueueCreateOrder: PQueue;
|
|
18
22
|
constructor(config: Config);
|
|
23
|
+
private getQueueOptions;
|
|
19
24
|
wallets(config?: AxiosRequestConfig): Promise<WalletsResponseData>;
|
|
20
25
|
myServers(config?: AxiosRequestConfig): Promise<MyServersResponseData>;
|
|
21
26
|
serverConfig(data: ServerConfigRequestData, config?: AxiosRequestConfig): Promise<ServerConfigResponseData>;
|
|
@@ -26,5 +31,9 @@ declare class CloreAI {
|
|
|
26
31
|
setSpotPrice(data: SetSpotPriceRequestData, config?: AxiosRequestConfig): Promise<SetSpotPriceResponseData>;
|
|
27
32
|
cancelOrder(data: CancelOrderRequestData, config?: AxiosRequestConfig): Promise<CancelOrderResponseData>;
|
|
28
33
|
createOrder(data: CreateOrderRequestData, config?: AxiosRequestConfig): Promise<CreateOrderResponseData>;
|
|
34
|
+
getGigaspot(config?: AxiosRequestConfig): Promise<GetGigaspotResponseData>;
|
|
35
|
+
createGigaspotOrders(data: CreateGigaspotOrdersRequestData, config?: AxiosRequestConfig): Promise<CreateGigaspotOrdersResponseData>;
|
|
36
|
+
editGigaspotOrders(data: EditGigaspotOrdersRequestData, config?: AxiosRequestConfig): Promise<EditGigaspotOrdersResponseData>;
|
|
37
|
+
cancelOrders(data: CancelOrdersRequestData, config?: AxiosRequestConfig): Promise<CancelOrdersResponseData>;
|
|
29
38
|
}
|
|
30
39
|
export default CloreAI;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER, statusCodes } from '
|
|
4
|
-
import { DatabaseError, ExceededError, InvalidApiTokenError, InvalidEndpointError, InvalidInputDataError, OtherError, UnknownError } from '
|
|
5
|
-
import { getErrorMessage, getQueueOptions } from '../common/helpers.js';
|
|
3
|
+
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER, statusCodes } from './constants.js';
|
|
4
|
+
import { DatabaseError, ExceededError, InvalidApiTokenError, InvalidEndpointError, InvalidInputDataError, OtherError, UnknownError } from './errors.js';
|
|
6
5
|
class CloreAI {
|
|
7
6
|
axios;
|
|
8
7
|
rateLimitQueue;
|
|
@@ -32,7 +31,9 @@ class CloreAI {
|
|
|
32
31
|
if (response.data.code === statusCodes.NORMAL) {
|
|
33
32
|
return response;
|
|
34
33
|
}
|
|
35
|
-
const errorMessage =
|
|
34
|
+
const errorMessage = response.data.error != null
|
|
35
|
+
? `Code "${response.status}", error "${response.data.error}"`
|
|
36
|
+
: `Code "${response.status}"`;
|
|
36
37
|
const axiosErrorParameters = [
|
|
37
38
|
errorMessage,
|
|
38
39
|
undefined,
|
|
@@ -58,64 +59,108 @@ class CloreAI {
|
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/class-methods-use-this -- Ignore
|
|
63
|
+
getQueueOptions(priority, config) {
|
|
64
|
+
const defaultQueueOptions = {
|
|
65
|
+
throwOnTimeout: true,
|
|
66
|
+
priority,
|
|
67
|
+
};
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- GenericAbortSignal
|
|
69
|
+
const signal = config?.signal;
|
|
70
|
+
if (signal == null) {
|
|
71
|
+
return defaultQueueOptions;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
...defaultQueueOptions,
|
|
75
|
+
signal,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
61
78
|
async wallets(config) {
|
|
62
79
|
const response = await this.rateLimitQueue.add(async () => {
|
|
63
80
|
return await this.axios.get('/wallets', config);
|
|
64
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
81
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
65
82
|
return response.data;
|
|
66
83
|
}
|
|
67
84
|
async myServers(config) {
|
|
68
85
|
const response = await this.rateLimitQueue.add(async () => {
|
|
69
86
|
return await this.axios.get('/my_servers', config);
|
|
70
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
87
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
71
88
|
return response.data;
|
|
72
89
|
}
|
|
73
90
|
async serverConfig(data, config) {
|
|
74
91
|
const response = await this.rateLimitQueue.add(async () => {
|
|
75
92
|
return await this.axios.get('/server_config', { ...config, data });
|
|
76
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
93
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
77
94
|
return response.data;
|
|
78
95
|
}
|
|
79
96
|
async marketplace(config) {
|
|
80
97
|
const response = await this.rateLimitQueue.add(async () => {
|
|
81
98
|
return await this.axios.get('/marketplace', config);
|
|
82
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
99
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
83
100
|
return response.data;
|
|
84
101
|
}
|
|
85
102
|
async myOrders(params, config) {
|
|
86
103
|
const response = await this.rateLimitQueue.add(async () => {
|
|
87
104
|
return await this.axios.get('/my_orders', { ...config, params });
|
|
88
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
105
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
89
106
|
return response.data;
|
|
90
107
|
}
|
|
91
108
|
async spotMarketplace(params, config) {
|
|
92
109
|
const response = await this.rateLimitQueue.add(async () => {
|
|
93
110
|
return await this.axios.get('/spot_marketplace', { ...config, params });
|
|
94
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
111
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
95
112
|
return response.data;
|
|
96
113
|
}
|
|
97
114
|
async setServerSettings(data, config) {
|
|
98
115
|
const response = await this.rateLimitQueue.add(async () => {
|
|
99
116
|
return await this.axios.post('/set_server_settings', data, config);
|
|
100
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
117
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
101
118
|
return response.data;
|
|
102
119
|
}
|
|
103
120
|
async setSpotPrice(data, config) {
|
|
104
121
|
const response = await this.rateLimitQueue.add(async () => {
|
|
105
122
|
return await this.axios.post('/set_spot_price', data, config);
|
|
106
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
123
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
107
124
|
return response.data;
|
|
108
125
|
}
|
|
109
126
|
async cancelOrder(data, config) {
|
|
110
127
|
const response = await this.rateLimitQueue.add(async () => {
|
|
111
128
|
return await this.axios.post('/cancel_order', data, config);
|
|
112
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
129
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
113
130
|
return response.data;
|
|
114
131
|
}
|
|
115
132
|
async createOrder(data, config) {
|
|
116
133
|
const response = await this.rateLimitQueueCreateOrder.add(async () => {
|
|
117
134
|
return await this.axios.post('/create_order', data, config);
|
|
118
|
-
}, getQueueOptions(priorityLevels.HIGHEST, config));
|
|
135
|
+
}, this.getQueueOptions(priorityLevels.HIGHEST, config));
|
|
136
|
+
return response.data;
|
|
137
|
+
}
|
|
138
|
+
async getGigaspot(config) {
|
|
139
|
+
return await this.rateLimitQueue.add(async () => {
|
|
140
|
+
const response = await this.axios.get('/get_gigaspot', config);
|
|
141
|
+
const snapshot = await axios.get(response.data.v1_snapshot_url);
|
|
142
|
+
return {
|
|
143
|
+
...response.data,
|
|
144
|
+
snapshot: snapshot.data,
|
|
145
|
+
};
|
|
146
|
+
}, this.getQueueOptions(priorityLevels.NORMAL, config));
|
|
147
|
+
}
|
|
148
|
+
async createGigaspotOrders(data, config) {
|
|
149
|
+
const response = await this.rateLimitQueue.add(async () => {
|
|
150
|
+
return await this.axios.post('/create_gigaspot_orders', data, config);
|
|
151
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
152
|
+
return response.data;
|
|
153
|
+
}
|
|
154
|
+
async editGigaspotOrders(data, config) {
|
|
155
|
+
const response = await this.rateLimitQueue.add(async () => {
|
|
156
|
+
return await this.axios.post('/edit_gigaspot_orders', data, config);
|
|
157
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
158
|
+
return response.data;
|
|
159
|
+
}
|
|
160
|
+
async cancelOrders(data, config) {
|
|
161
|
+
const response = await this.rateLimitQueue.add(async () => {
|
|
162
|
+
return await this.axios.post('/cancel_orders', data, config);
|
|
163
|
+
}, this.getQueueOptions(priorityLevels.HIGH, config));
|
|
119
164
|
return response.data;
|
|
120
165
|
}
|
|
121
166
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Currency, ResponseData } from '../types.js';
|
|
2
|
+
export interface CreateGigaspotOrdersRequestDataOrderOverclock {
|
|
3
|
+
pl: number;
|
|
4
|
+
core_lock?: number;
|
|
5
|
+
mem_lock?: number;
|
|
6
|
+
mem_offset?: number;
|
|
7
|
+
core_offset?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateGigaspotOrdersRequestDataOrder {
|
|
10
|
+
currency: Currency;
|
|
11
|
+
image: string;
|
|
12
|
+
renting_server: number;
|
|
13
|
+
price: number;
|
|
14
|
+
oc: CreateGigaspotOrdersRequestDataOrderOverclock[];
|
|
15
|
+
env?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export type CreateGigaspotOrdersRequestData = CreateGigaspotOrdersRequestDataOrder[];
|
|
18
|
+
export interface CreateGigaspotOrdersResponseData extends ResponseData {
|
|
19
|
+
failed_to_oc_servers: number[];
|
|
20
|
+
failed_to_rent_servers: number[];
|
|
21
|
+
too_low_bids_servers: number[];
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Currency, OrderType } from '../types.js';
|
|
1
|
+
import type { Currency, OrderType, ResponseData } from '../types.js';
|
|
2
2
|
export interface CreateOrderRequestDataBase {
|
|
3
3
|
type: OrderType;
|
|
4
4
|
currency: Currency;
|
|
@@ -22,4 +22,5 @@ export interface CreateOrderRequestDataSpot extends CreateOrderRequestDataBase {
|
|
|
22
22
|
type: 'spot';
|
|
23
23
|
spotprice: number;
|
|
24
24
|
}
|
|
25
|
-
export type
|
|
25
|
+
export type CreateOrderRequestData = CreateOrderRequestDataOnDemand | CreateOrderRequestDataSpot;
|
|
26
|
+
export type CreateOrderResponseData = ResponseData;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ResponseData } from '../types.js';
|
|
2
|
+
export interface EditGigaspotOrdersRequestDataOrderOverclock {
|
|
3
|
+
pl: number;
|
|
4
|
+
core_lock?: number;
|
|
5
|
+
mem_lock?: number;
|
|
6
|
+
mem_offset?: number;
|
|
7
|
+
core_offset?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface EditGigaspotOrdersRequestDataOrder {
|
|
10
|
+
order_id: number;
|
|
11
|
+
price: number;
|
|
12
|
+
oc: EditGigaspotOrdersRequestDataOrderOverclock[];
|
|
13
|
+
}
|
|
14
|
+
export type EditGigaspotOrdersRequestData = EditGigaspotOrdersRequestDataOrder[];
|
|
15
|
+
export interface EditGigaspotOrdersResponseData extends ResponseData {
|
|
16
|
+
success_to_update_ids: number[];
|
|
17
|
+
failed_to_update_ids: number[];
|
|
18
|
+
too_low_bid_ids: number[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Currency, Pricing, ResponseData } from '../types.js';
|
|
2
|
+
export interface GetGigaspotResponseDataSnapshotServerBid {
|
|
3
|
+
owner: number;
|
|
4
|
+
id: number;
|
|
5
|
+
active: boolean;
|
|
6
|
+
to_cache: boolean;
|
|
7
|
+
cached: boolean;
|
|
8
|
+
price: number;
|
|
9
|
+
currency: Currency;
|
|
10
|
+
pl: number;
|
|
11
|
+
}
|
|
12
|
+
export interface GetGigaspotResponseDataSnapshotServerGpu {
|
|
13
|
+
pl: [number, number];
|
|
14
|
+
mem_lock: [number, number];
|
|
15
|
+
core_lock: [number, number];
|
|
16
|
+
mem_offset: [number, number];
|
|
17
|
+
core_offset: [number, number];
|
|
18
|
+
model: string;
|
|
19
|
+
}
|
|
20
|
+
export interface GetGigaspotResponseDataSnapshotServer {
|
|
21
|
+
bids: GetGigaspotResponseDataSnapshotServerBid[];
|
|
22
|
+
on_demand_rented: boolean;
|
|
23
|
+
online: boolean;
|
|
24
|
+
cpu: string;
|
|
25
|
+
cores: number;
|
|
26
|
+
threads: number;
|
|
27
|
+
ram: number;
|
|
28
|
+
gpus: GetGigaspotResponseDataSnapshotServerGpu[];
|
|
29
|
+
working_properly: boolean;
|
|
30
|
+
cuda: string;
|
|
31
|
+
max_rental_length: number;
|
|
32
|
+
cc: string;
|
|
33
|
+
host: number;
|
|
34
|
+
reliability: number;
|
|
35
|
+
min_bid: number;
|
|
36
|
+
energy_price: number;
|
|
37
|
+
}
|
|
38
|
+
export type GetGigaspotResponseDataSnapshot = Record<string, GetGigaspotResponseDataSnapshotServer>;
|
|
39
|
+
export interface GetGigaspotResponseDataBase extends ResponseData {
|
|
40
|
+
my_user_id: number;
|
|
41
|
+
v1_snapshot_url: string;
|
|
42
|
+
creation_fees: Pricing;
|
|
43
|
+
}
|
|
44
|
+
export interface GetGigaspotResponseData extends GetGigaspotResponseDataBase {
|
|
45
|
+
snapshot: GetGigaspotResponseDataSnapshot;
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Currency, Price, ResponseData, Specs } from '../types.js';
|
|
2
|
+
export interface MarketplaceResponseDataServerRating {
|
|
3
|
+
avg: number;
|
|
4
|
+
cnt: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MarketplaceResponseDataServer {
|
|
7
|
+
allowed_coins: Currency[];
|
|
8
|
+
cuda_version: string;
|
|
9
|
+
gigaspot: boolean;
|
|
10
|
+
gpu_array: string[];
|
|
11
|
+
id: number;
|
|
12
|
+
mrl: number;
|
|
13
|
+
oc: boolean;
|
|
14
|
+
owner: number;
|
|
15
|
+
price: Price;
|
|
16
|
+
rating: MarketplaceResponseDataServerRating;
|
|
17
|
+
reliability: number;
|
|
18
|
+
rented: boolean;
|
|
19
|
+
specs: Specs;
|
|
20
|
+
}
|
|
21
|
+
export interface MarketplaceResponseData extends ResponseData {
|
|
22
|
+
servers: MarketplaceResponseDataServer[];
|
|
23
|
+
my_servers: number[];
|
|
24
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { Currency, Specs } from '../types.js';
|
|
2
|
-
export interface
|
|
1
|
+
import type { Currency, ResponseData, Specs } from '../types.js';
|
|
2
|
+
export interface MyOrdersRequestParams {
|
|
3
|
+
return_completed?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface MyOrdersResponseDataOrder {
|
|
3
6
|
auto_login: string;
|
|
4
7
|
id: number;
|
|
5
8
|
fee: number;
|
|
@@ -21,3 +24,7 @@ export interface MyOrdersResponseDataOrderCommon {
|
|
|
21
24
|
tcp_ports: string[];
|
|
22
25
|
http_port: string;
|
|
23
26
|
}
|
|
27
|
+
export interface MyOrdersResponseData extends ResponseData {
|
|
28
|
+
orders: MyOrdersResponseDataOrder[];
|
|
29
|
+
limit: number;
|
|
30
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Pricing, Specs, Visibility } from '
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
1
|
+
import type { Pricing, ResponseData, Specs, Visibility } from '../types.js';
|
|
3
2
|
export interface MyServersResponseDataServer {
|
|
4
3
|
name: string;
|
|
5
4
|
connected: boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Pricing, Specs, Visibility } from '
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
1
|
+
import type { Pricing, ResponseData, Specs, Visibility } from '../types.js';
|
|
3
2
|
export interface ServerConfigRequestData {
|
|
4
3
|
server_name: string;
|
|
5
4
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ResponseData } from '../types.js';
|
|
2
|
+
export interface SetSpotPriceRequestData {
|
|
3
|
+
order_id: number;
|
|
4
|
+
desired_price: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SetSpotPriceResponseDataMaxStep extends ResponseData {
|
|
7
|
+
error: 'exceeded_max_step';
|
|
8
|
+
max_step: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SetSpotPriceResponseDataTimeToLowering extends ResponseData {
|
|
11
|
+
error: 'can_lower_every_600_seconds';
|
|
12
|
+
time_to_lowering: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SetSpotPriceResponseDataNormal extends ResponseData {
|
|
15
|
+
error: null;
|
|
16
|
+
}
|
|
17
|
+
export type SetSpotPriceResponseData = SetSpotPriceResponseDataMaxStep | SetSpotPriceResponseDataTimeToLowering | SetSpotPriceResponseDataNormal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Currency, Pricing, ResponseData, Visibility } from '../types.js';
|
|
2
|
+
export interface SpotMarketplaceRequestParams {
|
|
3
|
+
market: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SpotMarketplaceResponseDataOffer {
|
|
6
|
+
active: boolean;
|
|
7
|
+
bid: number;
|
|
8
|
+
currency: Currency;
|
|
9
|
+
my: boolean;
|
|
10
|
+
offer_id: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SpotMarketplaceResponseDataServer {
|
|
13
|
+
min_pricing: Pricing;
|
|
14
|
+
mrl: number;
|
|
15
|
+
online: boolean;
|
|
16
|
+
visibility: Visibility;
|
|
17
|
+
}
|
|
18
|
+
export interface SpotMarketplaceResponseDataMarket {
|
|
19
|
+
currency_rates_in_usd: Pricing;
|
|
20
|
+
offers: SpotMarketplaceResponseDataOffer[];
|
|
21
|
+
server: SpotMarketplaceResponseDataServer;
|
|
22
|
+
}
|
|
23
|
+
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
24
|
+
market: SpotMarketplaceResponseDataMarket;
|
|
25
|
+
exists: boolean;
|
|
26
|
+
}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import CloreAI from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
import CloreAI from './CloreAI.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export type * from './endpoints/cancelOrder.js';
|
|
4
|
+
export type * from './endpoints/createOrder.js';
|
|
5
|
+
export type * from './endpoints/marketplace.js';
|
|
6
|
+
export type * from './endpoints/myOrders.js';
|
|
7
|
+
export type * from './endpoints/myServers.js';
|
|
8
|
+
export type * from './endpoints/serverConfig.js';
|
|
9
|
+
export type * from './endpoints/setServerSettings.js';
|
|
10
|
+
export type * from './endpoints/setSpotPrice.js';
|
|
11
|
+
export type * from './endpoints/spotMarketplace.js';
|
|
12
|
+
export type * from './endpoints/wallets.js';
|
|
13
|
+
export * from './errors.js';
|
|
14
|
+
export type * from './types.js';
|
|
4
15
|
export default CloreAI;
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CloreAI from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
import CloreAI from './CloreAI.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './errors.js';
|
|
4
4
|
export default CloreAI;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { CreateAxiosDefaults } from 'axios';
|
|
2
2
|
import type { Options, Queue, QueueAddOptions } from 'p-queue';
|
|
3
3
|
export type PQueueOptions = Options<Queue<() => Promise<unknown>, QueueAddOptions>, QueueAddOptions>;
|
|
4
|
-
export interface
|
|
4
|
+
export interface Config {
|
|
5
|
+
apiKey: string;
|
|
5
6
|
axiosConfig?: CreateAxiosDefaults;
|
|
6
7
|
rateLimitQueueOptions?: PQueueOptions;
|
|
7
8
|
rateLimitQueueOptionsCreateOrder?: PQueueOptions;
|
|
8
9
|
}
|
|
9
|
-
export interface
|
|
10
|
-
|
|
10
|
+
export interface ResponseData {
|
|
11
|
+
code: number;
|
|
12
|
+
error?: string | null;
|
|
11
13
|
}
|
|
12
14
|
export type OrderType = 'on-demand' | 'spot';
|
|
13
15
|
export type Visibility = 'public' | 'hidden';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloreai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLORE.AI API client",
|
|
6
6
|
"repository": {
|
|
@@ -9,20 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"author": "Vladislav Puzyrev",
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"./webapi": "./build/webapi.js"
|
|
15
|
-
},
|
|
16
|
-
"typesVersions": {
|
|
17
|
-
"*": {
|
|
18
|
-
".": [
|
|
19
|
-
"build/index.d.ts"
|
|
20
|
-
],
|
|
21
|
-
"webapi": [
|
|
22
|
-
"build/webapi.d.ts"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
},
|
|
12
|
+
"main": "build/index.js",
|
|
13
|
+
"types": "build/index.d.ts",
|
|
26
14
|
"keywords": [
|
|
27
15
|
"cloreai",
|
|
28
16
|
"clore",
|
|
@@ -42,17 +30,17 @@
|
|
|
42
30
|
},
|
|
43
31
|
"dependencies": {
|
|
44
32
|
"axios": "^1.7.9",
|
|
45
|
-
"p-queue": "^8.0
|
|
33
|
+
"p-queue": "^8.1.0"
|
|
46
34
|
},
|
|
47
35
|
"devDependencies": {
|
|
48
36
|
"@tsconfig/node-lts": "^22.0.1",
|
|
49
37
|
"@tsconfig/strictest": "^2.0.5",
|
|
50
|
-
"@types/node": "^22.10.
|
|
38
|
+
"@types/node": "^22.10.7",
|
|
51
39
|
"eslint": "^9.18.0",
|
|
52
40
|
"eslint-config-vladpuz": "^0.24.0",
|
|
53
41
|
"husky": "^9.1.7",
|
|
54
42
|
"jiti": "^2.4.2",
|
|
55
|
-
"npm-check-updates": "^17.1.
|
|
43
|
+
"npm-check-updates": "^17.1.14",
|
|
56
44
|
"prettier": "^3.4.2",
|
|
57
45
|
"prettier-config-vladpuz": "^0.9.0",
|
|
58
46
|
"rimraf": "^6.0.1",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CancelOrderRequestDataCommon } from '../../common/endpoints/cancelOrder.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface CancelOrderRequestData extends CancelOrderRequestDataCommon {
|
|
4
|
-
issue?: string;
|
|
5
|
-
}
|
|
6
|
-
export type CancelOrderResponseData = ResponseData;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { MarketplaceResponseDataServerCommon } from '../../common/endpoints/marketplace.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface MarketplaceResponseData extends ResponseData {
|
|
4
|
-
servers: MarketplaceResponseDataServerCommon[];
|
|
5
|
-
my_servers: number[];
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { MyOrdersResponseDataOrderCommon } from '../../common/endpoints/myOrders.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface MyOrdersRequestParams {
|
|
4
|
-
return_completed?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface MyOrdersResponseData extends ResponseData {
|
|
7
|
-
orders: MyOrdersResponseDataOrderCommon[];
|
|
8
|
-
limit: number;
|
|
9
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SetSpotPriceRequestDataCommon, SetSpotPriceResponseDataCommon } from '../../common/endpoints/setSpotPrice.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export type SetSpotPriceRequestData = SetSpotPriceRequestDataCommon;
|
|
4
|
-
export type SetSpotPriceResponseData = SetSpotPriceResponseDataCommon & ResponseData;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SpotMarketplaceResponseDataCommon } from '../../common/endpoints/spotMarketplace.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface SpotMarketplaceRequestParams {
|
|
4
|
-
market: number;
|
|
5
|
-
}
|
|
6
|
-
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
7
|
-
market: SpotMarketplaceResponseDataCommon;
|
|
8
|
-
exists: boolean;
|
|
9
|
-
}
|
package/build/cloreai/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import CloreAI from './CloreAI.js';
|
|
2
|
-
export type * from './endpoints/cancelOrder.js';
|
|
3
|
-
export type * from './endpoints/createOrder.js';
|
|
4
|
-
export type * from './endpoints/marketplace.js';
|
|
5
|
-
export type * from './endpoints/myOrders.js';
|
|
6
|
-
export type * from './endpoints/myServers.js';
|
|
7
|
-
export type * from './endpoints/serverConfig.js';
|
|
8
|
-
export type * from './endpoints/setServerSettings.js';
|
|
9
|
-
export type * from './endpoints/setSpotPrice.js';
|
|
10
|
-
export type * from './endpoints/spotMarketplace.js';
|
|
11
|
-
export type * from './endpoints/wallets.js';
|
|
12
|
-
export type * from './types.js';
|
|
13
|
-
export default CloreAI;
|
package/build/cloreai/index.js
DELETED
package/build/cloreai/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Currency, Price, Specs } from '../types.js';
|
|
2
|
-
export interface MarketplaceResponseDataServerRatingCommon {
|
|
3
|
-
avg: number;
|
|
4
|
-
cnt: number;
|
|
5
|
-
}
|
|
6
|
-
export interface MarketplaceResponseDataServerCommon {
|
|
7
|
-
allowed_coins: Currency[];
|
|
8
|
-
cuda_version: string;
|
|
9
|
-
gpu_array: string[];
|
|
10
|
-
id: number;
|
|
11
|
-
mrl: number;
|
|
12
|
-
oc: boolean;
|
|
13
|
-
owner: number;
|
|
14
|
-
price: Price;
|
|
15
|
-
rating: MarketplaceResponseDataServerRatingCommon;
|
|
16
|
-
reliability: number;
|
|
17
|
-
rented: boolean;
|
|
18
|
-
specs: Specs;
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface SetSpotPriceRequestDataCommon {
|
|
2
|
-
order_id: number;
|
|
3
|
-
desired_price: number;
|
|
4
|
-
}
|
|
5
|
-
export interface SetSpotPriceResponseDataMaxStep {
|
|
6
|
-
error: 'exceeded_max_step';
|
|
7
|
-
max_step: number;
|
|
8
|
-
}
|
|
9
|
-
export interface SetSpotPriceResponseDataTimeToLowering {
|
|
10
|
-
error: 'can_lower_every_600_seconds';
|
|
11
|
-
time_to_lowering: number;
|
|
12
|
-
}
|
|
13
|
-
export interface SetSpotPriceResponseDataNormal {
|
|
14
|
-
error: undefined;
|
|
15
|
-
}
|
|
16
|
-
export type SetSpotPriceResponseDataCommon = SetSpotPriceResponseDataMaxStep | SetSpotPriceResponseDataTimeToLowering | SetSpotPriceResponseDataNormal;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Currency, Pricing, Visibility } from '../types.js';
|
|
2
|
-
export interface SpotMarketplaceResponseDataOfferCommon {
|
|
3
|
-
active: boolean;
|
|
4
|
-
bid: number;
|
|
5
|
-
currency: Currency;
|
|
6
|
-
my: boolean;
|
|
7
|
-
offer_id: number;
|
|
8
|
-
}
|
|
9
|
-
export interface SpotMarketplaceResponseDataServerCommon {
|
|
10
|
-
min_pricing: Pricing;
|
|
11
|
-
mrl: number;
|
|
12
|
-
online: boolean;
|
|
13
|
-
visibility: Visibility;
|
|
14
|
-
}
|
|
15
|
-
export interface SpotMarketplaceResponseDataCommon {
|
|
16
|
-
currency_rates_in_usd: Pricing;
|
|
17
|
-
offers: SpotMarketplaceResponseDataOfferCommon[];
|
|
18
|
-
server: SpotMarketplaceResponseDataServerCommon;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { QueueAddOptions } from 'p-queue';
|
|
3
|
-
export declare function getErrorMessage(statusCode?: number | string, errorField?: string): string;
|
|
4
|
-
export declare function getQueueOptions(priority: number, config?: AxiosRequestConfig): QueueAddOptions & {
|
|
5
|
-
throwOnTimeout: true;
|
|
6
|
-
};
|
package/build/common/helpers.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function getErrorMessage(statusCode, errorField) {
|
|
2
|
-
const messages = [];
|
|
3
|
-
if (statusCode != null) {
|
|
4
|
-
messages.push(`Status code "${statusCode}".`);
|
|
5
|
-
}
|
|
6
|
-
if (errorField != null) {
|
|
7
|
-
messages.push(`Error field "${errorField}".`);
|
|
8
|
-
}
|
|
9
|
-
return messages.join(' ');
|
|
10
|
-
}
|
|
11
|
-
export function getQueueOptions(priority, config) {
|
|
12
|
-
const defaultQueueOptions = {
|
|
13
|
-
throwOnTimeout: true,
|
|
14
|
-
priority,
|
|
15
|
-
};
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- GenericAbortSignal
|
|
17
|
-
const signal = config?.signal;
|
|
18
|
-
if (signal == null) {
|
|
19
|
-
return defaultQueueOptions;
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
...defaultQueueOptions,
|
|
23
|
-
signal,
|
|
24
|
-
};
|
|
25
|
-
}
|
package/build/common/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
|
2
|
-
export type * from './endpoints/cancelOrder.js';
|
|
3
|
-
export type * from './endpoints/createOrder.js';
|
|
4
|
-
export type * from './endpoints/marketplace.js';
|
|
5
|
-
export type * from './endpoints/myOrders.js';
|
|
6
|
-
export type * from './endpoints/setSpotPrice.js';
|
|
7
|
-
export type * from './endpoints/spotMarketplace.js';
|
|
8
|
-
export * from './errors.js';
|
|
9
|
-
export * from './helpers.js';
|
|
10
|
-
export type * from './types.js';
|
package/build/common/index.js
DELETED
package/build/common/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/webapi/WebAPI.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
2
|
-
import PQueue from 'p-queue';
|
|
3
|
-
import type { CancelOrderRequestData, CancelOrderResponseData } from './endpoints/cancelOrder.js';
|
|
4
|
-
import type { CreateOrderRequestData, CreateOrderResponseData } from './endpoints/createOrder.js';
|
|
5
|
-
import type { MarketplaceResponseData } from './endpoints/marketplace.js';
|
|
6
|
-
import type { MyOrdersRequestData, MyOrdersResponseData } from './endpoints/myOrders.js';
|
|
7
|
-
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './endpoints/setSpotPrice.js';
|
|
8
|
-
import type { SpotMarketplaceRequestData, SpotMarketplaceResponseData } from './endpoints/spotMarketplace.js';
|
|
9
|
-
import type { Config } from './types.js';
|
|
10
|
-
declare class WebAPI {
|
|
11
|
-
axios: AxiosInstance;
|
|
12
|
-
rateLimitQueue: PQueue;
|
|
13
|
-
rateLimitQueueCreateOrder: PQueue;
|
|
14
|
-
constructor(config: Config);
|
|
15
|
-
marketplace(config?: AxiosRequestConfig): Promise<MarketplaceResponseData>;
|
|
16
|
-
myOrders(data: MyOrdersRequestData, config?: AxiosRequestConfig): Promise<MyOrdersResponseData>;
|
|
17
|
-
spotMarketplace(data: SpotMarketplaceRequestData, config?: AxiosRequestConfig): Promise<SpotMarketplaceResponseData>;
|
|
18
|
-
setSpotPrice(data: SetSpotPriceRequestData, config?: AxiosRequestConfig): Promise<SetSpotPriceResponseData>;
|
|
19
|
-
cancelOrder(data: CancelOrderRequestData, config?: AxiosRequestConfig): Promise<CancelOrderResponseData>;
|
|
20
|
-
createOrder(data: CreateOrderRequestData, config?: AxiosRequestConfig): Promise<CreateOrderResponseData>;
|
|
21
|
-
}
|
|
22
|
-
export default WebAPI;
|
package/build/webapi/WebAPI.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import PQueue from 'p-queue';
|
|
3
|
-
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER } from '../common/constants.js';
|
|
4
|
-
import { UnknownError } from '../common/errors.js';
|
|
5
|
-
import { getErrorMessage, getQueueOptions } from '../common/helpers.js';
|
|
6
|
-
class WebAPI {
|
|
7
|
-
axios;
|
|
8
|
-
rateLimitQueue;
|
|
9
|
-
rateLimitQueueCreateOrder;
|
|
10
|
-
constructor(config) {
|
|
11
|
-
this.rateLimitQueue = new PQueue({
|
|
12
|
-
interval: RATE_LIMIT,
|
|
13
|
-
intervalCap: 1,
|
|
14
|
-
concurrency: 1,
|
|
15
|
-
...config.rateLimitQueueOptions,
|
|
16
|
-
});
|
|
17
|
-
this.rateLimitQueueCreateOrder = new PQueue({
|
|
18
|
-
interval: RATE_LIMIT_CREATE_ORDER,
|
|
19
|
-
intervalCap: 1,
|
|
20
|
-
concurrency: 1,
|
|
21
|
-
...config.rateLimitQueueOptionsCreateOrder,
|
|
22
|
-
});
|
|
23
|
-
this.axios = axios.create({
|
|
24
|
-
...config.axiosConfig,
|
|
25
|
-
baseURL: 'https://clore.ai/webapi',
|
|
26
|
-
});
|
|
27
|
-
this.axios.interceptors.request.use((request) => {
|
|
28
|
-
request.data = {
|
|
29
|
-
...request.data,
|
|
30
|
-
token: config.token,
|
|
31
|
-
};
|
|
32
|
-
return request;
|
|
33
|
-
});
|
|
34
|
-
this.axios.interceptors.response.use((response) => {
|
|
35
|
-
const hasError = Boolean(response.data.error);
|
|
36
|
-
if (!hasError) {
|
|
37
|
-
return response;
|
|
38
|
-
}
|
|
39
|
-
const errorMessage = getErrorMessage(response.data.status, response.data.error);
|
|
40
|
-
throw new UnknownError(errorMessage, undefined, response.config, response.request, response);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async marketplace(config) {
|
|
44
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
45
|
-
return await this.axios.post('/marketplace/servers', null, config);
|
|
46
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
47
|
-
return response.data;
|
|
48
|
-
}
|
|
49
|
-
async myOrders(data, config) {
|
|
50
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
51
|
-
return await this.axios.post('/marketplace/orders', data, config);
|
|
52
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
53
|
-
return response.data;
|
|
54
|
-
}
|
|
55
|
-
async spotMarketplace(data, config) {
|
|
56
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
57
|
-
return await this.axios.post('/marketplace/get_spot', data, config);
|
|
58
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
59
|
-
return response.data;
|
|
60
|
-
}
|
|
61
|
-
async setSpotPrice(data, config) {
|
|
62
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
63
|
-
return await this.axios.post('/marketplace/set_spot_price', data, config);
|
|
64
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
65
|
-
return response.data;
|
|
66
|
-
}
|
|
67
|
-
async cancelOrder(data, config) {
|
|
68
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
69
|
-
return await this.axios.post('/marketplace/cancel_order', data, config);
|
|
70
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
71
|
-
return response.data;
|
|
72
|
-
}
|
|
73
|
-
async createOrder(data, config) {
|
|
74
|
-
const response = await this.rateLimitQueueCreateOrder.add(async () => {
|
|
75
|
-
return await this.axios.post('/create_order', data, config);
|
|
76
|
-
}, getQueueOptions(priorityLevels.HIGHEST, config));
|
|
77
|
-
return response.data;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export default WebAPI;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CancelOrderRequestDataCommon } from '../../common/endpoints/cancelOrder.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface CancelOrderRequestData extends CancelOrderRequestDataCommon {
|
|
4
|
-
rating: number;
|
|
5
|
-
}
|
|
6
|
-
export type CancelOrderResponseData = ResponseData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { MarketplaceResponseDataServerCommon } from '../../common/endpoints/marketplace.js';
|
|
2
|
-
import type { Price } from '../../common/types.js';
|
|
3
|
-
import type { ResponseData } from '../types.js';
|
|
4
|
-
export interface MarketplaceResponseData extends ResponseData {
|
|
5
|
-
all_servers: MarketplaceResponseDataServerCommon[];
|
|
6
|
-
creation_fees: Price;
|
|
7
|
-
disable_usd: boolean;
|
|
8
|
-
my_servers: MarketplaceResponseDataServerCommon[];
|
|
9
|
-
not_rented_available_servers: MarketplaceResponseDataServerCommon[];
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MyOrdersResponseDataOrderCommon } from '../../common/endpoints/myOrders.js';
|
|
2
|
-
import type { Currency, Price } from '../../common/types.js';
|
|
3
|
-
import type { ResponseData } from '../types.js';
|
|
4
|
-
export interface MyOrdersRequestData {
|
|
5
|
-
rc: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface MyOrdersResponseData extends ResponseData {
|
|
8
|
-
PoH_active: boolean;
|
|
9
|
-
PoH_rates: Record<Currency, Record<string, Price>>;
|
|
10
|
-
allowed_features: string[];
|
|
11
|
-
eo: boolean;
|
|
12
|
-
http_endpoint_by_proxy: Record<string, string>;
|
|
13
|
-
ol: number;
|
|
14
|
-
orders: MyOrdersResponseDataOrderCommon[];
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SetSpotPriceRequestDataCommon, SetSpotPriceResponseDataCommon } from '../../common/endpoints/setSpotPrice.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export type SetSpotPriceRequestData = SetSpotPriceRequestDataCommon;
|
|
4
|
-
export type SetSpotPriceResponseData = SetSpotPriceResponseDataCommon & ResponseData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SpotMarketplaceResponseDataCommon } from '../../common/endpoints/spotMarketplace.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface SpotMarketplaceRequestData {
|
|
4
|
-
id: number;
|
|
5
|
-
}
|
|
6
|
-
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
7
|
-
data: SpotMarketplaceResponseDataCommon;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/webapi/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import WebAPI from './WebAPI.js';
|
|
2
|
-
export type * from './endpoints/cancelOrder.js';
|
|
3
|
-
export type * from './endpoints/createOrder.js';
|
|
4
|
-
export type * from './endpoints/marketplace.js';
|
|
5
|
-
export type * from './endpoints/myOrders.js';
|
|
6
|
-
export type * from './endpoints/setSpotPrice.js';
|
|
7
|
-
export type * from './endpoints/spotMarketplace.js';
|
|
8
|
-
export type * from './types.js';
|
|
9
|
-
export default WebAPI;
|
package/build/webapi/index.js
DELETED
package/build/webapi/types.d.ts
DELETED
package/build/webapi/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/webapi.d.ts
DELETED
package/build/webapi.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|