Git Product home page Git Product logo

Comments (7)

yihau avatar yihau commented on August 20, 2024

https://portto.github.io/solana-go-sdk/rpc/get-signatures-for-address.html

from solana-go-sdk.

scottywm avatar scottywm commented on August 20, 2024

Hey, thanks for the link above, its working good for me.

I'm using the wallet address to get the transaction signatures and then I use the transaction signatures to get the transactions, only the signatures property in the transactions is an array and it looks like the signature is encoded.

I use this line of code to get the transactions

tr, errTran := c.GetTransaction(context.Background(), signature)

How do I get the signature from this encoded signature value?

Thanks

from solana-go-sdk.

Joeyboy92 avatar Joeyboy92 commented on August 20, 2024

Hey, I'm having the same problem too.
It looks like the actual transaction signature that is in the transactions filed is encoded somehow.
I can't decode it either.

from solana-go-sdk.

yihau avatar yihau commented on August 20, 2024

signatures on explorer are base58 encoded strings. lots of RPC do use them as well. if you do base58 decode, you will get a 64 bytes array. they are the same value, just represent by different text-encoded. In the other words, when you get a signature that is a byte array. you can just base58 encode it to get a human-friendly string.

from solana-go-sdk.

scottywm avatar scottywm commented on August 20, 2024

Hey, when i use your library to get the transaction, I'm needing to find the senders address and the recipients address and I have been relying on the order in which the sender and receiver details are inside the field PostTokenBalances, as shown below.

tr, _ := c.GetTransaction(context.Background(), sig)

recipient := tr.Meta.PostTokenBalances[1].Owner
sender := tr.Meta.PostTokenBalances[0].Owner

The problem I'm having is that sometimes the order in both of the PostTokenBalances and PreTokenBalances fields seems to change around and cause errors in my application.

Are you aware of this problem and how can I work around this to get the correct recipient and sender addresses?

from solana-go-sdk.

yihau avatar yihau commented on August 20, 2024

pre/post balance and pre/post token balance can only know the final result. if a tx is like A send B 100 token, B send C 100 token, you can only know A lost 100 and C get 100 but you don't have any idea B is the man in the middle. if you would like to know the detail, you need to parse instructions. for decoding an instruction, every program can define on their own way. you should take a look to the program

from solana-go-sdk.

scottywm avatar scottywm commented on August 20, 2024

Thanks 🙏🙏🙏🙏

from solana-go-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.