pontus-x_cli 1.2.5 → 1.2.7
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/README.md +107 -24
- package/dist/commands/compute.d.ts +3 -2
- package/dist/commands/compute.js +53 -42
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/edit-asset-allowed.d.ts +14 -0
- package/dist/commands/edit-asset-allowed.js +143 -0
- package/dist/commands/edit-asset-allowed.js.map +1 -0
- package/dist/commands/edit-trusted-algos.d.ts +1 -1
- package/dist/commands/edit-trusted-algos.js +36 -36
- package/dist/commands/edit-trusted-algos.js.map +1 -1
- package/dist/commands/generate-manifest.d.ts +11 -0
- package/dist/commands/generate-manifest.js +71 -0
- package/dist/commands/generate-manifest.js.map +1 -0
- package/dist/commands/generate-private-keys.d.ts +12 -0
- package/dist/commands/generate-private-keys.js +80 -0
- package/dist/commands/generate-private-keys.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +48 -48
- package/dist/config.js.map +1 -1
- package/dist/lib/aquarius.d.ts +2 -1
- package/dist/lib/aquarius.js +23 -26
- package/dist/lib/aquarius.js.map +1 -1
- package/dist/lib/spec.d.ts +3 -3
- package/dist/lib/spec.js +30 -39
- package/dist/lib/spec.js.map +1 -1
- package/dist/types/manifest-schema.json +11 -27
- package/dist/types/schema.json +22 -85
- package/dist/utils/asset.d.ts +4 -3
- package/dist/utils/asset.js +27 -21
- package/dist/utils/asset.js.map +1 -1
- package/dist/utils/login.d.ts +2 -2
- package/dist/utils/login.js +15 -13
- package/dist/utils/login.js.map +1 -1
- package/oclif.manifest.json +200 -1
- package/package.json +2 -1
|
@@ -7,46 +7,30 @@
|
|
|
7
7
|
"items": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"properties": {
|
|
10
|
-
"name": {
|
|
11
|
-
"type": "string"
|
|
12
|
-
},
|
|
13
10
|
"address": {
|
|
14
11
|
"type": "string"
|
|
15
12
|
},
|
|
16
|
-
"
|
|
13
|
+
"name": {
|
|
17
14
|
"type": "string"
|
|
18
15
|
},
|
|
19
16
|
"passwordEnvKey": {
|
|
20
17
|
"type": "string"
|
|
21
18
|
},
|
|
22
|
-
"
|
|
23
|
-
"type": "
|
|
24
|
-
"items": {
|
|
25
|
-
"type": "object",
|
|
26
|
-
"properties": {
|
|
27
|
-
"name": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"key": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"spec": {
|
|
34
|
-
"type": "string"
|
|
35
|
-
},
|
|
36
|
-
"did": {
|
|
37
|
-
"type": "string"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"required": ["spec"],
|
|
41
|
-
"additionalProperties": false
|
|
42
|
-
}
|
|
19
|
+
"privateKeyPath": {
|
|
20
|
+
"type": "string"
|
|
43
21
|
}
|
|
44
22
|
},
|
|
45
|
-
"required": [
|
|
23
|
+
"required": [
|
|
24
|
+
"address",
|
|
25
|
+
"passwordEnvKey",
|
|
26
|
+
"privateKeyPath"
|
|
27
|
+
],
|
|
46
28
|
"additionalProperties": false
|
|
47
29
|
}
|
|
48
30
|
}
|
|
49
31
|
},
|
|
50
|
-
"required": [
|
|
32
|
+
"required": [
|
|
33
|
+
"accounts"
|
|
34
|
+
],
|
|
51
35
|
"additionalProperties": false
|
|
52
36
|
}
|
package/dist/types/schema.json
CHANGED
|
@@ -2,95 +2,36 @@
|
|
|
2
2
|
"$ref": "#/definitions/PublishConfig",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"definitions": {
|
|
5
|
-
"ConsumerParameter": {
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"properties": {
|
|
8
|
-
"default": {
|
|
9
|
-
"description": "Field default value. For select types, string key of default option.",
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
"description": {
|
|
13
|
-
"description": "Field description.",
|
|
14
|
-
"type": "string"
|
|
15
|
-
},
|
|
16
|
-
"label": {
|
|
17
|
-
"description": "Displayed field label.",
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"name": {
|
|
21
|
-
"description": "Parameter name.",
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"options": {
|
|
25
|
-
"description": "For select types, a list of options.",
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"required": {
|
|
29
|
-
"description": "Defines if customer input for this field is mandatory.",
|
|
30
|
-
"type": "boolean"
|
|
31
|
-
},
|
|
32
|
-
"type": {
|
|
33
|
-
"description": "Field type.",
|
|
34
|
-
"enum": ["text", "number", "boolean", "select"],
|
|
35
|
-
"type": "string"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"required": [
|
|
39
|
-
"name",
|
|
40
|
-
"type",
|
|
41
|
-
"label",
|
|
42
|
-
"required",
|
|
43
|
-
"description",
|
|
44
|
-
"default"
|
|
45
|
-
],
|
|
46
|
-
"type": "object"
|
|
47
|
-
},
|
|
48
5
|
"ExtendedConsumerParameter": {
|
|
49
6
|
"additionalProperties": false,
|
|
50
7
|
"properties": {
|
|
51
8
|
"default": {
|
|
52
|
-
"description": "Field default value. For select types, string key of default option.",
|
|
53
9
|
"type": "string"
|
|
54
10
|
},
|
|
55
11
|
"description": {
|
|
56
|
-
"description": "Field description.",
|
|
57
12
|
"type": "string"
|
|
58
13
|
},
|
|
59
14
|
"label": {
|
|
60
|
-
"description": "Displayed field label.",
|
|
61
15
|
"type": "string"
|
|
62
16
|
},
|
|
63
17
|
"name": {
|
|
64
|
-
"description": "Parameter name.",
|
|
65
18
|
"type": "string"
|
|
66
19
|
},
|
|
67
20
|
"options": {
|
|
68
21
|
"items": {
|
|
69
|
-
"
|
|
70
|
-
"type": "string"
|
|
71
|
-
},
|
|
72
|
-
"type": "object"
|
|
22
|
+
"$ref": "#/definitions/Options"
|
|
73
23
|
},
|
|
74
24
|
"type": "array"
|
|
75
25
|
},
|
|
76
26
|
"required": {
|
|
77
|
-
"description": "Defines if customer input for this field is mandatory.",
|
|
78
27
|
"type": "boolean"
|
|
79
28
|
},
|
|
80
29
|
"type": {
|
|
81
|
-
"description": "Field type.",
|
|
82
30
|
"enum": ["text", "number", "boolean", "select"],
|
|
83
31
|
"type": "string"
|
|
84
32
|
}
|
|
85
33
|
},
|
|
86
|
-
"required": [
|
|
87
|
-
"default",
|
|
88
|
-
"description",
|
|
89
|
-
"label",
|
|
90
|
-
"name",
|
|
91
|
-
"required",
|
|
92
|
-
"type"
|
|
93
|
-
],
|
|
34
|
+
"required": ["name", "type", "label", "required", "description", "default"],
|
|
94
35
|
"type": "object"
|
|
95
36
|
},
|
|
96
37
|
"FileTypes": {
|
|
@@ -107,24 +48,21 @@
|
|
|
107
48
|
"additionalProperties": false,
|
|
108
49
|
"properties": {
|
|
109
50
|
"consumerParameters": {
|
|
110
|
-
"description": "Array of objects describing the consumer parameters",
|
|
111
51
|
"items": {
|
|
112
|
-
"$ref": "#/definitions/
|
|
52
|
+
"$ref": "#/definitions/ExtendedConsumerParameter"
|
|
113
53
|
},
|
|
114
54
|
"type": "array"
|
|
115
55
|
},
|
|
116
56
|
"container": {
|
|
117
57
|
"additionalProperties": false,
|
|
118
|
-
"description": "Object describing the Docker container image.",
|
|
119
58
|
"properties": {
|
|
120
59
|
"checksum": {
|
|
121
60
|
"description": "Checksum of the Docker image.",
|
|
122
61
|
"type": "string"
|
|
123
62
|
},
|
|
124
63
|
"consumerParameters": {
|
|
125
|
-
"description": "Array of objects describing the consumer parameters",
|
|
126
64
|
"items": {
|
|
127
|
-
"$ref": "#/definitions/
|
|
65
|
+
"$ref": "#/definitions/ExtendedConsumerParameter"
|
|
128
66
|
},
|
|
129
67
|
"type": "array"
|
|
130
68
|
},
|
|
@@ -141,7 +79,7 @@
|
|
|
141
79
|
"type": "string"
|
|
142
80
|
}
|
|
143
81
|
},
|
|
144
|
-
"required": ["
|
|
82
|
+
"required": ["checksum", "entrypoint", "image", "tag"],
|
|
145
83
|
"type": "object"
|
|
146
84
|
},
|
|
147
85
|
"language": {
|
|
@@ -241,13 +179,20 @@
|
|
|
241
179
|
"type": "boolean"
|
|
242
180
|
}
|
|
243
181
|
},
|
|
244
|
-
"required": [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
182
|
+
"required": ["name", "symbol", "templateIndex", "tokenURI", "transferable"],
|
|
183
|
+
"type": "object"
|
|
184
|
+
},
|
|
185
|
+
"Options": {
|
|
186
|
+
"additionalProperties": false,
|
|
187
|
+
"properties": {
|
|
188
|
+
"key": {
|
|
189
|
+
"type": "string"
|
|
190
|
+
},
|
|
191
|
+
"value": {
|
|
192
|
+
"type": "string"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"required": ["key", "value"],
|
|
251
196
|
"type": "object"
|
|
252
197
|
},
|
|
253
198
|
"PublishConfig": {
|
|
@@ -318,11 +263,11 @@
|
|
|
318
263
|
"type": "number"
|
|
319
264
|
},
|
|
320
265
|
"currency": {
|
|
321
|
-
"enum": ["
|
|
266
|
+
"enum": ["EURAU", "EUROe", "OCEAN"],
|
|
322
267
|
"type": "string"
|
|
323
268
|
},
|
|
324
269
|
"type": {
|
|
325
|
-
"enum": ["
|
|
270
|
+
"enum": ["fixed", "free"],
|
|
326
271
|
"type": "string"
|
|
327
272
|
}
|
|
328
273
|
},
|
|
@@ -339,15 +284,7 @@
|
|
|
339
284
|
"type": "number"
|
|
340
285
|
}
|
|
341
286
|
},
|
|
342
|
-
"required": [
|
|
343
|
-
"serviceType",
|
|
344
|
-
"fileType",
|
|
345
|
-
"serviceEndpoint",
|
|
346
|
-
"timeout",
|
|
347
|
-
"files",
|
|
348
|
-
"pricing",
|
|
349
|
-
"datatoken"
|
|
350
|
-
],
|
|
287
|
+
"required": ["datatoken", "files", "fileType", "pricing", "serviceEndpoint", "serviceType", "timeout"],
|
|
351
288
|
"type": "object"
|
|
352
289
|
},
|
|
353
290
|
"trustOwnerAlgorithms": {
|
package/dist/utils/asset.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AssetInfo } from
|
|
1
|
+
import { type AssetInfo } from '../lib/aquarius';
|
|
2
2
|
type Choice<Value> = {
|
|
3
3
|
value: Value;
|
|
4
4
|
name?: string;
|
|
@@ -15,11 +15,12 @@ interface PromptProps {
|
|
|
15
15
|
accessTypes?: string[];
|
|
16
16
|
owners?: string[];
|
|
17
17
|
tagSets?: string[][];
|
|
18
|
+
size?: number;
|
|
18
19
|
networkChoices?: Choice<number>[];
|
|
19
20
|
assetTypeChoices?: Choice<string>[];
|
|
20
21
|
accessTypeChoices?: Choice<string>[];
|
|
21
22
|
ownerChoices?: Choice<string>[];
|
|
22
|
-
promptType?:
|
|
23
|
+
promptType?: 'checkbox' | 'select';
|
|
23
24
|
}
|
|
24
|
-
export declare function PromptForAssets({ chainIds, assetTypes, accessTypes, owners, tagSets, networkChoices, assetTypeChoices, accessTypeChoices, ownerChoices, promptType, }?: PromptProps): Promise<AssetInfo[]>;
|
|
25
|
+
export declare function PromptForAssets({ chainIds, assetTypes, accessTypes, owners, tagSets, networkChoices, assetTypeChoices, accessTypeChoices, ownerChoices, size, promptType, }?: PromptProps): Promise<AssetInfo[]>;
|
|
25
26
|
export {};
|
package/dist/utils/asset.js
CHANGED
|
@@ -4,40 +4,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PromptForAssets = PromptForAssets;
|
|
7
|
+
const aquarius_1 = require("../lib/aquarius");
|
|
7
8
|
const prompts_1 = require("@inquirer/prompts");
|
|
8
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const aquarius_1 = require("../lib/aquarius");
|
|
10
10
|
const defaultChainIds = [
|
|
11
|
-
{ name:
|
|
12
|
-
{ name:
|
|
11
|
+
{ name: 'PONTUSXDEV', value: 32456 },
|
|
12
|
+
{ name: 'PONTUSXTEST', value: 32457 },
|
|
13
13
|
];
|
|
14
14
|
const defaultAssetTypes = [
|
|
15
|
-
{ name:
|
|
16
|
-
{ name:
|
|
15
|
+
{ name: 'Dataset', value: 'dataset' },
|
|
16
|
+
{ name: 'Algorithm', value: 'algorithm' },
|
|
17
17
|
];
|
|
18
18
|
const defaultAccessTypes = [
|
|
19
|
-
{ name:
|
|
20
|
-
{ name:
|
|
19
|
+
{ name: 'Download', value: 'access' },
|
|
20
|
+
{ name: 'Compute', value: 'compute' },
|
|
21
21
|
];
|
|
22
|
-
async function PromptForAssets({ chainIds, assetTypes, accessTypes, owners, tagSets, networkChoices = defaultChainIds, assetTypeChoices = defaultAssetTypes, accessTypeChoices = defaultAccessTypes, ownerChoices = [], promptType =
|
|
22
|
+
async function PromptForAssets({ chainIds, assetTypes, accessTypes, owners, tagSets, networkChoices = defaultChainIds, assetTypeChoices = defaultAssetTypes, accessTypeChoices = defaultAccessTypes, ownerChoices = [], size, promptType = 'checkbox', } = {}) {
|
|
23
23
|
const selectedChainIds = chainIds ||
|
|
24
24
|
(await (0, prompts_1.checkbox)({
|
|
25
|
-
message:
|
|
25
|
+
message: 'Select networks:',
|
|
26
26
|
choices: networkChoices,
|
|
27
27
|
}));
|
|
28
28
|
const selectedAssetTypes = assetTypes ||
|
|
29
29
|
(await (0, prompts_1.checkbox)({
|
|
30
|
-
message:
|
|
30
|
+
message: 'Select asset types:',
|
|
31
31
|
choices: assetTypeChoices,
|
|
32
32
|
}));
|
|
33
33
|
const selectedAccessTypes = accessTypes ||
|
|
34
34
|
(await (0, prompts_1.checkbox)({
|
|
35
|
-
message:
|
|
35
|
+
message: 'Select access types:',
|
|
36
36
|
choices: accessTypeChoices,
|
|
37
37
|
}));
|
|
38
38
|
const selectedOwners = owners || ownerChoices.length > 0
|
|
39
39
|
? await (0, prompts_1.checkbox)({
|
|
40
|
-
message:
|
|
40
|
+
message: 'Select owners:',
|
|
41
41
|
choices: ownerChoices,
|
|
42
42
|
})
|
|
43
43
|
: undefined;
|
|
@@ -46,52 +46,58 @@ async function PromptForAssets({ chainIds, assetTypes, accessTypes, owners, tagS
|
|
|
46
46
|
const tagSets = [];
|
|
47
47
|
while (true) {
|
|
48
48
|
const tagSet = await (0, prompts_1.input)({
|
|
49
|
-
message:
|
|
49
|
+
message: 'Enter a tag set (comma-separated), or leave blank to finish:',
|
|
50
50
|
});
|
|
51
51
|
if (!tagSet) {
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
|
-
tagSets.push(tagSet.split(
|
|
54
|
+
tagSets.push(tagSet.split(',').map(tag => tag.trim()));
|
|
55
55
|
}
|
|
56
56
|
return tagSets;
|
|
57
57
|
})());
|
|
58
|
+
const querySize = size ||
|
|
59
|
+
Number(await (0, prompts_1.input)({
|
|
60
|
+
message: 'Query max. assets:',
|
|
61
|
+
default: '100',
|
|
62
|
+
}));
|
|
58
63
|
const assets = await (0, aquarius_1.searchAssets)({
|
|
59
64
|
chainIds: selectedChainIds,
|
|
60
65
|
assetTypes: selectedAssetTypes,
|
|
61
66
|
accessTypes: selectedAccessTypes,
|
|
62
67
|
tagSets: selectedTagSets,
|
|
63
68
|
owners: selectedOwners,
|
|
69
|
+
size: querySize,
|
|
64
70
|
});
|
|
65
71
|
const sortedAssets = assets.sort((a, b) => b.created.localeCompare(a.created));
|
|
66
72
|
const assetChoices = [];
|
|
67
73
|
for (const [index, asset] of sortedAssets.entries()) {
|
|
68
74
|
const ownerName = await (0, aquarius_1.getOwnerName)(asset.owner);
|
|
69
75
|
assetChoices.push({
|
|
70
|
-
name: `${(index + 1).toString().padStart(2,
|
|
76
|
+
name: `${(index + 1).toString().padStart(2, '0')}. ${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split('T')[0])} | ${chalk_1.default.yellow(ownerName)} | ${chalk_1.default.magenta(asset.name)}`,
|
|
71
77
|
value: asset,
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
if (assetChoices.length === 0) {
|
|
75
|
-
console.log(chalk_1.default.red(
|
|
81
|
+
console.log(chalk_1.default.red('No assets found matching the criteria.'));
|
|
76
82
|
return [];
|
|
77
83
|
}
|
|
78
|
-
if (promptType ===
|
|
84
|
+
if (promptType === 'checkbox') {
|
|
79
85
|
return await (0, prompts_1.checkbox)({
|
|
80
|
-
message:
|
|
86
|
+
message: 'Select assets to edit:',
|
|
81
87
|
choices: assetChoices,
|
|
82
88
|
loop: false,
|
|
83
89
|
pageSize: 10,
|
|
84
90
|
theme: {
|
|
85
91
|
style: {
|
|
86
|
-
answer: (text) => `\n ${text.split(
|
|
92
|
+
answer: (text) => `\n ${text.split(',').join('\n')}\n`,
|
|
87
93
|
},
|
|
88
94
|
},
|
|
89
95
|
});
|
|
90
96
|
}
|
|
91
|
-
if (promptType ===
|
|
97
|
+
if (promptType === 'select') {
|
|
92
98
|
return [
|
|
93
99
|
await (0, prompts_1.select)({
|
|
94
|
-
message:
|
|
100
|
+
message: 'Select an asset to edit:',
|
|
95
101
|
choices: assetChoices,
|
|
96
102
|
loop: false,
|
|
97
103
|
pageSize: 10,
|
package/dist/utils/asset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../src/utils/asset.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../src/utils/asset.ts"],"names":[],"mappings":";;;;;AA+CA,0CA8HC;AA7KD,6CAA2E;AAC3E,+CAA2D;AAC3D,kDAAyB;AAazB,MAAM,eAAe,GAAG;IACtB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAM,EAAE;IACrC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAM,EAAE;CACnB,CAAA;AAErB,MAAM,iBAAiB,GAAG;IACxB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACrC,EAAE,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H,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC"}
|
package/dist/utils/login.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Network } from
|
|
2
|
-
import type { Manifest } from
|
|
1
|
+
import { type Network } from '../config';
|
|
2
|
+
import type { Manifest } from '../types/manifest';
|
|
3
3
|
export interface LoginInfo {
|
|
4
4
|
privateKey: string;
|
|
5
5
|
ownerAddress: string;
|
package/dist/utils/login.js
CHANGED
|
@@ -10,15 +10,15 @@ exports.printLoginInfos = printLoginInfos;
|
|
|
10
10
|
exports.getLoginInfos = getLoginInfos;
|
|
11
11
|
exports.askForNetwork = askForNetwork;
|
|
12
12
|
exports.getEnvNetwork = getEnvNetwork;
|
|
13
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
14
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
15
13
|
const config_1 = require("../config");
|
|
16
14
|
const aquarius_1 = require("../lib/aquarius");
|
|
17
15
|
const manifest_1 = require("../lib/manifest");
|
|
18
16
|
const wallet_1 = require("../lib/wallet");
|
|
17
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
19
|
function getPrivateKeyForOwner(loginInfos, ownerAddress) {
|
|
20
20
|
const address = ownerAddress.toLowerCase();
|
|
21
|
-
const loginInfo = loginInfos.find(
|
|
21
|
+
const loginInfo = loginInfos.find(info => info.ownerAddress.toLowerCase() === address);
|
|
22
22
|
if (!loginInfo) {
|
|
23
23
|
throw new Error(`No login info found for address ${ownerAddress}`);
|
|
24
24
|
}
|
|
@@ -27,7 +27,7 @@ function getPrivateKeyForOwner(loginInfos, ownerAddress) {
|
|
|
27
27
|
async function manifestToLoginInfos(manifest) {
|
|
28
28
|
return Promise.all(manifest.accounts.map(async (account) => {
|
|
29
29
|
try {
|
|
30
|
-
const password = process.env[account.passwordEnvKey ||
|
|
30
|
+
const password = process.env[account.passwordEnvKey || ''] || '';
|
|
31
31
|
const privateKey = await (0, wallet_1.readPrivateKey)(account.privateKeyPath, password);
|
|
32
32
|
const ownerAddress = await (0, wallet_1.getOwnerAddress)(privateKey);
|
|
33
33
|
const ownerName = await (0, aquarius_1.getOwnerName)(ownerAddress);
|
|
@@ -43,8 +43,8 @@ async function manifestToLoginInfos(manifest) {
|
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
45
|
async function getEnvLoginInfo() {
|
|
46
|
-
const privateKey = process.env.PRIVATE_KEY ||
|
|
47
|
-
if (privateKey ===
|
|
46
|
+
const privateKey = process.env.PRIVATE_KEY || '';
|
|
47
|
+
if (privateKey === '') {
|
|
48
48
|
throw new Error(`You are not logged in. Please login using "pontus-x_cli login" or set the PRIVATE_KEY environment variable.`);
|
|
49
49
|
}
|
|
50
50
|
const ownerAddress = await (0, wallet_1.getOwnerAddress)(privateKey);
|
|
@@ -57,7 +57,7 @@ async function getEnvLoginInfo() {
|
|
|
57
57
|
}
|
|
58
58
|
function printLoginInfos(loginInfos) {
|
|
59
59
|
loginInfos.forEach((loginInfo, index) => {
|
|
60
|
-
console.log(chalk_1.default.bold(`Account ${(index + 1).toString().padStart(2,
|
|
60
|
+
console.log(chalk_1.default.bold(`Account ${(index + 1).toString().padStart(2, '0')}: ${chalk_1.default.gray(loginInfo.ownerAddress)} ${chalk_1.default.magenta(loginInfo.ownerName)}`));
|
|
61
61
|
});
|
|
62
62
|
console.log();
|
|
63
63
|
}
|
|
@@ -66,18 +66,20 @@ async function getLoginInfos(manifestPath) {
|
|
|
66
66
|
if (manifestPath) {
|
|
67
67
|
console.log(chalk_1.default.green(`Using manifest file for authentication ${chalk_1.default.gray(`(path: ${manifestPath})\n`)}`));
|
|
68
68
|
const manifest = (0, manifest_1.readManifest)(manifestPath);
|
|
69
|
-
loginInfos = await manifestToLoginInfos(manifest)
|
|
69
|
+
loginInfos = (await manifestToLoginInfos(manifest))
|
|
70
|
+
.filter(info => info.ownerName !== '-')
|
|
71
|
+
.sort((a, b) => a.ownerName.localeCompare(b.ownerName));
|
|
70
72
|
}
|
|
71
73
|
else {
|
|
72
|
-
console.log(chalk_1.default.green(`Using environment variables for authentication ${chalk_1.default.gray(
|
|
74
|
+
console.log(chalk_1.default.green(`Using environment variables for authentication ${chalk_1.default.gray('(env: PRIVATE_KEY)')}\n`));
|
|
73
75
|
loginInfos = [await getEnvLoginInfo()];
|
|
74
76
|
}
|
|
75
77
|
return loginInfos;
|
|
76
78
|
}
|
|
77
79
|
async function askForNetwork() {
|
|
78
80
|
const network = await (0, prompts_1.select)({
|
|
79
|
-
message:
|
|
80
|
-
choices: Object.keys(config_1.NETWORK_CONFIGS).map(
|
|
81
|
+
message: 'Select network:',
|
|
82
|
+
choices: Object.keys(config_1.NETWORK_CONFIGS).map(network => ({
|
|
81
83
|
name: network,
|
|
82
84
|
value: network,
|
|
83
85
|
})),
|
|
@@ -90,9 +92,9 @@ function getEnvNetwork() {
|
|
|
90
92
|
if (!envNetwork) {
|
|
91
93
|
return null;
|
|
92
94
|
}
|
|
93
|
-
const network = Object.keys(config_1.NETWORK_CONFIGS).find(
|
|
95
|
+
const network = Object.keys(config_1.NETWORK_CONFIGS).find(network => network === envNetwork);
|
|
94
96
|
if (!network) {
|
|
95
|
-
throw new Error(`Invalid NETWORK environment variable value "${envNetwork}". Please set it to one of: ${Object.keys(config_1.NETWORK_CONFIGS).join(
|
|
97
|
+
throw new Error(`Invalid NETWORK environment variable value "${envNetwork}". Please set it to one of: ${Object.keys(config_1.NETWORK_CONFIGS).join(', ')}`);
|
|
96
98
|
}
|
|
97
99
|
return network;
|
|
98
100
|
}
|
package/dist/utils/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/utils/login.ts"],"names":[],"mappings":";;;;;AAcA,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/utils/login.ts"],"names":[],"mappings":";;;;;AAcA,sDASC;AAED,oDAuBC;AAED,0CAiBC;A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