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 to get my wallet's transaction history list, gas price and token 's detail? #377

Closed
JJBFC opened this issue Sep 16, 2021 · 12 comments
Labels
FAQ common questions tend to recur about web3 infra question Further information is requested

Comments

@JJBFC
Copy link

JJBFC commented Sep 16, 2021

Hi all, I m working on a wallet project, and found some problem that I can't handle with web3swift doc. I can get transID after each transaction, but how to get my wallet's transaction history list? Almost every dapp will show gasprice with high, average and slow speed when prepare to send a transaction. Where can I get the gas price? How to get unit price, symbol name and icon for a token? Btw, where do you guys get monetary exchange rate?

@JJBFC JJBFC changed the title How to get my wallet's transaction history list, gas price and How to get my wallet's transaction history list, gas price and token 's detail? Sep 16, 2021
@JJBFC
Copy link
Author

JJBFC commented Sep 16, 2021

I 've read all functions in Web3+Eth.swift, looks like there 's no function that satisfied my needs. And I also confused with : let block = try! web3.eth.getBlockByNumber(blockNumber, fullTransactions: false) let transactionInBlockArr : [TransactionInBlock] = block.transactions let transactionInBlock : TransactionInBlock = transactionInBlockArr.first! What exactly mean for block.transactions? Is it transaction records for the block?

@JJBFC
Copy link
Author

JJBFC commented Sep 16, 2021

@skywinder Pls help me boss~!

@dangell7
Copy link

You have to cycle through all transactions.

  1. Get list of tx hash's
  2. For each

@dangell7
Copy link

Gas price is web3.eth.gasPrice I believe.
Exchange rate is your choice, I use kucoin api and update my own database.
Token details are called through call transactions

@JJBFC
Copy link
Author

JJBFC commented Sep 18, 2021

@dangell7
Thanks so much for reply me!
How can I get tx hashs with my address and the token address, still not found it..
For web3.eth.gasPrice only return one price, so how can I calculate the high speed price and slow speed price?
For token details, I need to show the token unit price before transactions even in my homepage, what should I do.
If you can show me the code that would be great! Thanks bro!

@JJBFC
Copy link
Author

JJBFC commented Sep 18, 2021

@dangell7
I can get tx hash after finishing a transaction. So how can I get tx's hash list when I import a wallet without doing transations which almost every dapp can do?

@dangell7
Copy link

I do the transaction sync on the server. I use filters and cycle through the blocks. I think there is even a GitHub repo if you search. I went the long way though. Here is the docs for web3 python Learn More.

Gas Price is just an estimate. Its an arbitrary number. In the beginning there was no high or slow. It was one number and we started just "estimating". There are some calculators out there. You could use python web3 I know they return the prices. Or there's likely another api.

And I use the kucoin api for prices. Learn More

@JJBFC
Copy link
Author

JJBFC commented Sep 18, 2021

Hi @dangell7 ,
I tried some api from Infura. eth_getTransactionCount should return the count that my wallet made, but only the count. eth_getTransactionByHash should return the whole detail for one tx. I tried to combine this two method to get my history list but still not found how to get every hash for my tx. The getLogs api looks like can show the whole logs with my wallet address, but I don't really know how to set the "fromBlock" and "toBlock".
What a day : (

@jesuasir007
Copy link

@dangell7
Thanks so much for reply me!
How can I get tx hashs with my address and the token address, still not found it..
For web3.eth.gasPrice only return one price, so how can I calculate the high speed price and slow speed price?
For token details, I need to show the token unit price before transactions even in my homepage, what should I do.
If you can show me the code that would be great! Thanks bro!

hi please show some example for calculate slow medium and fast gas fees estimation any one help about this topic ?

@Valter4578 Valter4578 added the question Further information is requested label Dec 21, 2021
@Valter4578 Valter4578 added help wanted Extra attention is needed and removed question Further information is requested labels Dec 30, 2021
@SheepP
Copy link

SheepP commented Mar 4, 2022

Oops, I also meet the same issue, have any progress?

@Nahatakyan
Copy link

I have the same issue

@yaroslavyaroslav
Copy link
Collaborator

yaroslavyaroslav commented May 31, 2022

Please see #576 issue.
Spoiler: you're too use some external services for both tasks.

@yaroslavyaroslav yaroslavyaroslav added question Further information is requested and removed help wanted Extra attention is needed labels May 31, 2022
@yaroslavyaroslav yaroslavyaroslav closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2022
@skywinder skywinder added the FAQ common questions tend to recur about web3 infra label Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ common questions tend to recur about web3 infra question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants