pfc-validator / terra-rust Goto Github PK
View Code? Open in Web Editor NEWRust <-> Terrad API via LCD service
License: Apache License 2.0
Rust <-> Terrad API via LCD service
License: Apache License 2.0
I believe this is related exclusively to error handling code. I'm seeing error messages such as the following:
error[E0277]: `*const i8` cannot be shared between threads safely
--> terra-rust-wallet/src/lib.rs:62:72
|
62 | keyring.set_password(&serde_json::to_string(&wallet_internal)?)?;
| ^ `*const i8` cannot be shared between threads safely
|
= help: within `KeyringError`, the trait `Sync` is not implemented for `*const i8`
= note: required because it appears within the type `dbus::ffi::DBusError`
= note: required because it appears within the type `dbus::Error`
= note: required because it appears within the type `secret_service::error::SsError`
= note: required because it appears within the type `KeyringError`
= note: required because of the requirements on the impl of `From<KeyringError>` for `anyhow::Error`
= note: required by `std::convert::From::from`
error[E0277]: `*const std::ffi::c_void` cannot be shared between threads safely
--> terra-rust-wallet/src/lib.rs:62:72
|
62 | keyring.set_password(&serde_json::to_string(&wallet_internal)?)?;
| ^ `*const std::ffi::c_void` cannot be shared between threads safely
|
= help: within `KeyringError`, the trait `Sync` is not implemented for `*const std::ffi::c_void`
= note: required because it appears within the type `dbus::ffi::DBusError`
= note: required because it appears within the type `dbus::Error`
= note: required because it appears within the type `secret_service::error::SsError`
= note: required because it appears within the type `KeyringError`
= note: required because of the requirements on the impl of `From<KeyringError>` for `anyhow::Error`
= note: required by `std::convert::From::from`
I'll try to investigate this a bit further myself.
When running the code below: (slightly modified version of the example code).
use bitcoin::secp256k1::Secp256k1;
use terra_rust_api::{Terra, GasOptions, PrivateKey, Message};
use terra_rust_api::core_types::{Coin};
use terra_rust_api::messages::MsgSend;
async fn send_tx() {
// set up the LCD client
let gas_opts = GasOptions::create_with_gas_estimate("50ukrw",1.4).unwrap();
let terra = Terra::lcd_client("https://bombay-lcd.terra.dev/", "bombay-12", &gas_opts, None).await.unwrap();
// generate a private key
let secp = Secp256k1::new();
let from_key = PrivateKey::from_words(&secp,"uncle simple tide bundle apart absurd tenant fluid slam actor caught month hip tornado cattle regular nerve brand tower boy alert crash good neck").unwrap();
let from_public_key = from_key.public_key(&secp);
// generate the message SEND 1000 uluna from your private key to someone else
let coin: Coin = Coin::parse("1000uluna").unwrap().unwrap();
let from_account = from_public_key.account().unwrap();
let send: Message = MsgSend::create(from_account, "terra1usws7c2c6cs7nuc8vma9qzaky5pkgvm2uag6rh".to_string(), vec![coin]);
// generate the transaction & calc fees
let messages = vec![send];
// and submit the message(s) to the chain
let resp = terra.submit_transaction_sync(
&secp,
&from_key,
&messages,
None
)
.await;
println!("{:?}", resp)
}
fn main() {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(send_tx());
}
I'm getting this error:
Err(Reqwest HTTP(s) Error
Caused by:
0: error following redirect for url (https://bombay-lcd.terra.dev/auth/accounts/terra1rz4mcfwmqkgv7ss2tygpy79ffd33gh32as49j0): too many redirects
1: too many redirects)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.