You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BEGIN_COMMIT_OVERRIDE
cherry-pick: feat: move event size check from declaration to private
emission (#22168)
fix: prevent oracle failure on tag computation for invalid recipient
(#22163)
feat: move event size check from declaration to private emission
(#22168) [v4-next backport] (#22182)
fix(cli-wallet): peek claim stack instead of popping for
estimate-gas-only (#22196)
fix: use Fr.fromString for CLI wallet claim params to handle decimal
values (#22197)
fix: indefinite retry for prover node and agent broker communication
(#22202)
END_COMMIT_OVERRIDE
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/aztec-js/how_to_create_account.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,13 @@ See the [guide on fees](./how_to_pay_fees.md#sponsored-fee-payment-contracts) fo
46
46
47
47
### Using Fee Juice
48
48
49
-
If your account already has Fee Juice (for example, [bridged from L1](./how_to_pay_fees.md#bridge-fee-juice-from-l1)):
49
+
If your account has Fee Juice from a [bridge from L1](./how_to_pay_fees.md#bridge-fee-juice-from-l1), you can claim it and deploy in one step using `FeeJuicePaymentMethodWithClaim`:
The `from: NO_FROM` signals that this transaction should be executed without account contract mediation. The wallet will directly execute it via a default entrypoint with no authorization
53
+
If the account already has Fee Juice on L2 (for example, from a faucet or a previously claimed bridge), no special payment method is needed — just call `send({ from: NO_FROM })` and Fee Juice is used automatically.
54
+
55
+
The `from: NO_FROM` signals that this transaction should be executed without account contract mediation. The wallet will directly execute it via a default entrypoint with no authorization.
The `estimatedGasPadding` parameter adds a safety margin to the estimate. A value of `0.1` adds 10% padding. Use higher padding for transactions with variable gas costs.
@@ -78,41 +65,19 @@ The `estimatedGasPadding` parameter adds a safety margin to the estimate. A valu
78
65
79
66
After a transaction is mined, you can retrieve the fee paid from the receipt:
If your account has Fee Juice (for example, from a faucet), is [deployed](./how_to_create_account.md), and is registered in your wallet, it will be used automatically to pay for the fee of the transaction:
106
79
107
-
```typescript
108
-
// contract is a deployed contract instance; aliceAddress is from the connection guide
Under the hood, `L1FeeJuicePortalManager` gets the L1 addresses from the node `node_getNodeInfo` endpoint. It then exposes an easy method `bridgeTokensPublic` which mints fee juice on L1 and sends it to an L2 address via the L1 portal:
172
122
173
-
```typescript
174
-
// portalManager is from the L1FeeJuicePortalManager setup above
175
-
// aliceAddress is an Aztec address from the connection guide
Note that `gasLimits` and `teardownGasLimits` use `daGas`/`l2Gas` field names, while `maxFeesPerGas` and `maxPriorityFeesPerGas` use `feePerDaGas`/`feePerL2Gas`.
238
153
239
154
### Use automatic gas estimation
240
155
241
156
:::note
242
157
When using `EmbeddedWallet`, gas estimation happens automatically on every `send()` — you don't need to pass `estimateGas`. This option is useful for custom wallet implementations or when you want to estimate gas during a `simulate()` call.
243
158
:::
244
159
245
-
```typescript
246
-
// contract, aliceAddress, and paymentMethod are from the examples above
Gas estimation runs a simulation first to determine actual gas usage, then adds padding for safety. This works with all payment methods, including FPCs.
The `from` option specifies which address context to use for the simulation. This is required for all simulations, though it only affects private function execution (public functions ignore this value).
The `from` option specifies which account context to use for the simulation. This is required for all simulations. For private functions, it determines which account's private state is accessed. For public functions, it sets the `msg_sender` context.
28
24
29
25
### Handling return values
30
26
31
27
For functions returning multiple values, destructure the result:
32
28
33
29
```typescript
34
30
// contract and callerAddress are from the example above
The result includes `result` (the function return value), `stats` (execution statistics), `offchainEffects`, and `estimatedGas` (with `gasLimits` and `teardownGasLimits`).
59
43
60
44
### Private function considerations
61
45
62
46
When simulating private functions, the caller must have access to any private state being read. The PXE only has visibility into notes belonging to registered accounts.
63
47
64
-
```typescript
65
-
// contract and callerAddress are from the examples above
// This fails if callerAddress doesn't have access to otherAddress's notes
72
-
const otherBalance =awaitcontract.methods
73
-
.balance_of_private(otherAddress)
74
-
.simulate({ from: callerAddress }); // Error: cannot access private state
75
-
```
50
+
If the caller doesn't have access to another address's notes, the simulation will fail with an error.
76
51
77
52
:::warning
78
53
Simulation runs locally without generating proofs. No correctness guarantees are provided on the result. See [Call Types](../foundational-topics/call_types.md#simulate) for more details.
@@ -95,20 +70,11 @@ Contracts emit data in two forms you can read:
95
70
96
71
Use `aztecNode.getPublicLogs()` to retrieve raw log data:
97
72
98
-
```typescript
99
-
// aztecNode is from createAztecNodeClient() in the connection guide
The `from` field specifies which account sends the transaction. If that account has Fee Juice, it pays for the transaction automatically. For other fee payment options, see [paying fees](./how_to_pay_fees.md).
46
33
@@ -53,9 +40,7 @@ When using `EmbeddedWallet`, calling `send()` triggers a **simulation** step bef
53
40
54
41
This means a simple `.send()` is all most apps need. You can adjust the gas padding if desired:
55
42
56
-
```typescript
57
-
wallet.setEstimatedGasPadding(0.2); // 20% padding instead of the default 10%
Public authwits still need to be set explicitly before the transaction, as they require a separate onchain transaction. See [Using Authentication Witnesses](./how_to_use_authwit.md) for details.
@@ -85,7 +70,7 @@ After sending a transaction without waiting, you can query its receipt using the
85
70
86
71
The receipt includes:
87
72
88
-
-`status` - Transaction status (`success`, `reverted`, `dropped`, or `pending`)
73
+
-`status` - Transaction status (`pending`, `proposed`, `checkpointed`, `proven`, `finalized`, or `dropped`)
89
74
-`blockNumber` - Block where the transaction was included
90
75
-`transactionFee` - Fee paid for the transaction
91
76
-`error` - Error message if the transaction reverted
0 commit comments