I am trying to set a delegate with gnosis safe. The following code shows that we need to send a POST request with python3 to register a delegate with gnosis safe: https://safe-docs.dev.gnosisdev.com/safe/docs/tutorial_tx_service_set_delegate/ I have put the following code together in a script however i cannot get it to work
import requests
import time
import sha3
SAFE_ADDRESS = '*'
OWNER_PRIVATE_KEY = '*'
DELEGATE_ADDRESS = '*'
TX_SERVICE_BASE_URL = 'https://safe-transaction.rinkeby.gnosis.io'
totp = int(time.time()) // 3600
hash_to_sign = sha3.keccak_256(text=DELEGATE_ADDRESS + str(totp))
account = Account.from_key(OWNER_PRIVATE_KEY)
signature = account.signHash(hash_to_sign)
add_payload = {
"safe": SAFE_ADDRESS,
"delegate": DELEGATE_ADDRESS,
"signature": signature.signature.hex(),
"label": "My new delegate2"
}
print(list_response.text)
print(list_response.status_code)
when i run it i get this error: Traceback (most recent call last):
File "test.py", line 11, in <module>
hash_to_sign = sha3.keccak_256(text=DELEGATE_ADDRESS + str(totp))
TypeError: 'text' is an invalid keyword argument for sha3_224()
i've also tried to change keccak to 512 but its not working. How can i fix it?