Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metadata/simpleComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"compute": {
"allowRawAlgorithm": false,
"allowNetworkAccess": true,
"publisherTrustedAlgorithmPublishers": [],
"publisherTrustedAlgorithms": []
"publisherTrustedAlgorithmPublishers": ["*"],
"publisherTrustedAlgorithms": ["*"]
}
}
],
Expand Down
75 changes: 36 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"dependencies": {
"@oasisprotocol/sapphire-paratime": "^1.3.2",
"@oceanprotocol/contracts": "^2.3.1",
"@oceanprotocol/ddo-js": "^0.0.8",
"@oceanprotocol/lib": "^4.1.3",
"@oceanprotocol/ddo-js": "^0.1.0",
"@oceanprotocol/lib": "^4.1.4",
"commander": "^13.1.0",
"cross-fetch": "^3.1.5",
"crypto-js": "^4.1.1",
Expand Down
4 changes: 4 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export async function createCLI() {

const proceed = options.accept;
if (!proceed) {
if (!process.stdin.isTTY) {
console.error(chalk.red('Cannot prompt for confirmation (non-TTY). Use "--accept true" to skip.'));
process.exit(1);
}
const rl = createInterface({ input, output });
const confirmation = await rl.question(`\nProceed with payment for starting compute job at price ${amount} in tokens from address ${initResp.payment.token}? (y/n): `);
rl.close();
Expand Down
16 changes: 8 additions & 8 deletions test/consumeFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -81,7 +81,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -104,7 +104,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -127,7 +127,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -145,7 +145,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -162,7 +162,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -179,7 +179,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -196,7 +196,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand Down
16 changes: 5 additions & 11 deletions test/paidComputeFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("Ocean CLI Paid Compute", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -106,7 +106,7 @@ describe("Ocean CLI Paid Compute", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -125,18 +125,12 @@ describe("Ocean CLI Paid Compute", function() {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
}
const match = jsonMatch[0].match(/Exiting compute environments:\s*(.*)/s);
const result = match ? match[1].trim() : null;
if (!result) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
}


let environments;
try {
environments = eval(result);
environments = eval(jsonMatch[1]);
} catch (error) {
console.error(`Extracted output: ${jsonMatch[0]} and final result: ${result}`);
console.error(`Extracted output: ${jsonMatch[0]} and final result: ${jsonMatch[1]}`);
throw new Error("Failed to parse the extracted output:\n" + error);
}

Expand Down