Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Support --account=1f2f3f... parameter in testrpc for defining an acco…
Browse files Browse the repository at this point in the history
…unt (can be passed multiple times)
  • Loading branch information
axic committed Mar 9, 2016
1 parent ed2a950 commit 7d519a2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bin/testrpc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@
var argv = require('yargs').argv;
var TestRPC = require('..');

function parseAccounts(accounts) {
function splitAccount(account) {
account = account.split(',')
return { secretKey: new Buffer(account[0], 'hex'), balance: account[1] }
}

if (typeof accounts === 'string')
return [ splitAccount(accounts) ];
else if (!Array.isArray(accounts))
return;

var ret = []
for (var i = 0; i < accounts.length; i++) {
ret.push(splitAccount(accounts[i]));
}
return ret;
}

TestRPC.startServer(console, {
port: argv.p || argv.port,
debug: argv.d || argv.debug
debug: argv.d || argv.debug,
accounts: parseAccounts(argv.account)
});

0 comments on commit 7d519a2

Please sign in to comment.