'is there a way to write these python codes for a transaction created, having a constructor? i get a syntax error with these

transaction = SimpleStorage.constructor{}.buildTransaction(
    ("chainId": chain_id, "from": my_address, "nonce": nonce)
    )
print(transaction)


Solution 1:[1]

That's correct syntax for web3.py:

transaction = SimpleStorage.constructor().buildTransaction({
    'chainId': chain_id,
    'from': my_address,
    'nonce': nonce
})

However by using brownie you can manage, test and deploy smart contracts in more comfortable way than web3.py

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kj-crypto