{"_id":"@atixlabs/mina-testing-utils","_rev":"2-cd0bbc40fc2cff7fce7ea90240b44486","name":"@atixlabs/mina-testing-utils","dist-tags":{"latest":"0.0.1-a3"},"versions":{"0.0.1-alpha":{"name":"@atixlabs/mina-testing-utils","version":"0.0.1-alpha","description":"Handful MINA testing utilx to be used alongside with zkapp-cli generated projects","main":"lib/index.js","types":"lib/types.ts","bin":{"mina-testing-utils":"cli/cli.cjs"},"type":"module","scripts":{"test":"node --experimental-wasm-threads node_modules/jest/bin/jest.js","lint":"tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts'","build":"rimraf ./dist && npm run build:lib && npm run build:cli && cp package* ./dist/","build:lib":"tsc -p ./tsconfig.lib.json  && cp lib/types.ts ./dist/lib/","build:cli":"cp -r ./cli ./dist/","dev-pack":"npm run build && npm pack ./dist/"},"author":{"name":"Globant"},"license":"MIT","devDependencies":{"@jest/globals":"29.6.2","@types/jest":"29.5.3","jest":"29.7.0","rimraf":"5.0.1","ts-jest":"29.1.1","tslint":"6.1.3","typescript":"5.1.6"},"peerDependencies":{"snarkyjs":"0.12.*"},"dependencies":{"cfonts":"3.2.0","chalk":"4.1.2","cli-table":"^0.3.11","commander":"^11.0.0","spinnies":"0.5.1"},"gitHead":"fbd38378a89aef93545d34cd635e4e2fa3fdc8b9","_id":"@atixlabs/mina-testing-utils@0.0.1-alpha","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"integrity":"sha512-EvX/5luGA5VkhhQdhQYpUsSM0mV+qUNGY0/3sFvWHm3DCPejWCb15AKhQCrxDy+qPb90OfrDt7QnoIz1zjQs5g==","shasum":"9ee119c2bece0c625969d967a2f7a9ce6324fe34","tarball":"https://registry.npmjs.org/@atixlabs/mina-testing-utils/-/mina-testing-utils-0.0.1-alpha.tgz","fileCount":27,"unpackedSize":54885,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA7DVrjTxOT9gAO+maBKBRPo0GPH9BP1ecPOAUe1qI/nAiBGOcZEsNpkp3RNubLxjGe6505u+JfKVVG9McnwWb5oFQ=="}]},"_npmUser":{"name":"averbner","email":"averbner@atixlabs.com"},"directories":{},"maintainers":[{"name":"lalanv","email":"alverbner@gmail.com"},{"name":"averbner","email":"averbner@atixlabs.com"},{"name":"gpetragliaatix","email":"gpetraglia@atixlabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mina-testing-utils_0.0.1-alpha_1695834203411_0.6294002594769219"},"_hasShrinkwrap":false},"0.0.1-a1":{"name":"@atixlabs/mina-testing-utils","version":"0.0.1-a1","description":"Handful MINA testing utilx to be used alongside with zkapp-cli generated projects","main":"lib/index.js","types":"lib/types.ts","bin":{"mina-testing-utils":"cli/cli.cjs"},"type":"module","scripts":{"test":"node --experimental-wasm-threads node_modules/jest/bin/jest.js","lint":"tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts'","build":"rimraf ./dist && npm run build:lib && npm run build:cli && cp package* ./dist/","build:lib":"tsc -p ./tsconfig.lib.json  && cp lib/types.ts ./dist/lib/","build:cli":"cp -r ./cli ./dist/","dev-pack":"npm run build && npm pack ./dist/","release:alpha":"git cz bump --prerelease alpha --changelog","release":"git cz bump --changelog"},"author":{"name":"Atixlabs"},"license":"MIT","devDependencies":{"@jest/globals":"29.6.2","@types/jest":"29.5.3","jest":"29.7.0","rimraf":"5.0.1","ts-jest":"29.1.1","tslint":"6.1.3","typescript":"5.1.6"},"peerDependencies":{"snarkyjs":"0.12.*"},"dependencies":{"cfonts":"3.2.0","chalk":"4.1.2","cli-table":"^0.3.11","commander":"^11.0.0","spinnies":"0.5.1"},"gitHead":"f57a0a7223ef2cf934990aabfd8c0b3ad70ddf73","_id":"@atixlabs/mina-testing-utils@0.0.1-a1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-mYKcQJb61iErzYFvjI9kD2ws+3fBNp3+lGiS9TpT8HS+xjiWshjMDBwCJDq4/tIO6H8Nyh3HUFqHMCQ2Ek52ng==","shasum":"4df8c421640203b1093710ae1ccbabb06ad82450","tarball":"https://registry.npmjs.org/@atixlabs/mina-testing-utils/-/mina-testing-utils-0.0.1-a1.tgz","fileCount":30,"unpackedSize":56609,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnH+tPqC+1uulsX8sCIy8xlCibOFXVY3sGR9yrMnK9yAIgBK2fzMKhvdbEh5ub48PKASLBO1H+2zh8aDmCTDXDOwA="}]},"_npmUser":{"name":"averbner","email":"averbner@atixlabs.com"},"directories":{},"maintainers":[{"name":"lalanv","email":"alverbner@gmail.com"},{"name":"averbner","email":"averbner@atixlabs.com"},{"name":"gpetragliaatix","email":"gpetraglia@atixlabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mina-testing-utils_0.0.1-a1_1695839697271_0.03538905421731009"},"_hasShrinkwrap":false},"0.0.1-a3":{"name":"@atixlabs/mina-testing-utils","version":"0.0.1-a3","description":"Handful MINA testing utilx to be used alongside with zkapp-cli generated projects","main":"lib/index.js","types":"lib/types.ts","bin":{"mina-testing-utils":"cli/cli.cjs"},"type":"module","scripts":{"test":"node --experimental-wasm-threads node_modules/jest/bin/jest.js","lint":"tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts'","build":"rimraf ./dist && npm run build:lib && npm run build:cli && cp package* ./dist/","build:lib":"tsc -p ./tsconfig.lib.json  && cp lib/types.ts ./dist/lib/","build:cli":"cp -r ./cli ./dist/","dev-pack":"npm run build && npm pack ./dist/","release:alpha":"git cz bump --prerelease alpha --changelog","release":"git cz bump --changelog"},"author":{"name":"Atixlabs"},"license":"MIT","devDependencies":{"@jest/globals":"29.6.2","@types/jest":"29.5.3","jest":"29.7.0","rimraf":"5.0.1","ts-jest":"29.1.1","tslint":"6.1.3","typescript":"5.1.6"},"peerDependencies":{"o1js":"0.13.*"},"dependencies":{"cfonts":"3.2.0","chalk":"4.1.2","cli-table":"^0.3.11","commander":"^11.0.0","spinnies":"0.5.1"},"_id":"@atixlabs/mina-testing-utils@0.0.1-a3","gitHead":"20f764596b33b9e2a9144a35b44aaeb8b1b99078","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-QWJAXGchzJGwYgaMmW9nCZ4cQ9RLkaXEvlwYb7zqoV9Nsp3vY1h/JyIvxkcOw4gaPBQty3vZJzoxi2tT+PPpGQ==","shasum":"618f4aab15d2fa6421a4f6afe765468021197339","tarball":"https://registry.npmjs.org/@atixlabs/mina-testing-utils/-/mina-testing-utils-0.0.1-a3.tgz","fileCount":30,"unpackedSize":56601,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDR8FEtazJ0OQJADS43ika1FqccW1hHSJdluWchV67uVgIhAOHAr7bO8kZoe9Z/5NTopCuoqVVXjoyuKg/86wVCCYoM"}]},"_npmUser":{"name":"averbner","email":"averbner@atixlabs.com"},"directories":{},"maintainers":[{"name":"lalanv","email":"alverbner@gmail.com"},{"name":"averbner","email":"averbner@atixlabs.com"},{"name":"gpetragliaatix","email":"gpetraglia@atixlabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mina-testing-utils_0.0.1-a3_1696535495295_0.3400000189390866"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-27T17:03:23.298Z","0.0.1-alpha":"2023-09-27T17:03:23.652Z","modified":"2023-10-05T19:51:35.745Z","0.0.1-a1":"2023-09-27T18:34:57.585Z","0.0.1-a3":"2023-10-05T19:51:35.508Z"},"maintainers":[{"name":"lalanv","email":"alverbner@gmail.com"},{"name":"averbner","email":"averbner@atixlabs.com"},{"name":"gpetragliaatix","email":"gpetraglia@atixlabs.com"}],"description":"Handful MINA testing utilx to be used alongside with zkapp-cli generated projects","author":{"name":"Atixlabs"},"license":"MIT","readme":"# Mina Testing Utils\n\nThis repository contains a set of utilities for testing Mina zkapps:\n\n- Custom jest matchers\n- An interactive debugger to interact with locally deployed contracts\n- A contract (gates) sizer \n\n# Requirements\n\n- `node +18` (nvm recommended)\n- `o1js@0.12.*`\n\n# Installing\n\nIn order to use this tool, you should install it as a dev dependency on your existing project, for example, one created using `zkcli-app`:\n\n```bash\nnpm --save-dev install @atixlabs/mina-testing-utils \n```\n\n## Using Jest matchers\n\nImport it in your tests as follows:\n\n```typescript\n// Import to extend the matchers\nimport '@atixlabs/mina-testing-utils';\n\ndescribe('my test', () => {\n\n  it('some test', async () => {\n\n\t\t// Matchers are automatically recognized by jest\n    expect(Field(19)).toEqual(19);\n    expect(app.someBooleanState).toBeFalse()\n  })\n```\n\nYou can refer to [contract.test.ts](./test/contract/test-contract.ts) for a running example.\n\n## Using the interactive debugger\n\nAfter installing the package, you can run the interactive debugger as follows:\n\n```typescript \nimport { Field, SmartContract, state, State, method } from 'o1js';\n\n/**\n * Basic Example\n * See https://docs.minaprotocol.com/zkapps for more info.\n *\n * The Add contract initializes the state variable 'num' to be a Field(1) value by default when deployed.\n * When the 'update' method is called, the Add contract adds Field(2) to its 'num' contract state.\n *\n * This file is safe to delete and replace with your own contract.\n */\nexport class Add extends SmartContract {\n  @state(Field) num = State<Field>();\n\n  init() {\n    super.init();\n    this.num.set(Field(1));\n  }\n\n  @method update() {\n    const currentState = this.num.getAndAssertEquals();\n    const newState = currentState.add(2);\n    this.num.set(newState);\n  }\n}\n```\n\n```bash\n❯ npx mina-testing-utils repl\n\n\n ███╗   ███╗ ██╗ ███╗   ██╗  █████╗      ████████╗ ███████╗ ███████╗ ████████╗ ██╗ ███╗   ██╗  ██████╗      ██╗   ██╗ ████████╗ ██╗ ██╗      ███████╗\n ████╗ ████║ ██║ ████╗  ██║ ██╔══██╗     ╚══██╔══╝ ██╔════╝ ██╔════╝ ╚══██╔══╝ ██║ ████╗  ██║ ██╔════╝      ██║   ██║ ╚══██╔══╝ ██║ ██║      ██╔════╝\n ██╔████╔██║ ██║ ██╔██╗ ██║ ███████║        ██║    █████╗   ███████╗    ██║    ██║ ██╔██╗ ██║ ██║  ███╗     ██║   ██║    ██║    ██║ ██║      ███████╗\n ██║╚██╔╝██║ ██║ ██║╚██╗██║ ██╔══██║        ██║    ██╔══╝   ╚════██║    ██║    ██║ ██║╚██╗██║ ██║   ██║     ██║   ██║    ██║    ██║ ██║      ╚════██║\n ██║ ╚═╝ ██║ ██║ ██║ ╚████║ ██║  ██║        ██║    ███████╗ ███████║    ██║    ██║ ██║ ╚████║ ╚██████╔╝     ╚██████╔╝    ██║    ██║ ███████╗ ███████║\n ╚═╝     ╚═╝ ╚═╝ ╚═╝  ╚═══╝ ╚═╝  ╚═╝        ╚═╝    ╚══════╝ ╚══════╝    ╚═╝    ╚═╝ ╚═╝  ╚═══╝  ╚═════╝       ╚═════╝     ╚═╝    ╚═╝ ╚══════╝ ╚══════╝\n\n\n\n  \n\nPlease load the Mina REPL context by executing .loadMina before running any commands.\n\n\n  \nmina-testing-utils> .loadMina\n✔ Snarky loaded successfully! You can access it through the mina object.\n\nmina-testing-utils> let { Add } = await import(\"/Projects/yourProject/build/src/Add.js\")\n\nmina-testing-utils> let { priv: zkAppPrivateKey, pub: zkAppAddress } = mina.genKeyPair();\n\nmina-testing-utils> let zkApp = new Add(zkAppAddress);\n\nmina-testing-utils> let { privateKey: deployerKey, publicKey: deployerAccount } = mina.testAccounts[0];\n\nmina-testing-utils> let txn = await mina.o1js.Mina.transaction(deployerAccount, () => {\n  mina.o1js.AccountUpdate.fundNewAccount(deployerAccount);\n  zkApp.deploy();\n});\n\nmina-testing-utils> await txn.prove();\nmina-testing-utils> await txn.sign([deployerKey, zkAppPrivateKey]).send();\n\nmina-testing-utils> console.log(\"Stored number in state is: \", zkApp.num.get().toString())\nStored number in state is:  1\n```\n\nSee it in action:\n\n[![asciicast](https://asciinema.org/a/603288.svg)](https://asciinema.org/a/603288)\n\n## Using the contract sizer\n\nThis tool also allows you to keep track of the amount of gates the contracts you create are creating thus giving an idea of the complexity it will involve using them. To try it, run:\n\n```bash\nnpx mina-testing-utils circuits-sizer build/src/test-contract.js\n```\n\nBear in mind you need to compile them first (if `zkapp-cli` is being used, it should be `npm run build`).\n\nSee it in action:\n\n[![asciicast](https://asciinema.org/a/13DtDxa6nId5AtEhDcvZ3IyDf.svg)](https://asciinema.org/a/13DtDxa6nId5AtEhDcvZ3IyDf)\n\n# Development\n\n## Requirements\n\n- `nodejs +18`\n\n## Setup\n\n```\nnpm install\n```\n\n## Testing\n\n```\nnpm test\n```\n\n## Trying on a zkapp-cli local app\n\n_Note: npm link seems to be messing around with o1js import resulting in multiple errors therefore follow this steps in order to use a local version of this lib:_\n\n```bash\n# generate your zkapp as you would do normally, see https://docs.minaprotocol.com/zkapps/how-to-write-a-zkapp\nzk example\n\n# build the library\nnpm run build\n# generate a tar file in any folder as pleased\nnpm run dev-pack -- --pack-destination /tmp/ \n\n# install the library in your zkapp\ncd example && npm install --save-dev /tmp/mina-testing-utils-0.0.1.tgz\n```\n","readmeFilename":"README.md"}