0

I am trying to get all dex trades to know who send or received a determined token in a specific date. In this case I was looking for the transactions related to this token

https://etherscan.io/token/0x3d658390460295fb963f54dc0899cfb1c30776df

The function I implemented to get the transactions is the following:

def get_transactions_by_address_(self, address,
                                 action='txlist',
                                 sort='desc',
                                 page=1,
                                 offset=1000,
                                 startblock=None,
                                 endblock=None):
    """

    :param address:
    :param action: ['tokennfttx', 'txlist', 'txlistinternal', 'balancehistory', 'balancemulti']
    :param sort: ['desc', 'asc']
    :param **kwargs:
        startblock=0
        endblock=92702578
    :return:
    """
    token = self.etherscan_api_key
    options = {
        'module': 'account',
        'action': action,
        'address': address,
        'apikey': token,
        'sort': sort,
        'page': page,
        'offset': offset
    }
    if startblock:
        options['startblock'] = startblock
    if endblock:
        options['endblock'] = endblock

    return requests.get('https://api.etherscan.io/api',
                        params=options
                        )

If I search transactions from startblock:13692509 --> endblock: 13755040 using as action parameters all of the following: ['tokennfttx', 'txlist', 'txlistinternal'], I only get results for "txlist", also in the transaction dictionary From --> To, in the tag "TO", all values correspond to the token address, and I would like to know which "wallet address" received the token in every transaction, not only the token contract.

I understand this outcome is logical due to the blockchain's nature, but I would like to know which addresses received the given token, for

  1. Internal transactions

  2. Dex transactions

  3. If other, then other options

The Dan
  • 1,408
  • 6
  • 16
  • 41

1 Answers1

0

please try using action=tokentx and make url like this https://api.etherscan.io/api?module=account&action=tokentx&startblock={}&endblock={}&sort=asc&apikey=your api key&contractaddress=0x3d658390460295fb963f54dc0899cfb1c30776df

https://docs.etherscan.io/api-endpoints/accounts#get-a-list-of-erc20-token-transfer-events-by-address

paseca
  • 71
  • 3