-
Notifications
You must be signed in to change notification settings - Fork 598
refactor: TestWallet API cleanup pt. 1 #17283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,7 +208,7 @@ Generates a secret key and deploys an account contract. Uses a Schnorr single-ke | |
| - `--skip-initialization`: Skip initializing the account contract. Useful for publicly deploying an existing account. | ||
| - `--public-deploy`: Publishes the account contract instance (and the class, if needed). Needed if the contract contains public functions. | ||
| - `-p, --public-key <string>`: Public key that identifies a private signing key stored outside of the wallet. Used for ECDSA SSH accounts over the secp256r1 curve. | ||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080") | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot to update in the last PR. These references seems like a pretty bad thing to have given that |
||
| - `-sk, --secret-key <string>`: Secret key for account. Uses random by default. (env: `SECRET_KEY`) | ||
| - `-a, --alias <string>`: Alias for the account. Used for easy reference in subsequent commands. | ||
| - `-t, --type <string>`: Type of account to create (choices: "schnorr", "ecdsasecp256r1", "ecdsasecp256r1ssh", "ecdsasecp256k1", default: "schnorr") | ||
|
|
@@ -247,7 +247,7 @@ aztec-wallet deploy-account [options] | |
| #### Options | ||
|
|
||
| - `-f, --from <string>`: Alias or address of the account to deploy | ||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--json`: Emit output as json | ||
| - `--no-wait`: Skip waiting for the contract to be deployed. Print the hash of deployment transaction | ||
| - `--register-class`: Register the contract class (useful for when the contract class has not been deployed yet) | ||
|
|
@@ -306,7 +306,7 @@ aztec-wallet deploy [options] [artifact] | |
| - `-k, --public-key <string>`: Optional encryption public key for this address. Set this value only if this contract is expected to receive private notes, which will be encrypted using this public key | ||
| - `-s, --salt <hex string>`: Optional deployment salt as a hex string for generating the deployment address | ||
| - `--universal`: Do not mix the sender address into the deployment | ||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Constructor arguments (default: []) | ||
| - `-sk, --secret-key <string>`: The sender's secret key (env: `SECRET_KEY`) | ||
| - `-f, --from <string>`: Alias or address of the account to deploy from | ||
|
|
@@ -358,7 +358,7 @@ aztec-wallet register-contract [options] [address] [artifact] | |
| - `-s, --salt <hex string>`: Optional deployment salt as a hex string for generating the deployment address | ||
| Sends a transaction by calling a function on an Aztec contract. | ||
| - `--args [args...]`: Constructor arguments (default: []) | ||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-f, --from <string>`: Alias or address of the account to simulate from | ||
| - `-a, --alias <string>`: Alias for the contact. Used for easy reference in subsequent commands | ||
|
|
||
|
|
@@ -382,7 +382,7 @@ aztec-wallet send [options] <functionName> | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Function arguments (default: []) | ||
| - `-c, --contract-artifact <fileLocation>`: Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract | ||
| - `-ca, --contract-address <address>`: Aztec address of the contract | ||
|
|
@@ -435,7 +435,7 @@ aztec-wallet simulate [options] <functionName> | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Function arguments (default: []) | ||
| - `-ca, --contract-address <address>`: Aztec address of the contract | ||
| - `-c, --contract-artifact <fileLocation>`: Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract | ||
|
|
@@ -463,7 +463,7 @@ aztec-wallet profile [options] <functionName> | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Function arguments (default: []) | ||
| - `-ca, --contract-address <address>`: Aztec address of the contract | ||
| - `-c, --contract-artifact <fileLocation>`: Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract | ||
|
|
@@ -493,7 +493,7 @@ aztec-wallet create-authwit [options] <functionName> <caller> | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Function arguments (default: []) | ||
| - `-ca, --contract-address <address>`: Aztec address of the contract | ||
| - `-c, --contract-artifact <fileLocation>`: Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract | ||
|
|
@@ -530,7 +530,7 @@ aztec-wallet authorize-action [options] <functionName> <caller> | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `--args [args...]`: Function arguments (default: []) | ||
| - `-ca, --contract-address <address>`: Aztec address of the contract | ||
| - `-c, --contract-artifact <fileLocation>`: Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract | ||
|
|
@@ -570,7 +570,7 @@ aztec-wallet bridge-fee-juice [options] <amount> <recipient> | |
| - `-m, --mnemonic <string>`: The mnemonic to use for deriving the Ethereum address that will mint and bridge (default: "test test test test test test test test test test test junk") | ||
| - `--mint`: Mint the tokens on L1 (default: false) | ||
| - `--l1-private-key <string>`: The private key to the eth account bridging | ||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-c, --l1-chain-id <number>`: Chain ID of the ethereum host (default: 31337, env: `L1_CHAIN_ID`) | ||
| - `--json`: Output the claim in JSON format | ||
| - `--no-wait`: Wait for the bridged funds to be available in L2, polling every 60 seconds | ||
|
|
@@ -598,7 +598,7 @@ aztec-wallet get-tx [options] [txHash] | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-p, --page <number>`: The page number to display (default: 1) | ||
| - `-s, --page-size <number>`: The number of transactions to display per page (default: 10) | ||
|
|
||
|
|
@@ -662,7 +662,7 @@ aztec-wallet register-sender [options] [address] | |
|
|
||
| #### Options | ||
|
|
||
| - `-n, --node-url <string>`: URL of the PXE (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-n, --node-url <string>`: URL of Aztec Node (default: "http://host.docker.internal:8080", env: `AZTEC_NODE_URL`) | ||
| - `-f, --from <string>`: Alias or address of the account to simulate from | ||
| - `-a, --alias <string>`: Alias for the sender. Used for easy reference in subsequent commands | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,7 +142,7 @@ export class AccountManager { | |
| * @returns A Wallet instance. | ||
| */ | ||
| public async register(): Promise<AccountWithSecretKey> { | ||
| await this.pxe.registerContract({ | ||
| await this.wallet.registerContract({ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Random change when I was investigating what is remaining from allowing me to drop the ugly |
||
| artifact: await this.accountContract.getContractArtifact(), | ||
| instance: this.getInstance(), | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,20 +23,14 @@ export async function checkTx( | |
| const receipt = await aztecNode.getTxReceipt(txHash); | ||
| return receipt.status; | ||
| } else { | ||
| await inspectTx(wallet, aztecNode, txHash, log, { includeBlockInfo: true }); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just did a minor cleanup of this func. |
||
| await inspectTx(wallet, aztecNode, txHash, log); | ||
| } | ||
| } | ||
|
|
||
| // The rest of the code here was copied over here from CLI because in CLI I needed to prune the inspect function of the PXE | ||
| // dependency when dropping PXE JSON RPC Server. | ||
|
|
||
| async function inspectTx( | ||
| wallet: CLIWallet, | ||
| aztecNode: AztecNode, | ||
| txHash: TxHash, | ||
| log: LogFn, | ||
| opts: { includeBlockInfo?: boolean; artifactMap?: ArtifactMap } = {}, | ||
| ) { | ||
| async function inspectTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash, log: LogFn) { | ||
| const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]); | ||
| // Base tx data | ||
| log(`Tx ${txHash.toString()}`); | ||
|
|
@@ -50,11 +44,9 @@ async function inspectTx( | |
| } | ||
|
|
||
| const effects = effectsInBlock.data; | ||
| const artifactMap = opts?.artifactMap ?? (await getKnownArtifacts(wallet)); | ||
| const artifactMap = await getKnownArtifacts(wallet); | ||
|
|
||
| if (opts.includeBlockInfo) { | ||
| log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`); | ||
| } | ||
| log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`); | ||
| if (receipt.transactionFee) { | ||
| log(` Fee: ${receipt.transactionFee.toString()}`); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -444,14 +444,10 @@ export function injectCommands( | |
| const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js'); | ||
| const { l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options; | ||
|
|
||
| const wallet = walletAndNodeWrapper.wallet; | ||
| const node = walletAndNodeWrapper.node; | ||
|
|
||
| const [secret, messageLeafIndex] = await bridgeL1FeeJuice( | ||
| amount, | ||
| recipient, | ||
| wallet, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wallet no longer needs to be passed in as we can just obtain all the necessary info from node. |
||
| node, | ||
| walletAndNodeWrapper.node, | ||
| l1RpcUrls, | ||
| l1ChainId, | ||
| l1PrivateKey, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command doesn't exist on the cli.