kompendium-ano / factom-rust-client Goto Github PK
View Code? Open in Web Editor NEWRust JSON-RPC client for the Factom protocol
License: Apache License 2.0
Rust JSON-RPC client for the Factom protocol
License: Apache License 2.0
Examples are still using the old futures handling of map/and_then
Update with async syntax
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
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,
}
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.