Skip to content

Commit

Permalink
chore: upgrade to subxt 0.23.0
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
  • Loading branch information
gregdhill committed Oct 19, 2022
1 parent fe4dafa commit 20b0876
Show file tree
Hide file tree
Showing 9 changed files with 374 additions and 582 deletions.
154 changes: 58 additions & 96 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions runtime/Cargo.toml
Expand Up @@ -41,9 +41,9 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }

# Subxt dependencies
subxt = "0.22.0"
subxt = "0.23.0"
subxt-client = { path = "./client", optional = true }
jsonrpsee = { version = "0.14.0", features = ["async-client", "client-ws-transport", "macros", "jsonrpsee-types", "client", "jsonrpsee-ws-client", "jsonrpsee-client-transport"] }
jsonrpsee = { version = "0.15.1", features = ["async-client", "client-ws-transport", "macros", "jsonrpsee-types", "client", "jsonrpsee-ws-client", "jsonrpsee-client-transport"] }

bitcoin = { path = "../bitcoin" }

Expand Down
6 changes: 3 additions & 3 deletions runtime/client/Cargo.toml
Expand Up @@ -15,9 +15,9 @@ keywords = ["parity", "substrate", "blockchain"]
tokio = { version = "1.10", features = ["time", "rt-multi-thread"] }
futures = { version = "0.3.9", features = ["compat"], package = "futures" }
futures01 = { package = "futures", version = "0.1.29" }
jsonrpsee = "0.14.0"
jsonrpsee-types = "0.14.0"
jsonrpsee-core = { version = "0.14.0", features = ["async-client"] }
jsonrpsee = "0.15.1"
jsonrpsee-types = "0.15.1"
jsonrpsee-core = { version = "0.15.1", features = ["async-client"] }

log = "0.4.13"
serde_json = "1.0.61"
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/cli.rs
Expand Up @@ -6,7 +6,7 @@ use crate::{
use clap::Parser;
use sp_keyring::AccountKeyring;
use std::{collections::HashMap, num::ParseIntError, str::FromStr, time::Duration};
use subxt::sp_core::{sr25519::Pair, Pair as _};
use subxt::ext::sp_core::{sr25519::Pair, Pair as _};

#[derive(Parser, Debug, Clone)]
pub struct ProviderUserOpts {
Expand Down
20 changes: 9 additions & 11 deletions runtime/src/error.rs
@@ -1,6 +1,6 @@
pub use jsonrpsee::core::Error as JsonRpseeError;

use crate::{metadata::DispatchError, types::*, BTC_RELAY_MODULE, ISSUE_MODULE, SYSTEM_MODULE};
use crate::{types::*, BTC_RELAY_MODULE, ISSUE_MODULE, SYSTEM_MODULE};
use codec::Error as CodecError;
use jsonrpsee::{
client_transport::ws::WsHandshakeError,
Expand All @@ -10,11 +10,15 @@ use jsonrpsee::{
use prometheus::Error as PrometheusError;
use serde_json::Error as SerdeJsonError;
use std::{array::TryFromSliceError, fmt::Debug, io::Error as IoError, num::TryFromIntError, str::Utf8Error};
use subxt::{sp_core::crypto::SecretStringError, BasicError, ModuleError, TransactionError};
use subxt::{
error::{DispatchError, ModuleError, TransactionError},
ext::sp_core::crypto::SecretStringError,
};
use thiserror::Error;
use tokio::time::error::Elapsed;
use url::ParseError as UrlParseError;
pub type SubxtError = subxt::Error<DispatchError>;

pub use subxt::Error as SubxtError;

#[derive(Error, Debug)]
pub enum Error {
Expand Down Expand Up @@ -90,19 +94,13 @@ pub enum Error {
Utf8Error(#[from] Utf8Error),
}

impl From<BasicError> for Error {
fn from(err: BasicError) -> Self {
Self::SubxtRuntimeError(err.into())
}
}

impl Error {
fn is_module_err(&self, pallet_name: &str, error_name: &str) -> bool {
matches!(
self,
Error::SubxtRuntimeError(SubxtError::Module(ModuleError {
Error::SubxtRuntimeError(SubxtError::Runtime(DispatchError::Module(ModuleError{
pallet, error, ..
})) if pallet == pallet_name && error == error_name,
}))) if pallet == pallet_name && error == error_name,
)
}

Expand Down

0 comments on commit 20b0876

Please sign in to comment.