Giter Site home page Giter Site logo

terra-rust's Issues

terra-rust-wallet: compile errors due to lack of Sync

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.

Too many redirects

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.