ApeWorX / ApeWorX/web3.py

What DevEx improvements can we add for 7702 transaction interactions?

Open
#3,655 4 comments 0 reactions 0 assignees View on GitHub
Enhancement Help Wanted
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
2

Description

### What feature should we add?

EIP-7702 is working well with manual transaction signing via ethereum/eth-account#316. There are undoubtedly better ways to interact and build 7702 transactions than currently exist within web3.py. Today we must do something like:

(untested, pseudocode-ish)
```py
# get the contract of interest, as an example
contract = w3.eth.contract(address=contract_address, abi=contract_abi)

acct = Account.from_key(my_key)
signed_auth = acct.sign_authorization({
"address": contract.address,
"nonce": w3.eth.get_transaction_count(acct) + 1,
"chainId": w3.eth.chain_id,
})

# extract the data for the desired contract interaction
contract_call = contract.functions.myFunction(arg1, arg2).build_transaction()

tx = {
"to": acct.address,
...
"authorizationList": [signed_auth],
"data": contract_call["data"],
}
signed_tx = acct.sign_transaction(tx)

w3.eth.send_raw_transaction(signed_tx.raw_transaction)
```

The goal would be to improve the DevEx to build and send a 7702 transaction. I believe this likely has to exist at the *web3.py*, not the *eth-account* level, as we should have access to the web3 object to facilitate `eth_chainId`, `eth_getTransactionCount` (nonce), `eth_estimateGas` calls, contract call data collection, etc.

---

Loosely, if I have a known contract and ABI, I'd like to be able to say take this account, authorize this account to behave like that contract, and build my transaction with this auth inside the "authorlzationList" while making the first call to function A on the contract. It may also be better to have a builder where there can be many iterations of this to build a single transaction with many such auths.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.