solana-go-sdk
solana-go-sdk copied to clipboard
Sign raw tx and send it
Hello! I'm trying to swap some spl token to sol and i'm using jup.ag api for that. I'm stucked at signing and sending transaction. Their api returns me swap transaction in base64, i'm storing it in swapTx variable. After that i'm signing this raw tx bytes with my account.
When i'm trying to send my signed transaction it throws this err: {2.0 1 {"code":-32602,"message":"invalid value: integer `478196`, expected a value in the range [0, 65535]","data":null}}
func (c *Client) Swap(account types.Account, quote Quote) error {
swapTx, err := c.jupiter.Swap(jupiter.SwapRequest{
Route: quote,
UserPublicKey: account.PublicKey.String(),
})
if err != nil {
return err
}
signedTx := base58.Encode(account.Sign(swapTx))
resp, err := c.rpcClient.RpcClient.SendTransaction(ctx, signedTx)
if err != nil {
return err
}
log.Println(resp)
}
Also interested in this case, have received the same error. Maybe @yihau can help?