mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Updated to later version of substrate so that it compiles.
(Referencing substrate this way you only have to search and replace one string to upgrade)
This commit is contained in:
+17
-14
@@ -25,7 +25,10 @@ tokio1 = ["jsonrpsee-http-client/tokio1", "jsonrpsee-ws-client/tokio1"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.49"
|
||||
codec = { package = "parity-scale-codec", version = "2.1", default-features = false, features = ["derive", "full"] }
|
||||
codec = { package = "parity-scale-codec", version = "2.1", default-features = false, features = [
|
||||
"derive",
|
||||
"full",
|
||||
] }
|
||||
dyn-clone = "1.0.4"
|
||||
futures = "0.3.13"
|
||||
hex = "0.4.3"
|
||||
@@ -43,17 +46,17 @@ url = "2.2.1"
|
||||
substrate-subxt-client = { version = "0.7.0", path = "client", optional = true }
|
||||
substrate-subxt-proc-macro = { version = "0.15.0", path = "proc-macro" }
|
||||
|
||||
sp-application-crypto = "3.0.0"
|
||||
sp-core = "3.0.0"
|
||||
sp-rpc = "3.0.0"
|
||||
sp-runtime = "3.0.0"
|
||||
sp-std = "3.0.0"
|
||||
sp-version = "3.0.0"
|
||||
sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
|
||||
frame-metadata = "13.0.0"
|
||||
frame-support = "3.0.0"
|
||||
pallet-indices = "3.0.0"
|
||||
pallet-staking = "3.0.0"
|
||||
frame-metadata = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
pallet-indices = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
pallet-staking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5.0"
|
||||
@@ -62,6 +65,6 @@ env_logger = "0.8.3"
|
||||
tempdir = "0.3.7"
|
||||
wabt = "0.10.0"
|
||||
which = "4.0.2"
|
||||
sp-keyring = "3.0.0"
|
||||
frame-system = "3.0.0"
|
||||
pallet-balances = "3.0.0"
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
|
||||
+11
-6
@@ -1,7 +1,10 @@
|
||||
[package]
|
||||
name = "substrate-subxt-client"
|
||||
version = "0.7.0"
|
||||
authors = ["David Craven <david@craven.ch>", "Parity Technologies <admin@parity.io>"]
|
||||
authors = [
|
||||
"David Craven <david@craven.ch>",
|
||||
"Parity Technologies <admin@parity.io>",
|
||||
]
|
||||
edition = "2018"
|
||||
|
||||
license = "GPL-3.0"
|
||||
@@ -20,13 +23,15 @@ log = "0.4.13"
|
||||
serde_json = "1.0.61"
|
||||
thiserror = "1.0.23"
|
||||
|
||||
sc-client-db = "0.9.0"
|
||||
sp-keyring = "3.0.0"
|
||||
sc-network = { version = "0.9.0", default-features = false }
|
||||
sc-service = { version = "0.9.0", default-features = false }
|
||||
sc-client-db = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10", default-features = false }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10", default-features = false }
|
||||
|
||||
[target.'cfg(target_arch="x86_64")'.dependencies]
|
||||
sc-service = { version = "0.9.0", default-features = false, features = ["wasmtime"] }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10", default-features = false, features = [
|
||||
"wasmtime",
|
||||
] }
|
||||
|
||||
[dev-dependencies]
|
||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
[package]
|
||||
name = "substrate-subxt-proc-macro"
|
||||
version = "0.15.0"
|
||||
authors = ["David Craven <david@craven.ch>", "Parity Technologies <admin@parity.io>"]
|
||||
authors = [
|
||||
"David Craven <david@craven.ch>",
|
||||
"Parity Technologies <admin@parity.io>",
|
||||
]
|
||||
edition = "2018"
|
||||
autotests = false
|
||||
|
||||
@@ -26,13 +29,15 @@ synstructure = "0.12.4"
|
||||
|
||||
[dev-dependencies]
|
||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", features = [
|
||||
"derive",
|
||||
] }
|
||||
env_logger = "0.8.2"
|
||||
pretty_assertions = "0.6.1"
|
||||
substrate-subxt = { path = ".." }
|
||||
trybuild = "1.0.38"
|
||||
|
||||
sp-keyring = "3.0.0"
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.10" }
|
||||
|
||||
[[test]]
|
||||
name = "balances"
|
||||
|
||||
+7
-9
@@ -16,16 +16,10 @@
|
||||
|
||||
use jsonrpsee_types::Error as RequestError;
|
||||
use sp_core::crypto::SecretStringError;
|
||||
use sp_runtime::{
|
||||
transaction_validity::TransactionValidityError,
|
||||
DispatchError,
|
||||
};
|
||||
use sp_runtime::{transaction_validity::TransactionValidityError, DispatchError};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::metadata::{
|
||||
Metadata,
|
||||
MetadataError,
|
||||
};
|
||||
use crate::metadata::{Metadata, MetadataError};
|
||||
|
||||
/// Error enum.
|
||||
#[derive(Debug, Error)]
|
||||
@@ -139,7 +133,11 @@ impl RuntimeError {
|
||||
DispatchError::CannotLookup => Ok(Self::CannotLookup),
|
||||
DispatchError::ConsumerRemaining => Ok(Self::ConsumerRemaining),
|
||||
DispatchError::NoProviders => Ok(Self::NoProviders),
|
||||
DispatchError::Other(msg) => Ok(Self::Other(msg.into())),
|
||||
DispatchError::Arithmetic(_math_error) => {
|
||||
Ok(Self::Other("math_error".into()))
|
||||
}
|
||||
DispatchError::Token(_token_error) => Ok(Self::Other("token error".into())),
|
||||
DispatchError::Other(msg) => Ok(Self::Other(msg.to_string())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-55
@@ -14,46 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use codec::{
|
||||
Codec,
|
||||
Compact,
|
||||
Decode,
|
||||
Encode,
|
||||
Input,
|
||||
Output,
|
||||
};
|
||||
use codec::{Codec, Compact, Decode, Encode, Input, Output};
|
||||
use dyn_clone::DynClone;
|
||||
use sp_runtime::{
|
||||
DispatchError,
|
||||
DispatchResult,
|
||||
};
|
||||
use sp_runtime::{DispatchError, DispatchResult};
|
||||
use std::{
|
||||
collections::{
|
||||
hash_map::{
|
||||
Entry,
|
||||
HashMap,
|
||||
},
|
||||
hash_map::{Entry, HashMap},
|
||||
HashSet,
|
||||
},
|
||||
fmt,
|
||||
marker::{
|
||||
PhantomData,
|
||||
Send,
|
||||
},
|
||||
marker::{PhantomData, Send},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
error::{
|
||||
Error,
|
||||
RuntimeError,
|
||||
},
|
||||
metadata::{
|
||||
EventArg,
|
||||
Metadata,
|
||||
},
|
||||
Phase,
|
||||
Runtime,
|
||||
System,
|
||||
error::{Error, RuntimeError},
|
||||
metadata::{EventArg, Metadata},
|
||||
Phase, Runtime, System,
|
||||
};
|
||||
|
||||
/// Raw bytes for an Event
|
||||
@@ -206,20 +182,18 @@ impl<T: Runtime + System> EventsDecoder<T> {
|
||||
self.decode_raw_bytes(&[*arg.clone()], input, output, errors)?
|
||||
}
|
||||
}
|
||||
EventArg::Option(arg) => {
|
||||
match input.read_byte()? {
|
||||
0 => output.push_byte(0),
|
||||
1 => {
|
||||
output.push_byte(1);
|
||||
self.decode_raw_bytes(&[*arg.clone()], input, output, errors)?
|
||||
}
|
||||
_ => {
|
||||
return Err(Error::Other(
|
||||
"unexpected first byte decoding Option".into(),
|
||||
))
|
||||
}
|
||||
EventArg::Option(arg) => match input.read_byte()? {
|
||||
0 => output.push_byte(0),
|
||||
1 => {
|
||||
output.push_byte(1);
|
||||
self.decode_raw_bytes(&[*arg.clone()], input, output, errors)?
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
return Err(Error::Other(
|
||||
"unexpected first byte decoding Option".into(),
|
||||
))
|
||||
}
|
||||
},
|
||||
EventArg::Tuple(args) => {
|
||||
self.decode_raw_bytes(args, input, output, errors)?
|
||||
}
|
||||
@@ -234,7 +208,7 @@ impl<T: Runtime + System> EventsDecoder<T> {
|
||||
output.write(&buf);
|
||||
Ok(())
|
||||
} else {
|
||||
return Err(Error::TypeSizeUnavailable(name.to_owned()))
|
||||
return Err(Error::TypeSizeUnavailable(name.to_owned()));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -354,15 +328,8 @@ pub enum Raw {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use frame_metadata::{
|
||||
DecodeDifferent,
|
||||
ErrorMetadata,
|
||||
EventMetadata,
|
||||
ExtrinsicMetadata,
|
||||
ModuleMetadata,
|
||||
RuntimeMetadata,
|
||||
RuntimeMetadataPrefixed,
|
||||
RuntimeMetadataV12,
|
||||
META_RESERVED,
|
||||
DecodeDifferent, ErrorMetadata, EventMetadata, ExtrinsicMetadata, ModuleMetadata,
|
||||
RuntimeMetadata, RuntimeMetadataPrefixed, RuntimeMetadataV13, META_RESERVED,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
@@ -399,7 +366,7 @@ mod tests {
|
||||
let decoder = EventsDecoder::<TestRuntime>::new(
|
||||
Metadata::try_from(RuntimeMetadataPrefixed(
|
||||
META_RESERVED,
|
||||
RuntimeMetadata::V12(RuntimeMetadataV12 {
|
||||
RuntimeMetadata::V13(RuntimeMetadataV13 {
|
||||
modules: DecodeDifferent::Decoded(vec![ModuleMetadata {
|
||||
name: DecodeDifferent::Decoded("System".to_string()),
|
||||
storage: None,
|
||||
|
||||
+25
-47
@@ -14,27 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
convert::TryFrom,
|
||||
marker::PhantomData,
|
||||
str::FromStr,
|
||||
};
|
||||
use std::{collections::HashMap, convert::TryFrom, marker::PhantomData, str::FromStr};
|
||||
|
||||
use codec::{
|
||||
Decode,
|
||||
Encode,
|
||||
Error as CodecError,
|
||||
};
|
||||
use codec::{Decode, Encode, Error as CodecError};
|
||||
|
||||
use frame_metadata::{
|
||||
DecodeDifferent,
|
||||
RuntimeMetadata,
|
||||
RuntimeMetadataPrefixed,
|
||||
StorageEntryModifier,
|
||||
StorageEntryType,
|
||||
StorageHasher,
|
||||
META_RESERVED,
|
||||
DecodeDifferent, RuntimeMetadata, RuntimeMetadataPrefixed, StorageEntryModifier,
|
||||
StorageEntryType, StorageHasher, META_RESERVED,
|
||||
};
|
||||
use sp_core::storage::StorageKey;
|
||||
|
||||
@@ -292,13 +278,11 @@ impl StorageMetadata {
|
||||
StorageHasher::Blake2_256 => sp_core::blake2_256(bytes).to_vec(),
|
||||
StorageHasher::Twox128 => sp_core::twox_128(bytes).to_vec(),
|
||||
StorageHasher::Twox256 => sp_core::twox_256(bytes).to_vec(),
|
||||
StorageHasher::Twox64Concat => {
|
||||
sp_core::twox_64(bytes)
|
||||
.iter()
|
||||
.chain(bytes)
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
StorageHasher::Twox64Concat => sp_core::twox_64(bytes)
|
||||
.iter()
|
||||
.chain(bytes)
|
||||
.cloned()
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,24 +292,20 @@ impl StorageMetadata {
|
||||
|
||||
pub fn plain(&self) -> Result<StoragePlain, MetadataError> {
|
||||
match &self.ty {
|
||||
StorageEntryType::Plain(_) => {
|
||||
Ok(StoragePlain {
|
||||
prefix: self.prefix().0,
|
||||
})
|
||||
}
|
||||
StorageEntryType::Plain(_) => Ok(StoragePlain {
|
||||
prefix: self.prefix().0,
|
||||
}),
|
||||
_ => Err(MetadataError::StorageTypeError),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map<K: Encode>(&self) -> Result<StorageMap<K>, MetadataError> {
|
||||
match &self.ty {
|
||||
StorageEntryType::Map { hasher, .. } => {
|
||||
Ok(StorageMap {
|
||||
_marker: PhantomData,
|
||||
prefix: self.prefix().0,
|
||||
hasher: hasher.clone(),
|
||||
})
|
||||
}
|
||||
StorageEntryType::Map { hasher, .. } => Ok(StorageMap {
|
||||
_marker: PhantomData,
|
||||
prefix: self.prefix().0,
|
||||
hasher: hasher.clone(),
|
||||
}),
|
||||
_ => Err(MetadataError::StorageTypeError),
|
||||
}
|
||||
}
|
||||
@@ -338,14 +318,12 @@ impl StorageMetadata {
|
||||
hasher,
|
||||
key2_hasher,
|
||||
..
|
||||
} => {
|
||||
Ok(StorageDoubleMap {
|
||||
_marker: PhantomData,
|
||||
prefix: self.prefix().0,
|
||||
hasher1: hasher.clone(),
|
||||
hasher2: key2_hasher.clone(),
|
||||
})
|
||||
}
|
||||
} => Ok(StorageDoubleMap {
|
||||
_marker: PhantomData,
|
||||
prefix: self.prefix().0,
|
||||
hasher1: hasher.clone(),
|
||||
hasher2: key2_hasher.clone(),
|
||||
}),
|
||||
_ => Err(MetadataError::StorageTypeError),
|
||||
}
|
||||
}
|
||||
@@ -526,10 +504,10 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
|
||||
|
||||
fn try_from(metadata: RuntimeMetadataPrefixed) -> Result<Self, Self::Error> {
|
||||
if metadata.0 != META_RESERVED {
|
||||
return Err(ConversionError::InvalidPrefix.into())
|
||||
return Err(ConversionError::InvalidPrefix.into());
|
||||
}
|
||||
let meta = match metadata.1 {
|
||||
RuntimeMetadata::V12(meta) => meta,
|
||||
RuntimeMetadata::V13(meta) => meta,
|
||||
_ => return Err(ConversionError::InvalidVersion.into()),
|
||||
};
|
||||
let mut modules = HashMap::new();
|
||||
|
||||
Reference in New Issue
Block a user