Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5612278

Browse files
author
Kotsias, Panagiotis-Christos
committed
Finalized
1 parent 010e525 commit 5612278

File tree

3 files changed

+94
-3
lines changed

3 files changed

+94
-3
lines changed

etherscan/modules/contracts.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1+
from etherscan.utils.datatypes import ContractAddress
2+
from etherscan.enums.actions_enum import ActionsEnum as actions
3+
from etherscan.enums.fields_enum import FieldsEnum as fields
4+
from etherscan.enums.modules_enum import ModulesEnum as modules
5+
6+
17
class Contracts:
2-
pass
8+
@staticmethod
9+
def get_contract_abi(contract: ContractAddress) -> str:
10+
url = (
11+
f"{fields.MODULE}"
12+
f"{modules.CONTRACT}"
13+
f"{fields.ACTION}"
14+
f"{actions.GET_ABI}"
15+
f"{fields.ADDRESS}"
16+
f"{contract}"
17+
)
18+
return url
19+
20+
@staticmethod
21+
def get_contract_source_code(contract: ContractAddress) -> str:
22+
url = (
23+
f"{fields.MODULE}"
24+
f"{modules.CONTRACT}"
25+
f"{fields.ACTION}"
26+
f"{actions.GET_SOURCE_CODE}"
27+
f"{fields.ADDRESS}"
28+
f"{contract}"
29+
)
30+
return url

etherscan/modules/tokens.py

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1+
from etherscan.utils.datatypes import ContractAddress, TokenAddress
2+
from etherscan.enums.actions_enum import ActionsEnum as actions
3+
from etherscan.enums.tags_enum import TagsEnum as tags
4+
from etherscan.enums.fields_enum import FieldsEnum as fields
5+
from etherscan.enums.modules_enum import ModulesEnum as modules
6+
7+
18
class Tokens:
2-
pass
9+
@staticmethod
10+
def get_total_supply_by_contract_address(contract: ContractAddress) -> str:
11+
url = (
12+
f"{fields.MODULE}"
13+
f"{modules.STATS}"
14+
f"{fields.ACTION}"
15+
f"{actions.TOKEN_SUPPLY}"
16+
f"{fields.CONTRACT_ADDRESS}"
17+
f"{contract}"
18+
)
19+
return url
20+
21+
@staticmethod
22+
def get_acc_balance_by_token_and_contract_address(
23+
contract: ContractAddress, token: TokenAddress
24+
) -> str:
25+
url = (
26+
f"{fields.MODULE}"
27+
f"{modules.ACCOUNT}"
28+
f"{fields.ACTION}"
29+
f"{actions.TOKEN_BALANCE}"
30+
f"{fields.CONTRACT_ADDRESS}"
31+
f"{contract}"
32+
f"{fields.ADDRESS}"
33+
f"{token}"
34+
f"{fields.TAG}"
35+
f"{tags.LATEST}"
36+
)
37+
return url

etherscan/modules/transactions.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1+
from etherscan.utils.datatypes import TxHash
2+
from etherscan.enums.actions_enum import ActionsEnum as actions
3+
from etherscan.enums.fields_enum import FieldsEnum as fields
4+
from etherscan.enums.modules_enum import ModulesEnum as modules
5+
6+
17
class Transactions:
2-
pass
8+
@staticmethod
9+
def check_contract_execution_status(txhash: TxHash) -> str:
10+
url = (
11+
f"{fields.MODULE}"
12+
f"{modules.TRANSACTION}"
13+
f"{fields.ACTION}"
14+
f"{actions.GET_STATUS}"
15+
f"{fields.TXHASH}"
16+
f"{txhash}"
17+
)
18+
return url
19+
20+
@staticmethod
21+
def check_tx_receipt_status(txhash: TxHash) -> str:
22+
url = (
23+
f"{fields.MODULE}"
24+
f"{modules.TRANSACTION}"
25+
f"{fields.ACTION}"
26+
f"{actions.GET_TX_RECEIPT_STATUS}"
27+
f"{fields.TXHASH}"
28+
f"{txhash}"
29+
)
30+
return url

0 commit comments

Comments
 (0)