anyone has ever programmed in golang with geth client? I have a small query


when i try to get the Tx by hash
tx,pending,err:=Client.TransactionByHash(context.Background(), txhash)

tx does not have the from value to know who actually sent the tx am i missing something?

May 25, 2022, 3:37 PM
It seems highly unlikely. I don't program in Go, but if your library that provides Client.TransactionByHash has documentation, I would check into that function and look into the return types. What library is it?
May 25, 2022, 3:55 PM
its the og geth lib I kinda made my own struct around it and ig got it working just gotta test if it works fr

as in the lib the returned value does not hold from in it its saved locally and to retrieve gotta call another function for which i dont get enough data from the first function so had to look and make own struct with all the stuff I need
May 25, 2022, 3:58 PM
Yeah, it looks like you don't get from from a Transaction, but you can get it from a Message, but it also says a future PR will remove it. This might help a bit: https://github.com/ethereum/go-ethereum/blob/d575a2d3bc76dfbdefdd68b6cffff115542faf75/core/types/transaction.go#L560
May 25, 2022, 4:16 PM
Yeah ik so that's why I created my own struct and make a raw call using the gettxbyhash method and parse the data and save it and return through the function i made and it does not rely on geth so it won't break it in future
May 25, 2022, 4:35 PM
Yeah, good solution.
May 25, 2022, 4:35 PM
seems like a transfer issue in the code of the token
May 25, 2022, 4:42 PM
Generally these tokens create the pair at the time they are deployed (in the constructor)
https://github.com/safemoonprotocol/Safemoon.sol/blob/a2a1b922b1260b618427183ec8d4475d70cf4daf/Safemoon.sol#L1034 here you can see that it is checking to make sure from != uniswapV2Pair — your contract is not doing that, it is calling swapAndLiquify regardless.
May 25, 2022, 5:36 PM
okay . if so i will put those contraint also
May 25, 2022, 5:37 PM
Ok, good luck
May 25, 2022, 5:37 PM
thnx let me try at my end ..
yes . it was problem of from and to . now i can add and remove liquidity , i can buy also . rest thing i will try tommorw .
Thxn for help .😊
May 25, 2022, 6:09 PM

© 2024 Draquery.com All rights reserved.