blocto / solana-go-sdk

Solana Golang SDK
https://blocto.github.io/solana-go-sdk/
MIT License
394 stars 104 forks source link

[HELP] Deserializing AccountData data field into address lookup tables #153

Open atulsriv opened 9 months ago

atulsriv commented 9 months ago

I am trying to construct a solana transaction based on jupiter's swap-instructions endpoint (https://station.jup.ag/docs/apis/swap-api).

Essentially, they return a list of addresses that can be used to create address lookup tables. I am a bit confused/in the middle of figuring out how to do this. In their typescript example, they call GetAccountInfo and then deserialize the Data field into something of AddressLookupTable type (see the deserialize function here: https://solana-labs.github.io/solana-web3.js/classes/AddressLookupTableAccount.html).

Any advice on how to do this in golang?

type AccountInfo struct {
    Lamports   uint64
    Owner      common.PublicKey
    Executable bool
    RentEpoch  uint64
    Data       []byte
}