Skip to content

Commit 0c74c01

Browse files
committed
Merge branch 'master' of github.com:safe-global/safe-eth-py
2 parents 8b20fdf + 8a80927 commit 0c74c01

27 files changed

+12821
-552
lines changed

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: "CLA Assistant"
1313
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
1414
# Beta Release
15-
uses: cla-assistant/github-action@v2.2.1
15+
uses: cla-assistant/github-action@v2.3.0
1616
env:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
# the below token should have repo scope and must be manually added by you in the repository's secret

gnosis/eth/clients/blockscout_client.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,46 @@ class BlockScoutConfigurationProblem(BlockscoutClientException):
1919

2020
class BlockscoutClient:
2121
NETWORK_WITH_URL = {
22-
EthereumNetwork.XDAI: "https://blockscout.com/poa/xdai/",
23-
EthereumNetwork.MATIC: "https://polygon-explorer-mainnet.chainstacklabs.com/",
22+
EthereumNetwork.GNOSIS: "https://blockscout.com/poa/xdai/",
23+
EthereumNetwork.POLYGON: "https://polygon-explorer-mainnet.chainstacklabs.com/",
2424
EthereumNetwork.MUMBAI: "https://polygon-explorer-mumbai.chainstacklabs.com/",
2525
EthereumNetwork.ENERGY_WEB_CHAIN: "https://explorer.energyweb.org/",
26-
EthereumNetwork.VOLTA: "https://volta-explorer.energyweb.org/",
27-
EthereumNetwork.OLYMPUS: "https://explorer.polis.tech",
28-
EthereumNetwork.BOBA_NETWORK_BOBABEAM: "https://blockexplorer.bobabeam.boba.network/",
29-
EthereumNetwork.BOBA_RINKEBY: "https://blockexplorer.rinkeby.boba.network/",
30-
EthereumNetwork.BOBA: "https://blockexplorer.boba.network/",
31-
EthereumNetwork.GATHER_DEVNET: "https://devnet-explorer.gather.network/",
32-
EthereumNetwork.GATHER_TESTNET: "https://testnet-explorer.gather.network/",
33-
EthereumNetwork.GATHER_MAINNET: "https://explorer.gather.network/",
34-
EthereumNetwork.METIS_TESTNET: "https://stardust-explorer.metis.io/",
26+
EthereumNetwork.ENERGY_WEB_VOLTA_TESTNET: "https://volta-explorer.energyweb.org/",
27+
EthereumNetwork.POLIS_MAINNET: "https://explorer.polis.tech",
28+
EthereumNetwork.BOBABEAM: "https://blockexplorer.bobabeam.boba.network/",
29+
EthereumNetwork.BOBA_NETWORK_RINKEBY_TESTNET: "https://blockexplorer.rinkeby.boba.network/",
30+
EthereumNetwork.BOBA_NETWORK: "https://blockexplorer.boba.network/",
31+
EthereumNetwork.GATHER_DEVNET_NETWORK: "https://devnet-explorer.gather.network/",
32+
EthereumNetwork.GATHER_TESTNET_NETWORK: "https://testnet-explorer.gather.network/",
33+
EthereumNetwork.GATHER_MAINNET_NETWORK: "https://explorer.gather.network/",
34+
EthereumNetwork.METIS_STARDUST_TESTNET: "https://stardust-explorer.metis.io/",
3535
EthereumNetwork.METIS_GOERLI_TESTNET: "https://goerli.explorer.metisdevops.link/",
36-
EthereumNetwork.METIS: "https://andromeda-explorer.metis.io/",
36+
EthereumNetwork.METIS_ANDROMEDA_MAINNET: "https://andromeda-explorer.metis.io/",
3737
EthereumNetwork.FUSE_MAINNET: "https://explorer.fuse.io/",
38-
EthereumNetwork.VELAS_MAINNET: "https://evmexplorer.velas.com/",
39-
EthereumNetwork.REI_MAINNET: "https://scan.rei.network/",
40-
EthereumNetwork.REI_TESTNET: "https://scan-test.rei.network/",
41-
EthereumNetwork.METER: "https://scan.meter.io/",
38+
EthereumNetwork.VELAS_EVM_MAINNET: "https://evmexplorer.velas.com/",
39+
EthereumNetwork.REI_NETWORK: "https://scan.rei.network/",
40+
EthereumNetwork.REI_CHAIN_TESTNET: "https://scan-test.rei.network/",
41+
EthereumNetwork.METER_MAINNET: "https://scan.meter.io/",
4242
EthereumNetwork.METER_TESTNET: "https://scan-warringstakes.meter.io/",
43-
EthereumNetwork.GODWOKEN_TESTNET: "https://v1.betanet.gwscan.com/",
44-
EthereumNetwork.GODWOKEN: "https://v1.gwscan.com/",
43+
EthereumNetwork.GODWOKEN_TESTNET_V1: "https://v1.betanet.gwscan.com/",
44+
EthereumNetwork.GODWOKEN_MAINNET: "https://v1.gwscan.com/",
4545
EthereumNetwork.VENIDIUM_TESTNET: "https://evm-testnet.venidiumexplorer.com/",
46-
EthereumNetwork.VENIDIUM: "https://evm.venidiumexplorer.com/",
47-
EthereumNetwork.KLAY_BAOBAB: "https://baobab.scope.klaytn.com/",
48-
EthereumNetwork.KLAY_CYPRESS: "https://scope.klaytn.com/",
49-
EthereumNetwork.ACA: "https://blockscout.acala.network/",
46+
EthereumNetwork.VENIDIUM_MAINNET: "https://evm.venidiumexplorer.com/",
47+
EthereumNetwork.KLAYTN_TESTNET_BAOBAB: "https://baobab.scope.klaytn.com/",
48+
EthereumNetwork.KLAYTN_MAINNET_CYPRESS: "https://scope.klaytn.com/",
49+
EthereumNetwork.ACALA_NETWORK: "https://blockscout.acala.network/",
5050
EthereumNetwork.KARURA_NETWORK_TESTNET: "https://blockscout.karura.network/",
5151
EthereumNetwork.ACALA_NETWORK_TESTNET: "https://blockscout.mandala.acala.network/",
5252
EthereumNetwork.ASTAR: "https://blockscout.com/astar/",
53-
EthereumNetwork.EVMOS_MAINNET: "https://evm.evmos.org",
53+
EthereumNetwork.EVMOS: "https://evm.evmos.org",
5454
EthereumNetwork.EVMOS_TESTNET: "https://evm.evmos.dev",
55-
EthereumNetwork.RABBIT: "https://rabbit.analogscan.com",
55+
EthereumNetwork.RABBIT_ANALOG_TESTNET_CHAIN: "https://rabbit.analogscan.com",
5656
EthereumNetwork.KCC_MAINNET: "https://scan.kcc.io/",
5757
EthereumNetwork.KCC_TESTNET: "https://scan-testnet.kcc.network/",
58-
EthereumNetwork.ARBITRUM: "https://explorer.arbitrum.io",
58+
EthereumNetwork.ARBITRUM_ONE: "https://explorer.arbitrum.io",
5959
EthereumNetwork.ARBITRUM_NOVA: "https://nova-explorer.arbitrum.io",
6060
EthereumNetwork.ARBITRUM_GOERLI: "https://goerli-rollup-explorer.arbitrum.io",
61+
EthereumNetwork.CROSSBELL: "https://scan.crossbell.io",
6162
}
6263

6364
def __init__(self, network: EthereumNetwork):

gnosis/eth/clients/etherscan_client.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,44 @@ class EtherscanClient:
2828
EthereumNetwork.ROPSTEN: "https://ropsten.etherscan.io",
2929
EthereumNetwork.GOERLI: "https://goerli.etherscan.io",
3030
EthereumNetwork.KOVAN: "https://kovan.etherscan.io",
31-
EthereumNetwork.BINANCE: "https://bscscan.com",
32-
EthereumNetwork.MATIC: "https://polygonscan.com",
33-
EthereumNetwork.OPTIMISTIC: "https://optimistic.etherscan.io",
34-
EthereumNetwork.ARBITRUM: "https://arbiscan.io",
31+
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://bscscan.com",
32+
EthereumNetwork.POLYGON: "https://polygonscan.com",
33+
EthereumNetwork.OPTIMISM: "https://optimistic.etherscan.io",
34+
EthereumNetwork.ARBITRUM_ONE: "https://arbiscan.io",
3535
EthereumNetwork.ARBITRUM_NOVA: "https://nova.arbiscan.io",
3636
EthereumNetwork.ARBITRUM_GOERLI: "https://goerli.arbiscan.io",
37-
EthereumNetwork.AVALANCHE: "https://snowtrace.io",
38-
EthereumNetwork.MOON_MOONBEAM: "https://moonscan.io",
39-
EthereumNetwork.MOON_MOONRIVER: "https://moonriver.moonscan.io",
40-
EthereumNetwork.MOON_MOONBASE: "https://moonbase.moonscan.io",
41-
EthereumNetwork.CRONOS_MAINNET: "https://cronoscan.com",
37+
EthereumNetwork.AVALANCHE_C_CHAIN: "https://snowtrace.io",
38+
EthereumNetwork.MOONBEAM: "https://moonscan.io",
39+
EthereumNetwork.MOONRIVER: "https://moonriver.moonscan.io",
40+
EthereumNetwork.MOONBASE_ALPHA: "https://moonbase.moonscan.io",
41+
EthereumNetwork.CRONOS_MAINNET_BETA: "https://cronoscan.com",
4242
EthereumNetwork.CRONOS_TESTNET: "https://testnet.cronoscan.com",
43-
EthereumNetwork.CELO: "https://celoscan.io",
43+
EthereumNetwork.CELO_MAINNET: "https://celoscan.io",
44+
EthereumNetwork.BASE_GOERLI_TESTNET: "https://goerli.basescan.org",
45+
EthereumNetwork.NEON_EVM_DEVNET: "https://neonscan.org",
4446
}
4547

4648
NETWORK_WITH_API_URL = {
4749
EthereumNetwork.MAINNET: "https://api.etherscan.io",
4850
EthereumNetwork.RINKEBY: "https://api-rinkeby.etherscan.io",
4951
EthereumNetwork.ROPSTEN: "https://api-ropsten.etherscan.io",
50-
EthereumNetwork.GOERLI: "https://api-goerli.etherscan.io/",
52+
EthereumNetwork.GOERLI: "https://api-goerli.etherscan.io",
5153
EthereumNetwork.KOVAN: "https://api-kovan.etherscan.io",
52-
EthereumNetwork.BINANCE: "https://api.bscscan.com",
53-
EthereumNetwork.MATIC: "https://api.polygonscan.com",
54-
EthereumNetwork.OPTIMISTIC: "https://api-optimistic.etherscan.io",
55-
EthereumNetwork.ARBITRUM: "https://api.arbiscan.io",
54+
EthereumNetwork.BINANCE_SMART_CHAIN_MAINNET: "https://api.bscscan.com",
55+
EthereumNetwork.POLYGON: "https://api.polygonscan.com",
56+
EthereumNetwork.OPTIMISM: "https://api-optimistic.etherscan.io",
57+
EthereumNetwork.ARBITRUM_ONE: "https://api.arbiscan.io",
5658
EthereumNetwork.ARBITRUM_NOVA: "https://api-nova.arbiscan.io",
5759
EthereumNetwork.ARBITRUM_GOERLI: "https://api-goerli.arbiscan.io",
58-
EthereumNetwork.AVALANCHE: "https://api.snowtrace.io",
59-
EthereumNetwork.MOON_MOONBEAM: "https://api-moonbeam.moonscan.io",
60-
EthereumNetwork.MOON_MOONRIVER: "https://api-moonriver.moonscan.io",
61-
EthereumNetwork.MOON_MOONBASE: "https://api-moonbase.moonscan.io",
62-
EthereumNetwork.CRONOS_MAINNET: "https://api.cronoscan.com",
60+
EthereumNetwork.AVALANCHE_C_CHAIN: "https://api.snowtrace.io",
61+
EthereumNetwork.MOONBEAM: "https://api-moonbeam.moonscan.io",
62+
EthereumNetwork.MOONRIVER: "https://api-moonriver.moonscan.io",
63+
EthereumNetwork.MOONBASE_ALPHA: "https://api-moonbase.moonscan.io",
64+
EthereumNetwork.CRONOS_MAINNET_BETA: "https://api.cronoscan.com",
6365
EthereumNetwork.CRONOS_TESTNET: "https://api-testnet.cronoscan.com",
64-
EthereumNetwork.CELO: "https://api.celoscan.io",
66+
EthereumNetwork.CELO_MAINNET: "https://api.celoscan.io",
67+
EthereumNetwork.BASE_GOERLI_TESTNET: "https://api-goerli.basescan.org",
68+
EthereumNetwork.NEON_EVM_DEVNET: "https://devnet-api.neonscan.org",
6569
}
6670
HTTP_HEADERS = {
6771
"User-Agent": "curl/7.77.0",

gnosis/eth/eip712/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Routines for EIP712 encoding and signing.
55
66
Copyright (C) 2022 Judd Vinet <[email protected]>
7+
Uxío Fuentefría <[email protected]>
78
89
Permission is hereby granted, free of charge, to any person obtaining a copy of
910
this software and associated documentation files (the "Software"), to deal in
@@ -75,15 +76,16 @@ def _encode_field(name, typ, value):
7576
return ["bytes32", fast_keccak(value)]
7677

7778
if typ.endswith("]"):
78-
parsed_type = typ[:-2]
79-
type_value_pairs = dict(
80-
[_encode_field(name, parsed_type, v) for v in value]
81-
)
82-
h = fast_keccak(
83-
encode_abi(
84-
list(type_value_pairs.keys()), list(type_value_pairs.values())
85-
)
86-
)
79+
# Array type
80+
if value:
81+
parsed_type = typ[: typ.rindex("[")]
82+
type_value_pairs = [_encode_field(name, parsed_type, v) for v in value]
83+
data_types, data_hashes = zip(*type_value_pairs)
84+
else:
85+
# Empty array
86+
data_types, data_hashes = [], []
87+
88+
h = fast_keccak(encode_abi(data_types, data_hashes))
8789
return ["bytes32", h]
8890

8991
return [typ, value]

gnosis/eth/ethereum_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,10 +1407,11 @@ def get_client_version(self) -> str:
14071407

14081408
def get_network(self) -> EthereumNetwork:
14091409
"""
1410-
Get network name based on the chainId
1410+
Get network name based on the chainId. This method is not cached as the method for getting the
1411+
`chainId` already is.
14111412
14121413
:return: EthereumNetwork based on the chainId. If network is not
1413-
on our list, `EthereumNetwork.UNKOWN` is returned
1414+
on our list, `EthereumNetwork.UNKNOWN` is returned
14141415
"""
14151416
return EthereumNetwork(self.get_chain_id())
14161417

@@ -1533,6 +1534,7 @@ def deploy_and_initialize_contract(
15331534
"gasPrice": self.w3.eth.gas_price,
15341535
"value": Wei(0),
15351536
"to": contract_address if contract_address else "",
1537+
"chainId": self.get_chain_id(),
15361538
}
15371539
tx["gas"] = self.w3.eth.estimate_gas(tx)
15381540
tx_hash = self.send_unsigned_transaction(
@@ -1942,6 +1944,7 @@ def send_eth_to(
19421944
"value": value,
19431945
"gas": gas or Wei(self.estimate_gas(to, account.address, value)),
19441946
"gasPrice": Wei(gas_price),
1947+
"chainId": self.get_chain_id(),
19451948
}
19461949

19471950
if nonce is not None:

0 commit comments

Comments
 (0)