pontus-x_cli 1.2.7 → 2.0.0
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 +131 -43
- package/dist/commands/access.js +17 -2
- package/dist/commands/access.js.map +1 -1
- package/dist/commands/change-currency.d.ts +13 -0
- package/dist/commands/change-currency.js +69 -0
- package/dist/commands/change-currency.js.map +1 -0
- package/dist/commands/change-price.js +7 -5
- package/dist/commands/change-price.js.map +1 -1
- package/dist/commands/compute-results.d.ts +1 -1
- package/dist/commands/compute-results.js +5 -6
- package/dist/commands/compute-results.js.map +1 -1
- package/dist/commands/compute-status.d.ts +1 -1
- package/dist/commands/compute-status.js +12 -8
- package/dist/commands/compute-status.js.map +1 -1
- package/dist/commands/compute.d.ts +3 -3
- package/dist/commands/compute.js +70 -52
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/edit-additional-metadata.d.ts +1 -1
- package/dist/commands/edit-additional-metadata.js +16 -11
- package/dist/commands/edit-additional-metadata.js.map +1 -1
- package/dist/commands/edit-algo.js +12 -4
- package/dist/commands/edit-algo.js.map +1 -1
- package/dist/commands/edit-asset-allowed.d.ts +1 -1
- package/dist/commands/edit-asset-allowed.js +73 -43
- package/dist/commands/edit-asset-allowed.js.map +1 -1
- package/dist/commands/edit-asset-url.js +13 -5
- package/dist/commands/edit-asset-url.js.map +1 -1
- package/dist/commands/edit-compute-network.d.ts +14 -0
- package/dist/commands/edit-compute-network.js +78 -0
- package/dist/commands/edit-compute-network.js.map +1 -0
- package/dist/commands/edit-keywords.d.ts +13 -0
- package/dist/commands/edit-keywords.js +57 -0
- package/dist/commands/edit-keywords.js.map +1 -0
- package/dist/commands/edit-trusted-algos.d.ts +1 -1
- package/dist/commands/edit-trusted-algos.js +53 -45
- package/dist/commands/edit-trusted-algos.js.map +1 -1
- package/dist/commands/edit-trusted-publishers.js +13 -5
- package/dist/commands/edit-trusted-publishers.js.map +1 -1
- package/dist/commands/generate-asset-credentials.js +1 -1
- package/dist/commands/generate-asset-credentials.js.map +1 -1
- package/dist/commands/generate-manifest.d.ts +3 -3
- package/dist/commands/generate-manifest.js +20 -20
- package/dist/commands/generate-manifest.js.map +1 -1
- package/dist/commands/generate-private-keys.d.ts +2 -2
- package/dist/commands/generate-private-keys.js +26 -26
- package/dist/commands/generate-private-keys.js.map +1 -1
- package/dist/commands/get.js +2 -2
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/publish.d.ts +2 -1
- package/dist/commands/publish.js +54 -7
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/render.js +46 -27
- package/dist/commands/render.js.map +1 -1
- package/dist/commands/revoke.js +11 -5
- package/dist/commands/revoke.js.map +1 -1
- package/dist/commands/self-description.js +8 -3
- package/dist/commands/self-description.js.map +1 -1
- package/dist/config.d.ts +17 -14
- package/dist/config.js +75 -49
- package/dist/config.js.map +1 -1
- package/dist/lib/aquarius.js +95 -27
- package/dist/lib/aquarius.js.map +1 -1
- package/dist/lib/gaia-x_compliance/generate-credentials/index.js +35 -20
- package/dist/lib/gaia-x_compliance/generate-credentials/index.js.map +1 -1
- package/dist/lib/spec.d.ts +3 -3
- package/dist/lib/spec.js +66 -30
- package/dist/lib/spec.js.map +1 -1
- package/dist/scripts/patch-nautilus.cjs +15 -0
- package/dist/scripts/patch-nautilus.cjs.map +1 -0
- package/dist/scripts/patch-nautilus.d.cts +1 -0
- package/dist/types/manifest-schema.json +2 -8
- package/dist/types/schema.json +467 -62
- package/dist/utils/asset.d.ts +2 -2
- package/dist/utils/asset.js +23 -23
- package/dist/utils/asset.js.map +1 -1
- package/dist/utils/connection.d.ts +2 -1
- package/dist/utils/connection.js +84 -4
- package/dist/utils/connection.js.map +1 -1
- package/dist/utils/login.d.ts +2 -2
- package/dist/utils/login.js +13 -13
- package/dist/utils/login.js.map +1 -1
- package/oclif.manifest.json +169 -15
- package/package.json +6 -6
|
@@ -3,29 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nautilus_1 = require("@deltadao/nautilus");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
6
10
|
const config_1 = require("../config");
|
|
7
11
|
const aquarius_1 = require("../lib/aquarius");
|
|
8
12
|
const asset_1 = require("../utils/asset");
|
|
9
13
|
const connection_1 = require("../utils/connection");
|
|
10
14
|
const login_1 = require("../utils/login");
|
|
11
|
-
const nautilus_1 = require("@deltadao/nautilus");
|
|
12
|
-
const core_1 = require("@oclif/core");
|
|
13
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
-
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
15
15
|
class EditAssetAllowed extends core_1.Command {
|
|
16
16
|
async run() {
|
|
17
|
-
var _a, _b, _c;
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
18
|
const { flags } = await this.parse(EditAssetAllowed);
|
|
19
19
|
// Validation
|
|
20
20
|
if (flags.public && ((_a = flags.users) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
21
|
-
this.error(
|
|
21
|
+
this.error("You cannot specify user addresses and set the asset as public at the same time.");
|
|
22
22
|
}
|
|
23
23
|
if (!flags.public && !((_b = flags.users) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
24
|
-
this.error(
|
|
24
|
+
this.error("You must either specify user addresses with -u or use --public to remove all restrictions.");
|
|
25
25
|
}
|
|
26
26
|
// Network selection
|
|
27
27
|
const network = flags.network || (0, login_1.getEnvNetwork)() || (await (0, login_1.askForNetwork)());
|
|
28
|
-
console.log(`${chalk_1.default.green(
|
|
28
|
+
console.log(`${chalk_1.default.green("Using network:")} ${network}\n`);
|
|
29
29
|
const chainId = config_1.NETWORK_CONFIGS[network].chainId;
|
|
30
30
|
// Authentication selection
|
|
31
31
|
const loginInfos = await (0, login_1.getLoginInfos)(flags.manifest);
|
|
@@ -34,28 +34,28 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
34
34
|
const assets = flags.datasets
|
|
35
35
|
? await (0, aquarius_1.getAssetsFromDids)(flags.datasets)
|
|
36
36
|
: await askForAssets(loginInfos, chainId);
|
|
37
|
-
console.log(
|
|
37
|
+
console.log("\nThe following assets will be edited:");
|
|
38
38
|
for (const asset of assets) {
|
|
39
39
|
const ownerName = await (0, aquarius_1.getOwnerName)(asset.owner);
|
|
40
|
-
console.log(`${chalk_1.default.blue(asset.did)} | ${chalk_1.default.green(asset.created.split(
|
|
40
|
+
console.log(`${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)}`);
|
|
41
41
|
}
|
|
42
42
|
// Summary of what will change
|
|
43
43
|
if (flags.public) {
|
|
44
|
-
console.log(
|
|
44
|
+
console.log("\nAssets will be set as public (all address restrictions removed).");
|
|
45
45
|
}
|
|
46
46
|
else if ((_c = flags.users) === null || _c === void 0 ? void 0 : _c.length) {
|
|
47
|
-
console.log(
|
|
47
|
+
console.log("\nThe following addresses will be set as allowed users:");
|
|
48
48
|
for (const address of flags.users) {
|
|
49
49
|
console.log(` ${chalk_1.default.cyan(address)}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
console.log(
|
|
53
|
+
console.log("\nNo users specified — assets will be set to deny all (empty allow list).");
|
|
54
54
|
}
|
|
55
55
|
// Confirmation prompt
|
|
56
56
|
if (!flags.yes &&
|
|
57
|
-
!readline_sync_1.default.keyInYNStrict(
|
|
58
|
-
console.log(
|
|
57
|
+
!readline_sync_1.default.keyInYNStrict("\nDo you want to proceed with editing the allowed users for the selected assets?")) {
|
|
58
|
+
console.log("Operation cancelled by the user.");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
// Edit each asset
|
|
@@ -67,24 +67,54 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
67
67
|
PRIVATE_KEY: (0, login_1.getPrivateKeyForOwner)(loginInfos, asset.owner),
|
|
68
68
|
};
|
|
69
69
|
const connection = await connection_1.Connection.connect(envOverrides);
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
if (!connection.remoteStore) {
|
|
71
|
+
throw new Error("Editing requires a remote store. Please set PINATA_JWT or IPFS_UPLOAD_URL in your environment.");
|
|
72
|
+
}
|
|
73
|
+
const published = await connection.nautilus.getAsset(asset.did);
|
|
74
|
+
const assetBuilder = new nautilus_1.AssetBuilder(published);
|
|
75
|
+
assetBuilder.setIssuer(connection.wallet.address);
|
|
72
76
|
if (flags.public) {
|
|
73
|
-
|
|
74
|
-
[nautilus_1.CredentialListTypes.ALLOW, nautilus_1.CredentialListTypes.DENY].forEach(type => {
|
|
77
|
+
[nautilus_1.CredentialListTypes.ALLOW, nautilus_1.CredentialListTypes.DENY].forEach((type) => {
|
|
75
78
|
var _a, _b, _c, _d;
|
|
76
79
|
// Delete current allowed addresses
|
|
77
|
-
const
|
|
78
|
-
|
|
80
|
+
const rawExisting = (_d = (_c = (_b = (_a = published.credentials) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.find((c) => c.type === "address")) === null || _c === void 0 ? void 0 : _c.values) !== null && _d !== void 0 ? _d : [];
|
|
81
|
+
const existing = rawExisting.map((v) => typeof v === "string" ? v : v.address);
|
|
82
|
+
if (existing.length > 0) {
|
|
83
|
+
assetBuilder.removeCredentialAddresses(type, existing);
|
|
84
|
+
}
|
|
79
85
|
});
|
|
80
86
|
}
|
|
81
87
|
else {
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
[nautilus_1.CredentialListTypes.ALLOW].forEach((type) => {
|
|
89
|
+
var _a;
|
|
90
|
+
assetBuilder.addCredentialAddresses(type, [
|
|
91
|
+
asset.owner,
|
|
92
|
+
...((_a = flags.users) !== null && _a !== void 0 ? _a : []),
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const services = (0, nautilus_1.getServices)(published);
|
|
97
|
+
for (const s of services) {
|
|
98
|
+
const serviceBuilder = new nautilus_1.ServiceBuilder({
|
|
99
|
+
asset: published,
|
|
100
|
+
serviceId: s.id,
|
|
101
|
+
});
|
|
102
|
+
if (flags.public) {
|
|
103
|
+
serviceBuilder.service.credentials = {};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
serviceBuilder.addCredentialAddresses(nautilus_1.CredentialListTypes.ALLOW, [
|
|
107
|
+
asset.owner,
|
|
108
|
+
...((_d = flags.users) !== null && _d !== void 0 ? _d : []),
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
assetBuilder.addService(serviceBuilder.build());
|
|
84
112
|
}
|
|
85
113
|
const nautilusAsset = assetBuilder.build();
|
|
86
114
|
const result = await connection.nautilus.edit(nautilusAsset);
|
|
87
|
-
|
|
115
|
+
const txHash = result.setMetadataTxReceipt.hash ||
|
|
116
|
+
result.setMetadataTxReceipt.transactionHash;
|
|
117
|
+
this.log(`Allowed users updated for asset, transaction: ${connection.networkConfig.explorerUri}/tx/${txHash}\n`);
|
|
88
118
|
}
|
|
89
119
|
catch (error) {
|
|
90
120
|
this.warn(`Error editing allowed users for asset ${asset.did}: ${error}`);
|
|
@@ -92,49 +122,49 @@ class EditAssetAllowed extends core_1.Command {
|
|
|
92
122
|
}
|
|
93
123
|
}
|
|
94
124
|
}
|
|
95
|
-
EditAssetAllowed.description =
|
|
125
|
+
EditAssetAllowed.description = "Overwrite the list of allowed users for assets";
|
|
96
126
|
EditAssetAllowed.examples = [
|
|
97
|
-
|
|
98
|
-
|
|
127
|
+
"<%= config.bin %> <%= command.id %> -u 0xAbc123... 0xDef456... -d <assetDid1> <assetDid2>",
|
|
128
|
+
"<%= config.bin %> <%= command.id %> -u 0xAbc123... --public",
|
|
99
129
|
];
|
|
100
130
|
EditAssetAllowed.flags = {
|
|
101
131
|
users: core_1.Flags.string({
|
|
102
|
-
char:
|
|
103
|
-
description:
|
|
132
|
+
char: "u",
|
|
133
|
+
description: "Ethereum addresses of users to allow (0x...)",
|
|
104
134
|
multiple: true,
|
|
105
135
|
required: false,
|
|
106
136
|
}),
|
|
107
137
|
datasets: core_1.Flags.string({
|
|
108
|
-
char:
|
|
109
|
-
description:
|
|
138
|
+
char: "d",
|
|
139
|
+
description: "Asset DIDs to edit (did:op:...)",
|
|
110
140
|
multiple: true,
|
|
111
141
|
}),
|
|
112
142
|
yes: core_1.Flags.boolean({
|
|
113
|
-
char:
|
|
114
|
-
description:
|
|
143
|
+
char: "y",
|
|
144
|
+
description: "Skip confirmation prompt",
|
|
115
145
|
}),
|
|
116
146
|
manifest: core_1.Flags.string({
|
|
117
|
-
char:
|
|
118
|
-
description:
|
|
147
|
+
char: "m",
|
|
148
|
+
description: "Path to manifest file with the accounts to use for authentication",
|
|
119
149
|
}),
|
|
120
150
|
public: core_1.Flags.boolean({
|
|
121
|
-
char:
|
|
122
|
-
description:
|
|
151
|
+
char: "p",
|
|
152
|
+
description: "Make assets public (remove all address restrictions)",
|
|
123
153
|
}),
|
|
124
154
|
network: core_1.Flags.string({
|
|
125
|
-
char:
|
|
126
|
-
description:
|
|
155
|
+
char: "n",
|
|
156
|
+
description: "Network to use (env: NETWORK)",
|
|
127
157
|
options: Object.keys(config_1.NETWORK_CONFIGS),
|
|
128
158
|
}),
|
|
129
159
|
};
|
|
130
160
|
exports.default = EditAssetAllowed;
|
|
131
161
|
async function askForAssets(loginInfos, chainId) {
|
|
132
|
-
console.log(
|
|
162
|
+
console.log("\nPlease select the filters to find the assets you want to edit:");
|
|
133
163
|
return (0, asset_1.PromptForAssets)({
|
|
134
|
-
assetTypes: [
|
|
135
|
-
accessTypes: [
|
|
164
|
+
assetTypes: ["dataset", "algorithm"],
|
|
165
|
+
accessTypes: ["access", "compute"],
|
|
136
166
|
chainIds: [chainId],
|
|
137
|
-
ownerChoices: loginInfos.map(info => ({
|
|
167
|
+
ownerChoices: loginInfos.map((info) => ({
|
|
138
168
|
name: info.ownerName,
|
|
139
169
|
value: info.ownerAddress,
|
|
140
170
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-asset-allowed.js","sourceRoot":"","sources":["../../src/commands/edit-asset-allowed.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"edit-asset-allowed.js","sourceRoot":"","sources":["../../src/commands/edit-asset-allowed.ts"],"names":[],"mappings":";;;;;AAAA,iDAK4B;AAC5B,sCAA6C;AAC7C,kDAA0B;AAC1B,kEAAyC;AACzC,qCAAyD;AACzD,6CAIwB;AACxB,yCAAgD;AAChD,mDAAgD;AAChD,yCAOuB;AAEvB,MAAqB,gBAAiB,SAAQ,cAAO;IAsCnD,KAAK,CAAC,GAAG;;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAErD,aAAa;QACb,IAAI,KAAK,CAAC,MAAM,KAAI,MAAA,KAAK,CAAC,KAAK,0CAAE,MAAM,CAAA,EAAE,CAAC;YACxC,IAAI,CAAC,KAAK,CACR,iFAAiF,CAClF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,MAAM,CAAA,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,CACR,4FAA4F,CAC7F,CAAC;QACJ,CAAC;QAED,oBAAoB;QACpB,MAAM,OAAO,GACV,KAAK,CAAC,OAAmB,IAAI,IAAA,qBAAa,GAAE,IAAI,CAAC,MAAM,IAAA,qBAAa,GAAE,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,wBAAe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AG;QACT,WAAW,EAAE,0BAA0B;KACxC,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EACT,mEAAmE;KACtE,CAAC;IACF,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,sDAAsD;KACpE,CAAC;IACF,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,wBAAe,CAAC;KACtC,CAAC;CACH,CAAC;kBApCiB,gBAAgB;AAyLrC,KAAK,UAAU,YAAY,CACzB,UAAuB,EACvB,OAAe;IAEf,OAAO,CAAC,GAAG,CACT,kEAAkE,CACnE,CAAC;IACF,OAAO,IAAA,uBAAe,EAAC;QACrB,UAAU,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;QACpC,WAAW,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAClC,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACtC,IAAI,EAAE,IAAI,CAAC,SAAS;YACpB,KAAK,EAAE,IAAI,CAAC,YAAY;SACzB,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,23 +9,31 @@ const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
|
9
9
|
const connection_1 = require("../utils/connection");
|
|
10
10
|
class EditAssetUrl extends core_1.Command {
|
|
11
11
|
async run() {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
const { args, flags } = await this.parse(EditAssetUrl);
|
|
13
14
|
const { did, url } = args;
|
|
14
15
|
const connection = await connection_1.Connection.connect();
|
|
15
16
|
if (flags.yes ||
|
|
16
17
|
readline_sync_1.default.keyInYNStrict(`Changing the URL for ${did} to ${url}? `)) {
|
|
17
18
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (!connection.remoteStore) {
|
|
20
|
+
throw new Error("Editing requires a remote store. Please set PINATA_JWT or IPFS_UPLOAD_URL in your environment.");
|
|
21
|
+
}
|
|
22
|
+
const published = await connection.nautilus.getAsset(did);
|
|
23
|
+
const assetBuilder = new nautilus_1.AssetBuilder(published);
|
|
24
|
+
const serviceId = ((_a = (0, nautilus_1.getServices)(published)[0]) === null || _a === void 0 ? void 0 : _a.id) ||
|
|
25
|
+
((_b = published.services[0]) === null || _b === void 0 ? void 0 : _b.id);
|
|
20
26
|
const serviceBuilder = new nautilus_1.ServiceBuilder({
|
|
21
|
-
|
|
22
|
-
serviceId
|
|
27
|
+
asset: published,
|
|
28
|
+
serviceId,
|
|
23
29
|
});
|
|
24
30
|
serviceBuilder.addFile({ method: "GET", type: "url", url });
|
|
25
31
|
const service = serviceBuilder.build();
|
|
26
32
|
const asset = assetBuilder.addService(service).build();
|
|
27
33
|
const result = await connection.nautilus.edit(asset);
|
|
28
|
-
|
|
34
|
+
const txHash = result.setMetadataTxReceipt.hash ||
|
|
35
|
+
result.setMetadataTxReceipt.transactionHash;
|
|
36
|
+
this.log(`Changed asset URL, transaction: ${connection.networkConfig.explorerUri}/tx/${txHash}\n`);
|
|
29
37
|
}
|
|
30
38
|
catch (error) {
|
|
31
39
|
this.error(`Error changing dataset URL: ${error}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-asset-url.js","sourceRoot":"","sources":["../../src/commands/edit-asset-url.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"edit-asset-url.js","sourceRoot":"","sources":["../../src/commands/edit-asset-url.ts"],"names":[],"mappings":";;;;;AAAA,iDAA+E;AAC/E,sCAAmD;AACnD,kEAAyC;AAEzC,mDAAgD;AAEhD,MAAqB,YAAa,SAAQ,cAAO;IAqB/C,KAAK,CAAC,GAAG;;QACP,MAA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M,GACT,MAAM,CAAC,oBAA4B,CAAC,IAAI;oBACxC,MAAM,CAAC,oBAA4B,CAAC,eAAe,CAAC;gBAEvD,IAAI,CAAC,GAAG,CACN,mCAAmC,UAAU,CAAC,aAAa,CAAC,WAAW,OAAO,MAAM,IAAI,CACzF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;;AA3DM,iBAAI,GAAG;IACZ,GAAG,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACrE,GAAG,EAAE,WAAI,CAAC,MAAM,CAAC;QACf,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;AACK,wBAAW,GAAG,gCAAgC,CAAC;AAC/C,qBAAQ,GAAsB;IACnC,6LAA6L;CAC9L,CAAC;AACK,kBAAK,GAAG;IACb,GAAG,EAAE,YAAK,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;kBAnBiB,YAAY"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class EditComputeNetwork extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
did: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: Command.Example[];
|
|
8
|
+
static flags: {
|
|
9
|
+
enable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
disable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nautilus_1 = require("@deltadao/nautilus");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
9
|
+
const connection_1 = require("../utils/connection");
|
|
10
|
+
class EditComputeNetwork extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(EditComputeNetwork);
|
|
13
|
+
const { did } = args;
|
|
14
|
+
const enable = flags.disable ? false : flags.enable;
|
|
15
|
+
const action = enable ? "enable" : "disable";
|
|
16
|
+
const connection = await connection_1.Connection.connect();
|
|
17
|
+
if (flags.yes ||
|
|
18
|
+
readline_sync_1.default.keyInYNStrict(`${enable ? "Enable" : "Disable"} network access for asset ${did}? `)) {
|
|
19
|
+
try {
|
|
20
|
+
if (!connection.remoteStore) {
|
|
21
|
+
throw new Error("Editing requires a remote store. Please set PINATA_JWT or IPFS_UPLOAD_URL in your environment.");
|
|
22
|
+
}
|
|
23
|
+
const published = await connection.nautilus.getAsset(did);
|
|
24
|
+
const assetBuilder = new nautilus_1.AssetBuilder(published);
|
|
25
|
+
assetBuilder.setIssuer(connection.wallet.address);
|
|
26
|
+
const computeServices = (0, nautilus_1.getServices)(published).filter((s) => s.type === "compute");
|
|
27
|
+
if (computeServices.length === 0) {
|
|
28
|
+
this.error(`Asset ${did} has no compute service.`);
|
|
29
|
+
}
|
|
30
|
+
for (const s of computeServices) {
|
|
31
|
+
const serviceBuilder = new nautilus_1.ServiceBuilder({
|
|
32
|
+
asset: published,
|
|
33
|
+
serviceId: s.id,
|
|
34
|
+
});
|
|
35
|
+
serviceBuilder.allowAlgorithmNetworkAccess(enable);
|
|
36
|
+
assetBuilder.addService(serviceBuilder.build());
|
|
37
|
+
}
|
|
38
|
+
const asset = assetBuilder.build();
|
|
39
|
+
const result = await connection.nautilus.edit(asset);
|
|
40
|
+
const txHash = result.setMetadataTxReceipt.hash ||
|
|
41
|
+
result.setMetadataTxReceipt.transactionHash;
|
|
42
|
+
this.log(`Compute network access ${action}d for asset, transaction: ${connection.networkConfig.explorerUri}/tx/${txHash}\n`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.error(`Error updating compute network access: ${error}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
EditComputeNetwork.args = {
|
|
51
|
+
did: core_1.Args.string({ description: "DID of the asset", required: true }),
|
|
52
|
+
};
|
|
53
|
+
EditComputeNetwork.description = "Enable or disable algorithm network access for an asset's compute service";
|
|
54
|
+
EditComputeNetwork.examples = [
|
|
55
|
+
"<%= config.bin %> <%= command.id %> did:ope:37d12a459bed3461cb4553aeac7e8484a7ff144e618fd5a604fb01d73b965d40 --enable",
|
|
56
|
+
"<%= config.bin %> <%= command.id %> did:ope:37d12a459bed3461cb4553aeac7e8484a7ff144e618fd5a604fb01d73b965d40 --disable",
|
|
57
|
+
];
|
|
58
|
+
EditComputeNetwork.flags = {
|
|
59
|
+
enable: core_1.Flags.boolean({
|
|
60
|
+
char: "e",
|
|
61
|
+
default: true,
|
|
62
|
+
description: "Enable algorithm network access",
|
|
63
|
+
allowNo: true,
|
|
64
|
+
}),
|
|
65
|
+
disable: core_1.Flags.boolean({
|
|
66
|
+
char: "d",
|
|
67
|
+
description: "Disable algorithm network access",
|
|
68
|
+
exclusive: ["enable"],
|
|
69
|
+
}),
|
|
70
|
+
yes: core_1.Flags.boolean({
|
|
71
|
+
char: "y",
|
|
72
|
+
default: false,
|
|
73
|
+
description: "Skip confirmation prompt",
|
|
74
|
+
required: false,
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
exports.default = EditComputeNetwork;
|
|
78
|
+
//# sourceMappingURL=edit-compute-network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-compute-network.js","sourceRoot":"","sources":["../../src/commands/edit-compute-network.ts"],"names":[],"mappings":";;;;;AAAA,iDAA+E;AAC/E,sCAAmD;AACnD,kEAAyC;AAEzC,mDAAgD;AAEhD,MAAqB,kBAAmB,SAAQ,cAAO;IA8BrD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC7D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAE7C,MAAM,UAAU,GAAG,MAAM,uBAAU,CAAC,OAAO,EAAE,CAAC;QAC9C,IACE,KAAK,CAAC,GAAG;YACT,uBAAY,CAAC,aAAa,CACxB,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,6BAA6B,GAAG,IAAI,CACrE,EACD,CAAC;YACD,IAAI,CAAC;gBACH,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBAC5B,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;gBACJ,CAAC;gBAED,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC1D,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,SAAS,CAAC,CAAC;gBACjD,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC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E,CAAC;CACtE,CAAC;AACK,8BAAW,GAChB,2EAA2E,CAAC;AACvE,2BAAQ,GAAsB;IACnC,uHAAuH;IACvH,wHAAwH;CACzH,CAAC;AACK,wBAAK,GAAG;IACb,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,iCAAiC;QAC9C,OAAO,EAAE,IAAI;KACd,CAAC;IACF,OAAO,EAAE,YAAK,CAAC,OAAO,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE,CAAC,QAAQ,CAAC;KACtB,CAAC;IACF,GAAG,EAAE,YAAK,CAAC,OAAO,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;kBA5BiB,kBAAkB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class EditKeywords extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
did: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
keywords: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: Command.Example[];
|
|
9
|
+
static flags: {
|
|
10
|
+
yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nautilus_1 = require("@deltadao/nautilus");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
9
|
+
const connection_1 = require("../utils/connection");
|
|
10
|
+
class EditKeywords extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(EditKeywords);
|
|
13
|
+
const { did, keywords } = args;
|
|
14
|
+
const connection = await connection_1.Connection.connect();
|
|
15
|
+
if (flags.yes ||
|
|
16
|
+
readline_sync_1.default.keyInYNStrict(`Update the list of keyword a for asset ${did} to "${keywords}? `)) {
|
|
17
|
+
try {
|
|
18
|
+
if (!connection.remoteStore) {
|
|
19
|
+
throw new Error("Editing requires a remote store. Please set PINATA_JWT or IPFS_UPLOAD_URL in your environment.");
|
|
20
|
+
}
|
|
21
|
+
const published = await connection.nautilus.getAsset(did);
|
|
22
|
+
const assetBuilder = new nautilus_1.AssetBuilder(published);
|
|
23
|
+
const asset = assetBuilder
|
|
24
|
+
.addTags(keywords.split(",").map((k) => k.trim()))
|
|
25
|
+
.build();
|
|
26
|
+
const result = await connection.nautilus.edit(asset);
|
|
27
|
+
const txHash = result.setMetadataTxReceipt.hash ||
|
|
28
|
+
result.setMetadataTxReceipt.transactionHash;
|
|
29
|
+
this.log(`Asset keywords updated, transaction: ${connection.networkConfig.explorerUri}/tx/${txHash}\n`);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this.error(`Error editing keywords: ${error}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
EditKeywords.args = {
|
|
38
|
+
did: core_1.Args.string({ description: "Algorithm DID", required: true }),
|
|
39
|
+
keywords: core_1.Args.string({
|
|
40
|
+
description: "Comma separated list of keywords",
|
|
41
|
+
required: true,
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
EditKeywords.description = "Change the list of keywords of the indicated DID";
|
|
45
|
+
EditKeywords.examples = [
|
|
46
|
+
"<%= config.bin %> <%= command.id %> did:op:dcdb747f8feff3122c6d6c0f45a339a6e09415e721f98f61cc2c1d62ab35a21f agrospai,agriculture,data",
|
|
47
|
+
];
|
|
48
|
+
EditKeywords.flags = {
|
|
49
|
+
yes: core_1.Flags.boolean({
|
|
50
|
+
char: "y",
|
|
51
|
+
default: false,
|
|
52
|
+
description: "Skip confirmation prompt",
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
exports.default = EditKeywords;
|
|
57
|
+
//# sourceMappingURL=edit-keywords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-keywords.js","sourceRoot":"","sources":["../../src/commands/edit-keywords.ts"],"names":[],"mappings":";;;;;AAAA,iDAAkD;AAClD,sCAAmD;AACnD,kEAAyC;AAEzC,mDAAgD;AAEhD,MAAqB,YAAa,SAAQ,cAAO;IAsB/C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACvD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,UAAU,GAAG,MAAM,uBAAU,CAAC,OAAO,EAAE,CAAC;QAC9C,IACE,KAAK,CAAC,GAAG;YACT,uBAAY,CAAC,aAAa,CACxB,0CAA0C,GAAG,QAAQ,QAAQ,IAAI,CAClE,EACD,CAAC;YACD,IAAI,CAAC;gBACH,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBAC5B,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;gBACJ,CAAC;gBAED,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC1D,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,SAAS,CAAC,CAAC;gBACjD,MAAM,KAAK,GAAG,YAAY;qBACvB,OA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