5

I'm trying to get Solana transaction status using Rust. You can get the transaction status using explorer.solana.com, but I want to get it via code.

I tried to use the get_signature_status function in the Rust SDK. The function above expect a signature object.

So I tried using it:

let sig_s = String::from("...");
let sig: Signature = Signature(sig_s.as_bytes());
let stat = self.client.get_signature_status(&sig);
println!("{:?}", stat);

But I getting error of: "constructor is not visible here due to private fields"

I'm trying to understand if there is another way to create Signature object, I guess there should be a way to create Signature object and get its status.

1 Answer 1

5

You are probably using outdated version of solana docs. In the latest version, Signature implements FromStr so you can do the following:

let sig = Signature::from_str(sig_s).unwrap();

And that'll get you a signature you can use.

See https://docs.rs/solana-sdk for the latest version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.