{"_id":"@acc-toppings/api-acc-compiler","_rev":"1-f693cc7144c28be5ab2af659c6766372","name":"@acc-toppings/api-acc-compiler","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.2":{"name":"@acc-toppings/api-acc-compiler","version":"0.1.2","main":"local_service.js","license":"MIT","author":{"name":"acctoken"},"repository":{"type":"git","url":"https://github.com/ACCToken/acc-toppings/tree/master/packages/api-acc-compiler"},"contributors":[],"description":"Local node process to consume smart contract source files and compile to WASM/ABI files","publishConfig":{"access":"public"},"scripts":{"start":"node local-service.js"},"dependencies":{"@acctoken/accjs":"1.0.0","body-parser":"^1.19.0","cors":"^2.8.5","del":"^5.1.0","dotenv":"^8.1.0","express":"^4.16.4","file":"^0.2.2","node-fetch":"^2.3.0","recursive-copy":"^2.0.10","strip-ansi":"^5.1.0"},"gitHead":"bfb7b0193a2cccb93c759d5a2971b9eb1b0e80cc","_id":"@acc-toppings/api-acc-compiler@0.1.2","_nodeVersion":"11.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-jRvisNLrBAb4vc317qSZTP3r8AXhQDRYijB3MickXENeNTgaEnRrXl6uiWCeotwkQXNCYGX2HlWhYwhvn+XDUg==","shasum":"2aee9330c62cfc869d173132246556549977d046","tarball":"https://registry.npmjs.org/@acc-toppings/api-acc-compiler/-/api-acc-compiler-0.1.2.tgz","fileCount":7,"unpackedSize":23899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd36wGCRA9TVsSAnZWagAAyx0P/iSoIz1G3tMdRKtO+pAo\n50lMCL+YfNWw3Ct3On0DpMy0U+ANObgPkw/Xwt9vuPrkdLa8bJU6z7vB0Pa7\nKylgYhBx/bMaOBMzpr0xe6CHzcTGi3A22QpNz1LHMxoIbDt3qRMfvbSNGR6Y\n8GQ+1+CNs9dKJQHrWk8YAnoVhpDR73GlZm7BgHSHyPChiVujPwdeffXqkPwJ\nT2ZV5sOAK8eLBF9Cuh2tOq8afXBV86PRx6FpZxAqufmrBSHlfAJvLin9lt8a\nZtdGZ2LBQRQd7JRcNcM+8ovZNSA6V3SE+mdmHke12+B/h7B6m5WHOPvNA0CQ\nBB3Ab2b6WKUvs8QiqUotizmGva8WqgC456L1MdQgGrqbNUKwEKwAjehNuhuE\nBAhpZRxZv4Y+KIvW447sS3F8Q+y5OnT2PTl5VSH6bukadPPZpE6wn6ifwill\ntkHVAGmHvp0t4Y/QcW68WAgquFpuwQRK/s9vmRcqLevVxjz0+G6pFOtF/n9c\n8KycCX59seK6vnsLgRtX2vqtmNX2Aads9pFrHs0O9Apk2kcw2lguCtItXr9E\n57ycXHlIh63rjJzklamIitY5EKHDF/dtzCnPA3XMnP1Vo58ONpSU8bamAUBj\nD/5ZSmfeqbZ3BUISe43h4K6J8PknNKp1XHMxyUKQy5V5P9n3f148TZKVp3X+\n05on\r\n=XIlj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEFlZxCWsJe8+ZSZgRaU54HYXSuQGbO5RLg3GZYjesKGAiEAgjgnsOjcWyjvRZRHZRKW7kgkbTqQaT84NqMYAxdcjr4="}]},"maintainers":[{"name":"acctoken","email":"acctoken1234@hotmail.com"}],"_npmUser":{"name":"acctoken","email":"acctoken1234@hotmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/api-acc-compiler_0.1.2_1574939654402_0.148899590236101"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-28T11:14:14.140Z","0.1.2":"2019-11-28T11:14:14.501Z","modified":"2022-04-04T11:06:25.631Z"},"maintainers":[{"name":"acctoken","email":"acctoken1234@hotmail.com"}],"description":"Local node process to consume smart contract source files and compile to WASM/ABI files","repository":{"type":"git","url":"https://github.com/ACCToken/acc-toppings/tree/master/packages/api-acc-compiler"},"contributors":[],"author":{"name":"acctoken"},"license":"MIT","readme":"# api-acc-compiler <a href=\"https://www.npmjs.com/package/@acc-toppings/api-acc-compiler\"><img alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/@acc-toppings/api-acc-compiler.svg\"></a>\nSelf-contained Node.JS server that can perform the following functions:\n* Compile a smart contract to generate an `.abi` file\n* Compile and deploy a smart contract to the blockchain in a single step\n* Import a ready-made `.abi` file to go with the deployment of a smart contract\n\nUnder the hood, these functions create a Docker container running `acc.cdt`. More information about this can be viewed [here](./docker-acc-cdt).\n\n## Installation\n\nNavigate to the root of this package and run `yarn install` if running separately from the rest of the tools. Once all dependencies have been installed, navigate to the `./docker-acc-cdt` folder and run `./build_acc_cdt_docker.sh` to build the Docker image. This is necessary as the service will execute shell script code which spins up the Docker container transiently (disposed after it has finished the task).\n\nAfterwards, navigate back to the root and do `yarn start` to spin up the local service.\n\n## Endpoints\n\n### `/api/acc/compile` - `POST` method\nA `POST` method that compiles a group of source files for the smart contract based on a provided `source` input. It accepts the following as parameters:\n1. `source` - `<String>` - An absolute file path to the entry file of the smart contract. The filename with file extension will be passed to `acc-cpp` as the primary argument for compilation.\n\nIt will return the following:\n```\n{\n    wasmLocation: - <String> - full path of the compiled WASM file\n    abi: - <String> - full path of the ABI file\n    abiContents: - <String> - Stringified contents of the ABI file\n    errors: - <Array[String]> - List of possible errors\n    stdout: - <Array[String]> - Line by line contents of the standard output of the compiler\n    stderr: - <Array[String]> - Line by line contents of the standard error of the compiler\n    compiled: - <Boolean> - Helper field to determine if file has been compiled or not\n}\n```\n\nNote, that it will use the folder containing the entry file indicated in `source` as the container for all dependencies of the file.\n\n### `/api/acc/import` - `POST` method\nA `POST` method which takes a file name and the contents of that file as an input, writing the file to a pre-determined location in the API server so it can be used for smart contract deployment. Use this API method as a back up for cases when compiling the ABI did not work. It accepts the following as parameters:\n1. `abiName` - `<String>` - A file name with file extension such as `abi_file.abi`\n2. `content` - `<String>` - The raw stringified content of the `.abi` file to import\n\nIt will return the following:\n```\n{\n    abiPath: - <String> - The full path of the imported ABI file\n    errors: - <Array[String]> - List of possible errors\n    imported: - <Boolean> - Helper field to determine if the file has been compiled or not\n}\n```\n\n### `/api/acc/deploy` - `POST` method\nA `POST` method that compiles a group of source code files for the smart contract based on a provided `source` input. Afterwards, it will deploy the compiled smart contract to the blockchain at `endpoint` with the `account_name` permission signed with `private_key`. Optionally, if `abiSource` is provided, the service will use the `.abi` file at `abiSource` instead of generating the `.abi` file itself. It accepts the following as parameters:\n1. `source` - `<String>` - An absolute file path to the entry file of the smart contract. The filename with file extension will be passed to `acc-cpp` as the primary argument for compilation.\n2. `endpoint` - `<String>` - The full endpoint of the `nodeacc` instance the user wishes to deploy the contract to\n3. `account_name` - `<String>` - The name of the account that will sign and deploy this contract\n4. `private_key` - `<String>` - The private key of the account's permission. Be aware to use the correct private key. Otherwise, you may receive an error.\n5. [`abiSource`] - `<String>` - An absolute file path to the imported `.abi` file to use instead of the default behavior. Optional field.\n\nIt will return the following:\n```\n{\n    wasmLocation: - <String> - full path of the compiled WASM file\n    abi: - <String> - full path of the ABI file\n    abiContents: - <String> - Stringified contents of the ABI file\n    output: - <Object> - Trimmed result of the deployment action, in cases of deployment success\n    errors: - <Array[String]> - List of possible errors\n    stdout: - <Array[String]> - Line by line contents of the standard output of the compiler\n    stderr: - <Array[String]> - Line by line contents of the standard error of the compiler\n    compiled: - <Boolean> - Helper field to determine if file has been compiled or not\n    deployed: - <Boolean> - Helper field to determine if file has been deployed or not\n}\n```\n\nNote, that it will use the folder containing the entry file indicated in `source` as the container for all dependencies of the file.\n","readmeFilename":"README.md"}