From da73be19d2133845b3dc11d69f185ff7a6724289 Mon Sep 17 00:00:00 2001 From: signorecello Date: Thu, 9 May 2024 08:03:44 +0000 Subject: [PATCH] applying suggestions --- docs/docs/apis/aztec-js/_category_.yml | 1 - .../docs/apis/aztec-js/classes/_category_.yml | 2 - .../aztec-js/classes/contract.BatchCall.md | 155 -------- .../aztec-js/classes/contract.Contract.md | 215 ----------- .../aztec-js/classes/contract.ContractBase.md | 114 ------ .../contract.ContractFunctionInteraction.md | 213 ----------- .../aztec-js/classes/contract.DeployMethod.md | 346 ------------------ .../aztec-js/classes/contract.DeploySentTx.md | 269 -------------- .../apis/aztec-js/classes/contract.SentTx.md | 149 -------- docs/docs/apis/aztec-js/index.md | 50 --- .../apis/aztec-js/interfaces/_category_.yml | 2 - .../interfaces/account.AccountContract.md | 77 ---- .../interfaces/account.AccountInterface.md | 129 ------- .../interfaces/account.AuthWitnessProvider.md | 38 -- docs/docs/apis/aztec-js/modules.md | 13 - .../docs/apis/aztec-js/modules/_category_.yml | 2 - docs/docs/apis/aztec-js/modules/account.md | 34 -- docs/docs/apis/aztec-js/modules/contract.md | 178 --------- .../smart_contracts/contract_creation.md | 2 +- docs/docs/misc/glossary/call_types.md | 177 --------- docs/docs/misc/glossary/main.md | 41 --- .../public-vm/gen/_instruction-set.mdx | 1 - .../private_voting_contract.md | 2 +- .../contract_tutorials/token_contract.md | 2 +- .../simple_dapp/contract_deployment.md | 0 .../simple_dapp/contract_interaction.md | 0 .../advanced => }/simple_dapp/index.md | 2 +- .../simple_dapp/project_setup.md | 0 .../advanced => }/simple_dapp/pxe_service.md | 0 .../advanced => }/simple_dapp/testing.md | 6 +- 30 files changed, 7 insertions(+), 2213 deletions(-) delete mode 100644 docs/docs/apis/aztec-js/_category_.yml delete mode 100644 docs/docs/apis/aztec-js/classes/_category_.yml delete mode 100644 docs/docs/apis/aztec-js/classes/contract.BatchCall.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.Contract.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.ContractBase.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.ContractFunctionInteraction.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.DeployMethod.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.DeploySentTx.md delete mode 100644 docs/docs/apis/aztec-js/classes/contract.SentTx.md delete mode 100644 docs/docs/apis/aztec-js/index.md delete mode 100644 docs/docs/apis/aztec-js/interfaces/_category_.yml delete mode 100644 docs/docs/apis/aztec-js/interfaces/account.AccountContract.md delete mode 100644 docs/docs/apis/aztec-js/interfaces/account.AccountInterface.md delete mode 100644 docs/docs/apis/aztec-js/interfaces/account.AuthWitnessProvider.md delete mode 100644 docs/docs/apis/aztec-js/modules.md delete mode 100644 docs/docs/apis/aztec-js/modules/_category_.yml delete mode 100644 docs/docs/apis/aztec-js/modules/account.md delete mode 100644 docs/docs/apis/aztec-js/modules/contract.md delete mode 100644 docs/docs/misc/glossary/call_types.md delete mode 100644 docs/docs/misc/glossary/main.md rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/contract_deployment.md (100%) rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/contract_interaction.md (100%) rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/index.md (98%) rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/project_setup.md (100%) rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/pxe_service.md (100%) rename docs/docs/tutorials/tutorials/{contract_tutorials/advanced => }/simple_dapp/testing.md (89%) diff --git a/docs/docs/apis/aztec-js/_category_.yml b/docs/docs/apis/aztec-js/_category_.yml deleted file mode 100644 index 24a46026174e..000000000000 --- a/docs/docs/apis/aztec-js/_category_.yml +++ /dev/null @@ -1 +0,0 @@ -label: "API" \ No newline at end of file diff --git a/docs/docs/apis/aztec-js/classes/_category_.yml b/docs/docs/apis/aztec-js/classes/_category_.yml deleted file mode 100644 index 55c7980a4644..000000000000 --- a/docs/docs/apis/aztec-js/classes/_category_.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: "Classes" -position: 3 \ No newline at end of file diff --git a/docs/docs/apis/aztec-js/classes/contract.BatchCall.md b/docs/docs/apis/aztec-js/classes/contract.BatchCall.md deleted file mode 100644 index 5a175fa27c13..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.BatchCall.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -id: "contract.BatchCall" -title: "Class: BatchCall" -sidebar_label: "BatchCall" -custom_edit_url: null ---- - -[contract](../modules/contract.md).BatchCall - -A batch of function calls to be sent as a single transaction through a wallet. - -## Hierarchy - -- `BaseContractInteraction` - - ↳ **`BatchCall`** - -## Constructors - -### constructor - -• **new BatchCall**(`wallet`, `calls`): [`BatchCall`](contract.BatchCall.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | -| `calls` | `FunctionCall`[] | - -#### Returns - -[`BatchCall`](contract.BatchCall.md) - -#### Overrides - -BaseContractInteraction.constructor - -## Properties - -### calls - -• `Protected` **calls**: `FunctionCall`[] - -___ - -### pxe - -• `Protected` **pxe**: `PXE` - -#### Inherited from - -BaseContractInteraction.pxe - -___ - -### tx - -• `Protected` `Optional` **tx**: `Tx` - -#### Inherited from - -BaseContractInteraction.tx - -___ - -### txRequest - -• `Protected` `Optional` **txRequest**: `TxExecutionRequest` - -#### Inherited from - -BaseContractInteraction.txRequest - -___ - -### wallet - -• `Protected` **wallet**: [`Wallet`](../modules/account.md#wallet) - -## Methods - -### create - -▸ **create**(`opts?`): `Promise`\<`TxExecutionRequest`\> - -Create a transaction execution request that represents this batch, encoded and authenticated by the -user's wallet, ready to be simulated. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | An optional object containing additional configuration for the transaction. | - -#### Returns - -`Promise`\<`TxExecutionRequest`\> - -A Promise that resolves to a transaction instance. - -#### Overrides - -BaseContractInteraction.create - -___ - -### prove - -▸ **prove**(`options?`): `Promise`\<`Tx`\> - -Proves a transaction execution request and returns a tx object ready to be sent. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | optional arguments to be used in the creation of the transaction | - -#### Returns - -`Promise`\<`Tx`\> - -The resulting transaction - -#### Inherited from - -BaseContractInteraction.prove - -___ - -### send - -▸ **send**(`options?`): [`SentTx`](contract.SentTx.md) - -Sends a transaction to the contract function with the specified options. -This function throws an error if called on an unconstrained function. -It creates and signs the transaction if necessary, and returns a SentTx instance, -which can be used to track the transaction status, receipt, and events. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | An optional object containing 'from' property representing the AztecAddress of the sender. If not provided, the default address is used. | - -#### Returns - -[`SentTx`](contract.SentTx.md) - -A SentTx instance for tracking the transaction status and information. - -#### Inherited from - -BaseContractInteraction.send diff --git a/docs/docs/apis/aztec-js/classes/contract.Contract.md b/docs/docs/apis/aztec-js/classes/contract.Contract.md deleted file mode 100644 index 201be3f9c1e0..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.Contract.md +++ /dev/null @@ -1,215 +0,0 @@ ---- -id: "contract.Contract" -title: "Class: Contract" -sidebar_label: "Contract" -custom_edit_url: null ---- - -[contract](../modules/contract.md).Contract - -The Contract class represents a contract and provides utility methods for interacting with it. -It enables the creation of ContractFunctionInteraction instances for each function in the contract's ABI, -allowing users to call or send transactions to these functions. Additionally, the Contract class can be used -to attach the contract instance to a deployed contract on-chain through the PXE, which facilitates -interaction with Aztec's privacy protocol. - -## Hierarchy - -- [`ContractBase`](contract.ContractBase.md) - - ↳ **`Contract`** - -## Constructors - -### constructor - -• **new Contract**(`instance`, `artifact`, `wallet`): [`Contract`](contract.Contract.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `instance` | `ContractInstanceWithAddress` | The deployed contract instance definition. | -| `artifact` | `ContractArtifact` | The Application Binary Interface for the contract. | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | The wallet used for interacting with this contract. | - -#### Returns - -[`Contract`](contract.Contract.md) - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[constructor](contract.ContractBase.md#constructor) - -## Properties - -### artifact - -• `Readonly` **artifact**: `ContractArtifact` - -The Application Binary Interface for the contract. - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[artifact](contract.ContractBase.md#artifact) - -___ - -### instance - -• `Readonly` **instance**: `ContractInstanceWithAddress` - -The deployed contract instance definition. - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[instance](contract.ContractBase.md#instance) - -___ - -### methods - -• **methods**: `Object` = `{}` - -An object containing contract methods mapped to their respective names. - -#### Index signature - -▪ [name: `string`]: [`ContractMethod`](../modules/contract.md#contractmethod) - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[methods](contract.ContractBase.md#methods) - -___ - -### wallet - -• `Protected` **wallet**: [`Wallet`](../modules/account.md#wallet) - -The wallet used for interacting with this contract. - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[wallet](contract.ContractBase.md#wallet) - -## Accessors - -### address - -• `get` **address**(): `AztecAddress` - -Address of the contract. - -#### Returns - -`AztecAddress` - -#### Inherited from - -ContractBase.address - -___ - -### partialAddress - -• `get` **partialAddress**(): `Fr` - -Partial address of the contract. - -#### Returns - -`Fr` - -#### Inherited from - -ContractBase.partialAddress - -## Methods - -### withWallet - -▸ **withWallet**(`wallet`): `this` - -Creates a new instance of the contract wrapper attached to a different wallet. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | Wallet to use for sending txs. | - -#### Returns - -`this` - -A new contract instance. - -#### Inherited from - -[ContractBase](contract.ContractBase.md).[withWallet](contract.ContractBase.md#withwallet) - -___ - -### at - -▸ **at**(`address`, `artifact`, `wallet`): `Promise`\<[`Contract`](contract.Contract.md)\> - -Creates a contract instance. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `AztecAddress` | The deployed contract's address. | -| `artifact` | `ContractArtifact` | Build artifact of the contract. | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | The wallet to use when interacting with the contract. | - -#### Returns - -`Promise`\<[`Contract`](contract.Contract.md)\> - -A promise that resolves to a new Contract instance. - -___ - -### deploy - -▸ **deploy**(`wallet`, `artifact`, `args`, `constructorName?`): [`DeployMethod`](contract.DeployMethod.md)\<[`Contract`](contract.Contract.md)\> - -Creates a tx to deploy a new instance of a contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | The wallet for executing the deployment. | -| `artifact` | `ContractArtifact` | Build artifact of the contract to deploy | -| `args` | `any`[] | Arguments for the constructor. | -| `constructorName?` | `string` | The name of the constructor function to call. | - -#### Returns - -[`DeployMethod`](contract.DeployMethod.md)\<[`Contract`](contract.Contract.md)\> - -___ - -### deployWithPublicKeysHash - -▸ **deployWithPublicKeysHash**(`publicKeysHash`, `wallet`, `artifact`, `args`, `constructorName?`): [`DeployMethod`](contract.DeployMethod.md)\<[`Contract`](contract.Contract.md)\> - -Creates a tx to deploy a new instance of a contract using the specified public keys hash to derive the address. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `publicKeysHash` | `Fr` | Hash of public keys to use for deriving the address. | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | The wallet for executing the deployment. | -| `artifact` | `ContractArtifact` | Build artifact of the contract. | -| `args` | `any`[] | Arguments for the constructor. | -| `constructorName?` | `string` | The name of the constructor function to call. | - -#### Returns - -[`DeployMethod`](contract.DeployMethod.md)\<[`Contract`](contract.Contract.md)\> diff --git a/docs/docs/apis/aztec-js/classes/contract.ContractBase.md b/docs/docs/apis/aztec-js/classes/contract.ContractBase.md deleted file mode 100644 index 8ba95b3520f4..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.ContractBase.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -id: "contract.ContractBase" -title: "Class: ContractBase" -sidebar_label: "ContractBase" -custom_edit_url: null ---- - -[contract](../modules/contract.md).ContractBase - -Abstract implementation of a contract extended by the Contract class and generated contract types. - -## Hierarchy - -- **`ContractBase`** - - ↳ [`Contract`](contract.Contract.md) - -## Constructors - -### constructor - -• **new ContractBase**(`instance`, `artifact`, `wallet`): [`ContractBase`](contract.ContractBase.md) - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `instance` | `ContractInstanceWithAddress` | The deployed contract instance definition. | -| `artifact` | `ContractArtifact` | The Application Binary Interface for the contract. | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | The wallet used for interacting with this contract. | - -#### Returns - -[`ContractBase`](contract.ContractBase.md) - -## Properties - -### artifact - -• `Readonly` **artifact**: `ContractArtifact` - -The Application Binary Interface for the contract. - -___ - -### instance - -• `Readonly` **instance**: `ContractInstanceWithAddress` - -The deployed contract instance definition. - -___ - -### methods - -• **methods**: `Object` = `{}` - -An object containing contract methods mapped to their respective names. - -#### Index signature - -▪ [name: `string`]: [`ContractMethod`](../modules/contract.md#contractmethod) - -___ - -### wallet - -• `Protected` **wallet**: [`Wallet`](../modules/account.md#wallet) - -The wallet used for interacting with this contract. - -## Accessors - -### address - -• `get` **address**(): `AztecAddress` - -Address of the contract. - -#### Returns - -`AztecAddress` - -___ - -### partialAddress - -• `get` **partialAddress**(): `Fr` - -Partial address of the contract. - -#### Returns - -`Fr` - -## Methods - -### withWallet - -▸ **withWallet**(`wallet`): `this` - -Creates a new instance of the contract wrapper attached to a different wallet. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | Wallet to use for sending txs. | - -#### Returns - -`this` - -A new contract instance. diff --git a/docs/docs/apis/aztec-js/classes/contract.ContractFunctionInteraction.md b/docs/docs/apis/aztec-js/classes/contract.ContractFunctionInteraction.md deleted file mode 100644 index 4bcdd1e4eff5..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.ContractFunctionInteraction.md +++ /dev/null @@ -1,213 +0,0 @@ ---- -id: "contract.ContractFunctionInteraction" -title: "Class: ContractFunctionInteraction" -sidebar_label: "ContractFunctionInteraction" -custom_edit_url: null ---- - -[contract](../modules/contract.md).ContractFunctionInteraction - -This is the class that is returned when calling e.g. `contract.methods.myMethod(arg0, arg1)`. -It contains available interactions one can call on a method, including view. - -## Hierarchy - -- `BaseContractInteraction` - - ↳ **`ContractFunctionInteraction`** - -## Constructors - -### constructor - -• **new ContractFunctionInteraction**(`wallet`, `contractAddress`, `functionDao`, `args`): [`ContractFunctionInteraction`](contract.ContractFunctionInteraction.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | -| `contractAddress` | `AztecAddress` | -| `functionDao` | `FunctionAbi` | -| `args` | `any`[] | - -#### Returns - -[`ContractFunctionInteraction`](contract.ContractFunctionInteraction.md) - -#### Overrides - -BaseContractInteraction.constructor - -## Properties - -### args - -• `Protected` **args**: `any`[] - -___ - -### contractAddress - -• `Protected` **contractAddress**: `AztecAddress` - -___ - -### functionDao - -• `Protected` **functionDao**: `FunctionAbi` - -___ - -### pxe - -• `Protected` **pxe**: `PXE` - -#### Inherited from - -BaseContractInteraction.pxe - -___ - -### tx - -• `Protected` `Optional` **tx**: `Tx` - -#### Inherited from - -BaseContractInteraction.tx - -___ - -### txRequest - -• `Protected` `Optional` **txRequest**: `TxExecutionRequest` - -#### Inherited from - -BaseContractInteraction.txRequest - -___ - -### wallet - -• `Protected` **wallet**: [`Wallet`](../modules/account.md#wallet) - -## Methods - -### create - -▸ **create**(`opts?`): `Promise`\<`TxExecutionRequest`\> - -Create a transaction execution request that represents this call, encoded and authenticated by the -user's wallet, ready to be simulated. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | An optional object containing additional configuration for the transaction. | - -#### Returns - -`Promise`\<`TxExecutionRequest`\> - -A Promise that resolves to a transaction instance. - -#### Overrides - -BaseContractInteraction.create - -___ - -### prove - -▸ **prove**(`options?`): `Promise`\<`Tx`\> - -Proves a transaction execution request and returns a tx object ready to be sent. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | optional arguments to be used in the creation of the transaction | - -#### Returns - -`Promise`\<`Tx`\> - -The resulting transaction - -#### Inherited from - -BaseContractInteraction.prove - -___ - -### request - -▸ **request**(): `FunctionCall` - -Returns an execution request that represents this operation. Useful as a building -block for constructing batch requests. - -#### Returns - -`FunctionCall` - -An execution request wrapped in promise. - -___ - -### send - -▸ **send**(`options?`): [`SentTx`](contract.SentTx.md) - -Sends a transaction to the contract function with the specified options. -This function throws an error if called on an unconstrained function. -It creates and signs the transaction if necessary, and returns a SentTx instance, -which can be used to track the transaction status, receipt, and events. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`SendMethodOptions`](../modules/contract.md#sendmethodoptions) | An optional object containing 'from' property representing the AztecAddress of the sender. If not provided, the default address is used. | - -#### Returns - -[`SentTx`](contract.SentTx.md) - -A SentTx instance for tracking the transaction status and information. - -#### Inherited from - -BaseContractInteraction.send - -___ - -### simulate - -▸ **simulate**(`options?`): `Promise`\<`any`\> - -Simulate a transaction and get its return values -Differs from prove in a few important ways: -1. It returns the values of the function execution -2. It supports `unconstrained`, `private` and `public` functions -3. For `private` execution it: -3.a SKIPS the entrypoint and starts directly at the function -4. For `public` execution it: -4.a Removes the `txRequest` value after ended simulation -4.b Ignores the `from` in the options - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`SimulateMethodOptions`](../modules/contract.md#simulatemethodoptions) | An optional object containing additional configuration for the transaction. | - -#### Returns - -`Promise`\<`any`\> - -The result of the transaction as returned by the contract function. diff --git a/docs/docs/apis/aztec-js/classes/contract.DeployMethod.md b/docs/docs/apis/aztec-js/classes/contract.DeployMethod.md deleted file mode 100644 index 0ba2244329e3..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.DeployMethod.md +++ /dev/null @@ -1,346 +0,0 @@ ---- -id: "contract.DeployMethod" -title: "Class: DeployMethod" -sidebar_label: "DeployMethod" -custom_edit_url: null ---- - -[contract](../modules/contract.md).DeployMethod - -Contract interaction for deployment. Handles class registration, public instance deployment, -and initialization of the contract. Extends the BaseContractInteraction class. - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `TContract` | extends [`ContractBase`](contract.ContractBase.md) = [`Contract`](contract.Contract.md) | - -## Hierarchy - -- `BaseContractInteraction` - - ↳ **`DeployMethod`** - -## Constructors - -### constructor - -• **new DeployMethod**\<`TContract`\>(`publicKeysHash`, `wallet`, `artifact`, `postDeployCtor`, `args?`, `constructorNameOrArtifact?`): [`DeployMethod`](contract.DeployMethod.md)\<`TContract`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TContract` | extends [`ContractBase`](contract.ContractBase.md) = [`Contract`](contract.Contract.md) | - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `publicKeysHash` | `Fr` | `undefined` | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | `undefined` | -| `artifact` | `ContractArtifact` | `undefined` | -| `postDeployCtor` | (`address`: `AztecAddress`, `wallet`: [`Wallet`](../modules/account.md#wallet)) => `Promise`\<`TContract`\> | `undefined` | -| `args` | `any`[] | `[]` | -| `constructorNameOrArtifact?` | `string` \| `FunctionArtifact` | `undefined` | - -#### Returns - -[`DeployMethod`](contract.DeployMethod.md)\<`TContract`\> - -#### Overrides - -BaseContractInteraction.constructor - -## Properties - -### args - -• `Private` **args**: `any`[] = `[]` - -___ - -### artifact - -• `Private` **artifact**: `ContractArtifact` - -___ - -### constructorArtifact - -• `Private` **constructorArtifact**: `undefined` \| `FunctionArtifact` - -Constructor function to call. - -___ - -### functionCalls - -• `Private` `Optional` **functionCalls**: `ExecutionRequestInit` - -Cached call to request() - -___ - -### instance - -• `Private` `Optional` **instance**: `ContractInstanceWithAddress` = `undefined` - -The contract instance to be deployed. - -___ - -### log - -• `Private` **log**: `Logger` - -___ - -### postDeployCtor - -• `Private` **postDeployCtor**: (`address`: `AztecAddress`, `wallet`: [`Wallet`](../modules/account.md#wallet)) => `Promise`\<`TContract`\> - -#### Type declaration - -▸ (`address`, `wallet`): `Promise`\<`TContract`\> - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `AztecAddress` | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | - -##### Returns - -`Promise`\<`TContract`\> - -___ - -### publicKeysHash - -• `Private` **publicKeysHash**: `Fr` - -___ - -### pxe - -• `Protected` **pxe**: `PXE` - -#### Inherited from - -BaseContractInteraction.pxe - -___ - -### tx - -• `Protected` `Optional` **tx**: `Tx` - -#### Inherited from - -BaseContractInteraction.tx - -___ - -### txRequest - -• `Protected` `Optional` **txRequest**: `TxExecutionRequest` - -#### Inherited from - -BaseContractInteraction.txRequest - -___ - -### wallet - -• `Protected` **wallet**: [`Wallet`](../modules/account.md#wallet) - -## Accessors - -### address - -• `get` **address**(): `undefined` \| `AztecAddress` - -Return this deployment address. - -#### Returns - -`undefined` \| `AztecAddress` - -___ - -### partialAddress - -• `get` **partialAddress**(): `undefined` \| `Fr` - -Returns the partial address for this deployment. - -#### Returns - -`undefined` \| `Fr` - -## Methods - -### create - -▸ **create**(`options?`): `Promise`\<`TxExecutionRequest`\> - -Create a contract deployment transaction, given the deployment options. -This function internally calls `request()` and `sign()` methods to prepare -the transaction for deployment. The resulting signed transaction can be -later sent using the `send()` method. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | An object containing optional deployment settings, contractAddressSalt, and from. | - -#### Returns - -`Promise`\<`TxExecutionRequest`\> - -A Promise resolving to an object containing the signed transaction data and other relevant information. - -#### Overrides - -BaseContractInteraction.create - -___ - -### getDeploymentFunctionCalls - -▸ **getDeploymentFunctionCalls**(`options?`): `Promise`\<`ExecutionRequestInit`\> - -Returns calls for registration of the class and deployment of the instance, depending on the provided options. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | Deployment options. | - -#### Returns - -`Promise`\<`ExecutionRequestInit`\> - -A function call array with potentially requests to the class registerer and instance deployer. - -___ - -### getInitializeFunctionCalls - -▸ **getInitializeFunctionCalls**(`options`): `Promise`\<`ExecutionRequestInit`\> - -Returns the calls necessary to initialize the contract. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | Deployment options. | - -#### Returns - -`Promise`\<`ExecutionRequestInit`\> - -- An array of function calls. - -___ - -### getInstance - -▸ **getInstance**(`options?`): `ContractInstanceWithAddress` - -Builds the contract instance to be deployed and returns it. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | An object containing various deployment options. | - -#### Returns - -`ContractInstanceWithAddress` - -An instance object. - -___ - -### prove - -▸ **prove**(`options`): `Promise`\<`Tx`\> - -Prove the request. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | Deployment options. | - -#### Returns - -`Promise`\<`Tx`\> - -The proven tx. - -#### Overrides - -BaseContractInteraction.prove - -___ - -### request - -▸ **request**(`options?`): `Promise`\<`ExecutionRequestInit`\> - -Returns an array of function calls that represent this operation. Useful as a building -block for constructing batch requests. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | Deployment options. | - -#### Returns - -`Promise`\<`ExecutionRequestInit`\> - -An array of function calls. - -**`Remarks`** - -This method does not have the same return type as the `request` in the ContractInteraction object, -it returns a promise for an array instead of a function call directly. - -___ - -### send - -▸ **send**(`options?`): [`DeploySentTx`](contract.DeploySentTx.md)\<`TContract`\> - -Send the contract deployment transaction using the provided options. -This function extends the 'send' method from the ContractFunctionInteraction class, -allowing us to send a transaction specifically for contract deployment. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options` | [`DeployOptions`](../modules/contract.md#deployoptions) | An object containing various deployment options such as contractAddressSalt and from. | - -#### Returns - -[`DeploySentTx`](contract.DeploySentTx.md)\<`TContract`\> - -A SentTx object that returns the receipt and the deployed contract instance. - -#### Overrides - -BaseContractInteraction.send diff --git a/docs/docs/apis/aztec-js/classes/contract.DeploySentTx.md b/docs/docs/apis/aztec-js/classes/contract.DeploySentTx.md deleted file mode 100644 index f8670a5bdffd..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.DeploySentTx.md +++ /dev/null @@ -1,269 +0,0 @@ ---- -id: "contract.DeploySentTx" -title: "Class: DeploySentTx" -sidebar_label: "DeploySentTx" -custom_edit_url: null ---- - -[contract](../modules/contract.md).DeploySentTx - -A contract deployment transaction sent to the network, extending SentTx with methods to create a contract instance. - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `TContract` | extends [`Contract`](contract.Contract.md) = [`Contract`](contract.Contract.md) | - -## Hierarchy - -- [`SentTx`](contract.SentTx.md) - - ↳ **`DeploySentTx`** - -## Constructors - -### constructor - -• **new DeploySentTx**\<`TContract`\>(`wallet`, `txHashPromise`, `postDeployCtor`, `instance`): [`DeploySentTx`](contract.DeploySentTx.md)\<`TContract`\> - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TContract` | extends [`Contract`](contract.Contract.md) = [`Contract`](contract.Contract.md) | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `wallet` | `PXE` \| [`Wallet`](../modules/account.md#wallet) | - | -| `txHashPromise` | `Promise`\<`TxHash`\> | - | -| `postDeployCtor` | (`address`: `AztecAddress`, `wallet`: [`Wallet`](../modules/account.md#wallet)) => `Promise`\<`TContract`\> | - | -| `instance` | `ContractInstanceWithAddress` | The deployed contract instance | - -#### Returns - -[`DeploySentTx`](contract.DeploySentTx.md)\<`TContract`\> - -#### Overrides - -[SentTx](contract.SentTx.md).[constructor](contract.SentTx.md#constructor) - -## Properties - -### instance - -• **instance**: `ContractInstanceWithAddress` - -The deployed contract instance - -___ - -### log - -• `Private` **log**: `Logger` - -___ - -### postDeployCtor - -• `Private` **postDeployCtor**: (`address`: `AztecAddress`, `wallet`: [`Wallet`](../modules/account.md#wallet)) => `Promise`\<`TContract`\> - -#### Type declaration - -▸ (`address`, `wallet`): `Promise`\<`TContract`\> - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `AztecAddress` | -| `wallet` | [`Wallet`](../modules/account.md#wallet) | - -##### Returns - -`Promise`\<`TContract`\> - -___ - -### pxe - -• `Protected` **pxe**: `PXE` - -#### Inherited from - -[SentTx](contract.SentTx.md).[pxe](contract.SentTx.md#pxe) - -___ - -### txHashPromise - -• `Protected` **txHashPromise**: `Promise`\<`TxHash`\> - -#### Inherited from - -[SentTx](contract.SentTx.md).[txHashPromise](contract.SentTx.md#txhashpromise) - -## Methods - -### deployed - -▸ **deployed**(`opts?`): `Promise`\<`TContract`\> - -Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`DeployedWaitOpts`](../modules/contract.md#deployedwaitopts) | Options for configuring the waiting for the tx to be mined. | - -#### Returns - -`Promise`\<`TContract`\> - -The deployed contract instance. - -___ - -### getContractObject - -▸ **getContractObject**(`wallet?`): `Promise`\<`TContract`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `wallet?` | [`Wallet`](../modules/account.md#wallet) | - -#### Returns - -`Promise`\<`TContract`\> - -___ - -### getReceipt - -▸ **getReceipt**(): `Promise`\<`TxReceipt`\> - -Retrieve the transaction receipt associated with the current SentTx instance. -The function fetches the transaction hash using 'getTxHash' and then queries -the PXE to get the corresponding transaction receipt. - -#### Returns - -`Promise`\<`TxReceipt`\> - -A promise that resolves to a TxReceipt object representing the fetched transaction receipt. - -#### Inherited from - -[SentTx](contract.SentTx.md).[getReceipt](contract.SentTx.md#getreceipt) - -___ - -### getTxHash - -▸ **getTxHash**(): `Promise`\<`TxHash`\> - -Retrieves the transaction hash of the SentTx instance. -The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash. - -#### Returns - -`Promise`\<`TxHash`\> - -A promise that resolves to the transaction hash of the SentTx instance. - -#### Inherited from - -[SentTx](contract.SentTx.md).[getTxHash](contract.SentTx.md#gettxhash) - -___ - -### getUnencryptedLogs - -▸ **getUnencryptedLogs**(): `Promise`\<`GetUnencryptedLogsResponse`\> - -Gets unencrypted logs emitted by this tx. - -#### Returns - -`Promise`\<`GetUnencryptedLogsResponse`\> - -The requested logs. - -**`Remarks`** - -This function will wait for the tx to be mined if it hasn't been already. - -#### Inherited from - -[SentTx](contract.SentTx.md).[getUnencryptedLogs](contract.SentTx.md#getunencryptedlogs) - -___ - -### getVisibleNotes - -▸ **getVisibleNotes**(): `Promise`\<`ExtendedNote`[]\> - -Get notes of accounts registered in the provided PXE/Wallet created in this tx. - -#### Returns - -`Promise`\<`ExtendedNote`[]\> - -The requested notes. - -**`Remarks`** - -This function will wait for the tx to be mined if it hasn't been already. - -#### Inherited from - -[SentTx](contract.SentTx.md).[getVisibleNotes](contract.SentTx.md#getvisiblenotes) - -___ - -### wait - -▸ **wait**(`opts?`): `Promise`\<[`DeployTxReceipt`](../modules/contract.md#deploytxreceipt)\<`TContract`\>\> - -Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`DeployedWaitOpts`](../modules/contract.md#deployedwaitopts) | Options for configuring the waiting for the tx to be mined. | - -#### Returns - -`Promise`\<[`DeployTxReceipt`](../modules/contract.md#deploytxreceipt)\<`TContract`\>\> - -The transaction receipt with the deployed contract instance. - -#### Overrides - -[SentTx](contract.SentTx.md).[wait](contract.SentTx.md#wait) - -___ - -### waitForReceipt - -▸ **waitForReceipt**(`opts?`): `Promise`\<`TxReceipt`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | [`WaitOpts`](../modules/contract.md#waitopts) | - -#### Returns - -`Promise`\<`TxReceipt`\> - -#### Inherited from - -[SentTx](contract.SentTx.md).[waitForReceipt](contract.SentTx.md#waitforreceipt) diff --git a/docs/docs/apis/aztec-js/classes/contract.SentTx.md b/docs/docs/apis/aztec-js/classes/contract.SentTx.md deleted file mode 100644 index accede6ccfb4..000000000000 --- a/docs/docs/apis/aztec-js/classes/contract.SentTx.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -id: "contract.SentTx" -title: "Class: SentTx" -sidebar_label: "SentTx" -custom_edit_url: null ---- - -[contract](../modules/contract.md).SentTx - -The SentTx class represents a sent transaction through the PXE, providing methods to fetch -its hash, receipt, and mining status. - -## Hierarchy - -- **`SentTx`** - - ↳ [`DeploySentTx`](contract.DeploySentTx.md) - -## Constructors - -### constructor - -• **new SentTx**(`pxe`, `txHashPromise`): [`SentTx`](contract.SentTx.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `pxe` | `PXE` | -| `txHashPromise` | `Promise`\<`TxHash`\> | - -#### Returns - -[`SentTx`](contract.SentTx.md) - -## Properties - -### pxe - -• `Protected` **pxe**: `PXE` - -___ - -### txHashPromise - -• `Protected` **txHashPromise**: `Promise`\<`TxHash`\> - -## Methods - -### getReceipt - -▸ **getReceipt**(): `Promise`\<`TxReceipt`\> - -Retrieve the transaction receipt associated with the current SentTx instance. -The function fetches the transaction hash using 'getTxHash' and then queries -the PXE to get the corresponding transaction receipt. - -#### Returns - -`Promise`\<`TxReceipt`\> - -A promise that resolves to a TxReceipt object representing the fetched transaction receipt. - -___ - -### getTxHash - -▸ **getTxHash**(): `Promise`\<`TxHash`\> - -Retrieves the transaction hash of the SentTx instance. -The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash. - -#### Returns - -`Promise`\<`TxHash`\> - -A promise that resolves to the transaction hash of the SentTx instance. - -___ - -### getUnencryptedLogs - -▸ **getUnencryptedLogs**(): `Promise`\<`GetUnencryptedLogsResponse`\> - -Gets unencrypted logs emitted by this tx. - -#### Returns - -`Promise`\<`GetUnencryptedLogsResponse`\> - -The requested logs. - -**`Remarks`** - -This function will wait for the tx to be mined if it hasn't been already. - -___ - -### getVisibleNotes - -▸ **getVisibleNotes**(): `Promise`\<`ExtendedNote`[]\> - -Get notes of accounts registered in the provided PXE/Wallet created in this tx. - -#### Returns - -`Promise`\<`ExtendedNote`[]\> - -The requested notes. - -**`Remarks`** - -This function will wait for the tx to be mined if it hasn't been already. - -___ - -### wait - -▸ **wait**(`opts?`): `Promise`\<`FieldsOf`\<`TxReceipt`\>\> - -Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `opts?` | [`WaitOpts`](../modules/contract.md#waitopts) | Options for configuring the waiting for the tx to be mined. | - -#### Returns - -`Promise`\<`FieldsOf`\<`TxReceipt`\>\> - -The transaction receipt. - -___ - -### waitForReceipt - -▸ **waitForReceipt**(`opts?`): `Promise`\<`TxReceipt`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `opts?` | [`WaitOpts`](../modules/contract.md#waitopts) | - -#### Returns - -`Promise`\<`TxReceipt`\> diff --git a/docs/docs/apis/aztec-js/index.md b/docs/docs/apis/aztec-js/index.md deleted file mode 100644 index e216053ba626..000000000000 --- a/docs/docs/apis/aztec-js/index.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -id: "index" -title: "@aztec/aztec.js" -sidebar_label: "Readme" -sidebar_position: 0 -custom_edit_url: null ---- - -# Aztec.js - -Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](https://docs.aztec.network/apis/pxe/interfaces/PXE) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions. - -## Installing - -``` -npm install @aztec/aztec.js -``` - -## Usage - -Use the `@aztec/accounts` package in order to create and manage accounts, and acquire a `Wallet` object needed to send transactions and interact with the network. - -### Deploy a contract - -```typescript -import { Contract } from '@aztec/aztec.js'; - -const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send().deployed(); -console.log(`Contract deployed at ${contract.address}`); -``` - -### Send a transaction - -```typescript -import { Contract } from '@aztec/aztec.js'; - -const contract = await Contract.at(contractAddress, MyContractArtifact, wallet); -const tx = await contract.methods.transfer(amount, recipientAddress).send().wait(); -console.log(`Transferred ${amount} to ${recipientAddress} on block ${tx.blockNumber}`); -``` - -### Simulate a function - -```typescript -import { Contract } from '@aztec/aztec.js'; - -const contract = await Contract.at(contractAddress, MyContractArtifact, wallet); -const balance = await contract.methods.get_balance(wallet.getAddress()).simulate(); -console.log(`Account balance is ${balance}`); -``` diff --git a/docs/docs/apis/aztec-js/interfaces/_category_.yml b/docs/docs/apis/aztec-js/interfaces/_category_.yml deleted file mode 100644 index 43bec88cfa0a..000000000000 --- a/docs/docs/apis/aztec-js/interfaces/_category_.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: "Interfaces" -position: 4 \ No newline at end of file diff --git a/docs/docs/apis/aztec-js/interfaces/account.AccountContract.md b/docs/docs/apis/aztec-js/interfaces/account.AccountContract.md deleted file mode 100644 index 1f8f86076318..000000000000 --- a/docs/docs/apis/aztec-js/interfaces/account.AccountContract.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -id: "account.AccountContract" -title: "Interface: AccountContract" -sidebar_label: "AccountContract" -custom_edit_url: null ---- - -[account](../modules/account.md).AccountContract - -An account contract instance. Knows its artifact, deployment arguments, how to create -transaction execution requests out of function calls, and how to authorize actions. - -## Methods - -### getAuthWitnessProvider - -▸ **getAuthWitnessProvider**(`address`): [`AuthWitnessProvider`](account.AuthWitnessProvider.md) - -Returns the auth witness provider for the given address. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `CompleteAddress` | Address for which to create auth witnesses. | - -#### Returns - -[`AuthWitnessProvider`](account.AuthWitnessProvider.md) - -___ - -### getContractArtifact - -▸ **getContractArtifact**(): `ContractArtifact` - -Returns the artifact of this account contract. - -#### Returns - -`ContractArtifact` - -___ - -### getDeploymentArgs - -▸ **getDeploymentArgs**(): `undefined` \| `any`[] - -Returns the deployment arguments for this instance, or undefined if this contract does not require deployment. - -#### Returns - -`undefined` \| `any`[] - -___ - -### getInterface - -▸ **getInterface**(`address`, `publicKeysHash`, `nodeInfo`): [`AccountInterface`](account.AccountInterface.md) - -Returns the account interface for this account contract given a deployment at the provided address. -The account interface is responsible for assembling tx requests given requested function calls, and -for creating signed auth witnesses given action identifiers (message hashes). - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `address` | `CompleteAddress` | Address where this account contract is deployed. | -| `publicKeysHash` | `Fr` | Hash of the public keys used to authorize actions. | -| `nodeInfo` | `NodeInfo` | Info on the chain where it is deployed. | - -#### Returns - -[`AccountInterface`](account.AccountInterface.md) - -An account interface instance for creating tx requests and authorizing actions. diff --git a/docs/docs/apis/aztec-js/interfaces/account.AccountInterface.md b/docs/docs/apis/aztec-js/interfaces/account.AccountInterface.md deleted file mode 100644 index 73c189d8b141..000000000000 --- a/docs/docs/apis/aztec-js/interfaces/account.AccountInterface.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -id: "account.AccountInterface" -title: "Interface: AccountInterface" -sidebar_label: "AccountInterface" -custom_edit_url: null ---- - -[account](../modules/account.md).AccountInterface - -Handler for interfacing with an account. Knows how to create transaction execution -requests and authorize actions for its corresponding account. - -## Hierarchy - -- [`AuthWitnessProvider`](account.AuthWitnessProvider.md) - -- `EntrypointInterface` - - ↳ **`AccountInterface`** - -## Methods - -### createAuthWit - -▸ **createAuthWit**(`messageHashOrIntent`): `Promise`\<`AuthWitness`\> - -Computes an authentication witness from either a message hash or an intent (caller and an action). -If a message hash is provided, it will create a witness for that directly. -Otherwise, it will compute the message hash using the caller and the action of the intent. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `messageHashOrIntent` | `Fr` \| `Buffer` \| \{ `action`: `FunctionCall` \| [`ContractFunctionInteraction`](../classes/contract.ContractFunctionInteraction.md) ; `caller`: `AztecAddress` ; `chainId?`: `Fr` ; `version?`: `Fr` } | The message hash or the intent (caller and action) to approve | - -#### Returns - -`Promise`\<`AuthWitness`\> - -The authentication witness - -#### Inherited from - -[AuthWitnessProvider](account.AuthWitnessProvider.md).[createAuthWit](account.AuthWitnessProvider.md#createauthwit) - -___ - -### createTxExecutionRequest - -▸ **createTxExecutionRequest**(`execution`): `Promise`\<`TxExecutionRequest`\> - -Generates an execution request out of set of function calls. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `execution` | `ExecutionRequestInit` | The execution intents to be run. | - -#### Returns - -`Promise`\<`TxExecutionRequest`\> - -The authenticated transaction execution request. - -#### Inherited from - -EntrypointInterface.createTxExecutionRequest - -___ - -### getAddress - -▸ **getAddress**(): `AztecAddress` - -Returns the address for this account. - -#### Returns - -`AztecAddress` - -___ - -### getChainId - -▸ **getChainId**(): `Fr` - -Returns the chain id for this account - -#### Returns - -`Fr` - -___ - -### getCompleteAddress - -▸ **getCompleteAddress**(): `CompleteAddress` - -Returns the complete address for this account. - -#### Returns - -`CompleteAddress` - -___ - -### getPublicKeysHash - -▸ **getPublicKeysHash**(): `Fr` - -Returns the public keys hash for this account. - -#### Returns - -`Fr` - -___ - -### getVersion - -▸ **getVersion**(): `Fr` - -Returns the rollup version for this account - -#### Returns - -`Fr` diff --git a/docs/docs/apis/aztec-js/interfaces/account.AuthWitnessProvider.md b/docs/docs/apis/aztec-js/interfaces/account.AuthWitnessProvider.md deleted file mode 100644 index 3823c4eeac2b..000000000000 --- a/docs/docs/apis/aztec-js/interfaces/account.AuthWitnessProvider.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -id: "account.AuthWitnessProvider" -title: "Interface: AuthWitnessProvider" -sidebar_label: "AuthWitnessProvider" -custom_edit_url: null ---- - -[account](../modules/account.md).AuthWitnessProvider - -Creates authorization witnesses. - -## Hierarchy - -- **`AuthWitnessProvider`** - - ↳ [`AccountInterface`](account.AccountInterface.md) - -## Methods - -### createAuthWit - -▸ **createAuthWit**(`messageHashOrIntent`): `Promise`\<`AuthWitness`\> - -Computes an authentication witness from either a message hash or an intent (caller and an action). -If a message hash is provided, it will create a witness for that directly. -Otherwise, it will compute the message hash using the caller and the action of the intent. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `messageHashOrIntent` | `Fr` \| `Buffer` \| \{ `action`: `FunctionCall` \| [`ContractFunctionInteraction`](../classes/contract.ContractFunctionInteraction.md) ; `caller`: `AztecAddress` ; `chainId?`: `Fr` ; `version?`: `Fr` } | The message hash or the intent (caller and action) to approve | - -#### Returns - -`Promise`\<`AuthWitness`\> - -The authentication witness diff --git a/docs/docs/apis/aztec-js/modules.md b/docs/docs/apis/aztec-js/modules.md deleted file mode 100644 index f7beffd6eb30..000000000000 --- a/docs/docs/apis/aztec-js/modules.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: "modules" -title: "@aztec/aztec.js" -sidebar_label: "Table of Contents" -sidebar_position: 0.5 -hide_table_of_contents: true -custom_edit_url: null ---- - -## Modules - -- [account](modules/account.md) -- [contract](modules/contract.md) diff --git a/docs/docs/apis/aztec-js/modules/_category_.yml b/docs/docs/apis/aztec-js/modules/_category_.yml deleted file mode 100644 index 63f9c4e40160..000000000000 --- a/docs/docs/apis/aztec-js/modules/_category_.yml +++ /dev/null @@ -1,2 +0,0 @@ -label: "Modules" -position: 1 \ No newline at end of file diff --git a/docs/docs/apis/aztec-js/modules/account.md b/docs/docs/apis/aztec-js/modules/account.md deleted file mode 100644 index 838c2f4cbd36..000000000000 --- a/docs/docs/apis/aztec-js/modules/account.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: "account" -title: "Module: account" -sidebar_label: "account" -sidebar_position: 0 -custom_edit_url: null ---- - -The `account` module provides utilities for managing accounts. The AccountManager class -allows to deploy and register a fresh account, or to obtain a `Wallet` instance out of an account -already deployed. Use the `@aztec/accounts` package to load default account implementations that rely -on ECDSA or Schnorr signatures. - -## Interfaces - -- [AccountContract](../interfaces/account.AccountContract.md) -- [AccountInterface](../interfaces/account.AccountInterface.md) -- [AuthWitnessProvider](../interfaces/account.AuthWitnessProvider.md) - -## Type Aliases - -### Salt - -Ƭ **Salt**: `Fr` \| `number` \| `bigint` - -A contract deployment salt. - -___ - -### Wallet - -Ƭ **Wallet**: [`AccountInterface`](../interfaces/account.AccountInterface.md) & `PXE` - -The wallet interface. diff --git a/docs/docs/apis/aztec-js/modules/contract.md b/docs/docs/apis/aztec-js/modules/contract.md deleted file mode 100644 index 217bb2fd1b73..000000000000 --- a/docs/docs/apis/aztec-js/modules/contract.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -id: "contract" -title: "Module: contract" -sidebar_label: "contract" -sidebar_position: 0 -custom_edit_url: null ---- - -The `contract` module provides utilities for deploying and interacting with contracts, based on a -`Wallet` instance and a compiled artifact. Refer to the [account](account.md) module for how to obtain a valid -`Wallet` instance, and to the [Compiling contracts](https://docs.aztec.network/developers/contracts/compiling) -section of the documentation for how to generate an artifact out of your Noir source code. - -The [Contract](../classes/contract.Contract.md) class is the main class in this module, and provides static methods for deploying -a contract or interacting with an already deployed one. The `methods` property of the contract instance -provides access to private, public, and simulate methods, that can be invoked in a transaction via `send()`, -or can be queried via `simulate()`. - -```ts -const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send().deployed(); -console.log(`Contract deployed at ${contract.address}`); -``` - -```ts -const contract = await Contract.at(address, MyContractArtifact, wallet); -await contract.methods.mint(1000, owner).send().wait(); -console.log(`Total supply is now ${await contract.methods.totalSupply().simulate()}`); -``` - -The result of calling a method in a contract instance, such as `contract.methods.mint(1000, owner)` -in the example, is a [ContractFunctionInteraction](../classes/contract.ContractFunctionInteraction.md) instance. Usually this will be just sent as -a transaction to the network via the `send` method, but you can also `simulate` it without sending, -or obtaining the `request` for aggregating into a [BatchCall](../classes/contract.BatchCall.md). - -The result of `send`ing a transaction is a [SentTx](../classes/contract.SentTx.md) object, from which you can get the -transaction hash, or simply `wait` until the transaction is mined and the local PXE Service -has synchronized its changes. - -**`Remarks`** - -If you are using typescript, consider using the -[autogenerated type-safe interfaces](https://docs.aztec.network/developers/contracts/compiling#typescript-interfaces) -for interacting with your contracts. - -## Classes - -- [BatchCall](../classes/contract.BatchCall.md) -- [Contract](../classes/contract.Contract.md) -- [ContractBase](../classes/contract.ContractBase.md) -- [ContractFunctionInteraction](../classes/contract.ContractFunctionInteraction.md) -- [DeployMethod](../classes/contract.DeployMethod.md) -- [DeploySentTx](../classes/contract.DeploySentTx.md) -- [SentTx](../classes/contract.SentTx.md) - -## Type Aliases - -### ContractMethod - -Ƭ **ContractMethod**: (...`args`: `any`[]) => [`ContractFunctionInteraction`](../classes/contract.ContractFunctionInteraction.md) & \{ `selector`: `FunctionSelector` } - -Type representing a contract method that returns a ContractFunctionInteraction instance -and has a readonly 'selector' property of type Buffer. Takes any number of arguments. - -___ - -### ContractNotes - -Ƭ **ContractNotes**\<`T`\>: \{ [K in T]: ContractNote } - -Type representing the notes used in a contract. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends `string` | - -___ - -### ContractStorageLayout - -Ƭ **ContractStorageLayout**\<`T`\>: \{ [K in T]: FieldLayout } - -Type representing the storage layout of a contract. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `T` | extends `string` | - -___ - -### DeployOptions - -Ƭ **DeployOptions**: \{ `contractAddressSalt?`: `Fr` ; `skipClassRegistration?`: `boolean` ; `skipInitialization?`: `boolean` ; `skipPublicDeployment?`: `boolean` ; `universalDeploy?`: `boolean` } & [`SendMethodOptions`](contract.md#sendmethodoptions) - -Options for deploying a contract on the Aztec network. -Allows specifying a contract address salt, and additional send method options. - -___ - -### DeployTxReceipt - -Ƭ **DeployTxReceipt**\<`TContract`\>: `FieldsOf`\<`TxReceipt`\> & \{ `contract`: `TContract` } - -Extends a transaction receipt with a contract instance that represents the newly deployed contract. - -#### Type parameters - -| Name | Type | -| :------ | :------ | -| `TContract` | extends [`ContractBase`](../classes/contract.ContractBase.md) = [`Contract`](../classes/contract.Contract.md) | - -___ - -### DeployedWaitOpts - -Ƭ **DeployedWaitOpts**: [`WaitOpts`](contract.md#waitopts) & \{ `wallet?`: [`Wallet`](account.md#wallet) } - -Options related to waiting for a deployment tx. - -___ - -### SendMethodOptions - -Ƭ **SendMethodOptions**: `Object` - -Represents options for calling a (constrained) function in a contract. -Allows the user to specify the sender address and nonce for a transaction. - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `fee?` | `FeeOptions` | The fee options for the transaction. | -| `skipPublicSimulation?` | `boolean` | Wether to skip the simulation of the public part of the transaction. | - -___ - -### SimulateMethodOptions - -Ƭ **SimulateMethodOptions**: `Object` - -Represents the options for simulating a contract function interaction. -Allows specifying the address from which the view method should be called. -Disregarded for simulation of public functions - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `from?` | `AztecAddress` | The sender's Aztec address. | -| `gasSettings?` | `GasSettings` | Gas settings for the simulation. | - -___ - -### WaitOpts - -Ƭ **WaitOpts**: `Object` - -Options related to waiting for a tx. - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `debug?` | `boolean` | Whether to include information useful for debugging/testing in the receipt. | -| `dontThrowOnRevert?` | `boolean` | Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. | -| `interval?` | `number` | The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. | -| `timeout?` | `number` | The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. | -| `waitForNotesSync?` | `boolean` | Whether to wait for the PXE Service to sync all notes up to the block in which this tx was mined. If false, then any queries that depend on state set by this transaction may return stale data. Defaults to true. | - -## Variables - -### DefaultWaitOpts - -• `Const` **DefaultWaitOpts**: [`WaitOpts`](contract.md#waitopts) diff --git a/docs/docs/aztec/aztec/concepts/smart_contracts/contract_creation.md b/docs/docs/aztec/aztec/concepts/smart_contracts/contract_creation.md index ade22a7c6a78..5408c88f7124 100644 --- a/docs/docs/aztec/aztec/concepts/smart_contracts/contract_creation.md +++ b/docs/docs/aztec/aztec/concepts/smart_contracts/contract_creation.md @@ -326,4 +326,4 @@ Adds initial public state variables to the public data tree. ## Further reading -To see how to deploy a contract in practice, check out the [dapp development tutorial](/tutorials/tutorials/contract_tutorials/advanced/simple_dapp). +To see how to deploy a contract in practice, check out the [dapp development tutorial](/tutorials/tutorials/simple_dapp). diff --git a/docs/docs/misc/glossary/call_types.md b/docs/docs/misc/glossary/call_types.md deleted file mode 100644 index 3de6d61d8344..000000000000 --- a/docs/docs/misc/glossary/call_types.md +++ /dev/null @@ -1,177 +0,0 @@ ---- -## title: Call Types ---- - -# Understanding Call Types - -## What is a Call - -We say that a smart contract is called when one of its functions is invoked and its code is run. This means there'll be: - -- a caller -- arguments -- return values -- a call status (successful or failed) - -There are multiple types of calls, and some of the naming can make things **very** confusing. This page lists the different call types and execution modes, pointing out key differences between them. - -## Ethereum Call Types - -Even though we're discussing Aztec, its design is heavily influenced by Ethereum and many of the APIs and concepts are quite similar. It is therefore worthwhile to briefly review how things work there and what naming conventions are used to provide context to the Aztec-specific concepts. - -Broadly speaking, Ethereum contracts can be thought of as executing as a result of three different things: running certain EVM opcodes, running Solidity code (which compiles to EVM opcodes), or via the node JSON-RPC interface (e.g. when executing transactions). - -### EVM - -Certain opcodes allow contracts to make calls to other contracts, each with different semantics. We're particularly interested in `CALL` and `STATICCALL`, and how those relate to contract programming languages and client APIs. - -#### `CALL` - -This is the most common and basic type of call. It grants execution control to the caller until it eventually returns. No special semantics are in play here. Most Ethereum transactions spend the majority of their time in `CALL` contexts. - -#### `STATICCALL` - -This behaves almost exactly the same as `CALL`, with one key difference: any state-changing operations are forbidden and will immediately cause the call to fail. This includes writing to storage, emitting logs, or deploying new contracts. This call is used to query state on an external contract, e.g. to get data from a price oracle, check for access control permissions, etc. - -#### Others - -The `CREATE` and `CREATE2` opcodes (for contract deployment) also result in something similar to a `CALL` context, but all that's special about them has to do with how deployments work. `DELEGATECALL` (and `CALLCODE`) are somewhat complicated to understand but don't have any Aztec equivalents, so they are not worth covering. - -### Solidity - -Solidity (and other contract programming languages such as Vyper) compile down to EVM opcodes, but it is useful to understand how they map language concepts to the different call types. - -#### Mutating External Functions - -These are functions marked `payable` (which can receive ETH, which is a state change) or with no mutability declaration (sometimes called `nonpayable`). When one of these functions is called on a contract, the `CALL` opcode is emitted, meaning the callee can perform state changes, make further `CALL`s, etc. - -It is also possible to call such a function with `STATICCALL` manually (e.g. using assembly), but the execution will fail as soon as a state-changing opcode is executed. - -#### `view` - -An external function marked `view` will not be able to mutate state (write to storage, etc.), it can only _view_ the state. Solidity will emit the `STATICCALL` opcode when calling these functions, since its restrictions provide added safety to the caller (e.g. no risk of reentrancy). - -Note that it is entirely possible to use `CALL` to call a `view` function, and the result will be the exact same as if `STATICCALL` had been used. The reason why `STATICCALL` exists is so that _untrusted or unknown_ contracts can be called while still being able to reason about correctness. From the [EIP](https://eips.ethereum.org/EIPS/eip-214): - -> '`STATICCALL` adds a way to call other contracts and restrict what they can do in the simplest way. It can be safely assumed that the state of all accounts is the same before and after a static call.' - -### JSON-RPC - -From outside the EVM, calls to contracts are made via [JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/) methods, typically from some client library that is aware of contract ABIs, such as [ethers.js](https://docs.ethers.org/v5) or [viem](https://viem.sh/). - -#### `eth_sendTransaction` - -This method is how transactions are sent to a node to get them to be broadcast and eventually included in a block. The specified `to` address will be called in a `CALL` context, with some notable properties: - -- there are no return values, even if the contract function invoked does return some data -- there is no explicit caller: it is instead derived from a provided signature - -Some client libraries choose to automatically issue `eth_sendTransaction` when calling functions from a contract ABI that are not marked as `view` - [ethers is a good example](https://docs.ethers.org/v5/getting-started/#getting-started--writing). Notably, this means that any return value is lost and not available to the calling client - the library typically returns a transaction receipt instead. If the return value is required, then the only option is to simulate the call `eth_call`. - -Note that it is possible to call non state-changing functions (i.e. `view`) with `eth_sendTransaction` - this is always meaningless. What transactions do is change the blockchain state, so all calling such a function achieves is for the caller to lose funds by paying for gas fees. The sole purpose of a `view` function is to return data, and `eth_sendTransaction` does not make the return value available. - -#### `eth_call` - -This method is the largest culprit of confusion around calls, but unfortunately requires understanding of all previous concepts in order to be explained. Its name is also quite unhelpful. - -What `eth_call` does is simulate a transaction (a call to a contract) given the current blockchain state. The behavior will be the exact same as `eth_sendTransaction`, except: - -- no actual transaction will be created -- while gas _will_ be measured, there'll be no transaction fees of any kind -- no signature is required: the `from` address is passed directly, and can be set to any value (even if the private key is unknown, or if they are contract addresses!) -- the return value of the called contract is available - -`eth_call` is typically used for one of the following: - -- query blockchain data, e.g. read token balances -- preview the state changes produced by a transaction, e.g. the transaction cost, token balance changes, etc - -Because some libraries ([such as ethers](https://docs.ethers.org/v5/getting-started/#getting-started--reading)) automatically use `eth_call` for `view` functions (which when called via Solidity result in the `STATICCALL` opcode), these concepts can be hard to tell apart. The following bears repeating: **an `eth_call`'s call context is the same as `eth_sendTransaction`, and it is a `CALL` context, not `STATICCALL`.** - -## Aztec Call Types - -Large parts of the Aztec Network's design are still not finalized, and the nitty-gritty of contract calls is no exception. This section won't therefore contain a thorough review of these, but rather list some of the main ways contracts can currently be interacted with, with analogies to Ethereum call types when applicable. - -While Ethereum contracts are defined by bytecode that runs on the EVM, Aztec contracts have multiple modes of execution depending on the function that is invoked. - -### Private Execution - -Contract functions marked with `#[aztec(private)]` can only be called privately, and as such 'run' in the user's device. Since they're circuits, their 'execution' is actually the generation of a zk-SNARK proof that'll later be sent to the sequencer for verification. - -#### Private Calls - -Private functions from other contracts can be called either regularly or statically by using the `.call()` and `.static_call` functions. They will also be 'executed' (i.e. proved) in the user's device, and `static_call` will fail if any state changes are attempted (like the EVM's `STATICCALL`). - -#include_code private_call /noir-projects/noir-contracts/contracts/lending_contract/src/main.nr rust - -Unlike the EVM however, private execution doesn't revert in the traditional way: in case of error (e.g. a failed assertion, a state changing operation in a static context, etc.) the proof generation simply fails and no transaction request is generated, spending no network gas or user funds. - -#### Public Calls - -Since public execution can only be performed by the sequencer, public functions cannot be executed in a private context. It is possible however to _enqueue_ a public function call during private execution, requesting the sequencer to run it during inclusion of the transaction. It will be [executed in public](#public-execution) normally, including the possibility to enqueue static public calls. - -Since the public call is made asynchronously, any return values or side effects are not available during private execution. If the public function fails once executed, the entire transaction is reverted inncluding state changes caused by the private part, such as new notes or nullifiers. Note that this does result in gas being spent, like in the case of the EVM. - -#include_code enqueue_public /noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr rust - -It is also possible to create public functions that can _only_ be invoked by privately enqueing a call from the same contract, which can very useful to update public state after private exection (e.g. update a token's supply after privately minting). This is achieved by annotating functions with `#[aztec(internal)]`. - -A common pattern is to enqueue public calls to check some validity condition on public state, e.g. that a deadline has not expired or that some public value is set. - -#include_code call-check-deadline /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr rust - -#include_code deadline /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr rust - -:::warning -Calling public functions privately leaks some privacy! The caller of the function and all arguments will be revelead, so exercise care when mixing the private and public domains. To learn about alternative ways to access public state privately, look into [Shared State](../../developers/contracts/references/storage/shared_state.md). -::: - -### Public Execution - -Contract functions marked with `#[aztec(public)]` can only be called publicly, and are executed by the sequencer. The computation model is very similar to the EVM: all state, parameters, etc. are known to the entire network, and no data is private. Static execution like the EVM's `STATICCALL` is possible too, with similar semantics (state can be accessed but not modified, etc.). - -Since private calls are always run in a user's device, it is not possible to perform any private execution from a public context. A reasonably good mental model for public execution is that of an EVM in which some work has already been done privately, and all that is know about it is its correctness and side-effects (new notes and nullifiers, enqueued public calls, etc.). A reverted public execution will also revert the private side-effects. - -Public functions in other contracts can be called both regularly and statically, just like on the EVM. - -#include_code public_call /noir-projects/noir-contracts/contracts/fpc_contract/src/main.nr rust - -:::note -This is the same function that was called by privately enqueuing a call to it! Public functions can be called either directly in a public context, or asynchronously by enqueuing in a private context. -::: - -### Top-level Unconstrained - -Contract functions with the `unconstrained` Noir keyword are a special type of function still under development, and their semantics will likely change in the near future. They are used to perform state queries from an off-chain client, and are never included in any transaction. No guarantees are made on the correctness of the result since they rely exclusively on unconstrained oracle calls. - -A reasonable mental model for them is that of a `view` Solidity function that is never called in any transaction, and is only ever invoked via `eth_call`. Note that in these the caller assumes that the node is acting honestly by exectuing the true contract bytecode with correct blockchain state, the same way the Aztec version assumes the oracles are returning legitimate data. - -### aztec.js - -There are three different ways to execute an Aztec contract function using the `aztec.js` library, with close similarities to their [JSON-RPC counterparts](#json-rpc). - -#### `simulate` - -This is used to get a result out of an execution, either private or public. It creates no transaction and spends no gas. The mental model is fairly close to that of [`eth_call`](#eth_call), in that it can be used to call any type of function, simulate its execution and get a result out of it. `simulate` is also the only way to run [top-level unconstrained functions](#top-level-unconstrained). - -#include_code public_getter /noir-projects/noir-contracts/contracts/auth_contract/src/main.nr rust - -#include_code simulate_public_getter yarn-project/end-to-end/src/e2e_auth_contract.test.ts typescript - -:::warning -No correctness is guaranteed on the result of `simulate`! Correct execution is entirely optional and left up to the client that handles this request. -::: - -#### `prove` - -This creates and returns a transaction request, which includes proof of correct private execution and side-efects. The request is not broadcast however, and no gas is spent. It is typically used in testing contexts to inspect transaction parameters or to check for execution failure. - -#include_code local-tx-fails /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript - -Like most Ethereum libraries, `prove` also simulates public execution to try to detect runtime errors that would only occur once the transaction is picked up by the sequencer. This makes `prove` very useful in testing environments, but users shuld be wary of both false positives and negatives in production environments, particularly if the node's data is stale. Public simulation can be skipped by setting the `skipPublicSimulation` flag. - -#### `send` - -This is the same as [`prove`](#prove) except it also broadcasts the transaction and returns a receipt. This is how transactions are sent, getting them to be included in blocks and spending gas. It is similar to [`eth_sendTransaction`](#eth_sendtransaction), except it also performs some work on the user's device, namely the production of the proof for the private part of the transaction. - -#include_code send_tx yarn-project/end-to-end/src/e2e_card_game.test.ts typescript diff --git a/docs/docs/misc/glossary/main.md b/docs/docs/misc/glossary/main.md deleted file mode 100644 index d8f95781507f..000000000000 --- a/docs/docs/misc/glossary/main.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Glossary ---- - -### Smart Contracts - -Programs that run on the Aztec network are called smart contracts, similar to [programs](https://ethereum.org/en/developers/docs/smart-contracts/) that run on Ethereum. - -However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](https://docs.aztec.network/aztec/how-it-works/private-smart-contracts). - -### Barretenberg - -Aztec's cryptography back-end. Refer to the graphic at the top of [this page](https://medium.com/aztec-protocol/explaining-the-network-in-aztec-network-166862b3ef7d) to see how it fits in the Aztec architecture. - -Barretenberg's source code can be found [here](https://github.com/AztecProtocol/barretenberg). - -### Sequencer - -Aztec will be launched with a fully permissionless sequencer network that anyone can participate in. - -How this works is being discussed actively in the [Discourse forum](https://discourse.aztec.network/t/request-for-proposals-decentralized-sequencer-selection/350/). Once this discussion process is completed, we will update the glossary and documentation with specifications and instructions for how to run. - -Sequencers are generally responsible for: - -- Selecting pending transactions from the mempool -- Ordering transactions into a block -- Verifying all private transaction proofs and execute all public transactions to check their validity -- Computing the ROLLUP_BLOCK_REQUEST_DATA -- Computing state updates for messages between L2 & L1 -- Broadcasting the ROLLUP_BLOCK_REQUEST_DATA to the prover network via the proof pool for parallelizable computation. -- Building a rollup proof from completed proofs in the proof pool -- Tagging the pending block with an upgrade signal to facilitate forks -- Publishing completed block with proofs to Ethereum as an ETH transaction - -Previously in [Aztec Connect](https://medium.com/aztec-protocol/sunsetting-aztec-connect-a786edce5cae) there was a single sequencer, and you can find the Typescript reference implementation called Falafel [here](https://github.com/AztecProtocol/aztec-connect/tree/master/yarn-project/falafel). - -### Provers - -Aztec will be launched with a fully permissionless proving network that anyone can participate in. - -How this works will be discussed via a future RFP process on Discourse, similarly to the Sequencer RFP. diff --git a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx index f9c19f693074..ae238ed0b415 100644 --- a/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx +++ b/docs/docs/protocol-specs/public-vm/gen/_instruction-set.mdx @@ -1126,7 +1126,6 @@ context.machineState.pc = loc`} - **Details**: Target location is an immediate value (a constant in the bytecode). - **Bit-size**: 48 -[![](/img/protocol-specs/public-vm/bit-formats/INTERNALCALL.png)](/img/protocol-specs/public-vm/bit-formats/INTERNALCALL.png) ### `INTERNALRETURN` Return from an internal call. Pop from the internal call stack and jump to the popped location. diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/private_voting_contract.md b/docs/docs/tutorials/tutorials/contract_tutorials/private_voting_contract.md index f766666eaa0e..10a211912d71 100644 --- a/docs/docs/tutorials/tutorials/contract_tutorials/private_voting_contract.md +++ b/docs/docs/tutorials/tutorials/contract_tutorials/private_voting_contract.md @@ -1,6 +1,6 @@ --- title: "Private voting contract" -sidebar_position: 1 +sidebar_position: 0 --- import Image from '@theme/IdealImage'; diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/token_contract.md b/docs/docs/tutorials/tutorials/contract_tutorials/token_contract.md index a89818afe5a6..18b32e3db9d4 100644 --- a/docs/docs/tutorials/tutorials/contract_tutorials/token_contract.md +++ b/docs/docs/tutorials/tutorials/contract_tutorials/token_contract.md @@ -1,6 +1,6 @@ --- title: "Private token contract" -sidebar_position: 0 +sidebar_position: 1 --- In this tutorial we will go through writing an L2 native token contract diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/contract_deployment.md b/docs/docs/tutorials/tutorials/simple_dapp/contract_deployment.md similarity index 100% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/contract_deployment.md rename to docs/docs/tutorials/tutorials/simple_dapp/contract_deployment.md diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/contract_interaction.md b/docs/docs/tutorials/tutorials/simple_dapp/contract_interaction.md similarity index 100% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/contract_interaction.md rename to docs/docs/tutorials/tutorials/simple_dapp/contract_interaction.md diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/index.md b/docs/docs/tutorials/tutorials/simple_dapp/index.md similarity index 98% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/index.md rename to docs/docs/tutorials/tutorials/simple_dapp/index.md index 4b8678d4c06f..7254d2e242d0 100644 --- a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/index.md +++ b/docs/docs/tutorials/tutorials/simple_dapp/index.md @@ -1,5 +1,5 @@ --- -title: Simple Dapp +title: Dapp Tutorial --- In this tutorial we'll go through the steps for building a simple application that interacts with the Aztec Sandbox. We'll be building a console application using Javascript and NodeJS, but you may reuse the same concepts here for a web-based app. All Aztec libraries are written in Typescript and fully typed, so you can use Typescript instead of Javascript to make the most out of its type checker. diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/project_setup.md b/docs/docs/tutorials/tutorials/simple_dapp/project_setup.md similarity index 100% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/project_setup.md rename to docs/docs/tutorials/tutorials/simple_dapp/project_setup.md diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/pxe_service.md b/docs/docs/tutorials/tutorials/simple_dapp/pxe_service.md similarity index 100% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/pxe_service.md rename to docs/docs/tutorials/tutorials/simple_dapp/pxe_service.md diff --git a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md b/docs/docs/tutorials/tutorials/simple_dapp/testing.md similarity index 89% rename from docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md rename to docs/docs/tutorials/tutorials/simple_dapp/testing.md index e24681e3daf2..bf9531ddeadc 100644 --- a/docs/docs/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md +++ b/docs/docs/tutorials/tutorials/simple_dapp/testing.md @@ -4,7 +4,7 @@ title: Testing To wrap up this tutorial, we'll set up a simple automated test for our dapp contracts. We will be using [jest](https://jestjs.io/), but any nodejs test runner works fine. -Here we'll only test the happy path for a `transfer` on our private token contract, but in a real application you should be testing both happy and unhappy paths, as well as both your contracts and application logic. Refer to the full [testing guide](/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md) for more info on testing and assertions. +Here we'll only test the happy path for a `transfer` on our private token contract, but in a real application you should be testing both happy and unhappy paths, as well as both your contracts and application logic. Refer to the full [testing guide](/tutorials/tutorials/simple_dapp/testing.md) for more info on testing and assertions. ## Dependencies @@ -46,7 +46,7 @@ Let's set up our test suite. We'll make sure the Sandbox is running, create two #include_code setup yarn-project/end-to-end/src/sample-dapp/index.test.mjs javascript :::tip -Instead of creating new accounts in our test suite, we can use the ones already initialized by the Sandbox upon startup. This can provide a speed boost to your tests setup. However, bear in mind that you may accidentally introduce an interdependency across test suites by reusing the same accounts. Read more [here](/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md#using-sandbox-initial-accounts). +Instead of creating new accounts in our test suite, we can use the ones already initialized by the Sandbox upon startup. This can provide a speed boost to your tests setup. However, bear in mind that you may accidentally introduce an interdependency across test suites by reusing the same accounts. Read more [here](/tutorials/tutorials/simple_dapp/testing.md#using-sandbox-initial-accounts). ::: ## Writing our test @@ -55,7 +55,7 @@ Now that we have a working test environment, we can write our first test for exe #include_code test yarn-project/end-to-end/src/sample-dapp/index.test.mjs javascript -In this example, we assert that the `recipient`'s balance is increased by the amount transferred. We could also test that the `owner`'s funds are decremented by the same amount, or that a transaction that attempts to send more funds than those available would fail. Check out the [testing guide](/tutorials/tutorials/contract_tutorials/advanced/simple_dapp/testing.md) for more ideas. +In this example, we assert that the `recipient`'s balance is increased by the amount transferred. We could also test that the `owner`'s funds are decremented by the same amount, or that a transaction that attempts to send more funds than those available would fail. Check out the [testing guide](/tutorials/tutorials/simple_dapp/testing.md) for more ideas. ## Running our tests