metaclips / rustdcr Goto Github PK
View Code? Open in Web Editor NEWDecred in Rust
License: MIT License
Decred in Rust
License: MIT License
This issues tracks RPC method that are to be integrated in RustDCR. It is fairly easy to implement RPC methods by fulfilling some rust macros rules.
To create a RPC command, there are chain command macro generators and chain notification macro generators that can be called upon to easily generate RPC client commands and notification.
To create client commands, we
Generate a future/async type of the RPC command
using the build future macros the macros should entail the name of the RPC command with an appended tag Future (example, GetBlock command should be named GetBlockFuture in the build_future
macros). build_future
macros should also include a Result
return type of whatever type the command is to receive from the RPC server
(example, GetBlock is to receive a Result<i64, Error>) as its second parameter.on_message
function MUST
also be created for the the specific future type which handles decoding the data returned by the server to a a required type. GetBlockCount on_message function exampleGenerate a command
using the command generator macros which
&[]
of JSON value to be sent to the RPC server, example provided. NOTE we should take note of the order of value parameters while sending.get_block_verbose
contains two input parameter block_hash
and verbose_tx
which must be passed by the client. to generate the get_block_verbose
we pass command_generator!(
"get_block_verbose returns a data structure from the server with information
about a block given its hash.",
get_block_verbose,
future_type::GetBlockVerboseFuture,
commands::METHOD_GET_BLOCK,
&[
serde_json::json!(block_hash),
serde_json::json!(true),
serde_json::json!(verbose_tx)
],
block_hash: String,
verbose_tx: bool
);
where the 5th parameter is the array containing, block_hash, true (as boolean), verbose_tx
and the 6th and 7th parameter, block_hash
verbose_tx
is the function input parameter of get_block_verbose
with stated types. The generated function becomes
pub async fn get_block_verbose(&mut self, block_hash: String, verbose_tx: bool) -> Result<future_type::GetBlockVerboseFuture, RpcClientError>
future
typenotification_generator
macros which entails
&[]
of JSON value to be sent to the RPC servereither be defined using the either_defined() (ensures at least one of the notification handler specified is defined)
or all notification handler are defined using all_defined()
More here #10
Add continuous integration to perform cargo clippy, cargo check, cargo build and code coverage in our codebase
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.