From 760ebe61e3d7764579480389c6269931c218ddc0 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 22 Oct 2024 09:36:50 +0300 Subject: [PATCH 1/5] v2 fixes --- examples/zkapps/10-account-updates/package-lock.json | 9 +++++---- examples/zkapps/10-account-updates/package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/zkapps/10-account-updates/package-lock.json b/examples/zkapps/10-account-updates/package-lock.json index 6c3b7b988..c89b6600c 100644 --- a/examples/zkapps/10-account-updates/package-lock.json +++ b/examples/zkapps/10-account-updates/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -7358,9 +7358,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/10-account-updates/package.json b/examples/zkapps/10-account-updates/package.json index 27aacfe2f..a5cc5a817 100644 --- a/examples/zkapps/10-account-updates/package.json +++ b/examples/zkapps/10-account-updates/package.json @@ -44,6 +44,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } From e7fb424bec34ad5e8e8543c6602dd3baf1d34620 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 22 Oct 2024 09:37:17 +0300 Subject: [PATCH 2/5] v2 fixes --- docs/zkapps/o1js/recursion.mdx | 28 ++++----- docs/zkapps/tutorials/09-recursion.mdx | 6 +- .../zkapps/01-hello-world/package-lock.json | 9 +-- examples/zkapps/01-hello-world/package.json | 2 +- .../package-lock.json | 9 +-- .../package.json | 2 +- .../contracts/package-lock.json | 9 +-- .../contracts/package.json | 2 +- .../package-lock.json | 9 +-- .../package.json | 2 +- .../zkapps/07-oracles/contracts/package.json | 2 +- .../zkapps/09-recursion/package-lock.json | 9 +-- examples/zkapps/09-recursion/package.json | 2 +- examples/zkapps/09-recursion/src/Add.ts | 6 +- examples/zkapps/09-recursion/src/rollup.ts | 8 ++- examples/zkapps/09-recursion/src/vote.ts | 6 +- package-lock.json | 58 +++++++++++++++++++ package.json | 1 + 18 files changed, 119 insertions(+), 51 deletions(-) diff --git a/docs/zkapps/o1js/recursion.mdx b/docs/zkapps/o1js/recursion.mdx index fda80b2c0..22734729d 100644 --- a/docs/zkapps/o1js/recursion.mdx +++ b/docs/zkapps/o1js/recursion.mdx @@ -35,9 +35,9 @@ zkProgram is available as a top-level import. `Experimental.ZkProgram` is deprec In o1js, you can use `ZkProgram()` to define the steps of a recursive program. Like `SmartContract()` methods, `ZkProgram()` methods execute off-chain. -After performing the desired recursive steps, you can settle the interaction on Mina's blockchain by embedding `ZkProgram` within a `SmartContract` method that verifies the underlying proof of execution and extracts the output that can be used elsewhere in the method (like storing the output in app-state, for example). +After performing the desired recursive steps, you can settle the interaction on Mina's blockchain by embedding `ZkProgram` within a `SmartContract` method that verifies the underlying proof of execution and extracts the output that can be used elsewhere in the method (like storing the output in app-state, for example). -Similar to methods within the `SmartContract` class, inputs to `ZkProgram` are _private by default_ and are never seen by the Mina network. Unlike `SmartContract` methods, as the zkApp developer you choose the shape of the public input to all methods within a `ZkProgram`. +Similar to methods within the `SmartContract` class, inputs to `ZkProgram` are _private by default_ and are never seen by the Mina network. Unlike `SmartContract` methods, as the zkApp developer you choose the shape of the public input to all methods within a `ZkProgram`. ## Example: Recursively verify a simple program in a zkApp @@ -47,18 +47,18 @@ This simple example has only one method that proves the public input it received import { Field, ZkProgram } from 'o1js'; const SimpleProgram = ZkProgram({ - name: "simple-program-example", + name: 'simple-program-example', publicInput: Field, methods: { - run: { + run: { privateInputs: [], async method(publicInput: Field) { publicInput.assertEquals(Field(0)); }, - } - } + }, + }, }); ``` @@ -71,7 +71,7 @@ const { verificationKey } = await SimpleProgram.compile(); Now, you can use it to create a proof: ```typescript -const proof = await SimpleProgram.run(Field(0)); +const { proof } = await SimpleProgram.run(Field(0)); ``` To verify this proof from within any method of your `SmartContract` class: @@ -98,7 +98,7 @@ This program describes a recursive operation of adding one repeatedly to a numbe import { SelfProof, Field, ZkProgram, verify } from 'o1js'; const AddOne = ZkProgram({ - name: "add-one-example", + name: 'add-one-example', publicInput: Field, methods: { @@ -129,19 +129,19 @@ First, compile this program and make the base proof as before: ```typescript const { verificationKey } = await AddOne.compile(); -const proof = await AddOne.baseCase(Field(0)); +const { proof } = await AddOne.baseCase(Field(0)); ``` This time, use this proof as input to recursively add one again: ```typescript -const proof1 = await AddOne.step(Field(1), proof); +const { proof: proof1 } = await AddOne.step(Field(1), proof); ``` Repeat this as many times as you want: ```typescript -const proof2 = await AddOne.step(Field(2), proof1); +const { proof: proof2 } = await AddOne.step(Field(2), proof1); ``` Finally, verify the proof from within a SmartContract like the earlier example: @@ -164,14 +164,14 @@ This example program describes a very simple rollup for adding numbers: import { SelfProof, Field, ZkProgram, verify } from 'o1js'; let RollupAdd = ZkProgram({ - name: "rollup-add-example", + name: 'rollup-add-example', publicInput: Field, methods: { baseCase: { privateInputs: [], - async method(publicInput: Field) { }, + async method(publicInput: Field) {}, }, step: { @@ -199,7 +199,7 @@ You can also use ZkProgram directly to prove and verify arbitrary zero knowledge ```typescript const { verificationKey } = await MyProgram.compile(); -const proof = await MyProgram.base(Field(0)); +const { proof } = await MyProgram.base(Field(0)); ``` Now you can directly verify a JSON-encoded version of the proof to get back a boolean value that tells you if the proof is valid: diff --git a/docs/zkapps/tutorials/09-recursion.mdx b/docs/zkapps/tutorials/09-recursion.mdx index 9c8e726c5..f698432ca 100644 --- a/docs/zkapps/tutorials/09-recursion.mdx +++ b/docs/zkapps/tutorials/09-recursion.mdx @@ -199,15 +199,15 @@ async function main() { console.log('making proof 0'); - const proof0 = await Add.init(Field(0)); + const { proof: proof0 } = await Add.init(Field(0)); console.log('making proof 1'); - const proof1 = await Add.addNumber(Field(4), proof0, Field(4)); + const { proof: proof1 } = await Add.addNumber(Field(4), proof0, Field(4)); console.log('making proof 2'); - const proof2 = await Add.add(Field(4), proof1, proof0); + const { proof: proof2 } = await Add.add(Field(4), proof1, proof0); console.log('verifying proof 2'); console.log('proof 2 data', proof2.publicInput.toString()); diff --git a/examples/zkapps/01-hello-world/package-lock.json b/examples/zkapps/01-hello-world/package-lock.json index de3d8fe08..9de766590 100644 --- a/examples/zkapps/01-hello-world/package-lock.json +++ b/examples/zkapps/01-hello-world/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -7358,9 +7358,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/01-hello-world/package.json b/examples/zkapps/01-hello-world/package.json index c09a06ee7..cdf1b61c3 100644 --- a/examples/zkapps/01-hello-world/package.json +++ b/examples/zkapps/01-hello-world/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json b/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json index 97c523d19..0aa929182 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json +++ b/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -7358,9 +7358,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/package.json b/examples/zkapps/02-private-inputs-and-hash-functions/package.json index 8b607bd62..fe10131c3 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/package.json +++ b/examples/zkapps/02-private-inputs-and-hash-functions/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } diff --git a/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json b/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json index c05cafac2..05a63b5b7 100644 --- a/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json +++ b/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json @@ -25,7 +25,7 @@ "node": ">=18.14.0" }, "peerDependencies": { - "o1js": "^1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -6868,9 +6868,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/04-zkapp-browser-ui/contracts/package.json b/examples/zkapps/04-zkapp-browser-ui/contracts/package.json index d5876976a..f364eeab2 100644 --- a/examples/zkapps/04-zkapp-browser-ui/contracts/package.json +++ b/examples/zkapps/04-zkapp-browser-ui/contracts/package.json @@ -36,7 +36,7 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "^1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" }, "engines": { "node": ">=18.14.0" diff --git a/examples/zkapps/05-common-types-and-functions/package-lock.json b/examples/zkapps/05-common-types-and-functions/package-lock.json index 6b66436a4..d77cd462f 100644 --- a/examples/zkapps/05-common-types-and-functions/package-lock.json +++ b/examples/zkapps/05-common-types-and-functions/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.3" }, "peerDependencies": { - "o1js": "1.8.0" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -7358,9 +7358,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/05-common-types-and-functions/package.json b/examples/zkapps/05-common-types-and-functions/package.json index 37156d343..86d6e95a5 100644 --- a/examples/zkapps/05-common-types-and-functions/package.json +++ b/examples/zkapps/05-common-types-and-functions/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.3" }, "peerDependencies": { - "o1js": "1.8.0" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } diff --git a/examples/zkapps/07-oracles/contracts/package.json b/examples/zkapps/07-oracles/contracts/package.json index 88821d0d8..a7977b7a7 100644 --- a/examples/zkapps/07-oracles/contracts/package.json +++ b/examples/zkapps/07-oracles/contracts/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.0.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } diff --git a/examples/zkapps/09-recursion/package-lock.json b/examples/zkapps/09-recursion/package-lock.json index 1e000ca7f..d4351f5ef 100644 --- a/examples/zkapps/09-recursion/package-lock.json +++ b/examples/zkapps/09-recursion/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } }, "node_modules/@ampproject/remapping": { @@ -7358,9 +7358,10 @@ } }, "node_modules/o1js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.8.0.tgz", - "integrity": "sha512-mN0aM4HW3kyl/Gx0irqKQSQ2JftbmsK2t5nSZpTuNgTOVl0wQ6KZumXXps6E5hGkCjRfk+FjlL7CBsmqKqzYzg==", + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/09-recursion/package.json b/examples/zkapps/09-recursion/package.json index 98010ddcb..a3ada9876 100644 --- a/examples/zkapps/09-recursion/package.json +++ b/examples/zkapps/09-recursion/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.*" + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" } } diff --git a/examples/zkapps/09-recursion/src/Add.ts b/examples/zkapps/09-recursion/src/Add.ts index 9fd170ed8..c6531e433 100644 --- a/examples/zkapps/09-recursion/src/Add.ts +++ b/examples/zkapps/09-recursion/src/Add.ts @@ -51,15 +51,15 @@ async function main() { console.log('making proof 0'); - const proof0 = await Add.init(Field(0)); + const { proof: proof0 } = await Add.init(Field(0)); console.log('making proof 1'); - const proof1 = await Add.addNumber(Field(4), proof0, Field(4)); + const { proof: proof1 } = await Add.addNumber(Field(4), proof0, Field(4)); console.log('making proof 2'); - const proof2 = await Add.add(Field(4), proof1, proof0); + const { proof: proof2 } = await Add.add(Field(4), proof1, proof0); console.log('verifying proof 2'); console.log('proof 2 data', proof2.publicInput.toString()); diff --git a/examples/zkapps/09-recursion/src/rollup.ts b/examples/zkapps/09-recursion/src/rollup.ts index 2d4e4c94f..5423f0a7c 100644 --- a/examples/zkapps/09-recursion/src/rollup.ts +++ b/examples/zkapps/09-recursion/src/rollup.ts @@ -84,7 +84,7 @@ async function main() { increment, witness ); - const proof = await Rollup.oneStep( + const { proof } = await Rollup.oneStep( rollup, initialRoot, latestRoot, @@ -110,7 +110,11 @@ async function main() { proof.publicInput, rollupProofs[i].publicInput ); - let mergedProof = await Rollup.merge(rollup, proof, rollupProofs[i]); + let { proof: mergedProof } = await Rollup.merge( + rollup, + proof, + rollupProofs[i] + ); proof = mergedProof; } diff --git a/examples/zkapps/09-recursion/src/vote.ts b/examples/zkapps/09-recursion/src/vote.ts index def718d9e..9fc04366a 100644 --- a/examples/zkapps/09-recursion/src/vote.ts +++ b/examples/zkapps/09-recursion/src/vote.ts @@ -33,7 +33,7 @@ async function main() { ); const vote0 = VoteState.newVote(votersTree.getRoot()); - const proof0 = await Vote.create(vote0); + const { proof: proof0 } = await Vote.create(vote0); console.log('making proof 1'); @@ -51,7 +51,7 @@ async function main() { voterTreeWitness1, nullifierWitness1 ); - const proof1 = await Vote.applyVote( + const { proof: proof1 } = await Vote.applyVote( vote1, proof0, Bool(true), @@ -77,7 +77,7 @@ async function main() { voterTreeWitness2, nullifierWitness2 ); - const proof2 = await Vote.applyVote( + const { proof: proof2 } = await Vote.applyVote( vote2, proof1, Bool(false), diff --git a/package-lock.json b/package-lock.json index be3a6ac37..ce4f5426c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "hast-util-is-element": "1.1.0", + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d", "prism-react-renderer": "^1.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -5020,6 +5021,11 @@ "node": ">=8" } }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -5212,6 +5218,14 @@ "node": ">=8" } }, + "node_modules/cachedir": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", + "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -8967,6 +8981,15 @@ "node": ">=0.10.0" } }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "node_modules/jest-util": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz", @@ -9031,6 +9054,11 @@ "@sideway/pinpoint": "^2.0.0" } }, + "node_modules/js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -9775,6 +9803,26 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/o1js": { + "version": "1.9.1", + "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", + "license": "Apache-2.0", + "dependencies": { + "blakejs": "1.2.1", + "cachedir": "^2.4.0", + "isomorphic-fetch": "^3.0.0", + "js-sha256": "^0.9.0", + "reflect-metadata": "^0.1.13", + "tslib": "^2.3.0" + }, + "bin": { + "snarky-run": "src/build/run.js" + }, + "engines": { + "node": ">=18.14.0" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -11529,6 +11577,11 @@ "node": ">=6.0.0" } }, + "node_modules/reflect-metadata": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" + }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -14614,6 +14667,11 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", diff --git a/package.json b/package.json index 82617eb62..998b5ca9b 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "hast-util-is-element": "1.1.0", + "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d", "prism-react-renderer": "^1.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", From 800d74e16d3c8019419eda2bf00b1bd15ca58c89 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 22 Oct 2024 10:02:04 +0300 Subject: [PATCH 3/5] fix ci too --- .github/workflows/o1js-api-reference.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/o1js-api-reference.yml b/.github/workflows/o1js-api-reference.yml index 3ef84ae2c..6a20d1f00 100644 --- a/.github/workflows/o1js-api-reference.yml +++ b/.github/workflows/o1js-api-reference.yml @@ -29,7 +29,7 @@ jobs: run: | # Install dependencies and build o1js cd o1js - git submodule update --init --recursive + GIT_LFS_SKIP_SMUDGE=1 git submodule update --init --recursive npm ci && npm run build cd src/mina-signer && npm ci && npm run build && cd ../../ From c8fa008b77d87dbef291296f471f73077abfdaee Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 22 Oct 2024 10:43:47 +0300 Subject: [PATCH 4/5] fix o1js version --- examples/zkapps/01-hello-world/package-lock.json | 9 ++++----- examples/zkapps/01-hello-world/package.json | 2 +- .../package-lock.json | 9 ++++----- .../02-private-inputs-and-hash-functions/package.json | 2 +- .../04-zkapp-browser-ui/contracts/package-lock.json | 9 ++++----- .../zkapps/04-zkapp-browser-ui/contracts/package.json | 2 +- .../05-common-types-and-functions/package-lock.json | 9 ++++----- .../zkapps/05-common-types-and-functions/package.json | 2 +- examples/zkapps/07-oracles/contracts/package-lock.json | 8 ++++---- examples/zkapps/07-oracles/contracts/package.json | 2 +- examples/zkapps/09-recursion/package-lock.json | 9 ++++----- examples/zkapps/09-recursion/package.json | 2 +- examples/zkapps/10-account-updates/package-lock.json | 9 ++++----- examples/zkapps/10-account-updates/package.json | 2 +- package-lock.json | 9 ++++----- package.json | 2 +- 16 files changed, 40 insertions(+), 47 deletions(-) diff --git a/examples/zkapps/01-hello-world/package-lock.json b/examples/zkapps/01-hello-world/package-lock.json index 9de766590..aaf6b654d 100644 --- a/examples/zkapps/01-hello-world/package-lock.json +++ b/examples/zkapps/01-hello-world/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7358,10 +7358,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/01-hello-world/package.json b/examples/zkapps/01-hello-world/package.json index cdf1b61c3..38bd21a2e 100644 --- a/examples/zkapps/01-hello-world/package.json +++ b/examples/zkapps/01-hello-world/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json b/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json index 0aa929182..224c6f169 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json +++ b/examples/zkapps/02-private-inputs-and-hash-functions/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7358,10 +7358,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/02-private-inputs-and-hash-functions/package.json b/examples/zkapps/02-private-inputs-and-hash-functions/package.json index fe10131c3..bac464f13 100644 --- a/examples/zkapps/02-private-inputs-and-hash-functions/package.json +++ b/examples/zkapps/02-private-inputs-and-hash-functions/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json b/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json index 05a63b5b7..49701f6a9 100644 --- a/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json +++ b/examples/zkapps/04-zkapp-browser-ui/contracts/package-lock.json @@ -25,7 +25,7 @@ "node": ">=18.14.0" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -6868,10 +6868,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/04-zkapp-browser-ui/contracts/package.json b/examples/zkapps/04-zkapp-browser-ui/contracts/package.json index f364eeab2..4faca4f5e 100644 --- a/examples/zkapps/04-zkapp-browser-ui/contracts/package.json +++ b/examples/zkapps/04-zkapp-browser-ui/contracts/package.json @@ -36,7 +36,7 @@ "typescript": "^5.6" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" }, "engines": { "node": ">=18.14.0" diff --git a/examples/zkapps/05-common-types-and-functions/package-lock.json b/examples/zkapps/05-common-types-and-functions/package-lock.json index d77cd462f..ff0343b20 100644 --- a/examples/zkapps/05-common-types-and-functions/package-lock.json +++ b/examples/zkapps/05-common-types-and-functions/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.3" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7358,10 +7358,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/05-common-types-and-functions/package.json b/examples/zkapps/05-common-types-and-functions/package.json index 86d6e95a5..8035ab0fc 100644 --- a/examples/zkapps/05-common-types-and-functions/package.json +++ b/examples/zkapps/05-common-types-and-functions/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.3" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/examples/zkapps/07-oracles/contracts/package-lock.json b/examples/zkapps/07-oracles/contracts/package-lock.json index 1377eb8ac..3de45f8e7 100644 --- a/examples/zkapps/07-oracles/contracts/package-lock.json +++ b/examples/zkapps/07-oracles/contracts/package-lock.json @@ -23,7 +23,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "1.0.*" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7342,9 +7342,9 @@ } }, "node_modules/o1js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/o1js/-/o1js-1.0.1.tgz", - "integrity": "sha512-af+HS1zdJeMwvXvsb4U7PgpuBDTB40ziQHGRQQXOUzOLCA+CyV+ouUDfg7P4DS2ocS0M+M2mQZkuuxXc5ZSM5w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/07-oracles/contracts/package.json b/examples/zkapps/07-oracles/contracts/package.json index a7977b7a7..6d1993ea0 100644 --- a/examples/zkapps/07-oracles/contracts/package.json +++ b/examples/zkapps/07-oracles/contracts/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/examples/zkapps/09-recursion/package-lock.json b/examples/zkapps/09-recursion/package-lock.json index d4351f5ef..c008d6b1f 100644 --- a/examples/zkapps/09-recursion/package-lock.json +++ b/examples/zkapps/09-recursion/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7358,10 +7358,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/09-recursion/package.json b/examples/zkapps/09-recursion/package.json index a3ada9876..406386f5a 100644 --- a/examples/zkapps/09-recursion/package.json +++ b/examples/zkapps/09-recursion/package.json @@ -43,6 +43,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/examples/zkapps/10-account-updates/package-lock.json b/examples/zkapps/10-account-updates/package-lock.json index c89b6600c..71662f782 100644 --- a/examples/zkapps/10-account-updates/package-lock.json +++ b/examples/zkapps/10-account-updates/package-lock.json @@ -24,7 +24,7 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -7358,10 +7358,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "peer": true, "dependencies": { "blakejs": "1.2.1", diff --git a/examples/zkapps/10-account-updates/package.json b/examples/zkapps/10-account-updates/package.json index a5cc5a817..7eb622c5b 100644 --- a/examples/zkapps/10-account-updates/package.json +++ b/examples/zkapps/10-account-updates/package.json @@ -44,6 +44,6 @@ "typescript": "^5.6.2" }, "peerDependencies": { - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d" + "o1js": "^2.0.0" } } diff --git a/package-lock.json b/package-lock.json index ce4f5426c..7653bffb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "hast-util-is-element": "1.1.0", - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "o1js": "^2.0.0", "prism-react-renderer": "^1.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -9804,10 +9804,9 @@ } }, "node_modules/o1js": { - "version": "1.9.1", - "resolved": "https://pkg.pr.new/o1-labs/o1js@b04520d", - "integrity": "sha512-/yOZory+3Uo95A6uHxZQY0s3lZCKDwvdrnY/iNZkBhCde0rbI/KM9EjXa2jcZBHtbreUjHccs5g6pbj6PLR4wQ==", - "license": "Apache-2.0", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/o1js/-/o1js-2.0.0.tgz", + "integrity": "sha512-mYCxUkdCgmfF4v8JOTreYJP/PsAUXGkAbDZJn1uRxWlfZ+Eepls1O2fpTKQ5W9DC64vu0LlQZp9uqWKxW4lrVQ==", "dependencies": { "blakejs": "1.2.1", "cachedir": "^2.4.0", diff --git a/package.json b/package.json index 998b5ca9b..6921cf9cf 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "hast-util-is-element": "1.1.0", - "o1js": "https://pkg.pr.new/o1-labs/o1js@b04520d", + "o1js": "^2.0.0", "prism-react-renderer": "^1.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", From 334dbfd360a38fd5aa39673357baa3263cc9302c Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 22 Oct 2024 08:03:11 +0000 Subject: [PATCH 5/5] Build and publish new o1js API reference docs --- docs/zkapps/o1js-reference/README.mdx | 21 +- .../o1js-reference/classes/AccountUpdate.mdx | 484 ++- .../classes/AccountUpdateForest.mdx | 554 +-- .../classes/AccountUpdateTree.mdx | 309 +- .../classes/AlmostForeignField.mdx | 84 +- .../classes/BaseMerkleWitness.mdx | 82 +- docs/zkapps/o1js-reference/classes/Bool.mdx | 78 +- .../classes/CanonicalForeignField.mdx | 84 +- .../o1js-reference/classes/Character.mdx | 147 +- .../zkapps/o1js-reference/classes/Circuit.mdx | 8 +- .../o1js-reference/classes/CircuitString.mdx | 107 +- .../o1js-reference/classes/DynamicProof.mdx | 138 +- .../o1js-reference/classes/EcdsaSignature.mdx | 218 +- .../classes/EcdsaSignatureV2.mdx | 509 --- docs/zkapps/o1js-reference/classes/Field.mdx | 108 +- .../o1js-reference/classes/ForeignCurve.mdx | 214 +- .../o1js-reference/classes/ForeignCurveV2.mdx | 665 ---- .../o1js-reference/classes/ForeignField.mdx | 78 +- docs/zkapps/o1js-reference/classes/Group.mdx | 54 +- docs/zkapps/o1js-reference/classes/Hashed.mdx | 34 +- docs/zkapps/o1js-reference/classes/Int64.mdx | 442 ++- .../zkapps/o1js-reference/classes/Keypair.mdx | 8 +- docs/zkapps/o1js-reference/classes/Ledger.mdx | 8 +- .../o1js-reference/classes/MerkleList.mdx | 109 +- .../classes/MerkleListIterator.mdx | 66 +- .../o1js-reference/classes/MerkleMap.mdx | 14 +- .../classes/MerkleMapWitness.mdx | 102 +- .../o1js-reference/classes/MerkleTree.mdx | 26 +- .../o1js-reference/classes/Nullifier.mdx | 202 +- docs/zkapps/o1js-reference/classes/Packed.mdx | 68 +- .../o1js-reference/classes/PrivateKey.mdx | 90 +- docs/zkapps/o1js-reference/classes/Proof.mdx | 128 +- .../o1js-reference/classes/ProofBase.mdx | 116 +- .../o1js-reference/classes/PublicKey.mdx | 90 +- docs/zkapps/o1js-reference/classes/Scalar.mdx | 100 +- .../o1js-reference/classes/ScalarField.mdx | 972 ++++++ .../o1js-reference/classes/SelfProof.mdx | 128 +- docs/zkapps/o1js-reference/classes/Sign.mdx | 86 +- .../o1js-reference/classes/Signature.mdx | 82 +- .../o1js-reference/classes/SmartContract.mdx | 100 +- .../classes/TokenAccountUpdateIterator.mdx | 18 +- .../o1js-reference/classes/TokenContract.mdx | 135 +- .../o1js-reference/classes/TokenSymbol.mdx | 98 +- docs/zkapps/o1js-reference/classes/UInt32.mdx | 245 +- docs/zkapps/o1js-reference/classes/UInt64.mdx | 187 +- docs/zkapps/o1js-reference/classes/UInt8.mdx | 169 +- .../o1js-reference/classes/Unconstrained.mdx | 24 +- .../classes/VerificationKey.mdx | 117 +- .../zkapps/o1js-reference/functions/Bytes.mdx | 2 +- .../functions/ConstantField.mdx | 2 +- .../functions/MerkleListBase.mdx | 2 +- .../functions/MerkleWitness.mdx | 2 +- .../o1js-reference/functions/Option.mdx | 8 +- .../o1js-reference/functions/Reducer.mdx | 2 +- .../zkapps/o1js-reference/functions/State.mdx | 2 +- .../o1js-reference/functions/Struct.mdx | 6 +- .../o1js-reference/functions/VarField.mdx | 2 +- .../o1js-reference/functions/WithHash.mdx | 2 +- .../o1js-reference/functions/ZkProgram.mdx | 61 +- .../functions/addCachedAccount.mdx | 2 +- .../o1js-reference/functions/assert.mdx | 2 +- .../functions/checkBitLength.mdx | 2 +- .../functions/checkZkappTransaction.mdx | 2 +- .../o1js-reference/functions/circuitMain.mdx | 2 +- .../functions/conditionalSwap.mdx | 2 +- .../o1js-reference/functions/createEcdsa.mdx | 8 +- .../functions/createEcdsaV2.mdx | 17 - .../functions/createForeignCurve.mdx | 20 +- .../functions/createForeignCurveV2.mdx | 29 - .../functions/createForeignField.mdx | 8 +- .../functions/declareMethods.mdx | 2 +- .../o1js-reference/functions/declareState.mdx | 2 +- .../o1js-reference/functions/fetchAccount.mdx | 2 +- .../o1js-reference/functions/fetchEvents.mdx | 2 +- .../functions/fetchLastBlock.mdx | 2 +- .../functions/fetchTransactionStatus.mdx | 2 +- .../o1js-reference/functions/genericHash.mdx | 2 +- .../functions/initializeBindings.mdx | 2 +- .../functions/merkleListHash.mdx | 2 +- .../o1js-reference/functions/method.mdx | 2 +- .../o1js-reference/functions/provable.mdx | 4 +- .../o1js-reference/functions/provablePure.mdx | 2 +- .../o1js-reference/functions/public.mdx | 2 +- .../functions/readVarMessage.mdx | 2 +- .../o1js-reference/functions/sendZkapp.mdx | 2 +- .../functions/setArchiveGraphqlEndpoint.mdx | 2 +- .../functions/setGraphqlEndpoint.mdx | 2 +- .../functions/setGraphqlEndpoints.mdx | 2 +- .../functions/setNumberOfWorkers.mdx | 2 +- .../o1js-reference/functions/state-1.mdx | 6 +- .../functions/toConstantField.mdx | 2 +- docs/zkapps/o1js-reference/functions/toFp.mdx | 2 +- .../o1js-reference/functions/verify.mdx | 2 +- .../o1js-reference/functions/withHashes.mdx | 2 +- .../o1js-reference/functions/withMessage.mdx | 2 +- .../o1js-reference/interfaces/Permissions.mdx | 26 +- .../namespaces/Crypto/type-aliases/Curve.mdx | 2 +- .../Crypto/type-aliases/CurveParams.mdx | 2 +- .../namespaces/Encryption/README.mdx | 8 +- .../Encryption/functions/decrypt.mdx | 6 +- .../Encryption/functions/decryptBytes.mdx | 19 + .../Encryption/functions/encrypt.mdx | 28 +- .../Encryption/functions/encryptBytes.mdx | 19 + .../Encryption/type-aliases/CipherText.mdx | 24 + .../type-aliases/CipherTextBytes.mdx | 17 + .../namespaces/Experimental/README.mdx | 3 + .../Experimental/classes/BatchReducer.mdx | 3101 +++++++++++++++++ .../classes/OffchainStateCommitments.mdx | 194 +- .../Experimental/functions/ActionBatch.mdx | 719 ++++ .../functions/IndexedMerkleMap.mdx | 4 +- .../Experimental/functions/OffchainState.mdx | 2 +- .../Experimental/functions/memoizeWitness.mdx | 2 +- .../Experimental/type-aliases/ActionBatch.mdx | 11 + .../type-aliases/IndexedMerkleMap.mdx | 2 +- .../Lightnet/functions/acquireKeyPair.mdx | 2 +- .../functions/listAcquiredKeyPairs.mdx | 2 +- .../Lightnet/functions/releaseKeyPair.mdx | 2 +- .../Mina/functions/LocalBlockchain.mdx | 10 +- .../namespaces/Mina/functions/Network.mdx | 4 +- .../Mina/functions/TestPublicKey.mdx | 2 +- .../namespaces/Mina/functions/currentSlot.mdx | 2 +- .../Mina/functions/currentTransaction.mdx | 2 +- .../namespaces/Mina/functions/faucet.mdx | 2 +- .../Mina/functions/fetchActions.mdx | 2 +- .../namespaces/Mina/functions/fetchEvents.mdx | 2 +- .../Mina/functions/filterGroups.mdx | 2 +- .../namespaces/Mina/functions/getAccount.mdx | 2 +- .../namespaces/Mina/functions/getActions.mdx | 2 +- .../namespaces/Mina/functions/getBalance.mdx | 2 +- .../Mina/functions/getNetworkConstants.mdx | 2 +- .../Mina/functions/getNetworkId.mdx | 2 +- .../Mina/functions/getNetworkState.mdx | 2 +- .../Mina/functions/getProofsEnabled.mdx | 2 +- .../namespaces/Mina/functions/hasAccount.mdx | 2 +- .../namespaces/Mina/functions/sender.mdx | 2 +- .../Mina/functions/setActiveInstance.mdx | 2 +- .../namespaces/Mina/functions/transaction.mdx | 4 +- .../Mina/functions/waitForFunding.mdx | 2 +- .../Mina/namespaces/TestPublicKey/README.mdx | 1 + .../TestPublicKey/functions/fromBase58.mdx | 15 + .../TestPublicKey/functions/random.mdx | 4 +- .../Transaction/functions/fromJSON.mdx | 2 +- .../Mina/type-aliases/ActionStates.mdx | 2 +- .../Mina/type-aliases/FeePayerSpec.mdx | 2 +- .../Mina/type-aliases/IncludedTransaction.mdx | 2 +- .../Mina/type-aliases/NetworkConstants.mdx | 2 +- .../Mina/type-aliases/PendingTransaction.mdx | 2 +- .../PendingTransactionPromise.mdx | 2 +- .../type-aliases/PendingTransactionStatus.mdx | 2 +- .../Mina/type-aliases/RejectedTransaction.mdx | 2 +- .../Mina/type-aliases/TestPublicKey.mdx | 2 +- .../Mina/type-aliases/Transaction.mdx | 2 +- .../Mina/variables/activeInstance.mdx | 2 +- .../o1js-reference/type-aliases/Account.mdx | 2 +- .../o1js-reference/type-aliases/Bool.mdx | 2 +- .../o1js-reference/type-aliases/BoolVar.mdx | 2 +- .../o1js-reference/type-aliases/Bytes.mdx | 2 +- .../o1js-reference/type-aliases/Cache.mdx | 2 +- .../type-aliases/CacheHeader.mdx | 4 +- .../type-aliases/ConstantField.mdx | 2 +- .../type-aliases/DeployArgs.mdx | 2 +- .../o1js-reference/type-aliases/Empty.mdx | 2 +- .../type-aliases/FeatureFlags.mdx | 2 +- .../o1js-reference/type-aliases/Field.mdx | 2 +- .../type-aliases/FlexibleProvable.mdx | 2 +- .../type-aliases/FlexibleProvablePure.mdx | 2 +- .../o1js-reference/type-aliases/Group.mdx | 2 +- .../type-aliases/InferProvable.mdx | 2 +- .../o1js-reference/type-aliases/JsonProof.mdx | 2 +- .../type-aliases/MerkleListBase.mdx | 2 +- .../type-aliases/MerkleListIteratorBase.mdx | 2 +- .../o1js-reference/type-aliases/Option.mdx | 2 +- .../o1js-reference/type-aliases/Provable.mdx | 32 +- .../type-aliases/ProvableExtended.mdx | 2 +- .../type-aliases/ProvableHashable-1.mdx | 31 + .../type-aliases/ProvableHashable.mdx | 2 +- .../type-aliases/ProvablePure.mdx | 2 +- .../type-aliases/ProvableType.mdx | 13 + .../type-aliases/ProvableTypePure.mdx | 13 + .../type-aliases/ProvableWithEmpty.mdx | 27 + .../o1js-reference/type-aliases/Reducer.mdx | 2 +- .../type-aliases/ScalarConst.mdx | 2 +- .../o1js-reference/type-aliases/State.mdx | 20 +- .../o1js-reference/type-aliases/Struct.mdx | 2 +- .../type-aliases/ToProvable.mdx | 13 + .../type-aliases/TransactionPromise.mdx | 2 +- .../type-aliases/TransactionStatus.mdx | 2 +- .../o1js-reference/type-aliases/TupleN.mdx | 15 + .../o1js-reference/type-aliases/Undefined.mdx | 2 +- .../o1js-reference/type-aliases/VarField.mdx | 2 +- .../o1js-reference/type-aliases/Void.mdx | 2 +- .../o1js-reference/type-aliases/WithHash.mdx | 2 +- .../type-aliases/WithProvable.mdx | 13 + .../o1js-reference/type-aliases/Witness.mdx | 2 +- .../o1js-reference/type-aliases/ZkProgram.mdx | 13 +- .../type-aliases/ZkappPublicInput.mdx | 2 +- .../o1js-reference/variables/Account.mdx | 2 +- docs/zkapps/o1js-reference/variables/Bool.mdx | 2 +- .../zkapps/o1js-reference/variables/Cache.mdx | 2 +- .../o1js-reference/variables/Crypto.mdx | 2 +- .../zkapps/o1js-reference/variables/Empty.mdx | 2 +- .../o1js-reference/variables/FeatureFlags.mdx | 2 +- .../zkapps/o1js-reference/variables/Field.mdx | 2 +- .../o1js-reference/variables/Gadgets.mdx | 245 +- .../zkapps/o1js-reference/variables/Group.mdx | 2 +- docs/zkapps/o1js-reference/variables/Hash.mdx | 25 +- .../o1js-reference/variables/Keccak.mdx | 2 +- .../o1js-reference/variables/Permissions.mdx | 2 +- .../o1js-reference/variables/Poseidon.mdx | 4 +- .../o1js-reference/variables/ProvableType.mdx | 42 + .../o1js-reference/variables/TokenId.mdx | 2 +- .../variables/TransactionVersion.mdx | 2 +- .../o1js-reference/variables/TupleN.mdx | 67 + .../o1js-reference/variables/Undefined.mdx | 2 +- docs/zkapps/o1js-reference/variables/Void.mdx | 2 +- .../variables/ZkappPublicInput.mdx | 2 +- .../o1js-reference/variables/emptyHash.mdx | 2 +- sidebars.js | 116 +- 218 files changed, 9792 insertions(+), 3437 deletions(-) delete mode 100644 docs/zkapps/o1js-reference/classes/EcdsaSignatureV2.mdx delete mode 100644 docs/zkapps/o1js-reference/classes/ForeignCurveV2.mdx create mode 100644 docs/zkapps/o1js-reference/classes/ScalarField.mdx delete mode 100644 docs/zkapps/o1js-reference/functions/createEcdsaV2.mdx delete mode 100644 docs/zkapps/o1js-reference/functions/createForeignCurveV2.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Experimental/classes/BatchReducer.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Experimental/functions/ActionBatch.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch.mdx create mode 100644 docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/ProvableHashable-1.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/ProvableType.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/ProvableTypePure.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/ProvableWithEmpty.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/ToProvable.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/TupleN.mdx create mode 100644 docs/zkapps/o1js-reference/type-aliases/WithProvable.mdx create mode 100644 docs/zkapps/o1js-reference/variables/ProvableType.mdx create mode 100644 docs/zkapps/o1js-reference/variables/TupleN.mdx diff --git a/docs/zkapps/o1js-reference/README.mdx b/docs/zkapps/o1js-reference/README.mdx index bd78c4437..534592e4a 100644 --- a/docs/zkapps/o1js-reference/README.mdx +++ b/docs/zkapps/o1js-reference/README.mdx @@ -6,7 +6,7 @@ keywords: - Reference --- -# o1js   [![npm version](https://img.shields.io/npm/v/o1js.svg?style=flat)](https://www.npmjs.com/package/o1js) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/o1-labs/o1js/blob/main/CONTRIBUTING.md) +# o1js   [![npm version](https://img.shields.io/npm/v/o1js.svg?style=flat)](https://www.npmjs.com/package/o1js) [![npm](https://img.shields.io/npm/dm/o1js)](https://www.npmjs.com/package/o1js) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/o1-labs/o1js/blob/main/CONTRIBUTING.md) ℹ️ **o1js** is an evolution of [SnarkyJS](https://www.npmjs.com/package/snarkyjs) which saw 49 updated versions over two years of development with 43,141 downloads. @@ -64,6 +64,7 @@ High-quality community packages from open source developers are available for yo - **o1js-elgamal** A partially homomorphic encryption library for o1js based on Elgamal encryption: [GitHub](https://github.com/Trivo25/o1js-elgamal) and [npm](https://www.npmjs.com/package/o1js-elgamal) - **o1js-pack** A library for o1js that allows a zkApp developer to pack extra data into a single Field. [GitHub](https://github.com/45930/o1js-pack) and [npm](https://www.npmjs.com/package/o1js-pack) +- **zk-regex-o1js** A CLI tool for compiling ZK Regex circuits in o1js. [Github](https://github.com/Shigoto-dev19/zk-regex-o1js) and [npm](https://www.npmjs.com/package/zk-regex-o1js) To include your package, see [Creating high-quality community packages](https://github.com/o1-labs/o1js/blob/main/CONTRIBUTING.md#creating-high-quality-community-packages). @@ -86,10 +87,8 @@ To include your package, see [Creating high-quality community packages](https:// | [CircuitString](classes/CircuitString.mdx) | - | | [DynamicProof](classes/DynamicProof.mdx) | The `DynamicProof` class enables circuits to verify proofs using in-ciruit verfication keys. | | [EcdsaSignature](classes/EcdsaSignature.mdx) | - | -| [EcdsaSignatureV2](classes/EcdsaSignatureV2.mdx) | - | | [Field](classes/Field.mdx) | A [Field](classes/Field.mdx) is an element of a prime order [finite field](https://en.wikipedia.org/wiki/Finite_field). | | [ForeignCurve](classes/ForeignCurve.mdx) | - | -| [ForeignCurveV2](classes/ForeignCurveV2.mdx) | - | | [ForeignField](classes/ForeignField.mdx) | - | | [Group](classes/Group.mdx) | An element of a Group. | | [Hashed](classes/Hashed.mdx) | `Hashed` represents a type `T` by its hash. | @@ -108,6 +107,7 @@ To include your package, see [Creating high-quality community packages](https:// | [ProofBase](classes/ProofBase.mdx) | - | | [PublicKey](classes/PublicKey.mdx) | A public key, which is also an address on the Mina network. | | [Scalar](classes/Scalar.mdx) | Represents a [Scalar](classes/Scalar.mdx). | +| [ScalarField](classes/ScalarField.mdx) | ForeignField representing the scalar field of Pallas and the base field of Vesta | | [SelfProof](classes/SelfProof.mdx) | - | | [Sign](classes/Sign.mdx) | - | | [Signature](classes/Signature.mdx) | A Schnorr [Signature](classes/Signature.mdx) over the Pasta Curves. | @@ -143,17 +143,24 @@ To include your package, see [Creating high-quality community packages](https:// | [Provable](type-aliases/Provable.mdx) | `Provable` is the general interface for provable types in o1js. | | [ProvableExtended](type-aliases/ProvableExtended.mdx) | - | | [ProvableHashable](type-aliases/ProvableHashable.mdx) | - | +| [ProvableHashable](type-aliases/ProvableHashable-1.mdx) | - | | [ProvablePure](type-aliases/ProvablePure.mdx) | `ProvablePure` is a special kind of [Provable](type-aliases/Provable.mdx) interface, where the "auxiliary" (non-provable) data is empty. | +| [ProvableType](type-aliases/ProvableType.mdx) | - | +| [ProvableTypePure](type-aliases/ProvableTypePure.mdx) | - | +| [ProvableWithEmpty](type-aliases/ProvableWithEmpty.mdx) | - | | [Reducer](type-aliases/Reducer.mdx) | - | | [ScalarConst](type-aliases/ScalarConst.mdx) | - | | [State](type-aliases/State.mdx) | Gettable and settable state that can be checked for equality. | | [Struct](type-aliases/Struct.mdx) | - | +| [ToProvable](type-aliases/ToProvable.mdx) | - | | [TransactionPromise](type-aliases/TransactionPromise.mdx) | A `Promise` with some additional methods for making chained method calls | | [TransactionStatus](type-aliases/TransactionStatus.mdx) | INCLUDED: A transaction that is on the longest chain | +| [TupleN](type-aliases/TupleN.mdx) | tuple type that has the length as generic parameter | | [Undefined](type-aliases/Undefined.mdx) | - | | [VarField](type-aliases/VarField.mdx) | - | | [Void](type-aliases/Void.mdx) | - | | [WithHash](type-aliases/WithHash.mdx) | - | +| [WithProvable](type-aliases/WithProvable.mdx) | - | | [Witness](type-aliases/Witness.mdx) | - | | [ZkProgram](type-aliases/ZkProgram.mdx) | - | | [ZkappPublicInput](type-aliases/ZkappPublicInput.mdx) | The public input for zkApps consists of certain hashes of the proving | @@ -170,8 +177,10 @@ To include your package, see [Creating high-quality community packages](https:// | [Keccak](variables/Keccak.mdx) | - | | [Permissions](variables/Permissions.mdx) | - | | [Poseidon](variables/Poseidon.mdx) | - | +| [ProvableType](variables/ProvableType.mdx) | - | | [TokenId](variables/TokenId.mdx) | - | | [TransactionVersion](variables/TransactionVersion.mdx) | - | +| [TupleN](variables/TupleN.mdx) | - | | [Undefined](variables/Undefined.mdx) | - | | [Void](variables/Void.mdx) | - | | [ZkappPublicInput](variables/ZkappPublicInput.mdx) | - | @@ -193,10 +202,8 @@ To include your package, see [Creating high-quality community packages](https:// | [checkZkappTransaction](functions/checkZkappTransaction.mdx) | - | | [circuitMain](functions/circuitMain.mdx) | - | | [conditionalSwap](functions/conditionalSwap.mdx) | - | -| [createEcdsa](functions/createEcdsa.mdx) | - | -| [createEcdsaV2](functions/createEcdsaV2.mdx) | Create a class [EcdsaSignatureV2](classes/EcdsaSignatureV2.mdx) for verifying ECDSA signatures on the given curve. | -| [createForeignCurve](functions/createForeignCurve.mdx) | - | -| [createForeignCurveV2](functions/createForeignCurveV2.mdx) | Create a class representing an elliptic curve group, which is different from the native [Group](classes/Group.mdx). | +| [createEcdsa](functions/createEcdsa.mdx) | Create a class [EcdsaSignature](classes/EcdsaSignature.mdx) for verifying ECDSA signatures on the given curve. | +| [createForeignCurve](functions/createForeignCurve.mdx) | Create a class representing an elliptic curve group, which is different from the native [Group](classes/Group.mdx). | | [createForeignField](functions/createForeignField.mdx) | Create a class representing a prime order finite field, which is different from the native [Field](classes/Field.mdx). | | [declareMethods](functions/declareMethods.mdx) | `declareMethods` can be used in place of the `@method` decorator | | [declareState](functions/declareState.mdx) | `declareState` can be used in place of the `@state` decorator to declare on-chain state on a SmartContract. | diff --git a/docs/zkapps/o1js-reference/classes/AccountUpdate.mdx b/docs/zkapps/o1js-reference/classes/AccountUpdate.mdx index 2207aea59..3d4d6db6b 100644 --- a/docs/zkapps/o1js-reference/classes/AccountUpdate.mdx +++ b/docs/zkapps/o1js-reference/classes/AccountUpdate.mdx @@ -26,7 +26,7 @@ new AccountUpdate(body: Body, authorization?: {}): AccountUpdate #### Source -[lib/mina/account-update.ts:679](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L679) +[lib/mina/account-update.ts:703](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L703) ## Properties @@ -38,7 +38,7 @@ account: Account; #### Source -[lib/mina/account-update.ts:670](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L670) +[lib/mina/account-update.ts:694](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L694) *** @@ -54,7 +54,7 @@ authorization: {}; #### Source -[lib/mina/account-update.ts:667](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L667) +[lib/mina/account-update.ts:691](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L691) *** @@ -70,7 +70,7 @@ body: Body; #### Source -[lib/mina/account-update.ts:666](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L666) +[lib/mina/account-update.ts:690](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L690) *** @@ -82,7 +82,7 @@ currentSlot: CurrentSlot; #### Source -[lib/mina/account-update.ts:672](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L672) +[lib/mina/account-update.ts:696](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L696) *** @@ -94,7 +94,7 @@ id: number; #### Source -[lib/mina/account-update.ts:660](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L660) +[lib/mina/account-update.ts:684](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L684) *** @@ -109,7 +109,7 @@ was created. Can be modified by applications to add richer information. #### Source -[lib/mina/account-update.ts:665](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L665) +[lib/mina/account-update.ts:689](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L689) *** @@ -121,7 +121,7 @@ lazyAuthorization: undefined | LazySignature | LazyProof | LazyNone = undefined; #### Source -[lib/mina/account-update.ts:668](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L668) +[lib/mina/account-update.ts:692](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L692) *** @@ -133,7 +133,7 @@ network: Network; #### Source -[lib/mina/account-update.ts:671](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L671) +[lib/mina/account-update.ts:695](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L695) *** @@ -201,7 +201,7 @@ static Actions: { #### Source -[lib/mina/account-update.ts:676](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L676) +[lib/mina/account-update.ts:700](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L700) *** @@ -249,7 +249,147 @@ static Events: { #### Source -[lib/mina/account-update.ts:677](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L677) +[lib/mina/account-update.ts:701](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L701) + +*** + +### MayUseToken + +```ts +static MayUseToken: { + "InheritFromParent": { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; + }; + "No": { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; + }; + "ParentsOwnToken": { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; + }; + "isInheritFromParent": (a: AccountUpdate) => Bool; + "isNo": (__namedParameters: AccountUpdate) => Bool; + "isParentsOwnToken": (a: AccountUpdate) => Bool; + "type": BaseMayUseToken; +}; +``` + +#### InheritFromParent + +```ts +InheritFromParent: { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; +}; +``` + +#### InheritFromParent.inheritFromParent + +```ts +inheritFromParent: Bool; +``` + +#### InheritFromParent.parentsOwnToken + +```ts +parentsOwnToken: Bool; +``` + +#### No + +```ts +No: { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; +}; +``` + +#### No.inheritFromParent + +```ts +inheritFromParent: Bool; +``` + +#### No.parentsOwnToken + +```ts +parentsOwnToken: Bool; +``` + +#### ParentsOwnToken + +```ts +ParentsOwnToken: { + "inheritFromParent": Bool; + "parentsOwnToken": Bool; +}; +``` + +#### ParentsOwnToken.inheritFromParent + +```ts +inheritFromParent: Bool; +``` + +#### ParentsOwnToken.parentsOwnToken + +```ts +parentsOwnToken: Bool; +``` + +#### isInheritFromParent() + +```ts +isInheritFromParent: (a: AccountUpdate) => Bool; +``` + +##### Parameters + +• **a**: [`AccountUpdate`](AccountUpdate.mdx) + +##### Returns + +[`Bool`](Bool.mdx) + +#### isNo() + +```ts +isNo: (__namedParameters: AccountUpdate) => Bool; +``` + +##### Parameters + +• **\_\_namedParameters**: [`AccountUpdate`](AccountUpdate.mdx) + +##### Returns + +[`Bool`](Bool.mdx) + +#### isParentsOwnToken() + +```ts +isParentsOwnToken: (a: AccountUpdate) => Bool; +``` + +##### Parameters + +• **a**: [`AccountUpdate`](AccountUpdate.mdx) + +##### Returns + +[`Bool`](Bool.mdx) + +#### type + +```ts +type: {} = BaseMayUseToken; +``` + +#### Source + +[lib/mina/account-update.ts:1235](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1235) *** @@ -269,7 +409,7 @@ static check: (x: AccountUpdate) => void = Types.AccountUpdate.check; #### Source -[lib/mina/account-update.ts:1143](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1143) +[lib/mina/account-update.ts:1187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1187) *** @@ -285,7 +425,7 @@ static sizeInFields: () => number = Types.AccountUpdate.sizeInFields; #### Source -[lib/mina/account-update.ts:1130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1130) +[lib/mina/account-update.ts:1174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1174) *** @@ -305,7 +445,7 @@ static toFields: (x: AccountUpdate) => Field[] = Types.AccountUpdate.toFields; #### Source -[lib/mina/account-update.ts:1131](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1131) +[lib/mina/account-update.ts:1175](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1175) *** @@ -327,7 +467,7 @@ static toInput: (x: AccountUpdate) => {} = Types.AccountUpdate.toInput; #### Source -[lib/mina/account-update.ts:1139](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1139) +[lib/mina/account-update.ts:1183](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1183) *** @@ -347,7 +487,7 @@ static toValue: (x: AccountUpdate) => AccountUpdate = Types.AccountUpdate.toValu #### Source -[lib/mina/account-update.ts:1151](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1151) +[lib/mina/account-update.ts:1195](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1195) ## Accessors @@ -403,7 +543,7 @@ get balance(): { #### Source -[lib/mina/account-update.ts:765](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L765) +[lib/mina/account-update.ts:785](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L785) *** @@ -427,7 +567,7 @@ set balanceChange(x: Int64): void #### Source -[lib/mina/account-update.ts:780](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L780) +[lib/mina/account-update.ts:800](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L800) *** @@ -443,7 +583,7 @@ get publicKey(): PublicKey #### Source -[lib/mina/account-update.ts:855](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L855) +[lib/mina/account-update.ts:875](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L875) *** @@ -459,7 +599,7 @@ get tokenId(): Field #### Source -[lib/mina/account-update.ts:708](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L708) +[lib/mina/account-update.ts:732](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L732) *** @@ -477,199 +617,7 @@ get update(): {} #### Source -[lib/mina/account-update.ts:787](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L787) - -*** - -### MayUseToken - -```ts -get static MayUseToken(): { - "InheritFromParent": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "No": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "ParentsOwnToken": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "type": ProvablePureExtended<{ - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }>; - "isInheritFromParent": Bool; - "isNo": Bool; - "isParentsOwnToken": Bool; -} -``` - -#### Returns - -```ts -{ - "InheritFromParent": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "No": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "ParentsOwnToken": { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }; - "type": ProvablePureExtended<{ - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }>; - "isInheritFromParent": Bool; - "isNo": Bool; - "isParentsOwnToken": Bool; -} -``` - -##### InheritFromParent - -```ts -InheritFromParent: { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; -}; -``` - -##### InheritFromParent.inheritFromParent - -```ts -inheritFromParent: Bool; -``` - -##### InheritFromParent.parentsOwnToken - -```ts -parentsOwnToken: Bool; -``` - -##### No - -```ts -No: { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; -}; -``` - -##### No.inheritFromParent - -```ts -inheritFromParent: Bool; -``` - -##### No.parentsOwnToken - -```ts -parentsOwnToken: Bool; -``` - -##### ParentsOwnToken - -```ts -ParentsOwnToken: { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; -}; -``` - -##### ParentsOwnToken.inheritFromParent - -```ts -inheritFromParent: Bool; -``` - -##### ParentsOwnToken.parentsOwnToken - -```ts -parentsOwnToken: Bool; -``` - -##### type - -```ts -type: ProvablePureExtended<{ - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; - }, { - "inheritFromParent": Bool; - "parentsOwnToken": Bool; -}>; -``` - -###### Type declaration - -###### inheritFromParent - -```ts -inheritFromParent: Bool = Bool; -``` - -###### parentsOwnToken - -```ts -parentsOwnToken: Bool = Bool; -``` - -##### isInheritFromParent() - -###### Parameters - -• **a**: [`AccountUpdate`](AccountUpdate.mdx) - -###### Returns - -[`Bool`](Bool.mdx) - -##### isNo() - -###### Parameters - -• **\_\_namedParameters**: [`AccountUpdate`](AccountUpdate.mdx) - -###### Returns - -[`Bool`](Bool.mdx) - -##### isParentsOwnToken() - -###### Parameters - -• **a**: [`AccountUpdate`](AccountUpdate.mdx) - -###### Returns - -[`Bool`](Bool.mdx) - -#### Source - -[lib/mina/account-update.ts:1176](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1176) +[lib/mina/account-update.ts:807](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L807) ## Methods @@ -698,7 +646,7 @@ of the proof that authorizes the parent account update. #### Source -[lib/mina/account-update.ts:753](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L753) +[lib/mina/account-update.ts:773](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L773) *** @@ -714,7 +662,7 @@ extractTree(): AccountUpdateTree #### Source -[lib/mina/account-update.ts:1001](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1001) +[lib/mina/account-update.ts:1021](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1021) *** @@ -730,7 +678,7 @@ hash(): Field #### Source -[lib/mina/account-update.ts:957](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L957) +[lib/mina/account-update.ts:977](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L977) *** @@ -746,7 +694,7 @@ isDummy(): Bool #### Source -[lib/mina/account-update.ts:1019](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1019) +[lib/mina/account-update.ts:1047](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1047) *** @@ -776,7 +724,7 @@ be (can be) authorized by a signature. #### Source -[lib/mina/account-update.ts:874](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L874) +[lib/mina/account-update.ts:894](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L894) *** @@ -803,7 +751,7 @@ send(__namedParameters: { #### Source -[lib/mina/account-update.ts:712](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L712) +[lib/mina/account-update.ts:736](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L736) *** @@ -819,7 +767,7 @@ toJSON(): AccountUpdate #### Source -[lib/mina/account-update.ts:946](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L946) +[lib/mina/account-update.ts:966](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L966) *** @@ -838,7 +786,7 @@ default [AccountUpdate](AccountUpdate.mdx). #### Source -[lib/mina/account-update.ts:1208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1208) +[lib/mina/account-update.ts:1241](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1241) *** @@ -854,7 +802,7 @@ toPrettyLayout(): void #### Source -[lib/mina/account-update.ts:995](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L995) +[lib/mina/account-update.ts:1015](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1015) *** @@ -878,7 +826,7 @@ toPublicInput(__namedParameters: { #### Source -[lib/mina/account-update.ts:965](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L965) +[lib/mina/account-update.ts:985](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L985) *** @@ -929,7 +877,7 @@ Example: To constrain the account balance of a SmartContract to lie between #### Source -[lib/mina/account-update.ts:815](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L815) +[lib/mina/account-update.ts:835](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L835) *** @@ -970,7 +918,7 @@ Example: To fix the account nonce of a SmartContract to 0, you can use #### Source -[lib/mina/account-update.ts:842](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L842) +[lib/mina/account-update.ts:862](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L862) *** @@ -993,7 +941,7 @@ Attach account update to the current transaction #### Source -[lib/mina/account-update.ts:1063](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1063) +[lib/mina/account-update.ts:1107](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1107) *** @@ -1015,7 +963,7 @@ Clones the [AccountUpdate](AccountUpdate.mdx). #### Source -[lib/mina/account-update.ts:694](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L694) +[lib/mina/account-update.ts:718](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L718) *** @@ -1043,7 +991,39 @@ becomes part of the proof. #### Source -[lib/mina/account-update.ts:1044](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1044) +[lib/mina/account-update.ts:1072](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1072) + +*** + +### createIf() + +```ts +static createIf( + condition: Bool, + publicKey: PublicKey, + tokenId?: Field): AccountUpdate +``` + +Create an account update that is added to the transaction only if a condition is met. + +See [AccountUpdate.create](AccountUpdate.mdx#create) for more information. In this method, you can pass in +a condition that determines whether the account update should be added to the transaction. + +#### Parameters + +• **condition**: [`Bool`](Bool.mdx) + +• **publicKey**: [`PublicKey`](PublicKey.mdx) + +• **tokenId?**: [`Field`](Field.mdx) + +#### Returns + +[`AccountUpdate`](AccountUpdate.mdx) + +#### Source + +[lib/mina/account-update.ts:1094](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1094) *** @@ -1079,16 +1059,22 @@ be (can be) authorized by a signature. #### Source -[lib/mina/account-update.ts:1099](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1099) +[lib/mina/account-update.ts:1143](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1143) *** -### defaultAccountUpdate() +### default() ```ts -static defaultAccountUpdate(address: PublicKey, tokenId?: Field): AccountUpdate +static default(address: PublicKey, tokenId?: Field): AccountUpdate ``` +Create an account update from a public key and an optional token id. + +**Important**: This method is different from `AccountUpdate.create()`, in that it really just creates the account update object. +It does not attach the update to the current transaction or smart contract. +Use this method for lower-level operations with account updates. + #### Parameters • **address**: [`PublicKey`](PublicKey.mdx) @@ -1101,7 +1087,7 @@ static defaultAccountUpdate(address: PublicKey, tokenId?: Field): AccountUpdate #### Source -[lib/mina/account-update.ts:1011](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1011) +[lib/mina/account-update.ts:1038](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1038) *** @@ -1123,7 +1109,7 @@ static defaultFeePayer(address: PublicKey, nonce: UInt32): FeePayerUnsigned #### Source -[lib/mina/account-update.ts:1023](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1023) +[lib/mina/account-update.ts:1051](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1051) *** @@ -1139,7 +1125,7 @@ static dummy(): AccountUpdate #### Source -[lib/mina/account-update.ts:1014](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1014) +[lib/mina/account-update.ts:1042](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1042) *** @@ -1155,7 +1141,7 @@ static dummyFeePayer(): FeePayerUnsigned #### Source -[lib/mina/account-update.ts:1032](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1032) +[lib/mina/account-update.ts:1060](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1060) *** @@ -1171,7 +1157,7 @@ static empty(): AccountUpdate #### Source -[lib/mina/account-update.ts:1140](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1140) +[lib/mina/account-update.ts:1184](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1184) *** @@ -1193,7 +1179,7 @@ static fromFields(fields: Field[], __namedParameters: any[]): AccountUpdate #### Source -[lib/mina/account-update.ts:1144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1144) +[lib/mina/account-update.ts:1188](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1188) *** @@ -1213,7 +1199,7 @@ static fromJSON(json: AccountUpdate): AccountUpdate #### Source -[lib/mina/account-update.ts:952](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L952) +[lib/mina/account-update.ts:972](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L972) *** @@ -1233,7 +1219,7 @@ static fromValue(value: AccountUpdate | AccountUpdate | AccountUpdate): AccountU #### Source -[lib/mina/account-update.ts:1152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1152) +[lib/mina/account-update.ts:1196](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1196) *** @@ -1267,7 +1253,7 @@ they [AccountUpdate](AccountUpdate.mdx) for the account which pays the fee #### Source -[lib/mina/account-update.ts:1120](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1120) +[lib/mina/account-update.ts:1164](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1164) *** @@ -1287,7 +1273,7 @@ static getNonce(accountUpdate: FeePayerUnsigned | AccountUpdate): UInt32 #### Source -[lib/mina/account-update.ts:898](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L898) +[lib/mina/account-update.ts:918](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L918) *** @@ -1313,7 +1299,7 @@ static setValue(maybeValue: SetOrKeep, value: T): void #### Source -[lib/mina/account-update.ts:791](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L791) +[lib/mina/account-update.ts:811](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L811) *** @@ -1333,7 +1319,7 @@ static signFeePayerInPlace(feePayer: FeePayerUnsigned): void #### Source -[lib/mina/account-update.ts:892](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L892) +[lib/mina/account-update.ts:912](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L912) *** @@ -1361,7 +1347,7 @@ static toAuxiliary(a?: AccountUpdate): (any[] | { #### Source -[lib/mina/account-update.ts:1132](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1132) +[lib/mina/account-update.ts:1176](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1176) *** @@ -1381,7 +1367,7 @@ static toJSON(a: AccountUpdate): AccountUpdate #### Source -[lib/mina/account-update.ts:949](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L949) +[lib/mina/account-update.ts:969](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L969) *** @@ -1403,7 +1389,7 @@ Disattach an account update from where it's currently located in the transaction #### Source -[lib/mina/account-update.ts:1080](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1080) +[lib/mina/account-update.ts:1124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1124) *** @@ -1411,7 +1397,7 @@ Disattach an account update from where it's currently located in the transaction ```ts static witness( - type: FlexibleProvable, + resultType: FlexibleProvable, compute: () => Promise<{ "accountUpdate": AccountUpdate; "result": T; @@ -1430,7 +1416,7 @@ static witness( #### Parameters -• **type**: [`FlexibleProvable`](../type-aliases/FlexibleProvable.mdx)\<`T`\> +• **resultType**: [`FlexibleProvable`](../type-aliases/FlexibleProvable.mdx)\<`T`\> • **compute** @@ -1460,4 +1446,4 @@ static witness( #### Source -[lib/mina/account-update.ts:1160](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1160) +[lib/mina/account-update.ts:1219](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1219) diff --git a/docs/zkapps/o1js-reference/classes/AccountUpdateForest.mdx b/docs/zkapps/o1js-reference/classes/AccountUpdateForest.mdx index ca357b668..eaa1a19a5 100644 --- a/docs/zkapps/o1js-reference/classes/AccountUpdateForest.mdx +++ b/docs/zkapps/o1js-reference/classes/AccountUpdateForest.mdx @@ -13,7 +13,7 @@ type AccountUpdateTree = { ## Extends - [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}, `this`\> @@ -24,7 +24,7 @@ type AccountUpdateTree = { ```ts new AccountUpdateForest(__namedParameters: MerkleListBase<{ - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }>): AccountUpdateForest @@ -33,7 +33,7 @@ new AccountUpdateForest(__namedParameters: MerkleListBase<{ #### Parameters • **\_\_namedParameters**: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> @@ -48,7 +48,7 @@ new AccountUpdateForest(__namedParameters: MerkleListBase<{ #### Source -[lib/provable/merkle-list.ts:83](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L83) +[lib/provable/merkle-list.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L84) ## Properties @@ -56,7 +56,7 @@ new AccountUpdateForest(__namedParameters: MerkleListBase<{ ```ts data: Unconstrained; "id": RandomId; }>[]>; @@ -68,7 +68,7 @@ data: Unconstrained; #### Source -[lib/provable/merkle-list.ts:300](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L300) +[lib/provable/merkle-list.ts:353](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L353) *** @@ -132,7 +132,7 @@ static _nextHash: undefined | (hash: Field, t: any) => Field; #### Source -[lib/provable/merkle-list.ts:296](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L296) +[lib/provable/merkle-list.ts:349](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L349) *** @@ -148,195 +148,131 @@ static _provable: undefined | ProvableHashable>; #### Source -[lib/provable/merkle-list.ts:299](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L299) +[lib/provable/merkle-list.ts:352](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L352) *** -### empty() +### provable ```ts -static empty: () => MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; -}>; +static provable: { + "check": void; + "empty": AccountUpdateForest; + "fromFields": AccountUpdateForest; + "fromValue": AccountUpdateForest; + "sizeInFields": number; + "toAuxiliary": any[]; + "toFields": Field[]; + "toInput": HashInput; + "toValue": any; +}; ``` -#### Returns +#### check() -[`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; +##### Parameters + +• **value**: [`AccountUpdateForest`](AccountUpdateForest.mdx) \| [`MerkleList`](MerkleList.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> -> ##### accountUpdate -> -> ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; -> ``` -> -> ##### children -> -> ```ts -> children: MerkleListBase; -> ``` -> -> ##### id -> -> ```ts -> id: number = RandomId; -> ``` -> +##### Returns -#### Inherited from +`void` -`MerkleList.create( - AccountUpdateTreeBase, - merkleListHash -).empty` +#### empty() -#### Source +##### Returns -[lib/provable/merkle-list.ts:245](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L245) +[`AccountUpdateForest`](AccountUpdateForest.mdx) -*** +#### fromFields() -### from() +##### Parameters -```ts -static from: (array: { - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; - }[]) => MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; -}>; -``` +• **fields**: [`Field`](Field.mdx)[] -#### Parameters +• **aux**: `any`[] -• **array**: \{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}[] +##### Returns -#### Returns +[`AccountUpdateForest`](AccountUpdateForest.mdx) -[`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\> +#### fromValue() -> ##### accountUpdate -> -> ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; -> ``` -> -> ##### children -> -> ```ts -> children: MerkleListBase; -> ``` -> -> ##### id -> -> ```ts -> id: number = RandomId; -> ``` -> +##### Parameters -#### Inherited from +• **value**: `any` -`MerkleList.create( - AccountUpdateTreeBase, - merkleListHash -).from` +##### Returns -#### Source +[`AccountUpdateForest`](AccountUpdateForest.mdx) -[lib/provable/merkle-list.ts:246](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L246) +#### sizeInFields() -*** +##### Returns -### fromReverse() +`number` -```ts -static fromReverse: (array: { - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; - }[]) => MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; -}>; -``` +#### toAuxiliary() -#### Parameters +##### Parameters -• **array**: \{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; +• **value?**: [`AccountUpdateForest`](AccountUpdateForest.mdx) \| [`MerkleList`](MerkleList.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; - \}[] + \}\> -#### Returns +##### Returns -[`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; +`any`[] + +#### toFields() + +##### Parameters + +• **value**: [`AccountUpdateForest`](AccountUpdateForest.mdx) \| [`MerkleList`](MerkleList.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> -> ##### accountUpdate -> -> ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; -> ``` -> -> ##### children -> -> ```ts -> children: MerkleListBase; -> ``` -> -> ##### id -> -> ```ts -> id: number = RandomId; -> ``` -> +##### Returns -#### Inherited from +[`Field`](Field.mdx)[] -`MerkleList.create( - AccountUpdateTreeBase, - merkleListHash -).fromReverse` +#### toInput() -#### Source +##### Parameters -[lib/provable/merkle-list.ts:247](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L247) +• **value**: [`AccountUpdateForest`](AccountUpdateForest.mdx) \| [`MerkleList`](MerkleList.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; + `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; + `"id"`: `RandomId`; + \}\> -*** +##### Returns -### provable +`HashInput` -```ts -static provable: ProvableHashable; - "id": RandomId; -}>>; -``` +#### toValue() -#### Inherited from +##### Parameters + +• **value**: [`AccountUpdateForest`](AccountUpdateForest.mdx) \| [`MerkleList`](MerkleList.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; + `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; + `"id"`: `RandomId`; + \}\> + +##### Returns + +`any` + +#### Overrides `MerkleList.create( AccountUpdateTreeBase, @@ -345,7 +281,7 @@ static provable: ProvableHashable #### Source -[lib/provable/merkle-list.ts:319](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L319) +[lib/provable/merkle-list.ts:372](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L372) *** @@ -393,7 +329,7 @@ get static emptyHash(): Field #### Source -[lib/provable/merkle-list.ts:314](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L314) +[lib/provable/merkle-list.ts:367](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L367) ## Methods @@ -401,7 +337,7 @@ get static emptyHash(): Field ```ts clone(): MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }> @@ -410,7 +346,7 @@ clone(): MerkleList<{ #### Returns [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> @@ -418,7 +354,7 @@ clone(): MerkleList<{ > ##### accountUpdate > > ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; +> accountUpdate: Hashed = HashedAccountUpdate; > ``` > > ##### children @@ -440,7 +376,7 @@ clone(): MerkleList<{ #### Source -[lib/provable/merkle-list.ts:189](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L189) +[lib/provable/merkle-list.ts:223](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L223) *** @@ -448,7 +384,7 @@ clone(): MerkleList<{ ```ts forEach(length: number, callback: (element: { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }, isDummy: Bool, i: number) => void): void @@ -478,7 +414,7 @@ to handle the `isDummy` flag separately. #### Source -[lib/provable/merkle-list.ts:203](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L203) +[lib/provable/merkle-list.ts:237](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L237) *** @@ -498,7 +434,27 @@ isEmpty(): Bool #### Source -[lib/provable/merkle-list.ts:88](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L88) +[lib/provable/merkle-list.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L89) + +*** + +### lengthUnconstrained() + +```ts +lengthUnconstrained(): Unconstrained +``` + +#### Returns + +[`Unconstrained`](Unconstrained.mdx)\<`number`\> + +#### Inherited from + +[`MerkleList`](MerkleList.mdx).[`lengthUnconstrained`](MerkleList.mdx#lengthunconstrained) + +#### Source + +[lib/provable/merkle-list.ts:267](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L267) *** @@ -506,7 +462,7 @@ isEmpty(): Bool ```ts nextHash(hash: Field, value: { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }): Field @@ -518,7 +474,7 @@ nextHash(hash: Field, value: { • **value** -• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` • **value.children**: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>= `undefined` @@ -534,7 +490,7 @@ nextHash(hash: Field, value: { #### Source -[lib/provable/merkle-list.ts:306](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L306) +[lib/provable/merkle-list.ts:359](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L359) *** @@ -542,7 +498,7 @@ nextHash(hash: Field, value: { ```ts pop(): { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -556,7 +512,7 @@ If the list is empty, returns a dummy element. ```ts { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -565,7 +521,7 @@ If the list is empty, returns a dummy element. ##### accountUpdate ```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; +accountUpdate: Hashed = HashedAccountUpdate; ``` ##### children @@ -586,7 +542,7 @@ id: number = RandomId; #### Source -[lib/provable/merkle-list.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L154) +[lib/provable/merkle-list.ts:155](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L155) *** @@ -594,7 +550,7 @@ id: number = RandomId; ```ts popExn(): { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -608,7 +564,7 @@ This proves that the list is non-empty, and fails otherwise. ```ts { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -617,7 +573,7 @@ This proves that the list is non-empty, and fails otherwise. ##### accountUpdate ```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; +accountUpdate: Hashed = HashedAccountUpdate; ``` ##### children @@ -638,7 +594,7 @@ id: number = RandomId; #### Source -[lib/provable/merkle-list.ts:139](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L139) +[lib/provable/merkle-list.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L140) *** @@ -646,7 +602,7 @@ id: number = RandomId; ```ts popIf(condition: Bool): { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -664,7 +620,7 @@ If the list is empty, returns a dummy element. ```ts { - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; } @@ -673,7 +629,7 @@ If the list is empty, returns a dummy element. ##### accountUpdate ```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; +accountUpdate: Hashed = HashedAccountUpdate; ``` ##### children @@ -694,54 +650,101 @@ id: number = RandomId; #### Source -[lib/provable/merkle-list.ts:173](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L173) +[lib/provable/merkle-list.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L174) *** -### push() +### popIfUnsafe() ```ts -push(element: { - "accountUpdate": HashedAccountUpdate.provable; +popIfUnsafe(shouldPop: Bool): { + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; - }): void +} ``` -Push a new element to the list. +Low-level, minimal version of `pop()` which lets the _caller_ decide whether there is an element to pop. + +I.e. this proves: +- If the input condition is true, this returns the last element and removes it from the list. +- If the input condition is false, the list is unchanged and the return value is garbage. + +Note that if the caller passes `true` but the list is empty, this will fail. +If the caller passes `false` but the list is non-empty, this succeeds and just doesn't pop off an element. #### Parameters -• **element** +• **shouldPop**: [`Bool`](Bool.mdx) + +#### Returns + +```ts +{ + "accountUpdate": HashedAccountUpdate; + "children": MerkleListBase; + "id": RandomId; +} +``` + +##### accountUpdate + +```ts +accountUpdate: Hashed = HashedAccountUpdate; +``` + +##### children + +```ts +children: MerkleListBase; +``` + +##### id + +```ts +id: number = RandomId; +``` + +#### Inherited from + +[`MerkleList`](MerkleList.mdx).[`popIfUnsafe`](MerkleList.mdx#popifunsafe) + +#### Source -• **element.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +[lib/provable/merkle-list.ts:200](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L200) + +*** + +### push() + +```ts +push(update: AccountUpdate | AccountUpdateTreeBase): void +``` + +Push a new element to the list. -• **element.children**: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>= `undefined` +#### Parameters -• **element.id**: `number`= `RandomId` +• **update**: [`AccountUpdate`](AccountUpdate.mdx) \| `AccountUpdateTreeBase` #### Returns `void` -#### Inherited from +#### Overrides [`MerkleList`](MerkleList.mdx).[`push`](MerkleList.mdx#push) #### Source -[lib/provable/merkle-list.ts:95](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L95) +[lib/mina/account-update.ts:1381](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1381) *** ### pushIf() ```ts -pushIf(condition: Bool, element: { - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; - }): void +pushIf(condition: Bool, update: AccountUpdate | AccountUpdateTreeBase): void ``` Push a new element to the list, if the `condition` is true. @@ -750,25 +753,19 @@ Push a new element to the list, if the `condition` is true. • **condition**: [`Bool`](Bool.mdx) -• **element** - -• **element.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` - -• **element.children**: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>= `undefined` - -• **element.id**: `number`= `RandomId` +• **update**: [`AccountUpdate`](AccountUpdate.mdx) \| `AccountUpdateTreeBase` #### Returns `void` -#### Inherited from +#### Overrides [`MerkleList`](MerkleList.mdx).[`pushIf`](MerkleList.mdx#pushif) #### Source -[lib/provable/merkle-list.ts:107](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L107) +[lib/mina/account-update.ts:1386](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1386) *** @@ -776,7 +773,7 @@ Push a new element to the list, if the `condition` is true. ```ts startIterating(): MerkleListIterator<{ - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }> @@ -785,7 +782,7 @@ startIterating(): MerkleListIterator<{ #### Returns [`MerkleListIterator`](MerkleListIterator.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> @@ -793,7 +790,7 @@ startIterating(): MerkleListIterator<{ > ##### accountUpdate > > ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; +> accountUpdate: Hashed = HashedAccountUpdate; > ``` > > ##### children @@ -815,7 +812,7 @@ startIterating(): MerkleListIterator<{ #### Source -[lib/provable/merkle-list.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L217) +[lib/provable/merkle-list.ts:251](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L251) *** @@ -823,7 +820,7 @@ startIterating(): MerkleListIterator<{ ```ts startIteratingFromLast(): MerkleListIterator<{ - "accountUpdate": HashedAccountUpdate.provable; + "accountUpdate": HashedAccountUpdate; "children": MerkleListBase; "id": RandomId; }> @@ -832,7 +829,7 @@ startIteratingFromLast(): MerkleListIterator<{ #### Returns [`MerkleListIterator`](MerkleListIterator.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; `"id"`: `RandomId`; \}\> @@ -840,7 +837,7 @@ startIteratingFromLast(): MerkleListIterator<{ > ##### accountUpdate > > ```ts -> accountUpdate: Hashed = HashedAccountUpdate.provable; +> accountUpdate: Hashed = HashedAccountUpdate; > ``` > > ##### children @@ -862,7 +859,57 @@ startIteratingFromLast(): MerkleListIterator<{ #### Source -[lib/provable/merkle-list.ts:222](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L222) +[lib/provable/merkle-list.ts:256](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L256) + +*** + +### toArrayUnconstrained() + +```ts +toArrayUnconstrained(): Unconstrained<{ + "accountUpdate": HashedAccountUpdate; + "children": MerkleListBase; + "id": RandomId; +}[]> +``` + +#### Returns + +[`Unconstrained`](Unconstrained.mdx)\<\{ + `"accountUpdate"`: `HashedAccountUpdate`; + `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; + `"id"`: `RandomId`; + \}[]\> + +#### Inherited from + +[`MerkleList`](MerkleList.mdx).[`toArrayUnconstrained`](MerkleList.mdx#toarrayunconstrained) + +#### Source + +[lib/provable/merkle-list.ts:261](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L261) + +*** + +### toFlatArray() + +```ts +toFlatArray(mutate: boolean, depth: number): AccountUpdate[] +``` + +#### Parameters + +• **mutate**: `boolean`= `true` + +• **depth**: `number`= `0` + +#### Returns + +[`AccountUpdate`](AccountUpdate.mdx)[] + +#### Source + +[lib/mina/account-update.ts:1398](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1398) *** @@ -882,7 +929,7 @@ static assertConstant(forest: AccountUpdateForestBase): void #### Source -[lib/mina/account-update.ts:1377](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1377) +[lib/mina/account-update.ts:1429](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1429) *** @@ -890,7 +937,7 @@ static assertConstant(forest: AccountUpdateForestBase): void ```ts static create( - type: ProvableHashable, + type: WithProvable>, nextHash: (hash: Field, value: T) => Field, emptyHash_: Field): typeof MerkleList & { "empty": () => MerkleList; @@ -910,7 +957,7 @@ Optionally, you can tell `create()` how to do the hash that pushes a new list el #### Parameters -• **type**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\>\> • **nextHash**= `undefined` @@ -939,7 +986,57 @@ class MyList extends MerkleList.create(Field, (hash, x) => #### Source -[lib/provable/merkle-list.ts:239](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L239) +[lib/provable/merkle-list.ts:283](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L283) + +*** + +### empty() + +```ts +static empty(): AccountUpdateForest +``` + +#### Returns + +[`AccountUpdateForest`](AccountUpdateForest.mdx) + +#### Overrides + +`MerkleList.create( + AccountUpdateTreeBase, + merkleListHash +).empty` + +#### Source + +[lib/mina/account-update.ts:1442](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1442) + +*** + +### from() + +```ts +static from(array: AccountUpdateTreeBase[]): AccountUpdateForest +``` + +#### Parameters + +• **array**: `AccountUpdateTreeBase`[] + +#### Returns + +[`AccountUpdateForest`](AccountUpdateForest.mdx) + +#### Overrides + +`MerkleList.create( + AccountUpdateTreeBase, + merkleListHash +).from` + +#### Source + +[lib/mina/account-update.ts:1445](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1445) *** @@ -959,7 +1056,34 @@ static fromFlatArray(updates: AccountUpdate[]): AccountUpdateForest #### Source -[lib/mina/account-update.ts:1346](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1346) +[lib/mina/account-update.ts:1393](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1393) + +*** + +### fromReverse() + +```ts +static fromReverse(array: AccountUpdateTreeBase[]): AccountUpdateForest +``` + +#### Parameters + +• **array**: `AccountUpdateTreeBase`[] + +#### Returns + +[`AccountUpdateForest`](AccountUpdateForest.mdx) + +#### Overrides + +`MerkleList.create( + AccountUpdateTreeBase, + merkleListHash +).fromReverse` + +#### Source + +[lib/mina/account-update.ts:1448](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1448) *** @@ -986,4 +1110,4 @@ static toFlatArray( #### Source -[lib/mina/account-update.ts:1350](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1350) +[lib/mina/account-update.ts:1402](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1402) diff --git a/docs/zkapps/o1js-reference/classes/AccountUpdateTree.mdx b/docs/zkapps/o1js-reference/classes/AccountUpdateTree.mdx index 821caed4a..27b742324 100644 --- a/docs/zkapps/o1js-reference/classes/AccountUpdateTree.mdx +++ b/docs/zkapps/o1js-reference/classes/AccountUpdateTree.mdx @@ -13,8 +13,8 @@ type AccountUpdateForest = MerkleList; ## Extends - \{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: `AccountUpdateForest.provable`; + `"accountUpdate"`: `HashedAccountUpdate`; + `"children"`: `AccountUpdateForest`; `"id"`: `RandomId`; \} @@ -24,8 +24,8 @@ type AccountUpdateForest = MerkleList; ```ts new AccountUpdateTree(value: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }): AccountUpdateTree ``` @@ -34,13 +34,9 @@ new AccountUpdateTree(value: { • **value** -• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **value.children**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **value.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **value.id**: `number`= `RandomId` @@ -52,77 +48,53 @@ new AccountUpdateTree(value: { `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).constructor` #### Source -[lib/provable/types/struct.ts:267](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L267) +[lib/provable/types/struct.ts:280](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L280) ## Properties ### accountUpdate ```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; +accountUpdate: Hashed = HashedAccountUpdate; ``` #### Inherited from `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).accountUpdate` #### Source -[lib/mina/account-update.ts:1405](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1405) +[lib/mina/account-update.ts:1468](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1468) *** ### children ```ts -children: MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; - }> = AccountUpdateForest.provable; -``` - -#### Type declaration - -##### accountUpdate - -```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; -``` - -##### children - -```ts -children: MerkleListBase; -``` - -##### id - -```ts -id: number = RandomId; +children: AccountUpdateForest = AccountUpdateForest; ``` #### Inherited from `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).children` #### Source -[lib/mina/account-update.ts:1406](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1406) +[lib/mina/account-update.ts:1469](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1469) *** @@ -136,13 +108,13 @@ id: number = RandomId; `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).id` #### Source -[lib/mina/account-update.ts:1404](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1404) +[lib/mina/account-update.ts:1467](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1467) *** @@ -156,13 +128,13 @@ static _isStruct: true; `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, })._isStruct` #### Source -[lib/provable/types/struct.ts:267](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L267) +[lib/provable/types/struct.ts:280](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L280) *** @@ -170,8 +142,8 @@ static _isStruct: true; ```ts static check: (value: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }) => void; ``` @@ -187,13 +159,9 @@ For instance, calling check function on the type [Bool](Bool.mdx) asserts that t the element of type `T` to put assertions on. -• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **value.children**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **value.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **value.id**: `number`= `RandomId` @@ -205,13 +173,13 @@ the element of type `T` to put assertions on. `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).check` #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -219,8 +187,8 @@ the element of type `T` to put assertions on. ```ts static fromValue: (x: any) => { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }; ``` @@ -235,8 +203,8 @@ Convert provable type from a normal JS type. ```ts { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; } ``` @@ -244,37 +212,13 @@ Convert provable type from a normal JS type. ##### accountUpdate ```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; +accountUpdate: Hashed = HashedAccountUpdate; ``` ##### children ```ts -children: MerkleList<{ - "accountUpdate": HashedAccountUpdate.provable; - "children": MerkleListBase; - "id": RandomId; - }> = AccountUpdateForest.provable; -``` - -###### Type declaration - -###### accountUpdate - -```ts -accountUpdate: Hashed = HashedAccountUpdate.provable; -``` - -###### children - -```ts -children: MerkleListBase; -``` - -###### id - -```ts -id: number = RandomId; +children: AccountUpdateForest = AccountUpdateForest; ``` ##### id @@ -287,13 +231,13 @@ id: number = RandomId; `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).fromValue` #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -301,8 +245,8 @@ id: number = RandomId; ```ts static toAuxiliary: (value?: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }) => any[]; ``` @@ -317,13 +261,9 @@ returns an array of any type that make up the "auxiliary" (non-provable) data of the element of type `T` to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned. -• **value.accountUpdate?**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **value.accountUpdate?**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **value.children?**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **value.children?**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **value.id?**: `number`= `RandomId` @@ -335,13 +275,94 @@ If not provided, a default value for auxiliary data is returned. `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).toAuxiliary` #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; + "id": RandomId; + }) => { + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; + "id": RandomId; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` + +• **x.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` + +• **x.id**: `number`= `RandomId` + +#### Returns + +```ts +{ + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; + "id": RandomId; +} +``` + +##### accountUpdate + +```ts +accountUpdate: Hashed = HashedAccountUpdate; +``` + +##### children + +```ts +children: AccountUpdateForest = AccountUpdateForest; +``` + +##### id + +```ts +id: number = RandomId; +``` + +#### Inherited from + +`StructNoJson({ + id: RandomId, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, +}).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -349,8 +370,8 @@ If not provided, a default value for auxiliary data is returned. ```ts static toFields: (value: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }) => Field[]; ``` @@ -364,13 +385,9 @@ an array of [Field](Field.mdx) elements that make up the provable data of `value the element of type `T` to generate the [Field](Field.mdx) array from. -• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **value.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **value.children**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **value.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **value.id**: `number`= `RandomId` @@ -382,13 +399,13 @@ the element of type `T` to generate the [Field](Field.mdx) array from. `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).toFields` #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -396,8 +413,8 @@ the element of type `T` to generate the [Field](Field.mdx) array from. ```ts static toInput: (x: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }) => { "fields": Field[]; @@ -409,13 +426,9 @@ static toInput: (x: { • **x** -• **x.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **x.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **x.children**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **x.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **x.id**: `number`= `RandomId` @@ -444,13 +457,13 @@ optional packed: [Field, number][]; `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).toInput` #### Source -[lib/provable/types/struct.ts:270](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L270) +[lib/provable/types/struct.ts:283](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L283) *** @@ -458,8 +471,8 @@ optional packed: [Field, number][]; ```ts static toValue: (x: { - "accountUpdate": HashedAccountUpdate.provable; - "children": AccountUpdateForest.provable; + "accountUpdate": HashedAccountUpdate; + "children": AccountUpdateForest; "id": RandomId; }) => any; ``` @@ -470,13 +483,9 @@ Convert provable type to a normal JS type. • **x** -• **x.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate.provable` +• **x.accountUpdate**: [`Hashed`](Hashed.mdx)\<[`AccountUpdate`](AccountUpdate.mdx)\>= `HashedAccountUpdate` -• **x.children**: [`MerkleList`](MerkleList.mdx)\<\{ - `"accountUpdate"`: `HashedAccountUpdate.provable`; - `"children"`: [`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`AccountUpdateTreeBase`\>; - `"id"`: `RandomId`; - \}\>= `AccountUpdateForest.provable` +• **x.children**: [`AccountUpdateForest`](AccountUpdateForest.mdx)= `AccountUpdateForest` • **x.id**: `number`= `RandomId` @@ -488,13 +497,13 @@ Convert provable type to a normal JS type. `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).toValue` #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -520,7 +529,7 @@ See [AccountUpdate.approve](AccountUpdate.mdx#approve). #### Source -[lib/mina/account-update.ts:1425](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1425) +[lib/mina/account-update.ts:1488](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1488) *** @@ -538,13 +547,13 @@ static empty(): AccountUpdateTree `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).empty` #### Source -[lib/mina/account-update.ts:1441](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1441) +[lib/mina/account-update.ts:1504](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1504) *** @@ -568,7 +577,7 @@ Create a tree of account updates which only consists of a root. #### Source -[lib/mina/account-update.ts:1411](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1411) +[lib/mina/account-update.ts:1474](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1474) *** @@ -592,13 +601,13 @@ static fromFields(fields: Field[], aux: any): AccountUpdateTree `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).fromFields` #### Source -[lib/mina/account-update.ts:1438](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1438) +[lib/mina/account-update.ts:1501](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L1501) *** @@ -620,10 +629,10 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) `StructNoJson({ id: RandomId, - accountUpdate: HashedAccountUpdate.provable, - children: AccountUpdateForest.provable, + accountUpdate: HashedAccountUpdate, + children: AccountUpdateForest, }).sizeInFields` #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/classes/AlmostForeignField.mdx b/docs/zkapps/o1js-reference/classes/AlmostForeignField.mdx index da7f300a8..f766bdd5a 100644 --- a/docs/zkapps/o1js-reference/classes/AlmostForeignField.mdx +++ b/docs/zkapps/o1js-reference/classes/AlmostForeignField.mdx @@ -34,7 +34,7 @@ new AlmostForeignField(x: #### Source -[lib/provable/foreign-field.ts:481](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L481) +[lib/provable/foreign-field.ts:487](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L487) ## Properties @@ -46,7 +46,7 @@ type: "AlmostReduced" | "FullyReduced" = 'AlmostReduced'; #### Source -[lib/provable/foreign-field.ts:479](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L479) +[lib/provable/foreign-field.ts:485](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L485) *** @@ -64,7 +64,7 @@ The internal representation of a foreign field element, as a tuple of 3 limbs. #### Source -[lib/provable/foreign-field.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L50) +[lib/provable/foreign-field.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L49) *** @@ -80,7 +80,7 @@ static _Bigint: undefined | {} = undefined; #### Source -[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L28) +[lib/provable/foreign-field.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L27) *** @@ -96,7 +96,7 @@ static _modulus: undefined | bigint = undefined; #### Source -[lib/provable/foreign-field.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L29) +[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L28) *** @@ -112,7 +112,7 @@ static _provable: undefined | ProvablePureExtended #### Source -[lib/provable/foreign-field.ts:488](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L488) +[lib/provable/foreign-field.ts:494](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L494) *** @@ -286,7 +286,7 @@ get static sizeInBits(): number #### Source -[lib/provable/foreign-field.ts:43](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L43) +[lib/provable/foreign-field.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L42) ## Methods @@ -318,7 +318,7 @@ x.add(2); // x + 2 mod p #### Source -[lib/provable/foreign-field.ts:208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L208) +[lib/provable/foreign-field.ts:218](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L218) *** @@ -350,7 +350,7 @@ ensuring validity of all our non-native field arithmetic methods. #### Source -[lib/provable/foreign-field.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L163) +[lib/provable/foreign-field.ts:173](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L173) *** @@ -375,7 +375,7 @@ Returns the field element as a [CanonicalForeignField](CanonicalForeignField.mdx #### Source -[lib/provable/foreign-field.ts:194](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L194) +[lib/provable/foreign-field.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L204) *** @@ -421,7 +421,7 @@ xChecked satisfies CanonicalForeignField; ##### Source -[lib/provable/foreign-field.ts:286](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L286) +[lib/provable/foreign-field.ts:296](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L296) #### assertEquals(y, message) @@ -445,7 +445,7 @@ assertEquals(y: AlmostForeignField, message?: string): AlmostForeignField ##### Source -[lib/provable/foreign-field.ts:290](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L290) +[lib/provable/foreign-field.ts:300](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L300) #### assertEquals(y, message) @@ -469,7 +469,7 @@ assertEquals(y: ForeignField, message?: string): ForeignField ##### Source -[lib/provable/foreign-field.ts:291](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L291) +[lib/provable/foreign-field.ts:301](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L301) *** @@ -505,7 +505,7 @@ x.assertLessThan(10); #### Source -[lib/provable/foreign-field.ts:333](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L333) +[lib/provable/foreign-field.ts:339](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L339) *** @@ -538,7 +538,7 @@ z.mul(y).assertEquals(x); #### Source -[lib/provable/foreign-field.ts:455](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L455) +[lib/provable/foreign-field.ts:461](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L461) *** @@ -566,7 +566,7 @@ let isXZero = x.equals(0); #### Source -[lib/provable/foreign-field.ts:515](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L515) +[lib/provable/foreign-field.ts:521](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L521) *** @@ -595,7 +595,7 @@ z.mul(x).assertEquals(1); #### Source -[lib/provable/foreign-field.ts:441](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L441) +[lib/provable/foreign-field.ts:447](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L447) *** @@ -619,7 +619,7 @@ See FieldVar to understand constants vs variables. #### Source -[lib/provable/foreign-field.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L126) +[lib/provable/foreign-field.ts:136](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L136) *** @@ -651,7 +651,7 @@ x.mul(y); // x*y mod p #### Source -[lib/provable/foreign-field.ts:427](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L427) +[lib/provable/foreign-field.ts:433](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L433) *** @@ -679,7 +679,7 @@ x.neg(); // -x mod p = p - x #### Source -[lib/provable/foreign-field.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L219) +[lib/provable/foreign-field.ts:229](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L229) *** @@ -711,7 +711,7 @@ x.sub(1); // x - 1 mod p #### Source -[lib/provable/foreign-field.ts:234](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L234) +[lib/provable/foreign-field.ts:244](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L244) *** @@ -733,7 +733,7 @@ Convert this field element to a bigint. #### Source -[lib/provable/foreign-field.ts:146](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L146) +[lib/provable/foreign-field.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L156) *** @@ -761,7 +761,7 @@ This method is provable! #### Source -[lib/provable/foreign-field.ts:352](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L352) +[lib/provable/foreign-field.ts:358](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L358) *** @@ -788,7 +788,7 @@ that is, in situations where the prover computes a value outside provable code. #### Source -[lib/provable/foreign-field.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L138) +[lib/provable/foreign-field.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L148) *** @@ -810,7 +810,7 @@ Instance version of `Provable.toFields`, see Provable.toFields #### Source -[lib/provable/foreign-field.ts:400](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L400) +[lib/provable/foreign-field.ts:406](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L406) *** @@ -843,7 +843,7 @@ This is most efficient than when checking a multiple of 3 field elements at once #### Source -[lib/provable/foreign-field.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L177) +[lib/provable/foreign-field.ts:187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L187) *** @@ -867,7 +867,7 @@ static check(x: ForeignField): void #### Source -[lib/provable/foreign-field.ts:493](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L493) +[lib/provable/foreign-field.ts:499](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L499) *** @@ -895,7 +895,7 @@ Coerce the input to a [ForeignField](ForeignField.mdx). ##### Source -[lib/provable/foreign-field.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L114) +[lib/provable/foreign-field.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L124) #### from(x) @@ -917,7 +917,7 @@ static from(x: string | number | bigint | ForeignField): ForeignField ##### Source -[lib/provable/foreign-field.ts:115](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L115) +[lib/provable/foreign-field.ts:125](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L125) *** @@ -945,7 +945,7 @@ This method is provable! #### Source -[lib/provable/foreign-field.ts:382](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L382) +[lib/provable/foreign-field.ts:388](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L388) *** @@ -965,7 +965,7 @@ static random(): CanonicalForeignField #### Source -[lib/provable/foreign-field.ts:393](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L393) +[lib/provable/foreign-field.ts:399](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L399) *** @@ -1011,7 +1011,7 @@ than chaining calls to [ForeignField.add](ForeignField.mdx#add) and [ForeignFiel #### Source -[lib/provable/foreign-field.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L259) +[lib/provable/foreign-field.ts:269](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L269) *** @@ -1035,4 +1035,4 @@ Coerce the input to an [AlmostForeignField](AlmostForeignField.mdx) without addi #### Source -[lib/provable/foreign-field.ts:503](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L503) +[lib/provable/foreign-field.ts:509](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L509) diff --git a/docs/zkapps/o1js-reference/classes/BaseMerkleWitness.mdx b/docs/zkapps/o1js-reference/classes/BaseMerkleWitness.mdx index 89b3d21ec..8125f9f77 100644 --- a/docs/zkapps/o1js-reference/classes/BaseMerkleWitness.mdx +++ b/docs/zkapps/o1js-reference/classes/BaseMerkleWitness.mdx @@ -32,7 +32,7 @@ A circuit-compatible Witness. #### Source -[lib/provable/merkle-tree.ts:187](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L187) +[lib/provable/merkle-tree.ts:187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L187) ## Properties @@ -44,7 +44,7 @@ isLeft: Bool[]; #### Source -[lib/provable/merkle-tree.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L177) +[lib/provable/merkle-tree.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L177) *** @@ -56,7 +56,7 @@ path: Field[]; #### Source -[lib/provable/merkle-tree.ts:176](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L176) +[lib/provable/merkle-tree.ts:176](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L176) *** @@ -68,7 +68,7 @@ static height: number; #### Source -[lib/provable/merkle-tree.ts:175](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L175) +[lib/provable/merkle-tree.ts:175](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L175) ## Methods @@ -92,7 +92,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -112,7 +112,7 @@ Index of the leaf. #### Source -[lib/provable/merkle-tree.ts:221](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L221) +[lib/provable/merkle-tree.ts:221](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L221) *** @@ -138,7 +138,7 @@ The calculated root. #### Source -[lib/provable/merkle-tree.ts:204](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L204) +[lib/provable/merkle-tree.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L204) *** @@ -162,7 +162,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -178,7 +178,7 @@ height(): number #### Source -[lib/provable/merkle-tree.ts:178](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L178) +[lib/provable/merkle-tree.ts:178](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L178) *** @@ -198,7 +198,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -218,7 +218,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -238,7 +238,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -258,7 +258,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -288,7 +288,7 @@ static check(this: T, v: InstanceType): void #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L163) *** @@ -312,7 +312,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -342,7 +342,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -372,7 +372,7 @@ static fromJSON(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L196) +[lib/provable/types/circuit-value.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L208) *** @@ -402,7 +402,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -432,7 +432,7 @@ static fromValue(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L98) +[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L98) *** @@ -452,7 +452,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -472,7 +472,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -502,7 +532,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -532,7 +562,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -562,7 +592,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -592,7 +622,7 @@ static toJSON(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L185) +[lib/provable/types/circuit-value.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L197) *** @@ -622,4 +652,4 @@ static toValue(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L89) +[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L89) diff --git a/docs/zkapps/o1js-reference/classes/Bool.mdx b/docs/zkapps/o1js-reference/classes/Bool.mdx index 8b7d176eb..f8bdb00d5 100644 --- a/docs/zkapps/o1js-reference/classes/Bool.mdx +++ b/docs/zkapps/o1js-reference/classes/Bool.mdx @@ -26,7 +26,7 @@ new Bool(x: boolean | FieldVar | Bool): Bool #### Source -[lib/provable/bool.ts:33](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L33) +[lib/provable/bool.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L33) ## Properties @@ -38,7 +38,7 @@ value: FieldVar; #### Source -[lib/provable/bool.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L31) +[lib/provable/bool.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L31) *** @@ -69,7 +69,7 @@ a [Field](Field.mdx) #### Source -[lib/provable/bool.ts:373](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L373) +[lib/provable/bool.ts:373](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L373) *** @@ -81,7 +81,7 @@ static sizeInBytes: number = 1; #### Source -[lib/provable/bool.ts:367](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L367) +[lib/provable/bool.ts:367](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L367) ## Methods @@ -106,7 +106,7 @@ this [Bool](Bool.mdx) and `y` are also true. #### Source -[lib/provable/bool.ts:73](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L73) +[lib/provable/bool.ts:73](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L73) *** @@ -132,7 +132,7 @@ a [Bool](Bool.mdx). #### Source -[lib/provable/bool.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L114) +[lib/provable/bool.ts:114](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L114) *** @@ -154,7 +154,7 @@ Proves that this [Bool](Bool.mdx) is `false`. #### Source -[lib/provable/bool.ts:145](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L145) +[lib/provable/bool.ts:145](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L145) *** @@ -176,7 +176,7 @@ Proves that this [Bool](Bool.mdx) is `true`. #### Source -[lib/provable/bool.ts:131](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L131) +[lib/provable/bool.ts:131](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L131) *** @@ -200,7 +200,7 @@ a [Bool](Bool.mdx). #### Source -[lib/provable/bool.ts:160](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L160) +[lib/provable/bool.ts:160](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L160) *** @@ -232,7 +232,7 @@ assert(isZero.implies(lessThan10), 'x = 0 implies x < 10'); #### Source -[lib/provable/bool.ts:106](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L106) +[lib/provable/bool.ts:106](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L106) *** @@ -248,7 +248,7 @@ isConstant(): this is Object #### Source -[lib/provable/bool.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L45) +[lib/provable/bool.ts:45](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L45) *** @@ -266,7 +266,7 @@ a new [Bool](Bool.mdx) that is the negation of this [Bool](Bool.mdx). #### Source -[lib/provable/bool.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L59) +[lib/provable/bool.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L59) *** @@ -291,7 +291,7 @@ this [Bool](Bool.mdx) or `y` is true. #### Source -[lib/provable/bool.ts:86](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L86) +[lib/provable/bool.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L86) *** @@ -309,7 +309,7 @@ Returns the size of this type. #### Source -[lib/provable/bool.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L185) +[lib/provable/bool.ts:185](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L185) *** @@ -328,7 +328,7 @@ This can only be called on non-witness values. #### Source -[lib/provable/bool.ts:216](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L216) +[lib/provable/bool.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L216) *** @@ -346,7 +346,7 @@ Converts a [Bool](Bool.mdx) to a [Field](Field.mdx). `false` becomes 0 and `true #### Source -[lib/provable/bool.ts:52](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L52) +[lib/provable/bool.ts:52](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L52) *** @@ -364,7 +364,7 @@ Serializes this [Bool](Bool.mdx) into [Field](Field.mdx) elements. #### Source -[lib/provable/bool.ts:192](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L192) +[lib/provable/bool.ts:192](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L192) *** @@ -383,7 +383,7 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/bool.ts:208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L208) +[lib/provable/bool.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L208) *** @@ -402,7 +402,7 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/bool.ts:200](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L200) +[lib/provable/bool.ts:200](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L200) *** @@ -426,7 +426,7 @@ Boolean AND operation. #### Source -[lib/provable/bool.ts:244](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L244) +[lib/provable/bool.ts:244](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L244) *** @@ -450,7 +450,7 @@ Asserts if both [Bool](Bool.mdx) are equal. #### Source -[lib/provable/bool.ts:264](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L264) +[lib/provable/bool.ts:264](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L264) *** @@ -470,7 +470,7 @@ static check(x: Bool): void #### Source -[lib/provable/bool.ts:369](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L369) +[lib/provable/bool.ts:369](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L369) *** @@ -486,7 +486,7 @@ static empty(): Bool #### Source -[lib/provable/bool.ts:344](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L344) +[lib/provable/bool.ts:344](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L344) *** @@ -510,7 +510,7 @@ Checks two [Bool](Bool.mdx) for equality. #### Source -[lib/provable/bool.ts:275](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L275) +[lib/provable/bool.ts:275](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L275) *** @@ -530,7 +530,7 @@ static fromBytes(bytes: number[]): Bool #### Source -[lib/provable/bool.ts:356](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L356) +[lib/provable/bool.ts:356](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L356) *** @@ -552,7 +552,7 @@ Creates a data structure from an array of serialized [Field](Field.mdx) elements #### Source -[lib/provable/bool.ts:299](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L299) +[lib/provable/bool.ts:299](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L299) *** @@ -575,7 +575,7 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/bool.ts:333](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L333) +[lib/provable/bool.ts:333](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L333) *** @@ -597,7 +597,7 @@ static fromValue(b: boolean | Bool): Bool #### Source -[lib/provable/bool.ts:316](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L316) +[lib/provable/bool.ts:316](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L316) *** @@ -619,7 +619,7 @@ Boolean negation. #### Source -[lib/provable/bool.ts:234](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L234) +[lib/provable/bool.ts:234](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L234) *** @@ -643,7 +643,7 @@ Boolean OR operation. #### Source -[lib/provable/bool.ts:254](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L254) +[lib/provable/bool.ts:254](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L254) *** @@ -669,7 +669,7 @@ static readBytes(bytes: number[], offset: NonNegativeInteger): [Bool, numb #### Source -[lib/provable/bool.ts:360](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L360) +[lib/provable/bool.ts:360](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L360) *** @@ -687,7 +687,7 @@ Returns the size of this type. #### Source -[lib/provable/bool.ts:340](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L340) +[lib/provable/bool.ts:340](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L340) *** @@ -709,7 +709,7 @@ Static method to serialize a [Bool](Bool.mdx) into its auxiliary data. #### Source -[lib/provable/bool.ts:292](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L292) +[lib/provable/bool.ts:292](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L292) *** @@ -729,7 +729,7 @@ static toBytes(b: Bool): number[] #### Source -[lib/provable/bool.ts:352](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L352) +[lib/provable/bool.ts:352](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L352) *** @@ -749,7 +749,7 @@ static toField(x: boolean | Bool): Field #### Source -[lib/provable/bool.ts:227](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L227) +[lib/provable/bool.ts:227](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L227) *** @@ -771,7 +771,7 @@ Static method to serialize a [Bool](Bool.mdx) into an array of [Field](Field.mdx #### Source -[lib/provable/bool.ts:285](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L285) +[lib/provable/bool.ts:285](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L285) *** @@ -803,7 +803,7 @@ packed: [Field, number][]; #### Source -[lib/provable/bool.ts:348](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L348) +[lib/provable/bool.ts:348](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L348) *** @@ -826,7 +826,7 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/bool.ts:325](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L325) +[lib/provable/bool.ts:325](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L325) *** @@ -848,4 +848,4 @@ static toValue(x: Bool): boolean #### Source -[lib/provable/bool.ts:309](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L309) +[lib/provable/bool.ts:309](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L309) diff --git a/docs/zkapps/o1js-reference/classes/CanonicalForeignField.mdx b/docs/zkapps/o1js-reference/classes/CanonicalForeignField.mdx index d418cdd4d..f02422217 100644 --- a/docs/zkapps/o1js-reference/classes/CanonicalForeignField.mdx +++ b/docs/zkapps/o1js-reference/classes/CanonicalForeignField.mdx @@ -34,7 +34,7 @@ new CanonicalForeignField(x: #### Source -[lib/provable/foreign-field.ts:523](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L523) +[lib/provable/foreign-field.ts:529](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L529) ## Properties @@ -46,7 +46,7 @@ type: "FullyReduced"; #### Source -[lib/provable/foreign-field.ts:521](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L521) +[lib/provable/foreign-field.ts:527](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L527) *** @@ -64,7 +64,7 @@ The internal representation of a foreign field element, as a tuple of 3 limbs. #### Source -[lib/provable/foreign-field.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L50) +[lib/provable/foreign-field.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L49) *** @@ -80,7 +80,7 @@ static _Bigint: undefined | {} = undefined; #### Source -[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L28) +[lib/provable/foreign-field.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L27) *** @@ -96,7 +96,7 @@ static _modulus: undefined | bigint = undefined; #### Source -[lib/provable/foreign-field.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L29) +[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L28) *** @@ -112,7 +112,7 @@ static _provable: undefined | ProvablePureExtended.toFields`, see Provable.toFields #### Source -[lib/provable/foreign-field.ts:400](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L400) +[lib/provable/foreign-field.ts:406](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L406) *** @@ -846,7 +846,7 @@ This is most efficient than when checking a multiple of 3 field elements at once #### Source -[lib/provable/foreign-field.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L177) +[lib/provable/foreign-field.ts:187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L187) *** @@ -870,7 +870,7 @@ static check(x: ForeignField): void #### Source -[lib/provable/foreign-field.ts:535](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L535) +[lib/provable/foreign-field.ts:541](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L541) *** @@ -898,7 +898,7 @@ Coerce the input to a [ForeignField](ForeignField.mdx). ##### Source -[lib/provable/foreign-field.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L114) +[lib/provable/foreign-field.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L124) #### from(x) @@ -920,7 +920,7 @@ static from(x: string | number | bigint | ForeignField): ForeignField ##### Source -[lib/provable/foreign-field.ts:115](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L115) +[lib/provable/foreign-field.ts:125](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L125) *** @@ -948,7 +948,7 @@ This method is provable! #### Source -[lib/provable/foreign-field.ts:382](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L382) +[lib/provable/foreign-field.ts:388](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L388) *** @@ -968,7 +968,7 @@ static random(): CanonicalForeignField #### Source -[lib/provable/foreign-field.ts:393](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L393) +[lib/provable/foreign-field.ts:399](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L399) *** @@ -1014,7 +1014,7 @@ than chaining calls to [ForeignField.add](ForeignField.mdx#add) and [ForeignFiel #### Source -[lib/provable/foreign-field.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L259) +[lib/provable/foreign-field.ts:269](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L269) *** @@ -1038,4 +1038,4 @@ Coerce the input to a [CanonicalForeignField](CanonicalForeignField.mdx) without #### Source -[lib/provable/foreign-field.ts:545](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L545) +[lib/provable/foreign-field.ts:551](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L551) diff --git a/docs/zkapps/o1js-reference/classes/Character.mdx b/docs/zkapps/o1js-reference/classes/Character.mdx index 32ecb0775..0061584b9 100644 --- a/docs/zkapps/o1js-reference/classes/Character.mdx +++ b/docs/zkapps/o1js-reference/classes/Character.mdx @@ -26,7 +26,7 @@ new Character(value: number | Field): Character #### Source -[lib/provable/string.ts:13](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L13) +[lib/provable/string.ts:13](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L13) ## Properties @@ -42,7 +42,7 @@ value: Field = Field; #### Source -[lib/provable/string.ts:12](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L12) +[lib/provable/string.ts:12](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L12) *** @@ -58,7 +58,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -90,7 +90,7 @@ value: Field = Field; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -126,7 +126,7 @@ value: Field = Field; #### Source -[lib/provable/types/provable-intf.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L87) +[lib/provable/types/provable-intf.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L115) *** @@ -166,7 +166,7 @@ value: Field = Field; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -194,7 +194,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -228,88 +228,95 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) *** -### toFields() +### toCanonical()? ```ts -static toFields: (value: { +static optional toCanonical: (x: { "value": Field; - }) => Field[]; + }) => { + "value": Field; +}; ``` -A function that takes `value`, an element of type `T`, as argument and returns -an array of [Field](Field.mdx) elements that make up the provable data of `value`. +Optional method which transforms a provable type into its canonical representation. -#### Parameters +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. -• **value** +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. -the element of type `T` to generate the [Field](Field.mdx) array from. +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. -• **value.value**: [`Field`](Field.mdx)= `Field` +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.value**: [`Field`](Field.mdx)= `Field` #### Returns -[`Field`](Field.mdx)[] +```ts +{ + "value": Field; +} +``` + +##### value + +```ts +value: Field = Field; +``` #### Inherited from -`Struct({ value: Field }).toFields` +`Struct({ value: Field }).toCanonical` #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** -### toInput() +### toFields() ```ts -static toInput: (x: { +static toFields: (value: { "value": Field; - }) => { - "fields": Field[]; - "packed": [Field, number][]; -}; + }) => Field[]; ``` -#### Parameters - -• **x** - -• **x.value**: [`Field`](Field.mdx)= `Field` +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](Field.mdx) elements that make up the provable data of `value`. -#### Returns +#### Parameters -```ts -{ - "fields": Field[]; - "packed": [Field, number][]; -} -``` +• **value** -##### fields? +the element of type `T` to generate the [Field](Field.mdx) array from. -```ts -optional fields: Field[]; -``` +• **value.value**: [`Field`](Field.mdx)= `Field` -##### packed? +#### Returns -```ts -optional packed: [Field, number][]; -``` +[`Field`](Field.mdx)[] #### Inherited from -`Struct({ value: Field }).toInput` +`Struct({ value: Field }).toFields` #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -349,7 +356,7 @@ value: string = Field; #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -391,7 +398,7 @@ value: bigint = Field; #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -407,7 +414,7 @@ isNull(): Bool #### Source -[lib/provable/string.ts:17](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L17) +[lib/provable/string.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L17) *** @@ -423,7 +430,7 @@ toField(): Field #### Source -[lib/provable/string.ts:21](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L21) +[lib/provable/string.ts:21](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L21) *** @@ -439,7 +446,7 @@ toString(): string #### Source -[lib/provable/string.ts:25](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L25) +[lib/provable/string.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L25) *** @@ -467,7 +474,7 @@ static check(c: { #### Source -[lib/provable/string.ts:36](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L36) +[lib/provable/string.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L36) *** @@ -487,7 +494,7 @@ static fromString(str: string): Character #### Source -[lib/provable/string.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L30) +[lib/provable/string.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L30) *** @@ -511,4 +518,32 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) + +*** + +### toInput() + +```ts +static toInput(c: { + "value": Field; + }): HashInput +``` + +#### Parameters + +• **c** + +• **c.value**: [`Field`](Field.mdx) + +#### Returns + +`HashInput` + +#### Overrides + +`Struct({ value: Field }).toInput` + +#### Source + +[lib/provable/string.ts:40](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L40) diff --git a/docs/zkapps/o1js-reference/classes/Circuit.mdx b/docs/zkapps/o1js-reference/classes/Circuit.mdx index 258a4cf5c..60fd19d8b 100644 --- a/docs/zkapps/o1js-reference/classes/Circuit.mdx +++ b/docs/zkapps/o1js-reference/classes/Circuit.mdx @@ -20,7 +20,7 @@ static _main: CircuitData; #### Source -[lib/proof-system/circuit.ts:22](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L22) +[lib/proof-system/circuit.ts:22](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L22) ## Methods @@ -44,7 +44,7 @@ const keypair = await MyCircuit.generateKeypair(); #### Source -[lib/proof-system/circuit.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L31) +[lib/proof-system/circuit.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L31) *** @@ -80,7 +80,7 @@ const proof = await MyCircuit.prove(privateInput, publicInput, keypair); #### Source -[lib/proof-system/circuit.ts:51](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L51) +[lib/proof-system/circuit.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L51) *** @@ -117,4 +117,4 @@ const isValid = await MyCircuit.verify(publicInput, keypair.vk, proof); #### Source -[lib/proof-system/circuit.ts:82](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L82) +[lib/proof-system/circuit.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L82) diff --git a/docs/zkapps/o1js-reference/classes/CircuitString.mdx b/docs/zkapps/o1js-reference/classes/CircuitString.mdx index 4c98dd4be..1a402c181 100644 --- a/docs/zkapps/o1js-reference/classes/CircuitString.mdx +++ b/docs/zkapps/o1js-reference/classes/CircuitString.mdx @@ -30,7 +30,7 @@ new CircuitString(value: { #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) ## Properties @@ -46,7 +46,7 @@ values: Character[]; #### Source -[lib/provable/string.ts:61](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L61) +[lib/provable/string.ts:65](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L65) *** @@ -62,7 +62,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -97,7 +97,7 @@ the element of type `T` to put assertions on. #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -129,7 +129,7 @@ values: Character[]; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -165,7 +165,7 @@ values: Character[]; #### Source -[lib/provable/types/provable-intf.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L87) +[lib/provable/types/provable-intf.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L115) *** @@ -209,7 +209,7 @@ values: Character[]; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -235,7 +235,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -247,7 +247,7 @@ static maxLength: number = DEFAULT_STRING_LENGTH; #### Source -[lib/provable/string.ts:68](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L68) +[lib/provable/string.ts:72](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L72) *** @@ -281,7 +281,62 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "values": Character[]; + }) => { + "values": Character[]; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.values**: [`Character`](Character.mdx)[] + +#### Returns + +```ts +{ + "values": Character[]; +} +``` + +##### values + +```ts +values: Character[]; +``` + +#### Inherited from + +`Struct(RawCircuitString).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -314,7 +369,7 @@ the element of type `T` to generate the [Field](Field.mdx) array from. #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -362,7 +417,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L152) *** @@ -408,7 +463,7 @@ values: { #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -438,7 +493,7 @@ Convert provable type to a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -461,7 +516,7 @@ within the `maxLength` of this string (the other string can have a different max #### Source -[lib/provable/string.ts:117](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L117) +[lib/provable/string.ts:121](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L121) *** @@ -497,7 +552,7 @@ mask: Bool[]; #### Source -[lib/provable/string.ts:80](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L80) +[lib/provable/string.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L84) *** @@ -519,7 +574,7 @@ returns true if `this` has the same value as `other` #### Source -[lib/provable/string.ts:109](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L109) +[lib/provable/string.ts:113](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L113) *** @@ -535,7 +590,7 @@ hash(): Field #### Source -[lib/provable/string.ts:143](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L143) +[lib/provable/string.ts:147](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L147) *** @@ -551,7 +606,7 @@ length(): Field #### Source -[lib/provable/string.ts:102](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L102) +[lib/provable/string.ts:106](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L106) *** @@ -567,7 +622,7 @@ lengthMask(): Bool[] #### Source -[lib/provable/string.ts:99](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L99) +[lib/provable/string.ts:103](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L103) *** @@ -583,7 +638,7 @@ maxLength(): number #### Source -[lib/provable/string.ts:75](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L75) +[lib/provable/string.ts:79](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L79) *** @@ -605,7 +660,7 @@ substring(start: number, end: number): CircuitString #### Source -[lib/provable/string.ts:147](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L147) +[lib/provable/string.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L151) *** @@ -621,7 +676,7 @@ toString(): string #### Source -[lib/provable/string.ts:151](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L151) +[lib/provable/string.ts:155](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L155) *** @@ -641,7 +696,7 @@ static fromCharacters(chars: Character[]): CircuitString #### Source -[lib/provable/string.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L71) +[lib/provable/string.ts:75](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L75) *** @@ -661,7 +716,7 @@ static fromString(str: string): CircuitString #### Source -[lib/provable/string.ts:155](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/string.ts#L155) +[lib/provable/string.ts:159](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/string.ts#L159) *** @@ -685,4 +740,4 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/classes/DynamicProof.mdx b/docs/zkapps/o1js-reference/classes/DynamicProof.mdx index a845ef38d..054b1c956 100644 --- a/docs/zkapps/o1js-reference/classes/DynamicProof.mdx +++ b/docs/zkapps/o1js-reference/classes/DynamicProof.mdx @@ -76,7 +76,7 @@ new DynamicProof(__namedParameters: { #### Source -[lib/proof-system/zkprogram.ts:233](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L233) +[lib/proof-system/proof.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L49) ## Properties @@ -92,7 +92,7 @@ maxProofsVerified: 0 | 1 | 2; #### Source -[lib/proof-system/zkprogram.ts:220](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L220) +[lib/proof-system/proof.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L36) *** @@ -108,7 +108,7 @@ proof: unknown; #### Source -[lib/proof-system/zkprogram.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L219) +[lib/proof-system/proof.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L35) *** @@ -124,7 +124,7 @@ publicInput: Input; #### Source -[lib/proof-system/zkprogram.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L217) +[lib/proof-system/proof.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L33) *** @@ -140,7 +140,7 @@ publicOutput: Output; #### Source -[lib/proof-system/zkprogram.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L218) +[lib/proof-system/proof.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L34) *** @@ -156,7 +156,7 @@ shouldVerify: Bool; #### Source -[lib/proof-system/zkprogram.ts:221](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L221) +[lib/proof-system/proof.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L37) *** @@ -168,7 +168,7 @@ optional usedVerificationKey: VerificationKey; #### Source -[lib/proof-system/zkprogram.ts:388](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L388) +[lib/proof-system/proof.ts:235](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L235) *** @@ -189,11 +189,11 @@ _Note:_ Only proofs that use the exact same composition of custom gates which we If you want to verify _any_ proof, no matter what custom gates it uses, you can use FeatureFlags.allMaybe. Please note that this might incur a significant overhead. You can also toggle specific feature flags manually by specifying them here. -Alternatively, you can use {@FeatureFlags.fromZkProgram} to compute the set of feature flags that are compatible with a given program. +Alternatively, you can use FeatureFlags.fromZkProgram to compute the set of feature flags that are compatible with a given program. #### Source -[lib/proof-system/zkprogram.ts:375](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L375) +[lib/proof-system/proof.ts:222](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L222) *** @@ -205,7 +205,7 @@ static maxProofsVerified: 0 | 1 | 2; #### Source -[lib/proof-system/zkprogram.ts:357](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L357) +[lib/proof-system/proof.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L204) *** @@ -221,7 +221,7 @@ static publicInputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:209](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L209) +[lib/proof-system/proof.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L25) *** @@ -237,10 +237,66 @@ static publicOutputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L210) +[lib/proof-system/proof.ts:26](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L26) + +## Accessors + +### provable + +```ts +get static provable(): ProvableProof, any, any> +``` + +#### Returns + +`ProvableProof`\<[`DynamicProof`](DynamicProof.mdx)\<`any`, `any`\>, `any`, `any`\> + +#### Source + +[lib/proof-system/proof.ts:309](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L309) ## Methods +### publicFields() + +```ts +publicFields(): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`ProofBase`](ProofBase.mdx).[`publicFields`](ProofBase.mdx#publicfields) + +#### Source + +[lib/proof-system/proof.ts:92](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L92) + +*** + ### toJSON() ```ts @@ -257,7 +313,7 @@ toJSON(): JsonProof #### Source -[lib/proof-system/zkprogram.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L223) +[lib/proof-system/proof.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L39) *** @@ -281,7 +337,7 @@ The verification key this proof will be verified against #### Source -[lib/proof-system/zkprogram.ts:394](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L394) +[lib/proof-system/proof.ts:241](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L241) *** @@ -303,7 +359,7 @@ verifyIf(vk: VerificationKey, condition: Bool): void #### Source -[lib/proof-system/zkprogram.ts:398](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L398) +[lib/proof-system/proof.ts:245](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L245) *** @@ -340,7 +396,7 @@ domainLog2: number): Promise> #### Source -[lib/proof-system/zkprogram.ts:430](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L430) +[lib/proof-system/proof.ts:274](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L274) *** @@ -366,7 +422,7 @@ static fromJSON(this: S, __namedParameters: JsonProof): Promise): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Parameters + +• **value**: [`ProofBase`](ProofBase.mdx)\<`any`, `any`\> + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`ProofBase`](ProofBase.mdx).[`publicFields`](ProofBase.mdx#publicfields-1) + +#### Source + +[lib/proof-system/proof.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L84) *** @@ -428,4 +528,4 @@ name: string; #### Source -[lib/proof-system/zkprogram.ts:377](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L377) +[lib/proof-system/proof.ts:224](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L224) diff --git a/docs/zkapps/o1js-reference/classes/EcdsaSignature.mdx b/docs/zkapps/o1js-reference/classes/EcdsaSignature.mdx index 227e49210..b4fbae60e 100644 --- a/docs/zkapps/o1js-reference/classes/EcdsaSignature.mdx +++ b/docs/zkapps/o1js-reference/classes/EcdsaSignature.mdx @@ -1,11 +1,3 @@ -## Deprecated - -`EcdsaSignature` is now deprecated and will be removed in a future release. Please use [EcdsaSignatureV2](EcdsaSignatureV2.mdx) instead. - -## Extended by - -- [`EcdsaSignatureV2`](EcdsaSignatureV2.mdx) - ## Constructors ### new EcdsaSignature() @@ -19,6 +11,8 @@ new EcdsaSignature(signature: { Create a new [EcdsaSignature](EcdsaSignature.mdx) from an object containing the scalars r and s. +Note: Inputs must be range checked if they originate from a different field with a different modulus or if they are not constants. Please refer to the [ForeignField](ForeignField.mdx) constructor comments for more details. + #### Parameters • **signature** @@ -33,11 +27,11 @@ Create a new [EcdsaSignature](EcdsaSignature.mdx) from an object containing the #### Source -[lib/provable/crypto/foreign-ecdsa.ts:43](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L43) +[lib/provable/crypto/foreign-ecdsa.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L39) ## Properties -### ~~r~~ +### r ```ts r: AlmostForeignField; @@ -45,11 +39,11 @@ r: AlmostForeignField; #### Source -[lib/provable/crypto/foreign-ecdsa.ts:36](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L36) +[lib/provable/crypto/foreign-ecdsa.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L31) *** -### ~~s~~ +### s ```ts s: AlmostForeignField; @@ -57,11 +51,11 @@ s: AlmostForeignField; #### Source -[lib/provable/crypto/foreign-ecdsa.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L37) +[lib/provable/crypto/foreign-ecdsa.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L32) *** -### ~~\_Curve?~~ +### \_Curve? ```ts static optional _Curve: typeof ForeignCurve; @@ -69,11 +63,11 @@ static optional _Curve: typeof ForeignCurve; #### Source -[lib/provable/crypto/foreign-ecdsa.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L196) +[lib/provable/crypto/foreign-ecdsa.ts:220](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L220) *** -### ~~\_provable?~~ +### \_provable? ```ts static optional _provable: ProvablePureExtended publicKey); +let msg = Provable.witness(Provable.Array(Field, 9), () => messageBytes.map(Field)); +let sig = Provable.witness(Ecdsa, () => signature); -[`Bool`](Bool.mdx) +// verify signature +let isValid = sig.verify(msg, pk); +isValid.assertTrue('signature verifies'); +``` #### Source -[lib/provable/crypto/foreign-ecdsa.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L148) +[lib/provable/crypto/foreign-ecdsa.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L105) *** -### ~~verifyV2()~~ +### verifyEthers() ```ts -verifyV2(message: Bytes, publicKey: FlexiblePoint): Bool +verifyEthers(message: Bytes, publicKey: FlexiblePoint): Bool ``` -Verify the ECDSA signature given the message (an array of bytes) and public key (a [Curve](EcdsaSignature.mdx#curve) point). +Verify an ECDSA signature generated by the ethers.js library, given the message (as a byte array) and a public key (a [Curve](EcdsaSignature.mdx#curve) point). +The message digest used for signing follows the format defined in EIP-191, with the Ethereum-specific prefix. **Important:** This method returns a [Bool](Bool.mdx) which indicates whether the signature is valid. So, to actually prove validity of a signature, you need to assert that the result is true. +**Note:** This method is specifically designed to verify signatures generated by ethers.js. +Ensure that the curve being used is Secp256k1, as demonstrated in the example. + #### Parameters • **message**: `Bytes` +The original message as a byte array. + • **publicKey**: `FlexiblePoint` +The public key as a point on the Secp256k1 elliptic curve. + #### Returns [`Bool`](Bool.mdx) +- A [Bool](Bool.mdx) indicating the validity of the signature. + #### Throws -if one of the signature scalars is zero or if the public key is not on the curve. +An error will be thrown if one of the signature scalars is zero or if the public key does not lie on the curve. #### Example ```ts -// create classes for your curve +import { Wallet } from 'ethers'; + +// create the class for Secp256k1 curve class Secp256k1 extends createForeignCurve(Crypto.CurveParams.Secp256k1) {} -class Scalar extends Secp256k1.Scalar {} class Ecdsa extends createEcdsa(Secp256k1) {} +// outside provable code: create inputs let message = 'my message'; -let messageBytes = new TextEncoder().encode(message); +let signatureRaw = await wallet.signMessage(message); +let compressedPublicKey = wallet.signingKey.compressedPublicKey; -// outside provable code: create inputs -let privateKey = Scalar.random(); -let publicKey = Secp256k1.generator.scale(privateKey); -let signature = Ecdsa.sign(messageBytes, privateKey.toBigInt()); +// this also works for uncompressed public keys (wallet.signingKey.publicKey) +let publicKey = Secp256k1.fromEthers(compressedPublicKey.slice(2)); +let signature = Ecdsa.fromHex(signatureRaw); // ... // in provable code: create input witnesses (or use method inputs, or constants) -let pk = Provable.witness(Secp256k1.provable, () => publicKey); -let msg = Provable.witness(Provable.Array(Field, 9), () => messageBytes.map(Field)); -let sig = Provable.witness(Ecdsa.provable, () => signature); - -// verify signature -let isValid = sig.verify(msg, pk); +// and verify the signature +let isValid = signature.verifyEthers(Bytes.fromString(message), publicKey); isValid.assertTrue('signature verifies'); ``` #### Source -[lib/provable/crypto/foreign-ecdsa.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L118) +[lib/provable/crypto/foreign-ecdsa.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L151) + +*** + +### verifySignedHash() + +```ts +verifySignedHash(msgHash: bigint | AlmostForeignField, publicKey: FlexiblePoint): Bool +``` + +Verify the ECDSA signature given the message hash (a [Scalar](Scalar.mdx)) and public key (a [Curve](EcdsaSignature.mdx#curve) point). + +This is a building block of [EcdsaSignature.verify](EcdsaSignature.mdx#verify), where the input message is also hashed. +In contrast, this method just takes the message hash (a curve scalar) as input, giving you flexibility in +choosing the hashing algorithm. + +#### Parameters + +• **msgHash**: `bigint` \| [`AlmostForeignField`](AlmostForeignField.mdx) + +• **publicKey**: `FlexiblePoint` + +#### Returns + +[`Bool`](Bool.mdx) + +#### Source + +[lib/provable/crypto/foreign-ecdsa.ts:170](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L170) *** -### ~~check()~~ +### check() ```ts static check(signature: EcdsaSignature): void @@ -347,11 +355,11 @@ static check(signature: EcdsaSignature): void #### Source -[lib/provable/crypto/foreign-ecdsa.ts:187](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L187) +[lib/provable/crypto/foreign-ecdsa.ts:209](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L209) *** -### ~~from()~~ +### from() ```ts static from(signature: FlexibleSignature): EcdsaSignature @@ -369,11 +377,11 @@ Coerce the input to a [EcdsaSignature](EcdsaSignature.mdx). #### Source -[lib/provable/crypto/foreign-ecdsa.ts:54](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L54) +[lib/provable/crypto/foreign-ecdsa.ts:50](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L50) *** -### ~~fromHex()~~ +### fromHex() ```ts static fromHex(rawSignature: string): EcdsaSignature @@ -392,11 +400,11 @@ Create an [EcdsaSignature](EcdsaSignature.mdx) from a raw 130-char hex string as #### Source -[lib/provable/crypto/foreign-ecdsa.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L63) +[lib/provable/crypto/foreign-ecdsa.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L59) *** -### ~~sign()~~ +### sign() ```ts static sign(message: Uint8Array | (number | bigint)[], privateKey: bigint): EcdsaSignature @@ -418,11 +426,11 @@ Note: This method is not provable, and only takes JS bigints as input. #### Source -[lib/provable/crypto/foreign-ecdsa.ts:167](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L167) +[lib/provable/crypto/foreign-ecdsa.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L189) *** -### ~~signHash()~~ +### signHash() ```ts static signHash(msgHash: bigint, privateKey: bigint): EcdsaSignature @@ -448,4 +456,4 @@ Note: This method is not provable, and only takes JS bigints as input. #### Source -[lib/provable/crypto/foreign-ecdsa.ts:182](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L182) +[lib/provable/crypto/foreign-ecdsa.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L204) diff --git a/docs/zkapps/o1js-reference/classes/EcdsaSignatureV2.mdx b/docs/zkapps/o1js-reference/classes/EcdsaSignatureV2.mdx deleted file mode 100644 index 59a4f3e84..000000000 --- a/docs/zkapps/o1js-reference/classes/EcdsaSignatureV2.mdx +++ /dev/null @@ -1,509 +0,0 @@ -## Deprecated - -`EcdsaSignature` is now deprecated and will be removed in a future release. Please use [EcdsaSignatureV2](EcdsaSignatureV2.mdx) instead. - -## Extends - -- [`EcdsaSignature`](EcdsaSignature.mdx) - -## Constructors - -### new EcdsaSignatureV2() - -```ts -new EcdsaSignatureV2(signature: { - "r": number | bigint | Field3 | AlmostForeignField; - "s": number | bigint | Field3 | AlmostForeignField; - }): EcdsaSignatureV2 -``` - -#### Parameters - -• **signature** - -• **signature.r**: `number` \| `bigint` \| `Field3` \| [`AlmostForeignField`](AlmostForeignField.mdx) - -• **signature.s**: `number` \| `bigint` \| `Field3` \| [`AlmostForeignField`](AlmostForeignField.mdx) - -#### Returns - -[`EcdsaSignatureV2`](EcdsaSignatureV2.mdx) - -#### Overrides - -[`EcdsaSignature`](EcdsaSignature.mdx).[`constructor`](EcdsaSignature.mdx#constructors) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:220](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L220) - -## Properties - -### ~~r~~ - -```ts -r: AlmostForeignField; -``` - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`r`](EcdsaSignature.mdx#r) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:36](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L36) - -*** - -### ~~s~~ - -```ts -s: AlmostForeignField; -``` - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`s`](EcdsaSignature.mdx#s) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L37) - -*** - -### ~~\_Curve?~~ - -```ts -static optional _Curve: typeof ForeignCurve; -``` - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`_Curve`](EcdsaSignature.mdx#_curve) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L196) - -*** - -### ~~\_provable?~~ - -```ts -static optional _provable: ProvablePureExtended; -``` - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`_provable`](EcdsaSignature.mdx#_provable) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:197](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L197) - -## Accessors - -### ~~Constructor~~ - -```ts -get Constructor(): typeof EcdsaSignature -``` - -#### Returns - -*typeof* [`EcdsaSignature`](EcdsaSignature.mdx) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:193](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L193) - -*** - -### ~~Curve~~ - -```ts -get static Curve(): typeof ForeignCurve -``` - -The [ForeignCurve](ForeignCurve.mdx) on which the ECDSA signature is defined. - -#### Returns - -*typeof* [`ForeignCurve`](ForeignCurve.mdx) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:206](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L206) - -*** - -### ~~provable~~ - -```ts -get static provable(): ProvablePureExtended -``` - -`Provable` - -#### Returns - -`ProvablePureExtended`\<[`EcdsaSignature`](EcdsaSignature.mdx), \{ - `"r"`: `bigint`; - `"s"`: `bigint`; - \}, \{ - `"r"`: `string`; - `"s"`: `string`; - \}\> - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:213](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L213) - -## Methods - -### ~~toBigInt()~~ - -```ts -toBigInt(): { - "r": bigint; - "s": bigint; -} -``` - -Convert this signature to an object with bigint fields. - -#### Returns - -```ts -{ - "r": bigint; - "s": bigint; -} -``` - -##### ~~r~~ - -```ts -r: bigint; -``` - -##### ~~s~~ - -```ts -s: bigint; -``` - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`toBigInt`](EcdsaSignature.mdx#tobigint) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L71) - -*** - -### ~~verify()~~ - -```ts -verify(message: Bytes, publicKey: FlexiblePoint): Bool -``` - -#### Parameters - -• **message**: `Bytes` - -• **publicKey**: `FlexiblePoint` - -#### Returns - -[`Bool`](Bool.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`verify`](EcdsaSignature.mdx#verify) - -#### Deprecated - -There is a security vulnerability in this method. Use [verifyV2](EcdsaSignature.mdx#verifyv2) instead. - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:78](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L78) - -*** - -### ~~verifySignedHash()~~ - -```ts -verifySignedHash(msgHash: bigint | AlmostForeignField, publicKey: FlexiblePoint): Bool -``` - -#### Parameters - -• **msgHash**: `bigint` \| [`AlmostForeignField`](AlmostForeignField.mdx) - -• **publicKey**: `FlexiblePoint` - -#### Returns - -[`Bool`](Bool.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`verifySignedHash`](EcdsaSignature.mdx#verifysignedhash) - -#### Deprecated - -There is a security vulnerability in this method. Use [verifySignedHashV2](EcdsaSignature.mdx#verifysignedhashv2) instead. - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:127](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L127) - -*** - -### ~~verifySignedHashV2()~~ - -```ts -verifySignedHashV2(msgHash: bigint | AlmostForeignField, publicKey: FlexiblePoint): Bool -``` - -Verify the ECDSA signature given the message hash (a [Scalar](Scalar.mdx)) and public key (a [Curve](EcdsaSignature.mdx#curve) point). - -This is a building block of [EcdsaSignature.verify](EcdsaSignature.mdx#verify), where the input message is also hashed. -In contrast, this method just takes the message hash (a curve scalar) as input, giving you flexibility in -choosing the hashing algorithm. - -#### Parameters - -• **msgHash**: `bigint` \| [`AlmostForeignField`](AlmostForeignField.mdx) - -• **publicKey**: `FlexiblePoint` - -#### Returns - -[`Bool`](Bool.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`verifySignedHashV2`](EcdsaSignature.mdx#verifysignedhashv2) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L148) - -*** - -### ~~verifyV2()~~ - -```ts -verifyV2(message: Bytes, publicKey: FlexiblePoint): Bool -``` - -Verify the ECDSA signature given the message (an array of bytes) and public key (a [Curve](EcdsaSignature.mdx#curve) point). - -**Important:** This method returns a [Bool](Bool.mdx) which indicates whether the signature is valid. -So, to actually prove validity of a signature, you need to assert that the result is true. - -#### Parameters - -• **message**: `Bytes` - -• **publicKey**: `FlexiblePoint` - -#### Returns - -[`Bool`](Bool.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`verifyV2`](EcdsaSignature.mdx#verifyv2) - -#### Throws - -if one of the signature scalars is zero or if the public key is not on the curve. - -#### Example - -```ts -// create classes for your curve -class Secp256k1 extends createForeignCurve(Crypto.CurveParams.Secp256k1) {} -class Scalar extends Secp256k1.Scalar {} -class Ecdsa extends createEcdsa(Secp256k1) {} - -let message = 'my message'; -let messageBytes = new TextEncoder().encode(message); - -// outside provable code: create inputs -let privateKey = Scalar.random(); -let publicKey = Secp256k1.generator.scale(privateKey); -let signature = Ecdsa.sign(messageBytes, privateKey.toBigInt()); - -// ... -// in provable code: create input witnesses (or use method inputs, or constants) -let pk = Provable.witness(Secp256k1.provable, () => publicKey); -let msg = Provable.witness(Provable.Array(Field, 9), () => messageBytes.map(Field)); -let sig = Provable.witness(Ecdsa.provable, () => signature); - -// verify signature -let isValid = sig.verify(msg, pk); -isValid.assertTrue('signature verifies'); -``` - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L118) - -*** - -### ~~check()~~ - -```ts -static check(signature: EcdsaSignatureV2): void -``` - -#### Parameters - -• **signature**: [`EcdsaSignatureV2`](EcdsaSignatureV2.mdx) - -#### Returns - -`void` - -#### Overrides - -[`EcdsaSignature`](EcdsaSignature.mdx).[`check`](EcdsaSignature.mdx#check) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:227](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L227) - -*** - -### ~~from()~~ - -```ts -static from(signature: FlexibleSignature): EcdsaSignature -``` - -Coerce the input to a [EcdsaSignature](EcdsaSignature.mdx). - -#### Parameters - -• **signature**: `FlexibleSignature` - -#### Returns - -[`EcdsaSignature`](EcdsaSignature.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`from`](EcdsaSignature.mdx#from) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:54](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L54) - -*** - -### ~~fromHex()~~ - -```ts -static fromHex(rawSignature: string): EcdsaSignature -``` - -Create an [EcdsaSignature](EcdsaSignature.mdx) from a raw 130-char hex string as used in -[Ethereum transactions](https://ethereum.org/en/developers/docs/transactions/#typed-transaction-envelope). - -#### Parameters - -• **rawSignature**: `string` - -#### Returns - -[`EcdsaSignature`](EcdsaSignature.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`fromHex`](EcdsaSignature.mdx#fromhex) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L63) - -*** - -### ~~sign()~~ - -```ts -static sign(message: Uint8Array | (number | bigint)[], privateKey: bigint): EcdsaSignature -``` - -Create an [EcdsaSignature](EcdsaSignature.mdx) by signing a message with a private key. - -Note: This method is not provable, and only takes JS bigints as input. - -#### Parameters - -• **message**: `Uint8Array` \| (`number` \| `bigint`)[] - -• **privateKey**: `bigint` - -#### Returns - -[`EcdsaSignature`](EcdsaSignature.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`sign`](EcdsaSignature.mdx#sign) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:167](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L167) - -*** - -### ~~signHash()~~ - -```ts -static signHash(msgHash: bigint, privateKey: bigint): EcdsaSignature -``` - -Create an [EcdsaSignature](EcdsaSignature.mdx) by signing a message hash with a private key. - -This is a building block of [EcdsaSignature.sign](EcdsaSignature.mdx#sign), where the input message is also hashed. -In contrast, this method just takes the message hash (a curve scalar) as input, giving you flexibility in -choosing the hashing algorithm. - -Note: This method is not provable, and only takes JS bigints as input. - -#### Parameters - -• **msgHash**: `bigint` - -• **privateKey**: `bigint` - -#### Returns - -[`EcdsaSignature`](EcdsaSignature.mdx) - -#### Inherited from - -[`EcdsaSignature`](EcdsaSignature.mdx).[`signHash`](EcdsaSignature.mdx#signhash) - -#### Source - -[lib/provable/crypto/foreign-ecdsa.ts:182](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L182) diff --git a/docs/zkapps/o1js-reference/classes/Field.mdx b/docs/zkapps/o1js-reference/classes/Field.mdx index 0dd2a20d3..0937675fe 100644 --- a/docs/zkapps/o1js-reference/classes/Field.mdx +++ b/docs/zkapps/o1js-reference/classes/Field.mdx @@ -66,7 +66,7 @@ Coerce anything "field-like" (bigint, number, string, and [Field](Field.mdx)) to #### Source -[lib/provable/field.ts:97](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L97) +[lib/provable/field.ts:97](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L97) ## Properties @@ -78,7 +78,7 @@ value: FieldVar; #### Source -[lib/provable/field.ts:86](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L86) +[lib/provable/field.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L86) *** @@ -93,7 +93,7 @@ Order of the [Field](Field.mdx) is 289480223093290488558927462521719769633630564 #### Source -[lib/provable/field.ts:92](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L92) +[lib/provable/field.ts:92](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L92) *** @@ -107,7 +107,7 @@ The size of a [Field](Field.mdx) element in bits - 255. #### Source -[lib/provable/field.ts:1127](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1127) +[lib/provable/field.ts:1127](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1127) *** @@ -121,7 +121,7 @@ The size of a [Field](Field.mdx) element in bytes - 32. #### Source -[lib/provable/field.ts:1122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1122) +[lib/provable/field.ts:1122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1122) ## Methods @@ -169,7 +169,7 @@ sum.sub(Field(-7)).assertEquals(x); #### Source -[lib/provable/field.ts:250](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L250) +[lib/provable/field.ts:250](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L250) *** @@ -194,7 +194,7 @@ If the assertion fails, the code throws an error. #### Source -[lib/provable/field.ts:780](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L780) +[lib/provable/field.ts:780](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L780) *** @@ -222,7 +222,7 @@ See [Field.equals](Field.mdx#equals) for more details. #### Source -[lib/provable/field.ts:208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L208) +[lib/provable/field.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L208) *** @@ -251,7 +251,7 @@ See [Field.greaterThan](Field.mdx#greaterthan) for more details. #### Source -[lib/provable/field.ts:714](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L714) +[lib/provable/field.ts:714](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L714) *** @@ -280,7 +280,7 @@ See [Field.greaterThanOrEqual](Field.mdx#greaterthanorequal) for more details. #### Source -[lib/provable/field.ts:729](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L729) +[lib/provable/field.ts:729](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L729) *** @@ -309,7 +309,7 @@ See [lessThan](Field.mdx#lessthan) for more details. #### Source -[lib/provable/field.ts:664](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L664) +[lib/provable/field.ts:664](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L664) *** @@ -338,7 +338,7 @@ See [Field.lessThanOrEqual](Field.mdx#lessthanorequal) for more details. #### Source -[lib/provable/field.ts:689](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L689) +[lib/provable/field.ts:689](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L689) *** @@ -370,7 +370,7 @@ x.assertNotEquals(0, "expect x to be non-zero"); #### Source -[lib/provable/field.ts:746](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L746) +[lib/provable/field.ts:746](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L746) *** @@ -421,7 +421,7 @@ quotient.mul(y).assertEquals(x); #### Source -[lib/provable/field.ts:442](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L442) +[lib/provable/field.ts:442](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L442) *** @@ -452,7 +452,7 @@ Field(5).equals(5).assertEquals(Bool(true)); #### Source -[lib/provable/field.ts:522](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L522) +[lib/provable/field.ts:522](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L522) *** @@ -491,7 +491,7 @@ let isFalse = Field(1).div(2).greaterThan(Field(1).div(3); // in fact, 1/3 > 1/2 #### Source -[lib/provable/field.ts:625](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L625) +[lib/provable/field.ts:625](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L625) *** @@ -530,7 +530,7 @@ let isFalse = Field(1).div(2).greaterThanOrEqual(Field(1).div(3); // in fact, 1/ #### Source -[lib/provable/field.ts:649](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L649) +[lib/provable/field.ts:649](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L649) *** @@ -563,7 +563,7 @@ inverse.assertEquals(Field(1).div(someField)); // This statement is always true #### Source -[lib/provable/field.ts:396](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L396) +[lib/provable/field.ts:396](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L396) *** @@ -598,7 +598,7 @@ console.log(Field(42).isConstant()); // true #### Source -[lib/provable/field.ts:142](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L142) +[lib/provable/field.ts:142](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L142) *** @@ -626,7 +626,7 @@ b.isEven(); // true #### Source -[lib/provable/field.ts:339](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L339) +[lib/provable/field.ts:339](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L339) *** @@ -646,7 +646,7 @@ See [Field.isEven](Field.mdx#iseven) for examples. #### Source -[lib/provable/field.ts:323](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L323) +[lib/provable/field.ts:323](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L323) *** @@ -685,7 +685,7 @@ let isFalse = Field(1).div(3).lessThan(Field(1).div(2)); // in fact, 1/3 > 1/2 #### Source -[lib/provable/field.ts:571](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L571) +[lib/provable/field.ts:571](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L571) *** @@ -724,7 +724,7 @@ let isFalse = Field(1).div(3).lessThanOrEqual(Field(1).div(2)); // in fact, 1/3 #### Source -[lib/provable/field.ts:598](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L598) +[lib/provable/field.ts:598](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L598) *** @@ -757,7 +757,7 @@ product.assertEquals(Field(15)); #### Source -[lib/provable/field.ts:358](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L358) +[lib/provable/field.ts:358](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L358) *** @@ -793,7 +793,7 @@ someField.neg().assertEquals(someField.mul(Field(-1))); // This statement is alw #### Source -[lib/provable/field.ts:278](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L278) +[lib/provable/field.ts:278](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L278) *** @@ -819,7 +819,7 @@ A [Field](Field.mdx) element that is equal to the result of AST that was previou #### Source -[lib/provable/field.ts:872](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L872) +[lib/provable/field.ts:872](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L872) *** @@ -852,7 +852,7 @@ Therefore, this method leaves an adversarial prover the choice between two diffe #### Source -[lib/provable/field.ts:492](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L492) +[lib/provable/field.ts:492](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L492) *** @@ -883,7 +883,7 @@ square.assertEquals(someField.mul(someField)); // This statement is always true #### Source -[lib/provable/field.ts:463](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L463) +[lib/provable/field.ts:463](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L463) *** @@ -929,7 +929,7 @@ difference.add(Field(2)).assertEquals(x); #### Source -[lib/provable/field.ts:314](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L314) +[lib/provable/field.ts:314](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L314) *** @@ -949,7 +949,7 @@ As the primitive [Field](Field.mdx) type has no auxiliary data associated with i #### Source -[lib/provable/field.ts:1005](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1005) +[lib/provable/field.ts:1005](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1005) *** @@ -978,7 +978,7 @@ console.log(someField.toBigInt()); #### Source -[lib/provable/field.ts:176](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L176) +[lib/provable/field.ts:176](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L176) *** @@ -1010,7 +1010,7 @@ An array of [Bool](Bool.mdx) element representing little endian binary represent #### Source -[lib/provable/field.ts:810](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L810) +[lib/provable/field.ts:810](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L810) *** @@ -1039,7 +1039,7 @@ someField.toConstant().assertEquals(someField); // Always true #### Source -[lib/provable/field.ts:159](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L159) +[lib/provable/field.ts:159](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L159) *** @@ -1061,7 +1061,7 @@ A [Field](Field.mdx) array of length 1 created from this [Field](Field.mdx). #### Source -[lib/provable/field.ts:996](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L996) +[lib/provable/field.ts:996](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L996) *** @@ -1090,7 +1090,7 @@ console.log(someField.toJSON()); #### Source -[lib/provable/field.ts:1028](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1028) +[lib/provable/field.ts:1028](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1028) *** @@ -1119,7 +1119,7 @@ console.log(someField.toString()); #### Source -[lib/provable/field.ts:194](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L194) +[lib/provable/field.ts:194](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L194) *** @@ -1139,7 +1139,7 @@ As any field element can be a [Field](Field.mdx), this function does not create #### Source -[lib/provable/field.ts:966](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L966) +[lib/provable/field.ts:966](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L966) *** @@ -1155,7 +1155,7 @@ static empty(): Field #### Source -[lib/provable/field.ts:1011](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1011) +[lib/provable/field.ts:1011](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1011) *** @@ -1175,7 +1175,7 @@ static from(x: string | number | bigint | Field): Field #### Source -[lib/provable/field.ts:119](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L119) +[lib/provable/field.ts:119](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L119) *** @@ -1203,7 +1203,7 @@ A [Field](Field.mdx) element matching the [little endian binary representation]( #### Source -[lib/provable/field.ts:843](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L843) +[lib/provable/field.ts:843](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L843) *** @@ -1232,7 +1232,7 @@ A new [Field](Field.mdx) element created using the [little-endian](https://en.wi #### Source -[lib/provable/field.ts:1115](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1115) +[lib/provable/field.ts:1115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1115) *** @@ -1262,7 +1262,7 @@ The first [Field](Field.mdx) element of the given array. #### Source -[lib/provable/field.ts:955](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L955) +[lib/provable/field.ts:955](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L955) *** @@ -1288,7 +1288,7 @@ A [Field](Field.mdx) coerced from the given JSON string. #### Source -[lib/provable/field.ts:1060](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1060) +[lib/provable/field.ts:1060](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1060) *** @@ -1310,7 +1310,7 @@ static fromValue(x: string | number | bigint | Field): Field #### Source -[lib/provable/field.ts:985](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L985) +[lib/provable/field.ts:985](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L985) *** @@ -1336,7 +1336,7 @@ console.log(Field.random().toBigInt()); // Run this code twice! #### Source -[lib/provable/field.ts:894](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L894) +[lib/provable/field.ts:894](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L894) *** @@ -1366,7 +1366,7 @@ Part of the `Binable` interface. #### Source -[lib/provable/field.ts:1098](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1098) +[lib/provable/field.ts:1098](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1098) *** @@ -1395,7 +1395,7 @@ console.log(Field.sizeInFields()); // Prints 1 #### Source -[lib/provable/field.ts:940](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L940) +[lib/provable/field.ts:940](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L940) *** @@ -1415,7 +1415,7 @@ As the primitive [Field](Field.mdx) type has no auxiliary data associated with i #### Source -[lib/provable/field.ts:923](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L923) +[lib/provable/field.ts:923](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L923) *** @@ -1437,7 +1437,7 @@ Convert a [Field](Field.mdx) element to a bigint. #### Source -[lib/provable/field.ts:978](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L978) +[lib/provable/field.ts:978](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L978) *** @@ -1462,7 +1462,7 @@ An array of digits equal to the [little-endian](https://en.wikipedia.org/wiki/En #### Source -[lib/provable/field.ts:1089](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1089) +[lib/provable/field.ts:1089](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1089) *** @@ -1489,7 +1489,7 @@ A [Field](Field.mdx) array of length 1 created from this [Field](Field.mdx). #### Source -[lib/provable/field.ts:912](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L912) +[lib/provable/field.ts:912](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L912) *** @@ -1527,7 +1527,7 @@ fields: Field[]; #### Source -[lib/provable/field.ts:1074](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1074) +[lib/provable/field.ts:1074](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1074) *** @@ -1560,7 +1560,7 @@ console.log(Field.toJSON(someField)); #### Source -[lib/provable/field.ts:1047](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1047) +[lib/provable/field.ts:1047](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1047) *** @@ -1582,4 +1582,4 @@ static toValue(x: Field): bigint #### Source -[lib/provable/field.ts:971](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L971) +[lib/provable/field.ts:971](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L971) diff --git a/docs/zkapps/o1js-reference/classes/ForeignCurve.mdx b/docs/zkapps/o1js-reference/classes/ForeignCurve.mdx index 88ab88172..870693162 100644 --- a/docs/zkapps/o1js-reference/classes/ForeignCurve.mdx +++ b/docs/zkapps/o1js-reference/classes/ForeignCurve.mdx @@ -1,11 +1,3 @@ -## Deprecated - -`ForeignCurve` is now deprecated and will be removed in a future release. Please use [ForeignCurveV2](ForeignCurveV2.mdx) instead. - -## Extended by - -- [`ForeignCurveV2`](ForeignCurveV2.mdx) - ## Constructors ### new ForeignCurve() @@ -19,6 +11,8 @@ new ForeignCurve(g: { Create a new [ForeignCurve](ForeignCurve.mdx) from an object representing the (affine) x and y coordinates. +Note: Inputs must be range checked if they originate from a different field with a different modulus or if they are not constants. Please refer to the [ForeignField](ForeignField.mdx) constructor comments for more details. + #### Parameters • **g** @@ -43,11 +37,11 @@ let x = new ForeignCurve({ x: 1n, y: 1n }); #### Source -[lib/provable/crypto/foreign-curve.ts:54](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L54) +[lib/provable/crypto/foreign-curve.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L49) ## Properties -### ~~x~~ +### x ```ts x: AlmostForeignField; @@ -55,11 +49,11 @@ x: AlmostForeignField; #### Source -[lib/provable/crypto/foreign-curve.ts:39](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L39) +[lib/provable/crypto/foreign-curve.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L32) *** -### ~~y~~ +### y ```ts y: AlmostForeignField; @@ -67,11 +61,11 @@ y: AlmostForeignField; #### Source -[lib/provable/crypto/foreign-curve.ts:40](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L40) +[lib/provable/crypto/foreign-curve.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L33) *** -### ~~\_Bigint?~~ +### \_Bigint? ```ts static optional _Bigint: {}; @@ -79,11 +73,11 @@ static optional _Bigint: {}; #### Source -[lib/provable/crypto/foreign-curve.ts:249](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L249) +[lib/provable/crypto/foreign-curve.ts:362](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L362) *** -### ~~\_Field?~~ +### \_Field? ```ts static optional _Field: typeof AlmostForeignField; @@ -91,11 +85,11 @@ static optional _Field: typeof AlmostForeignField; #### Source -[lib/provable/crypto/foreign-curve.ts:250](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L250) +[lib/provable/crypto/foreign-curve.ts:363](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L363) *** -### ~~\_Scalar?~~ +### \_Scalar? ```ts static optional _Scalar: typeof AlmostForeignField; @@ -103,11 +97,11 @@ static optional _Scalar: typeof AlmostForeignField; #### Source -[lib/provable/crypto/foreign-curve.ts:251](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L251) +[lib/provable/crypto/foreign-curve.ts:364](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L364) *** -### ~~\_provable?~~ +### \_provable? ```ts static optional _provable: ProvablePureExtended; -``` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`_provable`](ForeignCurve.mdx#_provable) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:252](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L252) - -## Accessors - -### ~~Constructor~~ - -```ts -get Constructor(): typeof ForeignCurve -``` - -#### Returns - -*typeof* [`ForeignCurve`](ForeignCurve.mdx) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:246](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L246) - -*** - -### ~~modulus~~ - -```ts -get modulus(): bigint -``` - -The size of the curve's base field. - -#### Returns - -`bigint` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:90](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L90) - -*** - -### ~~Bigint~~ - -```ts -get static Bigint(): {} -``` - -Curve arithmetic on JS bigints. - -#### Returns - -```ts -{} -``` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:261](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L261) - -*** - -### ~~Field~~ - -```ts -get static Field(): typeof AlmostForeignField -``` - -The base field of this curve as a [ForeignField](ForeignField.mdx). - -#### Returns - -*typeof* [`AlmostForeignField`](AlmostForeignField.mdx) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:268](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L268) - -*** - -### ~~Scalar~~ - -```ts -get static Scalar(): typeof AlmostForeignField -``` - -The scalar field of this curve as a [ForeignField](ForeignField.mdx). - -#### Returns - -*typeof* [`AlmostForeignField`](AlmostForeignField.mdx) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:275](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L275) - -*** - -### ~~generator~~ - -```ts -get static generator(): ForeignCurve -``` - -The constant generator point. - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:78](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L78) - -*** - -### ~~modulus~~ - -```ts -get static modulus(): bigint -``` - -The size of the curve's base field. - -#### Returns - -`bigint` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:84](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L84) - -*** - -### ~~provable~~ - -```ts -get static provable(): ProvablePureExtended -``` - -`Provable` - -#### Returns - -`ProvablePureExtended`\<[`ForeignCurve`](ForeignCurve.mdx), \{ - `"x"`: `bigint`; - `"y"`: `bigint`; - \}, \{ - `"x"`: `string`; - `"y"`: `string`; - \}\> - -#### Source - -[lib/provable/crypto/foreign-curve.ts:282](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L282) - -## Methods - -### ~~add()~~ - -```ts -add(h: ForeignCurve | FlexiblePoint): ForeignCurve -``` - -Elliptic curve addition. - -```ts -let r = p.add(q); // r = p + q -``` - -**Important**: this is _incomplete addition_ and does not handle the degenerate cases: -- Inputs are equal, `g = h` (where you would use [double](ForeignCurve.mdx#double)). - In this case, the result of this method is garbage and can be manipulated arbitrarily by a malicious prover. -- Inputs are inverses of each other, `g = -h`, so that the result would be the zero point. - In this case, the proof fails. - -If you want guaranteed soundness regardless of the input, use [addSafe](ForeignCurve.mdx#addsafe) instead. - -#### Parameters - -• **h**: [`ForeignCurve`](ForeignCurve.mdx) \| `FlexiblePoint` - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`add`](ForeignCurve.mdx#add) - -#### Throws - -if the inputs are inverses of each other. - -#### Source - -[lib/provable/crypto/foreign-curve.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L130) - -*** - -### ~~addSafe()~~ - -```ts -addSafe(h: ForeignCurve | FlexiblePoint): ForeignCurve -``` - -Safe elliptic curve addition. - -This is the same as [add](ForeignCurve.mdx#add), but additionally proves that the inputs are not equal. -Therefore, the method is guaranteed to either fail or return a valid addition result. - -**Beware**: this is more expensive than [add](ForeignCurve.mdx#add), and is still incomplete in that -it does not succeed on equal or inverse inputs. - -#### Parameters - -• **h**: [`ForeignCurve`](ForeignCurve.mdx) \| `FlexiblePoint` - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`addSafe`](ForeignCurve.mdx#addsafe) - -#### Throws - -if the inputs are equal or inverses of each other. - -#### Source - -[lib/provable/crypto/foreign-curve.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L148) - -*** - -### ~~assertInSubgroup()~~ - -```ts -assertInSubgroup(): void -``` - -Assert that this point lies in the subgroup defined by `order*P = 0`. - -Note: this is a no-op if the curve has cofactor equal to 1. Otherwise -it performs the full scalar multiplication `order*P` and is expensive. - -#### Returns - -`void` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`assertInSubgroup`](ForeignCurve.mdx#assertinsubgroup) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:228](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L228) - -*** - -### ~~assertOnCurve()~~ - -```ts -assertOnCurve(): void -``` - -Assert that this point lies on the elliptic curve, which means it satisfies the equation -`y^2 = x^3 + ax + b` - -#### Returns - -`void` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`assertOnCurve`](ForeignCurve.mdx#assertoncurve) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:212](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L212) - -*** - -### ~~double()~~ - -```ts -double(): ForeignCurve -``` - -Elliptic curve doubling. - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`double`](ForeignCurve.mdx#double) - -#### Example - -```ts -let r = p.double(); // r = 2 * p -``` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:167](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L167) - -*** - -### ~~isConstant()~~ - -```ts -isConstant(): boolean -``` - -Checks whether this curve point is constant. - -See FieldVar to understand constants vs variables. - -#### Returns - -`boolean` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`isConstant`](ForeignCurve.mdx#isconstant) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:99](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L99) - -*** - -### ~~negate()~~ - -```ts -negate(): ForeignCurve -``` - -Elliptic curve negation. - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`negate`](ForeignCurve.mdx#negate) - -#### Example - -```ts -let r = p.negate(); // r = -p -``` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:181](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L181) - -*** - -### ~~scale()~~ - -```ts -scale(scalar: number | bigint | AlmostForeignField): ForeignCurve -``` - -Elliptic curve scalar multiplication, where the scalar is represented as a [ForeignField](ForeignField.mdx) element. - -**Important**: this proves that the result of the scalar multiplication is not the zero point. - -#### Parameters - -• **scalar**: `number` \| `bigint` \| [`AlmostForeignField`](AlmostForeignField.mdx) - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`scale`](ForeignCurve.mdx#scale) - -#### Throws - -if the scalar multiplication results in the zero point; for example, if the scalar is zero. - -#### Example - -```ts -let r = p.scale(s); // r = s * p -``` - -#### Source - -[lib/provable/crypto/foreign-curve.ts:197](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L197) - -*** - -### ~~toBigint()~~ - -```ts -toBigint(): GroupAffine -``` - -Convert this curve point to a point with bigint coordinates. - -#### Returns - -`GroupAffine` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`toBigint`](ForeignCurve.mdx#tobigint) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:106](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L106) - -*** - -### ~~assertInSubgroup()~~ - -```ts -static assertInSubgroup(g: ForeignCurve): void -``` - -#### Parameters - -• **g**: [`ForeignCurve`](ForeignCurve.mdx) - -#### Returns - -`void` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`assertInSubgroup`](ForeignCurve.mdx#assertinsubgroup-1) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:216](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L216) - -*** - -### ~~assertOnCurve()~~ - -```ts -static assertOnCurve(g: ForeignCurve): void -``` - -#### Parameters - -• **g**: [`ForeignCurve`](ForeignCurve.mdx) - -#### Returns - -`void` - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`assertOnCurve`](ForeignCurve.mdx#assertoncurve-1) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:204](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L204) - -*** - -### ~~check()~~ - -```ts -static check(g: ForeignCurveV2): void -``` - -Check that this is a valid element of the target subgroup of the curve: -- Check that the coordinates are valid field elements -- Use [()](ForeignCurve.mdx#assertoncurve-1) to check that the point lies on the curve -- If the curve has cofactor unequal to 1, use [()](ForeignCurve.mdx#assertinsubgroup-1). - -#### Parameters - -• **g**: [`ForeignCurveV2`](ForeignCurveV2.mdx) - -#### Returns - -`void` - -#### Overrides - -[`ForeignCurve`](ForeignCurve.mdx).[`check`](ForeignCurve.mdx#check) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:296](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L296) - -*** - -### ~~from()~~ - -```ts -static from(g: ForeignCurve | FlexiblePoint): ForeignCurve -``` - -Coerce the input to a [ForeignCurve](ForeignCurve.mdx). - -#### Parameters - -• **g**: [`ForeignCurve`](ForeignCurve.mdx) \| `FlexiblePoint` - -#### Returns - -[`ForeignCurve`](ForeignCurve.mdx) - -#### Inherited from - -[`ForeignCurve`](ForeignCurve.mdx).[`from`](ForeignCurve.mdx#from) - -#### Source - -[lib/provable/crypto/foreign-curve.ts:70](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L70) diff --git a/docs/zkapps/o1js-reference/classes/ForeignField.mdx b/docs/zkapps/o1js-reference/classes/ForeignField.mdx index 1481a77d9..1df7e78a0 100644 --- a/docs/zkapps/o1js-reference/classes/ForeignField.mdx +++ b/docs/zkapps/o1js-reference/classes/ForeignField.mdx @@ -32,9 +32,15 @@ Create a new [ForeignField](ForeignField.mdx) from a bigint, number, string or a let x = new ForeignField(5); ``` +Note: Inputs must be range checked if they originate from a different field with a different modulus or if they are not constants. + +- When constructing from another [ForeignField](ForeignField.mdx) instance, ensure the modulus matches. If not, check the modulus using `Gadgets.ForeignField.assertLessThan()` and handle appropriately. +- When constructing from a Field3 array, ensure all elements are valid Field elements and range checked. +- Ensure constants are correctly reduced to the modulus of the field. + #### Source -[lib/provable/foreign-field.ts:96](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L96) +[lib/provable/foreign-field.ts:101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L101) ## Properties @@ -48,7 +54,7 @@ The internal representation of a foreign field element, as a tuple of 3 limbs. #### Source -[lib/provable/foreign-field.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L50) +[lib/provable/foreign-field.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L49) *** @@ -60,7 +66,7 @@ static _Bigint: undefined | {} = undefined; #### Source -[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L28) +[lib/provable/foreign-field.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L27) *** @@ -72,7 +78,7 @@ static _modulus: undefined | bigint = undefined; #### Source -[lib/provable/foreign-field.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L29) +[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L28) *** @@ -84,7 +90,7 @@ static _provable: any = undefined; #### Source -[lib/provable/foreign-field.ts:408](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L408) +[lib/provable/foreign-field.ts:414](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L414) *** @@ -102,7 +108,7 @@ Sibling classes that represent different ranges of field elements. #### Source -[lib/provable/foreign-field.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L59) +[lib/provable/foreign-field.ts:58](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L58) ## Accessors @@ -118,7 +124,7 @@ get Constructor(): typeof ForeignField #### Source -[lib/provable/foreign-field.ts:52](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L52) +[lib/provable/foreign-field.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L51) *** @@ -134,7 +140,7 @@ get modulus(): bigint #### Source -[lib/provable/foreign-field.ts:40](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L40) +[lib/provable/foreign-field.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L39) *** @@ -152,7 +158,7 @@ Constructor for field elements that are "almost reduced", i.e. lie in the range #### Source -[lib/provable/foreign-field.ts:77](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L77) +[lib/provable/foreign-field.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L76) *** @@ -170,7 +176,7 @@ get static Bigint(): {} #### Source -[lib/provable/foreign-field.ts:32](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L32) +[lib/provable/foreign-field.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L31) *** @@ -188,7 +194,7 @@ Constructor for field elements that are fully reduced, i.e. lie in the range [0, #### Source -[lib/provable/foreign-field.ts:84](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L84) +[lib/provable/foreign-field.ts:83](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L83) *** @@ -206,7 +212,7 @@ Constructor for unreduced field elements. #### Source -[lib/provable/foreign-field.ts:70](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L70) +[lib/provable/foreign-field.ts:69](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L69) *** @@ -222,7 +228,7 @@ get static modulus(): bigint #### Source -[lib/provable/foreign-field.ts:36](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L36) +[lib/provable/foreign-field.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L35) *** @@ -240,7 +246,7 @@ get static provable(): any #### Source -[lib/provable/foreign-field.ts:413](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L413) +[lib/provable/foreign-field.ts:419](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L419) *** @@ -256,7 +262,7 @@ get static sizeInBits(): number #### Source -[lib/provable/foreign-field.ts:43](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L43) +[lib/provable/foreign-field.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L42) ## Methods @@ -284,7 +290,7 @@ x.add(2); // x + 2 mod p #### Source -[lib/provable/foreign-field.ts:208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L208) +[lib/provable/foreign-field.ts:218](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L218) *** @@ -312,7 +318,7 @@ ensuring validity of all our non-native field arithmetic methods. #### Source -[lib/provable/foreign-field.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L163) +[lib/provable/foreign-field.ts:173](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L173) *** @@ -333,7 +339,7 @@ Returns the field element as a [CanonicalForeignField](CanonicalForeignField.mdx #### Source -[lib/provable/foreign-field.ts:194](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L194) +[lib/provable/foreign-field.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L204) *** @@ -375,7 +381,7 @@ xChecked satisfies CanonicalForeignField; ##### Source -[lib/provable/foreign-field.ts:286](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L286) +[lib/provable/foreign-field.ts:296](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L296) #### assertEquals(y, message) @@ -395,7 +401,7 @@ assertEquals(y: AlmostForeignField, message?: string): AlmostForeignField ##### Source -[lib/provable/foreign-field.ts:290](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L290) +[lib/provable/foreign-field.ts:300](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L300) #### assertEquals(y, message) @@ -415,7 +421,7 @@ assertEquals(y: ForeignField, message?: string): ForeignField ##### Source -[lib/provable/foreign-field.ts:291](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L291) +[lib/provable/foreign-field.ts:301](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L301) *** @@ -447,7 +453,7 @@ x.assertLessThan(10); #### Source -[lib/provable/foreign-field.ts:333](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L333) +[lib/provable/foreign-field.ts:339](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L339) *** @@ -467,7 +473,7 @@ See FieldVar to understand constants vs variables. #### Source -[lib/provable/foreign-field.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L126) +[lib/provable/foreign-field.ts:136](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L136) *** @@ -491,7 +497,7 @@ x.neg(); // -x mod p = p - x #### Source -[lib/provable/foreign-field.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L219) +[lib/provable/foreign-field.ts:229](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L229) *** @@ -519,7 +525,7 @@ x.sub(1); // x - 1 mod p #### Source -[lib/provable/foreign-field.ts:234](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L234) +[lib/provable/foreign-field.ts:244](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L244) *** @@ -537,7 +543,7 @@ Convert this field element to a bigint. #### Source -[lib/provable/foreign-field.ts:146](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L146) +[lib/provable/foreign-field.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L156) *** @@ -561,7 +567,7 @@ This method is provable! #### Source -[lib/provable/foreign-field.ts:352](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L352) +[lib/provable/foreign-field.ts:358](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L358) *** @@ -584,7 +590,7 @@ that is, in situations where the prover computes a value outside provable code. #### Source -[lib/provable/foreign-field.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L138) +[lib/provable/foreign-field.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L148) *** @@ -602,7 +608,7 @@ Instance version of `Provable.toFields`, see Provable.toFields #### Source -[lib/provable/foreign-field.ts:400](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L400) +[lib/provable/foreign-field.ts:406](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L406) *** @@ -631,7 +637,7 @@ This is most efficient than when checking a multiple of 3 field elements at once #### Source -[lib/provable/foreign-field.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L177) +[lib/provable/foreign-field.ts:187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L187) *** @@ -651,7 +657,7 @@ static check(_: ForeignField): void #### Source -[lib/provable/foreign-field.ts:404](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L404) +[lib/provable/foreign-field.ts:410](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L410) *** @@ -675,7 +681,7 @@ Coerce the input to a [ForeignField](ForeignField.mdx). ##### Source -[lib/provable/foreign-field.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L114) +[lib/provable/foreign-field.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L124) #### from(x) @@ -693,7 +699,7 @@ static from(x: string | number | bigint | ForeignField): ForeignField ##### Source -[lib/provable/foreign-field.ts:115](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L115) +[lib/provable/foreign-field.ts:125](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L125) *** @@ -717,7 +723,7 @@ This method is provable! #### Source -[lib/provable/foreign-field.ts:382](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L382) +[lib/provable/foreign-field.ts:388](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L388) *** @@ -733,7 +739,7 @@ static random(): CanonicalForeignField #### Source -[lib/provable/foreign-field.ts:393](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L393) +[lib/provable/foreign-field.ts:399](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L399) *** @@ -775,4 +781,4 @@ than chaining calls to [ForeignField.add](ForeignField.mdx#add) and [ForeignFiel #### Source -[lib/provable/foreign-field.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L259) +[lib/provable/foreign-field.ts:269](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L269) diff --git a/docs/zkapps/o1js-reference/classes/Group.mdx b/docs/zkapps/o1js-reference/classes/Group.mdx index b52b3c905..219cf7c36 100644 --- a/docs/zkapps/o1js-reference/classes/Group.mdx +++ b/docs/zkapps/o1js-reference/classes/Group.mdx @@ -45,7 +45,7 @@ Coerces anything group-like to a [Group](Group.mdx). #### Source -[lib/provable/group.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L50) +[lib/provable/group.ts:50](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L50) ## Properties @@ -57,7 +57,7 @@ x: Field; #### Source -[lib/provable/group.ts:21](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L21) +[lib/provable/group.ts:21](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L21) *** @@ -69,7 +69,7 @@ y: Field; #### Source -[lib/provable/group.ts:22](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L22) +[lib/provable/group.ts:22](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L22) ## Accessors @@ -87,7 +87,7 @@ The generator `g` of the Group. #### Source -[lib/provable/group.ts:27](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L27) +[lib/provable/group.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L27) *** @@ -114,7 +114,7 @@ g.add(zero).assertEquals(g); #### Source -[lib/provable/group.ts:43](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L43) +[lib/provable/group.ts:43](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L43) ## Methods @@ -141,7 +141,7 @@ let g2 = g1.add(g1) #### Source -[lib/provable/group.ts:97](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L97) +[lib/provable/group.ts:97](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L97) *** @@ -171,7 +171,7 @@ This case has to be prevented or handled separately by the caller of this method #### Source -[lib/provable/group.ts:136](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L136) +[lib/provable/group.ts:136](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L136) *** @@ -200,7 +200,7 @@ g1.assertEquals(g2); #### Source -[lib/provable/group.ts:200](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L200) +[lib/provable/group.ts:200](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L200) *** @@ -227,7 +227,7 @@ g1.equals(g1); // Bool(true) #### Source -[lib/provable/group.ts:216](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L216) +[lib/provable/group.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L216) *** @@ -245,7 +245,7 @@ Checks if this element is the `zero` element `{x: 0, y: 0}`. #### Source -[lib/provable/group.ts:84](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L84) +[lib/provable/group.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L84) *** @@ -263,7 +263,7 @@ Negates this [Group](Group.mdx). Under the hood, it simply negates the `y` coord #### Source -[lib/provable/group.ts:165](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L165) +[lib/provable/group.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L165) *** @@ -290,7 +290,7 @@ let 5g = g.scale(s); #### Source -[lib/provable/group.ts:179](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L179) +[lib/provable/group.ts:179](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L179) *** @@ -312,7 +312,7 @@ Subtracts another [Group](Group.mdx) element from this one. #### Source -[lib/provable/group.ts:158](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L158) +[lib/provable/group.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L158) *** @@ -332,7 +332,7 @@ Returns an array containing this [Group](Group.mdx) element as an array of [Fiel #### Source -[lib/provable/group.ts:253](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L253) +[lib/provable/group.ts:253](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L253) *** @@ -372,7 +372,7 @@ y: string; #### Source -[lib/provable/group.ts:238](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L238) +[lib/provable/group.ts:238](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L238) *** @@ -394,7 +394,7 @@ Checks that a [Group](Group.mdx) element is constraint properly by checking that #### Source -[lib/provable/group.ts:330](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L330) +[lib/provable/group.ts:330](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L330) *** @@ -410,7 +410,7 @@ static empty(): Group #### Source -[lib/provable/group.ts:356](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L356) +[lib/provable/group.ts:356](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L356) *** @@ -454,7 +454,7 @@ Coerces two x and y coordinates into a [Group](Group.mdx) element. #### Source -[lib/provable/group.ts:260](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L260) +[lib/provable/group.ts:260](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L260) *** @@ -478,7 +478,7 @@ Deserializes a [Group](Group.mdx) element from a list of field elements. #### Source -[lib/provable/group.ts:290](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L290) +[lib/provable/group.ts:290](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L290) *** @@ -527,7 +527,7 @@ This operation does NOT affect the circuit and can't be used to prove anything a #### Source -[lib/provable/group.ts:317](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L317) +[lib/provable/group.ts:317](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L317) *** @@ -553,7 +553,7 @@ static fromValue(g: Group | { #### Source -[lib/provable/group.ts:227](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L227) +[lib/provable/group.ts:227](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L227) *** @@ -573,7 +573,7 @@ Returns 2. #### Source -[lib/provable/group.ts:299](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L299) +[lib/provable/group.ts:299](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L299) *** @@ -597,7 +597,7 @@ Returns an empty array. #### Source -[lib/provable/group.ts:281](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L281) +[lib/provable/group.ts:281](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L281) *** @@ -621,7 +621,7 @@ Returns an array containing a [Group](Group.mdx) element as an array of [Field]( #### Source -[lib/provable/group.ts:272](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L272) +[lib/provable/group.ts:272](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L272) *** @@ -653,7 +653,7 @@ fields: Field[]; #### Source -[lib/provable/group.ts:350](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L350) +[lib/provable/group.ts:350](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L350) *** @@ -697,7 +697,7 @@ y: string; #### Source -[lib/provable/group.ts:308](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L308) +[lib/provable/group.ts:308](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L308) *** @@ -737,4 +737,4 @@ y: bigint; #### Source -[lib/provable/group.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/group.ts#L223) +[lib/provable/group.ts:223](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/group.ts#L223) diff --git a/docs/zkapps/o1js-reference/classes/Hashed.mdx b/docs/zkapps/o1js-reference/classes/Hashed.mdx index 8e35f32ed..3c4e25a5b 100644 --- a/docs/zkapps/o1js-reference/classes/Hashed.mdx +++ b/docs/zkapps/o1js-reference/classes/Hashed.mdx @@ -24,6 +24,10 @@ let hashed = HashedType.hash(value); let value = hashed.unhash(); ``` +**Warning**: When wrapping a type with `Hashed`, make sure that that type is safe to automatically _pack_ +and _unpack_ in provable code. In particular, do not use `Hashed` with types that define a custom `toInput()` +(specifying a certain bit packing) but no corresponding `check()` method (that constrains the bit lengths of the packed parts). + ## Type parameters • **T** @@ -48,7 +52,7 @@ new Hashed(hash: Field, value: Unconstrained): Hashed #### Source -[lib/provable/packed.ts:210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L210) +[lib/provable/packed.ts:241](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L241) ## Properties @@ -60,7 +64,7 @@ hash: Field; #### Source -[lib/provable/packed.ts:175](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L175) +[lib/provable/packed.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L204) *** @@ -72,7 +76,7 @@ value: Unconstrained; #### Source -[lib/provable/packed.ts:176](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L176) +[lib/provable/packed.ts:205](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L205) *** @@ -84,7 +88,7 @@ static _innerProvable: undefined | ProvableHashable; #### Source -[lib/provable/packed.ts:257](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L257) +[lib/provable/packed.ts:288](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L288) *** @@ -96,7 +100,7 @@ static _provable: undefined | ProvableHashable>; #### Source -[lib/provable/packed.ts:256](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L256) +[lib/provable/packed.ts:287](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L287) ## Accessors @@ -112,7 +116,7 @@ get Constructor(): typeof Hashed #### Source -[lib/provable/packed.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L259) +[lib/provable/packed.ts:290](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L290) *** @@ -128,7 +132,7 @@ get static innerProvable(): ProvableHashable #### Source -[lib/provable/packed.ts:263](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L263) +[lib/provable/packed.ts:294](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L294) ## Methods @@ -144,7 +148,7 @@ toFields(): Field[] #### Source -[lib/provable/packed.ts:251](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L251) +[lib/provable/packed.ts:282](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L282) *** @@ -162,7 +166,7 @@ Unwrap a value from its hashed variant. #### Source -[lib/provable/packed.ts:239](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L239) +[lib/provable/packed.ts:270](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L270) *** @@ -182,15 +186,16 @@ static _hash(_: any): Field #### Source -[lib/provable/packed.ts:215](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L215) +[lib/provable/packed.ts:246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L246) *** ### create() ```ts -static create(type: ProvableHashable, hash?: (t: T) => Field): typeof Hashed & { +static create(type: WithProvable>, hash?: (t: T) => Field): typeof Hashed & { "provable": ProvableHashable>; + "empty": Hashed; } ``` @@ -202,7 +207,7 @@ Create a hashed representation of `type`. You can then use `HashedType.hash(x)` #### Parameters -• **type**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\>\> • **hash?** @@ -210,11 +215,12 @@ Create a hashed representation of `type`. You can then use `HashedType.hash(x)` *typeof* [`Hashed`](Hashed.mdx) & \{ `"provable"`: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`Hashed`](Hashed.mdx)\<`T`\>\>; + `"empty"`: [`Hashed`](Hashed.mdx)\<`T`\>; \} #### Source -[lib/provable/packed.ts:181](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L181) +[lib/provable/packed.ts:210](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L210) *** @@ -248,4 +254,4 @@ Optionally, if you already have the hash, you can pass it in and avoid recomputi #### Source -[lib/provable/packed.ts:228](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L228) +[lib/provable/packed.ts:259](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L259) diff --git a/docs/zkapps/o1js-reference/classes/Int64.mdx b/docs/zkapps/o1js-reference/classes/Int64.mdx index 473cdd45d..d8ade331a 100644 --- a/docs/zkapps/o1js-reference/classes/Int64.mdx +++ b/docs/zkapps/o1js-reference/classes/Int64.mdx @@ -13,14 +13,18 @@ A 64 bit signed integer with values ranging from -18,446,744,073,709,551,615 to ### new Int64() ```ts -new Int64(magnitude: UInt64, sgn: Sign): Int64 +new Int64(magnitude: UInt64, sgn?: Sign): Int64 ``` #### Parameters • **magnitude**: [`UInt64`](UInt64.mdx) -• **sgn**: [`Sign`](Sign.mdx)= `Sign.one` +The magnitude of the integer as a UInt64. + +• **sgn?**: [`Sign`](Sign.mdx)= `Sign.one` + +The sign of the integer. Default is positive (Sign.one). #### Returns @@ -30,9 +34,25 @@ new Int64(magnitude: UInt64, sgn: Sign): Int64 `CircuitValue.constructor` +#### Deprecated + +Use [Int64.create](Int64.mdx#create) for safe creation. + +WARNING: This constructor allows for ambiguous representation of zero (both +0 and -0). +This can lead to unexpected behavior in operations like [()](Int64.mdx#ispositive) and [()](Int64.mdx#mod). + +Security Implications: +1. A malicious prover could choose either positive or negative zero. +2. Arithmetic operations that result in 0 may allow an attacker to arbitrarily choose the sign. +3. This ambiguity could be exploited in protocols using Int64s for calculations like PNL tracking. + +Recommended Fix: +Use Int64.create() which enforces a canonical representation of zero, or +explicitly handle the zero case in operations like mod(). + #### Source -[lib/provable/int.ts:1051](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1051) +[lib/provable/int.ts:1141](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1141) ## Properties @@ -48,7 +68,7 @@ magnitude: UInt64; #### Source -[lib/provable/int.ts:1028](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1028) +[lib/provable/int.ts:1100](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1100) *** @@ -64,7 +84,35 @@ sgn: Sign; #### Source -[lib/provable/int.ts:1029](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1029) +[lib/provable/int.ts:1101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1101) + +*** + +### Unsafe + +```ts +static Unsafe: { + "fromObject": Int64; +}; +``` + +#### fromObject() + +##### Parameters + +• **obj** + +• **obj.magnitude**: [`UInt64`](UInt64.mdx) + +• **obj.sgn**: [`Sign`](Sign.mdx) + +##### Returns + +[`Int64`](Int64.mdx) + +#### Source + +[lib/provable/int.ts:1206](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1206) ## Accessors @@ -82,7 +130,7 @@ Static method to create a [Int64](Int64.mdx) with value `-1`. #### Source -[lib/provable/int.ts:1126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1126) +[lib/provable/int.ts:1258](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1258) *** @@ -100,7 +148,7 @@ Static method to create a [Int64](Int64.mdx) with value `1`. #### Source -[lib/provable/int.ts:1120](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1120) +[lib/provable/int.ts:1252](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1252) *** @@ -118,7 +166,7 @@ Static method to create a [Int64](Int64.mdx) with value `0`. #### Source -[lib/provable/int.ts:1114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1114) +[lib/provable/int.ts:1246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1246) ## Methods @@ -150,9 +198,13 @@ Addition with overflow checking. [`Int64`](Int64.mdx) +#### Implementation of + +`BalanceChange.add` + #### Source -[lib/provable/int.ts:1173](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1173) +[lib/provable/int.ts:1309](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1309) *** @@ -186,13 +238,17 @@ Asserts that two values are equal. `void` +#### Implementation of + +`BalanceChange.assertEquals` + #### Overrides `CircuitValue.assertEquals` #### Source -[lib/provable/int.ts:1243](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1243) +[lib/provable/int.ts:1391](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1391) *** @@ -208,11 +264,7 @@ div(y: | Int64): Int64 ``` -Integer division. - -`x.div(y)` returns the floor of `x / y`, that is, the greatest -`z` such that `z * y <= x`. -On negative numbers, this rounds towards zero. +Integer division with canonical zero representation. #### Parameters @@ -224,13 +276,28 @@ On negative numbers, this rounds towards zero. \| [`UInt32`](UInt32.mdx) \| [`Int64`](Int64.mdx) +The divisor. Can be an Int64, number, string, bigint, UInt64, or UInt32. + #### Returns [`Int64`](Int64.mdx) +A new Int64 representing the quotient, with canonical zero representation. + +`x.div(y)` returns the floor of `x / y`, that is, the greatest +*`z`* such that *`z * y <= x`. +On negative numbers, this rounds towards zero. + +This method guarantees that all results, including zero, have a consistent +representation, eliminating potential ambiguities in zero handling. + +#### Implementation of + +`BalanceChange.div` + #### Source -[lib/provable/int.ts:1198](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1198) +[lib/provable/int.ts:1341](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1341) *** @@ -262,13 +329,48 @@ Checks if two values are equal. [`Bool`](Bool.mdx) +#### Implementation of + +`BalanceChange.equals` + #### Overrides `CircuitValue.equals` #### Source -[lib/provable/int.ts:1236](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1236) +[lib/provable/int.ts:1384](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1384) + +*** + +### fromObject() + +```ts +fromObject(obj: { + "magnitude": string | number | bigint | UInt64; + "sgn": bigint | Sign; + }): Int64 +``` + +#### Parameters + +• **obj** + +• **obj.magnitude**: `string` \| `number` \| `bigint` \| [`UInt64`](UInt64.mdx) + +• **obj.sgn**: `bigint` \| [`Sign`](Sign.mdx) + +#### Returns + +[`Int64`](Int64.mdx) + +#### Implementation of + +`BalanceChange.fromObject` + +#### Source + +[lib/provable/int.ts:1212](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1212) *** @@ -282,95 +384,98 @@ isConstant(): boolean `boolean` +#### Implementation of + +`BalanceChange.isConstant` + #### Overrides `CircuitValue.isConstant` #### Source -[lib/provable/int.ts:1103](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1103) +[lib/provable/int.ts:1235](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1235) *** -### ~~isPositive()~~ +### isNegative() ```ts -isPositive(): Bool +isNegative(): Bool ``` +Checks if the value is negative (x < 0). + #### Returns [`Bool`](Bool.mdx) -#### Deprecated +#### Implementation of -Use [isPositiveV2](Int64.mdx#ispositivev2) instead. -The current implementation actually tests for non-negativity, but is wrong for the negative representation of 0. +`BalanceChange.isNegative` #### Source -[lib/provable/int.ts:1254](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1254) +[lib/provable/int.ts:1424](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1424) *** -### isPositiveV2() +### isNonNegative() ```ts -isPositiveV2(): Bool +isNonNegative(): Bool ``` -Checks if the value is positive (x > 0). +Checks if the value is non-negative (x >= 0). #### Returns [`Bool`](Bool.mdx) +#### Implementation of + +`BalanceChange.isNonNegative` + #### Source -[lib/provable/int.ts:1261](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1261) +[lib/provable/int.ts:1416](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1416) *** -### ~~mod()~~ +### isPositive() ```ts -mod(y: - | string - | number - | bigint - | UInt64 - | UInt32): Int64 +isPositive(): Bool ``` -#### Parameters - -• **y**: - \| `string` - \| `number` - \| `bigint` - \| [`UInt64`](UInt64.mdx) - \| [`UInt32`](UInt32.mdx) +Checks if the value is strictly positive (x > 0). #### Returns -[`Int64`](Int64.mdx) +[`Bool`](Bool.mdx) -#### Deprecated +True if the value is greater than zero, false otherwise. + +#### Implementation of -Use [()](Int64.mdx#modv2) instead. -This implementation is vulnerable whenever `this` is zero. -It allows the prover to return `y` instead of 0 as the result. +`BalanceChange.isPositive` + +#### Remarks + +This method considers zero as non-positive. It ensures consistency +with the mathematical definition of "positive" as strictly greater than zero. +This differs from some other methods which may treat zero as non-negative. #### Source -[lib/provable/int.ts:1210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1210) +[lib/provable/int.ts:1409](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1409) *** -### modV2() +### mod() ```ts -modV2(y: +mod(y: | string | number | bigint @@ -378,10 +483,13 @@ modV2(y: | UInt32): Int64 ``` -Integer remainder. +Calculates the integer remainder of this Int64 divided by the given value. -`x.mod(y)` returns the value `z` such that `0 <= z < y` and -`x - z` is divisible by `y`. +The result `z` satisfies the following conditions: +1. 0 <= z < |y| +2. x - z is divisible by y + +Note: This method follows the "truncate toward zero" convention for negative numbers. #### Parameters @@ -392,13 +500,33 @@ Integer remainder. \| [`UInt64`](UInt64.mdx) \| [`UInt32`](UInt32.mdx) +The divisor. Will be converted to UInt64 if not already. + #### Returns [`Int64`](Int64.mdx) +A new Int64 instance representing the remainder. + +#### Implementation of + +`BalanceChange.mod` + +#### Example + +```ts +const x1 = Int64.from(17); +const y1 = UInt64.from(5); +console.log(x1.mod(y1).toString()); // Output: 2 +``` + +#### Throws + +Implicitly, if y is zero or negative. + #### Source -[lib/provable/int.ts:1223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1223) +[lib/provable/int.ts:1369](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1369) *** @@ -430,50 +558,55 @@ Multiplication with overflow checking. [`Int64`](Int64.mdx) +#### Implementation of + +`BalanceChange.mul` + #### Source -[lib/provable/int.ts:1187](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1187) +[lib/provable/int.ts:1323](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1323) *** -### ~~neg()~~ +### neg() ```ts neg(): Int64 ``` +Negates the current Int64 value. + +This method returns a new Int64 instance with the opposite sign of the current value. +If the current value is zero, it returns zero. + #### Returns [`Int64`](Int64.mdx) -#### Deprecated - -Use [()](Int64.mdx#negv2) instead. -The current implementation will not be backwards-compatible with v2. +A new Int64 instance with the negated value. -#### Source - -[lib/provable/int.ts:1152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1152) +#### Implementation of -*** +`BalanceChange.neg` -### negV2() +#### Example ```ts -negV2(): Int64 +Int64.from(5).neg(); ``` -Negates the value. +#### See -`Int64.from(5).neg()` will turn into `Int64.from(-5)` + - Int64#from for creating Int64 instances + - Int64#zero for the zero constant -#### Returns +#### Throws -[`Int64`](Int64.mdx) +Implicitly, if the internal Provable.if condition fails #### Source -[lib/provable/int.ts:1162](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1162) +[lib/provable/int.ts:1298](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1298) *** @@ -505,9 +638,35 @@ Subtraction with underflow checking. [`Int64`](Int64.mdx) +#### Implementation of + +`BalanceChange.sub` + +#### Source + +[lib/provable/int.ts:1316](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1316) + +*** + +### toBigint() + +```ts +toBigint(): bigint +``` + +Turns the [Int64](Int64.mdx) into a BigInt. + +#### Returns + +`bigint` + +#### Implementation of + +`BalanceChange.toBigint` + #### Source -[lib/provable/int.ts:1180](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1180) +[lib/provable/int.ts:1222](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1222) *** @@ -521,13 +680,17 @@ toConstant(): this `this` +#### Implementation of + +`BalanceChange.toConstant` + #### Inherited from `CircuitValue.toConstant` #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -543,9 +706,13 @@ Returns the [Field](../variables/Field.mdx) value. [`Field`](Field.mdx) +#### Implementation of + +`BalanceChange.toField` + #### Source -[lib/provable/int.ts:1133](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1133) +[lib/provable/int.ts:1265](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1265) *** @@ -559,13 +726,17 @@ toFields(): Field[] [`Field`](Field.mdx)[] +#### Implementation of + +`BalanceChange.toFields` + #### Inherited from `CircuitValue.toFields` #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -579,13 +750,17 @@ toJSON(): any `any` +#### Implementation of + +`BalanceChange.toJSON` + #### Inherited from `CircuitValue.toJSON` #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -601,68 +776,79 @@ Turns the [Int64](Int64.mdx) into a string. `string` +#### Implementation of + +`BalanceChange.toString` + #### Source -[lib/provable/int.ts:1098](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1098) +[lib/provable/int.ts:1231](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1231) *** ### check() ```ts -static check(this: T, v: InstanceType): void +static check(__namedParameters: { + "magnitude": UInt64; + "sgn": Sign; + }): void ``` -#### Type parameters - -• **T** *extends* `AnyConstructor` - #### Parameters -• **this**: `T` +• **\_\_namedParameters** -• **v**: `InstanceType`\<`T`\> +• **\_\_namedParameters.magnitude**: [`UInt64`](UInt64.mdx) + +• **\_\_namedParameters.sgn**: [`Sign`](Sign.mdx) #### Returns `void` -#### Inherited from +#### Overrides `CircuitValue.check` #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/int.ts:1428](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1428) *** -### checkV2() +### create() ```ts -static checkV2(__namedParameters: { - "magnitude": UInt64; - "sgn": Sign; - }): void +static create(magnitude: UInt64, sign: Sign): Int64 ``` -Checks if the value is negative (x < 0). +Safely creates a new Int64 instance, enforcing canonical representation of zero. +This is the recommended way to create Int64 instances. #### Parameters -• **\_\_namedParameters** +• **magnitude**: [`UInt64`](UInt64.mdx) -• **\_\_namedParameters.magnitude**: [`UInt64`](UInt64.mdx) +The magnitude of the integer as a UInt64 -• **\_\_namedParameters.sgn**: [`Sign`](Sign.mdx) +• **sign**: [`Sign`](Sign.mdx)= `Sign.one` #### Returns -`void` +[`Int64`](Int64.mdx) + +A new Int64 instance with a canonical representation. + +#### Example + +```ts +const x = Int64.create(0); // canonical representation of zero +``` #### Source -[lib/provable/int.ts:1284](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1284) +[lib/provable/int.ts:1158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1158) *** @@ -686,7 +872,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -724,7 +910,7 @@ Check the range if the argument is a constant. #### Source -[lib/provable/int.ts:1088](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1088) +[lib/provable/int.ts:1198](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1198) *** @@ -746,7 +932,7 @@ Static method to create a [Int64](Int64.mdx) from a [Field](../variables/Field.m #### Source -[lib/provable/int.ts:1139](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1139) +[lib/provable/int.ts:1271](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1271) *** @@ -776,7 +962,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -806,7 +992,7 @@ static fromJSON(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L196) +[lib/provable/types/circuit-value.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L208) *** @@ -836,7 +1022,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -860,7 +1046,7 @@ Creates a new [Int64](Int64.mdx) from a [Field](../variables/Field.mdx). #### Source -[lib/provable/int.ts:1078](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1078) +[lib/provable/int.ts:1188](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1188) *** @@ -890,7 +1076,7 @@ static fromValue(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L98) +[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L98) *** @@ -910,7 +1096,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -930,7 +1116,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -960,7 +1176,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -990,7 +1206,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -1020,7 +1236,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -1050,7 +1266,7 @@ static toJSON(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L185) +[lib/provable/types/circuit-value.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L197) *** @@ -1080,4 +1296,4 @@ static toValue(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L89) +[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L89) diff --git a/docs/zkapps/o1js-reference/classes/Keypair.mdx b/docs/zkapps/o1js-reference/classes/Keypair.mdx index 0905df5a0..bbd967cc7 100644 --- a/docs/zkapps/o1js-reference/classes/Keypair.mdx +++ b/docs/zkapps/o1js-reference/classes/Keypair.mdx @@ -16,7 +16,7 @@ new Keypair(value: unknown): Keypair #### Source -[lib/proof-system/circuit.ts:104](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L104) +[lib/proof-system/circuit.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L104) ## Properties @@ -28,7 +28,7 @@ value: unknown; #### Source -[lib/proof-system/circuit.ts:102](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L102) +[lib/proof-system/circuit.ts:102](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L102) ## Methods @@ -54,7 +54,7 @@ const json = MyProvable.witnessFromKeypair(keypair); #### Source -[lib/proof-system/circuit.ts:123](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L123) +[lib/proof-system/circuit.ts:123](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L123) *** @@ -70,4 +70,4 @@ verificationKey(): VerificationKey #### Source -[lib/proof-system/circuit.ts:108](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L108) +[lib/proof-system/circuit.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L108) diff --git a/docs/zkapps/o1js-reference/classes/Ledger.mdx b/docs/zkapps/o1js-reference/classes/Ledger.mdx index 98cc8c9fb..c9d7ed17e 100644 --- a/docs/zkapps/o1js-reference/classes/Ledger.mdx +++ b/docs/zkapps/o1js-reference/classes/Ledger.mdx @@ -34,7 +34,7 @@ Adds an account and its balance to the ledger. #### Source -[snarky.d.ts:492](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/snarky.d.ts#L492) +[snarky.d.ts:492](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L492) *** @@ -63,7 +63,7 @@ Applies a JSON transaction to the ledger. #### Source -[snarky.d.ts:497](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/snarky.d.ts#L497) +[snarky.d.ts:497](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L497) *** @@ -87,7 +87,7 @@ Returns an account. #### Source -[snarky.d.ts:506](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/snarky.d.ts#L506) +[snarky.d.ts:506](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L506) *** @@ -105,4 +105,4 @@ Creates a fresh ledger. #### Source -[snarky.d.ts:487](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/snarky.d.ts#L487) +[snarky.d.ts:487](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L487) diff --git a/docs/zkapps/o1js-reference/classes/MerkleList.mdx b/docs/zkapps/o1js-reference/classes/MerkleList.mdx index 24ed0c1e8..84882d2e2 100644 --- a/docs/zkapps/o1js-reference/classes/MerkleList.mdx +++ b/docs/zkapps/o1js-reference/classes/MerkleList.mdx @@ -50,7 +50,7 @@ new MerkleList(__namedParameters: MerkleListBase): MerkleList #### Source -[lib/provable/merkle-list.ts:83](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L83) +[lib/provable/merkle-list.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L84) ## Properties @@ -66,7 +66,7 @@ data: Unconstrained[]>; #### Source -[lib/provable/merkle-list.ts:81](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L81) +[lib/provable/merkle-list.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L82) *** @@ -82,7 +82,7 @@ hash: Field; #### Source -[lib/provable/merkle-list.ts:80](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L80) +[lib/provable/merkle-list.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L81) *** @@ -94,7 +94,7 @@ static _emptyHash: undefined | Field; #### Source -[lib/provable/merkle-list.ts:297](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L297) +[lib/provable/merkle-list.ts:350](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L350) *** @@ -106,7 +106,7 @@ static _innerProvable: undefined | ProvableHashable; #### Source -[lib/provable/merkle-list.ts:300](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L300) +[lib/provable/merkle-list.ts:353](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L353) *** @@ -118,7 +118,7 @@ static _nextHash: undefined | (hash: Field, t: any) => Field; #### Source -[lib/provable/merkle-list.ts:296](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L296) +[lib/provable/merkle-list.ts:349](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L349) *** @@ -130,7 +130,7 @@ static _provable: undefined | ProvableHashable>; #### Source -[lib/provable/merkle-list.ts:299](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L299) +[lib/provable/merkle-list.ts:352](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L352) ## Accessors @@ -146,7 +146,7 @@ get Constructor(): typeof MerkleList #### Source -[lib/provable/merkle-list.ts:302](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L302) +[lib/provable/merkle-list.ts:355](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L355) *** @@ -162,7 +162,7 @@ get innerProvable(): ProvableHashable #### Source -[lib/provable/merkle-list.ts:319](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L319) +[lib/provable/merkle-list.ts:372](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L372) *** @@ -178,7 +178,7 @@ get static emptyHash(): Field #### Source -[lib/provable/merkle-list.ts:314](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L314) +[lib/provable/merkle-list.ts:367](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L367) ## Methods @@ -194,7 +194,7 @@ clone(): MerkleList #### Source -[lib/provable/merkle-list.ts:189](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L189) +[lib/provable/merkle-list.ts:223](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L223) *** @@ -224,7 +224,7 @@ to handle the `isDummy` flag separately. #### Source -[lib/provable/merkle-list.ts:203](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L203) +[lib/provable/merkle-list.ts:237](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L237) *** @@ -240,7 +240,23 @@ isEmpty(): Bool #### Source -[lib/provable/merkle-list.ts:88](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L88) +[lib/provable/merkle-list.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L89) + +*** + +### lengthUnconstrained() + +```ts +lengthUnconstrained(): Unconstrained +``` + +#### Returns + +[`Unconstrained`](Unconstrained.mdx)\<`number`\> + +#### Source + +[lib/provable/merkle-list.ts:267](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L267) *** @@ -262,7 +278,7 @@ nextHash(hash: Field, value: T): Field #### Source -[lib/provable/merkle-list.ts:306](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L306) +[lib/provable/merkle-list.ts:359](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L359) *** @@ -282,7 +298,7 @@ If the list is empty, returns a dummy element. #### Source -[lib/provable/merkle-list.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L154) +[lib/provable/merkle-list.ts:155](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L155) *** @@ -302,7 +318,7 @@ This proves that the list is non-empty, and fails otherwise. #### Source -[lib/provable/merkle-list.ts:139](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L139) +[lib/provable/merkle-list.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L140) *** @@ -326,7 +342,36 @@ If the list is empty, returns a dummy element. #### Source -[lib/provable/merkle-list.ts:173](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L173) +[lib/provable/merkle-list.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L174) + +*** + +### popIfUnsafe() + +```ts +popIfUnsafe(shouldPop: Bool): T +``` + +Low-level, minimal version of `pop()` which lets the _caller_ decide whether there is an element to pop. + +I.e. this proves: +- If the input condition is true, this returns the last element and removes it from the list. +- If the input condition is false, the list is unchanged and the return value is garbage. + +Note that if the caller passes `true` but the list is empty, this will fail. +If the caller passes `false` but the list is non-empty, this succeeds and just doesn't pop off an element. + +#### Parameters + +• **shouldPop**: [`Bool`](Bool.mdx) + +#### Returns + +`T` + +#### Source + +[lib/provable/merkle-list.ts:200](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L200) *** @@ -348,7 +393,7 @@ Push a new element to the list. #### Source -[lib/provable/merkle-list.ts:95](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L95) +[lib/provable/merkle-list.ts:96](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L96) *** @@ -372,7 +417,7 @@ Push a new element to the list, if the `condition` is true. #### Source -[lib/provable/merkle-list.ts:107](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L107) +[lib/provable/merkle-list.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L108) *** @@ -388,7 +433,7 @@ startIterating(): MerkleListIterator #### Source -[lib/provable/merkle-list.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L217) +[lib/provable/merkle-list.ts:251](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L251) *** @@ -404,7 +449,23 @@ startIteratingFromLast(): MerkleListIterator #### Source -[lib/provable/merkle-list.ts:222](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L222) +[lib/provable/merkle-list.ts:256](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L256) + +*** + +### toArrayUnconstrained() + +```ts +toArrayUnconstrained(): Unconstrained +``` + +#### Returns + +[`Unconstrained`](Unconstrained.mdx)\<`T`[]\> + +#### Source + +[lib/provable/merkle-list.ts:261](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L261) *** @@ -412,7 +473,7 @@ startIteratingFromLast(): MerkleListIterator ```ts static create( - type: ProvableHashable, + type: WithProvable>, nextHash: (hash: Field, value: T) => Field, emptyHash_: Field): typeof MerkleList & { "empty": () => MerkleList; @@ -432,7 +493,7 @@ Optionally, you can tell `create()` how to do the hash that pushes a new list el #### Parameters -• **type**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\>\> • **nextHash**= `undefined` @@ -457,4 +518,4 @@ class MyList extends MerkleList.create(Field, (hash, x) => #### Source -[lib/provable/merkle-list.ts:239](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L239) +[lib/provable/merkle-list.ts:283](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L283) diff --git a/docs/zkapps/o1js-reference/classes/MerkleListIterator.mdx b/docs/zkapps/o1js-reference/classes/MerkleListIterator.mdx index 2be957549..a933c3ad1 100644 --- a/docs/zkapps/o1js-reference/classes/MerkleListIterator.mdx +++ b/docs/zkapps/o1js-reference/classes/MerkleListIterator.mdx @@ -39,7 +39,7 @@ new MerkleListIterator(value: MerkleListIteratorBase): MerkleListIterator< #### Source -[lib/provable/merkle-list.ts:373](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L373) +[lib/provable/merkle-list.ts:426](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L426) ## Properties @@ -55,7 +55,7 @@ currentHash: Field; #### Source -[lib/provable/merkle-list.ts:370](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L370) +[lib/provable/merkle-list.ts:423](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L423) *** @@ -71,7 +71,7 @@ currentIndex: Unconstrained; #### Source -[lib/provable/merkle-list.ts:371](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L371) +[lib/provable/merkle-list.ts:424](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L424) *** @@ -87,7 +87,7 @@ readonly data: Unconstrained[]>; #### Source -[lib/provable/merkle-list.ts:366](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L366) +[lib/provable/merkle-list.ts:419](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L419) *** @@ -103,7 +103,7 @@ readonly hash: Field; #### Source -[lib/provable/merkle-list.ts:367](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L367) +[lib/provable/merkle-list.ts:420](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L420) *** @@ -115,7 +115,7 @@ static _emptyHash: undefined | Field; #### Source -[lib/provable/merkle-list.ts:666](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L666) +[lib/provable/merkle-list.ts:722](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L722) *** @@ -127,7 +127,7 @@ static _innerProvable: undefined | ProvableHashable; #### Source -[lib/provable/merkle-list.ts:669](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L669) +[lib/provable/merkle-list.ts:725](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L725) *** @@ -139,7 +139,7 @@ static _nextHash: undefined | (hash: Field, value: any) => Field; #### Source -[lib/provable/merkle-list.ts:665](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L665) +[lib/provable/merkle-list.ts:721](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L721) *** @@ -151,7 +151,7 @@ static _provable: undefined | ProvableHashable>; #### Source -[lib/provable/merkle-list.ts:668](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L668) +[lib/provable/merkle-list.ts:724](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L724) ## Accessors @@ -167,7 +167,7 @@ get Constructor(): typeof MerkleListIterator #### Source -[lib/provable/merkle-list.ts:671](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L671) +[lib/provable/merkle-list.ts:727](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L727) *** @@ -263,7 +263,7 @@ isDummy: Bool; #### Source -[lib/provable/merkle-list.ts:503](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L503) +[lib/provable/merkle-list.ts:556](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L556) *** @@ -279,7 +279,7 @@ get innerProvable(): ProvableHashable #### Source -[lib/provable/merkle-list.ts:688](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L688) +[lib/provable/merkle-list.ts:744](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L744) *** @@ -295,7 +295,7 @@ get static emptyHash(): Field #### Source -[lib/provable/merkle-list.ts:683](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L683) +[lib/provable/merkle-list.ts:739](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L739) ## Methods @@ -317,7 +317,7 @@ _index(direction: "next" | "previous", i?: number): number #### Source -[lib/provable/merkle-list.ts:430](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L430) +[lib/provable/merkle-list.ts:483](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L483) *** @@ -337,7 +337,7 @@ _updateIndex(direction: "next" | "previous"): void #### Source -[lib/provable/merkle-list.ts:438](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L438) +[lib/provable/merkle-list.ts:491](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L491) *** @@ -357,7 +357,7 @@ assertAtEnd(message?: string): void #### Source -[lib/provable/merkle-list.ts:399](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L399) +[lib/provable/merkle-list.ts:452](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L452) *** @@ -373,7 +373,7 @@ assertAtStart(): void #### Source -[lib/provable/merkle-list.ts:377](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L377) +[lib/provable/merkle-list.ts:430](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L430) *** @@ -389,7 +389,7 @@ clone(): MerkleListIterator #### Source -[lib/provable/merkle-list.ts:560](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L560) +[lib/provable/merkle-list.ts:613](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L613) *** @@ -405,7 +405,7 @@ isAtEnd(): Bool #### Source -[lib/provable/merkle-list.ts:381](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L381) +[lib/provable/merkle-list.ts:434](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L434) *** @@ -421,7 +421,7 @@ isAtStart(): Bool #### Source -[lib/provable/merkle-list.ts:406](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L406) +[lib/provable/merkle-list.ts:459](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L459) *** @@ -437,7 +437,7 @@ jumpToEnd(): void #### Source -[lib/provable/merkle-list.ts:385](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L385) +[lib/provable/merkle-list.ts:438](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L438) *** @@ -457,7 +457,7 @@ jumpToEndIf(condition: Bool): void #### Source -[lib/provable/merkle-list.ts:390](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L390) +[lib/provable/merkle-list.ts:443](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L443) *** @@ -473,7 +473,7 @@ jumpToStart(): void #### Source -[lib/provable/merkle-list.ts:410](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L410) +[lib/provable/merkle-list.ts:463](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L463) *** @@ -493,7 +493,7 @@ jumpToStartIf(condition: Bool): void #### Source -[lib/provable/merkle-list.ts:417](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L417) +[lib/provable/merkle-list.ts:470](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L470) *** @@ -509,7 +509,7 @@ next(): T #### Source -[lib/provable/merkle-list.ts:476](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L476) +[lib/provable/merkle-list.ts:529](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L529) *** @@ -531,7 +531,7 @@ nextHash(hash: Field, value: T): Field #### Source -[lib/provable/merkle-list.ts:675](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L675) +[lib/provable/merkle-list.ts:731](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L731) *** @@ -547,7 +547,7 @@ previous(): T #### Source -[lib/provable/merkle-list.ts:445](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L445) +[lib/provable/merkle-list.ts:498](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L498) *** @@ -555,7 +555,7 @@ previous(): T ```ts static create( - type: ProvableHashable, + type: WithProvable>, nextHash: (hash: Field, value: T) => Field, emptyHash_: Field): typeof MerkleListIterator & { "empty": () => MerkleListIterator; @@ -574,7 +574,7 @@ Create a Merkle array type #### Parameters -• **type**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\>\> • **nextHash**= `undefined` @@ -592,14 +592,14 @@ Create a Merkle array type #### Source -[lib/provable/merkle-list.ts:574](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L574) +[lib/provable/merkle-list.ts:627](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L627) *** ### createFromList() ```ts -static createFromList(merkleList: typeof MerkleList): typeof MerkleListIterator & { +static createFromList(merkleList: typeof MerkleList): (value: MerkleListIteratorBase) => MerkleListIterator & { "empty": () => MerkleListIterator; "from": (array: T[]) => MerkleListIterator; "provable": ProvableHashable>; @@ -618,7 +618,7 @@ static createFromList(merkleList: typeof MerkleList): typeof MerkleListIterat #### Returns -*typeof* [`MerkleListIterator`](MerkleListIterator.mdx) & \{ +(`value`: [`MerkleListIteratorBase`](../type-aliases/MerkleListIteratorBase.mdx)\<`T`\>) => [`MerkleListIterator`](MerkleListIterator.mdx)\<`T`\> & \{ `"empty"`: () => [`MerkleListIterator`](MerkleListIterator.mdx)\<`T`\>; `"from"`: (`array`: `T`[]) => [`MerkleListIterator`](MerkleListIterator.mdx)\<`T`\>; `"provable"`: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`MerkleListIterator`](MerkleListIterator.mdx)\<`T`\>\>; @@ -628,4 +628,4 @@ static createFromList(merkleList: typeof MerkleList): typeof MerkleListIterat #### Source -[lib/provable/merkle-list.ts:656](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L656) +[lib/provable/merkle-list.ts:712](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L712) diff --git a/docs/zkapps/o1js-reference/classes/MerkleMap.mdx b/docs/zkapps/o1js-reference/classes/MerkleMap.mdx index 28f3eb2ac..c6db5f369 100644 --- a/docs/zkapps/o1js-reference/classes/MerkleMap.mdx +++ b/docs/zkapps/o1js-reference/classes/MerkleMap.mdx @@ -22,7 +22,7 @@ const merkleMap = new MerkleMap(); #### Source -[lib/provable/merkle-map.ts:21](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L21) +[lib/provable/merkle-map.ts:21](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L21) ## Properties @@ -34,7 +34,7 @@ tree: MerkleTree; #### Source -[lib/provable/merkle-map.ts:11](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L11) +[lib/provable/merkle-map.ts:11](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L11) ## Methods @@ -54,7 +54,7 @@ _keyToIndex(key: Field): bigint #### Source -[lib/provable/merkle-map.ts:25](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L25) +[lib/provable/merkle-map.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L25) *** @@ -88,7 +88,7 @@ console.log(value); // Output: the value at key 5 or Field(0) if key does not ex #### Source -[lib/provable/merkle-map.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L71) +[lib/provable/merkle-map.ts:71](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L71) *** @@ -114,7 +114,7 @@ const root = merkleMap.getRoot(); #### Source -[lib/provable/merkle-map.ts:84](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L84) +[lib/provable/merkle-map.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L84) *** @@ -147,7 +147,7 @@ const witness = merkleMap.getWitness(key); #### Source -[lib/provable/merkle-map.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L98) +[lib/provable/merkle-map.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L98) *** @@ -183,4 +183,4 @@ merkleMap.set(key, value); #### Source -[lib/provable/merkle-map.ts:55](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L55) +[lib/provable/merkle-map.ts:55](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L55) diff --git a/docs/zkapps/o1js-reference/classes/MerkleMapWitness.mdx b/docs/zkapps/o1js-reference/classes/MerkleMapWitness.mdx index 10478bf09..ba4493ef8 100644 --- a/docs/zkapps/o1js-reference/classes/MerkleMapWitness.mdx +++ b/docs/zkapps/o1js-reference/classes/MerkleMapWitness.mdx @@ -26,7 +26,7 @@ new MerkleMapWitness(isLefts: Bool[], siblings: Field[]): MerkleMapWitness #### Source -[lib/provable/merkle-map.ts:110](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L110) +[lib/provable/merkle-map.ts:110](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L110) ## Properties @@ -38,7 +38,7 @@ isLefts: Bool[]; #### Source -[lib/provable/merkle-map.ts:107](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L107) +[lib/provable/merkle-map.ts:107](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L107) *** @@ -50,7 +50,7 @@ siblings: Field[]; #### Source -[lib/provable/merkle-map.ts:108](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L108) +[lib/provable/merkle-map.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L108) ## Methods @@ -74,40 +74,16 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** -### ~~computeRootAndKey()~~ +### computeRootAndKey() ```ts computeRootAndKey(value: Field): Field[] ``` -#### Parameters - -• **value**: [`Field`](Field.mdx) - -#### Returns - -[`Field`](Field.mdx)[] - -#### Deprecated - -This method is deprecated and will be removed in the next release. Please use [computeRootAndKeyV2](MerkleMapWitness.mdx#computerootandkeyv2) instead. - -#### Source - -[lib/provable/merkle-map.ts:119](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L119) - -*** - -### computeRootAndKeyV2() - -```ts -computeRootAndKeyV2(value: Field): Field[] -``` - Computes the merkle tree root for a given value and the key for this witness #### Parameters @@ -124,7 +100,7 @@ A tuple of the computed merkle root, and the key that is connected to the path u #### Source -[lib/provable/merkle-map.ts:145](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-map.ts#L145) +[lib/provable/merkle-map.ts:121](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-map.ts#L121) *** @@ -148,7 +124,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -168,7 +144,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -188,7 +164,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -208,7 +184,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -228,7 +204,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -258,7 +234,7 @@ static check(this: T, v: InstanceType): void #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L163) *** @@ -282,7 +258,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -312,7 +288,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -342,7 +318,7 @@ static fromJSON(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L196) +[lib/provable/types/circuit-value.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L208) *** @@ -372,7 +348,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -402,7 +378,7 @@ static fromValue(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L98) +[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L98) *** @@ -422,7 +398,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -442,7 +418,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -472,7 +478,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -502,7 +508,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -532,7 +538,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -562,7 +568,7 @@ static toJSON(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L185) +[lib/provable/types/circuit-value.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L197) *** @@ -592,4 +598,4 @@ static toValue(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L89) +[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L89) diff --git a/docs/zkapps/o1js-reference/classes/MerkleTree.mdx b/docs/zkapps/o1js-reference/classes/MerkleTree.mdx index 2b60318f4..cc9c4ead2 100644 --- a/docs/zkapps/o1js-reference/classes/MerkleTree.mdx +++ b/docs/zkapps/o1js-reference/classes/MerkleTree.mdx @@ -31,7 +31,7 @@ A new MerkleTree #### Source -[lib/provable/merkle-tree.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L37) +[lib/provable/merkle-tree.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L37) ## Properties @@ -45,7 +45,7 @@ The height of Merkle Tree. #### Source -[lib/provable/merkle-tree.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L37) +[lib/provable/merkle-tree.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L37) *** @@ -57,7 +57,7 @@ nodes: Record> = {}; #### Source -[lib/provable/merkle-tree.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L29) +[lib/provable/merkle-tree.ts:29](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L29) *** @@ -69,7 +69,7 @@ zeroes: Field[]; #### Source -[lib/provable/merkle-tree.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L30) +[lib/provable/merkle-tree.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L30) ## Accessors @@ -89,7 +89,7 @@ Amount of leaf nodes. #### Source -[lib/provable/merkle-tree.ts:166](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L166) +[lib/provable/merkle-tree.ts:166](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L166) ## Methods @@ -107,7 +107,7 @@ Return a new MerkleTree with the same contents as this one. #### Source -[lib/provable/merkle-tree.ts:48](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L48) +[lib/provable/merkle-tree.ts:48](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L48) *** @@ -131,7 +131,7 @@ Values to fill the leaves with. #### Source -[lib/provable/merkle-tree.ts:156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L156) +[lib/provable/merkle-tree.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L156) *** @@ -155,7 +155,7 @@ The data of the leaf. #### Source -[lib/provable/merkle-tree.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L71) +[lib/provable/merkle-tree.ts:71](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L71) *** @@ -185,7 +185,7 @@ The data of the node. #### Source -[lib/provable/merkle-tree.ts:62](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L62) +[lib/provable/merkle-tree.ts:62](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L62) *** @@ -205,7 +205,7 @@ The root of the Merkle Tree. #### Source -[lib/provable/merkle-tree.ts:79](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L79) +[lib/provable/merkle-tree.ts:79](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L79) *** @@ -231,7 +231,7 @@ The witness that belongs to the leaf. #### Source -[lib/provable/merkle-tree.ts:117](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L117) +[lib/provable/merkle-tree.ts:117](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L117) *** @@ -259,7 +259,7 @@ New value. #### Source -[lib/provable/merkle-tree.ts:94](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L94) +[lib/provable/merkle-tree.ts:94](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L94) *** @@ -285,4 +285,4 @@ True if the witness for the leaf node is valid. #### Source -[lib/provable/merkle-tree.ts:139](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L139) +[lib/provable/merkle-tree.ts:139](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L139) diff --git a/docs/zkapps/o1js-reference/classes/Nullifier.mdx b/docs/zkapps/o1js-reference/classes/Nullifier.mdx index 7e363c5dd..2c5d78ddd 100644 --- a/docs/zkapps/o1js-reference/classes/Nullifier.mdx +++ b/docs/zkapps/o1js-reference/classes/Nullifier.mdx @@ -80,7 +80,7 @@ new Nullifier(value: { #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) ## Properties @@ -129,7 +129,7 @@ h_m_pk_r: Group = Group; #### Source -[lib/provable/crypto/nullifier.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L26) +[lib/provable/crypto/nullifier.ts:26](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L26) *** @@ -171,7 +171,7 @@ s: Scalar = Scalar; #### Source -[lib/provable/crypto/nullifier.ts:22](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L22) +[lib/provable/crypto/nullifier.ts:22](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L22) *** @@ -198,7 +198,7 @@ publicKey: Group = Group; #### Source -[lib/provable/crypto/nullifier.ts:21](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L21) +[lib/provable/crypto/nullifier.ts:21](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L21) *** @@ -225,7 +225,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -294,7 +294,7 @@ the element of type `T` to put assertions on. #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -404,7 +404,7 @@ publicKey: Group = Group; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -518,7 +518,7 @@ publicKey: Group = Group; #### Source -[lib/provable/types/provable-intf.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L87) +[lib/provable/types/provable-intf.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L115) *** @@ -602,7 +602,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -670,7 +670,163 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "private": { + "c": Field; + "g_r": Group; + "h_m_pk_r": Group; + }; + "public": { + "nullifier": Group; + "s": Scalar; + }; + "publicKey": Group; + }) => { + "private": { + "c": Field; + "g_r": Group; + "h_m_pk_r": Group; + }; + "public": { + "nullifier": Group; + "s": Scalar; + }; + "publicKey": Group; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.private**= `undefined` + +• **x.private.c**: [`Field`](Field.mdx)= `Field` + +• **x.private.g\_r**: [`Group`](Group.mdx)= `Group` + +• **x.private.h\_m\_pk\_r**: [`Group`](Group.mdx)= `Group` + +• **x.public**= `undefined` + +• **x.public.nullifier**: [`Group`](Group.mdx)= `Group` + +• **x.public.s**: [`Scalar`](Scalar.mdx)= `Scalar` + +• **x.publicKey**: [`Group`](Group.mdx)= `Group` + +#### Returns + +```ts +{ + "private": { + "c": Field; + "g_r": Group; + "h_m_pk_r": Group; + }; + "public": { + "nullifier": Group; + "s": Scalar; + }; + "publicKey": Group; +} +``` + +##### private + +```ts +private: { + "c": Field; + "g_r": Group; + "h_m_pk_r": Group; +}; +``` + +##### private.c + +```ts +c: Field = Field; +``` + +##### private.g\_r + +```ts +g_r: Group = Group; +``` + +##### private.h\_m\_pk\_r + +```ts +h_m_pk_r: Group = Group; +``` + +##### public + +```ts +public: { + "nullifier": Group; + "s": Scalar; +}; +``` + +##### public.nullifier + +```ts +nullifier: Group = Group; +``` + +##### public.s + +```ts +s: Scalar = Scalar; +``` + +##### publicKey + +```ts +publicKey: Group = Group; +``` + +#### Inherited from + +`Struct({ + publicKey: Group, + public: { + nullifier: Group, + s: Scalar, + }, + private: { + c: Field, + g_r: Group, + h_m_pk_r: Group, + }, +}).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -737,7 +893,7 @@ the element of type `T` to generate the [Field](Field.mdx) array from. #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -819,7 +975,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L152) *** @@ -1020,7 +1176,7 @@ y: string; #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -1223,7 +1379,7 @@ y: bigint; #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -1254,7 +1410,7 @@ nullifier.assertUnused(); #### Source -[lib/provable/crypto/nullifier.ts:128](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L128) +[lib/provable/crypto/nullifier.ts:128](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L128) *** @@ -1278,7 +1434,7 @@ let pk = nullifier.getPublicKey(); #### Source -[lib/provable/crypto/nullifier.ts:157](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L157) +[lib/provable/crypto/nullifier.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L157) *** @@ -1309,7 +1465,7 @@ let isUnused = nullifier.isUnused(); #### Source -[lib/provable/crypto/nullifier.ts:108](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L108) +[lib/provable/crypto/nullifier.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L108) *** @@ -1335,7 +1491,7 @@ let key = nullifier.key(); #### Source -[lib/provable/crypto/nullifier.ts:95](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L95) +[lib/provable/crypto/nullifier.ts:95](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L95) *** @@ -1364,7 +1520,7 @@ let newRoot = nullifier.setUsed(witness); #### Source -[lib/provable/crypto/nullifier.ts:143](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L143) +[lib/provable/crypto/nullifier.ts:143](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L143) *** @@ -1394,7 +1550,7 @@ nullifier.verify(nullifierMessage); #### Source -[lib/provable/crypto/nullifier.ts:47](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L47) +[lib/provable/crypto/nullifier.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L47) *** @@ -1423,7 +1579,7 @@ https://eprint.iacr.org/2022/1255.pdf chapter 3 page 14 #### Source -[lib/provable/crypto/nullifier.ts:170](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L170) +[lib/provable/crypto/nullifier.ts:170](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L170) *** @@ -1458,7 +1614,7 @@ static fromJSON(json: Nullifier): Nullifier #### Source -[lib/provable/crypto/nullifier.ts:32](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/nullifier.ts#L32) +[lib/provable/crypto/nullifier.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/nullifier.ts#L32) *** @@ -1493,4 +1649,4 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/classes/Packed.mdx b/docs/zkapps/o1js-reference/classes/Packed.mdx index ebe94ab0b..40139cfce 100644 --- a/docs/zkapps/o1js-reference/classes/Packed.mdx +++ b/docs/zkapps/o1js-reference/classes/Packed.mdx @@ -30,6 +30,10 @@ let value = packed.unpack(); For example, it doesn't make sense to pack a _single_ Bool, because it will be 1 field element before and after packing. On the other hand, it does makes sense to pack a type that holds 10 or 20 Bools. +**Warning**: When wrapping a type with `Packed`, make sure that that type is safe to automatically _pack_ +and _unpack_ in provable code. In particular, do not use `Packed` with types that define a custom `toInput()` +(specifying a certain bit packing) but no corresponding `check()` method (that constrains the bit lengths of the packed parts). + ## Type parameters • **T** @@ -54,7 +58,7 @@ new Packed(packed: Field[], value: Unconstrained): Packed #### Source -[lib/provable/packed.ts:77](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L77) +[lib/provable/packed.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L115) ## Properties @@ -66,7 +70,7 @@ packed: Field[]; #### Source -[lib/provable/packed.ts:46](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L46) +[lib/provable/packed.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L51) *** @@ -78,19 +82,19 @@ value: Unconstrained; #### Source -[lib/provable/packed.ts:47](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L47) +[lib/provable/packed.ts:52](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L52) *** ### \_innerProvable ```ts -static _innerProvable: undefined | ProvableExtended; +static _innerProvable: undefined | ProvableHashable; ``` #### Source -[lib/provable/packed.ts:119](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L119) +[lib/provable/packed.ts:144](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L144) *** @@ -102,7 +106,7 @@ static _provable: undefined | ProvableHashable>; #### Source -[lib/provable/packed.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L118) +[lib/provable/packed.ts:143](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L143) ## Accessors @@ -118,23 +122,23 @@ get Constructor(): typeof Packed #### Source -[lib/provable/packed.ts:121](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L121) +[lib/provable/packed.ts:146](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L146) *** ### innerProvable ```ts -get static innerProvable(): ProvableExtended +get static innerProvable(): ProvableHashable ``` #### Returns -[`ProvableExtended`](../type-aliases/ProvableExtended.mdx)\<`any`\> +[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`any`\> #### Source -[lib/provable/packed.ts:125](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L125) +[lib/provable/packed.ts:150](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L150) ## Methods @@ -150,7 +154,7 @@ toFields(): Field[] #### Source -[lib/provable/packed.ts:113](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L113) +[lib/provable/packed.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L138) *** @@ -168,15 +172,16 @@ Unpack a value. #### Source -[lib/provable/packed.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L98) +[lib/provable/packed.ts:123](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L123) *** ### create() ```ts -static create(type: ProvableExtended): typeof Packed & { - "provable": ProvableHashable>; +static create(type: WithProvable>): typeof Packed & { + "provable": ProvableHashable, V>; + "pack": Packed; } ``` @@ -186,42 +191,19 @@ Create a packed representation of `type`. You can then use `PackedType.pack(x)` • **T** +• **V** + #### Parameters -• **type**: [`ProvableExtended`](../type-aliases/ProvableExtended.mdx)\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<[`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`, `V`\>\> #### Returns *typeof* [`Packed`](Packed.mdx) & \{ - `"provable"`: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`Packed`](Packed.mdx)\<`T`\>\>; + `"provable"`: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`Packed`](Packed.mdx)\<`T`\>, `V`\>; + `"pack"`: [`Packed`](Packed.mdx)\<`T`\>; \} #### Source -[lib/provable/packed.ts:52](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L52) - -*** - -### pack() - -```ts -static pack(x: T): Packed -``` - -Pack a value. - -#### Type parameters - -• **T** - -#### Parameters - -• **x**: `T` - -#### Returns - -[`Packed`](Packed.mdx)\<`T`\> - -#### Source - -[lib/provable/packed.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/packed.ts#L85) +[lib/provable/packed.ts:57](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/packed.ts#L57) diff --git a/docs/zkapps/o1js-reference/classes/PrivateKey.mdx b/docs/zkapps/o1js-reference/classes/PrivateKey.mdx index 900d4a2fb..ba1b5aecd 100644 --- a/docs/zkapps/o1js-reference/classes/PrivateKey.mdx +++ b/docs/zkapps/o1js-reference/classes/PrivateKey.mdx @@ -26,7 +26,7 @@ new PrivateKey(s: Scalar): PrivateKey #### Source -[lib/provable/crypto/signature.ts:25](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L25) +[lib/provable/crypto/signature.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L25) ## Properties @@ -38,7 +38,7 @@ s: Scalar; #### Source -[lib/provable/crypto/signature.ts:23](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L23) +[lib/provable/crypto/signature.ts:23](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L23) ## Methods @@ -62,7 +62,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -86,7 +86,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -106,7 +106,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -126,7 +126,7 @@ a base58 encoded string #### Source -[lib/provable/crypto/signature.ts:105](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L105) +[lib/provable/crypto/signature.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L105) *** @@ -144,7 +144,7 @@ Convert this [PrivateKey](PrivateKey.mdx) to a bigint #### Source -[lib/provable/crypto/signature.ts:68](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L68) +[lib/provable/crypto/signature.ts:68](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L68) *** @@ -164,7 +164,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -184,7 +184,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -204,7 +204,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -224,7 +224,7 @@ a [PublicKey](PublicKey.mdx). #### Source -[lib/provable/crypto/signature.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L87) +[lib/provable/crypto/signature.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L87) *** @@ -254,7 +254,7 @@ static check(this: T, v: InstanceType): void #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L163) *** @@ -278,7 +278,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -302,7 +302,7 @@ a [PrivateKey](PrivateKey.mdx). #### Source -[lib/provable/crypto/signature.ts:96](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L96) +[lib/provable/crypto/signature.ts:96](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L96) *** @@ -327,7 +327,7 @@ Be careful that you don't use this method to create private keys that were sampl #### Source -[lib/provable/crypto/signature.ts:78](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L78) +[lib/provable/crypto/signature.ts:78](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L78) *** @@ -353,7 +353,7 @@ a [PrivateKey](PrivateKey.mdx). #### Source -[lib/provable/crypto/signature.ts:61](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L61) +[lib/provable/crypto/signature.ts:61](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L61) *** @@ -383,7 +383,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -413,7 +413,7 @@ static fromJSON(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L196) +[lib/provable/types/circuit-value.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L208) *** @@ -443,7 +443,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -473,7 +473,7 @@ static fromValue(this: T, v: bigint | PrivateKey): InstanceType #### Source -[lib/provable/crypto/signature.ts:121](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L121) +[lib/provable/crypto/signature.ts:121](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L121) *** @@ -499,7 +499,7 @@ a new [PrivateKey](PrivateKey.mdx). #### Source -[lib/provable/crypto/signature.ts:40](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L40) +[lib/provable/crypto/signature.ts:40](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L40) *** @@ -540,7 +540,7 @@ publicKey: PublicKey; #### Source -[lib/provable/crypto/signature.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L50) +[lib/provable/crypto/signature.ts:50](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L50) *** @@ -560,7 +560,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -580,7 +580,7 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) *** @@ -608,7 +608,37 @@ a base58 encoded string #### Source -[lib/provable/crypto/signature.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L114) +[lib/provable/crypto/signature.ts:114](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L114) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -638,7 +668,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -668,7 +698,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -698,7 +728,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -728,7 +758,7 @@ static toJSON(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L185) +[lib/provable/types/circuit-value.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L197) *** @@ -752,4 +782,4 @@ static toValue(v: PrivateKey): bigint #### Source -[lib/provable/crypto/signature.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L118) +[lib/provable/crypto/signature.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L118) diff --git a/docs/zkapps/o1js-reference/classes/Proof.mdx b/docs/zkapps/o1js-reference/classes/Proof.mdx index 686ff47ae..dd8cbdc3e 100644 --- a/docs/zkapps/o1js-reference/classes/Proof.mdx +++ b/docs/zkapps/o1js-reference/classes/Proof.mdx @@ -43,7 +43,7 @@ new Proof(__namedParameters: { #### Source -[lib/proof-system/zkprogram.ts:233](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L233) +[lib/proof-system/proof.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L49) ## Properties @@ -59,7 +59,7 @@ maxProofsVerified: 0 | 1 | 2; #### Source -[lib/proof-system/zkprogram.ts:220](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L220) +[lib/proof-system/proof.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L36) *** @@ -75,7 +75,7 @@ proof: unknown; #### Source -[lib/proof-system/zkprogram.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L219) +[lib/proof-system/proof.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L35) *** @@ -91,7 +91,7 @@ publicInput: Input; #### Source -[lib/proof-system/zkprogram.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L217) +[lib/proof-system/proof.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L33) *** @@ -107,7 +107,7 @@ publicOutput: Output; #### Source -[lib/proof-system/zkprogram.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L218) +[lib/proof-system/proof.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L34) *** @@ -123,7 +123,7 @@ shouldVerify: Bool; #### Source -[lib/proof-system/zkprogram.ts:221](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L221) +[lib/proof-system/proof.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L37) *** @@ -139,7 +139,7 @@ static publicInputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:209](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L209) +[lib/proof-system/proof.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L25) *** @@ -155,7 +155,7 @@ static publicOutputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L210) +[lib/proof-system/proof.ts:26](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L26) *** @@ -187,10 +187,66 @@ name: string; #### Source -[lib/proof-system/zkprogram.ts:211](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L211) +[lib/proof-system/proof.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L27) + +## Accessors + +### provable + +```ts +get static provable(): ProvableProof, any, any> +``` + +#### Returns + +`ProvableProof`\<[`Proof`](Proof.mdx)\<`any`, `any`\>, `any`, `any`\> + +#### Source + +[lib/proof-system/proof.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L165) ## Methods +### publicFields() + +```ts +publicFields(): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`ProofBase`](ProofBase.mdx).[`publicFields`](ProofBase.mdx#publicfields) + +#### Source + +[lib/proof-system/proof.ts:92](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L92) + +*** + ### toJSON() ```ts @@ -207,7 +263,7 @@ toJSON(): JsonProof #### Source -[lib/proof-system/zkprogram.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L223) +[lib/proof-system/proof.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L39) *** @@ -223,7 +279,7 @@ verify(): void #### Source -[lib/proof-system/zkprogram.ts:252](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L252) +[lib/proof-system/proof.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L98) *** @@ -243,7 +299,7 @@ verifyIf(condition: Bool): void #### Source -[lib/proof-system/zkprogram.ts:255](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L255) +[lib/proof-system/proof.ts:101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L101) *** @@ -299,7 +355,7 @@ must match your ZkProgram. `maxProofsVerified` is the maximum number of proofs t #### Source -[lib/proof-system/zkprogram.ts:307](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L307) +[lib/proof-system/proof.ts:150](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L150) *** @@ -325,4 +381,48 @@ static fromJSON(this: S, __namedParameters: JsonProof): Promise): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Parameters + +• **value**: [`ProofBase`](ProofBase.mdx)\<`any`, `any`\> + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`ProofBase`](ProofBase.mdx).[`publicFields`](ProofBase.mdx#publicfields-1) + +#### Source + +[lib/proof-system/proof.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L84) diff --git a/docs/zkapps/o1js-reference/classes/ProofBase.mdx b/docs/zkapps/o1js-reference/classes/ProofBase.mdx index 7a00ec3b7..da88aeb00 100644 --- a/docs/zkapps/o1js-reference/classes/ProofBase.mdx +++ b/docs/zkapps/o1js-reference/classes/ProofBase.mdx @@ -5,9 +5,9 @@ ## Type parameters -• **Input** +• **Input** = `any` -• **Output** +• **Output** = `any` ## Constructors @@ -40,7 +40,7 @@ new ProofBase(__namedParameters: { #### Source -[lib/proof-system/zkprogram.ts:233](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L233) +[lib/proof-system/proof.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L49) ## Properties @@ -52,7 +52,7 @@ maxProofsVerified: 0 | 1 | 2; #### Source -[lib/proof-system/zkprogram.ts:220](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L220) +[lib/proof-system/proof.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L36) *** @@ -64,7 +64,7 @@ proof: unknown; #### Source -[lib/proof-system/zkprogram.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L219) +[lib/proof-system/proof.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L35) *** @@ -76,7 +76,7 @@ publicInput: Input; #### Source -[lib/proof-system/zkprogram.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L217) +[lib/proof-system/proof.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L33) *** @@ -88,7 +88,7 @@ publicOutput: Output; #### Source -[lib/proof-system/zkprogram.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L218) +[lib/proof-system/proof.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L34) *** @@ -100,7 +100,7 @@ shouldVerify: Bool; #### Source -[lib/proof-system/zkprogram.ts:221](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L221) +[lib/proof-system/proof.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L37) *** @@ -112,7 +112,7 @@ static publicInputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:209](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L209) +[lib/proof-system/proof.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L25) *** @@ -124,7 +124,7 @@ static publicOutputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L210) +[lib/proof-system/proof.ts:26](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L26) *** @@ -152,10 +152,62 @@ name: string; #### Source -[lib/proof-system/zkprogram.ts:211](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L211) +[lib/proof-system/proof.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L27) + +## Accessors + +### provable + +```ts +get static provable(): Provable +``` + +#### Returns + +`Provable`\<`any`\> + +#### Source + +[lib/proof-system/proof.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L66) ## Methods +### publicFields() + +```ts +publicFields(): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Source + +[lib/proof-system/proof.ts:92](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L92) + +*** + ### toJSON() ```ts @@ -168,4 +220,44 @@ toJSON(): JsonProof #### Source -[lib/proof-system/zkprogram.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L223) +[lib/proof-system/proof.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L39) + +*** + +### publicFields() + +```ts +static publicFields(value: ProofBase): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Parameters + +• **value**: [`ProofBase`](ProofBase.mdx)\<`any`, `any`\> + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Source + +[lib/proof-system/proof.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L84) diff --git a/docs/zkapps/o1js-reference/classes/PublicKey.mdx b/docs/zkapps/o1js-reference/classes/PublicKey.mdx index 15eb40738..98215f2fe 100644 --- a/docs/zkapps/o1js-reference/classes/PublicKey.mdx +++ b/docs/zkapps/o1js-reference/classes/PublicKey.mdx @@ -27,7 +27,7 @@ new PublicKey(...props: any[]): PublicKey #### Source -[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L13) +[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L13) ## Properties @@ -39,7 +39,7 @@ isOdd: Bool; #### Source -[lib/provable/crypto/signature.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L138) +[lib/provable/crypto/signature.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L138) *** @@ -51,7 +51,7 @@ x: Field; #### Source -[lib/provable/crypto/signature.ts:137](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L137) +[lib/provable/crypto/signature.ts:137](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L137) ## Methods @@ -75,7 +75,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -99,7 +99,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -119,7 +119,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -139,7 +139,7 @@ a [Bool](../variables/Bool.mdx) #### Source -[lib/provable/crypto/signature.ts:193](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L193) +[lib/provable/crypto/signature.ts:193](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L193) *** @@ -159,7 +159,7 @@ a base58 encoded [PublicKey](PublicKey.mdx) #### Source -[lib/provable/crypto/signature.ts:211](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L211) +[lib/provable/crypto/signature.ts:211](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L211) *** @@ -179,7 +179,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -199,7 +199,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -219,7 +219,7 @@ A [Group](../variables/Group.mdx) #### Source -[lib/provable/crypto/signature.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L144) +[lib/provable/crypto/signature.ts:144](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L144) *** @@ -239,7 +239,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -269,7 +269,7 @@ static check(this: T, v: InstanceType): void #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L163) *** @@ -297,7 +297,7 @@ an empty [PublicKey](PublicKey.mdx) #### Source -[lib/provable/crypto/signature.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L185) +[lib/provable/crypto/signature.ts:185](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L185) *** @@ -328,7 +328,7 @@ a [PublicKey](PublicKey.mdx). #### Source -[lib/provable/crypto/signature.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L177) +[lib/provable/crypto/signature.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L177) *** @@ -352,7 +352,7 @@ a [PublicKey](PublicKey.mdx) #### Source -[lib/provable/crypto/signature.ts:202](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L202) +[lib/provable/crypto/signature.ts:202](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L202) *** @@ -382,7 +382,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -406,7 +406,7 @@ a [PublicKey](PublicKey.mdx). #### Source -[lib/provable/crypto/signature.ts:161](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L161) +[lib/provable/crypto/signature.ts:161](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L161) *** @@ -440,7 +440,7 @@ a JSON string #### Source -[lib/provable/crypto/signature.ts:239](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L239) +[lib/provable/crypto/signature.ts:239](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L239) *** @@ -470,7 +470,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -494,7 +494,7 @@ a [PublicKey](PublicKey.mdx). #### Source -[lib/provable/crypto/signature.ts:169](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L169) +[lib/provable/crypto/signature.ts:169](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L169) *** @@ -531,7 +531,7 @@ static fromValue(this: T, __namedParameters: { #### Source -[lib/provable/crypto/signature.ts:246](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L246) +[lib/provable/crypto/signature.ts:246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L246) *** @@ -551,7 +551,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -571,7 +571,7 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) *** @@ -595,7 +595,37 @@ a base58 encoded [PublicKey](PublicKey.mdx) #### Source -[lib/provable/crypto/signature.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L219) +[lib/provable/crypto/signature.ts:219](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L219) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -625,7 +655,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -655,7 +685,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -685,7 +715,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -713,7 +743,7 @@ a JSON string #### Source -[lib/provable/crypto/signature.ts:231](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L231) +[lib/provable/crypto/signature.ts:231](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L231) *** @@ -757,4 +787,4 @@ x: bigint; #### Source -[lib/provable/crypto/signature.ts:243](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L243) +[lib/provable/crypto/signature.ts:243](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L243) diff --git a/docs/zkapps/o1js-reference/classes/Scalar.mdx b/docs/zkapps/o1js-reference/classes/Scalar.mdx index 8519c0f8d..5566cdab9 100644 --- a/docs/zkapps/o1js-reference/classes/Scalar.mdx +++ b/docs/zkapps/o1js-reference/classes/Scalar.mdx @@ -18,7 +18,7 @@ high254: Field; #### Source -[lib/provable/scalar.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L31) +[lib/provable/scalar.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L32) *** @@ -38,7 +38,7 @@ The reason is that we can efficiently compute the scalar multiplication `(t + 2^ #### Source -[lib/provable/scalar.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L30) +[lib/provable/scalar.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L31) *** @@ -50,7 +50,7 @@ static ORDER: bigint = Fq.modulus; #### Source -[lib/provable/scalar.ts:33](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L33) +[lib/provable/scalar.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L34) ## Methods @@ -74,7 +74,7 @@ Add scalar field elements. #### Source -[lib/provable/scalar.ts:135](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L135) +[lib/provable/scalar.ts:143](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L143) *** @@ -99,7 +99,7 @@ Throws if the denominator is zero. #### Source -[lib/provable/scalar.ts:172](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L172) +[lib/provable/scalar.ts:180](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L180) *** @@ -118,7 +118,7 @@ If a [Scalar](Scalar.mdx) is constructed outside provable code, it is a constant #### Source -[lib/provable/scalar.ts:67](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L67) +[lib/provable/scalar.ts:75](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L75) *** @@ -142,7 +142,7 @@ Multiply scalar field elements. #### Source -[lib/provable/scalar.ts:159](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L159) +[lib/provable/scalar.ts:167](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L167) *** @@ -162,7 +162,7 @@ Negate a scalar field element. #### Source -[lib/provable/scalar.ts:124](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L124) +[lib/provable/scalar.ts:132](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L132) *** @@ -186,7 +186,7 @@ Subtract scalar field elements. #### Source -[lib/provable/scalar.ts:147](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L147) +[lib/provable/scalar.ts:155](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L155) *** @@ -204,7 +204,7 @@ Convert this [Scalar](Scalar.mdx) into a bigint #### Source -[lib/provable/scalar.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L87) +[lib/provable/scalar.ts:95](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L95) *** @@ -226,7 +226,7 @@ See FieldVar for an explanation of constants vs. variables. #### Source -[lib/provable/scalar.ts:79](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L79) +[lib/provable/scalar.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L87) *** @@ -251,7 +251,7 @@ that can be used outside proofs. #### Source -[lib/provable/scalar.ts:225](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L225) +[lib/provable/scalar.ts:233](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L233) *** @@ -294,7 +294,7 @@ highBit: Bool; #### Source -[lib/provable/scalar.ts:188](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L188) +[lib/provable/scalar.ts:196](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L196) *** @@ -312,7 +312,7 @@ Serializes this Scalar to a string #### Source -[lib/provable/scalar.ts:309](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L309) +[lib/provable/scalar.ts:325](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L325) *** @@ -334,7 +334,7 @@ Part of the [Provable](../type-aliases/Provable.mdx) interface. #### Source -[lib/provable/scalar.ts:279](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L279) +[lib/provable/scalar.ts:287](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L287) *** @@ -350,7 +350,7 @@ static empty(): Scalar #### Source -[lib/provable/scalar.ts:321](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L321) +[lib/provable/scalar.ts:337](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L337) *** @@ -374,7 +374,7 @@ If the input is too large, it is reduced modulo the scalar field size. #### Source -[lib/provable/scalar.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L45) +[lib/provable/scalar.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L46) *** @@ -397,7 +397,7 @@ This method is provable. #### Source -[lib/provable/scalar.ts:97](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L97) +[lib/provable/scalar.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L105) *** @@ -421,7 +421,7 @@ This is always possible and unambiguous, since the scalar field is larger than t #### Source -[lib/provable/scalar.ts:58](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L58) +[lib/provable/scalar.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L66) *** @@ -445,7 +445,7 @@ Creates a data structure from an array of serialized [Field](Field.mdx) elements #### Source -[lib/provable/scalar.ts:257](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L257) +[lib/provable/scalar.ts:265](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L265) *** @@ -468,7 +468,29 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/scalar.ts:317](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L317) +[lib/provable/scalar.ts:333](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L333) + +*** + +### fromShiftedScalar() + +```ts +static fromShiftedScalar(s: ShiftedScalar): Scalar +``` + +Provable method to convert a ShiftedScalar to a [Scalar](Scalar.mdx). + +#### Parameters + +• **s**: `ShiftedScalar` + +#### Returns + +[`Scalar`](Scalar.mdx) + +#### Source + +[lib/provable/scalar.ts:57](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L57) *** @@ -488,7 +510,7 @@ static fromValue(x: bigint): Scalar #### Source -[lib/provable/scalar.ts:291](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L291) +[lib/provable/scalar.ts:307](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L307) *** @@ -507,7 +529,7 @@ Randomness can not be proven inside a circuit! #### Source -[lib/provable/scalar.ts:113](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L113) +[lib/provable/scalar.ts:121](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L121) *** @@ -527,7 +549,7 @@ Returns the size of this type in [Field](Field.mdx) elements. #### Source -[lib/provable/scalar.ts:272](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L272) +[lib/provable/scalar.ts:280](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L280) *** @@ -547,7 +569,27 @@ Serialize a [Scalar](Scalar.mdx) into its auxiliary data, which are empty. #### Source -[lib/provable/scalar.ts:248](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L248) +[lib/provable/scalar.ts:256](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L256) + +*** + +### toCanonical() + +```ts +static toCanonical(s: Scalar): Scalar +``` + +#### Parameters + +• **s**: [`Scalar`](Scalar.mdx) + +#### Returns + +[`Scalar`](Scalar.mdx) + +#### Source + +[lib/provable/scalar.ts:295](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L295) *** @@ -575,7 +617,7 @@ The fields are not constrained to be boolean. #### Source -[lib/provable/scalar.ts:211](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L211) +[lib/provable/scalar.ts:219](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L219) *** @@ -601,7 +643,7 @@ An object where the `fields` key is a [Field](Field.mdx) array of length 1 creat #### Source -[lib/provable/scalar.ts:239](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L239) +[lib/provable/scalar.ts:247](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L247) *** @@ -624,7 +666,7 @@ This operation does _not_ affect the circuit and can't be used to prove anything #### Source -[lib/provable/scalar.ts:301](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L301) +[lib/provable/scalar.ts:317](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L317) *** @@ -644,4 +686,4 @@ static toValue(x: Scalar): bigint #### Source -[lib/provable/scalar.ts:287](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L287) +[lib/provable/scalar.ts:303](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L303) diff --git a/docs/zkapps/o1js-reference/classes/ScalarField.mdx b/docs/zkapps/o1js-reference/classes/ScalarField.mdx new file mode 100644 index 000000000..2958cfdde --- /dev/null +++ b/docs/zkapps/o1js-reference/classes/ScalarField.mdx @@ -0,0 +1,972 @@ +ForeignField representing the scalar field of Pallas and the base field of Vesta + +## Extends + +- `UnreducedForeignField`\<`this`\> + +## Constructors + +### new ScalarField() + +```ts +new ScalarField(x: + | string + | number + | bigint + | Field3 + | ForeignField): ScalarField +``` + +Create a new [ForeignField](ForeignField.mdx) from a bigint, number, string or another ForeignField. + +#### Parameters + +• **x**: + \| `string` + \| `number` + \| `bigint` + \| `Field3` + \| [`ForeignField`](ForeignField.mdx) + +#### Returns + +[`ScalarField`](ScalarField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).constructor` + +#### Example + +```ts +let x = new ForeignField(5); +``` + +Note: Inputs must be range checked if they originate from a different field with a different modulus or if they are not constants. + +- When constructing from another [ForeignField](ForeignField.mdx) instance, ensure the modulus matches. If not, check the modulus using `Gadgets.ForeignField.assertLessThan()` and handle appropriately. +- When constructing from a Field3 array, ensure all elements are valid Field elements and range checked. +- Ensure constants are correctly reduced to the modulus of the field. + +#### Source + +[lib/provable/foreign-field.ts:101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L101) + +## Properties + +### type + +```ts +type: "Unreduced" | "AlmostReduced" | "FullyReduced" = 'Unreduced'; +``` + +#### Inherited from + +`createForeignField(Fq.modulus).type` + +#### Source + +[lib/provable/foreign-field.ts:469](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L469) + +*** + +### value + +```ts +value: Field3; +``` + +The internal representation of a foreign field element, as a tuple of 3 limbs. + +#### Inherited from + +`createForeignField(Fq.modulus).value` + +#### Source + +[lib/provable/foreign-field.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L49) + +*** + +### \_Bigint + +```ts +static _Bigint: undefined | {} = undefined; +``` + +#### Inherited from + +`createForeignField(Fq.modulus)._Bigint` + +#### Source + +[lib/provable/foreign-field.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L27) + +*** + +### \_modulus + +```ts +static _modulus: undefined | bigint = undefined; +``` + +#### Inherited from + +`createForeignField(Fq.modulus)._modulus` + +#### Source + +[lib/provable/foreign-field.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L28) + +*** + +### \_provable + +```ts +static _provable: undefined | ProvablePureExtended = undefined; +``` + +#### Inherited from + +`createForeignField(Fq.modulus)._provable` + +#### Source + +[lib/provable/foreign-field.ts:471](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L471) + +*** + +### \_variants + +```ts +static _variants: undefined | { + "almostReduced": typeof AlmostForeignField; + "canonical": typeof CanonicalForeignField; + "unreduced": typeof UnreducedForeignField; + } = undefined; +``` + +Sibling classes that represent different ranges of field elements. + +#### Inherited from + +`createForeignField(Fq.modulus)._variants` + +#### Source + +[lib/provable/foreign-field.ts:58](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L58) + +## Accessors + +### Constructor + +```ts +get Constructor(): typeof ForeignField +``` + +#### Returns + +*typeof* [`ForeignField`](ForeignField.mdx) + +#### Source + +[lib/provable/foreign-field.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L51) + +*** + +### modulus + +```ts +get modulus(): bigint +``` + +#### Returns + +`bigint` + +#### Source + +[lib/provable/foreign-field.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L39) + +*** + +### AlmostReduced + +```ts +get static AlmostReduced(): typeof AlmostForeignField +``` + +Constructor for field elements that are "almost reduced", i.e. lie in the range [0, 2^ceil(log2(p))). + +#### Returns + +*typeof* [`AlmostForeignField`](AlmostForeignField.mdx) + +#### Source + +[lib/provable/foreign-field.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L76) + +*** + +### Bigint + +```ts +get static Bigint(): {} +``` + +#### Returns + +```ts +{} +``` + +#### Source + +[lib/provable/foreign-field.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L31) + +*** + +### Canonical + +```ts +get static Canonical(): typeof CanonicalForeignField +``` + +Constructor for field elements that are fully reduced, i.e. lie in the range [0, p). + +#### Returns + +*typeof* [`CanonicalForeignField`](CanonicalForeignField.mdx) + +#### Source + +[lib/provable/foreign-field.ts:83](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L83) + +*** + +### Unreduced + +```ts +get static Unreduced(): typeof UnreducedForeignField +``` + +Constructor for unreduced field elements. + +#### Returns + +*typeof* `UnreducedForeignField` + +#### Source + +[lib/provable/foreign-field.ts:69](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L69) + +*** + +### modulus + +```ts +get static modulus(): bigint +``` + +#### Returns + +`bigint` + +#### Source + +[lib/provable/foreign-field.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L35) + +*** + +### provable + +```ts +get static provable(): ProvablePureExtended +``` + +#### Returns + +`ProvablePureExtended`\<`UnreducedForeignField`, `bigint`, `string`\> + +#### Source + +[lib/provable/foreign-field.ts:474](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L474) + +*** + +### sizeInBits + +```ts +get static sizeInBits(): number +``` + +#### Returns + +`number` + +#### Source + +[lib/provable/foreign-field.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L42) + +## Methods + +### add() + +```ts +add(y: number | bigint | ForeignField): UnreducedForeignField +``` + +Finite field addition + +#### Parameters + +• **y**: `number` \| `bigint` \| [`ForeignField`](ForeignField.mdx) + +#### Returns + +`UnreducedForeignField` + +#### Inherited from + +`createForeignField(Fq.modulus).add` + +#### Example + +```ts +x.add(2); // x + 2 mod p +``` + +#### Source + +[lib/provable/foreign-field.ts:218](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L218) + +*** + +### assertAlmostReduced() + +```ts +assertAlmostReduced(): AlmostForeignField +``` + +Assert that this field element lies in the range [0, 2^k), +where k = ceil(log2(p)) and p is the foreign field modulus. + +Returns the field element as a [AlmostForeignField](AlmostForeignField.mdx). + +For a more efficient version of this for multiple field elements, see [assertAlmostReduced](ForeignField.mdx#assertalmostreduced-1). + +Note: this does not ensure that the field elements is in the canonical range [0, p). +To assert that stronger property, there is [assertCanonical](ForeignField.mdx#assertcanonical). +You should typically use [assertAlmostReduced](ForeignField.mdx#assertalmostreduced-1) though, because it is cheaper to prove and sufficient for +ensuring validity of all our non-native field arithmetic methods. + +#### Returns + +[`AlmostForeignField`](AlmostForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).assertAlmostReduced` + +#### Source + +[lib/provable/foreign-field.ts:173](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L173) + +*** + +### assertCanonical() + +```ts +assertCanonical(): CanonicalForeignField +``` + +Assert that this field element is fully reduced, +i.e. lies in the range [0, p), where p is the foreign field modulus. + +Returns the field element as a [CanonicalForeignField](CanonicalForeignField.mdx). + +#### Returns + +[`CanonicalForeignField`](CanonicalForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).assertCanonical` + +#### Source + +[lib/provable/foreign-field.ts:204](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L204) + +*** + +### assertEquals() + +#### assertEquals(y, message) + +```ts +assertEquals(y: number | bigint | CanonicalForeignField, message?: string): CanonicalForeignField +``` + +Assert equality with a ForeignField-like value + +##### Parameters + +• **y**: `number` \| `bigint` \| [`CanonicalForeignField`](CanonicalForeignField.mdx) + +• **message?**: `string` + +##### Returns + +[`CanonicalForeignField`](CanonicalForeignField.mdx) + +##### Inherited from + +`createForeignField(Fq.modulus).assertEquals` + +##### Example + +```ts +x.assertEquals(0, "x is zero"); +``` + +Since asserting equality can also serve as a range check, +this method returns `x` with the appropriate type: + +##### Example + +```ts +let xChecked = x.assertEquals(1, "x is 1"); +xChecked satisfies CanonicalForeignField; +``` + +##### Source + +[lib/provable/foreign-field.ts:296](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L296) + +#### assertEquals(y, message) + +```ts +assertEquals(y: AlmostForeignField, message?: string): AlmostForeignField +``` + +##### Parameters + +• **y**: [`AlmostForeignField`](AlmostForeignField.mdx) + +• **message?**: `string` + +##### Returns + +[`AlmostForeignField`](AlmostForeignField.mdx) + +##### Inherited from + +`createForeignField(Fq.modulus).assertEquals` + +##### Source + +[lib/provable/foreign-field.ts:300](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L300) + +#### assertEquals(y, message) + +```ts +assertEquals(y: ForeignField, message?: string): ForeignField +``` + +##### Parameters + +• **y**: [`ForeignField`](ForeignField.mdx) + +• **message?**: `string` + +##### Returns + +[`ForeignField`](ForeignField.mdx) + +##### Inherited from + +`createForeignField(Fq.modulus).assertEquals` + +##### Source + +[lib/provable/foreign-field.ts:301](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L301) + +*** + +### assertLessThan() + +```ts +assertLessThan(c: number | bigint, message?: string): void +``` + +Assert that this field element is less than a constant c: `x < c`. + +The constant must satisfy `0 <= c < 2^264`, otherwise an error is thrown. + +#### Parameters + +• **c**: `number` \| `bigint` + +• **message?**: `string` + +#### Returns + +`void` + +#### Inherited from + +`createForeignField(Fq.modulus).assertLessThan` + +#### Example + +```ts +x.assertLessThan(10); +``` + +#### Source + +[lib/provable/foreign-field.ts:339](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L339) + +*** + +### isConstant() + +```ts +isConstant(): boolean +``` + +Checks whether this field element is a constant. + +See FieldVar to understand constants vs variables. + +#### Returns + +`boolean` + +#### Inherited from + +`createForeignField(Fq.modulus).isConstant` + +#### Source + +[lib/provable/foreign-field.ts:136](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L136) + +*** + +### neg() + +```ts +neg(): AlmostForeignField +``` + +Finite field negation + +#### Returns + +[`AlmostForeignField`](AlmostForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).neg` + +#### Example + +```ts +x.neg(); // -x mod p = p - x +``` + +#### Source + +[lib/provable/foreign-field.ts:229](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L229) + +*** + +### sub() + +```ts +sub(y: number | bigint | ForeignField): UnreducedForeignField +``` + +Finite field subtraction + +#### Parameters + +• **y**: `number` \| `bigint` \| [`ForeignField`](ForeignField.mdx) + +#### Returns + +`UnreducedForeignField` + +#### Inherited from + +`createForeignField(Fq.modulus).sub` + +#### Example + +```ts +x.sub(1); // x - 1 mod p +``` + +#### Source + +[lib/provable/foreign-field.ts:244](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L244) + +*** + +### toBigInt() + +```ts +toBigInt(): bigint +``` + +Convert this field element to a bigint. + +#### Returns + +`bigint` + +#### Inherited from + +`createForeignField(Fq.modulus).toBigInt` + +#### Source + +[lib/provable/foreign-field.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L156) + +*** + +### toBits() + +```ts +toBits(length?: number): Bool[] +``` + +Unpack a field element to its bits, as a [Bool](Bool.mdx)[] array. + +This method is provable! + +#### Parameters + +• **length?**: `number` + +#### Returns + +[`Bool`](Bool.mdx)[] + +#### Inherited from + +`createForeignField(Fq.modulus).toBits` + +#### Source + +[lib/provable/foreign-field.ts:358](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L358) + +*** + +### toConstant() + +```ts +toConstant(): ForeignField +``` + +Convert this field element to a constant. + +See FieldVar to understand constants vs variables. + +**Warning**: This function is only useful in Provable.witness or Provable.asProver blocks, +that is, in situations where the prover computes a value outside provable code. + +#### Returns + +[`ForeignField`](ForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).toConstant` + +#### Source + +[lib/provable/foreign-field.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L148) + +*** + +### toFields() + +```ts +toFields(): Field[] +``` + +Instance version of `Provable.toFields`, see Provable.toFields + +#### Returns + +[`Field`](Field.mdx)[] + +#### Inherited from + +`createForeignField(Fq.modulus).toFields` + +#### Source + +[lib/provable/foreign-field.ts:406](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L406) + +*** + +### toScalar() + +```ts +toScalar(): Scalar +``` + +Provable method to convert a [ScalarField](ScalarField.mdx) into a [Scalar](Scalar.mdx) + +#### Returns + +[`Scalar`](Scalar.mdx) + +#### Source + +[lib/provable/scalar-field.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar-field.ts#L16) + +*** + +### assertAlmostReduced() + +```ts +static assertAlmostReduced(...xs: T): [...{ [i in string | number | symbol]: AlmostForeignField }[]] +``` + +Assert that one or more field elements lie in the range [0, 2^k), +where k = ceil(log2(p)) and p is the foreign field modulus. + +This is most efficient than when checking a multiple of 3 field elements at once. + +#### Type parameters + +• **T** *extends* `Tuple`\<[`ForeignField`](ForeignField.mdx)\> + +#### Parameters + +• ...**xs**: `T` + +#### Returns + +[...\{ [i in string \| number \| symbol]: AlmostForeignField \}[]] + +#### Inherited from + +`createForeignField(Fq.modulus).assertAlmostReduced` + +#### Source + +[lib/provable/foreign-field.ts:187](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L187) + +*** + +### check() + +```ts +static check(x: ForeignField): void +``` + +#### Parameters + +• **x**: [`ForeignField`](ForeignField.mdx) + +#### Returns + +`void` + +#### Inherited from + +`createForeignField(Fq.modulus).check` + +#### Source + +[lib/provable/foreign-field.ts:479](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L479) + +*** + +### from() + +#### from(x) + +```ts +static from(x: string | number | bigint): CanonicalForeignField +``` + +Coerce the input to a [ForeignField](ForeignField.mdx). + +##### Parameters + +• **x**: `string` \| `number` \| `bigint` + +##### Returns + +[`CanonicalForeignField`](CanonicalForeignField.mdx) + +##### Inherited from + +`createForeignField(Fq.modulus).from` + +##### Source + +[lib/provable/foreign-field.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L124) + +#### from(x) + +```ts +static from(x: string | number | bigint | ForeignField): ForeignField +``` + +##### Parameters + +• **x**: `string` \| `number` \| `bigint` \| [`ForeignField`](ForeignField.mdx) + +##### Returns + +[`ForeignField`](ForeignField.mdx) + +##### Inherited from + +`createForeignField(Fq.modulus).from` + +##### Source + +[lib/provable/foreign-field.ts:125](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L125) + +*** + +### fromBits() + +```ts +static fromBits(bits: Bool[]): AlmostForeignField +``` + +Create a field element from its bits, as a `Bool[]` array. + +This method is provable! + +#### Parameters + +• **bits**: [`Bool`](Bool.mdx)[] + +#### Returns + +[`AlmostForeignField`](AlmostForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).fromBits` + +#### Source + +[lib/provable/foreign-field.ts:388](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L388) + +*** + +### fromScalar() + +```ts +static fromScalar(s: Scalar): ScalarField +``` + +Converts this [Scalar](Scalar.mdx) into a [ScalarField](ScalarField.mdx) + +#### Parameters + +• **s**: [`Scalar`](Scalar.mdx) + +#### Returns + +[`ScalarField`](ScalarField.mdx) + +#### Source + +[lib/provable/scalar-field.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar-field.ts#L34) + +*** + +### random() + +```ts +static random(): CanonicalForeignField +``` + +#### Returns + +[`CanonicalForeignField`](CanonicalForeignField.mdx) + +#### Inherited from + +`createForeignField(Fq.modulus).random` + +#### Source + +[lib/provable/foreign-field.ts:399](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L399) + +*** + +### sum() + +```ts +static sum(xs: (number | bigint | ForeignField)[], operations: (-1 | 1)[]): UnreducedForeignField +``` + +Sum (or difference) of multiple finite field elements. + +#### Parameters + +• **xs**: (`number` \| `bigint` \| [`ForeignField`](ForeignField.mdx))[] + +• **operations**: (`-1` \| `1`)[] + +#### Returns + +`UnreducedForeignField` + +#### Inherited from + +`createForeignField(Fq.modulus).sum` + +#### Example + +```ts +let z = ForeignField.sum([3, 2, 1], [-1, 1]); // 3 - 2 + 1 +z.assertEquals(2); +``` + +This method expects a list of ForeignField-like values, `x0,...,xn`, +and a list of "operations" `op1,...,opn` where every op is 1 or -1 (plus or minus), +and returns + +`x0 + op1*x1 + ... + opn*xn` + +where the sum is computed in finite field arithmetic. + +**Important:** For more than two summands, this is significantly more efficient +than chaining calls to [ForeignField.add](ForeignField.mdx#add) and [ForeignField.sub](ForeignField.mdx#sub). + +#### Source + +[lib/provable/foreign-field.ts:269](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L269) + +*** + +### toScalar() + +```ts +static toScalar(field: ForeignField): Scalar +``` + +#### Parameters + +• **field**: [`ForeignField`](ForeignField.mdx) + +#### Returns + +[`Scalar`](Scalar.mdx) + +#### Source + +[lib/provable/scalar-field.ts:20](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar-field.ts#L20) diff --git a/docs/zkapps/o1js-reference/classes/SelfProof.mdx b/docs/zkapps/o1js-reference/classes/SelfProof.mdx index 526742273..f62ebd5e5 100644 --- a/docs/zkapps/o1js-reference/classes/SelfProof.mdx +++ b/docs/zkapps/o1js-reference/classes/SelfProof.mdx @@ -43,7 +43,7 @@ new SelfProof(__namedParameters: { #### Source -[lib/proof-system/zkprogram.ts:233](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L233) +[lib/proof-system/proof.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L49) ## Properties @@ -59,7 +59,7 @@ maxProofsVerified: 0 | 1 | 2; #### Source -[lib/proof-system/zkprogram.ts:220](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L220) +[lib/proof-system/proof.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L36) *** @@ -75,7 +75,7 @@ proof: unknown; #### Source -[lib/proof-system/zkprogram.ts:219](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L219) +[lib/proof-system/proof.ts:35](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L35) *** @@ -91,7 +91,7 @@ publicInput: PublicInput; #### Source -[lib/proof-system/zkprogram.ts:217](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L217) +[lib/proof-system/proof.ts:33](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L33) *** @@ -107,7 +107,7 @@ publicOutput: PublicOutput; #### Source -[lib/proof-system/zkprogram.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L218) +[lib/proof-system/proof.ts:34](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L34) *** @@ -123,7 +123,7 @@ shouldVerify: Bool; #### Source -[lib/proof-system/zkprogram.ts:221](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L221) +[lib/proof-system/proof.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L37) *** @@ -139,7 +139,7 @@ static publicInputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:209](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L209) +[lib/proof-system/proof.ts:25](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L25) *** @@ -155,7 +155,7 @@ static publicOutputType: FlexibleProvablePure; #### Source -[lib/proof-system/zkprogram.ts:210](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L210) +[lib/proof-system/proof.ts:26](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L26) *** @@ -187,10 +187,66 @@ name: string; #### Source -[lib/proof-system/zkprogram.ts:211](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L211) +[lib/proof-system/proof.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L27) + +## Accessors + +### provable + +```ts +get static provable(): ProvableProof, any, any> +``` + +#### Returns + +`ProvableProof`\<[`Proof`](Proof.mdx)\<`any`, `any`\>, `any`, `any`\> + +#### Source + +[lib/proof-system/proof.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L165) ## Methods +### publicFields() + +```ts +publicFields(): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`Proof`](Proof.mdx).[`publicFields`](Proof.mdx#publicfields) + +#### Source + +[lib/proof-system/proof.ts:92](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L92) + +*** + ### toJSON() ```ts @@ -207,7 +263,7 @@ toJSON(): JsonProof #### Source -[lib/proof-system/zkprogram.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L223) +[lib/proof-system/proof.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L39) *** @@ -227,7 +283,7 @@ verify(): void #### Source -[lib/proof-system/zkprogram.ts:252](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L252) +[lib/proof-system/proof.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L98) *** @@ -251,7 +307,7 @@ verifyIf(condition: Bool): void #### Source -[lib/proof-system/zkprogram.ts:255](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L255) +[lib/proof-system/proof.ts:101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L101) *** @@ -311,7 +367,7 @@ must match your ZkProgram. `maxProofsVerified` is the maximum number of proofs t #### Source -[lib/proof-system/zkprogram.ts:307](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L307) +[lib/proof-system/proof.ts:150](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L150) *** @@ -341,4 +397,48 @@ static fromJSON(this: S, __namedParameters: JsonProof): Promise): { + "input": Field[]; + "output": Field[]; +} +``` + +#### Parameters + +• **value**: [`ProofBase`](ProofBase.mdx)\<`any`, `any`\> + +#### Returns + +```ts +{ + "input": Field[]; + "output": Field[]; +} +``` + +##### input + +```ts +input: Field[]; +``` + +##### output + +```ts +output: Field[]; +``` + +#### Inherited from + +[`Proof`](Proof.mdx).[`publicFields`](Proof.mdx#publicfields-1) + +#### Source + +[lib/proof-system/proof.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/proof.ts#L84) diff --git a/docs/zkapps/o1js-reference/classes/Sign.mdx b/docs/zkapps/o1js-reference/classes/Sign.mdx index 4366b07f3..4c7b30bdf 100644 --- a/docs/zkapps/o1js-reference/classes/Sign.mdx +++ b/docs/zkapps/o1js-reference/classes/Sign.mdx @@ -24,7 +24,7 @@ new Sign(...props: any[]): Sign #### Source -[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L13) +[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L13) ## Properties @@ -36,7 +36,7 @@ value: Field; #### Source -[lib/provable/int.ts:962](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L962) +[lib/provable/int.ts:1034](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1034) ## Accessors @@ -52,7 +52,7 @@ get static minusOne(): Sign #### Source -[lib/provable/int.ts:967](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L967) +[lib/provable/int.ts:1039](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1039) *** @@ -68,7 +68,7 @@ get static one(): Sign #### Source -[lib/provable/int.ts:964](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L964) +[lib/provable/int.ts:1036](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1036) ## Methods @@ -92,7 +92,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -116,7 +116,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -136,7 +136,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -152,7 +152,7 @@ isNegative(): Bool #### Source -[lib/provable/int.ts:999](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L999) +[lib/provable/int.ts:1071](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1071) *** @@ -168,7 +168,7 @@ isPositive(): Bool #### Source -[lib/provable/int.ts:996](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L996) +[lib/provable/int.ts:1068](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1068) *** @@ -188,7 +188,7 @@ mul(y: Sign): Sign #### Source -[lib/provable/int.ts:993](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L993) +[lib/provable/int.ts:1065](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1065) *** @@ -204,7 +204,7 @@ neg(): Sign #### Source -[lib/provable/int.ts:990](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L990) +[lib/provable/int.ts:1062](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1062) *** @@ -224,7 +224,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -244,7 +244,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -264,7 +264,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -280,7 +280,7 @@ toString(): string #### Source -[lib/provable/int.ts:1003](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1003) +[lib/provable/int.ts:1075](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1075) *** @@ -304,7 +304,7 @@ static check(x: Sign): void #### Source -[lib/provable/int.ts:970](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L970) +[lib/provable/int.ts:1042](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1042) *** @@ -328,7 +328,7 @@ static empty(): InstanceType #### Source -[lib/provable/int.ts:974](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L974) +[lib/provable/int.ts:1046](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1046) *** @@ -358,7 +358,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -386,7 +386,7 @@ static fromJSON(x: "Positive" | "Negative"): InstanceType #### Source -[lib/provable/int.ts:985](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L985) +[lib/provable/int.ts:1057](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1057) *** @@ -416,7 +416,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -444,7 +444,7 @@ static fromValue(x: bigint | Sign): InstanceType #### Source -[lib/provable/int.ts:1011](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1011) +[lib/provable/int.ts:1083](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1083) *** @@ -464,7 +464,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -484,7 +484,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -514,7 +544,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -544,7 +574,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -568,7 +598,7 @@ static toInput(x: Sign): HashInput #### Source -[lib/provable/int.ts:977](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L977) +[lib/provable/int.ts:1049](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1049) *** @@ -592,7 +622,7 @@ static toJSON(x: Sign): "Positive" | "Negative" #### Source -[lib/provable/int.ts:980](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L980) +[lib/provable/int.ts:1052](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1052) *** @@ -616,4 +646,4 @@ static toValue(x: Sign): Sign #### Source -[lib/provable/int.ts:1007](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1007) +[lib/provable/int.ts:1079](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1079) diff --git a/docs/zkapps/o1js-reference/classes/Signature.mdx b/docs/zkapps/o1js-reference/classes/Signature.mdx index bd0aad3d6..937fdbac8 100644 --- a/docs/zkapps/o1js-reference/classes/Signature.mdx +++ b/docs/zkapps/o1js-reference/classes/Signature.mdx @@ -26,7 +26,7 @@ new Signature(...props: any[]): Signature #### Source -[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L13) +[lib/provable/types/circuit-value.ts:13](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L13) ## Properties @@ -38,7 +38,7 @@ r: Field; #### Source -[lib/provable/crypto/signature.ts:258](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L258) +[lib/provable/crypto/signature.ts:258](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L258) *** @@ -50,7 +50,7 @@ s: Scalar; #### Source -[lib/provable/crypto/signature.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L259) +[lib/provable/crypto/signature.ts:259](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L259) ## Methods @@ -74,7 +74,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -98,7 +98,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -118,7 +118,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -136,7 +136,7 @@ Encodes a [Signature](Signature.mdx) in base58 format. #### Source -[lib/provable/crypto/signature.ts:321](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L321) +[lib/provable/crypto/signature.ts:321](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L321) *** @@ -156,7 +156,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -176,7 +176,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -196,7 +196,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -222,7 +222,7 @@ a [Bool](../variables/Bool.mdx) #### Source -[lib/provable/crypto/signature.ts:296](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L296) +[lib/provable/crypto/signature.ts:296](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L296) *** @@ -252,7 +252,7 @@ static check(this: T, v: InstanceType): void #### Source -[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L163) +[lib/provable/types/circuit-value.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L163) *** @@ -278,7 +278,7 @@ a [Signature](Signature.mdx) #### Source -[lib/provable/crypto/signature.ts:265](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L265) +[lib/provable/crypto/signature.ts:265](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L265) *** @@ -302,7 +302,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -324,7 +324,7 @@ Decodes a base58 encoded signature into a [Signature](Signature.mdx). #### Source -[lib/provable/crypto/signature.ts:314](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/signature.ts#L314) +[lib/provable/crypto/signature.ts:314](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/signature.ts#L314) *** @@ -354,7 +354,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -384,7 +384,7 @@ static fromJSON(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:196](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L196) +[lib/provable/types/circuit-value.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L208) *** @@ -414,7 +414,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -444,7 +444,7 @@ static fromValue(this: T, value: any): InstanceType #### Source -[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L98) +[lib/provable/types/circuit-value.ts:98](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L98) *** @@ -464,7 +464,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -484,7 +484,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -514,7 +544,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -544,7 +574,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -574,7 +604,7 @@ static toInput(this: T, v: InstanceType): HashInput #### Source -[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L63) +[lib/provable/types/circuit-value.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L63) *** @@ -604,7 +634,7 @@ static toJSON(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:185](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L185) +[lib/provable/types/circuit-value.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L197) *** @@ -634,4 +664,4 @@ static toValue(this: T, v: InstanceType): any #### Source -[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L89) +[lib/provable/types/circuit-value.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L89) diff --git a/docs/zkapps/o1js-reference/classes/SmartContract.mdx b/docs/zkapps/o1js-reference/classes/SmartContract.mdx index 85d8430e1..4cbc5e328 100644 --- a/docs/zkapps/o1js-reference/classes/SmartContract.mdx +++ b/docs/zkapps/o1js-reference/classes/SmartContract.mdx @@ -34,7 +34,7 @@ new SmartContract(address: PublicKey, tokenId?: Field): SmartContract #### Source -[lib/mina/zkapp.ts:614](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L614) +[lib/mina/zkapp.ts:614](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L614) ## Properties @@ -46,7 +46,7 @@ address: PublicKey; #### Source -[lib/mina/zkapp.ts:579](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L579) +[lib/mina/zkapp.ts:579](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L579) *** @@ -64,7 +64,7 @@ A list of event types that can be emitted using this.emitEvent()`. #### Source -[lib/mina/zkapp.ts:967](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L967) +[lib/mina/zkapp.ts:979](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L979) *** @@ -86,6 +86,11 @@ self: SmartContract; #### getAndRequireSignature() +Return a public key that is forced to sign this transaction. + +Note: This doesn't prove that the return value is the transaction sender, but it proves that whoever created +the transaction controls the private key associated with the returned public key. + ##### Returns [`PublicKey`](PublicKey.mdx) @@ -99,13 +104,15 @@ Throws an error if not inside a transaction, or the sender wasn't passed in. **Warning**: The fact that this public key equals the current sender is not part of the proof. A malicious prover could use any other public key without affecting the validity of the proof. +Consider using `this.sender.getAndRequireSignature()` if you need to prove that the sender controls this account. + ##### Returns [`PublicKey`](PublicKey.mdx) #### Source -[lib/mina/zkapp.ts:870](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L870) +[lib/mina/zkapp.ts:868](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L868) *** @@ -117,7 +124,7 @@ tokenId: Field; #### Source -[lib/mina/zkapp.ts:580](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L580) +[lib/mina/zkapp.ts:580](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L580) *** @@ -129,7 +136,7 @@ static optional _maxProofsVerified: 0 | 2 | 1; #### Source -[lib/mina/zkapp.ts:599](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L599) +[lib/mina/zkapp.ts:599](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L599) *** @@ -146,7 +153,7 @@ static optional _methodMetadata: Record( + condition: Bool, + type: K, + event: any): void +``` + +Conditionally emits an event. + +Events will be emitted as a part of the transaction and can be collected by archive nodes. + +#### Type parameters + +• **K** *extends* `string` \| `number` + +#### Parameters + +• **condition**: [`Bool`](Bool.mdx) + +• **type**: `K` + +• **event**: `any` + +#### Returns + +`void` + +#### Source + +[lib/mina/zkapp.ts:987](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L987) *** @@ -513,7 +555,7 @@ console.log(events); #### Source -[lib/mina/zkapp.ts:1019](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1019) +[lib/mina/zkapp.ts:1047](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1047) *** @@ -541,7 +583,7 @@ class MyContract extends SmartContract { #### Source -[lib/mina/zkapp.ts:773](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L773) +[lib/mina/zkapp.ts:771](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L771) *** @@ -563,7 +605,7 @@ Same as `SmartContract.self` but explicitly creates a new [AccountUpdate](Accoun #### Source -[lib/mina/zkapp.ts:860](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L860) +[lib/mina/zkapp.ts:858](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L858) *** @@ -589,7 +631,7 @@ with the only difference being that quick mock proofs are filled in instead of r #### Source -[lib/mina/zkapp.ts:806](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L806) +[lib/mina/zkapp.ts:804](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L804) *** @@ -616,7 +658,7 @@ send(args: { #### Source -[lib/mina/zkapp.ts:951](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L951) +[lib/mina/zkapp.ts:963](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L963) *** @@ -639,7 +681,7 @@ authorization flow. #### Source -[lib/mina/zkapp.ts:818](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L818) +[lib/mina/zkapp.ts:816](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L816) *** @@ -657,7 +699,7 @@ Returns a Proof type that belongs to this [SmartContract](SmartContract.mdx). #### Source -[lib/mina/zkapp.ts:605](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L605) +[lib/mina/zkapp.ts:605](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L605) *** @@ -709,7 +751,7 @@ an object, keyed by method name, each entry containing: #### Source -[lib/mina/zkapp.ts:1138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1138) +[lib/mina/zkapp.ts:1178](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1178) *** @@ -807,7 +849,7 @@ up to several minutes if your circuit is large or your hardware is not optimal f #### Source -[lib/mina/zkapp.ts:642](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L642) +[lib/mina/zkapp.ts:642](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L642) *** @@ -829,7 +871,7 @@ the digest, as a hex string #### Source -[lib/mina/zkapp.ts:683](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L683) +[lib/mina/zkapp.ts:683](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L683) *** @@ -849,4 +891,4 @@ static runOutsideCircuit(run: () => void): void #### Source -[lib/mina/zkapp.ts:1113](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1113) +[lib/mina/zkapp.ts:1153](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1153) diff --git a/docs/zkapps/o1js-reference/classes/TokenAccountUpdateIterator.mdx b/docs/zkapps/o1js-reference/classes/TokenAccountUpdateIterator.mdx index e6962e8da..a5e03d3dc 100644 --- a/docs/zkapps/o1js-reference/classes/TokenAccountUpdateIterator.mdx +++ b/docs/zkapps/o1js-reference/classes/TokenAccountUpdateIterator.mdx @@ -28,7 +28,7 @@ We still can't avoid processing some account updates that don't use the token, t ```ts new TokenAccountUpdateIterator( forest: MerkleListIterator, - mayUseToken: {}, + mayUseToken: MayUseToken, selfToken: Field): TokenAccountUpdateIterator ``` @@ -36,7 +36,7 @@ new TokenAccountUpdateIterator( • **forest**: [`MerkleListIterator`](MerkleListIterator.mdx)\<`AccountUpdateTreeBase`\> -• **mayUseToken** +• **mayUseToken**: `MayUseToken` • **selfToken**: [`Field`](Field.mdx) @@ -46,7 +46,7 @@ new TokenAccountUpdateIterator( #### Source -[lib/mina/token/forest-iterator.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L56) +[lib/mina/token/forest-iterator.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L59) ## Properties @@ -58,7 +58,7 @@ currentLayer: Layer; #### Source -[lib/mina/token/forest-iterator.ts:52](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L52) +[lib/mina/token/forest-iterator.ts:55](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L55) *** @@ -70,7 +70,7 @@ selfToken: Field; #### Source -[lib/mina/token/forest-iterator.ts:54](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L54) +[lib/mina/token/forest-iterator.ts:57](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L57) *** @@ -82,7 +82,7 @@ unfinishedParentLayers: MerkleList; #### Source -[lib/mina/token/forest-iterator.ts:53](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L53) +[lib/mina/token/forest-iterator.ts:56](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L56) ## Methods @@ -102,7 +102,7 @@ assertFinished(message?: string): void #### Source -[lib/mina/token/forest-iterator.ts:137](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L137) +[lib/mina/token/forest-iterator.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L140) *** @@ -148,7 +148,7 @@ usesThisToken: Bool; #### Source -[lib/mina/token/forest-iterator.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L85) +[lib/mina/token/forest-iterator.ts:88](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L88) *** @@ -170,4 +170,4 @@ static create(forest: AccountUpdateForest, selfToken: Field): TokenAccountUpdate #### Source -[lib/mina/token/forest-iterator.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/forest-iterator.ts#L66) +[lib/mina/token/forest-iterator.ts:69](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/forest-iterator.ts#L69) diff --git a/docs/zkapps/o1js-reference/classes/TokenContract.mdx b/docs/zkapps/o1js-reference/classes/TokenContract.mdx index bdbf772d1..40240bd62 100644 --- a/docs/zkapps/o1js-reference/classes/TokenContract.mdx +++ b/docs/zkapps/o1js-reference/classes/TokenContract.mdx @@ -30,7 +30,7 @@ new TokenContract(address: PublicKey, tokenId?: Field): TokenContract #### Source -[lib/mina/zkapp.ts:614](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L614) +[lib/mina/zkapp.ts:614](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L614) ## Properties @@ -46,7 +46,7 @@ address: PublicKey; #### Source -[lib/mina/zkapp.ts:579](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L579) +[lib/mina/zkapp.ts:579](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L579) *** @@ -68,7 +68,7 @@ A list of event types that can be emitted using this.emitEvent()`. #### Source -[lib/mina/zkapp.ts:967](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L967) +[lib/mina/zkapp.ts:979](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L979) *** @@ -90,6 +90,11 @@ self: SmartContract; #### getAndRequireSignature() +Return a public key that is forced to sign this transaction. + +Note: This doesn't prove that the return value is the transaction sender, but it proves that whoever created +the transaction controls the private key associated with the returned public key. + ##### Returns [`PublicKey`](PublicKey.mdx) @@ -103,6 +108,8 @@ Throws an error if not inside a transaction, or the sender wasn't passed in. **Warning**: The fact that this public key equals the current sender is not part of the proof. A malicious prover could use any other public key without affecting the validity of the proof. +Consider using `this.sender.getAndRequireSignature()` if you need to prove that the sender controls this account. + ##### Returns [`PublicKey`](PublicKey.mdx) @@ -113,7 +120,7 @@ A malicious prover could use any other public key without affecting the validity #### Source -[lib/mina/zkapp.ts:870](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L870) +[lib/mina/zkapp.ts:868](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L868) *** @@ -129,7 +136,22 @@ tokenId: Field; #### Source -[lib/mina/zkapp.ts:580](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L580) +[lib/mina/zkapp.ts:580](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L580) + +*** + +### MAX\_ACCOUNT\_UPDATES + +```ts +static MAX_ACCOUNT_UPDATES: number = 9; +``` + +The maximum number of account updates using the token in a single +transaction that this contract supports. + +#### Source + +[lib/mina/token/token-contract.ts:29](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L29) *** @@ -145,7 +167,7 @@ static optional _maxProofsVerified: 0 | 2 | 1; #### Source -[lib/mina/zkapp.ts:599](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L599) +[lib/mina/zkapp.ts:599](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L599) *** @@ -166,7 +188,7 @@ static optional _methodMetadata: Record #### Source -[lib/mina/token/token-contract.ts:83](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L83) +[lib/mina/token/token-contract.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L84) *** @@ -571,7 +593,7 @@ This is provided out of the box as it is both a good example, and probably the m #### Source -[lib/mina/token/token-contract.ts:121](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L121) +[lib/mina/token/token-contract.ts:128](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L128) *** @@ -615,7 +637,7 @@ async deploy() { #### Source -[lib/mina/token/token-contract.ts:51](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L51) +[lib/mina/token/token-contract.ts:52](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L52) *** @@ -633,7 +655,7 @@ Returns the `tokenId` of the token managed by this contract. #### Source -[lib/mina/token/token-contract.ts:69](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L69) +[lib/mina/token/token-contract.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L70) *** @@ -665,7 +687,46 @@ Emits an event. Events will be emitted as a part of the transaction and can be c #### Source -[lib/mina/zkapp.ts:973](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L973) +[lib/mina/zkapp.ts:1030](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1030) + +*** + +### emitEventIf() + +```ts +emitEventIf( + condition: Bool, + type: K, + event: any): void +``` + +Conditionally emits an event. + +Events will be emitted as a part of the transaction and can be collected by archive nodes. + +#### Type parameters + +• **K** *extends* `string` \| `number` + +#### Parameters + +• **condition**: [`Bool`](Bool.mdx) + +• **type**: `K` + +• **event**: `any` + +#### Returns + +`void` + +#### Inherited from + +[`SmartContract`](SmartContract.mdx).[`emitEventIf`](SmartContract.mdx#emiteventif) + +#### Source + +[lib/mina/zkapp.ts:987](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L987) *** @@ -744,7 +805,7 @@ console.log(events); #### Source -[lib/mina/zkapp.ts:1019](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1019) +[lib/mina/zkapp.ts:1047](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1047) *** @@ -770,7 +831,7 @@ This method is provable and is suitable as a base for implementing `approveUpdat #### Source -[lib/mina/token/token-contract.ts:90](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L90) +[lib/mina/token/token-contract.ts:91](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L91) *** @@ -802,7 +863,7 @@ class MyContract extends SmartContract { #### Source -[lib/mina/zkapp.ts:773](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L773) +[lib/mina/zkapp.ts:771](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L771) *** @@ -828,7 +889,7 @@ Same as `SmartContract.self` but explicitly creates a new [AccountUpdate](Accoun #### Source -[lib/mina/zkapp.ts:860](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L860) +[lib/mina/zkapp.ts:858](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L858) *** @@ -858,7 +919,7 @@ with the only difference being that quick mock proofs are filled in instead of r #### Source -[lib/mina/zkapp.ts:806](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L806) +[lib/mina/zkapp.ts:804](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L804) *** @@ -889,7 +950,7 @@ send(args: { #### Source -[lib/mina/zkapp.ts:951](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L951) +[lib/mina/zkapp.ts:963](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L963) *** @@ -916,7 +977,7 @@ authorization flow. #### Source -[lib/mina/zkapp.ts:818](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L818) +[lib/mina/zkapp.ts:816](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L816) *** @@ -945,7 +1006,7 @@ Transfer `amount` of tokens from `from` to `to`. #### Source -[lib/mina/token/token-contract.ts:157](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/token/token-contract.ts#L157) +[lib/mina/token/token-contract.ts:164](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/token/token-contract.ts#L164) *** @@ -967,7 +1028,7 @@ Returns a Proof type that belongs to this [SmartContract](SmartContract.mdx). #### Source -[lib/mina/zkapp.ts:605](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L605) +[lib/mina/zkapp.ts:605](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L605) *** @@ -1023,7 +1084,7 @@ an object, keyed by method name, each entry containing: #### Source -[lib/mina/zkapp.ts:1138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1138) +[lib/mina/zkapp.ts:1178](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1178) *** @@ -1125,7 +1186,7 @@ up to several minutes if your circuit is large or your hardware is not optimal f #### Source -[lib/mina/zkapp.ts:642](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L642) +[lib/mina/zkapp.ts:642](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L642) *** @@ -1151,7 +1212,7 @@ the digest, as a hex string #### Source -[lib/mina/zkapp.ts:683](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L683) +[lib/mina/zkapp.ts:683](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L683) *** @@ -1175,4 +1236,4 @@ static runOutsideCircuit(run: () => void): void #### Source -[lib/mina/zkapp.ts:1113](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1113) +[lib/mina/zkapp.ts:1153](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1153) diff --git a/docs/zkapps/o1js-reference/classes/TokenSymbol.mdx b/docs/zkapps/o1js-reference/classes/TokenSymbol.mdx index c9c1b4dd8..8e017196c 100644 --- a/docs/zkapps/o1js-reference/classes/TokenSymbol.mdx +++ b/docs/zkapps/o1js-reference/classes/TokenSymbol.mdx @@ -34,7 +34,7 @@ new TokenSymbol(value: { #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) ## Properties @@ -50,7 +50,7 @@ field: Field; #### Source -[lib/provable/crypto/poseidon.ts:206](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/poseidon.ts#L206) +[lib/provable/crypto/poseidon.ts:212](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L212) *** @@ -66,7 +66,7 @@ symbol: string; #### Source -[lib/provable/crypto/poseidon.ts:206](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/poseidon.ts#L206) +[lib/provable/crypto/poseidon.ts:212](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L212) *** @@ -82,7 +82,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -120,7 +120,7 @@ the element of type `T` to put assertions on. #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -160,7 +160,7 @@ symbol: string; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -214,7 +214,7 @@ symbol: string; #### Source -[lib/provable/types/provable-intf.ts:49](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L49) +[lib/provable/types/provable-intf.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L59) *** @@ -258,7 +258,7 @@ symbol: string; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -288,7 +288,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -325,7 +325,73 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "field": Field; + "symbol": string; + }) => { + "field": Field; + "symbol": string; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.field**: [`Field`](Field.mdx) + +• **x.symbol**: `string` + +#### Returns + +```ts +{ + "field": Field; + "symbol": string; +} +``` + +##### field + +```ts +field: Field; +``` + +##### symbol + +```ts +symbol: string; +``` + +#### Inherited from + +`Struct(TokenSymbolPure).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -361,7 +427,7 @@ the element of type `T` to generate the [Field](Field.mdx) array from. #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -412,7 +478,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L152) *** @@ -443,7 +509,7 @@ static toJSON: (x: { #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -476,7 +542,7 @@ Convert provable type to a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -496,7 +562,7 @@ static from(value: string | TokenSymbol): TokenSymbol #### Source -[lib/provable/crypto/poseidon.ts:253](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/poseidon.ts#L253) +[lib/provable/crypto/poseidon.ts:259](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L259) *** @@ -520,4 +586,4 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/classes/UInt32.mdx b/docs/zkapps/o1js-reference/classes/UInt32.mdx index a80c2b1de..04f8031ea 100644 --- a/docs/zkapps/o1js-reference/classes/UInt32.mdx +++ b/docs/zkapps/o1js-reference/classes/UInt32.mdx @@ -41,7 +41,7 @@ The max value of a [UInt32](UInt32.mdx) is `2^32 - 1 = UInt32.MAXINT()`. #### Source -[lib/provable/int.ts:514](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L514) +[lib/provable/int.ts:540](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L540) ## Properties @@ -53,7 +53,7 @@ value: Field; #### Source -[lib/provable/int.ts:505](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L505) +[lib/provable/int.ts:531](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L531) *** @@ -65,7 +65,7 @@ static NUM_BITS: number = 32; #### Source -[lib/provable/int.ts:506](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L506) +[lib/provable/int.ts:532](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L532) *** @@ -94,7 +94,7 @@ Only use this if you know what you are doing, otherwise use the safe [UInt32.fro #### Source -[lib/provable/int.ts:522](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L522) +[lib/provable/int.ts:548](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L548) ## Accessors @@ -112,7 +112,7 @@ Static method to create a [UInt32](UInt32.mdx) with value `0`. #### Source -[lib/provable/int.ts:544](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L544) +[lib/provable/int.ts:570](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L570) *** @@ -130,7 +130,7 @@ Static method to create a [UInt32](UInt32.mdx) with value `0`. #### Source -[lib/provable/int.ts:537](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L537) +[lib/provable/int.ts:563](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L563) ## Methods @@ -152,7 +152,7 @@ Addition with overflow checking. #### Source -[lib/provable/int.ts:691](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L691) +[lib/provable/int.ts:717](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L717) *** @@ -174,7 +174,7 @@ Addition modulo 2^32. Check Gadgets.addMod32 for a detailed description. #### Source -[lib/provable/int.ts:617](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L617) +[lib/provable/int.ts:643](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L643) *** @@ -218,7 +218,7 @@ c.assertEquals(1); #### Source -[lib/provable/int.ts:862](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L862) +[lib/provable/int.ts:888](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L888) *** @@ -242,7 +242,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -266,7 +266,7 @@ Asserts that a [UInt32](UInt32.mdx) is greater than another one. #### Source -[lib/provable/int.ts:932](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L932) +[lib/provable/int.ts:975](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L975) *** @@ -290,7 +290,7 @@ Asserts that a [UInt32](UInt32.mdx) is greater than or equal to another one. #### Source -[lib/provable/int.ts:946](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L946) +[lib/provable/int.ts:989](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L989) *** @@ -314,7 +314,7 @@ Asserts that a [UInt32](UInt32.mdx) is less than another one. #### Source -[lib/provable/int.ts:909](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L909) +[lib/provable/int.ts:952](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L952) *** @@ -338,7 +338,7 @@ Asserts that a [UInt32](UInt32.mdx) is less than or equal to another one. #### Source -[lib/provable/int.ts:881](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L881) +[lib/provable/int.ts:924](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L924) *** @@ -363,7 +363,7 @@ Integer division. #### Source -[lib/provable/int.ts:668](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L668) +[lib/provable/int.ts:694](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L694) *** @@ -407,7 +407,7 @@ rest: UInt32; #### Source -[lib/provable/int.ts:626](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L626) +[lib/provable/int.ts:652](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L652) *** @@ -431,7 +431,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -453,7 +453,7 @@ Checks if a [UInt32](UInt32.mdx) is greater than another one. #### Source -[lib/provable/int.ts:925](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L925) +[lib/provable/int.ts:968](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L968) *** @@ -475,7 +475,7 @@ Checks if a [UInt32](UInt32.mdx) is greater than or equal to another one. #### Source -[lib/provable/int.ts:939](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L939) +[lib/provable/int.ts:982](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L982) *** @@ -495,7 +495,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -534,7 +534,7 @@ y.assertEquals(0b110000); // 48 in binary #### Source -[lib/provable/int.ts:810](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L810) +[lib/provable/int.ts:836](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L836) *** @@ -556,7 +556,7 @@ Checks if a [UInt32](UInt32.mdx) is less than another one. #### Source -[lib/provable/int.ts:897](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L897) +[lib/provable/int.ts:940](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L940) *** @@ -578,7 +578,7 @@ Checks if a [UInt32](UInt32.mdx) is less than or equal to another one. #### Source -[lib/provable/int.ts:869](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L869) +[lib/provable/int.ts:912](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L912) *** @@ -603,7 +603,7 @@ Integer remainder. #### Source -[lib/provable/int.ts:677](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L677) +[lib/provable/int.ts:703](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L703) *** @@ -625,7 +625,7 @@ Multiplication with overflow checking. #### Source -[lib/provable/int.ts:683](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L683) +[lib/provable/int.ts:709](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L709) *** @@ -666,7 +666,40 @@ console.log(b.toBigInt().toString(2)); #### Source -[lib/provable/int.ts:755](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L755) +[lib/provable/int.ts:781](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L781) + +*** + +### or() + +```ts +or(x: UInt32): UInt32 +``` + +Bitwise OR gadget on [UInt32](UInt32.mdx) elements. Equivalent to the [bitwise OR `|` operator in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR). +The OR gate works by comparing two bits and returning `1` if at least one bit is `1`, and `0` otherwise. + +#### Parameters + +• **x**: [`UInt32`](UInt32.mdx) + +#### Returns + +[`UInt32`](UInt32.mdx) + +#### Example + +```typescript +let a = UInt32.from(3); // ... 000011 +let b = UInt32.from(5); // ... 000101 + +let c = a.or(b); // ... 000111 +c.assertEquals(7); +``` + +#### Source + +[lib/provable/int.ts:905](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L905) *** @@ -705,7 +738,7 @@ y.assertEquals(0b000011); // 48 in binary #### Source -[lib/provable/int.ts:833](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L833) +[lib/provable/int.ts:859](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L859) *** @@ -755,7 +788,7 @@ z.assertEquals(0b000011); #### Source -[lib/provable/int.ts:787](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L787) +[lib/provable/int.ts:813](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L813) *** @@ -777,7 +810,7 @@ Subtraction with underflow checking. #### Source -[lib/provable/int.ts:699](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L699) +[lib/provable/int.ts:725](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L725) *** @@ -795,7 +828,43 @@ Turns the [UInt32](UInt32.mdx) into a BigInt. #### Source -[lib/provable/int.ts:556](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L556) +[lib/provable/int.ts:582](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L582) + +*** + +### toBytes() + +```ts +toBytes(): [UInt8, UInt8, UInt8, UInt8] +``` + +Split a UInt32 into 4 UInt8s, in little-endian order. + +#### Returns + +[[`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx)] + +#### Source + +[lib/provable/int.ts:1006](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1006) + +*** + +### toBytesBE() + +```ts +toBytesBE(): [UInt8, UInt8, UInt8, UInt8] +``` + +Split a UInt32 into 4 UInt8s, in big-endian order. + +#### Returns + +[[`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx), [`UInt8`](UInt8.mdx)] + +#### Source + +[lib/provable/int.ts:1013](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1013) *** @@ -815,7 +884,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -835,7 +904,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -855,7 +924,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -873,7 +942,7 @@ Turns the [UInt32](UInt32.mdx) into a string. #### Source -[lib/provable/int.ts:550](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L550) +[lib/provable/int.ts:576](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L576) *** @@ -891,7 +960,7 @@ Turns the [UInt32](UInt32.mdx) into a [UInt64](UInt64.mdx). #### Source -[lib/provable/int.ts:562](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L562) +[lib/provable/int.ts:588](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L588) *** @@ -930,7 +999,7 @@ c.assertEquals(0b0110); #### Source -[lib/provable/int.ts:724](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L724) +[lib/provable/int.ts:750](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L750) *** @@ -948,7 +1017,7 @@ Creates a [UInt32](UInt32.mdx) with a value of 4,294,967,295. #### Source -[lib/provable/int.ts:610](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L610) +[lib/provable/int.ts:636](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L636) *** @@ -972,7 +1041,7 @@ static check(x: UInt32): void #### Source -[lib/provable/int.ts:567](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L567) +[lib/provable/int.ts:593](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L593) *** @@ -996,7 +1065,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -1018,7 +1087,51 @@ Creates a new [UInt32](UInt32.mdx). #### Source -[lib/provable/int.ts:602](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L602) +[lib/provable/int.ts:628](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L628) + +*** + +### fromBytes() + +```ts +static fromBytes(bytes: UInt8[]): UInt32 +``` + +Combine 4 UInt8s into a UInt32, in little-endian order. + +#### Parameters + +• **bytes**: [`UInt8`](UInt8.mdx)[] + +#### Returns + +[`UInt32`](UInt32.mdx) + +#### Source + +[lib/provable/int.ts:1020](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1020) + +*** + +### fromBytesBE() + +```ts +static fromBytesBE(bytes: UInt8[]): UInt32 +``` + +Combine 4 UInt8s into a UInt32, in big-endian order. + +#### Parameters + +• **bytes**: [`UInt8`](UInt8.mdx)[] + +#### Returns + +[`UInt32`](UInt32.mdx) + +#### Source + +[lib/provable/int.ts:1028](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1028) *** @@ -1048,7 +1161,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -1078,7 +1191,7 @@ Decodes a JSON-like object into this structure. #### Source -[lib/provable/int.ts:583](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L583) +[lib/provable/int.ts:609](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L609) *** @@ -1108,7 +1221,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -1136,7 +1249,7 @@ static fromValue(x: bigint | UInt32): InstanceType #### Source -[lib/provable/int.ts:954](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L954) +[lib/provable/int.ts:997](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L997) *** @@ -1156,7 +1269,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -1176,7 +1289,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -1206,7 +1349,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -1236,7 +1379,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -1260,7 +1403,7 @@ static toInput(x: UInt32): HashInput #### Source -[lib/provable/int.ts:570](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L570) +[lib/provable/int.ts:596](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L596) *** @@ -1286,7 +1429,7 @@ Encodes this structure into a JSON-like object. #### Source -[lib/provable/int.ts:576](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L576) +[lib/provable/int.ts:602](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L602) *** @@ -1310,4 +1453,4 @@ static toValue(x: UInt32): bigint #### Source -[lib/provable/int.ts:950](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L950) +[lib/provable/int.ts:993](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L993) diff --git a/docs/zkapps/o1js-reference/classes/UInt64.mdx b/docs/zkapps/o1js-reference/classes/UInt64.mdx index f0dee5ff8..cc0b463fc 100644 --- a/docs/zkapps/o1js-reference/classes/UInt64.mdx +++ b/docs/zkapps/o1js-reference/classes/UInt64.mdx @@ -43,7 +43,7 @@ The max value of a [UInt64](UInt64.mdx) is `2^64 - 1 = UInt64.MAXINT()`. #### Source -[lib/provable/int.ts:38](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L38) +[lib/provable/int.ts:40](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L40) ## Properties @@ -55,7 +55,7 @@ value: Field; #### Source -[lib/provable/int.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L29) +[lib/provable/int.ts:31](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L31) *** @@ -67,7 +67,7 @@ static NUM_BITS: number = 64; #### Source -[lib/provable/int.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L30) +[lib/provable/int.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L32) *** @@ -96,7 +96,7 @@ Only use this if you know what you are doing, otherwise use the safe [UInt64.fro #### Source -[lib/provable/int.ts:46](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L46) +[lib/provable/int.ts:48](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L48) ## Accessors @@ -114,7 +114,7 @@ Static method to create a [UInt64](UInt64.mdx) with value `1`. #### Source -[lib/provable/int.ts:67](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L67) +[lib/provable/int.ts:69](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L69) *** @@ -132,7 +132,7 @@ Static method to create a [UInt64](UInt64.mdx) with value `0`. #### Source -[lib/provable/int.ts:61](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L61) +[lib/provable/int.ts:63](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L63) ## Methods @@ -154,7 +154,29 @@ Addition with overflow checking. #### Source -[lib/provable/int.ts:232](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L232) +[lib/provable/int.ts:241](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L241) + +*** + +### addMod64() + +```ts +addMod64(y: UInt64): UInt64 +``` + +Addition modulo 2^64. Check Gadgets.addMod64 for a detailed description. + +#### Parameters + +• **y**: [`UInt64`](UInt64.mdx) + +#### Returns + +[`UInt64`](UInt64.mdx) + +#### Source + +[lib/provable/int.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L163) *** @@ -198,7 +220,7 @@ c.assertEquals(1); #### Source -[lib/provable/int.ts:402](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L402) +[lib/provable/int.ts:411](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L411) *** @@ -222,7 +244,7 @@ assertEquals(x: this): void #### Source -[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L130) +[lib/provable/types/circuit-value.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L130) *** @@ -246,7 +268,7 @@ Asserts that a [UInt64](UInt64.mdx) is greater than another one. #### Source -[lib/provable/int.ts:473](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L473) +[lib/provable/int.ts:499](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L499) *** @@ -270,7 +292,7 @@ Asserts that a [UInt64](UInt64.mdx) is greater than or equal to another one. #### Source -[lib/provable/int.ts:487](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L487) +[lib/provable/int.ts:513](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L513) *** @@ -294,7 +316,7 @@ Asserts that a [UInt64](UInt64.mdx) is less than another one. #### Source -[lib/provable/int.ts:450](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L450) +[lib/provable/int.ts:476](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L476) *** @@ -318,7 +340,7 @@ Asserts that a [UInt64](UInt64.mdx) is less than or equal to another one. #### Source -[lib/provable/int.ts:421](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L421) +[lib/provable/int.ts:447](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L447) *** @@ -343,7 +365,7 @@ Integer division. #### Source -[lib/provable/int.ts:206](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L206) +[lib/provable/int.ts:215](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L215) *** @@ -387,7 +409,7 @@ rest: UInt64; #### Source -[lib/provable/int.ts:163](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L163) +[lib/provable/int.ts:172](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L172) *** @@ -411,7 +433,7 @@ equals(x: this): Bool #### Source -[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L126) +[lib/provable/types/circuit-value.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L126) *** @@ -433,7 +455,7 @@ Checks if a [UInt64](UInt64.mdx) is greater than another one. #### Source -[lib/provable/int.ts:466](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L466) +[lib/provable/int.ts:492](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L492) *** @@ -455,7 +477,7 @@ Checks if a [UInt64](UInt64.mdx) is greater than or equal to another one. #### Source -[lib/provable/int.ts:480](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L480) +[lib/provable/int.ts:506](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L506) *** @@ -475,7 +497,7 @@ isConstant(): boolean #### Source -[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L134) +[lib/provable/types/circuit-value.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L134) *** @@ -512,7 +534,7 @@ y.assertEquals(0b110000); // 48 in binary #### Source -[lib/provable/int.ts:352](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L352) +[lib/provable/int.ts:361](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L361) *** @@ -534,7 +556,7 @@ Checks if a [UInt64](UInt64.mdx) is less than another one. #### Source -[lib/provable/int.ts:438](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L438) +[lib/provable/int.ts:464](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L464) *** @@ -556,7 +578,7 @@ Checks if a [UInt64](UInt64.mdx) is less than or equal to another one. #### Source -[lib/provable/int.ts:409](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L409) +[lib/provable/int.ts:435](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L435) *** @@ -581,7 +603,7 @@ Integer remainder. #### Source -[lib/provable/int.ts:216](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L216) +[lib/provable/int.ts:225](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L225) *** @@ -603,7 +625,7 @@ Multiplication with overflow checking. #### Source -[lib/provable/int.ts:223](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L223) +[lib/provable/int.ts:232](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L232) *** @@ -645,7 +667,40 @@ console.log(b.toBigInt().toString(2)); #### Source -[lib/provable/int.ts:299](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L299) +[lib/provable/int.ts:308](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L308) + +*** + +### or() + +```ts +or(x: UInt64): UInt64 +``` + +Bitwise OR gadget on [UInt64](UInt64.mdx) elements. Equivalent to the [bitwise OR `|` operator in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR). +The OR gate works by comparing two bits and returning `1` if at least one bit is `1`, and `0` otherwise. + +#### Parameters + +• **x**: [`UInt64`](UInt64.mdx) + +#### Returns + +[`UInt64`](UInt64.mdx) + +#### Example + +```typescript +let a = UInt64.from(3); // ... 000011 +let b = UInt64.from(5); // ... 000101 + +let c = a.or(b); // ... 000111 +c.assertEquals(7); +``` + +#### Source + +[lib/provable/int.ts:428](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L428) *** @@ -682,7 +737,7 @@ y.assertEquals(0b000011); // 3 in binary #### Source -[lib/provable/int.ts:373](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L373) +[lib/provable/int.ts:382](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L382) *** @@ -732,7 +787,7 @@ z.assertEquals(0b000011); #### Source -[lib/provable/int.ts:331](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L331) +[lib/provable/int.ts:340](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L340) *** @@ -754,7 +809,7 @@ Subtraction with underflow checking. #### Source -[lib/provable/int.ts:241](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L241) +[lib/provable/int.ts:250](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L250) *** @@ -772,7 +827,7 @@ Turns the [UInt64](UInt64.mdx) into a BigInt. #### Source -[lib/provable/int.ts:81](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L81) +[lib/provable/int.ts:83](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L83) *** @@ -792,7 +847,7 @@ toConstant(): this #### Source -[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L122) +[lib/provable/types/circuit-value.ts:122](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L122) *** @@ -812,7 +867,7 @@ toFields(): Field[] #### Source -[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L85) +[lib/provable/types/circuit-value.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L85) *** @@ -832,7 +887,7 @@ toJSON(): any #### Source -[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L118) +[lib/provable/types/circuit-value.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L118) *** @@ -850,7 +905,7 @@ Turns the [UInt64](UInt64.mdx) into a string. #### Source -[lib/provable/int.ts:74](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L74) +[lib/provable/int.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L76) *** @@ -868,7 +923,7 @@ Turns the [UInt64](UInt64.mdx) into a [UInt32](UInt32.mdx), asserting that it fi #### Source -[lib/provable/int.ts:88](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L88) +[lib/provable/int.ts:90](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L90) *** @@ -889,7 +944,7 @@ UInt64.from(4294967296).toUInt32Clamped().toString(); // "4294967295" #### Source -[lib/provable/int.ts:100](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L100) +[lib/provable/int.ts:102](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L102) *** @@ -928,7 +983,7 @@ c.assertEquals(0b0110); #### Source -[lib/provable/int.ts:266](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L266) +[lib/provable/int.ts:275](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L275) *** @@ -946,7 +1001,7 @@ Creates a [UInt64](UInt64.mdx) with a value of 18,446,744,073,709,551,615. #### Source -[lib/provable/int.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L154) +[lib/provable/int.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L156) *** @@ -970,7 +1025,7 @@ static check(x: UInt64): void #### Source -[lib/provable/int.ts:110](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L110) +[lib/provable/int.ts:112](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L112) *** @@ -994,7 +1049,7 @@ static empty(): InstanceType #### Source -[lib/provable/types/circuit-value.ts:218](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L218) +[lib/provable/types/circuit-value.ts:230](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L230) *** @@ -1026,7 +1081,7 @@ Creates a new [UInt64](UInt64.mdx). #### Source -[lib/provable/int.ts:146](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L146) +[lib/provable/int.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L148) *** @@ -1056,7 +1111,7 @@ static fromFields(this: T, xs: Field[]): InstanceType #### Source -[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L138) +[lib/provable/types/circuit-value.ts:138](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L138) *** @@ -1086,7 +1141,7 @@ Decodes a JSON-like object into this structure. #### Source -[lib/provable/int.ts:128](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L128) +[lib/provable/int.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L130) *** @@ -1116,7 +1171,7 @@ static fromObject(this: T, value: NonMethods>): InstanceType< #### Source -[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L30) +[lib/provable/types/circuit-value.ts:30](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L30) *** @@ -1144,7 +1199,7 @@ static fromValue(x: bigint | UInt64): InstanceType #### Source -[lib/provable/int.ts:495](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L495) +[lib/provable/int.ts:521](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L521) *** @@ -1164,7 +1219,7 @@ static sizeInFields(): number #### Source -[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L37) +[lib/provable/types/circuit-value.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L37) *** @@ -1184,7 +1239,37 @@ static toAuxiliary(): [] #### Source -[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L59) +[lib/provable/types/circuit-value.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L59) + +*** + +### toCanonical() + +```ts +static toCanonical(this: T, value: InstanceType): InstanceType +``` + +#### Type parameters + +• **T** *extends* `AnyConstructor` + +#### Parameters + +• **this**: `T` + +• **value**: `InstanceType`\<`T`\> + +#### Returns + +`InstanceType`\<`T`\> + +#### Inherited from + +`CircuitValue.toCanonical` + +#### Source + +[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L177) *** @@ -1214,7 +1299,7 @@ static toConstant(this: T, t: InstanceType): InstanceType #### Source -[lib/provable/types/circuit-value.ts:177](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L177) +[lib/provable/types/circuit-value.ts:189](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L189) *** @@ -1244,7 +1329,7 @@ static toFields(this: T, v: InstanceType): Field[] #### Source -[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/circuit-value.ts#L42) +[lib/provable/types/circuit-value.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/circuit-value.ts#L42) *** @@ -1268,7 +1353,7 @@ static toInput(x: UInt64): HashInput #### Source -[lib/provable/int.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L114) +[lib/provable/int.ts:116](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L116) *** @@ -1294,7 +1379,7 @@ Encodes this structure into a JSON-like object. #### Source -[lib/provable/int.ts:121](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L121) +[lib/provable/int.ts:123](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L123) *** @@ -1318,4 +1403,4 @@ static toValue(x: UInt64): bigint #### Source -[lib/provable/int.ts:491](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L491) +[lib/provable/int.ts:517](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L517) diff --git a/docs/zkapps/o1js-reference/classes/UInt8.mdx b/docs/zkapps/o1js-reference/classes/UInt8.mdx index 187fdd590..f2efccb3b 100644 --- a/docs/zkapps/o1js-reference/classes/UInt8.mdx +++ b/docs/zkapps/o1js-reference/classes/UInt8.mdx @@ -35,7 +35,7 @@ The max value of a [UInt8](UInt8.mdx) is `2^8 - 1 = 255`. #### Source -[lib/provable/int.ts:1312](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1312) +[lib/provable/int.ts:1456](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1456) ## Properties @@ -53,7 +53,7 @@ value: Field = Field; #### Source -[lib/provable/int.ts:1302](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1302) +[lib/provable/int.ts:1446](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1446) *** @@ -65,7 +65,7 @@ static NUM_BITS: number = 8; #### Source -[lib/provable/int.ts:1304](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1304) +[lib/provable/int.ts:1448](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1448) *** @@ -94,7 +94,7 @@ Only use this if you know what you are doing, otherwise use the safe [UInt8.from #### Source -[lib/provable/int.ts:1318](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1318) +[lib/provable/int.ts:1462](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1462) *** @@ -112,7 +112,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -146,7 +146,7 @@ value: Field = Field; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -184,7 +184,7 @@ value: Field = Field; #### Source -[lib/provable/types/provable-intf.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L87) +[lib/provable/types/provable-intf.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L115) *** @@ -226,7 +226,7 @@ value: Field = Field; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -256,7 +256,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -292,7 +292,64 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "value": Field; + }) => { + "value": Field; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.value**: [`Field`](Field.mdx)= `Field` + +#### Returns + +```ts +{ + "value": Field; +} +``` + +##### value + +```ts +value: Field = Field; +``` + +#### Inherited from + +`Struct({ + value: Field, +}).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -327,7 +384,7 @@ the element of type `T` to generate the [Field](Field.mdx) array from. #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -369,7 +426,7 @@ value: string = Field; #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -413,7 +470,43 @@ value: bigint = Field; #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) + +## Accessors + +### one + +```ts +get static one(): UInt8 +``` + +Static method to create a [UInt8](UInt8.mdx) with value `1`. + +#### Returns + +[`UInt8`](UInt8.mdx) + +#### Source + +[lib/provable/int.ts:1483](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1483) + +*** + +### zero + +```ts +get static zero(): UInt8 +``` + +Static method to create a [UInt8](UInt8.mdx) with value `0`. + +#### Returns + +[`UInt8`](UInt8.mdx) + +#### Source + +[lib/provable/int.ts:1477](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1477) ## Methods @@ -447,7 +540,7 @@ if the result is greater than 255. #### Source -[lib/provable/int.ts:1342](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1342) +[lib/provable/int.ts:1499](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1499) *** @@ -475,7 +568,7 @@ the [UInt8](UInt8.mdx) value to compare & assert with this [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1608](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1608) +[lib/provable/int.ts:1765](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1765) *** @@ -503,7 +596,7 @@ the [UInt8](UInt8.mdx) value to compare & assert with this [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1584](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1584) +[lib/provable/int.ts:1741](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1741) *** @@ -531,7 +624,7 @@ the [UInt8](UInt8.mdx) value to compare & assert with this [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1596](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1596) +[lib/provable/int.ts:1753](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1753) *** @@ -559,7 +652,7 @@ the [UInt8](UInt8.mdx) value to compare & assert with this [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1502](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1502) +[lib/provable/int.ts:1659](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1659) *** @@ -587,7 +680,7 @@ the [UInt8](UInt8.mdx) value to compare & assert with this [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1527](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1527) +[lib/provable/int.ts:1684](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1684) *** @@ -618,7 +711,7 @@ quotient.assertEquals(3); #### Source -[lib/provable/int.ts:1395](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1395) +[lib/provable/int.ts:1552](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1552) *** @@ -666,7 +759,7 @@ remainder: UInt8; #### Source -[lib/provable/int.ts:1422](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1422) +[lib/provable/int.ts:1579](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1579) *** @@ -696,7 +789,7 @@ UInt8.from(5).greaterThan(3); #### Source -[lib/provable/int.ts:1558](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1558) +[lib/provable/int.ts:1715](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1715) *** @@ -726,7 +819,7 @@ UInt8.from(3).greaterThanOrEqual(3); #### Source -[lib/provable/int.ts:1572](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1572) +[lib/provable/int.ts:1729](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1729) *** @@ -755,7 +848,7 @@ UInt8.from(2).lessThan(UInt8.from(3)); #### Source -[lib/provable/int.ts:1481](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1481) +[lib/provable/int.ts:1638](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1638) *** @@ -784,7 +877,7 @@ UInt8.from(3).lessThanOrEqual(UInt8.from(5)); #### Source -[lib/provable/int.ts:1459](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1459) +[lib/provable/int.ts:1616](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1616) *** @@ -814,7 +907,7 @@ mod.assertEquals(20); #### Source -[lib/provable/int.ts:1409](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1409) +[lib/provable/int.ts:1566](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1566) *** @@ -848,7 +941,7 @@ if the result is greater than 255. #### Source -[lib/provable/int.ts:1378](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1378) +[lib/provable/int.ts:1535](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1535) *** @@ -882,7 +975,7 @@ if the result is less than 0. #### Source -[lib/provable/int.ts:1360](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1360) +[lib/provable/int.ts:1517](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1517) *** @@ -902,7 +995,7 @@ Serialize the [UInt8](UInt8.mdx) to a bigint. #### Source -[lib/provable/int.ts:1636](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1636) +[lib/provable/int.ts:1793](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1793) *** @@ -922,7 +1015,7 @@ Serialize the [UInt8](UInt8.mdx) to a number. #### Source -[lib/provable/int.ts:1627](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1627) +[lib/provable/int.ts:1784](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1784) *** @@ -942,7 +1035,7 @@ Serialize the [UInt8](UInt8.mdx) to a string, e.g. for printing. #### Source -[lib/provable/int.ts:1618](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1618) +[lib/provable/int.ts:1775](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1775) *** @@ -960,7 +1053,7 @@ Turns a [UInt8](UInt8.mdx) into a [UInt32](UInt32.mdx). #### Source -[lib/provable/int.ts:1656](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1656) +[lib/provable/int.ts:1813](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1813) *** @@ -978,7 +1071,7 @@ Turns a [UInt8](UInt8.mdx) into a [UInt64](UInt64.mdx). #### Source -[lib/provable/int.ts:1663](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1663) +[lib/provable/int.ts:1820](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1820) *** @@ -996,7 +1089,7 @@ Creates a [UInt8](UInt8.mdx) with a value of 255. #### Source -[lib/provable/int.ts:1670](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1670) +[lib/provable/int.ts:1827](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1827) *** @@ -1029,7 +1122,7 @@ Proves that the input is in the [0, 255] range. #### Source -[lib/provable/int.ts:1644](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1644) +[lib/provable/int.ts:1801](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1801) *** @@ -1063,7 +1156,7 @@ Creates a new [UInt8](UInt8.mdx). #### Source -[lib/provable/int.ts:1677](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1677) +[lib/provable/int.ts:1834](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1834) *** @@ -1089,7 +1182,7 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) *** @@ -1119,4 +1212,4 @@ static toInput(x: { #### Source -[lib/provable/int.ts:1649](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/int.ts#L1649) +[lib/provable/int.ts:1806](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/int.ts#L1806) diff --git a/docs/zkapps/o1js-reference/classes/Unconstrained.mdx b/docs/zkapps/o1js-reference/classes/Unconstrained.mdx index 93e0130a0..9bbb92684 100644 --- a/docs/zkapps/o1js-reference/classes/Unconstrained.mdx +++ b/docs/zkapps/o1js-reference/classes/Unconstrained.mdx @@ -36,7 +36,7 @@ class MyContract extends SmartContract { ### provable ```ts -static provable: Provable, Unconstrained> & { +static provable: UnconstrainedProvable & { "empty": () => Unconstrained; "toInput": (x: Unconstrained) => { "fields": Field[]; @@ -93,7 +93,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/unconstrained.ts:114](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L114) +[lib/provable/types/unconstrained.ts:111](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L111) ## Methods @@ -113,7 +113,7 @@ Note: Can only be called outside provable code. #### Source -[lib/provable/types/unconstrained.ts:53](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L53) +[lib/provable/types/unconstrained.ts:53](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L53) *** @@ -135,7 +135,7 @@ Modify the unconstrained value. #### Source -[lib/provable/types/unconstrained.ts:67](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L67) +[lib/provable/types/unconstrained.ts:67](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L67) *** @@ -157,7 +157,7 @@ Set the unconstrained value to the same as another `Unconstrained`. #### Source -[lib/provable/types/unconstrained.ts:74](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L74) +[lib/provable/types/unconstrained.ts:74](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L74) *** @@ -179,7 +179,7 @@ Update an `Unconstrained` by a witness computation. #### Source -[lib/provable/types/unconstrained.ts:107](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L107) +[lib/provable/types/unconstrained.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L104) *** @@ -213,14 +213,14 @@ let xWrapped = Unconstrained.witness(() => Provable.toConstant(type, x)); #### Source -[lib/provable/types/unconstrained.ts:89](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L89) +[lib/provable/types/unconstrained.ts:89](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L89) *** -### provableWithEmpty() +### withEmpty() ```ts -static provableWithEmpty(empty: T): Provable, Unconstrained> & { +static withEmpty(empty: T): Provable, T> & { "empty": () => Unconstrained; "toInput": (x: Unconstrained) => { "fields": Field[]; @@ -239,7 +239,7 @@ static provableWithEmpty(empty: T): Provable, Unconstrained< #### Returns -`Provable`\<[`Unconstrained`](Unconstrained.mdx)\<`T`\>, [`Unconstrained`](Unconstrained.mdx)\<`T`\>\> & \{ +`Provable`\<[`Unconstrained`](Unconstrained.mdx)\<`T`\>, `T`\> & \{ `"empty"`: () => [`Unconstrained`](Unconstrained.mdx)\<`T`\>; `"toInput"`: (`x`: [`Unconstrained`](Unconstrained.mdx)\<`T`\>) => \{ `"fields"`: [`Field`](Field.mdx)[]; @@ -249,7 +249,7 @@ static provableWithEmpty(empty: T): Provable, Unconstrained< #### Source -[lib/provable/types/unconstrained.ts:134](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L134) +[lib/provable/types/unconstrained.ts:131](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L131) *** @@ -275,4 +275,4 @@ Create an `Unconstrained` from a witness computation. #### Source -[lib/provable/types/unconstrained.ts:97](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/unconstrained.ts#L97) +[lib/provable/types/unconstrained.ts:97](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/unconstrained.ts#L97) diff --git a/docs/zkapps/o1js-reference/classes/VerificationKey.mdx b/docs/zkapps/o1js-reference/classes/VerificationKey.mdx index c3eb023c5..639ba2c49 100644 --- a/docs/zkapps/o1js-reference/classes/VerificationKey.mdx +++ b/docs/zkapps/o1js-reference/classes/VerificationKey.mdx @@ -39,7 +39,7 @@ new VerificationKey(value: { #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) ## Properties @@ -60,7 +60,7 @@ data: string = String; #### Source -[lib/proof-system/zkprogram.ts:783](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L783) +[lib/proof-system/zkprogram.ts:545](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L545) *** @@ -81,7 +81,7 @@ hash: Field = Field; #### Source -[lib/proof-system/zkprogram.ts:783](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L783) +[lib/proof-system/zkprogram.ts:545](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L545) *** @@ -102,7 +102,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -145,7 +145,7 @@ the element of type `T` to put assertions on. #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -190,7 +190,7 @@ hash: Field = Field; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -249,7 +249,7 @@ hash: Field = Field; #### Source -[lib/provable/types/provable-intf.ts:49](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L49) +[lib/provable/types/provable-intf.ts:59](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L59) *** @@ -298,7 +298,7 @@ hash: Field = Field; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -339,7 +339,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -381,7 +381,78 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "data": String; + "hash": Field; + }) => { + "data": String; + "hash": Field; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.data**: `string`= `String` + +• **x.hash**: [`Field`](Field.mdx)= `Field` + +#### Returns + +```ts +{ + "data": String; + "hash": Field; +} +``` + +##### data + +```ts +data: string = String; +``` + +##### hash + +```ts +hash: Field = Field; +``` + +#### Inherited from + +`Struct({ + ...provable({ data: String, hash: Field }), + toJSON({ data }: { data: string }) { + return data; + }, +}).toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -422,7 +493,7 @@ the element of type `T` to generate the [Field](Field.mdx) array from. #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -478,7 +549,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L152) *** @@ -514,7 +585,7 @@ static toJSON: (x: { #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -572,10 +643,26 @@ hash: bigint = Field; #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods +### dummy() + +```ts +static dummy(): Promise +``` + +#### Returns + +`Promise`\<[`VerificationKey`](VerificationKey.mdx)\> + +#### Source + +[lib/proof-system/zkprogram.ts:550](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L550) + +*** + ### sizeInFields() ```ts @@ -601,4 +688,4 @@ A `number` representing the size of the `T` type in terms of [Field](Field.mdx) #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/functions/Bytes.mdx b/docs/zkapps/o1js-reference/functions/Bytes.mdx index 85df8eff2..b4ae1972d 100644 --- a/docs/zkapps/o1js-reference/functions/Bytes.mdx +++ b/docs/zkapps/o1js-reference/functions/Bytes.mdx @@ -20,4 +20,4 @@ let bytes = Bytes32.fromHex('deadbeef'); ## Source -[lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped-classes.ts#L16) +[lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped-classes.ts#L16) diff --git a/docs/zkapps/o1js-reference/functions/ConstantField.mdx b/docs/zkapps/o1js-reference/functions/ConstantField.mdx index 5471d01f3..26915c1d8 100644 --- a/docs/zkapps/o1js-reference/functions/ConstantField.mdx +++ b/docs/zkapps/o1js-reference/functions/ConstantField.mdx @@ -12,4 +12,4 @@ function ConstantField(x: bigint | ConstantFieldVar): ConstantField ## Source -[lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1246) +[lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1246) diff --git a/docs/zkapps/o1js-reference/functions/MerkleListBase.mdx b/docs/zkapps/o1js-reference/functions/MerkleListBase.mdx index 37f30072b..b46b0ac93 100644 --- a/docs/zkapps/o1js-reference/functions/MerkleListBase.mdx +++ b/docs/zkapps/o1js-reference/functions/MerkleListBase.mdx @@ -12,4 +12,4 @@ function MerkleListBase(): ProvableHashable> ## Source -[lib/provable/merkle-list.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L45) +[lib/provable/merkle-list.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L46) diff --git a/docs/zkapps/o1js-reference/functions/MerkleWitness.mdx b/docs/zkapps/o1js-reference/functions/MerkleWitness.mdx index bea9ab1c5..8878ac299 100644 --- a/docs/zkapps/o1js-reference/functions/MerkleWitness.mdx +++ b/docs/zkapps/o1js-reference/functions/MerkleWitness.mdx @@ -18,4 +18,4 @@ A circuit-compatible Merkle Witness. ## Source -[lib/provable/merkle-tree.ts:240](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L240) +[lib/provable/merkle-tree.ts:240](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L240) diff --git a/docs/zkapps/o1js-reference/functions/Option.mdx b/docs/zkapps/o1js-reference/functions/Option.mdx index e88a24f2f..7c212fe00 100644 --- a/docs/zkapps/o1js-reference/functions/Option.mdx +++ b/docs/zkapps/o1js-reference/functions/Option.mdx @@ -1,5 +1,5 @@ ```ts -function Option(type: A): Provable, InferValue>, InferValue | undefined> & (option: { +function Option(type: A): ProvableInferPureFrom, InferValue>, InferValue | undefined> & (option: { "isSome": Bool; "value": InferProvable; }) => Option, InferValue> & { @@ -13,7 +13,7 @@ Define an optional version of a provable type. ## Type parameters -• **A** *extends* `Provable`\<`any`, `any`\> +• **A** *extends* [`ProvableType`](../type-aliases/ProvableType.mdx) ## Parameters @@ -21,7 +21,7 @@ Define an optional version of a provable type. ## Returns -`Provable`\<[`Option`](../type-aliases/Option.mdx)\<[`InferProvable`](../type-aliases/InferProvable.mdx)\<`A`\>, `InferValue`\<`A`\>\>, `InferValue`\<`A`\> \| `undefined`\> & (`option`: \{ +`ProvableInferPureFrom`\<`A`, [`Option`](../type-aliases/Option.mdx)\<[`InferProvable`](../type-aliases/InferProvable.mdx)\<`A`\>, `InferValue`\<`A`\>\>, `InferValue`\<`A`\> \| `undefined`\> & (`option`: \{ `"isSome"`: [`Bool`](../type-aliases/Bool.mdx); `"value"`: [`InferProvable`](../type-aliases/InferProvable.mdx)\<`A`\>; \}) => [`Option`](../type-aliases/Option.mdx)\<[`InferProvable`](../type-aliases/InferProvable.mdx)\<`A`\>, `InferValue`\<`A`\>\> & \{ @@ -46,4 +46,4 @@ let zero: UInt64 = none.orElse(0n); // specify a default value ## Source -[lib/provable/option.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/option.ts#L37) +[lib/provable/option.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/option.ts#L37) diff --git a/docs/zkapps/o1js-reference/functions/Reducer.mdx b/docs/zkapps/o1js-reference/functions/Reducer.mdx index c744c3844..c53011e63 100644 --- a/docs/zkapps/o1js-reference/functions/Reducer.mdx +++ b/docs/zkapps/o1js-reference/functions/Reducer.mdx @@ -22,4 +22,4 @@ function Reducer(reducer: { ## Source -[lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/actions/reducer.ts#L17) +[lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/reducer.ts#L17) diff --git a/docs/zkapps/o1js-reference/functions/State.mdx b/docs/zkapps/o1js-reference/functions/State.mdx index 4806976c4..da1b7c14f 100644 --- a/docs/zkapps/o1js-reference/functions/State.mdx +++ b/docs/zkapps/o1js-reference/functions/State.mdx @@ -16,4 +16,4 @@ function State(defaultValue?: A): State ## Source -[lib/mina/state.ts:78](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/state.ts#L78) +[lib/mina/state.ts:91](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/state.ts#L91) diff --git a/docs/zkapps/o1js-reference/functions/Struct.mdx b/docs/zkapps/o1js-reference/functions/Struct.mdx index 4a3f6bde2..c5f00af43 100644 --- a/docs/zkapps/o1js-reference/functions/Struct.mdx +++ b/docs/zkapps/o1js-reference/functions/Struct.mdx @@ -113,6 +113,10 @@ Object specifying the layout of the `Struct` Class which you can extend +## Note + +Ensure you do not use or extend `Struct` as a type directly. Instead, always call it as a function to construct a type. `Struct` is not a valid provable type itself, types created with `Struct(...)` are. + ## Source -[lib/provable/types/struct.ts:136](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L136) +[lib/provable/types/struct.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L140) diff --git a/docs/zkapps/o1js-reference/functions/VarField.mdx b/docs/zkapps/o1js-reference/functions/VarField.mdx index 6a409acde..81f6bc9a7 100644 --- a/docs/zkapps/o1js-reference/functions/VarField.mdx +++ b/docs/zkapps/o1js-reference/functions/VarField.mdx @@ -12,4 +12,4 @@ function VarField(x: VarFieldVar): VarField ## Source -[lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1242) +[lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1242) diff --git a/docs/zkapps/o1js-reference/functions/WithHash.mdx b/docs/zkapps/o1js-reference/functions/WithHash.mdx index 9c18fd70f..1432ea4eb 100644 --- a/docs/zkapps/o1js-reference/functions/WithHash.mdx +++ b/docs/zkapps/o1js-reference/functions/WithHash.mdx @@ -16,4 +16,4 @@ function WithHash(type: ProvableHashable): ProvableHashable> ## Source -[lib/provable/merkle-list.ts:27](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L27) +[lib/provable/merkle-list.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L28) diff --git a/docs/zkapps/o1js-reference/functions/ZkProgram.mdx b/docs/zkapps/o1js-reference/functions/ZkProgram.mdx index e831a0748..00abdc780 100644 --- a/docs/zkapps/o1js-reference/functions/ZkProgram.mdx +++ b/docs/zkapps/o1js-reference/functions/ZkProgram.mdx @@ -1,13 +1,15 @@ ```ts -function ZkProgram(config: StatementType & { - "methods": { [I in string | number | symbol]: Method>, InferProvableOrVoid>, Types[I]> }; +function ZkProgram(config: Config & { + "methods": { [I in string | number | symbol]: Methods[I] }; "name": string; "overrideWrapDomain": 0 | 2 | 1; }): { - "analyzeMethods": () => Promise<{ [I in keyof Types]: UnwrapPromise> }>; + "analyzeMethods": () => Promise<{ [I in keyof Config["methods"]]: UnwrapPromise> }>; + "auxiliaryOutputTypes": AuxiliaryOutputs; "compile": (options?: { "cache": Cache; "forceRecompile": boolean; + "proofsEnabled": boolean; }) => Promise<{ "verificationKey": { "data": string; @@ -16,27 +18,36 @@ function ZkProgram(config: StatementType & { }>; "digest": () => Promise; "name": string; - "privateInputTypes": { [I in keyof Types]: Method>, InferProvableOrVoid>, Types[I]>["privateInputs"] }; - "publicInputType": ProvableOrUndefined>; - "publicOutputType": ProvableOrVoid>; - "rawMethods": { [I in keyof Types]: Method>, InferProvableOrVoid>, Types[I]>["method"] }; - "verify": (proof: Proof>, InferProvableOrVoid>>) => Promise; - } & { [I in keyof Types]: Prover>, InferProvableOrVoid>, Types[I]> } + "privateInputTypes": PrivateInputs; + "proofsEnabled": boolean; + "publicInputType": ProvableOrUndefined>; + "publicOutputType": ProvableOrVoid>; + "rawMethods": { [I in keyof Config["methods"]]: Methods[I]["method"] }; + "verify": (proof: Proof>, InferProvableOrVoid>>) => Promise; + "setProofsEnabled": void; + } & { [I in keyof Config["methods"]]: Prover>, InferProvableOrVoid>, PrivateInputs[I], InferProvableOrUndefined> } ``` ## Type parameters -• **StatementType** *extends* \{ - `"publicInput"`: [`FlexibleProvablePure`](../type-aliases/FlexibleProvablePure.mdx)\<`any`\>; - `"publicOutput"`: [`FlexibleProvablePure`](../type-aliases/FlexibleProvablePure.mdx)\<`any`\>; +• **Config** *extends* \{ + `"methods"`: \{\}; + `"publicInput"`: [`ProvableTypePure`](../type-aliases/ProvableTypePure.mdx); + `"publicOutput"`: [`ProvableTypePure`](../type-aliases/ProvableTypePure.mdx); \} -• **Types** *extends* \{\} +• **Methods** *extends* \{ [I in string \| number \| symbol]: Method\\>, InferProvableOrVoid\\>, Config["methods"][I]\> \} + +• **MethodSignatures** *extends* \{\} = `Config`\[`"methods"`\] + +• **PrivateInputs** *extends* \{ [I in string \| number \| symbol]: MethodSignatures[I]["privateInputs"] \} = \{ [I in string \| number \| symbol]: MethodSignatures[I]["privateInputs"] \} + +• **AuxiliaryOutputs** *extends* \{ [I in string \| number \| symbol]: Get\ \} = \{ [I in string \| number \| symbol]: Get\ \} ## Parameters -• **config**: `StatementType` & \{ - `"methods"`: \{ [I in string \| number \| symbol]: Method\\>, InferProvableOrVoid\\>, Types[I]\> \}; +• **config**: `Config` & \{ + `"methods"`: \{ [I in string \| number \| symbol]: Methods[I] \}; `"name"`: `string`; `"overrideWrapDomain"`: `0` \| `2` \| `1`; \} @@ -44,10 +55,12 @@ function ZkProgram(config: StatementType & { ## Returns \{ - `"analyzeMethods"`: () => `Promise`\<`{ [I in keyof Types]: UnwrapPromise> }`\>; + `"analyzeMethods"`: () => `Promise`\<`{ [I in keyof Config["methods"]]: UnwrapPromise> }`\>; + `"auxiliaryOutputTypes"`: `AuxiliaryOutputs`; `"compile"`: (`options`?: \{ `"cache"`: [`Cache`](../type-aliases/Cache.mdx); `"forceRecompile"`: `boolean`; + `"proofsEnabled"`: `boolean`; \}) => `Promise`\<\{ `"verificationKey"`: \{ `"data"`: `string`; @@ -56,13 +69,15 @@ function ZkProgram(config: StatementType & { \}\>; `"digest"`: () => `Promise`\<`string`\>; `"name"`: `string`; - `"privateInputTypes"`: `{ [I in keyof Types]: Method>, InferProvableOrVoid>, Types[I]>["privateInputs"] }`; - `"publicInputType"`: `ProvableOrUndefined`\<`Get`\<`StatementType`, `"publicInput"`\>\>; - `"publicOutputType"`: `ProvableOrVoid`\<`Get`\<`StatementType`, `"publicOutput"`\>\>; - `"rawMethods"`: `{ [I in keyof Types]: Method>, InferProvableOrVoid>, Types[I]>["method"] }`; - `"verify"`: (`proof`: [`Proof`](../classes/Proof.mdx)\<`InferProvableOrUndefined`\<`Get`\<`StatementType`, `"publicInput"`\>\>, `InferProvableOrVoid`\<`Get`\<`StatementType`, `"publicOutput"`\>\>\>) => `Promise`\<`boolean`\>; - \} & `{ [I in keyof Types]: Prover>, InferProvableOrVoid>, Types[I]> }` + `"privateInputTypes"`: `PrivateInputs`; + `"proofsEnabled"`: `boolean`; + `"publicInputType"`: `ProvableOrUndefined`\<`Get`\<`Config`, `"publicInput"`\>\>; + `"publicOutputType"`: `ProvableOrVoid`\<`Get`\<`Config`, `"publicOutput"`\>\>; + `"rawMethods"`: `{ [I in keyof Config["methods"]]: Methods[I]["method"] }`; + `"verify"`: (`proof`: [`Proof`](../classes/Proof.mdx)\<`InferProvableOrUndefined`\<`Get`\<`Config`, `"publicInput"`\>\>, `InferProvableOrVoid`\<`Get`\<`Config`, `"publicOutput"`\>\>\>) => `Promise`\<`boolean`\>; + `"setProofsEnabled"`: `void`; + \} & `{ [I in keyof Config["methods"]]: Prover>, InferProvableOrVoid>, PrivateInputs[I], InferProvableOrUndefined> }` ## Source -[lib/proof-system/zkprogram.ts:531](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L531) +[lib/proof-system/zkprogram.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L174) diff --git a/docs/zkapps/o1js-reference/functions/addCachedAccount.mdx b/docs/zkapps/o1js-reference/functions/addCachedAccount.mdx index 464a9ee3a..2c2887789 100644 --- a/docs/zkapps/o1js-reference/functions/addCachedAccount.mdx +++ b/docs/zkapps/o1js-reference/functions/addCachedAccount.mdx @@ -16,4 +16,4 @@ Adds an account to the local cache, indexed by a GraphQL endpoint. ## Source -[lib/mina/fetch.ts:410](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L410) +[lib/mina/fetch.ts:418](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L418) diff --git a/docs/zkapps/o1js-reference/functions/assert.mdx b/docs/zkapps/o1js-reference/functions/assert.mdx index ca148746c..ee44feb60 100644 --- a/docs/zkapps/o1js-reference/functions/assert.mdx +++ b/docs/zkapps/o1js-reference/functions/assert.mdx @@ -17,4 +17,4 @@ Can be used in provable code. ## Source -[lib/provable/gadgets/common.ts:57](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/gadgets/common.ts#L57) +[lib/provable/gadgets/common.ts:57](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/gadgets/common.ts#L57) diff --git a/docs/zkapps/o1js-reference/functions/checkBitLength.mdx b/docs/zkapps/o1js-reference/functions/checkBitLength.mdx index 95c46d6ae..cb6ead918 100644 --- a/docs/zkapps/o1js-reference/functions/checkBitLength.mdx +++ b/docs/zkapps/o1js-reference/functions/checkBitLength.mdx @@ -19,4 +19,4 @@ function checkBitLength( ## Source -[lib/provable/field.ts:1180](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1180) +[lib/provable/field.ts:1180](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1180) diff --git a/docs/zkapps/o1js-reference/functions/checkZkappTransaction.mdx b/docs/zkapps/o1js-reference/functions/checkZkappTransaction.mdx index f68b3479c..0c9be63ba 100644 --- a/docs/zkapps/o1js-reference/functions/checkZkappTransaction.mdx +++ b/docs/zkapps/o1js-reference/functions/checkZkappTransaction.mdx @@ -26,4 +26,4 @@ function checkZkappTransaction(transactionHash: string, blockLength: number): Pr ## Source -[lib/mina/fetch.ts:509](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L509) +[lib/mina/fetch.ts:517](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L517) diff --git a/docs/zkapps/o1js-reference/functions/circuitMain.mdx b/docs/zkapps/o1js-reference/functions/circuitMain.mdx index b9da5abcb..66fdeae90 100644 --- a/docs/zkapps/o1js-reference/functions/circuitMain.mdx +++ b/docs/zkapps/o1js-reference/functions/circuitMain.mdx @@ -19,4 +19,4 @@ function circuitMain( ## Source -[lib/proof-system/circuit.ts:192](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L192) +[lib/proof-system/circuit.ts:192](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L192) diff --git a/docs/zkapps/o1js-reference/functions/conditionalSwap.mdx b/docs/zkapps/o1js-reference/functions/conditionalSwap.mdx index 3ff053b95..8428ea3c8 100644 --- a/docs/zkapps/o1js-reference/functions/conditionalSwap.mdx +++ b/docs/zkapps/o1js-reference/functions/conditionalSwap.mdx @@ -19,4 +19,4 @@ function conditionalSwap( ## Source -[lib/provable/merkle-tree.ts:251](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L251) +[lib/provable/merkle-tree.ts:251](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L251) diff --git a/docs/zkapps/o1js-reference/functions/createEcdsa.mdx b/docs/zkapps/o1js-reference/functions/createEcdsa.mdx index 46b849c8d..c102b5ee0 100644 --- a/docs/zkapps/o1js-reference/functions/createEcdsa.mdx +++ b/docs/zkapps/o1js-reference/functions/createEcdsa.mdx @@ -2,6 +2,8 @@ function createEcdsa(curve: CurveParams | typeof ForeignCurve): typeof EcdsaSignature ``` +Create a class [EcdsaSignature](../classes/EcdsaSignature.mdx) for verifying ECDSA signatures on the given curve. + ## Parameters • **curve**: `CurveParams` \| *typeof* [`ForeignCurve`](../classes/ForeignCurve.mdx) @@ -10,10 +12,6 @@ function createEcdsa(curve: CurveParams | typeof ForeignCurve): typeof EcdsaSign *typeof* [`EcdsaSignature`](../classes/EcdsaSignature.mdx) -## Deprecated - -`EcdsaSignature` is now deprecated and will be removed in a future release. Please use [EcdsaSignatureV2](../classes/EcdsaSignatureV2.mdx) instead. - ## Source -[lib/provable/crypto/foreign-ecdsa.ts:238](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L238) +[lib/provable/crypto/foreign-ecdsa.ts:246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L246) diff --git a/docs/zkapps/o1js-reference/functions/createEcdsaV2.mdx b/docs/zkapps/o1js-reference/functions/createEcdsaV2.mdx deleted file mode 100644 index 49ebea192..000000000 --- a/docs/zkapps/o1js-reference/functions/createEcdsaV2.mdx +++ /dev/null @@ -1,17 +0,0 @@ -```ts -function createEcdsaV2(curve: CurveParams | typeof ForeignCurveV2): typeof EcdsaSignatureV2 -``` - -Create a class [EcdsaSignatureV2](../classes/EcdsaSignatureV2.mdx) for verifying ECDSA signatures on the given curve. - -## Parameters - -• **curve**: `CurveParams` \| *typeof* [`ForeignCurveV2`](../classes/ForeignCurveV2.mdx) - -## Returns - -*typeof* [`EcdsaSignatureV2`](../classes/EcdsaSignatureV2.mdx) - -## Source - -[lib/provable/crypto/foreign-ecdsa.ts:259](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-ecdsa.ts#L259) diff --git a/docs/zkapps/o1js-reference/functions/createForeignCurve.mdx b/docs/zkapps/o1js-reference/functions/createForeignCurve.mdx index d67f7d88b..bf3ca8df2 100644 --- a/docs/zkapps/o1js-reference/functions/createForeignCurve.mdx +++ b/docs/zkapps/o1js-reference/functions/createForeignCurve.mdx @@ -2,6 +2,20 @@ function createForeignCurve(params: CurveParams): typeof ForeignCurve ``` +Create a class representing an elliptic curve group, which is different from the native [Group](../classes/Group.mdx). + +```ts +const Curve = createForeignCurve(Crypto.CurveParams.Secp256k1); +``` + +`createForeignCurve(params)` takes curve parameters CurveParams as input. +We support `modulus` and `order` to be prime numbers up to 259 bits. + +The returned ForeignCurveNotNeeded class represents a _non-zero curve point_ and supports standard +elliptic curve operations like point addition and scalar multiplication. + +ForeignCurveNotNeeded also includes to associated foreign fields: `ForeignCurve.Field` and `ForeignCurve.Scalar`, see [createForeignField](createForeignField.mdx). + ## Parameters • **params**: `CurveParams` @@ -10,10 +24,6 @@ function createForeignCurve(params: CurveParams): typeof ForeignCurve *typeof* [`ForeignCurve`](../classes/ForeignCurve.mdx) -## Deprecated - -`createForeignCurve` is now deprecated and will be removed in a future release. Please use [createForeignCurveV2](createForeignCurveV2.mdx) instead. - ## Source -[lib/provable/crypto/foreign-curve.ts:309](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L309) +[lib/provable/crypto/foreign-curve.ts:432](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-curve.ts#L432) diff --git a/docs/zkapps/o1js-reference/functions/createForeignCurveV2.mdx b/docs/zkapps/o1js-reference/functions/createForeignCurveV2.mdx deleted file mode 100644 index 1fbd368b6..000000000 --- a/docs/zkapps/o1js-reference/functions/createForeignCurveV2.mdx +++ /dev/null @@ -1,29 +0,0 @@ -```ts -function createForeignCurveV2(params: CurveParams): typeof ForeignCurveV2 -``` - -Create a class representing an elliptic curve group, which is different from the native [Group](../classes/Group.mdx). - -```ts -const Curve = createForeignCurve(Crypto.CurveParams.Secp256k1); -``` - -`createForeignCurve(params)` takes curve parameters CurveParams as input. -We support `modulus` and `order` to be prime numbers up to 259 bits. - -The returned [ForeignCurveV2](../classes/ForeignCurveV2.mdx) class represents a _non-zero curve point_ and supports standard -elliptic curve operations like point addition and scalar multiplication. - -[ForeignCurveV2](../classes/ForeignCurveV2.mdx) also includes to associated foreign fields: `ForeignCurve.Field` and `ForeignCurve.Scalar`, see createForeignFieldV2. - -## Parameters - -• **params**: `CurveParams` - -## Returns - -*typeof* [`ForeignCurveV2`](../classes/ForeignCurveV2.mdx) - -## Source - -[lib/provable/crypto/foreign-curve.ts:345](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/foreign-curve.ts#L345) diff --git a/docs/zkapps/o1js-reference/functions/createForeignField.mdx b/docs/zkapps/o1js-reference/functions/createForeignField.mdx index 53db3065c..b5604565e 100644 --- a/docs/zkapps/o1js-reference/functions/createForeignField.mdx +++ b/docs/zkapps/o1js-reference/functions/createForeignField.mdx @@ -29,9 +29,9 @@ only supports addition and subtraction. This function returns the `Unreduced` class, which will cause the minimum amount of range checks to be created by default. If you want to do multiplication, you have two options: -- create your field elements using the [ForeignField.AlmostReduced](../classes/ForeignField.mdx#almostreduced) constructor, or using the `.provable` type on that class. +- create your field elements using the [ForeignField.AlmostReduced](../classes/ForeignField.mdx#almostreduced) constructor. ```ts -let x = Provable.witness(ForeignField.AlmostReduced.provable, () => ForeignField.from(5)); +let x = Provable.witness(ForeignField.AlmostReduced, () => 5n); ``` - create your field elements normally and convert them using `x.assertAlmostReduced()`. ```ts @@ -39,7 +39,7 @@ let xChecked = x.assertAlmostReduced(); // asserts x < 2^ceil(log2(p)); returns ``` Similarly, there is a separate class [CanonicalForeignField](../classes/CanonicalForeignField.mdx) which represents fully reduced, "canonical" field elements. -To convert to a canonical field element, use [ForeignField.assertCanonical](../classes/ForeignField.mdx#assertcanonical): +To convert to a canonical field element, use `ForeignField.assertCanonical()`: ```ts x.assertCanonical(); // asserts x < p; returns `CanonicalForeignField` @@ -60,4 +60,4 @@ the modulus of the finite field you are instantiating ## Source -[lib/provable/foreign-field.ts:636](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/foreign-field.ts#L636) +[lib/provable/foreign-field.ts:642](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/foreign-field.ts#L642) diff --git a/docs/zkapps/o1js-reference/functions/declareMethods.mdx b/docs/zkapps/o1js-reference/functions/declareMethods.mdx index 45316d3e1..3efaf5957 100644 --- a/docs/zkapps/o1js-reference/functions/declareMethods.mdx +++ b/docs/zkapps/o1js-reference/functions/declareMethods.mdx @@ -33,4 +33,4 @@ Note that a method of the same name must still be defined on the class, just wit ## Source -[lib/mina/zkapp.ts:1230](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1230) +[lib/mina/zkapp.ts:1270](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1270) diff --git a/docs/zkapps/o1js-reference/functions/declareState.mdx b/docs/zkapps/o1js-reference/functions/declareState.mdx index 3b21f80af..f4e7f90b8 100644 --- a/docs/zkapps/o1js-reference/functions/declareState.mdx +++ b/docs/zkapps/o1js-reference/functions/declareState.mdx @@ -51,4 +51,4 @@ declareState(MyContract, { x: Field }); ## Source -[lib/mina/state.ts:168](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/state.ts#L168) +[lib/mina/state.ts:183](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/state.ts#L183) diff --git a/docs/zkapps/o1js-reference/functions/fetchAccount.mdx b/docs/zkapps/o1js-reference/functions/fetchAccount.mdx index 808ff5b38..487d38dd1 100644 --- a/docs/zkapps/o1js-reference/functions/fetchAccount.mdx +++ b/docs/zkapps/o1js-reference/functions/fetchAccount.mdx @@ -53,4 +53,4 @@ zkapp information on the specified account or an error is thrown ## Source -[lib/mina/fetch.ts:171](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L171) +[lib/mina/fetch.ts:179](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L179) diff --git a/docs/zkapps/o1js-reference/functions/fetchEvents.mdx b/docs/zkapps/o1js-reference/functions/fetchEvents.mdx index c76c3cf56..ac01f3b70 100644 --- a/docs/zkapps/o1js-reference/functions/fetchEvents.mdx +++ b/docs/zkapps/o1js-reference/functions/fetchEvents.mdx @@ -82,4 +82,4 @@ console.log(events); ## Source -[lib/mina/fetch.ts:640](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L640) +[lib/mina/fetch.ts:648](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L648) diff --git a/docs/zkapps/o1js-reference/functions/fetchLastBlock.mdx b/docs/zkapps/o1js-reference/functions/fetchLastBlock.mdx index 7c99e037d..abace3706 100644 --- a/docs/zkapps/o1js-reference/functions/fetchLastBlock.mdx +++ b/docs/zkapps/o1js-reference/functions/fetchLastBlock.mdx @@ -14,4 +14,4 @@ Fetches the last block on the Mina network. ## Source -[lib/mina/fetch.ts:453](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L453) +[lib/mina/fetch.ts:461](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L461) diff --git a/docs/zkapps/o1js-reference/functions/fetchTransactionStatus.mdx b/docs/zkapps/o1js-reference/functions/fetchTransactionStatus.mdx index d2c219344..d9d19b667 100644 --- a/docs/zkapps/o1js-reference/functions/fetchTransactionStatus.mdx +++ b/docs/zkapps/o1js-reference/functions/fetchTransactionStatus.mdx @@ -16,4 +16,4 @@ Fetches the status of a transaction. ## Source -[lib/mina/fetch.ts:590](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L590) +[lib/mina/fetch.ts:598](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L598) diff --git a/docs/zkapps/o1js-reference/functions/genericHash.mdx b/docs/zkapps/o1js-reference/functions/genericHash.mdx index 3c8fc0b3a..f92f0fb75 100644 --- a/docs/zkapps/o1js-reference/functions/genericHash.mdx +++ b/docs/zkapps/o1js-reference/functions/genericHash.mdx @@ -23,4 +23,4 @@ function genericHash( ## Source -[lib/provable/merkle-list.ts:699](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L699) +[lib/provable/merkle-list.ts:755](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L755) diff --git a/docs/zkapps/o1js-reference/functions/initializeBindings.mdx b/docs/zkapps/o1js-reference/functions/initializeBindings.mdx index 5afcf9ce8..a1b5e5a5b 100644 --- a/docs/zkapps/o1js-reference/functions/initializeBindings.mdx +++ b/docs/zkapps/o1js-reference/functions/initializeBindings.mdx @@ -10,4 +10,4 @@ A function that has to finish before any bindings exports can be used. ## Source -[snarky.d.ts:763](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/snarky.d.ts#L763) +[snarky.d.ts:763](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L763) diff --git a/docs/zkapps/o1js-reference/functions/merkleListHash.mdx b/docs/zkapps/o1js-reference/functions/merkleListHash.mdx index 5ee31b3c1..b9b738617 100644 --- a/docs/zkapps/o1js-reference/functions/merkleListHash.mdx +++ b/docs/zkapps/o1js-reference/functions/merkleListHash.mdx @@ -29,4 +29,4 @@ function merkleListHash(provable: ProvableHashable, prefix: string): (hash ## Source -[lib/provable/merkle-list.ts:709](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L709) +[lib/provable/merkle-list.ts:765](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L765) diff --git a/docs/zkapps/o1js-reference/functions/method.mdx b/docs/zkapps/o1js-reference/functions/method.mdx index e3fb161a1..17befba8a 100644 --- a/docs/zkapps/o1js-reference/functions/method.mdx +++ b/docs/zkapps/o1js-reference/functions/method.mdx @@ -45,4 +45,4 @@ async myMethod(someArg: Field): Promise { ## Source -[lib/mina/zkapp.ts:105](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L105) +[lib/mina/zkapp.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L105) diff --git a/docs/zkapps/o1js-reference/functions/provable.mdx b/docs/zkapps/o1js-reference/functions/provable.mdx index 1e83b0b00..7ce20a31b 100644 --- a/docs/zkapps/o1js-reference/functions/provable.mdx +++ b/docs/zkapps/o1js-reference/functions/provable.mdx @@ -12,10 +12,12 @@ function provable(typeObj: A, options?: {}): InferredProvable • **options?** +**Deprecated** + ## Returns `InferredProvable`\<`A`, [`Field`](../classes/Field.mdx)\> ## Source -[lib/provable/types/provable-derivers.ts:57](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-derivers.ts#L57) +[lib/provable/types/provable-derivers.ts:78](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L78) diff --git a/docs/zkapps/o1js-reference/functions/provablePure.mdx b/docs/zkapps/o1js-reference/functions/provablePure.mdx index 32db1c3e6..c120b3a07 100644 --- a/docs/zkapps/o1js-reference/functions/provablePure.mdx +++ b/docs/zkapps/o1js-reference/functions/provablePure.mdx @@ -16,4 +16,4 @@ function provablePure(typeObj: A): ProvablePureExtended, Inf ## Source -[lib/provable/types/provable-derivers.ts:59](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-derivers.ts#L59) +[lib/provable/types/provable-derivers.ts:80](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L80) diff --git a/docs/zkapps/o1js-reference/functions/public.mdx b/docs/zkapps/o1js-reference/functions/public.mdx index ef3a4b9f9..0b9572bef 100644 --- a/docs/zkapps/o1js-reference/functions/public.mdx +++ b/docs/zkapps/o1js-reference/functions/public.mdx @@ -19,4 +19,4 @@ function public_( ## Source -[lib/proof-system/circuit.ts:156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/circuit.ts#L156) +[lib/proof-system/circuit.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L156) diff --git a/docs/zkapps/o1js-reference/functions/readVarMessage.mdx b/docs/zkapps/o1js-reference/functions/readVarMessage.mdx index 071506a42..fbc26227b 100644 --- a/docs/zkapps/o1js-reference/functions/readVarMessage.mdx +++ b/docs/zkapps/o1js-reference/functions/readVarMessage.mdx @@ -19,4 +19,4 @@ function readVarMessage( ## Source -[lib/provable/field.ts:1222](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1222) +[lib/provable/field.ts:1222](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1222) diff --git a/docs/zkapps/o1js-reference/functions/sendZkapp.mdx b/docs/zkapps/o1js-reference/functions/sendZkapp.mdx index 6f5c226d2..55c65fb2e 100644 --- a/docs/zkapps/o1js-reference/functions/sendZkapp.mdx +++ b/docs/zkapps/o1js-reference/functions/sendZkapp.mdx @@ -25,4 +25,4 @@ Sends a zkApp command (transaction) to the specified GraphQL endpoint. ## Source -[lib/mina/fetch.ts:610](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L610) +[lib/mina/fetch.ts:618](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L618) diff --git a/docs/zkapps/o1js-reference/functions/setArchiveGraphqlEndpoint.mdx b/docs/zkapps/o1js-reference/functions/setArchiveGraphqlEndpoint.mdx index 67676874d..79118e9fd 100644 --- a/docs/zkapps/o1js-reference/functions/setArchiveGraphqlEndpoint.mdx +++ b/docs/zkapps/o1js-reference/functions/setArchiveGraphqlEndpoint.mdx @@ -14,4 +14,4 @@ Sets up a GraphQL endpoint to be used for fetching information from an Archive N ## Source -[lib/mina/fetch.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L126) +[lib/mina/fetch.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L134) diff --git a/docs/zkapps/o1js-reference/functions/setGraphqlEndpoint.mdx b/docs/zkapps/o1js-reference/functions/setGraphqlEndpoint.mdx index ee83c99db..0dce3d55a 100644 --- a/docs/zkapps/o1js-reference/functions/setGraphqlEndpoint.mdx +++ b/docs/zkapps/o1js-reference/functions/setGraphqlEndpoint.mdx @@ -12,4 +12,4 @@ function setGraphqlEndpoint(graphqlEndpoint: string): void ## Source -[lib/mina/fetch.ts:104](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L104) +[lib/mina/fetch.ts:112](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L112) diff --git a/docs/zkapps/o1js-reference/functions/setGraphqlEndpoints.mdx b/docs/zkapps/o1js-reference/functions/setGraphqlEndpoints.mdx index a55568c17..2c5fdc112 100644 --- a/docs/zkapps/o1js-reference/functions/setGraphqlEndpoints.mdx +++ b/docs/zkapps/o1js-reference/functions/setGraphqlEndpoints.mdx @@ -12,4 +12,4 @@ function setGraphqlEndpoints(__namedParameters: string[]): void ## Source -[lib/mina/fetch.ts:97](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L97) +[lib/mina/fetch.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L105) diff --git a/docs/zkapps/o1js-reference/functions/setNumberOfWorkers.mdx b/docs/zkapps/o1js-reference/functions/setNumberOfWorkers.mdx index a8770da32..b5c29bc84 100644 --- a/docs/zkapps/o1js-reference/functions/setNumberOfWorkers.mdx +++ b/docs/zkapps/o1js-reference/functions/setNumberOfWorkers.mdx @@ -20,4 +20,4 @@ setNumberOfWorkers(2); // set the number of workers to 2 ## Source -[lib/proof-system/workers.ts:15](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/workers.ts#L15) +[lib/proof-system/workers.ts:15](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/workers.ts#L15) diff --git a/docs/zkapps/o1js-reference/functions/state-1.mdx b/docs/zkapps/o1js-reference/functions/state-1.mdx index cfd85d94b..af422ba20 100644 --- a/docs/zkapps/o1js-reference/functions/state-1.mdx +++ b/docs/zkapps/o1js-reference/functions/state-1.mdx @@ -1,5 +1,5 @@ ```ts -function state(stateType: FlexibleProvablePure): (target: SmartContract & { +function state(type: ProvableTypePure | FlexibleProvablePure): (target: SmartContract & { "constructor": any; }, key: string, _descriptor?: PropertyDescriptor) => void ``` @@ -18,7 +18,7 @@ you can use the following in the declaration of your zkapp: ## Parameters -• **stateType**: [`FlexibleProvablePure`](../type-aliases/FlexibleProvablePure.mdx)\<`A`\> +• **type**: [`ProvableTypePure`](../type-aliases/ProvableTypePure.mdx)\<`A`\> \| [`FlexibleProvablePure`](../type-aliases/FlexibleProvablePure.mdx)\<`A`\> ## Returns @@ -41,4 +41,4 @@ you can use the following in the declaration of your zkapp: ## Source -[lib/mina/state.ts:92](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/state.ts#L92) +[lib/mina/state.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/state.ts#L105) diff --git a/docs/zkapps/o1js-reference/functions/toConstantField.mdx b/docs/zkapps/o1js-reference/functions/toConstantField.mdx index 1e7eae749..e131292fd 100644 --- a/docs/zkapps/o1js-reference/functions/toConstantField.mdx +++ b/docs/zkapps/o1js-reference/functions/toConstantField.mdx @@ -22,4 +22,4 @@ function toConstantField( ## Source -[lib/provable/field.ts:1197](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1197) +[lib/provable/field.ts:1197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1197) diff --git a/docs/zkapps/o1js-reference/functions/toFp.mdx b/docs/zkapps/o1js-reference/functions/toFp.mdx index a6210af0e..7df5cea2c 100644 --- a/docs/zkapps/o1js-reference/functions/toFp.mdx +++ b/docs/zkapps/o1js-reference/functions/toFp.mdx @@ -12,4 +12,4 @@ function toFp(x: string | number | bigint | Field): bigint ## Source -[lib/provable/field.ts:1156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1156) +[lib/provable/field.ts:1156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1156) diff --git a/docs/zkapps/o1js-reference/functions/verify.mdx b/docs/zkapps/o1js-reference/functions/verify.mdx index 6306995bd..42760cab8 100644 --- a/docs/zkapps/o1js-reference/functions/verify.mdx +++ b/docs/zkapps/o1js-reference/functions/verify.mdx @@ -14,4 +14,4 @@ function verify(proof: ProofBase | JsonProof, verificationKey: string ## Source -[lib/proof-system/zkprogram.ts:466](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L466) +[lib/proof-system/zkprogram.ts:109](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L109) diff --git a/docs/zkapps/o1js-reference/functions/withHashes.mdx b/docs/zkapps/o1js-reference/functions/withHashes.mdx index 66a00674c..edce0a79e 100644 --- a/docs/zkapps/o1js-reference/functions/withHashes.mdx +++ b/docs/zkapps/o1js-reference/functions/withHashes.mdx @@ -43,4 +43,4 @@ hash: Field; ## Source -[lib/provable/merkle-list.ts:717](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L717) +[lib/provable/merkle-list.ts:773](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L773) diff --git a/docs/zkapps/o1js-reference/functions/withMessage.mdx b/docs/zkapps/o1js-reference/functions/withMessage.mdx index d90c5ca86..67836806c 100644 --- a/docs/zkapps/o1js-reference/functions/withMessage.mdx +++ b/docs/zkapps/o1js-reference/functions/withMessage.mdx @@ -14,4 +14,4 @@ function withMessage(error: unknown, message?: string): unknown ## Source -[lib/provable/field.ts:1174](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1174) +[lib/provable/field.ts:1174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1174) diff --git a/docs/zkapps/o1js-reference/interfaces/Permissions.mdx b/docs/zkapps/o1js-reference/interfaces/Permissions.mdx index 393653ac7..61a9523fb 100644 --- a/docs/zkapps/o1js-reference/interfaces/Permissions.mdx +++ b/docs/zkapps/o1js-reference/interfaces/Permissions.mdx @@ -26,7 +26,7 @@ unauthorized token interactions -- for example, it could be #### Source -[lib/mina/account-update.ts:373](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L373) +[lib/mina/account-update.ts:397](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L397) *** @@ -44,7 +44,7 @@ The Permission corresponding to the ability to emit actions to the account. #### Source -[lib/mina/account-update.ts:352](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L352) +[lib/mina/account-update.ts:376](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L376) *** @@ -63,7 +63,7 @@ an account. #### Source -[lib/mina/account-update.ts:308](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L308) +[lib/mina/account-update.ts:332](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L332) *** @@ -79,7 +79,7 @@ incrementNonce: AuthRequired; #### Source -[lib/mina/account-update.ts:361](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L361) +[lib/mina/account-update.ts:385](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L385) *** @@ -98,7 +98,7 @@ to this account. #### Source -[lib/mina/account-update.ts:320](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L320) +[lib/mina/account-update.ts:344](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L344) *** @@ -117,7 +117,7 @@ from this account. #### Source -[lib/mina/account-update.ts:314](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L314) +[lib/mina/account-update.ts:338](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L338) *** @@ -136,7 +136,7 @@ field of the account. #### Source -[lib/mina/account-update.ts:326](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L326) +[lib/mina/account-update.ts:350](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L350) *** @@ -155,7 +155,7 @@ field of the account. #### Source -[lib/mina/account-update.ts:332](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L332) +[lib/mina/account-update.ts:356](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L356) *** @@ -171,7 +171,7 @@ setTiming: AuthRequired; #### Source -[lib/mina/account-update.ts:363](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L363) +[lib/mina/account-update.ts:387](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L387) *** @@ -190,7 +190,7 @@ for this account. #### Source -[lib/mina/account-update.ts:358](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L358) +[lib/mina/account-update.ts:382](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L382) *** @@ -210,7 +210,7 @@ key associated with the circuit tied to this account. Effectively #### Source -[lib/mina/account-update.ts:339](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L339) +[lib/mina/account-update.ts:363](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L363) *** @@ -226,7 +226,7 @@ setVotingFor: AuthRequired; #### Source -[lib/mina/account-update.ts:362](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L362) +[lib/mina/account-update.ts:386](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L386) *** @@ -247,4 +247,4 @@ changed. Effectively "upgradeability" of the smart contract. #### Source -[lib/mina/account-update.ts:347](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L347) +[lib/mina/account-update.ts:371](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L371) diff --git a/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/Curve.mdx b/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/Curve.mdx index 94f858b92..22638b09e 100644 --- a/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/Curve.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/Curve.mdx @@ -4,4 +4,4 @@ type Curve: CurveAffine; ## Source -[lib/provable/crypto/crypto.ts:29](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/crypto.ts#L29) +[lib/provable/crypto/crypto.ts:29](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L29) diff --git a/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/CurveParams.mdx b/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/CurveParams.mdx index 7111ce7f1..748471769 100644 --- a/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/CurveParams.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/CurveParams.mdx @@ -7,4 +7,4 @@ y^2 = x^3 + ax + b ## Source -[lib/provable/crypto/crypto.ts:27](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/crypto.ts#L27) +[lib/provable/crypto/crypto.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L27) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/README.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/README.mdx index 28c5e9f47..0897f86e4 100644 --- a/docs/zkapps/o1js-reference/namespaces/Encryption/README.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/README.mdx @@ -2,5 +2,9 @@ | Member | Description | | :------ | :------ | -| [decrypt](functions/decrypt.mdx) | Decrypts a CipherText using a [PrivateKey](../../classes/PrivateKey.mdx).^ | -| [encrypt](functions/encrypt.mdx) | Public Key Encryption, using a given array of [Field](../../variables/Field.mdx) elements and encrypts it using a [PublicKey](../../classes/PublicKey.mdx). | +| [CipherText](type-aliases/CipherText.mdx) | - | +| [CipherTextBytes](type-aliases/CipherTextBytes.mdx) | - | +| [decrypt](functions/decrypt.mdx) | Decrypts a [CipherText](type-aliases/CipherText.mdx) using a [PrivateKey](../../classes/PrivateKey.mdx). | +| [decryptBytes](functions/decryptBytes.mdx) | Decrypts a [CipherText](type-aliases/CipherText.mdx) using a [PrivateKey](../../classes/PrivateKey.mdx). | +| [encrypt](functions/encrypt.mdx) | Public Key Encryption, encrypts Field elements using a [PublicKey](../../classes/PublicKey.mdx). | +| [encryptBytes](functions/encryptBytes.mdx) | Public Key Encryption, encrypts Bytes using a [PublicKey](../../classes/PublicKey.mdx). | diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decrypt.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decrypt.mdx index e6efe1c60..48185032a 100644 --- a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decrypt.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decrypt.mdx @@ -2,11 +2,11 @@ function decrypt(__namedParameters: CipherText, privateKey: PrivateKey): Field[] ``` -Decrypts a CipherText using a [PrivateKey](../../../classes/PrivateKey.mdx).^ +Decrypts a [CipherText](../type-aliases/CipherText.mdx) using a [PrivateKey](../../../classes/PrivateKey.mdx). ## Parameters -• **\_\_namedParameters**: `CipherText` +• **\_\_namedParameters**: [`CipherText`](../type-aliases/CipherText.mdx) • **privateKey**: [`PrivateKey`](../../../classes/PrivateKey.mdx) @@ -16,4 +16,4 @@ Decrypts a CipherText using a [PrivateKey](../../../classes/PrivateKey.mdx).^ ## Source -[lib/provable/crypto/encryption.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/encryption.ts#L45) +[lib/provable/crypto/encryption.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L28) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes.mdx new file mode 100644 index 000000000..52ac2f0a2 --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes.mdx @@ -0,0 +1,19 @@ +```ts +function decryptBytes(cipherText: CipherTextBytes, privateKey: PrivateKey): Bytes +``` + +Decrypts a [CipherText](../type-aliases/CipherText.mdx) using a [PrivateKey](../../../classes/PrivateKey.mdx). + +## Parameters + +• **cipherText**: [`CipherTextBytes`](../type-aliases/CipherTextBytes.mdx) + +• **privateKey**: [`PrivateKey`](../../../classes/PrivateKey.mdx) + +## Returns + +`Bytes` + +## Source + +[lib/provable/crypto/encryption.ts:129](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L129) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encrypt.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encrypt.mdx index 98445b283..495f3703f 100644 --- a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encrypt.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encrypt.mdx @@ -1,11 +1,8 @@ ```ts -function encrypt(message: Field[], otherPublicKey: PublicKey): { - "cipherText": Field[]; - "publicKey": Group; -} +function encrypt(message: Field[], otherPublicKey: PublicKey): CipherText ``` -Public Key Encryption, using a given array of [Field](../../../variables/Field.mdx) elements and encrypts it using a [PublicKey](../../../classes/PublicKey.mdx). +Public Key Encryption, encrypts Field elements using a [PublicKey](../../../classes/PublicKey.mdx). ## Parameters @@ -15,25 +12,8 @@ Public Key Encryption, using a given array of [Field](../../../variables/Field.m ## Returns -```ts -{ - "cipherText": Field[]; - "publicKey": Group; -} -``` - -### cipherText - -```ts -cipherText: Field[]; -``` - -### publicKey - -```ts -publicKey: Group; -``` +[`CipherText`](../type-aliases/CipherText.mdx) ## Source -[lib/provable/crypto/encryption.ts:16](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/encryption.ts#L16) +[lib/provable/crypto/encryption.ts:64](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L64) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes.mdx new file mode 100644 index 000000000..07186a8e7 --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes.mdx @@ -0,0 +1,19 @@ +```ts +function encryptBytes(message: Bytes, otherPublicKey: PublicKey): CipherTextBytes +``` + +Public Key Encryption, encrypts Bytes using a [PublicKey](../../../classes/PublicKey.mdx). + +## Parameters + +• **message**: `Bytes` + +• **otherPublicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) + +## Returns + +[`CipherTextBytes`](../type-aliases/CipherTextBytes.mdx) + +## Source + +[lib/provable/crypto/encryption.ts:97](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L97) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText.mdx new file mode 100644 index 000000000..df8bea9bc --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText.mdx @@ -0,0 +1,24 @@ +```ts +type CipherText: { + "cipherText": Field[]; + "publicKey": Group; +}; +``` + +## Type declaration + +### cipherText + +```ts +cipherText: Field[]; +``` + +### publicKey + +```ts +publicKey: Group; +``` + +## Source + +[lib/provable/crypto/encryption.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L19) diff --git a/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes.mdx b/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes.mdx new file mode 100644 index 000000000..556722b73 --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes.mdx @@ -0,0 +1,17 @@ +```ts +type CipherTextBytes: CipherText & { + "messageLength": number; +}; +``` + +## Type declaration + +### messageLength + +```ts +messageLength: number; +``` + +## Source + +[lib/provable/crypto/encryption.ts:23](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L23) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/README.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/README.mdx index 51534da04..4e8134ea4 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/README.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/README.mdx @@ -5,8 +5,11 @@ This module exposes APIs that are unstable, in the sense that the API surface is | Member | Description | | :------ | :------ | +| [BatchReducer](classes/BatchReducer.mdx) | A reducer to process actions in fixed-size batches. | | [OffchainStateCommitments](classes/OffchainStateCommitments.mdx) | Commitments that keep track of the current state of an offchain Merkle tree constructed from actions. | +| [ActionBatch](type-aliases/ActionBatch.mdx) | - | | [IndexedMerkleMap](type-aliases/IndexedMerkleMap.mdx) | - | +| [ActionBatch](functions/ActionBatch.mdx) | Provable type that represents a batch of actions. | | [IndexedMerkleMap](functions/IndexedMerkleMap.mdx) | Class factory for an Indexed Merkle Map with a given height. | | [OffchainState](functions/OffchainState.mdx) | Offchain state for a `SmartContract`. | | [memoizeWitness](functions/memoizeWitness.mdx) | Like Provable.witness, but memoizes the witness during transaction construction | diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/classes/BatchReducer.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/classes/BatchReducer.mdx new file mode 100644 index 000000000..25009f00c --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/classes/BatchReducer.mdx @@ -0,0 +1,3101 @@ +A reducer to process actions in fixed-size batches. + +```ts +let batchReducer = new BatchReducer({ actionType: Action, batchSize: 5 }); + +// in contract: concurrent dispatching of actions +batchReducer.dispatch(action); + +// reducer logic +// outside contract: prepare a list of { batch, proof } objects which cover all pending actions +let batches = await batchReducer.prepareBatches(); + +// in contract: process a single batch +// create one transaction that does this for each batch! +batchReducer.processBatch({ batch, proof }, (action, isDummy) => { + // ... +}); +``` + +## Extends + +- `BatchReducer`\<`ActionType`, `BatchSize`, `Action`\> + +## Type parameters + +• **ActionType** *extends* `Actionable`\<`any`\> + +• **BatchSize** *extends* `number` = `number` + +• **Action** = [`InferProvable`](../../../type-aliases/InferProvable.mdx)\<`ActionType`\> + +## Constructors + +### new BatchReducer() + +```ts +new BatchReducer(__namedParameters: { + "actionType": ActionType; + "batchSize": BatchSize; + "maxActionsPerUpdate": number; + "maxUpdatesFinalProof": 100; + "maxUpdatesPerProof": 300; +}): BatchReducer +``` + +#### Parameters + +• **\_\_namedParameters** + +• **\_\_namedParameters.actionType**: `ActionType` + +The provable type of actions submitted by this reducer. + +• **\_\_namedParameters.batchSize**: `BatchSize` + +The number of actions in a batch. The idea is to process one batch per transaction, by calling `processBatch()`. + +The motivation for processing actions in small batches is to work around the protocol limit on the number of account updates. +If every action should result in an account update, then you have to set the batch size low enough to not exceed the limit. + +If transaction limits are no concern, the `batchSize` could be set based on amount of logic you do per action. +A smaller batch size will make proofs faster, but you might need more individual transactions as more batches are needed to process all pending actions. + +• **\_\_namedParameters.maxActionsPerUpdate?**: `number`= `undefined` + +The maximum number of actions dispatched in any of the zkApp methods on the contract. + +Note: This number just has to be an upper bound of the actual maximum, but if it's the precise number, +fewer constraints will be used. (The overhead of a higher number is fairly small though.) + +A restriction is that the number has to be less or equal than the `batchSize`. +The reason is that actions in one account update are always processed together, so if you'd have more actions in one than the batch size, we couldn't process them at all. + +By default, this is set to `Math.min(batchSize, 5)` which should be sensible for most applications. + +• **\_\_namedParameters.maxUpdatesFinalProof?**: `number`= `100` + +The maximum number of action lists (= all actions on an account update) to process inside `processBatch()`, +i.e. in your zkApp method. + +Default: 100, which will take up about 3000 constraints. + +The current default should be sensible for most applications, but here are some trade-offs to consider when changing it: + +- Using a smaller number means a smaller circuit, so proofs of your method will be faster. +- Using a bigger number means it's more likely that you can prove _all_ actions in the method call and won't need a recursive proof. + +So, go lower if you expect very few actions, and higher if you expect a lot of actions. + +• **\_\_namedParameters.maxUpdatesPerProof?**: `number`= `300` + +The maximum number of action lists (= all actions on an account update) to process in a single recursive proof, in `prepareBatches()`. + +Default: 300, which will take up about 9000 constraints. + +The current default should be sensible for most applications, but here are some trade-offs to consider when changing it: + +- Using a smaller number means a smaller circuit, so recursive proofs will be faster. +- Using a bigger number means you'll need fewer recursive proofs in the case a lot of actions are pending. + +So, go lower if you expect very few actions, and higher if you expect a lot of actions. +(Note: A larger circuit causes longer compilation and proof times for your zkApp even if you _never_ need a recursive proof) + +#### Returns + +[`BatchReducer`](BatchReducer.mdx)\<`ActionType`, `BatchSize`, `Action`\> + +#### Inherited from + +`BatchReducer_.BatchReducer.constructor` + +#### Source + +[lib/mina/actions/batch-reducer.ts:75](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L75) + +## Properties + +### Batch + +```ts +Batch: (value: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + } & { + "_isStruct": true; + } & Provable<{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }, { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": any; + "useOnchainStack": Bool; + "witnesses": ActionWitnesses; + }> & { + "empty": () => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "fromJSON": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "fromValue": (value: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": any; + "useOnchainStack": Bool; + "witnesses": ActionWitnesses | Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "toInput": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "fields": Field[]; + "packed": [Field, number][]; + }; + "toJSON": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + }; +}; +``` + +#### Type declaration + +##### \_isStruct + +```ts +_isStruct: true; +``` + +#### Type declaration + +##### empty() + +```ts +empty: () => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +}; +``` + +###### Returns + +```ts +{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +} +``` + +###### isRecursive + +```ts +isRecursive: Bool = Bool; +``` + +###### onchainActionState + +```ts +onchainActionState: Field = Field; +``` + +###### onchainStack + +```ts +onchainStack: Field = Field; +``` + +###### processedActionState + +```ts +processedActionState: Field = Field; +``` + +###### stack + +```ts +stack: MerkleList>>; +``` + +###### useOnchainStack + +```ts +useOnchainStack: Bool = Bool; +``` + +###### witnesses + +```ts +witnesses: Unconstrained; +``` + +##### fromJSON() + +```ts +fromJSON: (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +}; +``` + +###### Parameters + +• **x** + +• **x.isRecursive**: `boolean`= `Bool` + +• **x.onchainActionState**: `string`= `Field` + +• **x.onchainStack**: `string`= `Field` + +• **x.processedActionState**: `string`= `Field` + +• **x.stack**= `undefined` + +• **x.stack.\_emptyHash**: `null` \| `string` + +• **x.stack.\_innerProvable**: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \} + +• **x.stack.\_nextHash**: `null` \| \{\} + +• **x.stack.\_provable**: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \} + +• **x.stack.empty** + +• **x.stack.emptyHash**: `string` + +• **x.stack.from** + +• **x.stack.fromReverse** + +• **x.stack.prototype** + +• **x.stack.prototype.Constructor** + +• **x.stack.prototype.Constructor.\_emptyHash**: `null` \| `string` + +• **x.stack.prototype.Constructor.\_innerProvable**: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \} + +• **x.stack.prototype.Constructor.\_nextHash**: `null` \| \{\} + +• **x.stack.prototype.Constructor.\_provable**: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \} + +• **x.stack.prototype.Constructor.emptyHash**: `string` + +• **x.stack.prototype.Constructor.prototype**: \{ hash: string; data: \{ get: \{\}; set: \{\}; setTo: \{\}; updateAsProver: \{\}; \}; isEmpty: \{\}; push: \{\}; pushIf: \{\}; popExn: \{\}; pop: \{\}; popIf: \{\}; popIfUnsafe: \{\}; clone: \{\}; forEach: \{\}; startIterating: \{\}; startIteratingFromLast: \{\}; ... 4 more ...; readonly innerProvable: \{ ...; \}; \} + +• **x.stack.prototype.Constructor.create** + +Create a Merkle list type + +Optionally, you can tell `create()` how to do the hash that pushes a new list element, by passing a `nextHash` function. + +**Example** +```ts +class MyList extends MerkleList.create(Field, (hash, x) => + Poseidon.hashWithPrefix('custom', [hash, x]) +) {} +``` + +• **x.stack.prototype.data** + +• **x.stack.prototype.data.get** + +Read an unconstrained value. + +Note: Can only be called outside provable code. + +• **x.stack.prototype.data.set** + +Modify the unconstrained value. + +• **x.stack.prototype.data.setTo** + +Set the unconstrained value to the same as another `Unconstrained`. + +• **x.stack.prototype.data.updateAsProver** + +Update an `Unconstrained` by a witness computation. + +• **x.stack.prototype.hash**: `string` + +• **x.stack.prototype.innerProvable** + +• **x.stack.prototype.innerProvable.check** + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +**Param** +the element of type `T` to put assertions on. + +• **x.stack.prototype.innerProvable.empty** + +• **x.stack.prototype.innerProvable.fromFields** + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +**Param** +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +**Param** +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +• **x.stack.prototype.innerProvable.fromValue** + +Convert provable type from a normal JS type. + +• **x.stack.prototype.innerProvable.toAuxiliary** + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +**Param** +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +• **x.stack.prototype.innerProvable.toCanonical?**: `null` \| \{\} + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +• **x.stack.prototype.innerProvable.toFields** + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +**Param** +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +• **x.stack.prototype.innerProvable.toInput** + +• **x.stack.prototype.innerProvable.toValue** + +Convert provable type to a normal JS type. + +• **x.stack.prototype.innerProvable.sizeInFields** + +• **x.stack.prototype.clone** + +• **x.stack.prototype.forEach** + +Iterate through the list in a fixed number of steps any apply a given callback on each element. + +Proves that the iteration traverses the entire list. +Once past the last element, dummy elements will be passed to the callback. + +Note: There are no guarantees about the contents of dummy elements, so the callback is expected +to handle the `isDummy` flag separately. + +• **x.stack.prototype.isEmpty** + +• **x.stack.prototype.lengthUnconstrained** + +• **x.stack.prototype.nextHash** + +• **x.stack.prototype.pop** + +Remove the last element from the list and return it. + +If the list is empty, returns a dummy element. + +• **x.stack.prototype.popExn** + +Remove the last element from the list and return it. + +This proves that the list is non-empty, and fails otherwise. + +• **x.stack.prototype.popIf** + +Return the last element, but only remove it if `condition` is true. + +If the list is empty, returns a dummy element. + +• **x.stack.prototype.popIfUnsafe** + +Low-level, minimal version of `pop()` which lets the _caller_ decide whether there is an element to pop. + +I.e. this proves: +- If the input condition is true, this returns the last element and removes it from the list. +- If the input condition is false, the list is unchanged and the return value is garbage. + +Note that if the caller passes `true` but the list is empty, this will fail. +If the caller passes `false` but the list is non-empty, this succeeds and just doesn't pop off an element. + +• **x.stack.prototype.push** + +Push a new element to the list. + +• **x.stack.prototype.pushIf** + +Push a new element to the list, if the `condition` is true. + +• **x.stack.prototype.startIterating** + +• **x.stack.prototype.startIteratingFromLast** + +• **x.stack.prototype.toArrayUnconstrained** + +• **x.stack.provable** + +• **x.stack.provable.check** + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +**Param** +the element of type `T` to put assertions on. + +• **x.stack.provable.empty** + +• **x.stack.provable.fromFields** + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +**Param** +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +**Param** +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +• **x.stack.provable.fromValue** + +Convert provable type from a normal JS type. + +• **x.stack.provable.toAuxiliary** + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +**Param** +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +• **x.stack.provable.toCanonical?**: `null` \| \{\} + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +• **x.stack.provable.toFields** + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +**Param** +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +• **x.stack.provable.toInput** + +• **x.stack.provable.toValue** + +Convert provable type to a normal JS type. + +• **x.stack.provable.sizeInFields** + +• **x.stack.create** + +Create a Merkle list type + +Optionally, you can tell `create()` how to do the hash that pushes a new list element, by passing a `nextHash` function. + +**Example** +```ts +class MyList extends MerkleList.create(Field, (hash, x) => + Poseidon.hashWithPrefix('custom', [hash, x]) +) {} +``` + +• **x.useOnchainStack**: `boolean`= `Bool` + +• **x.witnesses**= `undefined` + +• **x.witnesses.check** + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +**Param** +the element of type `T` to put assertions on. + +• **x.witnesses.empty** + +• **x.witnesses.fromFields** + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +**Param** +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +**Param** +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +• **x.witnesses.fromValue** + +Convert provable type from a normal JS type. + +• **x.witnesses.toAuxiliary** + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +**Param** +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +• **x.witnesses.toCanonical?**: `null` \| \{\} + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +• **x.witnesses.toFields** + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +**Param** +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +• **x.witnesses.toInput** + +• **x.witnesses.toValue** + +Convert provable type to a normal JS type. + +• **x.witnesses.sizeInFields** + +###### Returns + +```ts +{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +} +``` + +###### isRecursive + +```ts +isRecursive: Bool = Bool; +``` + +###### onchainActionState + +```ts +onchainActionState: Field = Field; +``` + +###### onchainStack + +```ts +onchainStack: Field = Field; +``` + +###### processedActionState + +```ts +processedActionState: Field = Field; +``` + +###### stack + +```ts +stack: MerkleList>>; +``` + +###### useOnchainStack + +```ts +useOnchainStack: Bool = Bool; +``` + +###### witnesses + +```ts +witnesses: Unconstrained; +``` + +##### fromValue() + +```ts +fromValue: (value: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": any; + "useOnchainStack": Bool; + "witnesses": ActionWitnesses | Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +}; +``` + +###### Parameters + +• **value** + +• **value.isRecursive**: `boolean` \| [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **value.onchainActionState**: `string` \| `number` \| `bigint` \| [`Field`](../../../classes/Field.mdx)= `Field` + +• **value.onchainStack**: `string` \| `number` \| `bigint` \| [`Field`](../../../classes/Field.mdx)= `Field` + +• **value.processedActionState**: `string` \| `number` \| `bigint` \| [`Field`](../../../classes/Field.mdx)= `Field` + +• **value.stack**: `any`= `undefined` + +• **value.useOnchainStack**: `boolean` \| [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **value.witnesses**: `ActionWitnesses` \| [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>= `undefined` + +###### Returns + +```ts +{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; +} +``` + +###### isRecursive + +```ts +isRecursive: Bool = Bool; +``` + +###### onchainActionState + +```ts +onchainActionState: Field = Field; +``` + +###### onchainStack + +```ts +onchainStack: Field = Field; +``` + +###### processedActionState + +```ts +processedActionState: Field = Field; +``` + +###### stack + +```ts +stack: MerkleList>>; +``` + +###### useOnchainStack + +```ts +useOnchainStack: Bool = Bool; +``` + +###### witnesses + +```ts +witnesses: Unconstrained; +``` + +##### toInput() + +```ts +toInput: (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "fields": Field[]; + "packed": [Field, number][]; +}; +``` + +###### Parameters + +• **x** + +• **x.isRecursive**: [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **x.onchainActionState**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.onchainStack**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.processedActionState**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.stack**: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`any`\>\>\>= `undefined` + +• **x.useOnchainStack**: [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **x.witnesses**: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>= `undefined` + +###### Returns + +```ts +{ + "fields": Field[]; + "packed": [Field, number][]; +} +``` + +###### fields? + +```ts +optional fields: Field[]; +``` + +###### packed? + +```ts +optional packed: [Field, number][]; +``` + +##### toJSON() + +```ts +toJSON: (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; +}; +``` + +###### Parameters + +• **x** + +• **x.isRecursive**: [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **x.onchainActionState**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.onchainStack**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.processedActionState**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.stack**: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`any`\>\>\>= `undefined` + +• **x.useOnchainStack**: [`Bool`](../../../classes/Bool.mdx)= `Bool` + +• **x.witnesses**: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>= `undefined` + +###### Returns + +```ts +{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; +} +``` + +###### isRecursive + +```ts +isRecursive: boolean = Bool; +``` + +###### onchainActionState + +```ts +onchainActionState: string = Field; +``` + +###### onchainStack + +```ts +onchainStack: string = Field; +``` + +###### processedActionState + +```ts +processedActionState: string = Field; +``` + +###### stack + +```ts +stack: { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; +}; +``` + +###### stack.\_emptyHash + +```ts +_emptyHash: null | string; +``` + +###### stack.\_innerProvable + +```ts +_innerProvable: null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.\_nextHash + +```ts +_nextHash: null | {}; +``` + +###### stack.\_provable + +```ts +_provable: null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.empty + +```ts +empty: {}; +``` + +###### stack.emptyHash + +```ts +emptyHash: string; +``` + +###### stack.from + +```ts +from: {}; +``` + +###### stack.fromReverse + +```ts +fromReverse: {}; +``` + +###### stack.prototype + +```ts +prototype: { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; +}; +``` + +###### stack.prototype.Constructor + +```ts +Constructor: { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; +}; +``` + +###### stack.prototype.Constructor.\_emptyHash + +```ts +_emptyHash: null | string; +``` + +###### stack.prototype.Constructor.\_innerProvable + +```ts +_innerProvable: null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.prototype.Constructor.\_nextHash + +```ts +_nextHash: null | {}; +``` + +###### stack.prototype.Constructor.\_provable + +```ts +_provable: null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.prototype.Constructor.emptyHash + +```ts +emptyHash: string; +``` + +###### stack.prototype.Constructor.prototype + +```ts +prototype: { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; +``` + +###### stack.prototype.Constructor.create + +```ts +create; +``` + +Create a Merkle list type + +Optionally, you can tell `create()` how to do the hash that pushes a new list element, by passing a `nextHash` function. + +###### Example + +```ts +class MyList extends MerkleList.create(Field, (hash, x) => + Poseidon.hashWithPrefix('custom', [hash, x]) +) {} +``` + +###### stack.prototype.data + +```ts +data: { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; +}; +``` + +###### stack.prototype.data.get + +```ts +get; +``` + +Read an unconstrained value. + +Note: Can only be called outside provable code. + +###### stack.prototype.data.set + +```ts +set; +``` + +Modify the unconstrained value. + +###### stack.prototype.data.setTo + +```ts +setTo; +``` + +Set the unconstrained value to the same as another `Unconstrained`. + +###### stack.prototype.data.updateAsProver + +```ts +updateAsProver; +``` + +Update an `Unconstrained` by a witness computation. + +###### stack.prototype.hash + +```ts +hash: string; +``` + +###### stack.prototype.innerProvable + +```ts +innerProvable: { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.prototype.innerProvable.check + +```ts +check: {}; +``` + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +###### Param + +the element of type `T` to put assertions on. + +###### stack.prototype.innerProvable.empty + +```ts +empty: {}; +``` + +###### stack.prototype.innerProvable.fromFields + +```ts +fromFields: {}; +``` + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +###### Param + +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +###### Param + +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +###### stack.prototype.innerProvable.fromValue + +```ts +fromValue: {}; +``` + +Convert provable type from a normal JS type. + +###### stack.prototype.innerProvable.toAuxiliary + +```ts +toAuxiliary: {}; +``` + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +###### Param + +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +###### stack.prototype.innerProvable.toCanonical? + +```ts +optional toCanonical: null | {}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +###### stack.prototype.innerProvable.toFields + +```ts +toFields: {}; +``` + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +###### Param + +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +###### stack.prototype.innerProvable.toInput + +```ts +toInput: {}; +``` + +###### stack.prototype.innerProvable.toValue + +```ts +toValue: {}; +``` + +Convert provable type to a normal JS type. + +###### stack.prototype.innerProvable.sizeInFields + +```ts +sizeInFields; +``` + +###### stack.prototype.clone + +```ts +clone; +``` + +###### stack.prototype.forEach + +```ts +forEach; +``` + +Iterate through the list in a fixed number of steps any apply a given callback on each element. + +Proves that the iteration traverses the entire list. +Once past the last element, dummy elements will be passed to the callback. + +Note: There are no guarantees about the contents of dummy elements, so the callback is expected +to handle the `isDummy` flag separately. + +###### stack.prototype.isEmpty + +```ts +isEmpty; +``` + +###### stack.prototype.lengthUnconstrained + +```ts +lengthUnconstrained; +``` + +###### stack.prototype.nextHash + +```ts +nextHash; +``` + +###### stack.prototype.pop + +```ts +pop; +``` + +Remove the last element from the list and return it. + +If the list is empty, returns a dummy element. + +###### stack.prototype.popExn + +```ts +popExn; +``` + +Remove the last element from the list and return it. + +This proves that the list is non-empty, and fails otherwise. + +###### stack.prototype.popIf + +```ts +popIf; +``` + +Return the last element, but only remove it if `condition` is true. + +If the list is empty, returns a dummy element. + +###### stack.prototype.popIfUnsafe + +```ts +popIfUnsafe; +``` + +Low-level, minimal version of `pop()` which lets the _caller_ decide whether there is an element to pop. + +I.e. this proves: +- If the input condition is true, this returns the last element and removes it from the list. +- If the input condition is false, the list is unchanged and the return value is garbage. + +Note that if the caller passes `true` but the list is empty, this will fail. +If the caller passes `false` but the list is non-empty, this succeeds and just doesn't pop off an element. + +###### stack.prototype.push + +```ts +push; +``` + +Push a new element to the list. + +###### stack.prototype.pushIf + +```ts +pushIf; +``` + +Push a new element to the list, if the `condition` is true. + +###### stack.prototype.startIterating + +```ts +startIterating; +``` + +###### stack.prototype.startIteratingFromLast + +```ts +startIteratingFromLast; +``` + +###### stack.prototype.toArrayUnconstrained + +```ts +toArrayUnconstrained; +``` + +###### stack.provable + +```ts +provable: { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### stack.provable.check + +```ts +check: {}; +``` + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +###### Param + +the element of type `T` to put assertions on. + +###### stack.provable.empty + +```ts +empty: {}; +``` + +###### stack.provable.fromFields + +```ts +fromFields: {}; +``` + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +###### Param + +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +###### Param + +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +###### stack.provable.fromValue + +```ts +fromValue: {}; +``` + +Convert provable type from a normal JS type. + +###### stack.provable.toAuxiliary + +```ts +toAuxiliary: {}; +``` + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +###### Param + +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +###### stack.provable.toCanonical? + +```ts +optional toCanonical: null | {}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +###### stack.provable.toFields + +```ts +toFields: {}; +``` + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +###### Param + +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +###### stack.provable.toInput + +```ts +toInput: {}; +``` + +###### stack.provable.toValue + +```ts +toValue: {}; +``` + +Convert provable type to a normal JS type. + +###### stack.provable.sizeInFields + +```ts +sizeInFields; +``` + +###### stack.create + +```ts +create; +``` + +Create a Merkle list type + +Optionally, you can tell `create()` how to do the hash that pushes a new list element, by passing a `nextHash` function. + +###### Example + +```ts +class MyList extends MerkleList.create(Field, (hash, x) => + Poseidon.hashWithPrefix('custom', [hash, x]) +) {} +``` + +###### useOnchainStack + +```ts +useOnchainStack: boolean = Bool; +``` + +###### witnesses + +```ts +witnesses: { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; +}; +``` + +###### witnesses.check + +```ts +check: {}; +``` + +Add assertions to the proof to check if `value` is a valid member of type `T`. +This function does not return anything, instead it creates any number of assertions to prove that `value` is a valid member of the type `T`. + +For instance, calling check function on the type [Bool](../../../classes/Bool.mdx) asserts that the value of the element is either 1 or 0. + +###### Param + +the element of type `T` to put assertions on. + +###### witnesses.empty + +```ts +empty: {}; +``` + +###### witnesses.fromFields + +```ts +fromFields: {}; +``` + +A function that returns an element of type `T` from the given provable and "auxiliary" data. + +This function is the reverse operation of calling toFields and toAuxilary methods on an element of type `T`. + +###### Param + +an array of [Field](../../../classes/Field.mdx) elements describing the provable data of the new `T` element. + +###### Param + +an array of any type describing the "auxiliary" data of the new `T` element, optional. + +###### witnesses.fromValue + +```ts +fromValue: {}; +``` + +Convert provable type from a normal JS type. + +###### witnesses.toAuxiliary + +```ts +toAuxiliary: {}; +``` + +A function that takes `value` (optional), an element of type `T`, as argument and +returns an array of any type that make up the "auxiliary" (non-provable) data of `value`. + +###### Param + +the element of type `T` to generate the auxiliary data array from, optional. +If not provided, a default value for auxiliary data is returned. + +###### witnesses.toCanonical? + +```ts +optional toCanonical: null | {}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +###### witnesses.toFields + +```ts +toFields: {}; +``` + +A function that takes `value`, an element of type `T`, as argument and returns +an array of [Field](../../../classes/Field.mdx) elements that make up the provable data of `value`. + +###### Param + +the element of type `T` to generate the [Field](../../../classes/Field.mdx) array from. + +###### witnesses.toInput + +```ts +toInput: {}; +``` + +###### witnesses.toValue + +```ts +toValue: {}; +``` + +Convert provable type to a normal JS type. + +###### witnesses.sizeInFields + +```ts +sizeInFields; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.Batch` + +#### Source + +[lib/mina/actions/batch-reducer.ts:67](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L67) + +*** + +### BatchProof + +```ts +BatchProof: typeof Proof; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.BatchProof` + +#### Source + +[lib/mina/actions/batch-reducer.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L70) + +*** + +### \_contract? + +```ts +optional _contract: BatchReducerContract; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer._contract` + +#### Source + +[lib/mina/actions/batch-reducer.ts:164](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L164) + +*** + +### \_contractClass? + +```ts +optional _contractClass: BatchReducerContractClass; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer._contractClass` + +#### Source + +[lib/mina/actions/batch-reducer.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L165) + +*** + +### actionType + +```ts +actionType: Provable & { + "empty": () => Action; + } & { + "toInput": (x: Action) => HashInput; + } & Omit, "fromFields"> & { + "fromFields": (fields: Field[]) => Action; +}; +``` + +#### Type declaration + +##### empty() + +```ts +empty: () => Action; +``` + +###### Returns + +`Action` + +#### Type declaration + +##### toInput() + +```ts +toInput: (x: Action) => HashInput; +``` + +###### Parameters + +• **x**: `Action` + +###### Returns + +`HashInput` + +#### Type declaration + +##### fromFields() + +```ts +fromFields: (fields: Field[]) => Action; +``` + +###### Parameters + +• **fields**: [`Field`](../../../classes/Field.mdx)[] + +###### Returns + +`Action` + +#### Inherited from + +`BatchReducer_.BatchReducer.actionType` + +#### Source + +[lib/mina/actions/batch-reducer.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L66) + +*** + +### batchSize + +```ts +batchSize: BatchSize; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.batchSize` + +#### Source + +[lib/mina/actions/batch-reducer.ts:65](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L65) + +*** + +### maxActionsPerUpdate + +```ts +maxActionsPerUpdate: number; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.maxActionsPerUpdate` + +#### Source + +[lib/mina/actions/batch-reducer.ts:73](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L73) + +*** + +### maxUpdatesFinalProof + +```ts +maxUpdatesFinalProof: number; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.maxUpdatesFinalProof` + +#### Source + +[lib/mina/actions/batch-reducer.ts:72](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L72) + +*** + +### program + +```ts +program: ActionStackProgram; +``` + +#### Inherited from + +`BatchReducer_.BatchReducer.program` + +#### Source + +[lib/mina/actions/batch-reducer.ts:69](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L69) + +## Accessors + +### initialActionStack + +```ts +get static initialActionStack(): Field +``` + +#### Returns + +[`Field`](../../../classes/Field.mdx) + +#### Source + +[lib/mina/actions/batch-reducer.ts:160](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L160) + +*** + +### initialActionState + +```ts +get static initialActionState(): Field +``` + +#### Returns + +[`Field`](../../../classes/Field.mdx) + +#### Source + +[lib/mina/actions/batch-reducer.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L157) + +## Methods + +### compile() + +```ts +compile(): Promise<{ + "verificationKey": { + "data": string; + "hash": Field; + }; +}> +``` + +Compile the recursive action stack prover. + +#### Returns + +`Promise`\<\{ + `"verificationKey"`: \{ + `"data"`: `string`; + `"hash"`: [`Field`](../../../classes/Field.mdx); + \}; + \}\> + +> ##### verificationKey +> +> ```ts +> verificationKey: { +> "data": string; +> "hash": Field; +> }; +> ``` +> +> ##### verificationKey.data +> +> ```ts +> data: string; +> ``` +> +> ##### verificationKey.hash +> +> ```ts +> hash: Field; +> ``` +> + +#### Inherited from + +`BatchReducer_.BatchReducer.compile` + +#### Source + +[lib/mina/actions/batch-reducer.ts:421](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L421) + +*** + +### contract() + +```ts +contract(): BatchReducerContract +``` + +#### Returns + +`BatchReducerContract` + +#### Inherited from + +`BatchReducer_.BatchReducer.contract` + +#### Source + +[lib/mina/actions/batch-reducer.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L174) + +*** + +### contractClass() + +```ts +contractClass(): BatchReducerContractClass +``` + +#### Returns + +`BatchReducerContractClass` + +#### Inherited from + +`BatchReducer_.BatchReducer.contractClass` + +#### Source + +[lib/mina/actions/batch-reducer.ts:167](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L167) + +*** + +### dispatch() + +```ts +dispatch(action: From): void +``` + +Submit an action. + +#### Parameters + +• **action**: `From`\<`ActionType`\> + +#### Returns + +`void` + +#### Inherited from + +`BatchReducer_.BatchReducer.dispatch` + +#### Source + +[lib/mina/actions/batch-reducer.ts:202](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L202) + +*** + +### dispatchIf() + +```ts +dispatchIf(condition: Bool, action: From): void +``` + +Conditionally submit an action. + +#### Parameters + +• **condition**: [`Bool`](../../../classes/Bool.mdx) + +• **action**: `From`\<`ActionType`\> + +#### Returns + +`void` + +#### Inherited from + +`BatchReducer_.BatchReducer.dispatchIf` + +#### Source + +[lib/mina/actions/batch-reducer.ts:215](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L215) + +*** + +### prepareBatches() + +```ts +prepareBatches(): Promise<{ + "batch": ActionBatch; + "proof": ActionStackProof; +}[]> +``` + +Create a proof which returns the next actions batch(es) to process and helps guarantee their correctness. + +#### Returns + +`Promise`\<\{ + `"batch"`: `ActionBatch`\<`Action`\>; + `"proof"`: `ActionStackProof`; + \}[]\> + +#### Inherited from + +`BatchReducer_.BatchReducer.prepareBatches` + +#### Source + +[lib/mina/actions/batch-reducer.ts:428](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L428) + +*** + +### processBatch() + +```ts +processBatch(__namedParameters: { + "batch": ActionBatch; + "proof": Proof; + }, callback: (action: Action, isDummy: Bool, i: number) => void): void +``` + +Process a batch of actions which was created by `prepareBatches()`. + +**Important**: The callback exposes the action's value along with an `isDummy` flag. +This is necessary because we process a dynamically-sized list in a fixed number of steps. +Dummies will be passed to your callback once the actual actions are exhausted. + +Make sure to write your code to account for dummies. For example, when sending MINA from your contract for every action, +you probably want to zero out the balance decrease in the `isDummy` case: +```ts +processBatch({ batch, proof }, (action, isDummy) => { + // ... other logic ... + + let amountToSend = Provable.if(isDummy, UInt64.zero, action.amount); + this.balance.subInPlace(amountToSend); +}); +``` + +**Warning**: Don't call `processBatch()` on two _different_ batches within the same method. The second call +would override the preconditions set by the first call, which would leave the method insecure. +To process more actions per method call, increase the `batchSize`. + +#### Parameters + +• **\_\_namedParameters** + +• **\_\_namedParameters.batch**: `ActionBatch`\<`Action`\> + +• **\_\_namedParameters.proof**: [`Proof`](../../../classes/Proof.mdx)\<[`Field`](../../../classes/Field.mdx), `ActionStackState`\> + +• **callback** + +#### Returns + +`void` + +#### Inherited from + +`BatchReducer_.BatchReducer.processBatch` + +#### Source + +[lib/mina/actions/batch-reducer.ts:253](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L253) + +*** + +### setContractClass() + +```ts +setContractClass(contractClass: BatchReducerContractClass): void +``` + +Set the smart contract class this reducer is connected with. + +Note: You can use either this method or `setContractInstance()` before calling `compile()`. +However, `setContractInstance()` is required for `proveNextBatch()`. + +#### Parameters + +• **contractClass**: `BatchReducerContractClass` + +#### Returns + +`void` + +#### Inherited from + +`BatchReducer_.BatchReducer.setContractClass` + +#### Source + +[lib/mina/actions/batch-reducer.ts:195](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L195) + +*** + +### setContractInstance() + +```ts +setContractInstance(contract: BatchReducerContract): void +``` + +Set the smart contract instance this reducer is connected with. + +Note: This is a required step before using `dispatch()`, `proveNextBatch()` or `processNextBatch()`. + +#### Parameters + +• **contract**: `BatchReducerContract` + +#### Returns + +`void` + +#### Inherited from + +`BatchReducer_.BatchReducer.setContractInstance` + +#### Source + +[lib/mina/actions/batch-reducer.ts:184](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/batch-reducer.ts#L184) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/classes/OffchainStateCommitments.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/classes/OffchainStateCommitments.mdx index a0f90d4a5..f35086982 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/classes/OffchainStateCommitments.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/classes/OffchainStateCommitments.mdx @@ -16,6 +16,7 @@ Fields: ```ts new OffchainStateCommitments(value: { "actionState": Field; + "length": Field; "root": Field; }): OffchainStateCommitments ``` @@ -26,6 +27,8 @@ new OffchainStateCommitments(value: { • **value.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **value.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **value.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -38,7 +41,7 @@ new OffchainStateCommitments(value: { #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) ## Properties @@ -54,7 +57,23 @@ actionState: Field = Field; #### Source -[lib/mina/actions/offchain-state-rollup.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/actions/offchain-state-rollup.ts#L45) +[lib/mina/actions/offchain-state-rollup.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/offchain-state-rollup.ts#L49) + +*** + +### length + +```ts +length: Field = Field; +``` + +#### Inherited from + +`OffchainState_.OffchainStateCommitments.length` + +#### Source + +[lib/mina/actions/offchain-state-rollup.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/offchain-state-rollup.ts#L46) *** @@ -70,7 +89,7 @@ root: Field = Field; #### Source -[lib/mina/actions/offchain-state-rollup.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/actions/offchain-state-rollup.ts#L42) +[lib/mina/actions/offchain-state-rollup.ts:45](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/offchain-state-rollup.ts#L45) *** @@ -86,7 +105,7 @@ static _isStruct: true; #### Source -[lib/provable/types/struct.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L144) +[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L148) *** @@ -95,6 +114,7 @@ static _isStruct: true; ```ts static check: (value: { "actionState": Field; + "length": Field; "root": Field; }) => void; ``` @@ -112,6 +132,8 @@ the element of type `T` to put assertions on. • **value.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **value.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **value.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -124,7 +146,7 @@ the element of type `T` to put assertions on. #### Source -[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L66) +[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L76) *** @@ -133,6 +155,7 @@ the element of type `T` to put assertions on. ```ts static empty: () => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -142,6 +165,7 @@ static empty: () => { ```ts { "actionState": Field; + "length": Field; "root": Field; } ``` @@ -152,6 +176,12 @@ static empty: () => { actionState: Field = Field; ``` +##### length + +```ts +length: Field = Field; +``` + ##### root ```ts @@ -164,7 +194,7 @@ root: Field = Field; #### Source -[lib/provable/types/struct.ts:154](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L154) +[lib/provable/types/struct.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L158) *** @@ -173,6 +203,7 @@ root: Field = Field; ```ts static fromFields: (fields: Field[]) => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -186,6 +217,7 @@ static fromFields: (fields: Field[]) => { ```ts { "actionState": Field; + "length": Field; "root": Field; } ``` @@ -196,6 +228,12 @@ static fromFields: (fields: Field[]) => { actionState: Field = Field; ``` +##### length + +```ts +length: Field = Field; +``` + ##### root ```ts @@ -208,7 +246,7 @@ root: Field = Field; #### Source -[lib/provable/types/provable-intf.ts:87](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L87) +[lib/provable/types/provable-intf.ts:115](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L115) *** @@ -217,9 +255,11 @@ root: Field = Field; ```ts static fromJSON: (x: { "actionState": Field; + "length": Field; "root": Field; }) => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -230,6 +270,8 @@ static fromJSON: (x: { • **x.actionState**: `string`= `Field` +• **x.length**: `string`= `Field` + • **x.root**: `string`= `Field` #### Returns @@ -237,6 +279,7 @@ static fromJSON: (x: { ```ts { "actionState": Field; + "length": Field; "root": Field; } ``` @@ -247,6 +290,12 @@ static fromJSON: (x: { actionState: Field = Field; ``` +##### length + +```ts +length: Field = Field; +``` + ##### root ```ts @@ -259,7 +308,7 @@ root: Field = Field; #### Source -[lib/provable/types/struct.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L153) +[lib/provable/types/struct.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L157) *** @@ -268,18 +317,23 @@ root: Field = Field; ```ts static fromValue: (x: { "actionState": Field; + "length": Field; "root": Field; } | { "actionState": Field; + "length": Field; "root": Field; }) => { "actionState": Field; + "length": Field; "root": Field; } & (value: { "actionState": Field; + "length": Field; "root": Field; }) => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -292,7 +346,7 @@ Convert provable type from a normal JS type. #### Source -[lib/provable/types/provable-intf.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L76) +[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L86) *** @@ -301,6 +355,7 @@ Convert provable type from a normal JS type. ```ts static toAuxiliary: (value?: { "actionState": Field; + "length": Field; "root": Field; }) => any[]; ``` @@ -317,6 +372,8 @@ If not provided, a default value for auxiliary data is returned. • **value.actionState?**: [`Field`](../../../classes/Field.mdx)= `Field` +• **value.length?**: [`Field`](../../../classes/Field.mdx)= `Field` + • **value.root?**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -329,7 +386,84 @@ If not provided, a default value for auxiliary data is returned. #### Source -[lib/provable/types/provable-intf.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L37) +[lib/provable/types/provable-intf.ts:47](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L47) + +*** + +### toCanonical()? + +```ts +static optional toCanonical: (x: { + "actionState": Field; + "length": Field; + "root": Field; + }) => { + "actionState": Field; + "length": Field; + "root": Field; +}; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x** + +• **x.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.length**: [`Field`](../../../classes/Field.mdx)= `Field` + +• **x.root**: [`Field`](../../../classes/Field.mdx)= `Field` + +#### Returns + +```ts +{ + "actionState": Field; + "length": Field; + "root": Field; +} +``` + +##### actionState + +```ts +actionState: Field = Field; +``` + +##### length + +```ts +length: Field = Field; +``` + +##### root + +```ts +root: Field = Field; +``` + +#### Inherited from + +`OffchainState_.OffchainStateCommitments.toCanonical` + +#### Source + +[lib/provable/types/provable-intf.ts:104](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L104) *** @@ -338,6 +472,7 @@ If not provided, a default value for auxiliary data is returned. ```ts static toFields: (value: { "actionState": Field; + "length": Field; "root": Field; }) => Field[]; ``` @@ -353,6 +488,8 @@ the element of type `T` to generate the [Field](../../../classes/Field.mdx) arra • **value.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **value.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **value.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -365,7 +502,7 @@ the element of type `T` to generate the [Field](../../../classes/Field.mdx) arra #### Source -[lib/provable/types/provable-intf.ts:26](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L26) +[lib/provable/types/provable-intf.ts:36](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L36) *** @@ -374,6 +511,7 @@ the element of type `T` to generate the [Field](../../../classes/Field.mdx) arra ```ts static toInput: (x: { "actionState": Field; + "length": Field; "root": Field; }) => { "fields": Field[]; @@ -387,6 +525,8 @@ static toInput: (x: { • **x.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **x.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **x.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -416,7 +556,7 @@ optional packed: [Field, number][]; #### Source -[lib/provable/types/struct.ts:148](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L148) +[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L152) *** @@ -425,9 +565,11 @@ optional packed: [Field, number][]; ```ts static toJSON: (x: { "actionState": Field; + "length": Field; "root": Field; }) => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -438,6 +580,8 @@ static toJSON: (x: { • **x.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **x.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **x.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -445,6 +589,7 @@ static toJSON: (x: { ```ts { "actionState": Field; + "length": Field; "root": Field; } ``` @@ -455,6 +600,12 @@ static toJSON: (x: { actionState: string = Field; ``` +##### length + +```ts +length: string = Field; +``` + ##### root ```ts @@ -467,7 +618,7 @@ root: string = Field; #### Source -[lib/provable/types/struct.ts:152](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L152) +[lib/provable/types/struct.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L156) *** @@ -476,9 +627,11 @@ root: string = Field; ```ts static toValue: (x: { "actionState": Field; + "length": Field; "root": Field; }) => { "actionState": Field; + "length": Field; "root": Field; }; ``` @@ -491,6 +644,8 @@ Convert provable type to a normal JS type. • **x.actionState**: [`Field`](../../../classes/Field.mdx)= `Field` +• **x.length**: [`Field`](../../../classes/Field.mdx)= `Field` + • **x.root**: [`Field`](../../../classes/Field.mdx)= `Field` #### Returns @@ -498,6 +653,7 @@ Convert provable type to a normal JS type. ```ts { "actionState": Field; + "length": Field; "root": Field; } ``` @@ -508,6 +664,12 @@ Convert provable type to a normal JS type. actionState: bigint = Field; ``` +##### length + +```ts +length: bigint = Field; +``` + ##### root ```ts @@ -520,7 +682,7 @@ root: bigint = Field; #### Source -[lib/provable/types/provable-intf.ts:71](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L71) +[lib/provable/types/provable-intf.ts:81](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L81) ## Methods @@ -544,7 +706,7 @@ static emptyFromHeight(height: number): OffchainStateCommitments #### Source -[lib/mina/actions/offchain-state-rollup.ts:47](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/actions/offchain-state-rollup.ts#L47) +[lib/mina/actions/offchain-state-rollup.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/offchain-state-rollup.ts#L51) *** @@ -568,4 +730,4 @@ A `number` representing the size of the `T` type in terms of [Field](../../../cl #### Source -[lib/provable/types/provable-intf.ts:56](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L56) +[lib/provable/types/provable-intf.ts:66](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L66) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/ActionBatch.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/ActionBatch.mdx new file mode 100644 index 000000000..a716c2b1a --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/ActionBatch.mdx @@ -0,0 +1,719 @@ +```ts +function ActionBatch(actionType: A): (value: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + } & { + "_isStruct": true; + } & Provable<{ + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }, { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": any; + "useOnchainStack": Bool; + "witnesses": ActionWitnesses; + }> & { + "empty": () => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "fromJSON": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "fromValue": (value: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": any; + "useOnchainStack": Bool; + "witnesses": ActionWitnesses | Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }; + "toInput": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "fields": Field[]; + "packed": [Field, number][]; + }; + "toJSON": (x: { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": MerkleList>>>; + "useOnchainStack": Bool; + "witnesses": Unconstrained; + }) => { + "isRecursive": Bool; + "onchainActionState": Field; + "onchainStack": Field; + "processedActionState": Field; + "stack": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "empty": {}; + "emptyHash": string; + "from": {}; + "fromReverse": {}; + "prototype": { + "Constructor": { + "_emptyHash": null | string; + "_innerProvable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "_nextHash": null | {}; + "_provable": null | { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "emptyHash": string; + "prototype": { hash: string; data: { get: {}; set: {}; setTo: {}; updateAsProver: {}; }; isEmpty: {}; push: {}; pushIf: {}; popExn: {}; pop: {}; popIf: {}; popIfUnsafe: {}; clone: {}; forEach: {}; startIterating: {}; startIteratingFromLast: {}; ... 4 more ...; readonly innerProvable: { ...; }; }; + "create": ; + }; + "data": { + "get": ; + "set": ; + "setTo": ; + "updateAsProver": ; + }; + "hash": string; + "innerProvable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "clone": ; + "forEach": ; + "isEmpty": ; + "lengthUnconstrained": ; + "nextHash": ; + "pop": ; + "popExn": ; + "popIf": ; + "popIfUnsafe": ; + "push": ; + "pushIf": ; + "startIterating": ; + "startIteratingFromLast": ; + "toArrayUnconstrained": ; + }; + "provable": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + "create": ; + }; + "useOnchainStack": Bool; + "witnesses": { + "check": {}; + "empty": {}; + "fromFields": {}; + "fromValue": {}; + "toAuxiliary": {}; + "toCanonical": null | {}; + "toFields": {}; + "toInput": {}; + "toValue": {}; + "sizeInFields": ; + }; + }; +} +``` + +Provable type that represents a batch of actions. + +## Type parameters + +• **A** *extends* `Actionable`\<`any`\> + +## Parameters + +• **actionType**: `A` + +## Returns + +(`value`: \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}) => \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \} & \{ + `"_isStruct"`: `true`; + \} & `Provable`\<\{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}, \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: `any`; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: `ActionWitnesses`; + \}\> & \{ + `"empty"`: () => \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}; + `"fromJSON"`: (`x`: \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: \{ + `"_emptyHash"`: `null` \| `string`; + `"_innerProvable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"_nextHash"`: `null` \| \{\}; + `"_provable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"empty"`: \{\}; + `"emptyHash"`: `string`; + `"from"`: \{\}; + `"fromReverse"`: \{\}; + `"prototype"`: \{ + `"Constructor"`: \{ + `"_emptyHash"`: `null` \| `string`; + `"_innerProvable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"_nextHash"`: `null` \| \{\}; + `"_provable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"emptyHash"`: `string`; + `"prototype"`: \{ hash: string; data: \{ get: \{\}; set: \{\}; setTo: \{\}; updateAsProver: \{\}; \}; isEmpty: \{\}; push: \{\}; pushIf: \{\}; popExn: \{\}; pop: \{\}; popIf: \{\}; popIfUnsafe: \{\}; clone: \{\}; forEach: \{\}; startIterating: \{\}; startIteratingFromLast: \{\}; ... 4 more ...; readonly innerProvable: \{ ...; \}; \}; + `"create"`: ; + \}; + `"data"`: \{ + `"get"`: ; + `"set"`: ; + `"setTo"`: ; + `"updateAsProver"`: ; + \}; + `"hash"`: `string`; + `"innerProvable"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"clone"`: ; + `"forEach"`: ; + `"isEmpty"`: ; + `"lengthUnconstrained"`: ; + `"nextHash"`: ; + `"pop"`: ; + `"popExn"`: ; + `"popIf"`: ; + `"popIfUnsafe"`: ; + `"push"`: ; + `"pushIf"`: ; + `"startIterating"`: ; + `"startIteratingFromLast"`: ; + `"toArrayUnconstrained"`: ; + \}; + `"provable"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"create"`: ; + \}; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + \}) => \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}; + `"fromValue"`: (`value`: \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: `any`; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: `ActionWitnesses` \| [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}) => \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}; + `"toInput"`: (`x`: \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}) => \{ + `"fields"`: [`Field`](../../../classes/Field.mdx)[]; + `"packed"`: [[`Field`](../../../classes/Field.mdx), `number`][]; + \}; + `"toJSON"`: (`x`: \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: [`MerkleList`](../../../classes/MerkleList.mdx)\<[`MerkleList`](../../../classes/MerkleList.mdx)\<[`Hashed`](../../../classes/Hashed.mdx)\<`InferProvable`\<`A`, [`Field`](../../../classes/Field.mdx)\>\>\>\>; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: [`Unconstrained`](../../../classes/Unconstrained.mdx)\<`ActionWitnesses`\>; + \}) => \{ + `"isRecursive"`: `Bool`; + `"onchainActionState"`: `Field`; + `"onchainStack"`: `Field`; + `"processedActionState"`: `Field`; + `"stack"`: \{ + `"_emptyHash"`: `null` \| `string`; + `"_innerProvable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"_nextHash"`: `null` \| \{\}; + `"_provable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"empty"`: \{\}; + `"emptyHash"`: `string`; + `"from"`: \{\}; + `"fromReverse"`: \{\}; + `"prototype"`: \{ + `"Constructor"`: \{ + `"_emptyHash"`: `null` \| `string`; + `"_innerProvable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"_nextHash"`: `null` \| \{\}; + `"_provable"`: `null` \| \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"emptyHash"`: `string`; + `"prototype"`: \{ hash: string; data: \{ get: \{\}; set: \{\}; setTo: \{\}; updateAsProver: \{\}; \}; isEmpty: \{\}; push: \{\}; pushIf: \{\}; popExn: \{\}; pop: \{\}; popIf: \{\}; popIfUnsafe: \{\}; clone: \{\}; forEach: \{\}; startIterating: \{\}; startIteratingFromLast: \{\}; ... 4 more ...; readonly innerProvable: \{ ...; \}; \}; + `"create"`: ; + \}; + `"data"`: \{ + `"get"`: ; + `"set"`: ; + `"setTo"`: ; + `"updateAsProver"`: ; + \}; + `"hash"`: `string`; + `"innerProvable"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"clone"`: ; + `"forEach"`: ; + `"isEmpty"`: ; + `"lengthUnconstrained"`: ; + `"nextHash"`: ; + `"pop"`: ; + `"popExn"`: ; + `"popIf"`: ; + `"popIfUnsafe"`: ; + `"push"`: ; + `"pushIf"`: ; + `"startIterating"`: ; + `"startIteratingFromLast"`: ; + `"toArrayUnconstrained"`: ; + \}; + `"provable"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + `"create"`: ; + \}; + `"useOnchainStack"`: `Bool`; + `"witnesses"`: \{ + `"check"`: \{\}; + `"empty"`: \{\}; + `"fromFields"`: \{\}; + `"fromValue"`: \{\}; + `"toAuxiliary"`: \{\}; + `"toCanonical"`: `null` \| \{\}; + `"toFields"`: \{\}; + `"toInput"`: \{\}; + `"toValue"`: \{\}; + `"sizeInFields"`: ; + \}; + \}; + \} + +## Source + +[index.ts:213](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L213) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/IndexedMerkleMap.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/IndexedMerkleMap.mdx index 9826416a0..1a98404bb 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/IndexedMerkleMap.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/IndexedMerkleMap.mdx @@ -21,7 +21,7 @@ Indexed Merkle maps can be used directly in provable code: ZkProgram({ methods: { test: { - privateInputs: [MerkleMap.provable, Field], + privateInputs: [MerkleMap, Field], method(map: MerkleMap, key: Field) { // get the value associated with `key` @@ -49,4 +49,4 @@ effciently computable as a hash image, and this update doesn't affect the Merkle ## Source -[index.ts:156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/index.ts#L156) +[index.ts:166](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L166) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/OffchainState.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/OffchainState.mdx index 9056c4e72..2eaf4faae 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/OffchainState.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/OffchainState.mdx @@ -76,4 +76,4 @@ Note: When increasing this, consider decreasing `maxActionsPerProof` or `logTota ## Source -[index.ts:160](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/index.ts#L160) +[index.ts:170](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L170) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/memoizeWitness.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/memoizeWitness.mdx index 612e67b07..31c332569 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/functions/memoizeWitness.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/functions/memoizeWitness.mdx @@ -21,4 +21,4 @@ for reuse by the prover. This is needed to witness non-deterministic values. ## Source -[index.ts:153](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/index.ts#L153) +[index.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L163) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch.mdx new file mode 100644 index 000000000..6fc1f2170 --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch.mdx @@ -0,0 +1,11 @@ +```ts +type ActionBatch: BatchReducer_.ActionBatch; +``` + +## Type parameters + +• **Action** + +## Source + +[index.ts:213](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L213) diff --git a/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap.mdx b/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap.mdx index e12fe086d..7937ed580 100644 --- a/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap.mdx @@ -4,4 +4,4 @@ type IndexedMerkleMap: IndexedMerkleMapBase; ## Source -[index.ts:156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/index.ts#L156) +[index.ts:166](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L166) diff --git a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/acquireKeyPair.mdx b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/acquireKeyPair.mdx index 519367aa9..c83b8554d 100644 --- a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/acquireKeyPair.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/acquireKeyPair.mdx @@ -50,4 +50,4 @@ Key pair ## Source -[lib/mina/fetch.ts:819](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L819) +[lib/mina/fetch.ts:843](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L843) diff --git a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/listAcquiredKeyPairs.mdx b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/listAcquiredKeyPairs.mdx index 0ab2d2f32..0d9f2cf30 100644 --- a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/listAcquiredKeyPairs.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/listAcquiredKeyPairs.mdx @@ -28,4 +28,4 @@ Key pairs list or null if the request failed ## Source -[lib/mina/fetch.ts:899](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L899) +[lib/mina/fetch.ts:923](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L923) diff --git a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/releaseKeyPair.mdx b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/releaseKeyPair.mdx index fbd0d15ef..39fa8c93f 100644 --- a/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/releaseKeyPair.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Lightnet/functions/releaseKeyPair.mdx @@ -27,4 +27,4 @@ Response message from the account manager as string or null if the request faile ## Source -[lib/mina/fetch.ts:862](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/fetch.ts#L862) +[lib/mina/fetch.ts:886](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L886) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/LocalBlockchain.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/LocalBlockchain.mdx index 5ae92e192..66952eba9 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/LocalBlockchain.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/LocalBlockchain.mdx @@ -27,6 +27,7 @@ function LocalBlockchain(__namedParameters: { "getNetworkState": PreconditionBaseTypes<{}>; "hasAccount": boolean; "incrementGlobalSlot": void; + "resetProofsEnabled": void; "sendTransaction": PendingTransactionPromise; "setBlockchainLength": void; "setGlobalSlot": void; @@ -73,6 +74,7 @@ A mock Mina blockchain running locally and useful for testing. `"getNetworkState"`: `PreconditionBaseTypes`\<\{\}\>; `"hasAccount"`: `boolean`; `"incrementGlobalSlot"`: `void`; + `"resetProofsEnabled"`: `void`; `"sendTransaction"`: [`PendingTransactionPromise`](../type-aliases/PendingTransactionPromise.mdx); `"setBlockchainLength"`: `void`; `"setGlobalSlot"`: `void`; @@ -253,6 +255,12 @@ A mock Mina blockchain running locally and useful for testing. > > `void` > +> ### resetProofsEnabled() +> +> #### Returns +> +> `void` +> > ### sendTransaction() > > #### Parameters @@ -318,4 +326,4 @@ A mock Mina blockchain running locally and useful for testing. ## Source -[lib/mina/local-blockchain.ts:68](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/local-blockchain.ts#L68) +[lib/mina/local-blockchain.ts:72](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L72) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/Network.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/Network.mdx index 02bcc3f22..d6d564d28 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/Network.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/Network.mdx @@ -16,7 +16,7 @@ Represents the Mina blockchain running on a real network ### Source -[lib/mina/mina.ts:101](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina.ts#L101) +[lib/mina/mina.ts:101](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L101) ## Network(options) @@ -47,4 +47,4 @@ function Network(options: { ### Source -[lib/mina/mina.ts:102](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina.ts#L102) +[lib/mina/mina.ts:102](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L102) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/TestPublicKey.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/TestPublicKey.mdx index 94aee2098..259d312bd 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/TestPublicKey.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/TestPublicKey.mdx @@ -12,4 +12,4 @@ function TestPublicKey(key: PrivateKey): TestPublicKey ## Source -[lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/local-blockchain.ts#L51) +[lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L51) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentSlot.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentSlot.mdx index fc8b141d2..e09e05f17 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentSlot.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentSlot.mdx @@ -10,4 +10,4 @@ The current slot number, according to the active Mina instance. ## Source -[lib/mina/mina-instance.ts:137](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L137) +[lib/mina/mina-instance.ts:137](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L137) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentTransaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentTransaction.mdx index b106c2641..be16e478e 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentTransaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/currentTransaction.mdx @@ -8,4 +8,4 @@ function currentTransaction(): undefined | CurrentTransaction ## Source -[lib/mina/transaction-context.ts:16](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction-context.ts#L16) +[lib/mina/transaction-context.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction-context.ts#L16) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/faucet.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/faucet.mdx index b4dc03904..a6a2ce9a2 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/faucet.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/faucet.mdx @@ -16,4 +16,4 @@ Requests the [testnet faucet](https://faucet.minaprotocol.com/api/v1/faucet) to ## Source -[lib/mina/mina.ts:513](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina.ts#L513) +[lib/mina/mina.ts:514](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L514) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchActions.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchActions.mdx index 0c5d8a58a..9a805406e 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchActions.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchActions.mdx @@ -37,4 +37,4 @@ A list of emitted sequencing actions associated to the given public key. ## Source -[lib/mina/mina-instance.ts:197](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L197) +[lib/mina/mina-instance.ts:197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L197) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchEvents.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchEvents.mdx index a9511b967..a208496f9 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchEvents.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/fetchEvents.mdx @@ -49,4 +49,4 @@ A list of emitted events associated to the given public key. ## Source -[lib/mina/mina-instance.ts:186](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L186) +[lib/mina/mina-instance.ts:186](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L186) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/filterGroups.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/filterGroups.mdx index 6cc34a4a8..4ba689499 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/filterGroups.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/filterGroups.mdx @@ -40,4 +40,4 @@ signedSingle: number = singleCount; ## Source -[lib/mina/transaction-validation.ts:130](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction-validation.ts#L130) +[lib/mina/transaction-validation.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction-validation.ts#L130) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getAccount.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getAccount.mdx index d9e0802d1..3c5422e30 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getAccount.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getAccount.mdx @@ -16,4 +16,4 @@ The account data associated to the given public key. ## Source -[lib/mina/mina-instance.ts:144](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L144) +[lib/mina/mina-instance.ts:144](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L144) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getActions.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getActions.mdx index bed16b170..968626998 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getActions.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getActions.mdx @@ -27,4 +27,4 @@ A list of emitted sequencing actions associated to the given public key. ## Source -[lib/mina/mina-instance.ts:208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L208) +[lib/mina/mina-instance.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L208) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getBalance.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getBalance.mdx index d40ae5ed6..245cee22f 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getBalance.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getBalance.mdx @@ -16,4 +16,4 @@ The balance associated to the given public key. ## Source -[lib/mina/mina-instance.ts:179](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L179) +[lib/mina/mina-instance.ts:179](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L179) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkConstants.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkConstants.mdx index 8ead664e2..4712c04f3 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkConstants.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkConstants.mdx @@ -10,4 +10,4 @@ Data associated with the current Mina network constants. ## Source -[lib/mina/mina-instance.ts:165](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L165) +[lib/mina/mina-instance.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L165) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkId.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkId.mdx index 5bbea8a3f..64968a46e 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkId.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkId.mdx @@ -10,4 +10,4 @@ The current Mina network ID. ## Source -[lib/mina/mina-instance.ts:158](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L158) +[lib/mina/mina-instance.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L158) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkState.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkState.mdx index 98bedc731..18ad9f221 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkState.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkState.mdx @@ -10,4 +10,4 @@ Data associated with the current state of the Mina network. ## Source -[lib/mina/mina-instance.ts:172](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L172) +[lib/mina/mina-instance.ts:172](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L172) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getProofsEnabled.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getProofsEnabled.mdx index 1be9c41bc..85f89d3c9 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/getProofsEnabled.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/getProofsEnabled.mdx @@ -8,4 +8,4 @@ function getProofsEnabled(): boolean ## Source -[lib/mina/mina-instance.ts:216](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L216) +[lib/mina/mina-instance.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L216) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/hasAccount.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/hasAccount.mdx index 844f50b92..0d127946b 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/hasAccount.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/hasAccount.mdx @@ -16,4 +16,4 @@ Checks if an account exists within the ledger. ## Source -[lib/mina/mina-instance.ts:151](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L151) +[lib/mina/mina-instance.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L151) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/sender.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/sender.mdx index be40f9dfd..a583ba205 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/sender.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/sender.mdx @@ -12,4 +12,4 @@ Throws an error if not inside a transaction, or the sender wasn't passed in. ## Source -[lib/mina/mina.ts:462](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina.ts#L462) +[lib/mina/mina.ts:463](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L463) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/setActiveInstance.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/setActiveInstance.mdx index 5624efd3d..8bf21d538 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/setActiveInstance.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/setActiveInstance.mdx @@ -14,4 +14,4 @@ Set the currently used Mina instance. ## Source -[lib/mina/mina-instance.ts:126](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L126) +[lib/mina/mina-instance.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L126) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/transaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/transaction.mdx index e4d325cc7..16e01cd12 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/transaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/transaction.mdx @@ -28,7 +28,7 @@ A transaction that can subsequently be submitted to the chain. ### Source -[lib/mina/transaction.ts:563](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L563) +[lib/mina/transaction.ts:564](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L564) ## transaction(f) @@ -46,4 +46,4 @@ function transaction(f: () => Promise): TransactionPromise ### Source -[lib/mina/transaction.ts:567](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L567) +[lib/mina/transaction.ts:568](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L568) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/functions/waitForFunding.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/functions/waitForFunding.mdx index e2d03a1bf..bacf6f102 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/functions/waitForFunding.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/functions/waitForFunding.mdx @@ -12,4 +12,4 @@ function waitForFunding(address: string): Promise ## Source -[lib/mina/mina.ts:489](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina.ts#L489) +[lib/mina/mina.ts:490](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L490) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/README.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/README.mdx index 78d1f4649..faa0a1181 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/README.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/README.mdx @@ -2,4 +2,5 @@ | Member | Description | | :------ | :------ | +| [fromBase58](functions/fromBase58.mdx) | - | | [random](functions/random.mdx) | - | diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58.mdx new file mode 100644 index 000000000..3634267bb --- /dev/null +++ b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58.mdx @@ -0,0 +1,15 @@ +```ts +function fromBase58(base58: string): TestPublicKey +``` + +## Parameters + +• **base58**: `string` + +## Returns + +[`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx) + +## Source + +[lib/mina/local-blockchain.ts:64](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L64) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random.mdx index c9e583e89..ebc6518bd 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random.mdx @@ -12,8 +12,8 @@ function random(count: N): N extends 1 ? TestPublicKey : TupleN +`N` *extends* `1` ? [`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx) : [`TupleN`](../../../../../type-aliases/TupleN.mdx)\<[`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx), `N`\> ## Source -[lib/mina/local-blockchain.ts:55](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/local-blockchain.ts#L55) +[lib/mina/local-blockchain.ts:55](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L55) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/functions/fromJSON.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/functions/fromJSON.mdx index cd5d52f30..a67e36d70 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/functions/fromJSON.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/functions/fromJSON.mdx @@ -12,4 +12,4 @@ function fromJSON(json: ZkappCommand): Transaction ## Source -[lib/mina/transaction.ts:84](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L84) +[lib/mina/transaction.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L85) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/ActionStates.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/ActionStates.mdx index 836ba8113..ee06e22c4 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/ActionStates.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/ActionStates.mdx @@ -21,4 +21,4 @@ optional fromActionState: Field; ## Source -[lib/mina/mina-instance.ts:62](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L62) +[lib/mina/mina-instance.ts:62](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L62) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/FeePayerSpec.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/FeePayerSpec.mdx index ac52a8fcb..752cdf36d 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/FeePayerSpec.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/FeePayerSpec.mdx @@ -11,4 +11,4 @@ Allows you to specify information about the fee payer account and the transactio ## Source -[lib/mina/mina-instance.ts:52](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L52) +[lib/mina/mina-instance.ts:52](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L52) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/IncludedTransaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/IncludedTransaction.mdx index 629af1110..493ef72cf 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/IncludedTransaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/IncludedTransaction.mdx @@ -34,4 +34,4 @@ try { ## Source -[lib/mina/transaction.ts:257](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L257) +[lib/mina/transaction.ts:258](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L258) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/NetworkConstants.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/NetworkConstants.mdx index 0960abd43..433b553e6 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/NetworkConstants.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/NetworkConstants.mdx @@ -30,4 +30,4 @@ Duration of 1 slot in millisecondw ## Source -[lib/mina/mina-instance.ts:67](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L67) +[lib/mina/mina-instance.ts:67](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L67) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransaction.mdx index 0f64b04ce..8f1e364f1 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransaction.mdx @@ -148,4 +148,4 @@ try { ## Source -[lib/mina/transaction.ts:156](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L156) +[lib/mina/transaction.ts:157](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L157) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionPromise.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionPromise.mdx index 70166e876..ac9f15bfe 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionPromise.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionPromise.mdx @@ -19,4 +19,4 @@ Equivalent to calling the resolved `PendingTransaction`'s `wait` method. ## Source -[lib/mina/transaction.ts:375](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L375) +[lib/mina/transaction.ts:376](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L376) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionStatus.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionStatus.mdx index f0a2e1b87..260b3617a 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionStatus.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionStatus.mdx @@ -4,4 +4,4 @@ type PendingTransactionStatus: "pending" | "rejected"; ## Source -[lib/mina/transaction.ts:150](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L150) +[lib/mina/transaction.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L151) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/RejectedTransaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/RejectedTransaction.mdx index 38d196c2c..04786407e 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/RejectedTransaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/RejectedTransaction.mdx @@ -43,4 +43,4 @@ try { ## Source -[lib/mina/transaction.ts:281](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L281) +[lib/mina/transaction.ts:282](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L282) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/TestPublicKey.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/TestPublicKey.mdx index 1ad5d917a..849a11bf1 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/TestPublicKey.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/TestPublicKey.mdx @@ -14,4 +14,4 @@ key: PrivateKey; ## Source -[lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/local-blockchain.ts#L51) +[lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L51) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/Transaction.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/Transaction.mdx index 5a28298c9..c79315161 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/Transaction.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/Transaction.mdx @@ -52,4 +52,4 @@ if (result.status === 'pending') { ## Source -[lib/mina/transaction.ts:83](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L83) +[lib/mina/transaction.ts:84](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L84) diff --git a/docs/zkapps/o1js-reference/namespaces/Mina/variables/activeInstance.mdx b/docs/zkapps/o1js-reference/namespaces/Mina/variables/activeInstance.mdx index ab147dada..bbb697616 100644 --- a/docs/zkapps/o1js-reference/namespaces/Mina/variables/activeInstance.mdx +++ b/docs/zkapps/o1js-reference/namespaces/Mina/variables/activeInstance.mdx @@ -4,4 +4,4 @@ activeInstance: Mina; ## Source -[lib/mina/mina-instance.ts:108](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/mina-instance.ts#L108) +[lib/mina/mina-instance.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L108) diff --git a/docs/zkapps/o1js-reference/type-aliases/Account.mdx b/docs/zkapps/o1js-reference/type-aliases/Account.mdx index 6b9fbcd05..14066aad2 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Account.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Account.mdx @@ -4,4 +4,4 @@ type Account: Types.Account; ## Source -[lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account.ts#L19) +[lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account.ts#L19) diff --git a/docs/zkapps/o1js-reference/type-aliases/Bool.mdx b/docs/zkapps/o1js-reference/type-aliases/Bool.mdx index 3f78ee3fa..fed51d3d4 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Bool.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Bool.mdx @@ -4,4 +4,4 @@ type Bool: Bool; ## Source -[lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L70) +[lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L70) diff --git a/docs/zkapps/o1js-reference/type-aliases/BoolVar.mdx b/docs/zkapps/o1js-reference/type-aliases/BoolVar.mdx index db64429b7..3561d1a25 100644 --- a/docs/zkapps/o1js-reference/type-aliases/BoolVar.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/BoolVar.mdx @@ -4,4 +4,4 @@ type BoolVar: FieldVar; ## Source -[lib/provable/bool.ts:14](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/bool.ts#L14) +[lib/provable/bool.ts:14](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L14) diff --git a/docs/zkapps/o1js-reference/type-aliases/Bytes.mdx b/docs/zkapps/o1js-reference/type-aliases/Bytes.mdx index ee83b2a7c..517f19fa4 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Bytes.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Bytes.mdx @@ -4,4 +4,4 @@ type Bytes: InternalBytes; ## Source -[lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped-classes.ts#L16) +[lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped-classes.ts#L16) diff --git a/docs/zkapps/o1js-reference/type-aliases/Cache.mdx b/docs/zkapps/o1js-reference/type-aliases/Cache.mdx index da3df09fe..a09194734 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Cache.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Cache.mdx @@ -76,4 +76,4 @@ The value to write to the cache, as a byte array. ## Source -[lib/proof-system/cache.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/cache.ts#L31) +[lib/proof-system/cache.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/cache.ts#L37) diff --git a/docs/zkapps/o1js-reference/type-aliases/CacheHeader.mdx b/docs/zkapps/o1js-reference/type-aliases/CacheHeader.mdx index b8a1f8170..a15c8c9c3 100644 --- a/docs/zkapps/o1js-reference/type-aliases/CacheHeader.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/CacheHeader.mdx @@ -5,7 +5,7 @@ type CacheHeader: | WrapKeyHeader<"wrap-pk"> | WrapKeyHeader<"wrap-vk"> | PlainHeader<"srs"> - | PlainHeader<"lagrange-basis"> & CommonHeader; + | PlainHeader & CommonHeader; ``` A header that is passed to the caching layer, to support rich caching strategies. @@ -14,4 +14,4 @@ Both `uniqueId` and `programId` can safely be used as a file path. ## Source -[lib/proof-system/cache.ts:98](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/cache.ts#L98) +[lib/proof-system/cache.ts:106](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/cache.ts#L106) diff --git a/docs/zkapps/o1js-reference/type-aliases/ConstantField.mdx b/docs/zkapps/o1js-reference/type-aliases/ConstantField.mdx index d75d44f2a..122671122 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ConstantField.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ConstantField.mdx @@ -14,4 +14,4 @@ value: ConstantFieldVar; ## Source -[lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1246) +[lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1246) diff --git a/docs/zkapps/o1js-reference/type-aliases/DeployArgs.mdx b/docs/zkapps/o1js-reference/type-aliases/DeployArgs.mdx index b2d739b0e..23ce3a18b 100644 --- a/docs/zkapps/o1js-reference/type-aliases/DeployArgs.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/DeployArgs.mdx @@ -9,4 +9,4 @@ type DeployArgs: { ## Source -[lib/mina/zkapp.ts:1208](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/zkapp.ts#L1208) +[lib/mina/zkapp.ts:1248](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1248) diff --git a/docs/zkapps/o1js-reference/type-aliases/Empty.mdx b/docs/zkapps/o1js-reference/type-aliases/Empty.mdx index 4eed9d6cb..18a45f2e9 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Empty.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Empty.mdx @@ -4,4 +4,4 @@ type Empty: Undefined; ## Source -[lib/proof-system/zkprogram.ts:79](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L79) +[lib/proof-system/zkprogram.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L85) diff --git a/docs/zkapps/o1js-reference/type-aliases/FeatureFlags.mdx b/docs/zkapps/o1js-reference/type-aliases/FeatureFlags.mdx index 6d2b82acf..7f489f963 100644 --- a/docs/zkapps/o1js-reference/type-aliases/FeatureFlags.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/FeatureFlags.mdx @@ -63,4 +63,4 @@ xor: boolean | undefined; ## Source -[lib/proof-system/zkprogram.ts:90](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L90) +[lib/proof-system/feature-flags.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/feature-flags.ts#L17) diff --git a/docs/zkapps/o1js-reference/type-aliases/Field.mdx b/docs/zkapps/o1js-reference/type-aliases/Field.mdx index 053a57bff..9aaac00b7 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Field.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Field.mdx @@ -4,4 +4,4 @@ type Field: Field; ## Source -[lib/provable/wrapped.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L42) +[lib/provable/wrapped.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L42) diff --git a/docs/zkapps/o1js-reference/type-aliases/FlexibleProvable.mdx b/docs/zkapps/o1js-reference/type-aliases/FlexibleProvable.mdx index c7e60b4df..17262b67d 100644 --- a/docs/zkapps/o1js-reference/type-aliases/FlexibleProvable.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/FlexibleProvable.mdx @@ -8,4 +8,4 @@ type FlexibleProvable: Provable | Struct; ## Source -[lib/provable/types/struct.ts:60](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L60) +[lib/provable/types/struct.ts:61](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L61) diff --git a/docs/zkapps/o1js-reference/type-aliases/FlexibleProvablePure.mdx b/docs/zkapps/o1js-reference/type-aliases/FlexibleProvablePure.mdx index 397456018..309301de6 100644 --- a/docs/zkapps/o1js-reference/type-aliases/FlexibleProvablePure.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/FlexibleProvablePure.mdx @@ -8,4 +8,4 @@ type FlexibleProvablePure: ProvablePure | StructPure; ## Source -[lib/provable/types/struct.ts:61](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L61) +[lib/provable/types/struct.ts:62](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L62) diff --git a/docs/zkapps/o1js-reference/type-aliases/Group.mdx b/docs/zkapps/o1js-reference/type-aliases/Group.mdx index 2df057dec..810c48167 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Group.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Group.mdx @@ -4,4 +4,4 @@ type Group: Group; ## Source -[lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L76) +[lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L76) diff --git a/docs/zkapps/o1js-reference/type-aliases/InferProvable.mdx b/docs/zkapps/o1js-reference/type-aliases/InferProvable.mdx index 199bd21ce..31859de28 100644 --- a/docs/zkapps/o1js-reference/type-aliases/InferProvable.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/InferProvable.mdx @@ -8,4 +8,4 @@ type InferProvable: GenericInferProvable; ## Source -[lib/provable/types/provable-derivers.ts:50](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-derivers.ts#L50) +[lib/provable/types/provable-derivers.ts:65](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L65) diff --git a/docs/zkapps/o1js-reference/type-aliases/JsonProof.mdx b/docs/zkapps/o1js-reference/type-aliases/JsonProof.mdx index 70cd6fa4b..a9a8d63a1 100644 --- a/docs/zkapps/o1js-reference/type-aliases/JsonProof.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/JsonProof.mdx @@ -35,4 +35,4 @@ publicOutput: string[]; ## Source -[lib/proof-system/zkprogram.ts:503](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L503) +[lib/proof-system/zkprogram.ts:146](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L146) diff --git a/docs/zkapps/o1js-reference/type-aliases/MerkleListBase.mdx b/docs/zkapps/o1js-reference/type-aliases/MerkleListBase.mdx index dd013a843..23c16ad34 100644 --- a/docs/zkapps/o1js-reference/type-aliases/MerkleListBase.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/MerkleListBase.mdx @@ -27,4 +27,4 @@ hash: Field; ## Source -[lib/provable/merkle-list.ts:45](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L45) +[lib/provable/merkle-list.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L46) diff --git a/docs/zkapps/o1js-reference/type-aliases/MerkleListIteratorBase.mdx b/docs/zkapps/o1js-reference/type-aliases/MerkleListIteratorBase.mdx index 8874aac3b..61e2b705d 100644 --- a/docs/zkapps/o1js-reference/type-aliases/MerkleListIteratorBase.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/MerkleListIteratorBase.mdx @@ -47,4 +47,4 @@ readonly hash: Field; ## Source -[lib/provable/merkle-list.ts:330](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L330) +[lib/provable/merkle-list.ts:383](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L383) diff --git a/docs/zkapps/o1js-reference/type-aliases/Option.mdx b/docs/zkapps/o1js-reference/type-aliases/Option.mdx index b502bac8e..f3f84963a 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Option.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Option.mdx @@ -52,4 +52,4 @@ value: T; ## Source -[lib/provable/option.ts:37](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/option.ts#L37) +[lib/provable/option.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/option.ts#L37) diff --git a/docs/zkapps/o1js-reference/type-aliases/Provable.mdx b/docs/zkapps/o1js-reference/type-aliases/Provable.mdx index 31275fbe3..ababb2dea 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Provable.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Provable.mdx @@ -4,6 +4,7 @@ type Provable: { "fromFields": (fields: Field[], aux: any[]) => T; "fromValue": (x: TValue | T) => T; "toAuxiliary": (value?: T) => any[]; + "toCanonical": (x: T) => T; "toFields": (value: T) => Field[]; "toValue": (x: T) => TValue; "sizeInFields": number; @@ -110,6 +111,35 @@ If not provided, a default value for auxiliary data is returned. `any`[] +### toCanonical()? + +```ts +optional toCanonical: (x: T) => T; +``` + +Optional method which transforms a provable type into its canonical representation. + +This is needed for types that have multiple representations of the same underlying value, +and might even not have perfect completeness for some of those representations. + +An example is the `ForeignField` class, which allows non-native field elements to exist in unreduced form. +The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error. + +Specific protocols need to be able to protect themselves against incomplete operations at all costs. +For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action. +`toCanonical()` converts any input into a safe form and enables us to handle cases like this generically. + +Note: For most types, this method is the identity function. +The identity function will also be used when the `toCanonical()` is not present on a type. + +#### Parameters + +• **x**: `T` + +#### Returns + +`T` + ### toFields() ```ts @@ -157,4 +187,4 @@ A `number` representing the size of the `T` type in terms of [Field](../classes/ ## Source -[lib/provable/types/provable-intf.ts:17](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L17) +[lib/provable/types/provable-intf.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L27) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableExtended.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableExtended.mdx index 77bacd7a5..30567b403 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ProvableExtended.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableExtended.mdx @@ -12,4 +12,4 @@ type ProvableExtended: Provable & ProvableExtension ## Source -[lib/provable/types/struct.ts:48](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L48) +[lib/provable/types/struct.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L49) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableHashable-1.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableHashable-1.mdx new file mode 100644 index 000000000..0bf40ac02 --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableHashable-1.mdx @@ -0,0 +1,31 @@ +```ts +type ProvableHashable: ProvableWithEmpty & { + "toInput": (x: T) => HashInput; +}; +``` + +## Type declaration + +### toInput() + +```ts +toInput: (x: T) => HashInput; +``` + +#### Parameters + +• **x**: `T` + +#### Returns + +`HashInput` + +## Type parameters + +• **T** + +• **TValue** = `any` + +## Source + +[lib/provable/types/provable-intf.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L124) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableHashable.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableHashable.mdx index 4da803e03..9ea30d17e 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ProvableHashable.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableHashable.mdx @@ -10,4 +10,4 @@ type ProvableHashable: Provable & Hashable; ## Source -[lib/provable/crypto/poseidon.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/poseidon.ts#L31) +[lib/provable/crypto/poseidon.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L32) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvablePure.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvablePure.mdx index 35cc35245..99844a49e 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ProvablePure.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ProvablePure.mdx @@ -34,4 +34,4 @@ fromFields: (fields: Field[]) => T; ## Source -[lib/provable/types/provable-intf.ts:86](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/provable-intf.ts#L86) +[lib/provable/types/provable-intf.ts:114](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L114) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableType.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableType.mdx new file mode 100644 index 000000000..223ac6c42 --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableType.mdx @@ -0,0 +1,13 @@ +```ts +type ProvableType: WithProvable>; +``` + +## Type parameters + +• **T** = `any` + +• **V** = `any` + +## Source + +[lib/provable/types/provable-intf.ts:132](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L132) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableTypePure.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableTypePure.mdx new file mode 100644 index 000000000..efe25fd15 --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableTypePure.mdx @@ -0,0 +1,13 @@ +```ts +type ProvableTypePure: WithProvable>; +``` + +## Type parameters + +• **T** = `any` + +• **V** = `any` + +## Source + +[lib/provable/types/provable-intf.ts:133](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L133) diff --git a/docs/zkapps/o1js-reference/type-aliases/ProvableWithEmpty.mdx b/docs/zkapps/o1js-reference/type-aliases/ProvableWithEmpty.mdx new file mode 100644 index 000000000..12b775c67 --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/ProvableWithEmpty.mdx @@ -0,0 +1,27 @@ +```ts +type ProvableWithEmpty: Provable & { + "empty": () => T; +}; +``` + +## Type declaration + +### empty() + +```ts +empty: () => T; +``` + +#### Returns + +`T` + +## Type parameters + +• **T** + +• **TValue** = `any` + +## Source + +[lib/provable/types/provable-intf.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L118) diff --git a/docs/zkapps/o1js-reference/type-aliases/Reducer.mdx b/docs/zkapps/o1js-reference/type-aliases/Reducer.mdx index e90832e20..ec0ebb109 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Reducer.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Reducer.mdx @@ -18,4 +18,4 @@ actionType: FlexibleProvablePure; ## Source -[lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/actions/reducer.ts#L17) +[lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/reducer.ts#L17) diff --git a/docs/zkapps/o1js-reference/type-aliases/ScalarConst.mdx b/docs/zkapps/o1js-reference/type-aliases/ScalarConst.mdx index e3861998d..3df2213e0 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ScalarConst.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ScalarConst.mdx @@ -4,4 +4,4 @@ type ScalarConst: [0, bigint]; ## Source -[lib/provable/scalar.ts:19](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/scalar.ts#L19) +[lib/provable/scalar.ts:20](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L20) diff --git a/docs/zkapps/o1js-reference/type-aliases/State.mdx b/docs/zkapps/o1js-reference/type-aliases/State.mdx index 45bed8ea7..3531c0034 100644 --- a/docs/zkapps/o1js-reference/type-aliases/State.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/State.mdx @@ -5,6 +5,7 @@ type State: { "get": A; "getAndRequireEquals": A; "requireEquals": void; + "requireEqualsIf": void; "requireNothing": void; "set": void; }; @@ -89,6 +90,23 @@ by adding a precondition which the verifying Mina node will check before accepti `void` +### requireEqualsIf() + +Require that the on-chain state has to equal the given state if the provided condition is true. + +If the condition is false, this is a no-op. +If the condition is true, this adds a precondition that the verifying Mina node will check before accepting this transaction. + +#### Parameters + +• **condition**: [`Bool`](../classes/Bool.mdx) + +• **a**: `A` + +#### Returns + +`void` + ### requireNothing() **DANGER ZONE**: Override the error message that warns you when you use `.get()` without adding a precondition. @@ -111,4 +129,4 @@ Set the on-chain state to a new value. ## Source -[lib/mina/state.ts:78](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/state.ts#L78) +[lib/mina/state.ts:91](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/state.ts#L91) diff --git a/docs/zkapps/o1js-reference/type-aliases/Struct.mdx b/docs/zkapps/o1js-reference/type-aliases/Struct.mdx index 664f46726..bc9c9873d 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Struct.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Struct.mdx @@ -18,4 +18,4 @@ _isStruct: true; ## Source -[lib/provable/types/struct.ts:136](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/types/struct.ts#L136) +[lib/provable/types/struct.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L140) diff --git a/docs/zkapps/o1js-reference/type-aliases/ToProvable.mdx b/docs/zkapps/o1js-reference/type-aliases/ToProvable.mdx new file mode 100644 index 000000000..d4069df4c --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/ToProvable.mdx @@ -0,0 +1,13 @@ +```ts +type ToProvable: A extends { + "provable": infer P; + } ? P : A; +``` + +## Type parameters + +• **A** *extends* [`WithProvable`](WithProvable.mdx)\<`any`\> + +## Source + +[lib/provable/types/provable-intf.ts:135](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L135) diff --git a/docs/zkapps/o1js-reference/type-aliases/TransactionPromise.mdx b/docs/zkapps/o1js-reference/type-aliases/TransactionPromise.mdx index 0f058a81f..d65f56bc8 100644 --- a/docs/zkapps/o1js-reference/type-aliases/TransactionPromise.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/TransactionPromise.mdx @@ -31,4 +31,4 @@ Equivalent to calling the resolved `Transaction`'s `send` method. ## Source -[lib/mina/transaction.ts:313](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/transaction.ts#L313) +[lib/mina/transaction.ts:314](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L314) diff --git a/docs/zkapps/o1js-reference/type-aliases/TransactionStatus.mdx b/docs/zkapps/o1js-reference/type-aliases/TransactionStatus.mdx index 169069216..f9b50e875 100644 --- a/docs/zkapps/o1js-reference/type-aliases/TransactionStatus.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/TransactionStatus.mdx @@ -10,4 +10,4 @@ UNKNOWN: The transaction has either been snarked, reached finality through conse ## Source -[lib/mina/graphql.ts:215](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/graphql.ts#L215) +[lib/mina/graphql.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/graphql.ts#L216) diff --git a/docs/zkapps/o1js-reference/type-aliases/TupleN.mdx b/docs/zkapps/o1js-reference/type-aliases/TupleN.mdx new file mode 100644 index 000000000..8e74abcdc --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/TupleN.mdx @@ -0,0 +1,15 @@ +```ts +type TupleN: N extends N ? number extends N ? [...T[]] : [...TupleRec] : never; +``` + +tuple type that has the length as generic parameter + +## Type parameters + +• **T** + +• **N** *extends* `number` + +## Source + +[lib/util/types.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/util/types.ts#L28) diff --git a/docs/zkapps/o1js-reference/type-aliases/Undefined.mdx b/docs/zkapps/o1js-reference/type-aliases/Undefined.mdx index 464f4bf7f..cb5522b8e 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Undefined.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Undefined.mdx @@ -4,4 +4,4 @@ type Undefined: undefined; ## Source -[lib/proof-system/zkprogram.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L76) +[lib/proof-system/zkprogram.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L82) diff --git a/docs/zkapps/o1js-reference/type-aliases/VarField.mdx b/docs/zkapps/o1js-reference/type-aliases/VarField.mdx index 25b774fa1..5dea52681 100644 --- a/docs/zkapps/o1js-reference/type-aliases/VarField.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/VarField.mdx @@ -14,4 +14,4 @@ value: VarFieldVar; ## Source -[lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/field.ts#L1242) +[lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1242) diff --git a/docs/zkapps/o1js-reference/type-aliases/Void.mdx b/docs/zkapps/o1js-reference/type-aliases/Void.mdx index d8db8b3d4..3997cab41 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Void.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Void.mdx @@ -4,4 +4,4 @@ type Void: undefined; ## Source -[lib/proof-system/zkprogram.ts:81](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L81) +[lib/proof-system/zkprogram.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L87) diff --git a/docs/zkapps/o1js-reference/type-aliases/WithHash.mdx b/docs/zkapps/o1js-reference/type-aliases/WithHash.mdx index 0cccc95f5..b4c06ee5f 100644 --- a/docs/zkapps/o1js-reference/type-aliases/WithHash.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/WithHash.mdx @@ -25,4 +25,4 @@ previousHash: Field; ## Source -[lib/provable/merkle-list.ts:27](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L27) +[lib/provable/merkle-list.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L28) diff --git a/docs/zkapps/o1js-reference/type-aliases/WithProvable.mdx b/docs/zkapps/o1js-reference/type-aliases/WithProvable.mdx new file mode 100644 index 000000000..9cd658824 --- /dev/null +++ b/docs/zkapps/o1js-reference/type-aliases/WithProvable.mdx @@ -0,0 +1,13 @@ +```ts +type WithProvable: { + "provable": A; + } | A; +``` + +## Type parameters + +• **A** + +## Source + +[lib/provable/types/provable-intf.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L130) diff --git a/docs/zkapps/o1js-reference/type-aliases/Witness.mdx b/docs/zkapps/o1js-reference/type-aliases/Witness.mdx index 092f13d2a..8614845b9 100644 --- a/docs/zkapps/o1js-reference/type-aliases/Witness.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/Witness.mdx @@ -7,4 +7,4 @@ type Witness: { ## Source -[lib/provable/merkle-tree.ts:16](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-tree.ts#L16) +[lib/provable/merkle-tree.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L16) diff --git a/docs/zkapps/o1js-reference/type-aliases/ZkProgram.mdx b/docs/zkapps/o1js-reference/type-aliases/ZkProgram.mdx index 388265670..9aff8d3e4 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ZkProgram.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ZkProgram.mdx @@ -1,16 +1,17 @@ ```ts -type ZkProgram: ReturnType; +type ZkProgram: ReturnType; ``` ## Type parameters -• **S** *extends* \{ - `"publicInput"`: [`FlexibleProvablePure`](FlexibleProvablePure.mdx)\<`any`\>; - `"publicOutput"`: [`FlexibleProvablePure`](FlexibleProvablePure.mdx)\<`any`\>; +• **Config** *extends* \{ + `"methods"`: `{ [I in string]: Object }`; + `"publicInput"`: [`ProvableTypePure`](ProvableTypePure.mdx); + `"publicOutput"`: [`ProvableTypePure`](ProvableTypePure.mdx); \} -• **T** *extends* `{ [I in string]: Tuple }` +• **Methods** *extends* `{ [I in keyof Config["methods"]]: Method>, InferProvableOrVoid>, Config["methods"][I]> }` ## Source -[lib/proof-system/zkprogram.ts:531](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L531) +[lib/proof-system/zkprogram.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L174) diff --git a/docs/zkapps/o1js-reference/type-aliases/ZkappPublicInput.mdx b/docs/zkapps/o1js-reference/type-aliases/ZkappPublicInput.mdx index 8d3acb11e..eea6648be 100644 --- a/docs/zkapps/o1js-reference/type-aliases/ZkappPublicInput.mdx +++ b/docs/zkapps/o1js-reference/type-aliases/ZkappPublicInput.mdx @@ -33,4 +33,4 @@ calls: Field; ## Source -[lib/mina/account-update.ts:1990](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1990) +[lib/mina/account-update.ts:2050](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L2050) diff --git a/docs/zkapps/o1js-reference/variables/Account.mdx b/docs/zkapps/o1js-reference/variables/Account.mdx index 0574432c0..ee0690269 100644 --- a/docs/zkapps/o1js-reference/variables/Account.mdx +++ b/docs/zkapps/o1js-reference/variables/Account.mdx @@ -4,4 +4,4 @@ Account: GenericProvableExtended; ## Source -[lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account.ts#L19) +[lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account.ts#L19) diff --git a/docs/zkapps/o1js-reference/variables/Bool.mdx b/docs/zkapps/o1js-reference/variables/Bool.mdx index 23597ae20..cd4352445 100644 --- a/docs/zkapps/o1js-reference/variables/Bool.mdx +++ b/docs/zkapps/o1js-reference/variables/Bool.mdx @@ -30,4 +30,4 @@ const b: Bool = Field(5).equals(6); ## Source -[lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L70) +[lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L70) diff --git a/docs/zkapps/o1js-reference/variables/Cache.mdx b/docs/zkapps/o1js-reference/variables/Cache.mdx index a96ca5647..0ec7fde05 100644 --- a/docs/zkapps/o1js-reference/variables/Cache.mdx +++ b/docs/zkapps/o1js-reference/variables/Cache.mdx @@ -38,4 +38,4 @@ None: Cache; ## Source -[lib/proof-system/cache.ts:31](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/cache.ts#L31) +[lib/proof-system/cache.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/cache.ts#L37) diff --git a/docs/zkapps/o1js-reference/variables/Crypto.mdx b/docs/zkapps/o1js-reference/variables/Crypto.mdx index f674c884d..aa84bf879 100644 --- a/docs/zkapps/o1js-reference/variables/Crypto.mdx +++ b/docs/zkapps/o1js-reference/variables/Crypto.mdx @@ -32,4 +32,4 @@ Create elliptic curve arithmetic methods. ## Source -[lib/provable/crypto/crypto.ts:8](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/crypto.ts#L8) +[lib/provable/crypto/crypto.ts:8](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L8) diff --git a/docs/zkapps/o1js-reference/variables/Empty.mdx b/docs/zkapps/o1js-reference/variables/Empty.mdx index be0f7e0e9..c4427326d 100644 --- a/docs/zkapps/o1js-reference/variables/Empty.mdx +++ b/docs/zkapps/o1js-reference/variables/Empty.mdx @@ -4,4 +4,4 @@ Empty: ProvablePureExtended; ## Source -[lib/proof-system/zkprogram.ts:79](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L79) +[lib/proof-system/zkprogram.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L85) diff --git a/docs/zkapps/o1js-reference/variables/FeatureFlags.mdx b/docs/zkapps/o1js-reference/variables/FeatureFlags.mdx index e587a23e1..35b892fdc 100644 --- a/docs/zkapps/o1js-reference/variables/FeatureFlags.mdx +++ b/docs/zkapps/o1js-reference/variables/FeatureFlags.mdx @@ -213,4 +213,4 @@ fromZkProgramList: (programs: AnalysableProgram[]) => Promise; ## Source -[lib/proof-system/zkprogram.ts:90](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L90) +[lib/proof-system/feature-flags.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/feature-flags.ts#L17) diff --git a/docs/zkapps/o1js-reference/variables/Field.mdx b/docs/zkapps/o1js-reference/variables/Field.mdx index 1284433c9..fb8f725b3 100644 --- a/docs/zkapps/o1js-reference/variables/Field.mdx +++ b/docs/zkapps/o1js-reference/variables/Field.mdx @@ -47,4 +47,4 @@ the value to convert to a [Field](Field.mdx) ## Source -[lib/provable/wrapped.ts:42](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L42) +[lib/provable/wrapped.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L42) diff --git a/docs/zkapps/o1js-reference/variables/Gadgets.mdx b/docs/zkapps/o1js-reference/variables/Gadgets.mdx index fcc404849..9873c8ac8 100644 --- a/docs/zkapps/o1js-reference/variables/Gadgets.mdx +++ b/docs/zkapps/o1js-reference/variables/Gadgets.mdx @@ -1,5 +1,6 @@ ```ts const Gadgets: { + "BLAKE2B": BLAKE2B; "Field3": { "provable": { "fromValue": Field3; @@ -23,10 +24,17 @@ const Gadgets: { "neg": Field3; "sub": Field3; "sum": Field3; + "toCanonical": Field3; }; "SHA256": SHA256; "addMod32": (x: Field, y: Field) => Field; - "divMod32": (n: Field, quotientBits: number) => { + "addMod64": (x: Field, y: Field) => Field; + "arrayGet": (array: Field[], index: Field) => Field; + "divMod32": (n: Field, nBits: number) => { + "quotient": Field; + "remainder": Field; + }; + "divMod64": (n: Field, nBits: number) => { "quotient": Field; "remainder": Field; }; @@ -37,6 +45,7 @@ const Gadgets: { "leftShift64": Field; "multiRangeCheck": void; "not": Field; + "or": Field; "rangeCheck16": void; "rangeCheck32": void; "rangeCheck3x12": void; @@ -52,6 +61,59 @@ const Gadgets: { ## Type declaration +### BLAKE2B + +```ts +BLAKE2B: { + get "IV": UInt64[]; + "hash": Bytes; +}; +``` + +Implementation of the [BLAKE2b hash function.](https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE2) Hash function with arbitrary length output. + +Applies the BLAKE2b hash function to a list of byte-sized elements. + +The function accepts [Bytes](../type-aliases/Bytes.mdx) as the input message, which is a type that represents a static-length list of byte-sized field elements (range-checked using Gadgets.rangeCheck8). +Alternatively, you can pass plain `number[]`, `bigint[]` or `Uint8Array` to perform a hash outside provable code. + +Produces an output of [Bytes](../type-aliases/Bytes.mdx) that conforms to the chosen digest length. + +#### Param + +[Bytes](../type-aliases/Bytes.mdx) representing the message to hash. + +```ts +let preimage = Bytes.fromString("hello world"); +let digest = Gadgets.BLAKE2b.hash(preimage); +``` + +### BLAKE2B.IV + +```ts +get IV(): UInt64[] +``` + +#### Returns + +[`UInt64`](../classes/UInt64.mdx)[] + +#### Source + +[lib/provable/gadgets/blake2b.ts:77](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/gadgets/blake2b.ts#L77) + +### BLAKE2B.hash() + +#### Parameters + +• **data**: `FlexibleBytes` + +• **digestLength**: `number`= `64` + +#### Returns + +`Bytes` + ### Field3 ```ts @@ -169,6 +231,7 @@ ForeignField: { "neg": Field3; "sub": Field3; "sum": Field3; + "toCanonical": Field3; }; ``` @@ -230,8 +293,8 @@ x + y mod f #### Example ```ts -let x = Provable.witness(Field3.provable, () => Field3.from(9n)); -let y = Provable.witness(Field3.provable, () => Field3.from(10n)); +let x = Provable.witness(Field3, () => 9n); +let y = Provable.witness(Field3, () => 10n); // range check x and y Gadgets.multiRangeCheck(x); @@ -277,9 +340,9 @@ if any of the assumptions is violated. #### Example ```ts -let x = Provable.witness(Field3.provable, () => Field3.from(4n)); -let y = Provable.witness(Field3.provable, () => Field3.from(5n)); -let z = Provable.witness(Field3.provable, () => Field3.from(10n)); +let x = Provable.witness(Field3, () => 4n); +let y = Provable.witness(Field3, () => 5n); +let z = Provable.witness(Field3, () => 10n); ForeignField.assertAlmostReduced([x, y, z], f); @@ -319,7 +382,7 @@ if x is greater or equal to f. #### Example ```ts -let x = Provable.witness(Field3.provable, () => Field3.from(0x1235n)); +let x = Provable.witness(Field3, () => 0x1235n); // range check limbs of x Gadgets.multiRangeCheck(x); @@ -475,8 +538,8 @@ So, to use the result in another foreign field multiplication, you have to add t // example modulus: secp256k1 prime let f = (1n << 256n) - (1n << 32n) - 0b1111010001n; -let x = Provable.witness(Field3.provable, () => Field3.from(f - 1n)); -let y = Provable.witness(Field3.provable, () => Field3.from(f - 2n)); +let x = Provable.witness(Field3, () => f - 1n); +let y = Provable.witness(Field3, () => f - 2n); // range check x, y and prove additional bounds x[2] <= f[2] ForeignField.assertAlmostReduced([x, y], f); @@ -557,9 +620,9 @@ See Gadgets.ForeignField.add for assumptions on inputs. #### Example ```ts -let x = Provable.witness(Field3.provable, () => Field3.from(4n)); -let y = Provable.witness(Field3.provable, () => Field3.from(5n)); -let z = Provable.witness(Field3.provable, () => Field3.from(10n)); +let x = Provable.witness(Field3, () => 4n); +let y = Provable.witness(Field3, () => 5n); +let z = Provable.witness(Field3, () => 10n); // range check x, y, z Gadgets.multiRangeCheck(x); @@ -572,12 +635,31 @@ let sum = ForeignField.sum([x, y, z], [1n, -1n], 17n); Provable.log(sum); // ['16', '0', '0'] = limb representation of 16 = 4 + 5 - 10 mod 17 ``` +### ForeignField.toCanonical() + +Convert x, which may be unreduced, to a canonical representative xR < f +such that x = xR mod f + +Note: This method is complete, it works for all unreduced field elements. +It can therefore be used to protect against incompleteness of field operations in other places. + +#### Parameters + +• **x**: `Field3` + +• **f**: `bigint` + +#### Returns + +`Field3` + ### SHA256 ```ts SHA256: { "compression": sha256Compression; "createMessageSchedule": (M: UInt32[]) => UInt32[]; + "padding": (data: FlexibleBytes) => UInt32[][]; get "initialState": UInt32[]; "hash": Bytes; }; @@ -645,6 +727,20 @@ The 512-bit message block (16-element array of UInt32). The message schedule (64-element array of UInt32). +### SHA256.padding() + +```ts +padding: (data: FlexibleBytes) => UInt32[][]; +``` + +#### Parameters + +• **data**: `FlexibleBytes` + +#### Returns + +[`UInt32`](../classes/UInt32.mdx)[][] + ### SHA256.initialState ```ts @@ -657,7 +753,7 @@ get initialState(): UInt32[] #### Source -[lib/provable/gadgets/sha256.ts:105](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/gadgets/sha256.ts#L105) +[lib/provable/gadgets/sha256.ts:100](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/gadgets/sha256.ts#L100) ### SHA256.hash() @@ -685,10 +781,84 @@ addMod32: (x: Field, y: Field) => Field; [`Field`](../classes/Field.mdx) +### addMod64() + +```ts +addMod64: (x: Field, y: Field) => Field; +``` + +#### Parameters + +• **x**: [`Field`](../classes/Field.mdx) + +• **y**: [`Field`](../classes/Field.mdx) + +#### Returns + +[`Field`](../classes/Field.mdx) + +### arrayGet() + +```ts +arrayGet: (array: Field[], index: Field) => Field; +``` + +Get value from array in O(n) rows. + +Assumes that index is in [0, n), returns an unconstrained result otherwise. + +Note: This saves 0.5*n constraints compared to equals() + switch() even if equals() were implemented optimally. + +#### Parameters + +• **array**: [`Field`](../classes/Field.mdx)[] + +• **index**: [`Field`](../classes/Field.mdx) + +#### Returns + +[`Field`](../classes/Field.mdx) + ### divMod32() ```ts -divMod32: (n: Field, quotientBits: number) => { +divMod32: (n: Field, nBits: number) => { + "quotient": Field; + "remainder": Field; +}; +``` + +#### Parameters + +• **n**: [`Field`](../classes/Field.mdx) + +• **nBits**: `number`= `64` + +#### Returns + +```ts +{ + "quotient": Field; + "remainder": Field; +} +``` + +##### quotient + +```ts +quotient: Field; +``` + +##### remainder + +```ts +remainder: Field; +``` + +### divMod64() + +```ts +divMod64: (n: Field, nBits: number) => { "quotient": Field; "remainder": Field; }; @@ -698,7 +868,7 @@ divMod32: (n: Field, quotientBits: number) => { • **n**: [`Field`](../classes/Field.mdx) -• **quotientBits**: `number`= `32` +• **nBits**: `number`= `128` #### Returns @@ -726,7 +896,8 @@ remainder: Field; Bitwise AND gadget on [Field](Field.mdx) elements. Equivalent to the [bitwise AND `&` operator in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_AND). The AND gate works by comparing two bits and returning `1` if both bits are `1`, and `0` otherwise. -It can be checked by a double generic gate that verifies the following relationship between the values below (in the process it also invokes the Gadgets.xor gadget which will create additional constraints depending on `length`). +It can be checked by a double generic gate that verifies the following relationship between the values +below (in the process it also invokes the Gadgets.xor gadget which will create additional constraints depending on `length`). The generic gate verifies:\ `a + b = sum` and the conjunction equation `2 * and = sum - xor`\ @@ -737,7 +908,9 @@ Where:\ You can find more details about the implementation in the [Mina book](https://o1-labs.github.io/proof-systems/specs/kimchi.html?highlight=gates#and) -The `length` parameter lets you define how many bits should be compared. `length` is rounded to the nearest multiple of 16, `paddedLength = ceil(length / 16) * 16`, and both input values are constrained to fit into `paddedLength` bits. The output is guaranteed to have at most `paddedLength` bits as well. +The `length` parameter lets you define how many bits should be compared. `length` is rounded +to the nearest multiple of 16, `paddedLength = ceil(length / 16) * 16`, and both input values +are constrained to fit into `paddedLength` bits. The output is guaranteed to have at most `paddedLength` bits as well. **Note:** Specifying a larger `length` parameter adds additional constraints. @@ -1007,6 +1180,42 @@ b.assertEquals(0b1010); Throws an error if the input value exceeds 254 bits. +### or() + +Bitwise OR gadget on [Field](Field.mdx) elements. Equivalent to the [bitwise OR `|` operator in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR). +The OR gate works by comparing two bits and returning `1` if at least one bit is `1`, and `0` otherwise. + +The `length` parameter lets you define how many bits should be compared. `length` is rounded +to the nearest multiple of 16, `paddedLength = ceil(length / 16) * 16`, and both input values +are constrained to fit into `paddedLength` bits. The output is guaranteed to have at most `paddedLength` bits as well. + +**Note:** Specifying a larger `length` parameter adds additional constraints. + +**Note:** Both [Field](Field.mdx) elements need to fit into `2^paddedLength - 1`. Otherwise, an error is thrown and no proof can be generated. +For example, with `length = 2` (`paddedLength = 16`), `and()` will fail for any input that is larger than `2**16`. + +#### Parameters + +• **a**: [`Field`](../classes/Field.mdx) + +• **b**: [`Field`](../classes/Field.mdx) + +• **length**: `number` + +#### Returns + +[`Field`](../classes/Field.mdx) + +#### Example + +```typescript +let a = Field.from(3); // ... 000011 +let b = Field.from(5); // ... 000101 + +let c = Gadgets.or(a, b, 16); // ... 000111 +c.assertEquals(7); +``` + ### rangeCheck16() #### Parameters @@ -1395,4 +1604,4 @@ c.assertEquals(0b0110); ## Source -[lib/provable/gadgets/gadgets.ts:36](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/gadgets/gadgets.ts#L36) +[lib/provable/gadgets/gadgets.ts:39](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/gadgets/gadgets.ts#L39) diff --git a/docs/zkapps/o1js-reference/variables/Group.mdx b/docs/zkapps/o1js-reference/variables/Group.mdx index b15cefb85..f40dbee0a 100644 --- a/docs/zkapps/o1js-reference/variables/Group.mdx +++ b/docs/zkapps/o1js-reference/variables/Group.mdx @@ -17,4 +17,4 @@ An element of a Group. ## Source -[lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/wrapped.ts#L76) +[lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L76) diff --git a/docs/zkapps/o1js-reference/variables/Hash.mdx b/docs/zkapps/o1js-reference/variables/Hash.mdx index f53dcdbf4..267224fcf 100644 --- a/docs/zkapps/o1js-reference/variables/Hash.mdx +++ b/docs/zkapps/o1js-reference/variables/Hash.mdx @@ -1,5 +1,8 @@ ```ts const Hash: { + "BLAKE2B": { + "hash": Bytes; + }; "Keccak256": { "hash": Bytes; }; @@ -41,6 +44,24 @@ A collection of hash functions which can be used in provable code. ## Type declaration +### BLAKE2B + +```ts +BLAKE2B: { + "hash": Bytes; +}; +``` + +### BLAKE2B.hash() + +#### Parameters + +• **bytes**: `Bytes` + +#### Returns + +`Bytes` + ### Keccak256 ```ts @@ -193,7 +214,7 @@ lower per-field element cost than hashing. #### Parameters -• **type**: `Hashable`\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<`Hashable`\<`T`\>\> • **value**: `T` @@ -382,4 +403,4 @@ You can find the full set of Poseidon parameters [here](https://github.com/o1-la ## Source -[lib/provable/crypto/hash.ts:11](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/hash.ts#L11) +[lib/provable/crypto/hash.ts:11](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/hash.ts#L11) diff --git a/docs/zkapps/o1js-reference/variables/Keccak.mdx b/docs/zkapps/o1js-reference/variables/Keccak.mdx index a9501b021..d3af8da0c 100644 --- a/docs/zkapps/o1js-reference/variables/Keccak.mdx +++ b/docs/zkapps/o1js-reference/variables/Keccak.mdx @@ -108,4 +108,4 @@ let digest512= Keccak.preNist(512, preimage); ## Source -[lib/provable/crypto/keccak.ts:11](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/keccak.ts#L11) +[lib/provable/crypto/keccak.ts:11](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/keccak.ts#L11) diff --git a/docs/zkapps/o1js-reference/variables/Permissions.mdx b/docs/zkapps/o1js-reference/variables/Permissions.mdx index ddd9511c0..bc757e3bc 100644 --- a/docs/zkapps/o1js-reference/variables/Permissions.mdx +++ b/docs/zkapps/o1js-reference/variables/Permissions.mdx @@ -269,4 +269,4 @@ Modification is permitted by signatures only, using the private key of the zkapp ## Source -[lib/mina/account-update.ts:303](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L303) +[lib/mina/account-update.ts:327](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L327) diff --git a/docs/zkapps/o1js-reference/variables/Poseidon.mdx b/docs/zkapps/o1js-reference/variables/Poseidon.mdx index de59cba21..309bab61b 100644 --- a/docs/zkapps/o1js-reference/variables/Poseidon.mdx +++ b/docs/zkapps/o1js-reference/variables/Poseidon.mdx @@ -75,7 +75,7 @@ lower per-field element cost than hashing. #### Parameters -• **type**: `Hashable`\<`T`\> +• **type**: [`WithProvable`](../type-aliases/WithProvable.mdx)\<`Hashable`\<`T`\>\> • **value**: `T` @@ -129,4 +129,4 @@ The output point is deterministic and its discrete log is not efficiently comput ## Source -[lib/provable/crypto/poseidon.ts:55](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/crypto/poseidon.ts#L55) +[lib/provable/crypto/poseidon.ts:56](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L56) diff --git a/docs/zkapps/o1js-reference/variables/ProvableType.mdx b/docs/zkapps/o1js-reference/variables/ProvableType.mdx new file mode 100644 index 000000000..351cca264 --- /dev/null +++ b/docs/zkapps/o1js-reference/variables/ProvableType.mdx @@ -0,0 +1,42 @@ +```ts +ProvableType: { + "get": ToProvable; + "synthesize": T; +}; +``` + +## Type declaration + +### get() + +#### Type parameters + +• **A** *extends* `unknown` + +#### Parameters + +• **type**: `A` + +#### Returns + +[`ToProvable`](../type-aliases/ToProvable.mdx)\<`A`\> + +### synthesize() + +Create some value of type `T` from its provable type description. + +#### Type parameters + +• **T** + +#### Parameters + +• **type**: [`ProvableType`](../type-aliases/ProvableType.mdx)\<`T`, `any`\> + +#### Returns + +`T` + +## Source + +[lib/provable/types/provable-intf.ts:132](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L132) diff --git a/docs/zkapps/o1js-reference/variables/TokenId.mdx b/docs/zkapps/o1js-reference/variables/TokenId.mdx index 7d62dfebb..6364f3b3c 100644 --- a/docs/zkapps/o1js-reference/variables/TokenId.mdx +++ b/docs/zkapps/o1js-reference/variables/TokenId.mdx @@ -49,4 +49,4 @@ default: Field; ## Source -[lib/mina/account-update.ts:642](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L642) +[lib/mina/account-update.ts:666](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L666) diff --git a/docs/zkapps/o1js-reference/variables/TransactionVersion.mdx b/docs/zkapps/o1js-reference/variables/TransactionVersion.mdx index 1377dfa9e..be3c296f6 100644 --- a/docs/zkapps/o1js-reference/variables/TransactionVersion.mdx +++ b/docs/zkapps/o1js-reference/variables/TransactionVersion.mdx @@ -18,4 +18,4 @@ current: () => UInt32; ## Source -[lib/mina/account-update.ts:118](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L118) +[lib/mina/account-update.ts:119](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L119) diff --git a/docs/zkapps/o1js-reference/variables/TupleN.mdx b/docs/zkapps/o1js-reference/variables/TupleN.mdx new file mode 100644 index 000000000..e5e643c91 --- /dev/null +++ b/docs/zkapps/o1js-reference/variables/TupleN.mdx @@ -0,0 +1,67 @@ +```ts +TupleN: { + "fromArray": TupleN; + "hasLength": tuple is TupleN; + "map": [...{ [i in string | number | symbol]: B }[]]; +}; +``` + +## Type declaration + +### fromArray() + +#### Type parameters + +• **T** + +• **N** *extends* `number` + +#### Parameters + +• **n**: `N` + +• **arr**: `T`[] + +#### Returns + +[`TupleN`](../type-aliases/TupleN.mdx)\<`T`, `N`\> + +### hasLength() + +#### Type parameters + +• **T** + +• **N** *extends* `number` + +#### Parameters + +• **n**: `N` + +• **tuple**: `T`[] + +#### Returns + +`tuple is TupleN` + +### map() + +#### Type parameters + +• **T** *extends* `Tuple`\<`any`\> + +• **B** + +#### Parameters + +• **tuple**: `T` + +• **f** + +#### Returns + +[...\{ [i in string \| number \| symbol]: B \}[]] + +## Source + +[lib/util/types.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/util/types.ts#L28) diff --git a/docs/zkapps/o1js-reference/variables/Undefined.mdx b/docs/zkapps/o1js-reference/variables/Undefined.mdx index 91a33b93d..5faabafb6 100644 --- a/docs/zkapps/o1js-reference/variables/Undefined.mdx +++ b/docs/zkapps/o1js-reference/variables/Undefined.mdx @@ -4,4 +4,4 @@ Undefined: ProvablePureExtended; ## Source -[lib/proof-system/zkprogram.ts:76](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L76) +[lib/proof-system/zkprogram.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L82) diff --git a/docs/zkapps/o1js-reference/variables/Void.mdx b/docs/zkapps/o1js-reference/variables/Void.mdx index bc46a5cb9..f6ee1cd95 100644 --- a/docs/zkapps/o1js-reference/variables/Void.mdx +++ b/docs/zkapps/o1js-reference/variables/Void.mdx @@ -4,4 +4,4 @@ Void: ProvablePureExtended; ## Source -[lib/proof-system/zkprogram.ts:81](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/proof-system/zkprogram.ts#L81) +[lib/proof-system/zkprogram.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L87) diff --git a/docs/zkapps/o1js-reference/variables/ZkappPublicInput.mdx b/docs/zkapps/o1js-reference/variables/ZkappPublicInput.mdx index 271770ebf..b321b7e4c 100644 --- a/docs/zkapps/o1js-reference/variables/ZkappPublicInput.mdx +++ b/docs/zkapps/o1js-reference/variables/ZkappPublicInput.mdx @@ -27,4 +27,4 @@ calls: Field = Field; ## Source -[lib/mina/account-update.ts:1990](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/mina/account-update.ts#L1990) +[lib/mina/account-update.ts:2050](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L2050) diff --git a/docs/zkapps/o1js-reference/variables/emptyHash.mdx b/docs/zkapps/o1js-reference/variables/emptyHash.mdx index a3cf00a83..79a8088ba 100644 --- a/docs/zkapps/o1js-reference/variables/emptyHash.mdx +++ b/docs/zkapps/o1js-reference/variables/emptyHash.mdx @@ -4,4 +4,4 @@ const emptyHash: Field; ## Source -[lib/provable/merkle-list.ts:23](https://github.com/o1-labs/o1js/blob/72b8e2c2b9aaba4b5c12257bdd63dfe2676a3d99/src/lib/provable/merkle-list.ts#L23) +[lib/provable/merkle-list.ts:24](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L24) diff --git a/sidebars.js b/sidebars.js index 6f029b8bd..031875801 100644 --- a/sidebars.js +++ b/sidebars.js @@ -237,11 +237,6 @@ module.exports = { id: 'zkapps/o1js-reference/classes/EcdsaSignature', label: 'EcdsaSignature', }, - { - type: 'doc', - id: 'zkapps/o1js-reference/classes/EcdsaSignatureV2', - label: 'EcdsaSignatureV2', - }, { type: 'doc', id: 'zkapps/o1js-reference/classes/Field', @@ -252,11 +247,6 @@ module.exports = { id: 'zkapps/o1js-reference/classes/ForeignCurve', label: 'ForeignCurve', }, - { - type: 'doc', - id: 'zkapps/o1js-reference/classes/ForeignCurveV2', - label: 'ForeignCurveV2', - }, { type: 'doc', id: 'zkapps/o1js-reference/classes/ForeignField', @@ -347,6 +337,11 @@ module.exports = { id: 'zkapps/o1js-reference/classes/Scalar', label: 'Scalar', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/classes/ScalarField', + label: 'ScalarField', + }, { type: 'doc', id: 'zkapps/o1js-reference/classes/SelfProof', @@ -503,21 +498,11 @@ module.exports = { id: 'zkapps/o1js-reference/functions/createEcdsa', label: 'createEcdsa', }, - { - type: 'doc', - id: 'zkapps/o1js-reference/functions/createEcdsaV2', - label: 'createEcdsaV2', - }, { type: 'doc', id: 'zkapps/o1js-reference/functions/createForeignCurve', label: 'createForeignCurve', }, - { - type: 'doc', - id: 'zkapps/o1js-reference/functions/createForeignCurveV2', - label: 'createForeignCurveV2', - }, { type: 'doc', id: 'zkapps/o1js-reference/functions/createForeignField', @@ -710,11 +695,37 @@ module.exports = { id: 'zkapps/o1js-reference/namespaces/Encryption/functions/decrypt', label: 'decrypt', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes', + label: 'decryptBytes', + }, { type: 'doc', id: 'zkapps/o1js-reference/namespaces/Encryption/functions/encrypt', label: 'encrypt', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes', + label: 'encryptBytes', + }, + ], + }, + { + type: 'category', + label: 'Type-Aliases', + items: [ + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText', + label: 'CipherText', + }, + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes', + label: 'CipherTextBytes', + }, ], }, ], @@ -732,6 +743,11 @@ module.exports = { type: 'category', label: 'Classes', items: [ + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Experimental/classes/BatchReducer', + label: 'BatchReducer', + }, { type: 'doc', id: 'zkapps/o1js-reference/namespaces/Experimental/classes/OffchainStateCommitments', @@ -743,6 +759,11 @@ module.exports = { type: 'category', label: 'Functions', items: [ + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Experimental/functions/ActionBatch', + label: 'ActionBatch', + }, { type: 'doc', id: 'zkapps/o1js-reference/namespaces/Experimental/functions/IndexedMerkleMap', @@ -764,6 +785,11 @@ module.exports = { type: 'category', label: 'Type-Aliases', items: [ + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch', + label: 'ActionBatch', + }, { type: 'doc', id: 'zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap', @@ -942,6 +968,11 @@ module.exports = { type: 'category', label: 'Functions', items: [ + { + type: 'doc', + id: 'zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58', + label: 'fromBase58', + }, { type: 'doc', id: 'zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random', @@ -1155,6 +1186,11 @@ module.exports = { id: 'zkapps/o1js-reference/type-aliases/ProvableExtended', label: 'ProvableExtended', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/ProvableHashable-1', + label: 'ProvableHashable-1', + }, { type: 'doc', id: 'zkapps/o1js-reference/type-aliases/ProvableHashable', @@ -1165,6 +1201,21 @@ module.exports = { id: 'zkapps/o1js-reference/type-aliases/ProvablePure', label: 'ProvablePure', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/ProvableType', + label: 'ProvableType', + }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/ProvableTypePure', + label: 'ProvableTypePure', + }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/ProvableWithEmpty', + label: 'ProvableWithEmpty', + }, { type: 'doc', id: 'zkapps/o1js-reference/type-aliases/Reducer', @@ -1185,6 +1236,11 @@ module.exports = { id: 'zkapps/o1js-reference/type-aliases/Struct', label: 'Struct', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/ToProvable', + label: 'ToProvable', + }, { type: 'doc', id: 'zkapps/o1js-reference/type-aliases/TransactionPromise', @@ -1195,6 +1251,11 @@ module.exports = { id: 'zkapps/o1js-reference/type-aliases/TransactionStatus', label: 'TransactionStatus', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/TupleN', + label: 'TupleN', + }, { type: 'doc', id: 'zkapps/o1js-reference/type-aliases/Undefined', @@ -1215,6 +1276,11 @@ module.exports = { id: 'zkapps/o1js-reference/type-aliases/WithHash', label: 'WithHash', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/type-aliases/WithProvable', + label: 'WithProvable', + }, { type: 'doc', id: 'zkapps/o1js-reference/type-aliases/Witness', @@ -1301,6 +1367,11 @@ module.exports = { id: 'zkapps/o1js-reference/variables/Poseidon', label: 'Poseidon', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/variables/ProvableType', + label: 'ProvableType', + }, { type: 'doc', id: 'zkapps/o1js-reference/variables/TokenId', @@ -1311,6 +1382,11 @@ module.exports = { id: 'zkapps/o1js-reference/variables/TransactionVersion', label: 'TransactionVersion', }, + { + type: 'doc', + id: 'zkapps/o1js-reference/variables/TupleN', + label: 'TupleN', + }, { type: 'doc', id: 'zkapps/o1js-reference/variables/Undefined',