gagliardetto / solana-go

Go SDK library and RPC client for the Solana Blockchain
Apache License 2.0
930 stars 264 forks source link

[HELP] - Always getting a versioned Transaction Too large error #173

Open atulsriv opened 9 months ago

atulsriv commented 9 months ago

panic: failed to send transaction to rpc clients. Error: base64 encoded solana_sdk::transaction::versioned::VersionedTransaction too large: 1964 bytes (max: encoded/raw 1644/1232)

Considering I am able to do this swap via the 3rd party's UI, I think this is something wrong with how I am building my transaction. Particularly, how I am passing in TransactionAddressLookupTables into the transaction builder. Anyone have an example of how to do this?

This is the function func TransactionAddressTables(tables map[PublicKey]PublicKeySlice) TransactionOption { return transactionOptionFunc(func(opts *transactionOptions) { opts.addressTables = tables }) }

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).

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

I am assuming the format is [addressLookupTable pub key] -> [all of the pubkeys to lookup addresses by], but even this confused me, because the [addressLookupTable pub key] should be constant. Any help is greatly appreciated!!

Mike-Wazowsk1 commented 1 week ago

same problem