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

Commit

Permalink
Take networkId parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed May 21, 2019
1 parent 10a639a commit bc0a386
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions 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,6 +130,7 @@ yargs // eslint-disable-line
.alias({
'accountId': ['account_id'],
'nodeUrl': 'node_url',
'networkId': ['network_id'],
'wasmFile': 'wasm_file',
'projectDir': 'project_dir',
'outDir': 'out_dir'
Expand Down
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 bc0a386

Please sign in to comment.