diff --git a/yarn-project/cli/README.md b/yarn-project/cli/README.md index c3dd94eb054..08bc07e5f0a 100644 --- a/yarn-project/cli/README.md +++ b/yarn-project/cli/README.md @@ -308,12 +308,12 @@ aztec-cli get-account 0x123456789abcdef123456789abcdef12345678 ### send -Calls a function on an Aztec contract. +Sends a transaction invoking a function on an Aztec contract. Syntax: ```shell -aztec-cli call-fn [functionArgs...] [options] +aztec-cli send --args [functionArgs...] --contract-abi --contract-address --private-key ``` - `functionName`: Name of the function to call. @@ -334,14 +334,15 @@ Example usage: aztec-cli send transfer -ca 0x123456789abcdef123456789abcdef12345678 -a 100 -c path/to/abi.json ``` -### view-fn +### call -Simulates the execution of a view (read-only) function on a deployed contract, without modifying state. +Calls a view (read-only) function on a deployed contract. +Unlike transactions, view calls do not modify the state of the contract. Syntax: ```shell -aztec-cli call [functionArgs...] [options] +aztec-cli call -a [functionArgs...] -c -ca -f ``` - `functionName`: Name of the function to view. @@ -351,7 +352,7 @@ Options: - `'-a, --args [functionArgs...]` (optional): Function arguments. Default: []. - `-c, --contract-abi `: The compiled contract's ABI in JSON format. You can also use one of Aztec's example contracts found in (@aztec/noir-contracts)[https://www.npmjs.com/package/@aztec/noir-contracts], e.g. PrivateTokenContractAbi. - `-ca, --contract-address
`: Address of the contract. -- `-f, --from `: Public key of the transaction viewer. If empty, it will try to find an account in the RPC. +- `-f, --from `: Address of the caller. If empty, first account in the Aztec RPC Server will be used. - `-u, --rpc-url `: URL of the Aztec RPC. Default: `http://localhost:8080`. This command simulates the execution of a view function on a deployed contract without modifying the state. It requires the contract's ABI, address, function name, and optionally, function arguments. The command displays the result of the view function. diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index 86119a7a300..71e61409f65 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -410,7 +410,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", ) .requiredOption('-ca, --contract-address
', 'Aztec address of the contract.') - .option('-f, --from ', 'Public key of the TX viewer. If empty, will try to find account in RPC.') + .option('-f, --from ', 'Aztec address of the caller. If empty, will use the first account from RPC.') .option('-u, --rpc-url ', 'URL of the Aztec RPC', AZTEC_RPC_HOST || 'http://localhost:8080') .action(async (functionName, options) => { const { contractAddress, functionArgs, contractAbi } = await prepTx(