cloreai 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -75
- package/dist/Cloreai.d.ts +42 -0
- package/dist/Cloreai.js +267 -0
- package/dist/CloreaiError.d.ts +17 -0
- package/dist/CloreaiError.js +13 -0
- package/dist/Gigaspot.d.ts +14 -0
- package/dist/Gigaspot.js +74 -0
- package/dist/constants.d.ts +20 -0
- package/{build → dist}/constants.js +8 -9
- package/dist/index.d.ts +22 -0
- package/dist/index.js +5 -0
- package/{build → dist}/resources/cancelOrder.d.ts +1 -1
- package/{build → dist}/resources/cancelOrders.d.ts +1 -1
- package/{build → dist}/resources/createGigaspotOrders.d.ts +4 -11
- package/{build → dist}/resources/createOrder.d.ts +10 -10
- package/dist/resources/editGigaspotOrders.d.ts +12 -0
- package/{build → dist}/resources/getGigaspot.d.ts +27 -27
- package/{build → dist}/resources/marketplace.d.ts +5 -6
- package/{build → dist}/resources/myOrders.d.ts +6 -7
- package/dist/resources/myServers.d.ts +16 -0
- package/{build → dist}/resources/pohBalance.d.ts +18 -18
- package/dist/resources/renterFees.d.ts +22 -0
- package/{build → dist}/resources/serverConfig.d.ts +14 -11
- package/dist/resources/setServerSettings.d.ts +18 -0
- package/dist/resources/setSpotPrice.d.ts +15 -0
- package/{build → dist}/resources/spotMarketplace.d.ts +15 -15
- package/{build → dist}/resources/wallets.d.ts +5 -5
- package/dist/resources/wallets.js +1 -0
- package/{build → dist}/types.d.ts +18 -22
- package/dist/types.js +1 -0
- package/package.json +23 -24
- package/build/CloreAI.d.ts +0 -34
- package/build/CloreAI.js +0 -133
- package/build/Gigaspot.d.ts +0 -17
- package/build/Gigaspot.js +0 -46
- package/build/constants.d.ts +0 -21
- package/build/errors.d.ts +0 -22
- package/build/errors.js +0 -43
- package/build/getQueueOptions.d.ts +0 -5
- package/build/getQueueOptions.js +0 -15
- package/build/index.d.ts +0 -20
- package/build/index.js +0 -4
- package/build/resources/editGigaspotOrders.d.ts +0 -19
- package/build/resources/myServers.d.ts +0 -15
- package/build/resources/setServerSettings.d.ts +0 -11
- package/build/resources/setSpotPrice.d.ts +0 -17
- package/build/resources/setSpotPrice.js +0 -2
- /package/{build → dist}/resources/cancelOrder.js +0 -0
- /package/{build → dist}/resources/cancelOrders.js +0 -0
- /package/{build → dist}/resources/createGigaspotOrders.js +0 -0
- /package/{build → dist}/resources/createOrder.js +0 -0
- /package/{build → dist}/resources/editGigaspotOrders.js +0 -0
- /package/{build → dist}/resources/getGigaspot.js +0 -0
- /package/{build → dist}/resources/marketplace.js +0 -0
- /package/{build → dist}/resources/myOrders.js +0 -0
- /package/{build → dist}/resources/myServers.js +0 -0
- /package/{build → dist}/resources/pohBalance.js +0 -0
- /package/{build/resources/serverConfig.js → dist/resources/renterFees.js} +0 -0
- /package/{build/resources/setServerSettings.js → dist/resources/serverConfig.js} +0 -0
- /package/{build/resources/spotMarketplace.js → dist/resources/setServerSettings.js} +0 -0
- /package/{build/resources/wallets.js → dist/resources/setSpotPrice.js} +0 -0
- /package/{build/types.js → dist/resources/spotMarketplace.js} +0 -0
package/dist/Gigaspot.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { priorityLevels } from "./constants.js";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-type-assertion */
|
|
3
|
+
class Gigaspot {
|
|
4
|
+
#queue;
|
|
5
|
+
#baseURL;
|
|
6
|
+
#fetch;
|
|
7
|
+
constructor(queue, baseURL, fetchFunction) {
|
|
8
|
+
this.#queue = queue;
|
|
9
|
+
this.#baseURL = baseURL;
|
|
10
|
+
this.#fetch = fetchFunction;
|
|
11
|
+
}
|
|
12
|
+
async getGigaspot(init = {}) {
|
|
13
|
+
const url = new URL(this.#baseURL + '/get_gigaspot');
|
|
14
|
+
const response = await this.#queue.add(async () => {
|
|
15
|
+
return await this.#fetch(url, {
|
|
16
|
+
...init,
|
|
17
|
+
method: 'GET',
|
|
18
|
+
});
|
|
19
|
+
}, {
|
|
20
|
+
priority: priorityLevels.NORMAL,
|
|
21
|
+
signal: init.signal ?? undefined,
|
|
22
|
+
});
|
|
23
|
+
const data = await response.json();
|
|
24
|
+
const snapshotResponse = await fetch(data.v1_snapshot_url);
|
|
25
|
+
const snapshotData = await snapshotResponse.json();
|
|
26
|
+
return {
|
|
27
|
+
...data,
|
|
28
|
+
snapshot: snapshotData,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async createGigaspotOrders(data, init = {}) {
|
|
32
|
+
const url = new URL(this.#baseURL + '/create_gigaspot_orders');
|
|
33
|
+
const response = await this.#queue.add(async () => {
|
|
34
|
+
return await this.#fetch(url, {
|
|
35
|
+
...init,
|
|
36
|
+
method: 'POST',
|
|
37
|
+
body: JSON.stringify(data),
|
|
38
|
+
});
|
|
39
|
+
}, {
|
|
40
|
+
priority: priorityLevels.HIGH,
|
|
41
|
+
signal: init.signal ?? undefined,
|
|
42
|
+
});
|
|
43
|
+
return await response.json();
|
|
44
|
+
}
|
|
45
|
+
async editGigaspotOrders(data, init = {}) {
|
|
46
|
+
const url = new URL(this.#baseURL + '/edit_gigaspot_orders');
|
|
47
|
+
const response = await this.#queue.add(async () => {
|
|
48
|
+
return await this.#fetch(url, {
|
|
49
|
+
...init,
|
|
50
|
+
method: 'POST',
|
|
51
|
+
body: JSON.stringify(data),
|
|
52
|
+
});
|
|
53
|
+
}, {
|
|
54
|
+
priority: priorityLevels.HIGH,
|
|
55
|
+
signal: init.signal ?? undefined,
|
|
56
|
+
});
|
|
57
|
+
return await response.json();
|
|
58
|
+
}
|
|
59
|
+
async cancelOrders(data, init = {}) {
|
|
60
|
+
const url = new URL(this.#baseURL + '/cancel_orders');
|
|
61
|
+
const response = await this.#queue.add(async () => {
|
|
62
|
+
return await this.#fetch(url, {
|
|
63
|
+
...init,
|
|
64
|
+
method: 'POST',
|
|
65
|
+
body: JSON.stringify(data),
|
|
66
|
+
});
|
|
67
|
+
}, {
|
|
68
|
+
priority: priorityLevels.HIGH,
|
|
69
|
+
signal: init.signal ?? undefined,
|
|
70
|
+
});
|
|
71
|
+
return await response.json();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export default Gigaspot;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const RATE_LIMIT = 1000;
|
|
2
|
+
export declare const RATE_LIMIT_CREATE_ORDER = 5000;
|
|
3
|
+
export declare const gigaspotBaseImages: Readonly<{
|
|
4
|
+
UBUNTU: "a3f9c4d7e5b088d8a0bff880";
|
|
5
|
+
HIVEOS: "c9a4e2f6b7d488d8f0bab0ff";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const statusCodes: Readonly<{
|
|
8
|
+
NORMAL: 0;
|
|
9
|
+
DATABASE_ERROR: 1;
|
|
10
|
+
INVALID_INPUT_DATA: 2;
|
|
11
|
+
INVALID_API_TOKEN: 3;
|
|
12
|
+
INVALID_ENDPOINT: 4;
|
|
13
|
+
EXCEEDED: 5;
|
|
14
|
+
CUSTOM: 6;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const priorityLevels: Readonly<{
|
|
17
|
+
NORMAL: 0;
|
|
18
|
+
HIGH: 1;
|
|
19
|
+
HIGHEST: 2;
|
|
20
|
+
}>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
export const RATE_LIMIT =
|
|
1
|
+
export const RATE_LIMIT = 1000;
|
|
2
2
|
export const RATE_LIMIT_CREATE_ORDER = 5000;
|
|
3
|
-
export const
|
|
4
|
-
export const gigaspotBaseImages = {
|
|
3
|
+
export const gigaspotBaseImages = Object.freeze({
|
|
5
4
|
UBUNTU: 'a3f9c4d7e5b088d8a0bff880',
|
|
6
5
|
HIVEOS: 'c9a4e2f6b7d488d8f0bab0ff',
|
|
7
|
-
};
|
|
8
|
-
export const statusCodes = {
|
|
6
|
+
});
|
|
7
|
+
export const statusCodes = Object.freeze({
|
|
9
8
|
NORMAL: 0,
|
|
10
9
|
DATABASE_ERROR: 1,
|
|
11
10
|
INVALID_INPUT_DATA: 2,
|
|
12
11
|
INVALID_API_TOKEN: 3,
|
|
13
12
|
INVALID_ENDPOINT: 4,
|
|
14
13
|
EXCEEDED: 5,
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export const priorityLevels = {
|
|
14
|
+
CUSTOM: 6,
|
|
15
|
+
});
|
|
16
|
+
export const priorityLevels = Object.freeze({
|
|
18
17
|
NORMAL: 0,
|
|
19
18
|
HIGH: 1,
|
|
20
19
|
HIGHEST: 2,
|
|
21
|
-
};
|
|
20
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Cloreai from './Cloreai.ts';
|
|
2
|
+
export * from './Cloreai.ts';
|
|
3
|
+
export * from './CloreaiError.ts';
|
|
4
|
+
export * from './constants.ts';
|
|
5
|
+
export type * from './resources/cancelOrder.ts';
|
|
6
|
+
export type * from './resources/cancelOrders.ts';
|
|
7
|
+
export type * from './resources/createGigaspotOrders.ts';
|
|
8
|
+
export type * from './resources/createOrder.ts';
|
|
9
|
+
export type * from './resources/editGigaspotOrders.ts';
|
|
10
|
+
export type * from './resources/getGigaspot.ts';
|
|
11
|
+
export type * from './resources/marketplace.ts';
|
|
12
|
+
export type * from './resources/myOrders.ts';
|
|
13
|
+
export type * from './resources/myServers.ts';
|
|
14
|
+
export type * from './resources/pohBalance.ts';
|
|
15
|
+
export type * from './resources/renterFees.ts';
|
|
16
|
+
export type * from './resources/serverConfig.ts';
|
|
17
|
+
export type * from './resources/setServerSettings.ts';
|
|
18
|
+
export type * from './resources/setSpotPrice.ts';
|
|
19
|
+
export type * from './resources/spotMarketplace.ts';
|
|
20
|
+
export type * from './resources/wallets.ts';
|
|
21
|
+
export type * from './types.ts';
|
|
22
|
+
export default Cloreai;
|
package/dist/index.js
ADDED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import type { Currency, ResponseData } from '../types.
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
core_offset?: number;
|
|
5
|
-
mem_offset?: number;
|
|
6
|
-
core_lock?: number;
|
|
7
|
-
mem_lock?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface CreateGigaspotOrdersRequestDataOrder {
|
|
1
|
+
import type { Currency, GigaspotOverclock, ResponseData } from '../types.ts';
|
|
2
|
+
export type CreateGigaspotOrdersRequestData = CreateGigaspotOrdersOrder[];
|
|
3
|
+
export interface CreateGigaspotOrdersOrder {
|
|
10
4
|
currency: Currency;
|
|
11
5
|
image: string;
|
|
12
6
|
renting_server: number;
|
|
13
7
|
price: number;
|
|
14
|
-
oc:
|
|
8
|
+
oc: GigaspotOverclock[];
|
|
15
9
|
env?: Record<string, string>;
|
|
16
10
|
}
|
|
17
|
-
export type CreateGigaspotOrdersRequestData = CreateGigaspotOrdersRequestDataOrder[];
|
|
18
11
|
export interface CreateGigaspotOrdersResponseData extends ResponseData {
|
|
19
12
|
failed_to_oc_servers: number[];
|
|
20
13
|
failed_to_rent_servers: number[];
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type { Currency, OrderType, ResponseData } from '../types.
|
|
2
|
-
export
|
|
1
|
+
import type { Currency, OrderType, ResponseData } from '../types.ts';
|
|
2
|
+
export type CreateOrderRequestData = CreateOrderOnDemand | CreateOrderSpot;
|
|
3
|
+
export interface CreateOrderOnDemand extends CreateOrderBase {
|
|
4
|
+
type: 'on-demand';
|
|
5
|
+
}
|
|
6
|
+
export interface CreateOrderSpot extends CreateOrderBase {
|
|
7
|
+
type: 'spot';
|
|
8
|
+
spotprice: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateOrderBase {
|
|
3
11
|
type: OrderType;
|
|
4
12
|
currency: Currency;
|
|
5
13
|
image: string;
|
|
@@ -15,12 +23,4 @@ export interface CreateOrderRequestDataBase {
|
|
|
15
23
|
remember_password?: boolean;
|
|
16
24
|
dockerhub_auth?: string;
|
|
17
25
|
}
|
|
18
|
-
export interface CreateOrderRequestDataOnDemand extends CreateOrderRequestDataBase {
|
|
19
|
-
type: 'on-demand';
|
|
20
|
-
}
|
|
21
|
-
export interface CreateOrderRequestDataSpot extends CreateOrderRequestDataBase {
|
|
22
|
-
type: 'spot';
|
|
23
|
-
spotprice: number;
|
|
24
|
-
}
|
|
25
|
-
export type CreateOrderRequestData = CreateOrderRequestDataOnDemand | CreateOrderRequestDataSpot;
|
|
26
26
|
export type CreateOrderResponseData = ResponseData;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GigaspotOverclock, ResponseData } from '../types.ts';
|
|
2
|
+
export type EditGigaspotOrdersRequestData = EditGigaspotOrdersOrder[];
|
|
3
|
+
export interface EditGigaspotOrdersOrder {
|
|
4
|
+
order_id: number;
|
|
5
|
+
price: number;
|
|
6
|
+
oc: GigaspotOverclock[];
|
|
7
|
+
}
|
|
8
|
+
export interface EditGigaspotOrdersResponseData extends ResponseData {
|
|
9
|
+
success_to_update_ids: number[];
|
|
10
|
+
failed_to_update_ids: number[];
|
|
11
|
+
too_low_bid_ids: number[];
|
|
12
|
+
}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import type { Currency, Pricing, ResponseData } from '../types.
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
id: number;
|
|
5
|
-
active: boolean;
|
|
6
|
-
to_cache: boolean;
|
|
7
|
-
cached: boolean;
|
|
8
|
-
price: number;
|
|
9
|
-
currency: Currency;
|
|
10
|
-
pl: number;
|
|
1
|
+
import type { Currency, Pricing, ResponseData } from '../types.ts';
|
|
2
|
+
export interface GetGigaspotResponseData extends GetGigaspotResponseDataBase {
|
|
3
|
+
snapshot: GetGigaspotSnapshot;
|
|
11
4
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mem_offset: [number, number];
|
|
17
|
-
core_offset: [number, number];
|
|
18
|
-
model: string;
|
|
5
|
+
export interface GetGigaspotResponseDataBase extends ResponseData {
|
|
6
|
+
my_user_id: number;
|
|
7
|
+
v1_snapshot_url: string;
|
|
8
|
+
creation_fees: Pricing;
|
|
19
9
|
}
|
|
20
|
-
export
|
|
21
|
-
|
|
10
|
+
export type GetGigaspotSnapshot = Record<string, GetGigaspotSnapshotServer>;
|
|
11
|
+
export interface GetGigaspotSnapshotServer {
|
|
12
|
+
bids: GetGigaspotSnapshotServerBid[];
|
|
22
13
|
on_demand_rented: boolean;
|
|
23
14
|
online: boolean;
|
|
24
15
|
cpu: string;
|
|
25
16
|
cores: number;
|
|
26
17
|
threads: number;
|
|
27
18
|
ram: number;
|
|
28
|
-
gpus:
|
|
19
|
+
gpus: GetGigaspotSnapshotServerGpu[];
|
|
29
20
|
working_properly: boolean;
|
|
30
21
|
cuda: string;
|
|
31
22
|
max_rental_length: number;
|
|
@@ -35,12 +26,21 @@ export interface GetGigaspotResponseDataSnapshotServer {
|
|
|
35
26
|
min_bid: number;
|
|
36
27
|
energy_price: number;
|
|
37
28
|
}
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
export interface GetGigaspotSnapshotServerBid {
|
|
30
|
+
owner: number;
|
|
31
|
+
id: number;
|
|
32
|
+
active: boolean;
|
|
33
|
+
to_cache: boolean;
|
|
34
|
+
cached: boolean;
|
|
35
|
+
price: number;
|
|
36
|
+
currency: Currency;
|
|
37
|
+
pl: number;
|
|
43
38
|
}
|
|
44
|
-
export interface
|
|
45
|
-
|
|
39
|
+
export interface GetGigaspotSnapshotServerGpu {
|
|
40
|
+
pl: [number, number];
|
|
41
|
+
mem_lock: [number, number];
|
|
42
|
+
core_lock: [number, number];
|
|
43
|
+
mem_offset: [number, number];
|
|
44
|
+
core_offset: [number, number];
|
|
45
|
+
model: string;
|
|
46
46
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { Currency, Price, Rating, ResponseData, Specs } from '../types.
|
|
2
|
-
export interface
|
|
1
|
+
import type { Currency, Price, Rating, ResponseData, Specs } from '../types.ts';
|
|
2
|
+
export interface MarketplaceResponseData extends ResponseData {
|
|
3
|
+
servers: MarketplaceServer[];
|
|
4
|
+
}
|
|
5
|
+
export interface MarketplaceServer {
|
|
3
6
|
id: number;
|
|
4
7
|
owner: number;
|
|
5
8
|
autoprice?: string;
|
|
@@ -15,7 +18,3 @@ export interface MarketplaceResponseDataServer {
|
|
|
15
18
|
oc?: boolean;
|
|
16
19
|
cuda_version: string;
|
|
17
20
|
}
|
|
18
|
-
export interface MarketplaceResponseData extends ResponseData {
|
|
19
|
-
servers: MarketplaceResponseDataServer[];
|
|
20
|
-
my_servers: number[];
|
|
21
|
-
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { Currency, Rating, ResponseData, Specs } from '../types.
|
|
1
|
+
import type { Currency, Rating, ResponseData, Specs } from '../types.ts';
|
|
2
2
|
export interface MyOrdersRequestParams {
|
|
3
3
|
return_completed?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface MyOrdersResponseData extends ResponseData {
|
|
6
|
+
orders: MyOrdersOrder[];
|
|
7
|
+
limit: number;
|
|
8
|
+
}
|
|
9
|
+
export interface MyOrdersOrder {
|
|
6
10
|
id: number;
|
|
7
|
-
fee: number;
|
|
8
11
|
creation_fee: number;
|
|
9
12
|
price: number;
|
|
10
13
|
mrl: number;
|
|
@@ -31,7 +34,3 @@ export interface MyOrdersResponseDataOrder {
|
|
|
31
34
|
spot?: boolean;
|
|
32
35
|
expired?: boolean;
|
|
33
36
|
}
|
|
34
|
-
export interface MyOrdersResponseData extends ResponseData {
|
|
35
|
-
orders: MyOrdersResponseDataOrder[];
|
|
36
|
-
limit: number;
|
|
37
|
-
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Currency, Pricing, ResponseData, Specs, Visibility } from '../types.ts';
|
|
2
|
+
export interface MyServersResponseData extends ResponseData {
|
|
3
|
+
servers: MyServersServer[];
|
|
4
|
+
limit: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MyServersServer {
|
|
7
|
+
name: string;
|
|
8
|
+
connected: boolean;
|
|
9
|
+
visibility: Visibility;
|
|
10
|
+
pricing: Pricing;
|
|
11
|
+
online: boolean;
|
|
12
|
+
min_spot_pricing: Pricing;
|
|
13
|
+
allowed_currencies: Currency[];
|
|
14
|
+
init_token?: string;
|
|
15
|
+
specs?: Specs;
|
|
16
|
+
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import type { ResponseData } from '../types.
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
leased_amount: number;
|
|
7
|
-
leased_finished_amount: number;
|
|
8
|
-
}
|
|
9
|
-
export interface PohBalanceResponseDataBalance {
|
|
10
|
-
total: number;
|
|
11
|
-
free_amount: number;
|
|
12
|
-
reward_amount: number;
|
|
13
|
-
offers: PohBalanceResponseDataBalanceOffers;
|
|
1
|
+
import type { ResponseData } from '../types.ts';
|
|
2
|
+
export interface PohBalanceResponseData extends ResponseData {
|
|
3
|
+
items: PohBalanceItem[];
|
|
4
|
+
balance: PohBalance;
|
|
5
|
+
count: number;
|
|
14
6
|
}
|
|
15
|
-
export interface
|
|
7
|
+
export interface PohBalanceItem {
|
|
16
8
|
user: number;
|
|
17
9
|
address: string;
|
|
18
10
|
signature: string;
|
|
@@ -24,8 +16,16 @@ export interface PohBalanceResponseDataItem {
|
|
|
24
16
|
balance: number;
|
|
25
17
|
last_check: number;
|
|
26
18
|
}
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
export interface PohBalance {
|
|
20
|
+
total: number;
|
|
21
|
+
free_amount: number;
|
|
22
|
+
reward_amount: number;
|
|
23
|
+
offers: PohBalanceOffers;
|
|
24
|
+
}
|
|
25
|
+
export interface PohBalanceOffers {
|
|
26
|
+
rented_amount: number;
|
|
27
|
+
rented_on_marketplace_amount: number;
|
|
28
|
+
rented_finished_amount: number;
|
|
29
|
+
leased_amount: number;
|
|
30
|
+
leased_finished_amount: number;
|
|
31
31
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Pricing, ResponseData } from '../types.ts';
|
|
2
|
+
export interface RenterFeesResponseData extends ResponseData {
|
|
3
|
+
renter_fees: RenterFees;
|
|
4
|
+
poh_config: RenterFeesPohConfig;
|
|
5
|
+
creation_fees: RenterFeesCreationFees;
|
|
6
|
+
poh_balance: number;
|
|
7
|
+
}
|
|
8
|
+
export interface RenterFees {
|
|
9
|
+
on_demand: RenterFee;
|
|
10
|
+
spot: RenterFee;
|
|
11
|
+
}
|
|
12
|
+
export interface RenterFee {
|
|
13
|
+
base: Pricing;
|
|
14
|
+
}
|
|
15
|
+
export interface RenterFeesPohConfig {
|
|
16
|
+
max_reduction_percent: number;
|
|
17
|
+
max_poh_amount: number;
|
|
18
|
+
}
|
|
19
|
+
export interface RenterFeesCreationFees {
|
|
20
|
+
on_demand: Pricing;
|
|
21
|
+
spot: Pricing;
|
|
22
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { Pricing, ResponseData, Specs, Visibility } from '../types.
|
|
1
|
+
import type { AutoPrice, Currency, Pricing, PricingInOriginalUsd, ResponseData, Specs, Visibility } from '../types.ts';
|
|
2
2
|
export interface ServerConfigRequestData {
|
|
3
3
|
server_name: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
command: string;
|
|
9
|
-
env: Record<string, string>;
|
|
5
|
+
export interface ServerConfigResponseData extends ResponseData {
|
|
6
|
+
config: ServerConfig;
|
|
7
|
+
creation_completed: boolean;
|
|
10
8
|
}
|
|
11
|
-
export interface
|
|
9
|
+
export interface ServerConfig {
|
|
12
10
|
name: string;
|
|
13
11
|
connected: boolean;
|
|
14
12
|
visibility: Visibility;
|
|
@@ -20,9 +18,14 @@ export interface ServerConfigResponseDataConfig {
|
|
|
20
18
|
id: number;
|
|
21
19
|
rental_status: number;
|
|
22
20
|
specs: Specs;
|
|
23
|
-
background_job:
|
|
21
|
+
background_job: ServerConfigBackgroundJob;
|
|
22
|
+
allowed_coins: Currency[];
|
|
23
|
+
autoprice: AutoPrice;
|
|
24
|
+
usd_pricing: PricingInOriginalUsd;
|
|
24
25
|
}
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
export interface ServerConfigBackgroundJob {
|
|
27
|
+
times_updated: number;
|
|
28
|
+
image: string;
|
|
29
|
+
command: string;
|
|
30
|
+
env: Record<string, string>;
|
|
28
31
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AutoPrice, PricingInOriginalUsd, ResponseData } from '../types.ts';
|
|
2
|
+
export interface SetServerSettingsRequestData {
|
|
3
|
+
'name': string;
|
|
4
|
+
'availability': boolean;
|
|
5
|
+
'mrl': number;
|
|
6
|
+
'bitcoin_on_demand': number;
|
|
7
|
+
'bitcoin_spot': number;
|
|
8
|
+
'CLORE-Blockchain_on_demand'?: number;
|
|
9
|
+
'CLORE-Blockchain_spot'?: number;
|
|
10
|
+
'USD-Blockchain_on_demand'?: number;
|
|
11
|
+
'USD-Blockchain_spot'?: number;
|
|
12
|
+
'enabled-USD-Blockchain'?: boolean;
|
|
13
|
+
'enabled-CLORE-Blockchain'?: boolean;
|
|
14
|
+
'enabled-bitcoin'?: boolean;
|
|
15
|
+
'autoprice'?: AutoPrice;
|
|
16
|
+
'usd_pricing'?: PricingInOriginalUsd;
|
|
17
|
+
}
|
|
18
|
+
export type SetServerSettingsResponseData = ResponseData;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResponseData } from '../types.ts';
|
|
2
|
+
export interface SetSpotPriceRequestData {
|
|
3
|
+
order_id: number;
|
|
4
|
+
desired_price: number;
|
|
5
|
+
}
|
|
6
|
+
export type SetSpotPriceResponseData = SetSpotPriceMaxStep | SetSpotPriceTimeToLowering | SetSpotPriceNormal;
|
|
7
|
+
export interface SetSpotPriceMaxStep extends ResponseData {
|
|
8
|
+
error: 'exceeded_max_step';
|
|
9
|
+
max_step: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SetSpotPriceTimeToLowering extends ResponseData {
|
|
12
|
+
error: 'can_lower_every_600_seconds';
|
|
13
|
+
time_to_lowering: number;
|
|
14
|
+
}
|
|
15
|
+
export type SetSpotPriceNormal = Omit<ResponseData, 'error'>;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { Currency, Pricing, ResponseData, Visibility } from '../types.
|
|
1
|
+
import type { Currency, Pricing, ResponseData, Visibility } from '../types.ts';
|
|
2
2
|
export interface SpotMarketplaceRequestParams {
|
|
3
3
|
market: number;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
6
|
-
|
|
5
|
+
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
6
|
+
market: SpotMarketplaceMarket;
|
|
7
|
+
exists: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SpotMarketplaceMarket {
|
|
10
|
+
currency_rates_in_usd: Pricing;
|
|
11
|
+
offers: SpotMarketplaceMarketOffer[];
|
|
12
|
+
server: SpotMarketplaceMarketServer;
|
|
13
|
+
}
|
|
14
|
+
export interface SpotMarketplaceMarketOffer {
|
|
15
|
+
offer_id: number;
|
|
7
16
|
bid: number;
|
|
8
|
-
|
|
17
|
+
active: boolean;
|
|
9
18
|
my: boolean;
|
|
10
|
-
|
|
19
|
+
currency: Currency;
|
|
11
20
|
}
|
|
12
|
-
export interface
|
|
21
|
+
export interface SpotMarketplaceMarketServer {
|
|
13
22
|
min_pricing: Pricing;
|
|
14
23
|
mrl: number;
|
|
15
24
|
online: boolean;
|
|
16
25
|
visibility: Visibility;
|
|
17
26
|
}
|
|
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
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Currency, ResponseData } from '../types.
|
|
2
|
-
export interface
|
|
1
|
+
import type { Currency, ResponseData } from '../types.ts';
|
|
2
|
+
export interface WalletsResponseData extends ResponseData {
|
|
3
|
+
wallets: Wallet[];
|
|
4
|
+
}
|
|
5
|
+
export interface Wallet {
|
|
3
6
|
name: Currency;
|
|
4
7
|
deposit: string;
|
|
5
8
|
balance: number;
|
|
6
9
|
withdrawal_fee: number;
|
|
7
10
|
}
|
|
8
|
-
export interface WalletsResponseData extends ResponseData {
|
|
9
|
-
wallets: WalletsResponseDataWallet[];
|
|
10
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,37 +1,26 @@
|
|
|
1
|
-
import type { CreateAxiosDefaults } from 'axios';
|
|
2
|
-
import type { Options as PQueueOptions, Queue, QueueAddOptions } from 'p-queue';
|
|
3
|
-
export type QueueOptions = PQueueOptions<Queue<() => Promise<unknown>, QueueAddOptions>, QueueAddOptions>;
|
|
4
|
-
export interface Options {
|
|
5
|
-
axiosOptions?: CreateAxiosDefaults;
|
|
6
|
-
queueOptions?: QueueOptions;
|
|
7
|
-
queueOptionsCreateOrder?: QueueOptions;
|
|
8
|
-
queueOptionsGigaspot?: QueueOptions;
|
|
9
|
-
}
|
|
10
1
|
export interface ResponseData {
|
|
11
2
|
code: number;
|
|
12
|
-
error?: string
|
|
3
|
+
error?: string;
|
|
13
4
|
}
|
|
14
5
|
export type OrderType = 'on-demand' | 'spot';
|
|
15
6
|
export type Visibility = 'public' | 'hidden';
|
|
16
|
-
export type Currency = 'CLORE-Blockchain' | 'bitcoin';
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
export type Currency = 'CLORE-Blockchain' | 'USD-Blockchain' | 'bitcoin';
|
|
8
|
+
export type Pricing = Partial<Record<Currency, number>>;
|
|
9
|
+
export type AutoPrice = Partial<Record<Currency, 'usd' | false>>;
|
|
10
|
+
export type PricingInOriginalUsd = Partial<Record<Currency, {
|
|
11
|
+
on_demand: number;
|
|
12
|
+
spot: number;
|
|
13
|
+
}>>;
|
|
22
14
|
export interface PricingInUsd {
|
|
23
|
-
on_demand_btc: number;
|
|
24
15
|
on_demand_clore: number;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export interface PricingInOriginalUsd {
|
|
28
|
-
on_demand: number;
|
|
16
|
+
on_demand_usd: number;
|
|
17
|
+
on_demand_btc: number;
|
|
29
18
|
spot: number;
|
|
30
19
|
}
|
|
31
20
|
export interface Price {
|
|
32
21
|
on_demand: Pricing;
|
|
33
22
|
spot: Pricing;
|
|
34
|
-
usd
|
|
23
|
+
usd: PricingInUsd;
|
|
35
24
|
original_usd?: PricingInOriginalUsd;
|
|
36
25
|
}
|
|
37
26
|
export interface Net {
|
|
@@ -77,3 +66,10 @@ export interface Rating {
|
|
|
77
66
|
avg: number;
|
|
78
67
|
cnt: number;
|
|
79
68
|
}
|
|
69
|
+
export interface GigaspotOverclock {
|
|
70
|
+
pl: number;
|
|
71
|
+
core_offset?: number;
|
|
72
|
+
mem_offset?: number;
|
|
73
|
+
core_lock?: number;
|
|
74
|
+
mem_lock?: number;
|
|
75
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|