Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction from buffer crashed #91

Open
kk-vv opened this issue Jan 30, 2024 · 2 comments
Open

Transaction from buffer crashed #91

kk-vv opened this issue Jan 30, 2024 · 2 comments

Comments

@kk-vv
Copy link

kk-vv commented Jan 30, 2024

    let swapTransaction = "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHE6qKuts57bO2mg6cbj30QT4A3skmECnYiUVLCsOTirdeCgUkQaFYTleMcAX2p74eBXQZd1dwDyQZAPJfSv2KGc4W3FfOv2Xk+oeN6f/J0NU72gYddLzELx4G5UGmCxeNgj8R1MPvyuvS2qXi6VM9UWstHrV+HUZwbaukvr0Q0WY9Q+6gPplbNhPv+SK6XOQSX8+FMvOyP12TWA3oJ+XkLeVG4Udk5e5oReTsPZ52w8mzs3/ivxQXTupZBJzIVPHw/k54rg5UE6ZjmyUBpObjmq0QBWuBNpLrILwzSDuKyv2HXAcVuklgKT/VF1QWEnmrf7ArRq42XRiUkdWIZYgEfrNuCHH/POhqrZBNawsW/vjZ0w5tXghOCOpXZOYKLcemsLmFrjy6CB49a7T3SzV9/jKgKMC9Qt5n5ypgWf4B2TlNyVrr4IBnDfDn1F4pIswzwRa4dcMGijQHlQPLvHCWcnbb0Qs6UV6mEE7Jw0D1r3D9NZXd6iIwj4TsasfYvhotfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAAAEedVb8jHAbu50xW7OaBUH/bGy3qP0jlECsc2iVrwTjwbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpjJclj04kifG7PRApFI4NgwtaE5na/xCEBI572Nvp+Fm0P/on9df2SnTAmx8pWHneSwmrNt/J3VFLMhqns4zl6OL4d+g9rsaIj0Orta57MRu3jDSWCJf85ae4LBbiD/GX9tnJbfcDAMPlrdqyxs23gNR9+Snk0dv5uKt9vG+rsqgIDQAFAjSEBgANAAkDr5IDAAAAAAAQBgACACUMDwEBDAIAAgwCAAAAgJaYAAAAAAAPAQIBERAGAAcAKAwPAQEOOg8SAAIBCgclKA4OEQ4mEicdAQMaGBkPCBwbCw4jDxMiFBUXJBYTExMTExMDCRIhDxIeCiAJHwQFBiktwSCbM0HWnIEAAwAAABpkAAEHZAECEQBkAgOAlpgAAAAAAAgCky4AAAAAMgAADwMCAAABCQNciv9l8mgl8j6Fd6xh+aVvmEOc54Bo9QVJ10TmSZpG0gXr6uzo6QQqCwxGVy4M7t45sy4vc4DaiT7ps5V5J3MYJmWX01fgbyZiOTcGlMPCx8TJA+nGyFVVKMyqsvHK2ZNsvoVS7mHQL2FekI0eZHSdNlR6FTuiA6SjoQKQpg=="
    let data = Data(base64Encoded: swapTransaction)
    let transaction = try Transaction.from(data: data!)
@0xjorgev
Copy link
Contributor

0xjorgev commented Aug 9, 2024

Hey there, I think I am having the same issue trying to execute a JUP swap, it looks like the data sent to the function is been nullified and crashes when trying to removeFirst() on the Message Object, I'd been trying to create an extension to expand of modify this function and latter add it over a pull request, but haven't been able to make it work.

@0xjorgev
Copy link
Contributor

I was able to make this work, in my case by Using a VersionedTransaction instead of a Transaction, the code looks like this:

let rawData = Data(base64Encoded:"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHE6qKuts57bO2mg6cbj30QT4A3skmECnYiUVLCsOTirdeCgUkQaFYTleMcAX2p74eBXQZd1dwDyQZAPJfSv2KGc4W3FfOv2Xk+oeN6f/J0NU72gYddLzELx4G5UGmCxeNgj8R1MPvyuvS2qXi6VM9UWstHrV+HUZwbaukvr0Q0WY9Q+6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6SjoQKQpg==")!
var versioned = try VersionedTransaction.deserialize(data: rawData)
try versioned.sign(signers: [account])
let configs = RequestConfiguration(encoding: "base64")!
let hash = try await solanaClient().apiClient.sendTransaction(transaction: versioned.serialize().base64EncodedString(), configs: configs)

Also take into account that this needs to be executed on Mainnet not Dev or Test net.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants