blob: 347673b90d6a9e85ba43e8e6bb47d772bea3c3ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import * as testrpc from 'ganache-cli';
import * as _ from 'lodash';
import { constants } from '../src/utils/constants';
import { utils } from '../src/utils/utils';
const opts = {
accounts: constants.TESTRPC_ACCOUNTS,
logger: console,
};
const server = testrpc.server(opts);
server.listen(constants.TESTRPC_PORT, (err: any, result: any) => {
if (err) {
utils.consoleLog(err);
return;
}
const state = result ? result : server.provider.manager.state;
utils.consoleLog('');
utils.consoleLog('Available Accounts');
utils.consoleLog('==================');
const accounts = state.accounts;
const addresses = _.keys(accounts);
_.forEach(addresses, (address, index) => {
const line = `(${index}) ${address}`;
utils.consoleLog(line);
});
utils.consoleLog('');
utils.consoleLog('Private Keys');
utils.consoleLog('==================');
_.forEach(addresses, (address, index) => {
utils.consoleLog(`(${index}) ${accounts[address].secretKey.toString('hex')}`);
});
utils.consoleLog('');
utils.consoleLog('Listening on localhost:' + constants.TESTRPC_PORT);
});
|