mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 13:45:40 +00:00
fixes
This commit is contained in:
+1
-2
@@ -7,6 +7,5 @@ members = [
|
|||||||
"macro",
|
"macro",
|
||||||
"subxt",
|
"subxt",
|
||||||
"test-runtime",
|
"test-runtime",
|
||||||
# TODO(niklasad1): remove to separate repo
|
|
||||||
"client"
|
|
||||||
]
|
]
|
||||||
|
exclude = ["client"]
|
||||||
|
|||||||
+13
-8
@@ -22,23 +22,28 @@ log = "0.4.13"
|
|||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|
||||||
sc-client-db = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-client-db = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-network = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-service = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
|
|
||||||
tokio = { version = "1.16", features = ["rt-multi-thread"] }
|
tokio = { version = "1.16", features = ["rt-multi-thread"] }
|
||||||
|
|
||||||
[target.'cfg(target_arch="x86_64")'.dependencies]
|
[target.'cfg(target_arch="x86_64")'.dependencies]
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false, features = [
|
sc-service = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0", features = ["wasmtime"] }
|
||||||
"wasmtime",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
|
||||||
node-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false }
|
node-cli = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0", default-features = false }
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
subxt = { path = "../subxt" }
|
subxt = { path = "../subxt" }
|
||||||
|
# TODO(niklasad1): we should probably generate some other runtime because of the
|
||||||
|
# tag i.e. not "master".
|
||||||
test-runtime = { path = "../test-runtime" }
|
test-runtime = { path = "../test-runtime" }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
sp-core = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
|
sp-runtime = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
|
sp-version = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" }
|
||||||
|
|||||||
+4
-1
@@ -35,6 +35,7 @@ use jsonrpsee::core::{
|
|||||||
async_trait,
|
async_trait,
|
||||||
client::{
|
client::{
|
||||||
Client as JsonRpcClient,
|
Client as JsonRpcClient,
|
||||||
|
ClientBuilder as JsonRpcClientBuilder,
|
||||||
TransportReceiverT,
|
TransportReceiverT,
|
||||||
TransportSenderT,
|
TransportSenderT,
|
||||||
},
|
},
|
||||||
@@ -153,7 +154,9 @@ impl SubxtClient {
|
|||||||
|
|
||||||
impl From<SubxtClient> for JsonRpcClient {
|
impl From<SubxtClient> for JsonRpcClient {
|
||||||
fn from(client: SubxtClient) -> Self {
|
fn from(client: SubxtClient) -> Self {
|
||||||
(client.sender, client.receiver).into()
|
JsonRpcClientBuilder::default()
|
||||||
|
.request_timeout(std::time::Duration::from_secs(5 * 60))
|
||||||
|
.build(client.sender, client.receiver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-11
@@ -26,18 +26,22 @@ use node_cli::service::NewFullBase;
|
|||||||
use sp_keyring::AccountKeyring;
|
use sp_keyring::AccountKeyring;
|
||||||
use subxt::{
|
use subxt::{
|
||||||
ClientBuilder,
|
ClientBuilder,
|
||||||
PairSigner,
|
|
||||||
DefaultConfig,
|
DefaultConfig,
|
||||||
DefaultExtra
|
DefaultExtra,
|
||||||
|
PairSigner,
|
||||||
};
|
};
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
use test_runtime::node_runtime::{
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
};
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
pub async fn test_embedded_client() {
|
pub async fn test_embedded_client() {
|
||||||
tracing_subscriber::FmtSubscriber::builder()
|
tracing_subscriber::FmtSubscriber::builder()
|
||||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||||
.try_init()
|
.try_init()
|
||||||
.expect("setting default subscriber failed");
|
.expect("setting default subscriber failed");
|
||||||
|
|
||||||
let tmp = TempDir::new("subxt-").expect("failed to create tempdir");
|
let tmp = TempDir::new("subxt-").expect("failed to create tempdir");
|
||||||
let config = SubxtClientConfig {
|
let config = SubxtClientConfig {
|
||||||
@@ -56,7 +60,7 @@ pub async fn test_embedded_client() {
|
|||||||
chain_spec: node_cli::chain_spec::development_config(),
|
chain_spec: node_cli::chain_spec::development_config(),
|
||||||
role: Role::Authority(AccountKeyring::Alice),
|
role: Role::Authority(AccountKeyring::Alice),
|
||||||
telemetry: None,
|
telemetry: None,
|
||||||
wasm_method: WasmExecutionMethod::Compiled,
|
wasm_method: WasmExecutionMethod::Interpreted,
|
||||||
tokio_handle: tokio::runtime::Handle::current(),
|
tokio_handle: tokio::runtime::Handle::current(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,7 +79,8 @@ pub async fn test_embedded_client() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let api: test_runtime::node_runtime::RuntimeApi<DefaultConfig, DefaultExtra<_>> = ext_client.clone().to_runtime_api();
|
let api: node_runtime::RuntimeApi<DefaultConfig, DefaultExtra<_>> =
|
||||||
|
ext_client.clone().to_runtime_api();
|
||||||
|
|
||||||
// verify that we can read storage
|
// verify that we can read storage
|
||||||
api.storage()
|
api.storage()
|
||||||
@@ -88,7 +93,7 @@ pub async fn test_embedded_client() {
|
|||||||
let bob_address = AccountKeyring::Bob.to_account_id().into();
|
let bob_address = AccountKeyring::Bob.to_account_id().into();
|
||||||
|
|
||||||
// verify that we can call dispatchable functions
|
// verify that we can call dispatchable functions
|
||||||
let events = api
|
let success = api
|
||||||
.tx()
|
.tx()
|
||||||
.balances()
|
.balances()
|
||||||
.transfer(bob_address, 100_000)
|
.transfer(bob_address, 100_000)
|
||||||
@@ -97,10 +102,10 @@ pub async fn test_embedded_client() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.wait_for_finalized_success()
|
.wait_for_finalized_success()
|
||||||
.await
|
.await
|
||||||
|
.unwrap()
|
||||||
|
.has_event::<system::events::ExtrinsicSuccess>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
panic!("{:?}", events);
|
|
||||||
|
|
||||||
// verify that we receive events
|
// verify that we receive events
|
||||||
// assert!(success);
|
assert!(success);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user