forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): DIP1 - Extracting how-tos (AztecProtocol#4251)
Closes AztecProtocol/dev-rel#110 Closes AztecProtocol#3282 Closes AztecProtocol/dev-rel#114 Closes AztecProtocol/dev-rel#116 --------- Co-authored-by: Cat McGee <catmcgee@Cats-MacBook-Pro.local>
- Loading branch information
Showing
92 changed files
with
1,468 additions
and
989 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: How to Call a View Function | ||
--- | ||
|
||
This guide explains how to call a `view` function using [Aztec.js](../main.md). | ||
|
||
To do this from the CLI, go [here](../../sandbox/references/cli-commands.md#calling-an-unconstrained-view-function). | ||
|
||
```typescript | ||
import { Contract } from "@aztec/aztec.js"; | ||
|
||
const contract = await Contract.at(contractAddress, MyContractArtifact, wallet); | ||
const balance = await contract.methods.getBalance(wallet.getAddress()).view(); | ||
console.log(`Account balance is ${balance}`); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: How to Create a New Account | ||
--- | ||
|
||
This guide explains how to create a new account using [Aztec.js](../main.md). | ||
|
||
To do this from the CLI, go [here](../../sandbox/references/cli-commands.md#creating-accounts). | ||
|
||
```typescript | ||
import { getSchnorrAccount } from "@aztec/aztec.js"; | ||
import { GrumpkinPrivateKey } from "@aztec/circuit-types"; | ||
|
||
const encryptionPrivateKey = GrumpkinPrivateKey.random(); | ||
const signingPrivateKey = GrumpkinPrivateKey.random(); | ||
const wallet = getSchnorrAccount( | ||
pxe, | ||
encryptionPrivateKey, | ||
signingPrivateKey | ||
).waitDeploy(); | ||
console.log(`New account deployed at ${wallet.getAddress()}`); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: How to Deploy a Contract | ||
--- | ||
|
||
This guide explains how to deploy a smart contract using [Aztec.js](../main.md). | ||
|
||
To do this from the CLI, go [here](../../sandbox/references/cli-commands.md#deploying-a-token-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}`); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: How to Send a Transaction | ||
--- | ||
|
||
This guide explains how to send a transaction using [Aztec.js](../main.md). | ||
|
||
To do this from the CLI, go [here](../../sandbox/references/cli-commands.md#sending-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}` | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.