Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
add evm-dev-init command
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedotexe authored and Mike Purvis committed Dec 11, 2020
1 parent 171dcf3 commit 74ec085
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/near-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ yargs // eslint-disable-line
.command(require('../commands/validators'))
.command(require('../commands/proposals'))
.command(require('../commands/evm-call'))
.command(require('../commands/evm-dev-init'))
.command(require('../commands/evm-view'))
.config(config)
.alias({
Expand Down
26 changes: 26 additions & 0 deletions commands/evm-dev-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const exitOnError = require('../utils/exit-on-error');
const { utils } = require('near-web3-provider');
const connect = require('../utils/connect');

module.exports = {
command: 'evm-dev-init <accountId> [numAccounts]',
desc: 'Creates test accounts using NEAR Web3 Provider',
builder: (yargs) => yargs
.option('accountId', {
desc: 'NEAR account creating the test subaccounts',
type: 'string',
default: '0'
})
.option('numAccounts', {
desc: 'Number of test accounts to create',
type: 'number',
default: '5'
}),
handler: exitOnError(scheduleEVMDevInit)
};

async function scheduleEVMDevInit(options) {
const near = await connect(options);
const account = await near.account(options.accountId);
await utils.createTestAccounts(account, options.numAccounts);
}

0 comments on commit 74ec085

Please sign in to comment.