8000 Add view_account <accountId> command by vgrichina · Pull Request #53 · near/near-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Add view_account <accountId> command #53

Merged
merged 1 commit into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
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 D2D7 (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