Skip to content

Commit

Permalink
Merge pull request #42 from nearprotocol/network-id
Browse files Browse the repository at this point in the history
 Take networkId parameter
  • Loading branch information
janedegtiareva authored May 21, 2019
2 parents 056437e + bc0a386 commit 3c0cf47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion bin/near
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ yargs // eslint-disable-line
type: 'string',
default: 'http://localhost:3030'
})
.option('networkId', {
desc: 'NEAR network ID, allows using different keys based on network',
type: 'string',
default: 'default'
})
.option('helperUrl', {
desc: 'NEAR contract helper URL',
type: 'string',
Expand All @@ -125,12 +130,12 @@ yargs // eslint-disable-line
.alias({
'accountId': ['account_id'],
'nodeUrl': 'node_url',
'networkId': ['network_id'],
'wasmFile': 'wasm_file',
'projectDir': 'project_dir',
'outDir': 'out_dir'
})
.showHelpOnFail(true)
.demandCommand(1, 'Please enter a command')
.strict()
.argv;

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ exports.createDevAccount = async function(options) {

await neardev.connect(options);
await options.deps.createAccount(options.accountId, keyPair.getPublicKey());
const keyStore = new UnencryptedFileSystemKeyStore();
const keyStore = new UnencryptedFileSystemKeyStore('./', options.networkId);
keyStore.setKey(options.accountId, keyPair);
console.log("Create account complete.");
};

async function connect(options) {
const keyStore = new UnencryptedFileSystemKeyStore();
const keyStore = new UnencryptedFileSystemKeyStore('./', options.networkId);
if (!options.accountId) {
// see if we only have one account in keystore and just use that.
const accountIds = await keyStore.getAccountIds();
Expand Down

0 comments on commit 3c0cf47

Please sign in to comment.