Skip to content

Commit

Permalink
Fix automation-price with polkadot-v0.9.43
Browse files Browse the repository at this point in the history
  • Loading branch information
imstar15 committed Oct 26, 2023
1 parent 871d8eb commit fc90557
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions pallets/automation-price/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.1.3" }
jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }

sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

pallet-automation-price-rpc-runtime-api = { path = "./runtime-api" }
5 changes: 3 additions & 2 deletions pallets/automation-price/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.3", features = ["derive", "full"], default-features = false }
serde = { version = "1.0.144", features = ["derive"], optional = true }
scale-info = { version = "2.1", features = ["derive"], default-features = false }

sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion pallets/automation-price/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::{Codec, Decode, Encode};
use scale_info::TypeInfo;
use sp_std::vec::Vec;

#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};

#[derive(Debug, PartialEq, Encode, Decode)]
#[derive(Debug, PartialEq, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
pub struct FeeDetails<Balance> {
Expand Down
4 changes: 2 additions & 2 deletions pallets/automation-price/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
at: Option<Block::Hash>,
) -> RpcResult<FeeDetails<NumberOrHex>> {
let api = self.client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let at_hash = at.unwrap_or_else(|| self.client.info().best_hash);

let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| {
CallError::Custom(ErrorObject::owned(
Expand All @@ -100,7 +100,7 @@ where
))
})?;
let fee_details = api
.query_fee_details(&at, uxt)
.query_fee_details(at_hash, uxt)
.map_err(|e| {
CallError::Custom(ErrorObject::owned(
Error::RuntimeError.into(),
Expand Down

0 comments on commit fc90557

Please sign in to comment.