diff --git a/examples/zkapps/01-hello-world/config.json b/examples/zkapps/01-hello-world/config.json index a6ba768fa..93216b0e5 100644 --- a/examples/zkapps/01-hello-world/config.json +++ b/examples/zkapps/01-hello-world/config.json @@ -1,4 +1,4 @@ { "version": 1, - "networks": {} -} + "deployAliases": {} +} \ No newline at end of file diff --git a/examples/zkapps/01-hello-world/src/main.ts b/examples/zkapps/01-hello-world/src/main.ts index c93b2d287..3e87cc9a2 100644 --- a/examples/zkapps/01-hello-world/src/main.ts +++ b/examples/zkapps/01-hello-world/src/main.ts @@ -19,6 +19,8 @@ const zkAppAddress = zkAppPrivateKey.toPublicKey(); // create an instance of Square - and deploy it to zkAppAddress const zkAppInstance = new Square(zkAppAddress); const deployTxn = await Mina.transaction(deployerAccount, async () => { + // 1 Mina fee is required to create a new account for the zkApp + // This line means the deployer account will pay the fee for any account created in this transaction AccountUpdate.fundNewAccount(deployerAccount); await zkAppInstance.deploy(); }); diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/config.json b/examples/zkapps/02-private-inputs-and-hash-functions/config.json index a6ba768fa..93216b0e5 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/config.json +++ b/examples/zkapps/02-private-inputs-and-hash-functions/config.json @@ -1,4 +1,4 @@ { "version": 1, - "networks": {} -} + "deployAliases": {} +} \ No newline at end of file diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/src/main.ts b/examples/zkapps/02-private-inputs-and-hash-functions/src/main.ts index 4a1c9decd..e1097c904 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/src/main.ts +++ b/examples/zkapps/02-private-inputs-and-hash-functions/src/main.ts @@ -20,6 +20,8 @@ const zkAppAddress = zkAppPrivateKey.toPublicKey(); const zkAppInstance = new IncrementSecret(zkAppAddress); const deployTxn = await Mina.transaction(deployerAccount, async () => { + // 1 Mina fee is required to create a new account for the zkApp + // This line means the deployer account will pay the fee for any account created in this transaction AccountUpdate.fundNewAccount(deployerAccount); await zkAppInstance.deploy(); await zkAppInstance.initState(salt, Field(750)); diff --git a/examples/zkapps/04-zkapp-browser-ui/contracts/config.json b/examples/zkapps/04-zkapp-browser-ui/contracts/config.json index 73c34d158..93216b0e5 100644 --- a/examples/zkapps/04-zkapp-browser-ui/contracts/config.json +++ b/examples/zkapps/04-zkapp-browser-ui/contracts/config.json @@ -1,4 +1,4 @@ { "version": 1, "deployAliases": {} -} +} \ No newline at end of file diff --git a/examples/zkapps/05-common-types-and-functions/config.json b/examples/zkapps/05-common-types-and-functions/config.json index a6ba768fa..93216b0e5 100644 --- a/examples/zkapps/05-common-types-and-functions/config.json +++ b/examples/zkapps/05-common-types-and-functions/config.json @@ -1,4 +1,4 @@ { "version": 1, - "networks": {} -} + "deployAliases": {} +} \ No newline at end of file diff --git a/examples/zkapps/05-common-types-and-functions/src/main.ts b/examples/zkapps/05-common-types-and-functions/src/main.ts index 7a5f85f7c..8a685c49b 100644 --- a/examples/zkapps/05-common-types-and-functions/src/main.ts +++ b/examples/zkapps/05-common-types-and-functions/src/main.ts @@ -179,6 +179,8 @@ const senderPrivateKey = senderPublicKey.key; // deploy the smart contract const deployTxn = await Mina.transaction(deployerAccount, async () => { + // 1 Mina fee is required to create a new account for the zkApp + // This line means the deployer account will pay the fee for any account created in this transaction AccountUpdate.fundNewAccount(deployerAccount); await zkApp.deploy(); // get the root of the new tree to use as the initial tree root diff --git a/examples/zkapps/07-oracles/contracts/config.json b/examples/zkapps/07-oracles/contracts/config.json index 73c34d158..93216b0e5 100644 --- a/examples/zkapps/07-oracles/contracts/config.json +++ b/examples/zkapps/07-oracles/contracts/config.json @@ -1,4 +1,4 @@ { "version": 1, "deployAliases": {} -} +} \ No newline at end of file diff --git a/examples/zkapps/09-recursion/config.json b/examples/zkapps/09-recursion/config.json index a6ba768fa..93216b0e5 100644 --- a/examples/zkapps/09-recursion/config.json +++ b/examples/zkapps/09-recursion/config.json @@ -1,4 +1,4 @@ { "version": 1, - "networks": {} -} + "deployAliases": {} +} \ No newline at end of file diff --git a/examples/zkapps/10-account-updates/src/ProofsOnlyZkApp.ts b/examples/zkapps/10-account-updates/src/ProofsOnlyZkApp.ts index e60f9f22b..48ac83ed4 100644 --- a/examples/zkapps/10-account-updates/src/ProofsOnlyZkApp.ts +++ b/examples/zkapps/10-account-updates/src/ProofsOnlyZkApp.ts @@ -34,8 +34,7 @@ export class ProofsOnlyZkApp extends SmartContract { } @method async init() { - this.account.provedState.getAndRequireEquals(); - this.account.provedState.get().assertFalse(); + this.account.provedState.getAndRequireEquals().assertFalse(); super.init(); this.num.set(Field(1)); @@ -43,8 +42,7 @@ export class ProofsOnlyZkApp extends SmartContract { } @method async add(incrementBy: Field) { - this.account.provedState.getAndRequireEquals(); - this.account.provedState.get().assertTrue(); + this.account.provedState.getAndRequireEquals().assertTrue(); const num = this.num.getAndRequireEquals(); this.num.set(num.add(incrementBy)); @@ -53,16 +51,14 @@ export class ProofsOnlyZkApp extends SmartContract { } @method async incrementCalls() { - this.account.provedState.getAndRequireEquals(); - this.account.provedState.get().assertTrue(); + this.account.provedState.getAndRequireEquals().assertTrue(); const calls = this.calls.getAndRequireEquals(); this.calls.set(calls.add(Field(1))); } @method async callSecondary(secondaryAddr: PublicKey) { - this.account.provedState.getAndRequireEquals(); - this.account.provedState.get().assertTrue(); + this.account.provedState.getAndRequireEquals().assertTrue(); const secondaryContract = new SecondaryZkApp(secondaryAddr); const num = this.num.getAndRequireEquals(); diff --git a/examples/zkapps/anonymous-message-board/src/message.ts b/examples/zkapps/anonymous-message-board/src/message.ts index 56cf38d18..42f67301a 100644 --- a/examples/zkapps/anonymous-message-board/src/message.ts +++ b/examples/zkapps/anonymous-message-board/src/message.ts @@ -53,22 +53,22 @@ export class Message extends SmartContract { const signerPublicKey = signerPrivateKey.toPublicKey(); // Get approved public keys - const user1 = this.user1.get(); - const user2 = this.user2.get(); - const user3 = this.user3.get(); + const user1 = this.user1.getAndRequireEquals(); + const user2 = this.user2.getAndRequireEquals(); + const user3 = this.user3.getAndRequireEquals(); // Assert that signerPublicKey is one of the approved public keys signerPublicKey .equals(user1) .or(signerPublicKey.equals(user2)) .or(signerPublicKey.equals(user3)) - .assertEquals(true); + .assertTrue(); // Update on-chain message state this.message.set(message); // Compute new messageHistoryHash - const oldHash = this.messageHistoryHash.get(); + const oldHash = this.messageHistoryHash.getAndRequireEquals(); const newHash = Poseidon.hash([message, oldHash]); // Update on-chain messageHistoryHash