aeternity / ae_mdw

Aeternity Middleware in Elixir
26 stars 11 forks source link

Filtering by `contract` does not work on /v3/accounts/<account>/activities #1992

Closed asyncmind0 closed 2 weeks ago

asyncmind0 commented 1 month ago

Filtering by contract does not work on /v3/accounts//activities

seems like filter by contracts is broken 🤔

curl -X 'GET' \
  'https://mainnet.aeternity.io/mdw/v3/accounts/ak_psy8tRXPzGxh6975H7K6XQcMFVsdrxJMt7YkzMY8oUTevutzw/activities?owned_only=true&type=transactions&limit=10' \
  -H 'accept: application/json'
curl -X 'GET' \
  'https://mainnet.aeternity.io/mdw/v3/accounts/ak_psy8tRXPzGxh6975H7K6XQcMFVsdrxJMt7YkzMY8oUTevutzw/activities?owned_only=true&type=contract&limit=10' \
  -H 'accept: application/json'
sborrazas commented 1 month ago

@asyncmind0 filtering activities by type=contract will return internal contract call/create activities, not transactions. Activities type filter filters type of activities, not type of transactions. If you want transaction activities for the account you can use type=transaction, but that's going to return all transactions related to the account, not filtered by contractcall/spendtx/etc.

What you can do is use the /transactions endpoint that's specifically for transactions and has a whole bunch of filters. For example, to get all the transactions where caller_id is ak_psy8tRXPzGxh6975H7K6XQcMFVsdrxJMt7YkzMY8oUTevutzw you can do: https://mainnet.aeternity.io/mdw/v3/transactions?caller_id=ak_psy8tRXPzGxh6975H7K6XQcMFVsdrxJMt7YkzMY8oUTevutzw&type=contract_call or if you want contract create transactions that have a caller_id too you can simply do too: https://mainnet.aeternity.io/mdw/v3/transactions?caller_id=ak_psy8tRXPzGxh6975H7K6XQcMFVsdrxJMt7YkzMY8oUTevutzw

asyncmind0 commented 2 weeks ago

thanks I think my case might be better served using events.