@clonegod/ttd-core 2.0.34 → 2.0.36
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/index.d.ts +2 -1
- package/dist/index.js +26 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import { ArbCache, StandardPoolInfoType, StandardTokenInfoType, TokenPriceWithAmountType, TradeCommandLineArgs, TradeResponseType, UniqueOrderbookIdType } from '../types';
|
|
4
|
+
import { ArbCache, StandardPoolInfoType, StandardTokenInfoType, TokenPriceWithAmountType, TradeCommandLineArgs, TradeResponseType, UniqueOrderbookIdType, WalletInfoType } from '../types';
|
|
5
5
|
import * as cache from './cache';
|
|
6
6
|
export * from './analyze';
|
|
7
7
|
export * from './app_config';
|
|
@@ -201,6 +201,7 @@ export declare function load_wallet(group_id: string, only_pubkey?: boolean): {
|
|
|
201
201
|
public_key: string;
|
|
202
202
|
private_key: string;
|
|
203
203
|
};
|
|
204
|
+
export declare function load_wallet_multi(group_ids: string[], only_pubkey?: boolean): WalletInfoType[];
|
|
204
205
|
export declare const success: (data: any) => {
|
|
205
206
|
code: number;
|
|
206
207
|
msg: string;
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ exports.mkdirSync = mkdirSync;
|
|
|
72
72
|
exports.getServerInfo = getServerInfo;
|
|
73
73
|
exports.getIPAddress = getIPAddress;
|
|
74
74
|
exports.load_wallet = load_wallet;
|
|
75
|
+
exports.load_wallet_multi = load_wallet_multi;
|
|
75
76
|
exports.chunkArray = chunkArray;
|
|
76
77
|
require('dotenv').config();
|
|
77
78
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
@@ -630,6 +631,31 @@ function load_wallet(group_id, only_pubkey = true) {
|
|
|
630
631
|
}
|
|
631
632
|
return wallet;
|
|
632
633
|
}
|
|
634
|
+
function load_wallet_multi(group_ids, only_pubkey = true) {
|
|
635
|
+
if (!group_ids || group_ids.length < 1) {
|
|
636
|
+
throw new Error('Invalid param: group_ids is empty or null !');
|
|
637
|
+
}
|
|
638
|
+
let wallet_dir = process.env.WALLET_DIR;
|
|
639
|
+
if (!wallet_dir) {
|
|
640
|
+
wallet_dir = path_1.default.join((0, exports.home_dir)(), 'data', 'keypairs');
|
|
641
|
+
}
|
|
642
|
+
let wallets = [];
|
|
643
|
+
for (let group_id of group_ids) {
|
|
644
|
+
let file_path = path_1.default.join(wallet_dir, `${group_id}.json`);
|
|
645
|
+
log_info(`Load wallet, group_id=${group_id}, file_path=${file_path}`);
|
|
646
|
+
let wallet = readFile(file_path, true, false);
|
|
647
|
+
if (only_pubkey) {
|
|
648
|
+
wallets.push({
|
|
649
|
+
public_key: wallet.public_key,
|
|
650
|
+
private_key: ''
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
wallets.push(wallet);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return wallets;
|
|
658
|
+
}
|
|
633
659
|
const success = (data) => {
|
|
634
660
|
return {
|
|
635
661
|
code: 200,
|