diff --git a/bin/near b/bin/near index a6ed452c..1f966eab 100755 --- a/bin/near +++ b/bin/near @@ -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', @@ -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; diff --git a/index.js b/index.js index 8b609f23..26b976f8 100755 --- a/index.js +++ b/index.js @@ -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();