Skip to content

Commit

Permalink
remove if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjoshford committed Apr 14, 2021
1 parent 1c32cd9 commit 00a75da
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion commands/add-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion commands/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion commands/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('.');
Expand Down
2 changes: 1 addition & 1 deletion commands/delete-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion commands/evm-call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}()` +
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 00a75da

Please sign in to comment.