Add an RPC method for calling a contract. (#3563)

* Sketch

* Some work on docs.

* Doc improvements.

* More docs.

* Some more docs.

* Yet another comment.

* Bump impl_version.

* Accept the block hash

* Use NumberOrHex

* Update node/rpc/src/contracts.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Move rpc/primitives
This commit is contained in:
Sergei Pepyakin
2019-09-12 13:30:10 +02:00
committed by GitHub
parent 294d172187
commit 4daac15d22
18 changed files with 279 additions and 27 deletions
+8 -2
View File
@@ -270,11 +270,17 @@ pub fn new_light<C: Send + Default + 'static>(config: Configuration<C, GenesisCo
Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, client)) as _)
)?
.with_rpc_extensions(|client, pool| {
use node_rpc::accounts::{Accounts, AccountsApi};
use node_rpc::{
accounts::{Accounts, AccountsApi},
contracts::{Contracts, ContractsApi},
};
let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(
AccountsApi::to_delegate(Accounts::new(client, pool))
AccountsApi::to_delegate(Accounts::new(client.clone(), pool))
);
io.extend_with(
ContractsApi::to_delegate(Contracts::new(client))
);
io
})?