Move substrate-bridge-relay into repository (#1)

* Initial commit. CLI which parses RPC urls.

* Establish ws connections and make simple RPC requests.

* Complete bridge setup.

* Process subscription events.

* Ctrl-C handler.

* Write a bare-bones README and copy in design doc.

* Modularize code a little bit.

* Communicate with each chain in a separate task.

* Parse headers from RPC subscription notifications.

* Send (fake) extrinsics across bridge channels.

And now it's deadlocked.

* Fix deadlock.

* Clarify in README that this is not-in-progress.

* Move everything into a single folder

* Move Substrate relay into appropriate folder

* Get the Substrate Relay node compiling

* Update Cargo.lock

* Use new composite accounts from Substrate

* Remove specification document

It has been moved to the Wiki on the Github repo.

* Update author + remove comments

* Use latest master for jsonrpsee

Required renaming some stuff (e.g Client -> RawClient)

Co-authored-by: Jim Posen <jim.posen@gmail.com>
This commit is contained in:
Hernando Castano
2020-03-02 12:20:23 -05:00
committed by Bastian Köcher
parent 7ef276daba
commit ebbc4724d0
8 changed files with 661 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
use jsonrpsee::core::client::{RawClient, RawClientError, TransportClient};
use node_primitives::{BlockNumber, Hash, Header};
use sp_core::Bytes;
use sp_rpc::number::NumberOrHex;
jsonrpsee::rpc_api! {
pub SubstrateRPC {
#[rpc(method = "author_submitExtrinsic", positional_params)]
fn author_submit_extrinsic(extrinsic: Bytes) -> Hash;
#[rpc(method = "chain_getFinalizedHead")]
fn chain_finalized_head() -> Hash;
#[rpc(method = "chain_getBlockHash", positional_params)]
fn chain_block_hash(id: Option<NumberOrHex<BlockNumber>>) -> Option<Hash>;
#[rpc(method = "chain_getHeader", positional_params)]
fn chain_header(hash: Option<Hash>) -> Option<Header>;
#[rpc(positional_params)]
fn state_call(name: String, bytes: Bytes, hash: Option<Hash>) -> Bytes;
}
}
pub async fn genesis_block_hash<R: TransportClient>(client: &mut RawClient<R>)
-> Result<Option<Hash>, RawClientError<R::Error>>
{
SubstrateRPC::chain_block_hash(client, Some(NumberOrHex::Number(0))).await
}