Skip to content

Commit c6f2923

Browse files
authored
chore: document cast send --auth and cast wallet sign-auth (EIP-7702) (#1441)
* add sign-auth reference * add --auth to cast send and cast wallet sign-auth docs
1 parent 3574884 commit c6f2923

File tree

2 files changed

+92
-35
lines changed

2 files changed

+92
-35
lines changed

src/reference/cast/cast-send.md

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ cast-send - Sign and publish a transaction.
66

77
### SYNOPSIS
88

9-
``cast send`` [*options*] *to* [*sig*] [*args...*]
9+
`cast send` [*options*] _to_ [*sig*] [*args...*]
1010

1111
### DESCRIPTION
1212

1313
Sign and publish a transaction.
1414

15-
The destination (*to*) can be an ENS name or an address.
15+
The destination (_to_) can be an ENS name or an address.
1616

1717
{{#include sig-description.md}}
1818

@@ -23,8 +23,18 @@ The destination (*to*) can be an ENS name or an address.
2323
`--resend`
2424
    Reuse the latest nonce of the sending account.
2525

26-
`--create` *code* [*sig* *args...*]
27-
    Deploy a contract by specifying raw bytecode, in place of specifying a *to* address.
26+
`--create` _code_ [*sig* *args...*]
27+
    Deploy a contract by specifying raw bytecode, in place of specifying a _to_ address.
28+
29+
`--auth` _auth_
30+
    EIP-7702 authorization list.
31+
32+
    Can be either a hex-encoded signed authorization or an address.
33+
34+
`--access-list` _access_list_
35+
    EIP-2930 access list.
36+
37+
    Accepts either a JSON-encoded access list or an empty value to create the access list via an RPC call to `eth_createAccessList`. To retrieve only the access list portion, use the `cast access-list` command.
2838

2939
#### Receipt Options
3040

@@ -33,8 +43,8 @@ The destination (*to*) can be an ENS name or an address.
3343
    Do not wait for the transaction receipt if it does not exist yet.
3444
    Environment: `CAST_ASYNC`
3545

36-
`-c` *confirmations*
37-
`--confirmations` *confirmations*
46+
`-c` _confirmations_
47+
`--confirmations` _confirmations_
3848
    Wait a number of confirmations before exiting. Default: `1`.
3949

4050
{{#include ../common/wallet-options.md}}
@@ -53,48 +63,51 @@ The destination (*to*) can be an ENS name or an address.
5363
### EXAMPLES
5464

5565
1. Send some ether to Vitalik using your Ledger:
56-
```sh
57-
cast send --ledger vitalik.eth --value 0.1ether
58-
```
66+
67+
```sh
68+
cast send --ledger vitalik.eth --value 0.1ether
69+
```
5970

6071
2. Call `deposit(address token, uint256 amount)` on a contract:
61-
```sh
62-
cast send --ledger 0x... "deposit(address,uint256)" 0x... 1
63-
```
72+
73+
```sh
74+
cast send --ledger 0x... "deposit(address,uint256)" 0x... 1
75+
```
6476

6577
3. Call a function that expects a `struct`:
6678

67-
```solidity
68-
contract Test {
69-
struct MyStruct {
70-
address addr;
71-
uint256 amount;
72-
}
73-
function myfunction(MyStruct memory t) public pure {}
74-
}
75-
```
79+
```solidity
80+
contract Test {
81+
struct MyStruct {
82+
address addr;
83+
uint256 amount;
84+
}
85+
function myfunction(MyStruct memory t) public pure {}
86+
}
87+
```
7688

77-
Structs are encoded as tuples (see [struct encoding](../../misc/struct-encoding.md))
89+
Structs are encoded as tuples (see [struct encoding](../../misc/struct-encoding.md))
7890

79-
```sh
80-
cast send 0x... "myfunction((address,uint256))" "(0x...,1)"
81-
```
91+
```sh
92+
cast send 0x... "myfunction((address,uint256))" "(0x...,1)"
93+
```
8294

8395
4. Send a transaction with hex data in the `input` field of the transaction object:
84-
```sh
85-
cast send 0x... 0x68656c6c6f20776f726c64
86-
```
96+
97+
```sh
98+
cast send 0x... 0x68656c6c6f20776f726c64
99+
```
87100

88101
5. Sign an EIP-7702 authorization and attach it to a transaction from a different sender:
89-
```sh
90-
cast send $(cast az) --private-key <sender-pk> --auth $(cast wallet sign-auth <address> --private-key <delegator-pk>)
91-
```
92102

93-
6. Send an EIP-7702 transaction delegating the sender to `<address>`:
94-
```sh
95-
cast send $(cast az) --auth <address>
96-
```
103+
```sh
104+
cast send $(cast az) --private-key <sender-pk> --auth $(cast wallet sign-auth <address> --private-key <delegator-pk>)
105+
```
97106

107+
6. Send an EIP-7702 transaction delegating the sender to `<address>`:
108+
```sh
109+
cast send $(cast az) --auth <address>
110+
```
98111

99112
### SEE ALSO
100113

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## cast wallet sign-auth
2+
3+
### NAME
4+
5+
cast-wallet-sign-auth - Sign an EIP-7702 authorization.
6+
7+
### SYNOPSIS
8+
9+
`cast wallet sign-auth` _address_
10+
11+
### DESCRIPTION
12+
13+
Sign an [EIP-7702](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md) authorization for an address.
14+
15+
Note that `sign-auth` uses the current nonce as it is not aware of whether you are going to broadcast the authorization from the same or a different sender.
16+
17+
If you are sending the transaction from the same address you will need to either pass the next nonce using the `--nonce` flag or alternatively use `cast send <to> --auth <address>` to sign and send directly.
18+
19+
### OPTIONS
20+
21+
{{#include ../common/wallet-options-raw.md}}
22+
23+
{{#include ../common/wallet-options-keystore.md}}
24+
25+
{{#include ../common/wallet-options-hardware.md}}
26+
27+
{{#include common-options.md}}
28+
29+
### EXAMPLES
30+
31+
1. Sign an EIP-7702 authorization using a keystore:
32+
33+
```sh
34+
cast wallet sign-auth 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keystore keystore.json --interactive
35+
```
36+
37+
2. Sign an EIP-7702 authorization using a raw private key:
38+
```sh
39+
cast wallet sign-auth 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --private-key $PRIV_KEY
40+
```
41+
42+
### SEE ALSO
43+
44+
[cast](./cast.md), [cast wallet](./cast-wallet.md)

0 commit comments

Comments
 (0)