Skip to content
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

How do i process transactions that are pending by filtering on the ERC20 token address #941

Open
mdm183 opened this issue Apr 22, 2023 · 3 comments

Comments

@mdm183
Copy link

mdm183 commented Apr 22, 2023

Currently I am using the EthNewPendingTransactionObservableSubscription method, which works great. However I am having a challenge to filter the transactions on the ERC20 level. I can filter by applying some logic on the 'from' and 'To' address fields, however cannot seem to figure out a way to filter on the ERC20-Token data.

Separately, if I was to use the EthLogsObservableSubscription I can filter on example a pair Contract address for any confirmed transaction.

Hope I made some sense. Just need some pointers or an example - that would really help..

Thanks in advance

@juanfranblanco
Copy link
Member

juanfranblanco commented Apr 22, 2023

You have to do it manually, decoding the data, check the playground example on decoding Transaction Input. https://playground.nethereum.com/csharp/id/1075

@mdm183
Copy link
Author

mdm183 commented Apr 23, 2023

Thanks @juanfranblanco . Actually to check the ERC20 token transfers on the pending transaction, I need a TransferReceipt which obviously would not be generated, until the TX is mined. However using the input data of the TX I can see payload which references ERC20 token info, but quite challenging to decode. Is there a way to decode the Input data ? to get quantity/value info

Example:
0x2ad33c590000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000000b130a28a6e06180000000000000000000000000000000000000000000000000000003d1e9b0d8b1000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000562e362876c8aee4744fc2c6aac8394c312d215d0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000d0be1fded5d964619b92b3672c08c43305529be00000000000000000000000000000000000000000000000000000bdb878e67000

@juanfranblanco
Copy link
Member

@mdm183 I assume you found it, but in case here is the sample in the playground https://playground.nethereum.com/csharp/id/1075

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants