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

Commit

Permalink
Add view_account <accountId> command
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Jun 7, 2019
1 parent baf598a commit bf53541
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/near
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ const callViewFunction = {
handler: (argv) => exitOnError(main.callViewFunction(argv))
};

const viewAccount = {
command: 'view_account <accountId>',
desc: 'view given account/contract state',
builder: (yargs) => yargs,
handler: (argv) => exitOnError(main.viewAccount(argv))
};

const sendTokens = {
command: 'send <receiver> <amount>',
desc: 'send tokens to given receiver',
Expand Down Expand Up @@ -136,6 +143,7 @@ yargs // eslint-disable-line
.command(deploy)
.command(scheduleFunctionCall)
.command(callViewFunction)
.command(viewAccount)
.command(sendTokens)
.command(clean)
.command(newProject)
Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,11 @@ exports.callViewFunction = async function(options) {
console.log(`View call: ${options.contractName}.${options.methodName}(${options.args || ''})`);
const near = await connect(options);
console.log('Result:', await near.callViewFunction(options.contractName, options.methodName, JSON.parse(options.args || '{}')));
};

exports.viewAccount = async function(options) {
const { accountId } = options;
console.log(`View account: ${accountId}`);
const near = await connect(options);
console.log('Result:', await near.nearClient.viewAccount(accountId));
};

0 comments on commit bf53541

Please sign in to comment.