cetus-tools 1.0.1 → 1.0.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/dist/api/bitso/BitsoApiConnection.d.ts +26 -0
- package/dist/api/bitso/BitsoApiConnection.js +121 -0
- package/dist/api/bitso/BitsoApiConnection.js.map +1 -0
- package/dist/api/bitso/tools/BitsoBalance.d.ts +17 -0
- package/dist/api/bitso/tools/BitsoBalance.js +30 -0
- package/dist/api/bitso/tools/BitsoBalance.js.map +1 -0
- package/dist/api/bitso/tools/BitsoBook.d.ts +37 -0
- package/dist/api/bitso/tools/BitsoBook.js +52 -0
- package/dist/api/bitso/tools/BitsoBook.js.map +1 -0
- package/dist/api/bitso/tools/BitsoOrder.d.ts +42 -0
- package/dist/api/bitso/tools/BitsoOrder.js +31 -0
- package/dist/api/bitso/tools/BitsoOrder.js.map +1 -0
- package/dist/api/bitso/tools/BitsoOrderBook.d.ts +14 -0
- package/dist/api/bitso/tools/BitsoOrderBook.js +25 -0
- package/dist/api/bitso/tools/BitsoOrderBook.js.map +1 -0
- package/dist/api/bitso/tools/BitsoTrade.d.ts +41 -0
- package/dist/api/bitso/tools/BitsoTrade.js +47 -0
- package/dist/api/bitso/tools/BitsoTrade.js.map +1 -0
- package/dist/crud/ChatPlatformManager.d.ts +22 -0
- package/dist/crud/ChatPlatformManager.js +38 -0
- package/dist/crud/ChatPlatformManager.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IBitsoBook } from './tools/BitsoBook';
|
|
2
|
+
import { IBitsoOrder } from './tools/BitsoOrder';
|
|
3
|
+
import { IBitsoTrade, IBitsoTradeRequest } from './tools/BitsoTrade';
|
|
4
|
+
export interface BitsoApiConfig {
|
|
5
|
+
url: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
apiSecret: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class BitsoApiConnection {
|
|
10
|
+
private config;
|
|
11
|
+
constructor(config: BitsoApiConfig);
|
|
12
|
+
private sign;
|
|
13
|
+
getBalances(): Promise<import("./tools/BitsoBalance").IBitsobalance[]>;
|
|
14
|
+
getAvailableBookList(): Promise<IBitsoBook[]>;
|
|
15
|
+
getOrderBook(book: IBitsoBook, aggregate?: boolean): Promise<import("./tools/BitsoOrderBook").IBitsoOrderBook>;
|
|
16
|
+
placeOrder(body: IBitsoOrder): Promise<{
|
|
17
|
+
oid: string;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
lookUpOrder(oid: string): Promise<import("./tools/BitsoOrder").IBitsoOrderDetails[]>;
|
|
20
|
+
getUserOpenOrders(book: IBitsoBook): Promise<import("./tools/BitsoOrder").IBitsoOrderDetails[]>;
|
|
21
|
+
cancelOrder(oid: string): Promise<string[]>;
|
|
22
|
+
getTrades(book: IBitsoTradeRequest): Promise<IBitsoTrade[]>;
|
|
23
|
+
getOrderTrades(oid: string): Promise<import("./tools/BitsoTrade").IBitsoTradeDetails[]>;
|
|
24
|
+
getFees(): Promise<any>;
|
|
25
|
+
getTicker(book: IBitsoBook): Promise<any>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BitsoApiConnection = void 0;
|
|
13
|
+
const crypto_js_1 = require("crypto-js");
|
|
14
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
15
|
+
const BitsoBalance_1 = require("./tools/BitsoBalance");
|
|
16
|
+
const BitsoBook_1 = require("./tools/BitsoBook");
|
|
17
|
+
const BitsoOrderBook_1 = require("./tools/BitsoOrderBook");
|
|
18
|
+
const BitsoOrder_1 = require("./tools/BitsoOrder");
|
|
19
|
+
const BitsoTrade_1 = require("./tools/BitsoTrade");
|
|
20
|
+
class BitsoApiConnection {
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.config = config;
|
|
23
|
+
}
|
|
24
|
+
sign(method, path, body) {
|
|
25
|
+
let nonce = Date.now();
|
|
26
|
+
let message = nonce + method + path + (body ? JSON.stringify(body) : "");
|
|
27
|
+
console.log("> message:", message);
|
|
28
|
+
const hash = (0, crypto_js_1.HmacSHA256)(message, this.config.apiSecret);
|
|
29
|
+
let signature = crypto_js_1.enc.Hex.stringify(hash);
|
|
30
|
+
return {
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Bitso ${this.config.apiKey}:${nonce}:${signature}`
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
getBalances() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
let signature = this.sign('GET', '/api/v3/balance/');
|
|
39
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/balance/`, signature);
|
|
40
|
+
return (0, BitsoBalance_1.parseBitsoBalanceArray)(response.payload.balances);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getAvailableBookList() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let signature = this.sign('GET', `/api/v3/available_books/`);
|
|
46
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/available_books/`, signature);
|
|
47
|
+
return (0, BitsoBook_1.parseBitsoBookArray)(response.payload);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getOrderBook(book, aggregate) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
let signature = this.sign('GET', `/api/v3/order_book/`);
|
|
53
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/order_book/?book=${book.book}&aggregate=${aggregate !== null && aggregate !== void 0 ? aggregate : true}`, signature);
|
|
54
|
+
return (0, BitsoOrderBook_1.parseBitsoOrderBook)(response.payload);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
placeOrder(body) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
let signature = this.sign('POST', `/api/v3/orders/`, body);
|
|
60
|
+
let response = yield itrm_tools_1.RequestAxiosCall.post(`${this.config.url}/api/v3/orders/`, body, signature);
|
|
61
|
+
return response.success ? response.payload : undefined;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
lookUpOrder(oid) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
let signature = this.sign('GET', `/api/v3/orders/${oid}/`);
|
|
67
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/orders/${oid}/`, signature);
|
|
68
|
+
return response.success ? (0, BitsoOrder_1.parseBitsoOrderDetailsArray)(response.payload) : [];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getUserOpenOrders(book) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
let signature = this.sign('GET', `/api/v3/open_orders/?book=${book.book}`);
|
|
74
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/open_orders/?book=${book.book}`, signature);
|
|
75
|
+
return response.success ? (0, BitsoOrder_1.parseBitsoOrderDetailsArray)(response.payload) : [];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
cancelOrder(oid) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
let signature = this.sign('DELETE', `/api/v3/orders/${oid}/`);
|
|
81
|
+
let response = yield itrm_tools_1.RequestAxiosCall.delete(`${this.config.url}/api/v3/orders/${oid}/`, signature);
|
|
82
|
+
return response.success ? response.payload : [];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getTrades(book) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
let path = `/api/v3/trades/?book=${book.book}${book.limit ? '&limit=' + book.limit : ''}${book.maker ? '&maker=' + book.maker : ''}${book.sort ? '&sort=' + book.sort : ''}`;
|
|
88
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}${path}`, this.sign('GET', path));
|
|
89
|
+
return response.success ? (0, BitsoTrade_1.parseBitsoTradeArray)(response.payload) : [];
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
getOrderTrades(oid) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
let signature = this.sign('GET', `/api/v3/order_trades/${oid}/`);
|
|
96
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/order_trades/${oid}/`, signature);
|
|
97
|
+
return response.success ? (0, BitsoTrade_1.parseBitsoTradeDetailsArray)(response.payload) : [];
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.log("> err", err.response.status, ":", err.response.data);
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
getFees() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
let signature = this.sign('GET', `/api/v3/fees/`);
|
|
108
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/fees/`, signature);
|
|
109
|
+
return response;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
getTicker(book) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
let signature = this.sign('GET', `/api/v3/ticker/?book=${book.book}`);
|
|
115
|
+
let response = yield itrm_tools_1.RequestAxiosCall.get(`${this.config.url}/api/v3/ticker/?book=${book.book}`, signature);
|
|
116
|
+
return response;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.BitsoApiConnection = BitsoApiConnection;
|
|
121
|
+
//# sourceMappingURL=BitsoApiConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoApiConnection.js","sourceRoot":"","sources":["../../../src/api/bitso/BitsoApiConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA8C;AAC9C,uDAA8D;AAC9D,iDAAoE;AACpE,2DAA6D;AAC7D,mDAA8E;AAC9E,mDAAgJ;AAQhJ,MAAa,kBAAkB;IAG3B,YAAY,MAAsB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEO,IAAI,CAAC,MAAc,EAAE,IAAY,EAAE,IAAU;QACjD,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,IAAA,sBAAU,EAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,SAAS,GAAG,eAAG,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO;YACH,OAAO,EAAE;gBACL,aAAa,EAAE,SAAS,IAAI,CAAC,MAAM,CAAC,M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AAC,CAAC,CAAC,IAAA,wCAA2B,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACjF,CAAC;YAAC,OAAM,GAAQ,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAClE,OAAO,EAAE,CAAC;YACd,CAAC;QACL,CAAC;KAAA;IAEY,OAAO;;YAChB,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;YAClD,IAAI,QAAQ,GAAQ,MAAM,6BAAgB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,eAAe,EAAE,SAAS,CAAC,CAAC;YAC7F,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAEY,SAAS,CAAC,IAAgB;;YACnC,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,wBAAwB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACtE,IAAI,QAAQ,GAAQ,MAAM,6BAAgB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,wBAAwB,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,CAAC,CAAC;YACjH,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ;AA1FD,gDA0FC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IBitsobalance {
|
|
2
|
+
currency: string;
|
|
3
|
+
available: number;
|
|
4
|
+
locked: number;
|
|
5
|
+
total: number;
|
|
6
|
+
pending_deposit: number;
|
|
7
|
+
pending_withdrawal: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseBitsoBalance(response: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
}): IBitsobalance;
|
|
12
|
+
export declare function parseBitsoBalanceArray(response: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}[]): IBitsobalance[];
|
|
15
|
+
export declare function findBalances(currencies: string[], balances: IBitsobalance[]): {
|
|
16
|
+
[key: string]: IBitsobalance;
|
|
17
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBalances = exports.parseBitsoBalanceArray = exports.parseBitsoBalance = void 0;
|
|
4
|
+
function parseBitsoBalance(response) {
|
|
5
|
+
return {
|
|
6
|
+
currency: response.currency,
|
|
7
|
+
available: parseFloat(response.available),
|
|
8
|
+
locked: parseFloat(response.locked),
|
|
9
|
+
total: parseFloat(response.total),
|
|
10
|
+
pending_deposit: parseFloat(response.pending_deposit),
|
|
11
|
+
pending_withdrawal: parseFloat(response.pending_withdrawal),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.parseBitsoBalance = parseBitsoBalance;
|
|
15
|
+
function parseBitsoBalanceArray(response) {
|
|
16
|
+
let result = [];
|
|
17
|
+
for (let datum of response)
|
|
18
|
+
result.push(parseBitsoBalance(datum));
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
exports.parseBitsoBalanceArray = parseBitsoBalanceArray;
|
|
22
|
+
function findBalances(currencies, balances) {
|
|
23
|
+
let result = {};
|
|
24
|
+
for (let balance of balances)
|
|
25
|
+
if (currencies.includes(balance.currency))
|
|
26
|
+
result[balance.currency] = balance;
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
exports.findBalances = findBalances;
|
|
30
|
+
//# sourceMappingURL=BitsoBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoBalance.js","sourceRoot":"","sources":["../../../../src/api/bitso/tools/BitsoBalance.ts"],"names":[],"mappings":";;;AASA,SAAgB,iBAAiB,CAAC,QAAoC;IAClE,OAAO;QACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;QACzC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnC,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC;QACrD,kBAAkB,EAAE,UAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC;KAC9D,CAAC;AACN,CAAC;AATD,8CASC;AAED,SAAgB,sBAAsB,CAAC,QAAsC;IACzE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,IAAI,QAAQ;QACtB,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC;AAClB,CAAC;AALD,wDAKC;AAED,SAAgB,YAAY,CAAC,UAAoB,EAAE,QAAyB;IACxE,IAAI,MAAM,GAAqC,EAAE,CAAC;IAClD,KAAK,IAAI,OAAO,IAAI,QAAQ;QACxB,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;IAC3C,OAAO,MAAM,CAAC;AAClB,CAAC;AAND,oCAMC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface IBitsoBookFeesRate {
|
|
2
|
+
maker: number;
|
|
3
|
+
taker: number;
|
|
4
|
+
volume?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IBitsoBook {
|
|
7
|
+
book: string;
|
|
8
|
+
default_chart: string;
|
|
9
|
+
minimum_price: number;
|
|
10
|
+
maximum_price: number;
|
|
11
|
+
minimum_value: number;
|
|
12
|
+
maximum_value: number;
|
|
13
|
+
minimum_amount: number;
|
|
14
|
+
maximum_amount: number;
|
|
15
|
+
tick_size: number;
|
|
16
|
+
fees: {
|
|
17
|
+
flat_rate: IBitsoBookFeesRate;
|
|
18
|
+
structure: IBitsoBookFeesRate[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function parseBitsoBookArray(response: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
fees: any;
|
|
24
|
+
}[]): IBitsoBook[];
|
|
25
|
+
export declare function parseBitsoBook(response: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
fees: any;
|
|
28
|
+
}): IBitsoBook;
|
|
29
|
+
export declare function parseBitsoBookFeesRateArray(response: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
}[]): IBitsoBookFeesRate[];
|
|
32
|
+
export declare function parseBitsoBookFeesRate(response: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
}): IBitsoBookFeesRate;
|
|
35
|
+
export declare function findBitsoBook(pairs: string[], books: IBitsoBook[]): {
|
|
36
|
+
[key: string]: IBitsoBook;
|
|
37
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBitsoBook = exports.parseBitsoBookFeesRate = exports.parseBitsoBookFeesRateArray = exports.parseBitsoBook = exports.parseBitsoBookArray = void 0;
|
|
4
|
+
function parseBitsoBookArray(response) {
|
|
5
|
+
let result = [];
|
|
6
|
+
for (let datum of response)
|
|
7
|
+
result.push(parseBitsoBook(datum));
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
exports.parseBitsoBookArray = parseBitsoBookArray;
|
|
11
|
+
function parseBitsoBook(response) {
|
|
12
|
+
return {
|
|
13
|
+
book: response.book,
|
|
14
|
+
default_chart: response.default_chart,
|
|
15
|
+
minimum_price: parseFloat(response.minimum_price),
|
|
16
|
+
maximum_price: parseFloat(response.maximum_price),
|
|
17
|
+
minimum_value: parseFloat(response.minimum_value),
|
|
18
|
+
maximum_value: parseFloat(response.maximum_value),
|
|
19
|
+
minimum_amount: parseFloat(response.minimum_amount),
|
|
20
|
+
maximum_amount: parseFloat(response.maximum_amount),
|
|
21
|
+
tick_size: parseFloat(response.tick_size),
|
|
22
|
+
fees: {
|
|
23
|
+
flat_rate: parseBitsoBookFeesRate(response.fees.flat_rate),
|
|
24
|
+
structure: parseBitsoBookFeesRateArray(response.fees.structure)
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.parseBitsoBook = parseBitsoBook;
|
|
29
|
+
function parseBitsoBookFeesRateArray(response) {
|
|
30
|
+
let result = [];
|
|
31
|
+
for (let value of response)
|
|
32
|
+
result.push(parseBitsoBookFeesRate(value));
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
exports.parseBitsoBookFeesRateArray = parseBitsoBookFeesRateArray;
|
|
36
|
+
function parseBitsoBookFeesRate(response) {
|
|
37
|
+
return {
|
|
38
|
+
maker: parseFloat(response.maker),
|
|
39
|
+
taker: parseFloat(response.taker),
|
|
40
|
+
volume: response.volume ? parseFloat(response.volume) : undefined
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.parseBitsoBookFeesRate = parseBitsoBookFeesRate;
|
|
44
|
+
function findBitsoBook(pairs, books) {
|
|
45
|
+
let result = {};
|
|
46
|
+
for (let book of books)
|
|
47
|
+
if (pairs.includes(book.book))
|
|
48
|
+
result[book.book] = book;
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
exports.findBitsoBook = findBitsoBook;
|
|
52
|
+
//# sourceMappingURL=BitsoBook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoBook.js","sourceRoot":"","sources":["../../../../src/api/bitso/tools/BitsoBook.ts"],"names":[],"mappings":";;;AAsBA,SAAgB,mBAAmB,CAAC,QAAgD;IAChF,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,IAAI,QAAQ;QACtB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAA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AAM,CAAC,CAAC,CAAC,CAAC,SAAS;KACpE,CAAC;AACN,CAAC;AAND,wDAMC;AAED,SAAgB,aAAa,CAAC,KAAe,EAAE,KAAmB;IAC9D,IAAI,MAAM,GAAkC,EAAE,CAAC;IAC/C,KAAK,IAAI,IAAI,IAAI,KAAK;QAClB,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjC,OAAO,MAAM,CAAC;AAClB,CAAC;AAND,sCAMC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface IBitsoOrder {
|
|
2
|
+
book: string;
|
|
3
|
+
major?: number;
|
|
4
|
+
minor?: number;
|
|
5
|
+
origin_id?: string;
|
|
6
|
+
price?: number;
|
|
7
|
+
side: 'buy' | 'sell';
|
|
8
|
+
stop?: string;
|
|
9
|
+
type: 'market' | 'limit';
|
|
10
|
+
time_in_force?: 'goodtillcancelled' | 'fillorkill' | 'immediateorcancel' | 'postonly';
|
|
11
|
+
}
|
|
12
|
+
export interface IBitsoOrderDetails {
|
|
13
|
+
book: string;
|
|
14
|
+
created_at: string;
|
|
15
|
+
oid: string;
|
|
16
|
+
original_amount: number;
|
|
17
|
+
origin_id?: string;
|
|
18
|
+
original_value: number;
|
|
19
|
+
price?: number;
|
|
20
|
+
side: 'buy' | 'sell';
|
|
21
|
+
status: 'queued' | 'open' | 'partially' | 'filled' | 'cancelled' | 'completed';
|
|
22
|
+
stop?: number;
|
|
23
|
+
time_in_force: 'goodtillcancelled' | 'fillorkill' | 'immediateorcancel' | 'postonly';
|
|
24
|
+
triggered_at?: string;
|
|
25
|
+
type: 'market' | 'limit';
|
|
26
|
+
unfilled_amount: number;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function parseBitsoOrderDetailsArray(response: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
side: 'buy' | 'sell';
|
|
32
|
+
status: 'queued' | 'open' | 'partially' | 'filled' | 'cancelled' | 'completed';
|
|
33
|
+
time_in_force: 'goodtillcancelled' | 'fillorkill' | 'immediateorcancel' | 'postonly';
|
|
34
|
+
type: 'market' | 'limit';
|
|
35
|
+
}[]): IBitsoOrderDetails[];
|
|
36
|
+
export declare function parseBitsoOrderDetails(response: {
|
|
37
|
+
[key: string]: string;
|
|
38
|
+
side: 'buy' | 'sell';
|
|
39
|
+
status: 'queued' | 'open' | 'partially' | 'filled' | 'cancelled' | 'completed';
|
|
40
|
+
time_in_force: 'goodtillcancelled' | 'fillorkill' | 'immediateorcancel' | 'postonly';
|
|
41
|
+
type: 'market' | 'limit';
|
|
42
|
+
}): IBitsoOrderDetails;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBitsoOrderDetails = exports.parseBitsoOrderDetailsArray = void 0;
|
|
4
|
+
function parseBitsoOrderDetailsArray(response) {
|
|
5
|
+
let result = [];
|
|
6
|
+
for (let datum of response)
|
|
7
|
+
result.push(parseBitsoOrderDetails(datum));
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
exports.parseBitsoOrderDetailsArray = parseBitsoOrderDetailsArray;
|
|
11
|
+
function parseBitsoOrderDetails(response) {
|
|
12
|
+
return {
|
|
13
|
+
book: response.book,
|
|
14
|
+
unfilled_amount: parseFloat(response.unfilled_amount),
|
|
15
|
+
original_amount: parseFloat(response.original_amount),
|
|
16
|
+
original_value: parseFloat(response.original_value),
|
|
17
|
+
created_at: response.created_at,
|
|
18
|
+
updated_at: response.updated_at,
|
|
19
|
+
oid: response.oid,
|
|
20
|
+
side: response.side,
|
|
21
|
+
status: response.status,
|
|
22
|
+
time_in_force: response.time_in_force,
|
|
23
|
+
type: response.type,
|
|
24
|
+
origin_id: response.origin_id,
|
|
25
|
+
price: response.price ? parseFloat(response.price) : undefined,
|
|
26
|
+
stop: response.stop ? parseFloat(response.stop) : undefined,
|
|
27
|
+
triggered_at: response.triggered_at
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.parseBitsoOrderDetails = parseBitsoOrderDetails;
|
|
31
|
+
//# sourceMappingURL=BitsoOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoOrder.js","sourceRoot":"","sources":["../../../../src/api/bitso/tools/BitsoOrder.ts"],"names":[],"mappings":";;;AA8BA,SAAgB,2BAA2B,CAAC,QAMrC;IACH,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,IAAI,QAAQ;QACtB,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAXD,kEAWC;AAED,SAAgB,sBAAsB,CAAC,QAMlC;IACD,OAAO;QACH,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC;QACrD,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC;QACrD,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC;QACnD,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9D,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3D,YAAY,EAAE,QAAQ,CAAC,YAAY;KACtC,CAAC;AACN,CAAC;AAxBD,wDAwBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IBitsoBookOrder {
|
|
2
|
+
book: string;
|
|
3
|
+
price: number;
|
|
4
|
+
amount: number;
|
|
5
|
+
oid: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IBitsoOrderBook {
|
|
8
|
+
updated_at: string;
|
|
9
|
+
sequence: number;
|
|
10
|
+
bids: IBitsoBookOrder[];
|
|
11
|
+
asks: IBitsoBookOrder[];
|
|
12
|
+
}
|
|
13
|
+
export declare function parseBitsoOrderBook(response: any): IBitsoOrderBook;
|
|
14
|
+
export declare function parseBitsoOrderArray(values: any[]): IBitsoBookOrder[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBitsoOrderArray = exports.parseBitsoOrderBook = void 0;
|
|
4
|
+
function parseBitsoOrderBook(response) {
|
|
5
|
+
return {
|
|
6
|
+
updated_at: response.updated_at,
|
|
7
|
+
sequence: parseInt(response.sequence),
|
|
8
|
+
bids: parseBitsoOrderArray(response.bids),
|
|
9
|
+
asks: parseBitsoOrderArray(response.asks)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
exports.parseBitsoOrderBook = parseBitsoOrderBook;
|
|
13
|
+
function parseBitsoOrderArray(values) {
|
|
14
|
+
let result = [];
|
|
15
|
+
for (let value of values)
|
|
16
|
+
result.push({
|
|
17
|
+
book: value.book,
|
|
18
|
+
price: parseFloat(value.price),
|
|
19
|
+
amount: parseFloat(value.amount),
|
|
20
|
+
oid: value.oid
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
exports.parseBitsoOrderArray = parseBitsoOrderArray;
|
|
25
|
+
//# sourceMappingURL=BitsoOrderBook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoOrderBook.js","sourceRoot":"","sources":["../../../../src/api/bitso/tools/BitsoOrderBook.ts"],"names":[],"mappings":";;;AAcA,SAAgB,mBAAmB,CAAC,QAAa;IAC7C,OAAO;QACH,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrC,IAAI,EAAE,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzC,IAAI,EAAE,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC5C,CAAA;AACL,CAAC;AAPD,kDAOC;AAED,SAAgB,oBAAoB,CAAC,MAAa;IAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,IAAI,MAAM;QACpB,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;YAC9B,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC;YAChC,GAAG,EAAE,KAAK,CAAC,GAAG;SACjB,CAAC,CAAC;IACP,OAAO,MAAM,CAAC;AAClB,CAAC;AAVD,oDAUC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface IBitsoTradeRequest {
|
|
2
|
+
book: string;
|
|
3
|
+
limit?: number;
|
|
4
|
+
maker?: string;
|
|
5
|
+
sort?: 'asc' | 'desc';
|
|
6
|
+
}
|
|
7
|
+
export interface IBitsoTrade {
|
|
8
|
+
book: string;
|
|
9
|
+
created_at: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
maker_side: 'buy' | 'sell';
|
|
12
|
+
price: number;
|
|
13
|
+
tid: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IBitsoTradeDetails {
|
|
16
|
+
book: string;
|
|
17
|
+
created_at: string;
|
|
18
|
+
fees_amount: number;
|
|
19
|
+
side: 'buy' | 'sell';
|
|
20
|
+
minor: number;
|
|
21
|
+
minor_currency: string;
|
|
22
|
+
major: number;
|
|
23
|
+
major_currency: string;
|
|
24
|
+
maker_side: 'buy' | 'sell';
|
|
25
|
+
price: number;
|
|
26
|
+
tid: number;
|
|
27
|
+
oid: string;
|
|
28
|
+
fees_currency: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function parseBitsoTradeArray(response: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}[]): IBitsoTrade[];
|
|
33
|
+
export declare function parseBitsoTrade(response: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}): IBitsoTrade;
|
|
36
|
+
export declare function parseBitsoTradeDetailsArray(response: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}[]): IBitsoTradeDetails[];
|
|
39
|
+
export declare function parseBitsoTradeDetails(response: {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}): IBitsoTradeDetails;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBitsoTradeDetails = exports.parseBitsoTradeDetailsArray = exports.parseBitsoTrade = exports.parseBitsoTradeArray = void 0;
|
|
4
|
+
function parseBitsoTradeArray(response) {
|
|
5
|
+
let result = [];
|
|
6
|
+
for (let datum of response)
|
|
7
|
+
result.push(parseBitsoTrade(datum));
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
exports.parseBitsoTradeArray = parseBitsoTradeArray;
|
|
11
|
+
function parseBitsoTrade(response) {
|
|
12
|
+
return {
|
|
13
|
+
book: response.book,
|
|
14
|
+
created_at: response.created_at,
|
|
15
|
+
amount: parseFloat(response.amount),
|
|
16
|
+
maker_side: response.maker_side,
|
|
17
|
+
price: parseFloat(response.price),
|
|
18
|
+
tid: response.tid
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.parseBitsoTrade = parseBitsoTrade;
|
|
22
|
+
function parseBitsoTradeDetailsArray(response) {
|
|
23
|
+
let result = [];
|
|
24
|
+
for (let datum of response)
|
|
25
|
+
result.push(parseBitsoTradeDetails(datum));
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
exports.parseBitsoTradeDetailsArray = parseBitsoTradeDetailsArray;
|
|
29
|
+
function parseBitsoTradeDetails(response) {
|
|
30
|
+
return {
|
|
31
|
+
book: response.book,
|
|
32
|
+
created_at: response.created_at,
|
|
33
|
+
maker_side: response.maker_side,
|
|
34
|
+
price: parseFloat(response.price),
|
|
35
|
+
tid: response.tid,
|
|
36
|
+
fees_amount: parseFloat(response.fees_amount),
|
|
37
|
+
fees_currency: response.fees_currency,
|
|
38
|
+
major: parseFloat(response.major),
|
|
39
|
+
major_currency: response.major_currency,
|
|
40
|
+
minor: parseFloat(response.minor),
|
|
41
|
+
minor_currency: response.minor_currency,
|
|
42
|
+
side: response.side,
|
|
43
|
+
oid: response.oid
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.parseBitsoTradeDetails = parseBitsoTradeDetails;
|
|
47
|
+
//# sourceMappingURL=BitsoTrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitsoTrade.js","sourceRoot":"","sources":["../../../../src/api/bitso/tools/BitsoTrade.ts"],"names":[],"mappings":";;;AAgCA,SAAgB,oBAAoB,CAAC,QAAmC;IACpE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,KAAK,IAAI,QAAQ;QACtB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAClB,CAAC;AALD,oDAKC;AAED,SAAgB,eAAe,CAAC,QAAgC;IAC5D,OAAO;QACH,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;Q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
|
|
4
|
+
chatPlatformId?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
updatedAt?: string;
|
|
7
|
+
createdAt?: string;
|
|
8
|
+
config?: AxiosRequestConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface IChatPlatformDetails {
|
|
11
|
+
name: string;
|
|
12
|
+
config?: AxiosRequestConfig;
|
|
13
|
+
}
|
|
14
|
+
export declare class ChatPlatformManager extends CrudServiceManager<IChatPlatformDetails, IChatPlatform> {
|
|
15
|
+
private url;
|
|
16
|
+
constructor(url: string);
|
|
17
|
+
find(details: IChatPlatformDetails): Promise<IChatPlatform | undefined>;
|
|
18
|
+
findById(id: StandardIdRequestDefinition): Promise<IChatPlatform | undefined>;
|
|
19
|
+
create(details: IChatPlatformDetails): Promise<IChatPlatform | undefined>;
|
|
20
|
+
modify(platform: IChatPlatform): Promise<any>;
|
|
21
|
+
destroy(platform: IChatPlatform): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChatPlatformManager = void 0;
|
|
13
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
14
|
+
class ChatPlatformManager extends itrm_tools_1.CrudServiceManager {
|
|
15
|
+
constructor(url) {
|
|
16
|
+
super();
|
|
17
|
+
this.url = url;
|
|
18
|
+
}
|
|
19
|
+
find(details) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return this.sendFinding(`${this.url}/platforms?name=${details.name}`, details.config);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
findById(id) {
|
|
25
|
+
return this.sendFinding(`${this.url}/platforms?id=${id.id}`, id.config);
|
|
26
|
+
}
|
|
27
|
+
create(details) {
|
|
28
|
+
return this.sendCreation(`${this.url}/platforms`, { name: details.name }, details.config);
|
|
29
|
+
}
|
|
30
|
+
modify(platform) {
|
|
31
|
+
return this.sendModification(`${this.url}/platforms/${platform.chatPlatformId}`, { name: platform.name }, platform.config);
|
|
32
|
+
}
|
|
33
|
+
destroy(platform) {
|
|
34
|
+
return this.sendDestuction(`${this.url}/platforms/${platform.chatPlatformId}`, platform.config);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ChatPlatformManager = ChatPlatformManager;
|
|
38
|
+
//# sourceMappingURL=ChatPlatformManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatPlatformManager.js","sourceRoot":"","sources":["../../src/crud/ChatPlatformManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;AAe7E,MAAa,mBAAoB,SAAQ,+BAAuD;IAG5F,YAAY,GAAW;QACnB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAEY,IAAI,CAAC,OAA6B;;YAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,mBAAmB,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1F,CAAC;KAAA;IAEM,QAAQ,CAAC,EAA+B;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;IAEM,MAAM,CAAC,OAA6B;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,GAAG,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,QAAuB;QACjC,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,GAAG,cAAc,QAAQ,CAAC,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/H,CAAC;IAEM,OAAO,CAAC,QAAuB;QAClC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,GAAG,cAAc,QAAQ,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpG,CAAC;CACJ;AA3BD,kDA2BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { ExpressLogableConfig as ExpressLogableConfig } from './api/ExpressLogableConfig';
|
|
2
|
+
export { BitsoApiConfig as BitsoApiConfig, BitsoApiConnection as BitsoApiConnection } from './api/bitso/BitsoApiConnection';
|
|
3
|
+
export { IBitsobalance as IBitsobalance, findBalances as findBalances } from './api/bitso/tools/BitsoBalance';
|
|
4
|
+
export { IBitsoBook as IBitsoBook, findBitsoBook as findBitsoBook } from './api/bitso/tools/BitsoBook';
|
|
5
|
+
export { IBitsoOrder as IBitsoOrder, IBitsoOrderDetails as IBitsoOrderDetails } from './api/bitso/tools/BitsoOrder';
|
|
6
|
+
export { IBitsoOrderBook as IBitsoOrderBook } from './api/bitso/tools/BitsoOrderBook';
|
|
2
7
|
export { KeyTypeManager as KeyTypeManager, IKeyType as IKeyType, IKeyTypeDetails as IKeyTypeDetails } from './crud/KeyTypeManager';
|
|
3
8
|
export { applyKeyTypeMocks as applyKeyTypeMocks } from './crud/test/KeyTypeMocks';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyKeyTypeMocks = exports.KeyTypeManager = exports.ExpressLogableConfig = void 0;
|
|
3
|
+
exports.applyKeyTypeMocks = exports.KeyTypeManager = exports.findBitsoBook = exports.findBalances = exports.BitsoApiConnection = exports.ExpressLogableConfig = void 0;
|
|
4
4
|
var ExpressLogableConfig_1 = require("./api/ExpressLogableConfig");
|
|
5
5
|
Object.defineProperty(exports, "ExpressLogableConfig", { enumerable: true, get: function () { return ExpressLogableConfig_1.ExpressLogableConfig; } });
|
|
6
|
+
var BitsoApiConnection_1 = require("./api/bitso/BitsoApiConnection");
|
|
7
|
+
Object.defineProperty(exports, "BitsoApiConnection", { enumerable: true, get: function () { return BitsoApiConnection_1.BitsoApiConnection; } });
|
|
8
|
+
var BitsoBalance_1 = require("./api/bitso/tools/BitsoBalance");
|
|
9
|
+
Object.defineProperty(exports, "findBalances", { enumerable: true, get: function () { return BitsoBalance_1.findBalances; } });
|
|
10
|
+
var BitsoBook_1 = require("./api/bitso/tools/BitsoBook");
|
|
11
|
+
Object.defineProperty(exports, "findBitsoBook", { enumerable: true, get: function () { return BitsoBook_1.findBitsoBook; } });
|
|
6
12
|
var KeyTypeManager_1 = require("./crud/KeyTypeManager");
|
|
7
13
|
Object.defineProperty(exports, "KeyTypeManager", { enumerable: true, get: function () { return KeyTypeManager_1.KeyTypeManager; } });
|
|
8
14
|
var KeyTypeMocks_1 = require("./crud/test/KeyTypeMocks");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mEAA0F;AAAjF,4HAAA,oBAAoB,OAAwB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mEAA0F;AAAjF,4HAAA,oBAAoB,OAAwB;AACrD,qEAA4H;AAAjF,wHAAA,kBAAkB,OAAsB;AACnF,+DAA8G;AAArE,4GAAA,YAAY,OAAgB;AACrE,yDAAuG;AAApE,0GAAA,aAAa,OAAiB;AAIjE,wDAAmI;AAA1H,gHAAA,cAAc,OAAkB;AAEzC,yDAAkF;AAAzE,iHAAA,iBAAiB,OAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cetus-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Librería para elementos comunes de CETUS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@types/crypto-js": "^4.2.1",
|
|
33
34
|
"@types/jest": "^29.5.6",
|
|
34
35
|
"@types/morgan": "^1.9.7",
|
|
35
36
|
"@types/node": "^20.8.7",
|
|
@@ -40,8 +41,9 @@
|
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"axios": "^1.5.1",
|
|
44
|
+
"crypto-js": "^4.2.0",
|
|
43
45
|
"dotenv": "^16.3.1",
|
|
44
|
-
"itrm-tools": "^1.0.
|
|
46
|
+
"itrm-tools": "^1.0.49",
|
|
45
47
|
"morgan": "^1.10.0"
|
|
46
48
|
},
|
|
47
49
|
"optionalDependencies": {
|