soluser 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +13 -0
- package/package.json +1 -1
- package/src/commands/keyfile.js +15 -0
package/bin/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const removeAccount = require('../src/commands/remove');
|
|
|
8
8
|
const { showExamples } = require('../src/utils/example');
|
|
9
9
|
const pruneAccount = require('../src/commands/prune');
|
|
10
10
|
const clear = require('../src/commands/clear');
|
|
11
|
+
// 导入 keyfile 命令
|
|
12
|
+
const showKeyfilePath = require('../src/commands/keyfile');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
// 导入地址查询命令
|
|
@@ -77,6 +79,17 @@ program
|
|
|
77
79
|
);
|
|
78
80
|
});
|
|
79
81
|
|
|
82
|
+
// ...
|
|
83
|
+
|
|
84
|
+
// 定义 keyfile 命令
|
|
85
|
+
program
|
|
86
|
+
.command('keyfile')
|
|
87
|
+
.alias('k')
|
|
88
|
+
.description('Output the keyfile path of the current Solana account')
|
|
89
|
+
.action(() => {
|
|
90
|
+
showKeyfilePath();
|
|
91
|
+
});
|
|
92
|
+
|
|
80
93
|
|
|
81
94
|
// 定义切换账号命令(修改后)
|
|
82
95
|
program
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
const { execCommand } = require('../utils/solana');
|
|
3
|
+
function getKeyFilePath() {
|
|
4
|
+
const keyfile = execCommand('solana config get keypair');
|
|
5
|
+
if(keyfile && keyfile.includes('Key Path') && keyfile.includes(":")){
|
|
6
|
+
return keyfile.split(":")[1].trim();
|
|
7
|
+
}
|
|
8
|
+
throw new Error('Error: Keypair path not found in config , failed to parse' + keyfile) ;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function showKeyfilePath() {
|
|
12
|
+
console.log(getKeyFilePath());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = showKeyfilePath;
|