3

guys! Right now I am working on web3 project, which has a wallet as it's one parts. Can you give me advices on how to create this Transaction History for user, because I am kind of stuck on it.

First of all, I guess, it is great idea to show user his history updates in real-time while he is in the App. For this purpose I am using Moralis Stream API, which is great: it sends me real-time data about new transactions. Problems begin when I am trying to decode those transactions for user. They do not have so much information, some transactions cant get decoded even with ABI and input data (when decoding transactions from OKX DEX Aggregator, I always get raise ValueError(f"Could not find any function with matching {identifier}") ValueError: Could not find any function with matching selector)

So, I really don't know what to do. There is an idea to maybe use BSC/ETH/Polygon/etc/Scans to retrieve transaction data by it's hash, but idk, would be happy to hear your advices.

In general, my goal is to bring all transactions to types: Swap (when in one transaction we give one token and in the end receive another), Send (we only send), Receive (we only get) and Approve. How it can be done?

4
  • Have you tried using Morlais web3 data API? They have an API endpoint to get all the transactions of an address it also gives the decoded data of the transaction logs. docs.moralis.io/web3-data-api/evm/reference/…
    – JohnVersus
    Commented Jan 16 at 5:50
  • Moralis js sdk has parsedLogs function to decode logs from streams. const decodedLogs = Moralis.Streams.parsedLogs(webhook_data);
    – JohnVersus
    Commented Jan 16 at 6:01
  • @JohnVersus thanks. I tried decoded transactions and it in most cases works fine. But can I ask you, how to deal with transactions like this: bscscan.com/tx/… (hash - 0x48fd02c1e07ef8000401f97e8ee2bfa325214e90c93455444e41fbad2ca06fe8) It is swap on OKX DEX, and it was TON sent WBNB received. I use decoded transactions endpoint and then, for "swap" kind of transactions I read logs and detect swap. In this case there is no data in logs that WBNB arrived on my address. Why so? And what to do then?
    – Kind_Man
    Commented Jan 18 at 8:46
  • I am not sure I understand your questions correctly. I tested the transaction on the below page and it seems to have given me all the expected decoded logs. docs.moralis.io/web3-data-api/evm/reference/…
    – JohnVersus
    Commented Jan 26 at 9:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.