From 00a75da9d337254a6b934d4fd2b1261436ff8b13 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 13 Apr 2021 19:17:41 -0700 Subject: [PATCH] remove if statement --- commands/add-key.js | 2 +- commands/call.js | 2 +- commands/create-account.js | 2 +- commands/delete-key.js | 2 +- commands/evm-call.js | 2 +- index.js | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commands/add-key.js b/commands/add-key.js index d5a25f6b..70221b34 100644 --- a/commands/add-key.js +++ b/commands/add-key.js @@ -32,7 +32,7 @@ module.exports = { }; async function addAccessKey(options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log(`Adding ${options.contractId ? 'function call access' : 'full access'} key = ${options.accessKey} to ${options.accountId}.`); const near = await connect(options); const account = await near.account(options.accountId); diff --git a/commands/call.js b/commands/call.js index 69ab97f7..a7de4216 100644 --- a/commands/call.js +++ b/commands/call.js @@ -37,7 +37,7 @@ module.exports = { }; async function scheduleFunctionCall(options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log(`Scheduling a call: ${options.contractName}.${options.methodName}(${options.args || ''})` + (options.amount && options.amount != '0' ? ` with attached ${options.amount} NEAR` : '')); const near = await connect(options); diff --git a/commands/create-account.js b/commands/create-account.js index 35862b14..2853f163 100644 --- a/commands/create-account.js +++ b/commands/create-account.js @@ -73,7 +73,7 @@ const createAccountCommandDeprecated = { }; async function createAccount(options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.masterAccount, options.networkId, options.keyStore); + await checkCredentials(options.masterAccount, options.networkId, options.keyStore); // NOTE: initialBalance is passed as part of config here, parsed in middleware/initial-balance // periods are disallowed in top-level accounts and can only be used for subaccounts const splitAccount = options.accountId.split('.'); diff --git a/commands/delete-key.js b/commands/delete-key.js index 50adb76d..eaee76ce 100644 --- a/commands/delete-key.js +++ b/commands/delete-key.js @@ -16,7 +16,7 @@ module.exports = { }; async function deleteAccessKey(options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log(`Deleting key = ${options.accessKey} on ${options.accountId}.`); const near = await connect(options); const account = await near.account(options.accountId); diff --git a/commands/evm-call.js b/commands/evm-call.js index 5b67e2c1..d9f3b7ed 100644 --- a/commands/evm-call.js +++ b/commands/evm-call.js @@ -37,7 +37,7 @@ module.exports = { }; async function scheduleEVMFunctionCall(options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); const args = JSON.parse(options.args || '[]'); console.log(`Scheduling a call inside ${options.evmAccount} EVM:`); console.log(`${options.contractName}.${options.methodName}()` + diff --git a/index.js b/index.js index 9a9c3712..ce329e2e 100644 --- a/index.js +++ b/index.js @@ -31,7 +31,7 @@ exports.clean = async function () { }; exports.deploy = async function (options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log( `Starting deployment. Account id: ${options.accountId}, node: ${options.nodeUrl}, helper: ${options.helperUrl}, file: ${options.wasmFile}`); @@ -190,7 +190,7 @@ exports.viewAccount = async function (options) { }; exports.deleteAccount = async function (options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log( `Deleting account. Account id: ${options.accountId}, node: ${options.nodeUrl}, helper: ${options.helperUrl}, beneficiary: ${options.beneficiaryId}`); const near = await connect(options); @@ -209,7 +209,7 @@ exports.keys = async function (options) { }; exports.sendMoney = async function (options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.sender, options.networkId, options.keyStore); + await checkCredentials(options.sender, options.networkId, options.keyStore); console.log(`Sending ${options.amount} NEAR to ${options.receiver} from ${options.sender}`); const near = await connect(options); const account = await near.account(options.sender); @@ -218,7 +218,7 @@ exports.sendMoney = async function (options) { }; exports.stake = async function (options) { - if(options.networkId === 'default' | 'testnet') await checkCredentials(options.accountId, options.networkId, options.keyStore); + await checkCredentials(options.accountId, options.networkId, options.keyStore); console.log(`Staking ${options.amount} (${utils.format.parseNearAmount(options.amount)}) on ${options.accountId} with public key = ${qs.unescape(options.stakingKey)}.`); const near = await connect(options); const account = await near.account(options.accountId);