Giter VIP home page Giter VIP logo

factom-rust-client's People

Contributors

mberry avatar samuelvanderwaal avatar sigrlami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

maxbull

factom-rust-client's Issues

Tests should use open node

Current tests require a locally hosted factomd node, this should be moved over to the opennode some tests still won't properly parse as it's not connected.

Running walletd will still be necessary

Unnecessary "to_static_str" Calls

The usage documentation shows using the to_static_str utility function to convert the string literals to static strings when directly creating the Factom struct but this is unnecessary as the Rust compiler will coerce the &str to &'static str directly as it knows the type from Factom struct declaration.

// Factomd open node and walletd locally on port 3003. Id is included in the json-rpc call.
let api = Factom{
    uri: to_static_str("https://api.factomd.net/v2").
    wallet_uri: to_static_str("http://localhost:3003/v2"),
    id: 0
}
let request = api.wallet_balances();
let response = fetch(request).unwrap();
dbg!(response);

Using the code as is results in a compiler error because to_static_str expects a String type argument:

expected struct `std::string::String`, found reference | help: try using a conversion method: `"https://api.factomd.net/v2".to_string()` |

Also note that there's a typo for the uri assignment as it should have a comma instead of a period at the end.

Correct usage should be:

let api = Factom {
    uri: "https://api.factomd.net/v2",
    wallet_uri: "http://localhost:3003/v2",
    id: 0,
}

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.