diff --git a/Cargo.toml b/Cargo.toml
index 39484b143c..6b584e23d3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,10 +28,10 @@ frame-system = { git = "https://github.com/paritytech/substrate/", package = "fr
pallet-balances = { git = "https://github.com/paritytech/substrate/", package = "pallet-balances" }
pallet-contracts = { git = "https://github.com/paritytech/substrate/", package = "pallet-contracts" }
pallet-indices = { git = "https://github.com/paritytech/substrate/", package = "pallet-indices" }
-substrate-rpc-api = { git = "https://github.com/paritytech/substrate/", package = "substrate-rpc-api" }
+substrate-rpc-api = { git = "https://github.com/paritytech/substrate/", package = "sc-rpc-api" }
substrate-rpc-primitives = { git = "https://github.com/paritytech/substrate/", package = "substrate-rpc-primitives" }
substrate-primitives = { git = "https://github.com/paritytech/substrate/", package = "substrate-primitives" }
-txpool = { git = "https://github.com/paritytech/substrate/", package = "substrate-transaction-graph" }
+txpool = { git = "https://github.com/paritytech/substrate/", package = "sc-transaction-graph" }
url = "1.7"
[dev-dependencies]
diff --git a/src/rpc.rs b/src/rpc.rs
index cc7062b437..336f1687e2 100644
--- a/src/rpc.rs
+++ b/src/rpc.rs
@@ -14,18 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with substrate-subxt. If not, see .
-use crate::{
- error::Error,
- events::{
- EventsDecoder,
- RuntimeEvent,
- },
- metadata::Metadata,
- frame::{
- balances::Balances,
- system::System,
- },
-};
use futures::future::{
self,
Future,
@@ -55,7 +43,27 @@ use substrate_rpc_api::{
chain::ChainClient,
state::StateClient,
};
-use substrate_rpc_primitives::number::NumberOrHex;
+use substrate_rpc_primitives::{
+ list::ListOrValue,
+ number::NumberOrHex,
+};
+
+use crate::{
+ error::Error,
+ events::{
+ EventsDecoder,
+ RawEvent,
+ RuntimeEvent,
+ },
+ frame::{
+ balances::Balances,
+ system::{
+ System,
+ SystemEvent,
+ },
+ },
+ metadata::Metadata,
+};
pub type ChainBlock = SignedBlock::Header, OpaqueExtrinsic>>;
pub type BlockNumber = NumberOrHex<::BlockNumber>;
@@ -102,10 +110,15 @@ impl Rpc {
pub fn genesis_hash(&self) -> impl Future- {
let block_zero = T::BlockNumber::min_value();
self.chain
- .block_hash(Some(NumberOrHex::Number(block_zero)))
+ .block_hash(Some(ListOrValue::Value(NumberOrHex::Number(block_zero))))
.map_err(Into::into)
- .and_then(|genesis_hash| {
- future::result(genesis_hash.ok_or("Genesis hash not found".into()))
+ .and_then(|list_or_value| {
+ future::result(
+ match list_or_value {
+ ListOrValue::Value(genesis_hash) => genesis_hash.ok_or_else(|| "Genesis hash not found".into()),
+ ListOrValue::List(_) => Err("Expected a Value, got a List".into()),
+ }
+ )
})
}
@@ -123,9 +136,17 @@ impl Rpc {
/// Get a block hash, returns hash of latest block by default
pub fn block_hash(
&self,
- hash: Option>,
+ block_number: Option>,
) -> impl Future
- , Error = Error> {
- self.chain.block_hash(hash).map_err(Into::into)
+ self.chain
+ .block_hash(block_number.map(|bn| ListOrValue::Value(bn)))
+ .map_err(Into::into)
+ .and_then(|list_or_value| {
+ match list_or_value {
+ ListOrValue::Value(hash) => Ok(hash),
+ ListOrValue::List(_) => Err("Expected a Value, got a List".into()),
+ }
+ })
}
/// Get a Block
@@ -158,11 +179,6 @@ use substrate_primitives::{
twox_128,
};
use txpool::watcher::Status;
-
-use crate::{
- events::RawEvent,
- frame::system::SystemEvent,
-};
use frame_system::Phase;
type MapClosure = Box T + Send>;