Skip to content

Commit 4baa831

Browse files
authored
Merge pull request #95 from AElfProject/feature/send
feat: password required
2 parents 914eaa2 + c270772 commit 4baa831

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aelf-command",
3-
"version": "0.1.51-beta.0",
3+
"version": "0.1.51-beta.1",
44
"description": "A CLI tools for AElf",
55
"main": "src/index.js",
66
"type": "module",

src/command/call.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import AElf from 'aelf-sdk';
22
import inquirer from 'inquirer';
33
import chalk from 'chalk';
44
import BaseSubCommand from './baseSubCommand.js';
5-
import { callCommandUsages, callCommandParameters, callGlobalOptionValidatorDesc } from '../utils/constants.js';
5+
import { callCommandUsages, callCommandParameters, commonGlobalOptionValidatorDesc } from '../utils/constants.js';
66
import {
77
getContractMethods,
88
getContractInstance,
@@ -38,7 +38,7 @@ class CallCommand extends BaseSubCommand {
3838
parameters = callCommandParameters,
3939
usage = callCommandUsages,
4040
options = [],
41-
validatorDesc = callGlobalOptionValidatorDesc
41+
validatorDesc = commonGlobalOptionValidatorDesc
4242
) {
4343
super(name, parameters, description, options, usage, rc, validatorDesc);
4444
}

src/command/send.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { callCommandParameters, callCommandUsages, strictGlobalOptionValidatorDesc } from '../utils/constants.js';
12
import CallCommand from './call.js';
23

34
/**
@@ -9,7 +10,15 @@ class SendCommand extends CallCommand {
910
* @param {Registry} rc - The registry instance.
1011
*/
1112
constructor(rc) {
12-
super(rc, 'send', 'Execute a method on a contract.');
13+
super(
14+
rc,
15+
'send',
16+
'Execute a method on a contract.',
17+
callCommandParameters,
18+
callCommandUsages,
19+
[],
20+
strictGlobalOptionValidatorDesc
21+
);
1322
}
1423

1524
/**

src/utils/constants.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,21 +381,12 @@ const commonGlobalOptionValidatorDesc = {
381381

382382
const strictGlobalOptionValidatorDesc = /**@type {CommonGlobalOptionValidatorDesc}*/ ({});
383383

384-
// @ts-ignore
385-
Object.entries(commonGlobalOptionValidatorDesc).forEach((/** @type {[CommonGlobalOptionKey, any]} */ [key, value]) => {
386-
strictGlobalOptionValidatorDesc[key] = {
387-
...value
388-
// required: true
389-
};
390-
});
391-
392-
const callGlobalOptionValidatorDesc = /**@type {CommonGlobalOptionValidatorDesc}*/ ({});
393384
// @ts-ignore
394385
Object.entries(commonGlobalOptionValidatorDesc).forEach((/** @type {[CommonGlobalOptionKey, any]} */ [key, value]) => {
395386
if (key === 'account' || key === 'password') {
396387
strictGlobalOptionValidatorDesc[key] = {
397388
...value,
398-
required: false
389+
required: true
399390
};
400391
} else {
401392
strictGlobalOptionValidatorDesc[key] = {
@@ -464,7 +455,6 @@ export {
464455
callCommandParameters,
465456
commonGlobalOptionValidatorDesc,
466457
strictGlobalOptionValidatorDesc,
467-
callGlobalOptionValidatorDesc,
468458
blkInfoCommandParameters,
469459
blkInfoCommandUsage,
470460
txResultCommandParameters,

0 commit comments

Comments
 (0)