mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Transaction queue integration + submission RPC (#99)
* Implement transaction queue RPC. * whitespace * Support without_std env in environmental! (#110) * Make environmental crate support without_std env. * Small doc fixes. * Remove dead code.
This commit is contained in:
@@ -9,6 +9,8 @@ error-chain = "0.11"
|
||||
polkadot-api = { path = "../api" }
|
||||
polkadot-primitives = { path = "../primitives" }
|
||||
polkadot-runtime = { path = "../runtime" }
|
||||
substrate-client = { path = "../../substrate/client" }
|
||||
substrate-rpc = { path = "../../substrate/rpc" }
|
||||
substrate-primitives = { path = "../../substrate/primitives" }
|
||||
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
|
||||
substrate-codec = { path = "../../substrate/codec" }
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
extern crate ed25519;
|
||||
extern crate ethereum_types;
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate substrate_rpc;
|
||||
extern crate substrate_primitives as substrate_primitives;
|
||||
extern crate substrate_runtime_primitives as substrate_runtime_primitives;
|
||||
extern crate polkadot_runtime as runtime;
|
||||
@@ -31,8 +32,10 @@ use std::collections::HashMap;
|
||||
use std::cmp::Ordering;
|
||||
use std::sync::Arc;
|
||||
|
||||
use codec::Slicable;
|
||||
use polkadot_api::PolkadotApi;
|
||||
use primitives::{AccountId, Timestamp};
|
||||
use substrate_primitives::block::Extrinsic;
|
||||
use runtime::{Block, UncheckedExtrinsic, TimestampCall, Call};
|
||||
use substrate_runtime_primitives::traits::Checkable;
|
||||
use transaction_pool::{Pool, Readiness};
|
||||
@@ -371,6 +374,16 @@ impl TransactionPool {
|
||||
}
|
||||
}
|
||||
|
||||
impl substrate_rpc::author::AsyncAuthorApi for TransactionPool {
|
||||
fn submit_extrinsic(&mut self, xt: Extrinsic) -> substrate_rpc::author::error::Result<()> {
|
||||
self.import(xt
|
||||
.using_encoded(|ref mut s| UncheckedExtrinsic::decode(s))
|
||||
.ok_or(substrate_rpc::author::error::ErrorKind::InvalidFormat)?)
|
||||
.map(|_| ())
|
||||
.map_err(|_| substrate_rpc::author::error::ErrorKind::PoolError.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user