Skip to content

Commit 7030596

Browse files
committed
convert to pyproject.toml
1 parent 16bb505 commit 7030596

File tree

88 files changed

+6796
-6466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6796
-6466
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ docs
1515

1616
# eggs
1717
*egg*
18+
19+
.black
20+
.flake8
21+
.errors

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
install:
22
pip install -e .
33

4+
uninstall:
5+
pip uninstall -y rstms-etherscan-python
6+
47
.PHONY: test
5-
test:
8+
unitest:
69
bash ./run_tests.sh $(API_KEY)
710

811
clean:
912
find . -type d -name __pycache__ -exec rm -rf "{}" +
1013
rm -rf build *.egg-info
1114
rm -f .black .flake8 .errors .coverage
1215

13-
fmt:
14-
black -l 135 etherscan
15-
flake8 --max-line-len 135 etherscan
16+
include $(wildcard make/*.mk)

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1.0

etherscan/__init__.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
from .etherscan import Etherscan
2-
from .modules.accounts import Accounts as accounts
3-
from .modules.blocks import Blocks as blocks
4-
from .modules.contracts import Contracts as contracts
5-
from .modules.gastracker import GasTracker as gastracker
6-
from .modules.pro import Pro as pro
7-
from .modules.proxy import Proxy as proxy
8-
from .modules.stats import Stats as stats
9-
from .modules.tokens import Tokens as tokens
10-
from .modules.transactions import Transactions as transactions
1+
"""
2+
etherscan-python
113
12-
__all__ = [
13-
"Etherscan",
14-
"accounts",
15-
"blocks",
16-
"contracts",
17-
"gastracker",
18-
"pro",
19-
"proxy",
20-
"stats",
21-
"tokens",
22-
"transactions",
23-
]
4+
A minimal, yet complete, python API for etherscan.io.
5+
6+
forked from: https://github.com/pcko1/etherscan-python
7+
8+
"""
9+
10+
from .modules.accounts import Accounts as accounts # noqa: F401
11+
from .modules.blocks import Blocks as blocks # noqa: F401
12+
from .modules.contracts import Contracts as contracts # noqa: F401
13+
from .modules.gastracker import GasTracker as gastracker # noqa: F401
14+
from .modules.pro import Pro as pro # noqa: F401
15+
from .modules.proxy import Proxy as proxy # noqa: F401
16+
from .modules.stats import Stats as stats # noqa: F401
17+
from .modules.tokens import Tokens as tokens # noqa: F401
18+
from .modules.transactions import Transactions as transactions # noqa: F401

etherscan/etherscan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def __load_config(config_path: str) -> dict:
2424
def __run(func, api_key: str, net: str):
2525
def wrapper(*args, **kwargs):
2626
url = (
27-
f"{fields.PREFIX.format(net.lower()).replace('-main','')}" f"{func(*args, **kwargs)}" f"{fields.API_KEY}" f"{api_key}"
27+
f"{fields.PREFIX.format(net.lower()).replace('-main','')}"
28+
f"{func(*args, **kwargs)}"
29+
f"{fields.API_KEY}"
30+
f"{api_key}"
2831
)
2932
r = requests.get(url, headers={"User-Agent": ""})
3033
return parser.parse(r)

etherscan/modules/accounts.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ def get_internal_txs_by_address_paginated(
151151
@staticmethod
152152
def get_internal_txs_by_txhash(txhash: str) -> str:
153153
# NOTE: Returns the last 10k events
154-
url = f"{fields.MODULE}" f"{modules.ACCOUNT}" f"{fields.ACTION}" f"{actions.TXLIST_INTERNAL}" f"{fields.TXHASH}" f"{txhash}"
154+
url = (
155+
f"{fields.MODULE}"
156+
f"{modules.ACCOUNT}"
157+
f"{fields.ACTION}"
158+
f"{actions.TXLIST_INTERNAL}"
159+
f"{fields.TXHASH}"
160+
f"{txhash}"
161+
)
155162
return url
156163

157164
@staticmethod
@@ -206,7 +213,9 @@ def get_erc20_token_transfer_events_by_address(
206213
return url
207214

208215
@staticmethod
209-
def get_erc20_token_transfer_events_by_contract_address_paginated(contract_address: str, page: int, offset: int, sort: str) -> str:
216+
def get_erc20_token_transfer_events_by_contract_address_paginated(
217+
contract_address: str, page: int, offset: int, sort: str
218+
) -> str:
210219
url = (
211220
f"{fields.MODULE}"
212221
f"{modules.ACCOUNT}"

etherscan/modules/blocks.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66
class Blocks:
77
@staticmethod
88
def get_block_reward_by_block_number(block_no: str) -> str:
9-
url = f"{fields.MODULE}" f"{modules.BLOCK}" f"{fields.ACTION}" f"{actions.GET_BLOCK_REWARD}" f"{fields.BLOCKNO}" f"{block_no}"
9+
url = (
10+
f"{fields.MODULE}"
11+
f"{modules.BLOCK}"
12+
f"{fields.ACTION}"
13+
f"{actions.GET_BLOCK_REWARD}"
14+
f"{fields.BLOCKNO}"
15+
f"{block_no}"
16+
)
1017
return url
1118

1219
@staticmethod
1320
def get_est_block_countdown_time_by_block_number(block_no: str) -> str:
1421
url = (
15-
f"{fields.MODULE}" f"{modules.BLOCK}" f"{fields.ACTION}" f"{actions.GET_BLOCK_COUNTDOWN}" f"{fields.BLOCKNO}" f"{block_no}"
22+
f"{fields.MODULE}"
23+
f"{modules.BLOCK}"
24+
f"{fields.ACTION}"
25+
f"{actions.GET_BLOCK_COUNTDOWN}"
26+
f"{fields.BLOCKNO}"
27+
f"{block_no}"
1628
)
1729
return url
1830

etherscan/modules/contracts.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,26 @@
99
class Contracts:
1010
@staticmethod
1111
def get_contract_abi(address: str) -> str:
12-
url = f"{fields.MODULE}" f"{modules.CONTRACT}" f"{fields.ACTION}" f"{actions.GET_ABI}" f"{fields.ADDRESS}" f"{address}"
12+
url = (
13+
f"{fields.MODULE}"
14+
f"{modules.CONTRACT}"
15+
f"{fields.ACTION}"
16+
f"{actions.GET_ABI}"
17+
f"{fields.ADDRESS}"
18+
f"{address}"
19+
)
1320
return url
1421

1522
@staticmethod
1623
def get_contract_source_code(address: str) -> str:
17-
url = f"{fields.MODULE}" f"{modules.CONTRACT}" f"{fields.ACTION}" f"{actions.GET_SOURCE_CODE}" f"{fields.ADDRESS}" f"{address}"
24+
url = (
25+
f"{fields.MODULE}"
26+
f"{modules.CONTRACT}"
27+
f"{fields.ACTION}"
28+
f"{actions.GET_SOURCE_CODE}"
29+
f"{fields.ADDRESS}"
30+
f"{address}"
31+
)
1832
return url
1933

2034
@staticmethod

etherscan/modules/transactions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
class Transactions:
77
@staticmethod
88
def get_contract_execution_status(txhash: str) -> str:
9-
url = f"{fields.MODULE}" f"{modules.TRANSACTION}" f"{fields.ACTION}" f"{actions.GET_STATUS}" f"{fields.TXHASH}" f"{txhash}"
9+
url = (
10+
f"{fields.MODULE}"
11+
f"{modules.TRANSACTION}"
12+
f"{fields.ACTION}"
13+
f"{actions.GET_STATUS}"
14+
f"{fields.TXHASH}"
15+
f"{txhash}"
16+
)
1017
return url
1118

1219
@staticmethod

etherscan/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "2.1.0"

logs/standard/GOERLI-get_acc_balance_by_token_and_contract_address.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"contract_address": "0x57d90b64a1a57749b0f932f1a3395792e12e7055",
66
"address": "0xe04f27eb70e025b78871a2ad7eabe85e61212761"
77
},
8-
"log_timestamp": "2023-04-18-07:50:14",
8+
"log_timestamp": "2023-04-18-16:35:12",
99
"res": "0"
1010
}

logs/standard/GOERLI-get_contract_abi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"kwargs": {
55
"address": "0x748D03fb181A158bea396489eA6589E7dCfBA495"
66
},
7-
"log_timestamp": "2023-04-18-07:49:55",
7+
"log_timestamp": "2023-04-18-16:34:50",
88
"res": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"reason\",\"type\":\"bytes\"}],\"name\":\"TransactionFailed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"addTransaction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"executeAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"removeTransaction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setTransactionEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transactions\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"destination\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transactionsSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
99
}

logs/standard/GOERLI-get_contract_creator_and_creation_tx_hash.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0x7af963cF6D228E564e2A0aA0DdBF06210B38615D"
77
]
88
},
9-
"log_timestamp": "2023-04-18-07:49:57",
9+
"log_timestamp": "2023-04-18-16:34:51",
1010
"res": [
1111
{
1212
"contractAddress": "0x7af963cf6d228e564e2a0aa0ddbf06210b38615d",

logs/standard/GOERLI-get_contract_execution_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"kwargs": {
55
"txhash": "0x15f8e5ea1079d9a0bb04a4c58ae5fe7654b5b2b4463375ff7ffb490aa0032f3a"
66
},
7-
"log_timestamp": "2023-04-18-07:50:16",
7+
"log_timestamp": "2023-04-18-16:35:14",
88
"res": {
99
"isError": "0",
1010
"errDescription": ""

logs/standard/GOERLI-get_contract_source_code.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"kwargs": {
55
"address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413"
66
},
7-
"log_timestamp": "2023-04-18-07:49:56",
7+
"log_timestamp": "2023-04-18-16:34:50",
88
"res": [
99
{
1010
"SourceCode": "",

logs/standard/GOERLI-get_erc20_token_transfer_events_by_address.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"endblock": 999999999,
88
"sort": "asc"
99
},
10-
"log_timestamp": "2023-04-18-07:49:47",
10+
"log_timestamp": "2023-04-18-16:35:42",
1111
"res": [
1212
{
1313
"blockNumber": "4325753",
@@ -28,7 +28,7 @@
2828
"gasUsed": "274574",
2929
"cumulativeGasUsed": "669283",
3030
"input": "deprecated",
31-
"confirmations": "4524620"
31+
"confirmations": "4526515"
3232
},
3333
{
3434
"blockNumber": "4325755",
@@ -49,7 +49,7 @@
4949
"gasUsed": "36775",
5050
"cumulativeGasUsed": "332336",
5151
"input": "deprecated",
52-
"confirmations": "4524618"
52+
"confirmations": "4526513"
5353
}
5454
]
5555
}

logs/standard/GOERLI-get_erc20_token_transfer_events_by_address_and_contract_paginated.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"offset": 100,
99
"sort": "asc"
1010
},
11-
"log_timestamp": "2023-04-18-07:49:49",
11+
"log_timestamp": "2023-04-18-16:35:43",
1212
"res": [
1313
{
1414
"blockNumber": "4325753",
@@ -29,7 +29,7 @@
2929
"gasUsed": "274574",
3030
"cumulativeGasUsed": "669283",
3131
"input": "deprecated",
32-
"confirmations": "4524620"
32+
"confirmations": "4526515"
3333
},
3434
{
3535
"blockNumber": "4325755",
@@ -50,7 +50,7 @@
5050
"gasUsed": "36775",
5151
"cumulativeGasUsed": "332336",
5252
"input": "deprecated",
53-
"confirmations": "4524618"
53+
"confirmations": "4526513"
5454
}
5555
]
5656
}

0 commit comments

Comments
 (0)