diff --git a/docs/source/conf.py b/docs/source/conf.py
index ef678456d..538fdb943 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -19,8 +19,8 @@
# -- Project information -----------------------------------------------------
project = "Safe-eth-py"
-copyright = "2018-2023"
-author = "Uxio, Moisés"
+copyright = "2018-2024"
+author = "Uxio, Moisés, Felipe"
# -- General configuration ---------------------------------------------------
diff --git a/docs/source/gnosis.eth.clients.rst b/docs/source/gnosis.eth.clients.rst
index 8c8574420..b13e32f27 100644
--- a/docs/source/gnosis.eth.clients.rst
+++ b/docs/source/gnosis.eth.clients.rst
@@ -20,6 +20,14 @@ gnosis.eth.clients.contract\_metadata module
:undoc-members:
:show-inheritance:
+gnosis.eth.clients.ens\_client module
+-------------------------------------------
+
+.. automodule:: gnosis.eth.clients.ens_client
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
gnosis.eth.clients.etherscan\_client module
-------------------------------------------
diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst
index 063f71552..28dc49af8 100644
--- a/docs/source/quickstart.rst
+++ b/docs/source/quickstart.rst
@@ -70,6 +70,15 @@ You can modify timeouts (in seconds) for the RPC endpoints by setting
By default every RPC request will be retried `3` times. You can modify that by setting `ETHEREUM_RPC_RETRY_COUNT`.
+gnosis.eth.clients
+~~~~~~~~~~
+
+You can modify timeouts (in seconds) for the gnosis.eth.clients by setting the following environment variables:
+
+- ``class EnsClient``: `ENS_CLIENT_REQUEST_TIMEOUT`.
+- ``class EtherscanClient``: `ETHERSCAN_CLIENT_REQUEST_TIMEOUT`.
+- ``class SourcifyClient``: `SOURCIFY_CLIENT_REQUEST_TIMEOUT`.
+
gnosis.eth.constants
~~~~~~~~~~~~~~~~~~~~
- ``NULL_ADDRESS (0x000...0)``: Solidity ``address(0)``.
@@ -160,7 +169,7 @@ Gnosis Products
---------------
Safe
~~~~
-On ``gnosis.safe`` there're classes to work with `Gnosis Safe `_
+On ``gnosis.safe`` there're classes to work with `Safe `_
.. code-block:: python
@@ -182,6 +191,21 @@ To work with Multisig Transactions:
safe_tx.call() # Check it works
safe_tx.execute(tx_sender_private_key)
+To interact with the Transaction Service API:
+
+.. code-block:: python
+
+ from gnosis.eth import EthereumClient
+ from gnosis.safe import Safe
+ ethereum_client = EthereumClient(ETHEREUM_NODE_URL)
+ transaction_service_api = TransactionServiceApi(
+ network=EthereumNetwork.SEPOLIA,
+ ethereum_client=ethereum_client
+ )
+ delegates_for_safe = transaction_service_api.get_delegates(SAFE_ADDRESS)
+
+You can modify the request timeout (in seconds) by setting `SAFE_TRANSACTION_SERVICE_REQUEST_TIMEOUT` as environment variable.
+
CowSwap
~~~~~~~~
On ``gnosis.cowswap`` there're classes to work with `CowSwap `_
diff --git a/gnosis/eth/clients/ens_client.py b/gnosis/eth/clients/ens_client.py
index 5cbb48c3b..9f6df7b27 100644
--- a/gnosis/eth/clients/ens_client.py
+++ b/gnosis/eth/clients/ens_client.py
@@ -1,3 +1,4 @@
+import os
from typing import Any, Dict, List, Optional, Union
import requests
@@ -22,7 +23,9 @@ def __init__(self, network_id: int):
else: # Fallback to mainnet
url = "https://api.thegraph.com/subgraphs/name/ensdomains/ens/"
self.url = url
- self.request_timeout = 5 # Seconds
+ self.request_timeout = int(
+ os.environ.get("ENS_CLIENT_REQUEST_TIMEOUT", 5)
+ ) # Seconds
self.request_session = requests.Session()
def is_available(self) -> bool:
diff --git a/gnosis/eth/clients/etherscan_client.py b/gnosis/eth/clients/etherscan_client.py
index 00563fde6..43ad903a7 100644
--- a/gnosis/eth/clients/etherscan_client.py
+++ b/gnosis/eth/clients/etherscan_client.py
@@ -1,4 +1,5 @@
import json
+import os
import time
from typing import Any, Dict, Optional
from urllib.parse import urljoin
@@ -115,7 +116,9 @@ def __init__(
self,
network: EthereumNetwork,
api_key: Optional[str] = None,
- request_timeout: int = 10,
+ request_timeout: int = int(
+ os.environ.get("ETHERSCAN_CLIENT_REQUEST_TIMEOUT", 10)
+ ),
):
self.network = network
self.api_key = api_key
diff --git a/gnosis/eth/clients/sourcify_client.py b/gnosis/eth/clients/sourcify_client.py
index 1ce8ad9ec..2709477b5 100644
--- a/gnosis/eth/clients/sourcify_client.py
+++ b/gnosis/eth/clients/sourcify_client.py
@@ -1,3 +1,4 @@
+import os
from typing import Any, Dict, List, Optional
from urllib.parse import urljoin
@@ -34,7 +35,9 @@ def __init__(
network: EthereumNetwork = EthereumNetwork.MAINNET,
base_url_api: str = "https://sourcify.dev",
base_url_repo: str = "https://repo.sourcify.dev/",
- request_timeout: int = 10,
+ request_timeout: int = int(
+ os.environ.get("SOURCIFY_CLIENT_REQUEST_TIMEOUT", 10)
+ ),
):
self.network = network
self.base_url_api = base_url_api
diff --git a/gnosis/safe/api/transaction_service_api/transaction_service_api.py b/gnosis/safe/api/transaction_service_api/transaction_service_api.py
index 7cb1c1851..73c3934fe 100644
--- a/gnosis/safe/api/transaction_service_api/transaction_service_api.py
+++ b/gnosis/safe/api/transaction_service_api/transaction_service_api.py
@@ -1,11 +1,12 @@
import logging
+import os
from typing import Any, Dict, List, Optional, Tuple, Union
from eth_account.signers.local import LocalAccount
from eth_typing import ChecksumAddress, HexStr
from hexbytes import HexBytes
-from gnosis.eth import EthereumNetwork
+from gnosis.eth import EthereumClient, EthereumNetwork
from gnosis.eth.utils import fast_keccak_text
from gnosis.safe import SafeTx
@@ -35,6 +36,17 @@ class TransactionServiceApi(SafeBaseAPI):
EthereumNetwork.ZKSYNC_MAINNET: "https://safe-transaction-zksync.safe.global",
}
+ def __init__(
+ self,
+ network: EthereumNetwork,
+ ethereum_client: Optional[EthereumClient] = None,
+ base_url: Optional[str] = None,
+ request_timeout: int = int(
+ os.environ.get("SAFE_TRANSACTION_SERVICE_REQUEST_TIMEOUT", 10)
+ ),
+ ):
+ super().__init__(network, ethereum_client, base_url, request_timeout)
+
@classmethod
def create_delegate_message_hash(cls, delegate_address: ChecksumAddress) -> str:
return fast_keccak_text(get_delegate_message(delegate_address))