Fixed errors with the API
diff --git a/cli-functions.js b/cli-functions.js
index 86e6865..f5b17f7 100644
--- a/cli-functions.js
+++ b/cli-functions.js
@@ -45,9 +45,8 @@
}
module.exports = {
- createAccount: (configPath) => handleExec(`create --config ${configPath}`),
- compileContract: (path) => handleExec(`compile --path ${path}`),
- deployContract: (path) => handleExec(`deploy --path ${path}`),
- executeContract: (command) => handleExec(`execute ${command}`)
+ createAccount: (configPath) => handleExec(`smart-contracts-cli create --config ${configPath}`),
+ compileContract: (sourcePath, outputPath) => handleExec(`smart-contracts-cli compile -s ${sourcePath} -o ${outputPath}`),
+ deployContract: (config, contract, name, args, owner) => handleExec(`smart-contracts-cli deploy --config ${config} --contract ${contract} --name ${name} --arguments ${args} --owner ${owner}`),
+ executeContract: (config, sender, contract, func, args) => handleExec(`smart-contracts-cli execute --config ${config} --sender ${sender} --contract ${contract} --function ${func} --arguments ${args}`)
};
-
diff --git a/package-lock.json b/package-lock.json
index d67ca4f..aa8890d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,7 @@
"express": "^4.19.2",
"express-graphql": "^0.12.0",
"graphql": "^15.9.0",
- "inquirer": "^10.2.0"
+ "inquirer": "^10.2.2"
}
},
"node_modules/@inquirer/checkbox": {
@@ -75,9 +75,9 @@
}
},
"node_modules/@inquirer/expand": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-2.2.0.tgz",
- "integrity": "sha512-PD0z1dTRTIlpcnXRMRvdVPfBe10jBf4i7YLBU8tNWDkf3HxqmdymVvqnT8XG+hxQSvqfpJCe13Jv2Iv1eB3bIg==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-2.3.0.tgz",
+ "integrity": "sha512-qnJsUcOGCSG1e5DTOErmv2BPQqrtT6uzqn1vI/aYGiPKq+FgslGZmtdnXbhuI7IlT7OByDoEEqdnhUnVR2hhLw==",
"dependencies": {
"@inquirer/core": "^9.1.0",
"@inquirer/type": "^1.5.3",
@@ -133,14 +133,14 @@
}
},
"node_modules/@inquirer/prompts": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-5.4.0.tgz",
- "integrity": "sha512-HIQGd7JOX6WXf7zg7WGs+1m+e3eRFyL4mDtWRlV01AXqZido9W3BSoku2BR4E1lK/NCXok6jg6tTcLw4I0thfg==",
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-5.5.0.tgz",
+ "integrity": "sha512-BHDeL0catgHdcHbSFFUddNzvx/imzJMft+tWDPwTm3hfu8/tApk1HrooNngB2Mb4qY+KaRWF+iZqoVUPeslEog==",
"dependencies": {
"@inquirer/checkbox": "^2.5.0",
"@inquirer/confirm": "^3.2.0",
"@inquirer/editor": "^2.2.0",
- "@inquirer/expand": "^2.2.0",
+ "@inquirer/expand": "^2.3.0",
"@inquirer/input": "^2.3.0",
"@inquirer/number": "^1.1.0",
"@inquirer/password": "^2.2.0",
@@ -756,11 +756,12 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/inquirer": {
- "version": "10.2.0",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-10.2.0.tgz",
- "integrity": "sha512-OE/HDYrQAgeUPs3mKetfarr/EFiotdULUc7R2XvwqPHMEjFtCqNsfYDfCZ5baAKKtb9kCaKclNTTE9hSi7JFjg==",
+ "version": "10.2.2",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-10.2.2.tgz",
+ "integrity": "sha512-tyao/4Vo36XnUItZ7DnUXX4f1jVao2mSrleV/5IPtW/XAEA26hRVsbc68nuTEKWcr5vMP/1mVoT2O7u8H4v1Vg==",
"dependencies": {
- "@inquirer/prompts": "^5.4.0",
+ "@inquirer/core": "^9.1.0",
+ "@inquirer/prompts": "^5.5.0",
"@inquirer/type": "^1.5.3",
"@types/mute-stream": "^0.0.4",
"ansi-escapes": "^4.3.2",
@@ -1268,9 +1269,9 @@
}
},
"@inquirer/expand": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-2.2.0.tgz",
- "integrity": "sha512-PD0z1dTRTIlpcnXRMRvdVPfBe10jBf4i7YLBU8tNWDkf3HxqmdymVvqnT8XG+hxQSvqfpJCe13Jv2Iv1eB3bIg==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-2.3.0.tgz",
+ "integrity": "sha512-qnJsUcOGCSG1e5DTOErmv2BPQqrtT6uzqn1vI/aYGiPKq+FgslGZmtdnXbhuI7IlT7OByDoEEqdnhUnVR2hhLw==",
"requires": {
"@inquirer/core": "^9.1.0",
"@inquirer/type": "^1.5.3",
@@ -1311,14 +1312,14 @@
}
},
"@inquirer/prompts": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-5.4.0.tgz",
- "integrity": "sha512-HIQGd7JOX6WXf7zg7WGs+1m+e3eRFyL4mDtWRlV01AXqZido9W3BSoku2BR4E1lK/NCXok6jg6tTcLw4I0thfg==",
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-5.5.0.tgz",
+ "integrity": "sha512-BHDeL0catgHdcHbSFFUddNzvx/imzJMft+tWDPwTm3hfu8/tApk1HrooNngB2Mb4qY+KaRWF+iZqoVUPeslEog==",
"requires": {
"@inquirer/checkbox": "^2.5.0",
"@inquirer/confirm": "^3.2.0",
"@inquirer/editor": "^2.2.0",
- "@inquirer/expand": "^2.2.0",
+ "@inquirer/expand": "^2.3.0",
"@inquirer/input": "^2.3.0",
"@inquirer/number": "^1.1.0",
"@inquirer/password": "^2.2.0",
@@ -1771,11 +1772,12 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"inquirer": {
- "version": "10.2.0",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-10.2.0.tgz",
- "integrity": "sha512-OE/HDYrQAgeUPs3mKetfarr/EFiotdULUc7R2XvwqPHMEjFtCqNsfYDfCZ5baAKKtb9kCaKclNTTE9hSi7JFjg==",
+ "version": "10.2.2",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-10.2.2.tgz",
+ "integrity": "sha512-tyao/4Vo36XnUItZ7DnUXX4f1jVao2mSrleV/5IPtW/XAEA26hRVsbc68nuTEKWcr5vMP/1mVoT2O7u8H4v1Vg==",
"requires": {
- "@inquirer/prompts": "^5.4.0",
+ "@inquirer/core": "^9.1.0",
+ "@inquirer/prompts": "^5.5.0",
"@inquirer/type": "^1.5.3",
"@types/mute-stream": "^0.0.4",
"ansi-escapes": "^4.3.2",
diff --git a/package.json b/package.json
index 3542835..14f657d 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,6 @@
"express": "^4.19.2",
"express-graphql": "^0.12.0",
"graphql": "^15.9.0",
- "inquirer": "^10.2.0"
+ "inquirer": "^10.2.2"
}
}
diff --git a/schema.js b/schema.js
index 394842c..cb84282 100644
--- a/schema.js
+++ b/schema.js
@@ -13,23 +13,38 @@
},
compileContract: {
type: GraphQLString,
- args: { path: { type: GraphQLString } },
+ args: {
+ sourcePath: { type: GraphQLString },
+ outputPath: { type: GraphQLString }
+ },
resolve(parent, args) {
- return compileContract(args.path);
+ return compileContract(args.sourcePath, args.outputPath);
}
},
deployContract: {
type: GraphQLString,
- args: { path: { type: GraphQLString } },
+ args: {
+ config: { type: GraphQLString },
+ contract: { type: GraphQLString },
+ name: { type: GraphQLString },
+ arguments: { type: GraphQLString },
+ owner: { type: GraphQLString }
+ },
resolve(parent, args) {
- return deployContract(args.path);
+ return deployContract(args.config, args.contract, args.name, args.arguments, args.owner);
}
},
executeContract: {
type: GraphQLString,
- args: { command: { type: GraphQLString } },
+ args: {
+ config: { type: GraphQLString },
+ sender: { type: GraphQLString },
+ contract: { type: GraphQLString },
+ function: { type: GraphQLString },
+ arguments: { type: GraphQLString }
+ },
resolve(parent, args) {
- return executeContract(args.command);
+ return executeContract(args.config, args.sender, args.contract, args.function, args.arguments);
}
}
}
@@ -38,4 +53,3 @@
module.exports = new GraphQLSchema({
query: RootQuery
});
-
diff --git a/server.js b/server.js
index fb6958b..9e0d4a9 100644
--- a/server.js
+++ b/server.js
@@ -17,4 +17,3 @@
app.listen(4000, () => {
console.log('Server is running on port 4000..');
});
-