Skip to content

nft related code update #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions etherscan/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_balance_multiple(self):
return req['result']

def get_transaction_page(self, page=1, offset=10000, sort='asc',
internal=False, erc20=False) -> list:
internal=False, erc20=False, erc721=False, erc1155=False) -> list:
"""
Get a page of transactions, each transaction
returns list of dict with keys:
Expand Down Expand Up @@ -63,10 +63,15 @@ def get_transaction_page(self, page=1, offset=10000, sort='asc',
NOTE: not sure if this works for contract addresses, requires testing
"""
if internal:
self.url_dict[self.ACTION] = 'txlistinternal'
self.url_dict[self.ACTION] = 'txlistinternal' # interact with contract
elif erc20:
self.url_dict[self.ACTION] = 'tokentx'
self.url_dict[self.ACTION] = 'tokentx' # erc20 token trans
elif erc721:
self.url_dict[self.ACTION] = 'tokennfttx' # nfts
elif erc1155:
self.url_dict[self.ACTION] = 'token1155tx' # nfts
else:
# return 'no such category'
self.url_dict[self.ACTION] = 'txlist'
self.url_dict[self.PAGE] = str(page)
self.url_dict[self.OFFSET] = str(offset)
Expand Down Expand Up @@ -147,12 +152,17 @@ def get_all_blocks_mined(self, blocktype='blocks', offset=10000) -> list:
print("page {} added".format(page_number[0]))
self.url_dict[self.PAGE] = str(int(page_number[0]) + 1)

def get_internal_by_hash(self, tx_hash=''):
def get_internal_by_hash(self, tx_hash:str):
"""
Currently not implemented
:return:

"""
pass
self.url_dict[self.ACTION] = 'txlistinternal'
self.url_dict[self.TXHASH] = tx_hash
self.build_url()
req = self.connect()
return req['result']



def update_transactions(self, address, trans):
"""
Expand Down
1 change: 1 addition & 0 deletions etherscan/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def build_url(self):
self.url = self.PREFIX + ''.join(
[param + val if val else '' for param, val in
self.url_dict.items()])
# print(self.url)

def connect(self):
# TODO: deal with "unknown exception" error
Expand Down