From f31036b4788d6be8cc699e34a72929865ce99709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=BE=BE?= Date: Sat, 11 Dec 2021 00:36:16 +0800 Subject: [PATCH 01/31] Fix the test case bugs for now, not the robust way. Add test set up to ignore the annoying requests test warning. Add logs modules and test case. Add module gas tracker and test case. Add api key error. Modified README file. Modified setup.py file version. --- README.md | 3 ++- etherscan/client.py | 18 +++++++++++++- etherscan/gas_tracker.py | 44 ++++++++++++++++++++++++++++++++++ etherscan/logs.py | 48 ++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- tests/test_accounts.py | 10 +++++--- tests/test_blocks.py | 4 ++++ tests/test_gas_tracker.py | 27 +++++++++++++++++++++ tests/test_logs.py | 40 +++++++++++++++++++++++++++++++ tests/test_proxies.py | 6 ++++- tests/test_token.py | 4 ++++ tests/test_transactions.py | 4 ++++ 12 files changed, 203 insertions(+), 7 deletions(-) create mode 100644 etherscan/gas_tracker.py create mode 100644 etherscan/logs.py create mode 100644 tests/test_gas_tracker.py create mode 100644 tests/test_logs.py diff --git a/README.md b/README.md index d53fd3d..61a0b46 100755 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ Currently, only the following Etherscan.io API modules are available: - proxies - blocks - transactions +- Logs +- Gas Tracker The remaining available modules provided by Etherscan.io will be added eventually... @@ -58,7 +60,6 @@ Jupyter notebooks area also included in each directory to show all examples - Package and submit to PyPI - Add the following modules: - - event logs - geth proxy - websockets - Add robust documentation diff --git a/etherscan/client.py b/etherscan/client.py index 0802433..83da7a1 100755 --- a/etherscan/client.py +++ b/etherscan/client.py @@ -30,6 +30,10 @@ class BadRequest(ClientException): """Invalid request passed""" +class InvalidAPIKey(ClientException): + """Invalid API key""" + + # Assume user puts his API key in the api_key.json # file under variable name "key" class Client(object): @@ -59,6 +63,11 @@ class Client(object): TAG = '&tag=' BOOLEAN = '&boolean=' INDEX = '&index=' + FROM_BLOCK = '&fromBlock=' + TO_BLOCK = '&toBlock=' + TOPIC0 = '&topic0=' + TOPIC0_1_OPR = '&topic0_1_opr=' + TOPIC1 = '&topic1=' API_KEY = '&apikey=' url_dict = {} @@ -86,7 +95,12 @@ def __init__(self, address, api_key=''): (self.TAG, ''), (self.BOOLEAN, ''), (self.INDEX, ''), - (self.API_KEY, api_key)]) + (self.API_KEY, api_key), + (self.FROM_BLOCK, ''), + (self.TO_BLOCK, ''), + (self.TOPIC0, ''), + (self.TOPIC0_1_OPR, ''), + (self.TOPIC1, '')]) # Var initialization should take place within init self.url = None @@ -119,6 +133,8 @@ def connect(self): status = data.get('status') if status == '1' or self.check_keys_api(data): return data + elif status == '0' and data.get('result') == "Invalid API Key": + raise InvalidAPIKey(data.get('result')) else: raise EmptyResponse(data.get('message', 'no message')) raise BadRequest( diff --git a/etherscan/gas_tracker.py b/etherscan/gas_tracker.py new file mode 100644 index 0000000..7efc516 --- /dev/null +++ b/etherscan/gas_tracker.py @@ -0,0 +1,44 @@ +from .client import Client + + +class GasTrackerException(Exception): + """Base class for exceptions in this module.""" + pass + + +class GasTracker(Client): + def __init__(self, api_key='YourApiKeyToken'): + Client.__init__(self, address='', api_key=api_key) + self.url_dict[self.MODULE] = 'gastracker' + + def get_estimation_of_confirmation_time(self, gas_price: str) -> str: + """ + Returns the estimated time, in seconds, for a transaction to be confirmed on the blockchain. + + Args: + gas_price (str): the price paid per unit of gas, in wei + + Returns: + str: The result is returned in seconds. + """ + self.url_dict[self.ACTION] = 'gasestimate' + self.url_dict[self.GAS_PRICE] = gas_price + self.build_url() + req = self.connect() + return req['result'] + + def get_gas_oracle(self) -> dict: + """ + Returns the current Safe, Proposed and Fast gas prices. + + Returns: + dict: The gas prices are returned in Gwei. + """ + self.url_dict[self.ACTION] = 'gasoracle' + self.build_url() + req = self.connect() + return req['result'] + + def get_daily_average_gas_limit(self, start_date, end_date) -> list: + # TODO API Pro + pass diff --git a/etherscan/logs.py b/etherscan/logs.py new file mode 100644 index 0000000..60b448f --- /dev/null +++ b/etherscan/logs.py @@ -0,0 +1,48 @@ +from .client import Client + + +class LogsException(Exception): + """Base class for exceptions in this module.""" + pass + + +class Logs(Client): + """ + The Event Log API was designed to provide an alternative to the native eth_getLogs. + """ + def __init__(self, api_key='YourApiKeyToken'): + Client.__init__(self, address='', api_key=api_key) + self.url_dict[self.MODULE] = 'logs' + + def get_logs(self, from_block: str, to_block='latest', + topic0='', topic1='', topic0_1_opr='and',) -> list: + """ + Get Event Logs from block number [from_block] to block [to_block] , + where log address = [address], topic[0] = [topic0] 'AND' topic[1] = [topic1] + + Args: + from_block (str): start block number + to_block (str, optional): end block number. Defaults to 'latest'. + topic0 (str, optional): Defaults to ''. + topic1 (str, optional): Defaults to ''. + topic0_1_opr (str, optional): and|or between topic0 & topic1. Defaults to 'and'. + + Returns: + list: [description] + """ + # TODO: support multi topics + if not topic0 and topic1: + raise(LogsException('can not only set topic1 while topic0 is empty')) + self.url_dict[self.ACTION] = 'getLogs' + self.url_dict[self.FROM_BLOCK] = from_block if type( + from_block) is str else str(from_block) + self.url_dict[self.TO_BLOCK] = to_block if type( + to_block) is str else str(to_block) + self.url_dict[self.TOPIC0] = topic0 if type( + topic0) is str else hex(topic0) + self.url_dict[self.TOPIC1] = topic1 if type( + topic1) is str else hex(topic1) + self.url_dict[self.TOPIC0_1_OPR] = topic0_1_opr + self.build_url() + req = self.connect() + return req['result'] diff --git a/setup.py b/setup.py index a547046..bc99d9d 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setuptools.setup( name='py_etherscan_api', - version='0.8.0', + version='0.9.0', packages=['examples', 'examples.stats', 'examples.tokens', 'examples.accounts', 'examples.blocks', 'examples.transactions', 'etherscan'], url='https://github.com/corpetty/py-etherscan-api', diff --git a/tests/test_accounts.py b/tests/test_accounts.py index a5129d1..8c7ff88 100755 --- a/tests/test_accounts.py +++ b/tests/test_accounts.py @@ -1,8 +1,9 @@ import unittest +import warnings from etherscan.accounts import Account -SINGLE_BALANCE = '40807178566070000000000' +SINGLE_BALANCE = '40891626854930000000000' SINGLE_ACCOUNT = '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a' MULTI_ACCOUNT = [ '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a', @@ -10,15 +11,18 @@ ] MULTI_BALANCE = [ {'account': '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a', - 'balance': '40807178566070000000000'}, + 'balance': '40891626854930000000000'}, {'account': '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a', - 'balance': '40807178566070000000000'} + 'balance': '40891626854930000000000'} ] API_KEY = 'YourAPIkey' class AccountsTestCase(unittest.TestCase): + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + def test_get_balance(self): api = Account(address=SINGLE_ACCOUNT, api_key=API_KEY) self.assertEqual(api.get_balance(), SINGLE_BALANCE) diff --git a/tests/test_blocks.py b/tests/test_blocks.py index e3d59ff..0bdae81 100644 --- a/tests/test_blocks.py +++ b/tests/test_blocks.py @@ -1,4 +1,5 @@ import unittest +import warnings from etherscan.blocks import Blocks @@ -10,6 +11,9 @@ class BlocksTestCase(unittest.TestCase): + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + def test_get_block_reward(self): api = Blocks(api_key=(API_KEY)) reward_object = api.get_block_reward(BLOCK) diff --git a/tests/test_gas_tracker.py b/tests/test_gas_tracker.py new file mode 100644 index 0000000..37d2303 --- /dev/null +++ b/tests/test_gas_tracker.py @@ -0,0 +1,27 @@ +import unittest +import warnings + +from etherscan.gas_tracker import GasTracker + +GAS_PRICE = '2000000000' +PRICE_ORACLE_RESULT_DICT_KEYS = ("SafeGasPrice", + "ProposeGasPrice", + "FastGasPrice", + "suggestBaseFee") +API_KEY = 'YourAPIkey' + + +class BlocksTestCase(unittest.TestCase): + + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + self.api = GasTracker(api_key=API_KEY) + + def test_get_estimation_of_confirmation_time(self): + estimated_time = self.api.get_estimation_of_confirmation_time(GAS_PRICE) + self.assertTrue(int(estimated_time) > 0) + + def test_get_gas_oracle(self): + oracle_price = self.api.get_gas_oracle() + for key in PRICE_ORACLE_RESULT_DICT_KEYS: + self.assertTrue(key in oracle_price and float(oracle_price[key]) > 0) diff --git a/tests/test_logs.py b/tests/test_logs.py new file mode 100644 index 0000000..f4d36d9 --- /dev/null +++ b/tests/test_logs.py @@ -0,0 +1,40 @@ +import unittest +import warnings + +from etherscan.logs import Logs, LogsException +from etherscan.client import InvalidAPIKey + +FROM_BLOCK = 379224 +TO_BLOCK = 400000 +ADDRESS = '0x33990122638b9132ca29c723bdf037f1a891a70c' +TOPIC0 = '0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545' +TOPIC1 = '0x72657075746174696f6e00000000000000000000000000000000000000000000' +TOPIC0_1_OPR = 'and' +API_KEY = 'YourAPIkey' + + +class BlocksTestCase(unittest.TestCase): + + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + self.api = Logs(api_key=(API_KEY)) + + def test_invalid_api_key(self): + with self.assertRaises(InvalidAPIKey): + api = Logs(api_key=('invalid' + API_KEY)) + api.get_logs(from_block=FROM_BLOCK, topic0=TOPIC0) + + def test_get_logs_error(self): + with self.assertRaises(LogsException): + self.api.get_logs(from_block=FROM_BLOCK, topic1=TOPIC1) + + def test_get_logs_one_topic(self): + topics = self.api.get_logs(from_block=FROM_BLOCK, topic0=TOPIC0) + for topic in topics: + self.assertTrue(TOPIC0 in topic.get('topics', '')) + + def test_get_logs_two_topics(self): + topics = self.api.get_logs(from_block=FROM_BLOCK, topic0=TOPIC0, topic1=TOPIC1) + for topic in topics: + self.assertTrue(TOPIC0 in topic.get('topics', '') + and TOPIC1 in topic.get('topics', '')) diff --git a/tests/test_proxies.py b/tests/test_proxies.py index 9bc5e64..5067be0 100755 --- a/tests/test_proxies.py +++ b/tests/test_proxies.py @@ -1,5 +1,6 @@ import re import unittest +import warnings from etherscan.proxies import Proxies @@ -23,11 +24,14 @@ class ProxiesTestCase(unittest.TestCase): + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + def test_get_most_recent_block(self): api = Proxies(api_key=API_KEY) most_recent = int(api.get_most_recent_block(), 16) print(most_recent) - p = re.compile('^[0-9]{7}$') + p = re.compile('^[0-9]{8}$') self.assertTrue(p.match(str(most_recent))) def test_get_block_by_number(self): diff --git a/tests/test_token.py b/tests/test_token.py index fd1860e..2ce91ac 100755 --- a/tests/test_token.py +++ b/tests/test_token.py @@ -1,4 +1,5 @@ import unittest +import warnings from etherscan.tokens import Tokens @@ -11,6 +12,9 @@ class TokensTestCase(unittest.TestCase): + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + def test_get_token_supply(self): api = Tokens(contract_address=CONTRACT_ADDRESS, api_key=(API_KEY)) self.assertEqual(api.get_total_supply(), ELCOIN_TOKEN_SUPPLY) diff --git a/tests/test_transactions.py b/tests/test_transactions.py index 7dec60c..e2847e2 100644 --- a/tests/test_transactions.py +++ b/tests/test_transactions.py @@ -1,4 +1,5 @@ import unittest +import warnings from etherscan.transactions import Transactions @@ -10,6 +11,9 @@ class TransactionsTestCase(unittest.TestCase): + def setUp(self): + warnings.simplefilter('ignore', ResourceWarning) + def test_get_status(self): api = Transactions(api_key=(API_KEY)) status = api.get_status(TX_1) From c8f1fad7d5110ba4e36e7104ae30bc960a7cc76b Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:14:24 -0700 Subject: [PATCH 02/31] Update --- api_key.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 api_key.json diff --git a/api_key.json b/api_key.json new file mode 100644 index 0000000..ed1cb8e --- /dev/null +++ b/api_key.json @@ -0,0 +1 @@ +{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } \ No newline at end of file From e955637075f5f2135a2447b3ccc49dac3eff6a65 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:15:35 -0700 Subject: [PATCH 03/31] Update __init__.py --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 745e2a5..7d400d1 100755 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -__author__ = 'Corey Petty' +__author__ = 'Aisha Redl-Sherwood' name = "py-etherscan-api" \ No newline at end of file From 9dab0285c0bf36a9c952858322047d99fa162e37 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:17:42 -0700 Subject: [PATCH 04/31] Update setup.py --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index bc99d9d..0516099 100755 --- a/setup.py +++ b/setup.py @@ -5,10 +5,10 @@ version='0.9.0', packages=['examples', 'examples.stats', 'examples.tokens', 'examples.accounts', 'examples.blocks', 'examples.transactions', 'etherscan'], - url='https://github.com/corpetty/py-etherscan-api', - license='MIT', - author='coreypetty', - author_email='petty.btc@gmail.com', + url='https://github.com/rose2161/py-etherscan-api', + license='Gnup', + author='aisha redl', + author_email='aisharose2161@gmail.com', description='Python Bindings to Etherscan.io API', install_requires=[ 'requests>=2.20.0', From c69c5315eb43b3d0658f1a4588264c7313543f15 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:20:24 -0700 Subject: [PATCH 05/31] Update etherscan --- etherscan/api_key.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 etherscan/api_key.json diff --git a/etherscan/api_key.json b/etherscan/api_key.json new file mode 100644 index 0000000..ed1cb8e --- /dev/null +++ b/etherscan/api_key.json @@ -0,0 +1 @@ +{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } \ No newline at end of file From 3bb789ff71cd4e7930dc551d4affcb159faf582a Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:21:25 -0700 Subject: [PATCH 06/31] Update README.md --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 61a0b46..00e494f 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# py-etherscan-api module +in# py-etherscan-api module [![Build Status](https://secure.travis-ci.org/corpetty/py-etherscan-api.png?branch=master)](http://travis-ci.org/corpetty/py-etherscan-api) [![Join the chat at https://gitter.im/py-etherscan/Lobby](https://badges.gitter.im/py-etherscan/Lobby.svg)](https://gitter.im/py-etherscan/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -65,9 +65,3 @@ Jupyter notebooks area also included in each directory to show all examples - Add robust documentation - Add unit test suite - Add request throttling based on Etherscan's suggestions - -## Holla at ya' boy - -BTC: 16Ny72US78VEjL5GUinSAavDwARb8dXWKG - -ETH: 0x5E8047fc033499BD5d8C463ADb29f10f11165ed0 From 4f15e67559ceb0073658254a6689bb6f47881474 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:35:06 -0700 Subject: [PATCH 07/31] Update __init__.py --- etherscan/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherscan/__init__.py b/etherscan/__init__.py index 9900b50..87e9910 100755 --- a/etherscan/__init__.py +++ b/etherscan/__init__.py @@ -1 +1 @@ -__author__ = 'Corey Petty' +__author__ = 'Aisha Redl-Sherwood' From bab794cfc9994c452b68f23211b8a9cbae5c38b9 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:35:46 -0700 Subject: [PATCH 08/31] Update test_transactions.py --- tests/test_transactions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_transactions.py b/tests/test_transactions.py index e2847e2..114b7b7 100644 --- a/tests/test_transactions.py +++ b/tests/test_transactions.py @@ -3,7 +3,7 @@ from etherscan.transactions import Transactions -API_KEY = 'YourAPIkey' +API_KEY = 'FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG' TX_1 = '0x15f8e5ea1079d9a0bb04a4c58ae5fe7654b5b2b4463375ff7ffb490aa0032f3a' TX_2 = '0x513c1ba0bebf66436b5fed86ab668452b7805593c05073eb2d51d3a52f480a76' ERROR_STRING = 'Bad jump destination' From 5a0bc10c9eb81071f2d90be0df8afd7a28d50cd7 Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Wed, 27 Dec 2023 23:28:30 -0800 Subject: [PATCH 09/31] Update api_key.json --- api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_key.json b/api_key.json index ed1cb8e..c6ab811 100644 --- a/api_key.json +++ b/api_key.json @@ -1 +1 @@ -{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } \ No newline at end of file +{ "key" : "{API_KEY}" } From 1dd93fa74b520e22002e7202d4dd9969317e9a60 Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Wed, 24 Apr 2024 03:05:02 -0700 Subject: [PATCH 10/31] Update __init__.py --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 7d400d1..67dafdb 100755 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ __author__ = 'Aisha Redl-Sherwood' -name = "py-etherscan-api" \ No newline at end of file +name = "py-etherscan-api" Forked From db2947c03c77b6c905535de11df322cd8c893998 Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Wed, 29 May 2024 01:04:30 -0700 Subject: [PATCH 11/31] fix: pip-requirements.txt to reduce vulnerabilities (#7) The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-6928867 Co-authored-by: snyk-bot --- pip-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 pip-requirements.txt diff --git a/pip-requirements.txt b/pip-requirements.txt old mode 100755 new mode 100644 index 5d0fbdb..0230bb4 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -1,2 +1,2 @@ -requests>=2.20.0 +requests>=2.32.0 typing==3.6.4 From 59652e660633cd357c7653987a86674a34e00643 Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Mon, 3 Jun 2024 20:12:13 -0700 Subject: [PATCH 12/31] Delete examples/__init__.py --- examples/__init__.py | 1 - 1 file changed, 1 deletion(-) delete mode 100755 examples/__init__.py diff --git a/examples/__init__.py b/examples/__init__.py deleted file mode 100755 index 9900b50..0000000 --- a/examples/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'Corey Petty' From dfbdee5fd603aedc29bdd7a42e7557e33fe06a77 Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Tue, 3 Dec 2024 05:03:27 -0800 Subject: [PATCH 13/31] Update test_transactions.py --- tests/test_transactions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_transactions.py b/tests/test_transactions.py index 114b7b7..1cb898a 100644 --- a/tests/test_transactions.py +++ b/tests/test_transactions.py @@ -3,7 +3,7 @@ from etherscan.transactions import Transactions -API_KEY = 'FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG' +API_KEY = '{API_KEY}' TX_1 = '0x15f8e5ea1079d9a0bb04a4c58ae5fe7654b5b2b4463375ff7ffb490aa0032f3a' TX_2 = '0x513c1ba0bebf66436b5fed86ab668452b7805593c05073eb2d51d3a52f480a76' ERROR_STRING = 'Bad jump destination' From d9252bcd49b3475443ae7a760727b121899a76ee Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Tue, 3 Dec 2024 05:07:36 -0800 Subject: [PATCH 14/31] Update api_key.json --- api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_key.json b/api_key.json index c6ab811..9b90517 100644 --- a/api_key.json +++ b/api_key.json @@ -1 +1 @@ -{ "key" : "{API_KEY}" } +{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } From 6af2f5b444be07f3a6b28657396f9ed47097080f Mon Sep 17 00:00:00 2001 From: Cryptob3auty Date: Tue, 3 Dec 2024 05:11:54 -0800 Subject: [PATCH 15/31] Update FUNDING.yml --- .github/FUNDING.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9d4faec..9a9469a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,12 +1,4 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with a single custom sponsorship URL +github: rose2161 +open_collective: Cryptob3auty From 980de3f07998e6bde6cae06445a81cffc21299d0 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 04:54:19 -0700 Subject: [PATCH 16/31] Create workflows --- .github/workflows | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows diff --git a/.github/workflows b/.github/workflows new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.github/workflows @@ -0,0 +1 @@ + From 6ccf86734b5c49bd0c6f2ccffbb114b9c8eeffbc Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 04:55:44 -0700 Subject: [PATCH 17/31] Delete .github/workflows --- .github/workflows | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/workflows diff --git a/.github/workflows b/.github/workflows deleted file mode 100644 index 8b13789..0000000 --- a/.github/workflows +++ /dev/null @@ -1 +0,0 @@ - From 53dcc24f8607bd31381f768c0d3d21ad0b25f245 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 04:57:00 -0700 Subject: [PATCH 18/31] Create python-publish.yaml --- .github/python-publish.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/python-publish.yaml diff --git a/.github/python-publish.yaml b/.github/python-publish.yaml new file mode 100644 index 0000000..bb8c9c2 --- /dev/null +++ b/.github/python-publish.yaml @@ -0,0 +1,30 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From 137d08a075f86a115105209c5296fe291509ea70 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 05:39:33 -0700 Subject: [PATCH 19/31] Create python-publish.yaml --- .github/workflows/python-publish.yaml | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/python-publish.yaml diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml new file mode 100644 index 0000000..1a03a7b --- /dev/null +++ b/.github/workflows/python-publish.yaml @@ -0,0 +1,31 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From ed2eb08fa4cf1745473564e02f5de6b73215e86d Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 05:43:00 -0700 Subject: [PATCH 20/31] Create config.yml --- . circleci/config.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 . circleci/config.yml diff --git a/. circleci/config.yml b/. circleci/config.yml new file mode 100644 index 0000000..1a03a7b --- /dev/null +++ b/. circleci/config.yml @@ -0,0 +1,31 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From a24e31953fe7612e163a280e1b9a95d360965761 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 05:49:17 -0700 Subject: [PATCH 21/31] Update __init__.py --- examples/accounts/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/accounts/__init__.py b/examples/accounts/__init__.py index 9900b50..2d200b2 100755 --- a/examples/accounts/__init__.py +++ b/examples/accounts/__init__.py @@ -1 +1 @@ -__author__ = 'Corey Petty' +__author__ = 'Aisha Redl' From 79c69adfe7db0b95bb2888d56c4bc808e81c14f0 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 06:00:20 -0700 Subject: [PATCH 22/31] Update get_total_supply.py --- examples/tokens/get_total_supply.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tokens/get_total_supply.py b/examples/tokens/get_total_supply.py index 3e98ce4..97ca259 100755 --- a/examples/tokens/get_total_supply.py +++ b/examples/tokens/get_total_supply.py @@ -8,6 +8,6 @@ # DGD # MKR # TheDAO -api = Tokens(tokenname='SNT', api_key=key) +api = Tokens(tokenname='MKR', api_key=key) supply = api.get_total_supply() print(supply) From 5224cebff675937b45fa7608e93fcc7447929ef7 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 06:07:37 -0700 Subject: [PATCH 23/31] Update get_token_balance.py --- examples/tokens/get_token_balance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tokens/get_token_balance.py b/examples/tokens/get_token_balance.py index 744b2f8..bbf2c21 100755 --- a/examples/tokens/get_token_balance.py +++ b/examples/tokens/get_token_balance.py @@ -4,8 +4,8 @@ with open('../../api_key.json', mode='r') as key_file: key = json.loads(key_file.read())['key'] -address = '0xe04f27eb70e025b78871a2ad7eabe85e61212761' -api = Tokens(contract_address='0x57d90b64a1a57749b0f932f1a3395792e12e7055', +address = '0x4f19f6f747f43a3d9fcf8bb7d2214e798cd2ece8' +api = Tokens(contract_address='0xdAC17F958D2ee523a2206206994597C13D831ec7', api_key=key) balance = api.get_token_balance(address=address) print(balance) From f6e54e1216aefa0839a86f8696537b37b21e89e1 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 06:13:51 -0700 Subject: [PATCH 24/31] Update api_key.json --- etherscan/api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherscan/api_key.json b/etherscan/api_key.json index ed1cb8e..a6ac492 100644 --- a/etherscan/api_key.json +++ b/etherscan/api_key.json @@ -1 +1 @@ -{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } \ No newline at end of file +{ "api_key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } From fc9f619d7c928fc3eeec451dc631a531dccef435 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Sun, 27 Jul 2025 06:14:33 -0700 Subject: [PATCH 25/31] Update api_key.json --- etherscan/api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherscan/api_key.json b/etherscan/api_key.json index a6ac492..9b90517 100644 --- a/etherscan/api_key.json +++ b/etherscan/api_key.json @@ -1 +1 @@ -{ "api_key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } +{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } From 9b9ff4f20389dedc3c1a88229dfee589e99f9270 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Mon, 18 Aug 2025 07:13:39 -0700 Subject: [PATCH 26/31] Update api_key.json --- api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_key.json b/api_key.json index 9b90517..aa43427 100644 --- a/api_key.json +++ b/api_key.json @@ -1 +1 @@ -{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } +{ "key" : "{{secrets.api_key}}" } From 71a8135bb6ea5aa104990af9f461540183966e11 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Mon, 18 Aug 2025 07:18:48 -0700 Subject: [PATCH 27/31] Update api_key.json --- api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_key.json b/api_key.json index aa43427..51f5068 100644 --- a/api_key.json +++ b/api_key.json @@ -1 +1 @@ -{ "key" : "{{secrets.api_key}}" } +{ "key" : "{{secrets.API_KEY}}" } From e88842c96d2af5c55e68a74cad4ecffa7bb38eca Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Mon, 18 Aug 2025 07:20:16 -0700 Subject: [PATCH 28/31] Update __init__.py --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 67dafdb..c8fb69e 100755 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ __author__ = 'Aisha Redl-Sherwood' -name = "py-etherscan-api" Forked +name = "mypy-etherscan-api, forked from "Core Petty's, 'py-etherscan-api'" From 570f4a1376983dd6ac53550ce2d1c8ca488676d1 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Mon, 18 Aug 2025 07:22:37 -0700 Subject: [PATCH 29/31] Update api_key.json --- api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_key.json b/api_key.json index 51f5068..e1b535d 100644 --- a/api_key.json +++ b/api_key.json @@ -1 +1 @@ -{ "key" : "{{secrets.API_KEY}}" } +{ "key" : "${{secrets.API_KEY}}" } From 83e4be2158f39f67e60d61480824bf0f26048bf6 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Mon, 18 Aug 2025 07:26:56 -0700 Subject: [PATCH 30/31] Update api_key.json --- etherscan/api_key.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherscan/api_key.json b/etherscan/api_key.json index 9b90517..e1b535d 100644 --- a/etherscan/api_key.json +++ b/etherscan/api_key.json @@ -1 +1 @@ -{ "key" : "FCNR79749SDWAYAVAE2RBWHDZUMAKIXQUG" } +{ "key" : "${{secrets.API_KEY}}" } From 59e53655818529184f8bec3d9c75d6a21517c5e6 Mon Sep 17 00:00:00 2001 From: Cryptob3auty <76785638+Rose2161@users.noreply.github.com> Date: Fri, 3 Oct 2025 09:27:28 -0700 Subject: [PATCH 31/31] Update __init__.py --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index c8fb69e..2a9b8cd 100755 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -__author__ = 'Aisha Redl-Sherwood' +contributor= 'Aisha Redl-Sherwood' name = "mypy-etherscan-api, forked from "Core Petty's, 'py-etherscan-api'"