From ac854a48372eb305fd83d151842f323024762c7f Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Tue, 15 Sep 2020 14:52:53 -0700 Subject: [PATCH] Undo add-key branch here --- bin/near-cli.js | 1 - commands/add-key.js | 43 ------------------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 commands/add-key.js diff --git a/bin/near-cli.js b/bin/near-cli.js index 33b01c22..c343c471 100644 --- a/bin/near-cli.js +++ b/bin/near-cli.js @@ -228,7 +228,6 @@ yargs // eslint-disable-line .command(login) .command(require('../commands/repl')) .command(require('../commands/generate-key')) - .command(require('../commands/add-key')) .command(require('../commands/delete-key')) .command(require('../commands/validators')) .command(require('../commands/proposals')) diff --git a/commands/add-key.js b/commands/add-key.js deleted file mode 100644 index c92bde50..00000000 --- a/commands/add-key.js +++ /dev/null @@ -1,43 +0,0 @@ -const exitOnError = require('../utils/exit-on-error'); -const connect = require('../utils/connect'); -const inspectResponse = require('../utils/inspect-response'); -const { utils } = require('near-api-js'); - -module.exports = { - command: 'add-key [access-key]', - desc: 'Add an access key to given account', - builder: (yargs) => yargs - .option('access-key', { - desc: 'Public key to add (base58 encoded)', - type: 'string', - required: true, - }) - .option('contract-id', { - desc: 'Limit access key to given contract (if not provided - will create full access key)', - type: 'string', - required: false, - }) - .option('method-names', { - desc: 'Method names to limit access key to (command separated)', - type: 'string', - required: false, - }) - .option('allowance', { - desc: 'Allowance in $NEAR for the key (default 0)', - type: 'string', - required: false, - }), - handler: exitOnError(addAccessKey) -}; - -async function addAccessKey(options) { - if (!options.accountId) { - return; - } - 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); - const allowance = utils.format.parseNearAmount(options.allowance); - const result = await account.addKey(options.accessKey, options.contractId, options.methodNames, allowance); - inspectResponse.prettyPrintResponse(result, options); -}