@airmoney-degn/airmoney-cli 0.10.10 → 0.11.1
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/dist/cli/wallet.js +22 -3
- package/dist/config.json +3 -0
- package/dist/index.js +2 -1
- package/dist/util/server.js +4 -4
- package/package.json +12 -5
package/dist/cli/wallet.js
CHANGED
|
@@ -68,7 +68,26 @@ async function listWallet(chainName) {
|
|
|
68
68
|
}
|
|
69
69
|
const files = (0, fs_1.readdirSync)(walletPath)
|
|
70
70
|
.map(file => file.split('.json')[0])
|
|
71
|
-
.
|
|
71
|
+
.reduce((acc, address) => {
|
|
72
|
+
if (address === 'default') {
|
|
73
|
+
const defaultAddress = (0, fs_1.readFileSync)(path_1.default.join(walletPath, 'default'), 'utf8');
|
|
74
|
+
const existingDefaultItem = acc.find(item => item.address === defaultAddress);
|
|
75
|
+
if (existingDefaultItem) {
|
|
76
|
+
existingDefaultItem.default = true;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
acc.push({ address: defaultAddress, default: true });
|
|
80
|
+
}
|
|
81
|
+
return acc;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
acc.push({ address, default: false });
|
|
85
|
+
}
|
|
86
|
+
return acc;
|
|
87
|
+
}, [])
|
|
88
|
+
.forEach(item => {
|
|
89
|
+
console.log(`${item.address} ${item.default ? '(default)' : ''}`);
|
|
90
|
+
});
|
|
72
91
|
return files;
|
|
73
92
|
}
|
|
74
93
|
async function importWalletSk(PrivateKey, chainName) {
|
|
@@ -108,7 +127,7 @@ async function importSvmWallet(privateKey) {
|
|
|
108
127
|
const walletPath = path_1.default.join(config, 'wallet', 'svm');
|
|
109
128
|
if (!(0, fs_1.existsSync)(walletPath)) {
|
|
110
129
|
(0, fs_1.mkdirSync)(walletPath, {
|
|
111
|
-
recursive: true
|
|
130
|
+
recursive: true,
|
|
112
131
|
});
|
|
113
132
|
}
|
|
114
133
|
const bytes = bs58.decode(privateKey);
|
|
@@ -123,7 +142,7 @@ async function exportWalletSk(address, chainName) {
|
|
|
123
142
|
const walletPath = path_1.default.join(config, 'wallet', chainName);
|
|
124
143
|
if (!(0, fs_1.existsSync)(walletPath)) {
|
|
125
144
|
(0, fs_1.mkdirSync)(walletPath, {
|
|
126
|
-
recursive: true
|
|
145
|
+
recursive: true,
|
|
127
146
|
});
|
|
128
147
|
}
|
|
129
148
|
let walletFile;
|
package/dist/config.json
ADDED
package/dist/index.js
CHANGED
|
@@ -8,13 +8,14 @@ const serve_1 = require("./cli/serve");
|
|
|
8
8
|
const upload_1 = require("./cli/upload");
|
|
9
9
|
const setup_1 = require("./cli/setup");
|
|
10
10
|
const wallet_1 = require("./cli/wallet");
|
|
11
|
+
const config_json_1 = require("./config.json");
|
|
11
12
|
// Load environment from config
|
|
12
13
|
(0, env_1.loadEnvFromConfig)();
|
|
13
14
|
const program = new commander_1.Command();
|
|
14
15
|
program
|
|
15
16
|
.name('airmoney-cli')
|
|
16
17
|
.description('airmoney-cli is a command-line interface tool designed to facilitate the development and management of decentralized applications (DApps) for Airmoney.')
|
|
17
|
-
.version(
|
|
18
|
+
.version(config_json_1.version);
|
|
18
19
|
program
|
|
19
20
|
.command('setup')
|
|
20
21
|
.description('Setup env with userAddress, apiKey, rpc')
|
package/dist/util/server.js
CHANGED
|
@@ -63,12 +63,12 @@ function displayImage(request, appName) {
|
|
|
63
63
|
}
|
|
64
64
|
const event = {
|
|
65
65
|
source: 'air-money',
|
|
66
|
-
type:
|
|
67
|
-
subType:
|
|
66
|
+
type: 'service',
|
|
67
|
+
subType: 'setImage',
|
|
68
68
|
data: {
|
|
69
69
|
id: request.params[1],
|
|
70
|
-
imageName: `data:${mime};base64,${file}
|
|
71
|
-
}
|
|
70
|
+
imageName: `data:${mime};base64,${file}`,
|
|
71
|
+
},
|
|
72
72
|
};
|
|
73
73
|
return event;
|
|
74
74
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airmoney-degn/airmoney-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "airmoney-cli is a command-line interface tool designed to facilitate the development and management of decentralized applications (DApps) for Airmoney.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"format": "prettier --write \"src/**/*\"",
|
|
13
|
-
"start": "npm run build && node dist/index.js",
|
|
14
|
-
"build": "rm -rf dist && tsc && cp -r bin/ dist/bin/ && chmod -R +x dist",
|
|
15
|
-
"release": "npm run build && npm publish"
|
|
13
|
+
"start": "npm run update-version &&npm run build && node dist/index.js",
|
|
14
|
+
"build": "npm run update-version && rm -rf dist && tsc && cp -r bin/ dist/bin/ && chmod -R +x dist",
|
|
15
|
+
"release": "npm run build && npm publish",
|
|
16
|
+
"version": "changeset version",
|
|
17
|
+
"changeset": "changeset",
|
|
18
|
+
"update-version": "node scripts/update-version.js"
|
|
16
19
|
},
|
|
17
20
|
"keywords": [
|
|
18
21
|
"CLI"
|
|
@@ -48,6 +51,7 @@
|
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@airmoney-degn/controller-sdk": "^5.4.1",
|
|
54
|
+
"@changesets/cli": "^2.29.7",
|
|
51
55
|
"@types/bs58": "5.0.0",
|
|
52
56
|
"@types/cors": "^2.8.17",
|
|
53
57
|
"@types/express": "^5.0.0",
|
|
@@ -62,5 +66,8 @@
|
|
|
62
66
|
"prettier": "^3.6.1",
|
|
63
67
|
"typescript": "^5.0.4"
|
|
64
68
|
},
|
|
65
|
-
"packageManager": "npm@>=10.9.3 <11"
|
|
69
|
+
"packageManager": "npm@>=10.9.3 <11",
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=22.19.0 <23"
|
|
72
|
+
}
|
|
66
73
|
}
|