diff --git a/etherscan/accounts.py b/etherscan/accounts.py index 2bf7177..3da9b0d 100755 --- a/etherscan/accounts.py +++ b/etherscan/accounts.py @@ -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: @@ -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) @@ -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): """ diff --git a/etherscan/client.py b/etherscan/client.py index 83da7a1..b76dde1 100755 --- a/etherscan/client.py +++ b/etherscan/client.py @@ -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