-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added runtime-api for eth-event polling (#376)
Signed-off-by: Ivan Cholakov <icholakov1@gmail.com> Co-authored-by: Thanos Doukoudakis <56822898+thadouk@users.noreply.github.com>
- Loading branch information
1 parent
926ce67
commit e163adf
Showing
9 changed files
with
185 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[package] | ||
name = "pallet-eth-bridge-runtime-api" | ||
description = "Runtime API for module" | ||
license = "GPL-3.0" | ||
version = { workspace = true } | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
repository = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.6.1", features = ["derive"], default-features = false } | ||
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } | ||
pallet-eth-bridge = { default-features = false, path = "../../eth-bridge" } | ||
pallet-avn = { path = "../../avn", default-features = false } | ||
sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } | ||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } | ||
sp-avn-common = { default-features = false, path = "../../../primitives/avn-common" } | ||
sp-application-crypto = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } | ||
|
||
|
||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"frame-support/std", | ||
"pallet-eth-bridge/std", | ||
"sp-api/std", | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
use codec::Codec; | ||
use frame_support::dispatch::Vec; | ||
use sp_avn_common::event_discovery::{EthBlockRange, EthereumEventsPartition}; | ||
use sp_core::{H160, H256}; | ||
|
||
sp_api::decl_runtime_apis! { | ||
|
||
#[api_version(1)] | ||
pub trait EthEventHandlerApi<AccountId> | ||
where | ||
AccountId: Codec, | ||
{ | ||
fn query_active_block_range()-> (EthBlockRange, u16); | ||
fn query_has_author_casted_event_vote(account_id: AccountId) -> bool; | ||
fn query_signatures() -> Vec<H256>; | ||
fn query_bridge_contract() -> H160; | ||
fn create_proof(account_id:AccountId, events_partition:EthereumEventsPartition)-> Vec<u8>; | ||
fn submit_vote( | ||
author: AccountId, | ||
events_partition: EthereumEventsPartition, | ||
signature: sp_core::sr25519::Signature | ||
) -> Result<(), ()>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters