Skip to content

Commit 2f8ed08

Browse files
Copilotaviggiano
andcommitted
Condense batch transactions documentation to be more concise
Co-authored-by: aviggiano <[email protected]>
1 parent 55992c3 commit 2f8ed08

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

README.md

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -60,58 +60,19 @@ safe.proposeTransactionWithSignature(weth, abi.encodeCall(IWETH.withdraw, (0)),
6060

6161
#### Batch transactions
6262

63-
For proposing multiple transactions together, use `proposeTransactions`:
64-
6563
```solidity
66-
address[] memory targets = new address[](2);
67-
bytes[] memory datas = new bytes[](2);
68-
69-
targets[0] = address(contract1);
70-
datas[0] = abi.encodeCall(Contract1.someFunction, ());
71-
72-
targets[1] = address(contract2);
73-
datas[1] = abi.encodeCall(Contract2.anotherFunction, ());
74-
7564
safe.proposeTransactions(targets, datas, sender, "m/44'/60'/0'/0/0");
7665
```
7766

78-
If you need to pre-compute the signature for batch transactions (e.g., when using a Ledger), you must:
79-
80-
1. Get the target and data for the batch transaction using `getProposeTransactionsTargetAndData`:
67+
For pre-computed signatures with hardware wallets:
8168

8269
```solidity
8370
(address to, bytes memory data) = safe.getProposeTransactionsTargetAndData(targets, datas);
84-
```
85-
86-
2. Sign the transaction with `Enum.Operation.DelegateCall` (**NOT** `Call`):
87-
88-
```solidity
8971
bytes memory signature = safe.sign(to, data, Enum.Operation.DelegateCall, sender, "m/44'/60'/0'/0/0");
90-
```
91-
92-
3. Propose the transactions with the signature:
93-
94-
```solidity
9572
safe.proposeTransactionsWithSignature(targets, datas, sender, signature);
9673
```
9774

98-
**⚠️ CRITICAL**: Batch transactions **MUST** use `Enum.Operation.DelegateCall` to preserve `msg.sender` across sub-calls.
99-
100-
**Common Mistake**: If you sign with `Enum.Operation.Call` instead of `DelegateCall`, the Safe API will reject your transaction with an error about an incorrect signer address. The signer address reported in the error will not match your actual signing address because the signature will be invalid.
101-
102-
**Correct usage**:
103-
```solidity
104-
// ✓ CORRECT - Use DelegateCall for batch transactions
105-
bytes memory signature = safe.sign(to, data, Enum.Operation.DelegateCall, sender, derivationPath);
106-
safe.proposeTransactionsWithSignature(targets, datas, sender, signature);
107-
```
108-
109-
**Incorrect usage**:
110-
```solidity
111-
// ✗ WRONG - Using Call instead of DelegateCall will cause signature validation to fail
112-
bytes memory signature = safe.sign(to, data, Enum.Operation.Call, sender, derivationPath);
113-
safe.proposeTransactionsWithSignature(targets, datas, sender, signature);
114-
```
75+
**⚠️ Important**: Batch transactions require `Enum.Operation.DelegateCall` (not `Call`). Using `Call` causes signature validation errors.
11576

11677
### Requirements
11778

0 commit comments

Comments
 (0)