diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ececff2..ddac90e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Unreleased -## [0.19.0](https://github.com/o1-labs/zkapp-cli/compare/v18.0...v19.0) - 2024-03-06 +## [0.20.0](https://github.com/o1-labs/zkapp-cli/compare/v19.0...v20.0) - 2024-04-22 + +- The CLI, templates, and examples have been updated to be compatible with the latest version `1.0.0` of `o1js`. This includes updating all instances of Mina.LocalBlochain() and Proof.fromJSON() to be async. [#623](https://github.com/o1-labs/zkapp-cli/pull/623) + +## [0.19.0](https://github.com/o1-labs/zkapp-cli/compare/v18.0...v19.0) - 2024-04-09 ### Breaking changes diff --git a/examples/sudoku/ts/src/run.ts b/examples/sudoku/ts/src/run.ts index 460775ce..599b4a96 100644 --- a/examples/sudoku/ts/src/run.ts +++ b/examples/sudoku/ts/src/run.ts @@ -14,10 +14,11 @@ import { cloneSudoku, generateSudoku, solveSudoku } from './sudoku-lib.js'; import { AccountUpdate, Mina, PrivateKey } from 'o1js'; // setup -const Local = Mina.LocalBlockchain(); +const Local = await Mina.LocalBlockchain(); Mina.setActiveInstance(Local); -const { privateKey: senderKey, publicKey: sender } = Local.testAccounts[0]; +const sender = Local.testAccounts[0]; +const senderKey = sender.key; const sudoku = generateSudoku(0.5); const zkAppPrivateKey = PrivateKey.random(); const zkAppAddress = zkAppPrivateKey.toPublicKey(); diff --git a/examples/sudoku/ts/src/sudoku.test.ts b/examples/sudoku/ts/src/sudoku.test.ts index e0d12438..d4911351 100644 --- a/examples/sudoku/ts/src/sudoku.test.ts +++ b/examples/sudoku/ts/src/sudoku.test.ts @@ -7,14 +7,14 @@ describe('sudoku', () => { zkAppPrivateKey: PrivateKey, zkAppAddress: PublicKey, sudoku: number[][], - sender: PublicKey, + sender: Mina.TestPublicKey, senderKey: PrivateKey; beforeEach(async () => { - let Local = Mina.LocalBlockchain({ proofsEnabled: false }); + let Local = await Mina.LocalBlockchain({ proofsEnabled: false }); Mina.setActiveInstance(Local); - sender = Local.testAccounts[0].publicKey; - senderKey = Local.testAccounts[0].privateKey; + sender = Local.testAccounts[0]; + senderKey = sender.key; zkAppPrivateKey = PrivateKey.random(); zkAppAddress = zkAppPrivateKey.toPublicKey(); zkApp = new SudokuZkApp(zkAppAddress); diff --git a/examples/tictactoe/ts/src/run.ts b/examples/tictactoe/ts/src/run.ts index 9e29c7d9..6516713f 100644 --- a/examples/tictactoe/ts/src/run.ts +++ b/examples/tictactoe/ts/src/run.ts @@ -20,13 +20,11 @@ import { } from 'o1js'; import { TicTacToe, Board } from './tictactoe.js'; -let Local = Mina.LocalBlockchain({ proofsEnabled: false }); +let Local = await Mina.LocalBlockchain({ proofsEnabled: false }); Mina.setActiveInstance(Local); -const [ - { publicKey: player1, privateKey: player1Key }, - { publicKey: player2, privateKey: player2Key }, -] = Local.testAccounts; - +const [player1, player2] = Local.testAccounts; +const player1Key = player1.key; +const player2Key = player2.key; const zkAppPrivateKey = PrivateKey.random(); const zkAppPublicKey = zkAppPrivateKey.toPublicKey(); const zkApp = new TicTacToe(zkAppPublicKey); diff --git a/examples/tictactoe/ts/src/tictactoe.test.ts b/examples/tictactoe/ts/src/tictactoe.test.ts index 989e1341..e2f54e83 100644 --- a/examples/tictactoe/ts/src/tictactoe.test.ts +++ b/examples/tictactoe/ts/src/tictactoe.test.ts @@ -10,17 +10,19 @@ import { } from 'o1js'; describe('tictactoe', () => { - let player1: PublicKey, + let player1: Mina.TestPublicKey, player1Key: PrivateKey, - player2: PublicKey, + player2: Mina.TestPublicKey, zkAppAddress: PublicKey, zkAppPrivateKey: PrivateKey; beforeEach(async () => { - let Local = Mina.LocalBlockchain({ proofsEnabled: false }); + let Local = await Mina.LocalBlockchain({ proofsEnabled: false }); Mina.setActiveInstance(Local); - [{ publicKey: player1, privateKey: player1Key }, { publicKey: player2 }] = - Local.testAccounts; + + [player1, player2] = Local.testAccounts; + player1Key = player1.key; + zkAppPrivateKey = PrivateKey.random(); zkAppAddress = zkAppPrivateKey.toPublicKey(); }); diff --git a/package-lock.json b/package-lock.json index 3841277e..334b3af5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zkapp-cli", - "version": "0.19.0", + "version": "0.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zkapp-cli", - "version": "0.19.0", + "version": "0.20.0", "license": "Apache-2.0", "dependencies": { "chalk": "^5.3.0", @@ -19,7 +19,7 @@ "fs-extra": "^11.2.0", "gittar": "^0.1.1", "mina-signer": "^3.0.4", - "o1js": "^0.18.*", + "o1js": "^1.0.*", "opener": "^1.5.2", "ora": "^8.0.1", "semver": "^7.6.0", @@ -6281,9 +6281,9 @@ } }, "node_modules/o1js": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-0.18.0.tgz", - "integrity": "sha512-A4XFfRLUHxB8ZUzctpxmYA4kBi3ZRwSgeK/KKuWxf2kDmaxjWOxbCzH/1wHelom4QKIgSIaJpXkAtR0jJv7tqw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.0.1.tgz", + "integrity": "sha512-af+HS1zdJeMwvXvsb4U7PgpuBDTB40ziQHGRQQXOUzOLCA+CyV+ouUDfg7P4DS2ocS0M+M2mQZkuuxXc5ZSM5w==", "dependencies": { "blakejs": "1.2.1", "cachedir": "^2.4.0", @@ -6296,7 +6296,7 @@ "snarky-run": "src/build/run.js" }, "engines": { - "node": ">=16.4.0" + "node": ">=18.14.0" } }, "node_modules/object-assign": { diff --git a/package.json b/package.json index 4454732a..2765d75b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zkapp-cli", - "version": "0.19.0", + "version": "0.20.0", "description": "CLI to create zkApps (zero-knowledge apps) for Mina Protocol", "homepage": "https://github.com/o1-labs/zkapp-cli/", "keywords": [ @@ -65,7 +65,7 @@ "fs-extra": "^11.2.0", "gittar": "^0.1.1", "mina-signer": "^3.0.4", - "o1js": "^0.18.*", + "o1js": "^1.0.*", "opener": "^1.5.2", "ora": "^8.0.1", "semver": "^7.6.0", diff --git a/templates/project-ts/package.json b/templates/project-ts/package.json index dacb945a..c38ba21b 100644 --- a/templates/project-ts/package.json +++ b/templates/project-ts/package.json @@ -36,6 +36,6 @@ "typescript": "^4.7.2" }, "peerDependencies": { - "o1js": "0.18.*" + "o1js": "1.0.*" } } diff --git a/templates/project-ts/src/Add.test.ts b/templates/project-ts/src/Add.test.ts index 8a9f8ad1..7b6b47f9 100644 --- a/templates/project-ts/src/Add.test.ts +++ b/templates/project-ts/src/Add.test.ts @@ -11,9 +11,9 @@ import { Field, Mina, PrivateKey, PublicKey, AccountUpdate } from 'o1js'; let proofsEnabled = false; describe('Add', () => { - let deployerAccount: PublicKey, + let deployerAccount: Mina.TestPublicKey, deployerKey: PrivateKey, - senderAccount: PublicKey, + senderAccount: Mina.TestPublicKey, senderKey: PrivateKey, zkAppAddress: PublicKey, zkAppPrivateKey: PrivateKey, @@ -23,13 +23,13 @@ describe('Add', () => { if (proofsEnabled) await Add.compile(); }); - beforeEach(() => { - const Local = Mina.LocalBlockchain({ proofsEnabled }); + beforeEach(async () => { + const Local = await Mina.LocalBlockchain({ proofsEnabled }); Mina.setActiveInstance(Local); - ({ privateKey: deployerKey, publicKey: deployerAccount } = - Local.testAccounts[0]); - ({ privateKey: senderKey, publicKey: senderAccount } = - Local.testAccounts[1]); + [deployerAccount, senderAccount] = Local.testAccounts; + deployerKey = deployerAccount.key; + senderKey = senderAccount.key; + zkAppPrivateKey = PrivateKey.random(); zkAppAddress = zkAppPrivateKey.toPublicKey(); zkApp = new Add(zkAppAddress);