mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
testing: Adjust for the new interface
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -6,9 +6,6 @@ use crate::{subxt_test, test_context};
|
|||||||
use codec::{Compact, Encode};
|
use codec::{Compact, Encode};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
#[cfg(lightclient)]
|
|
||||||
use subxt::client::OnlineClientT;
|
|
||||||
|
|
||||||
#[cfg(fullclient)]
|
#[cfg(fullclient)]
|
||||||
use crate::utils::node_runtime;
|
use crate::utils::node_runtime;
|
||||||
#[cfg(fullclient)]
|
#[cfg(fullclient)]
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ use codec::{Decode, Encode};
|
|||||||
#[cfg(fullclient)]
|
#[cfg(fullclient)]
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
#[cfg(lightclient)]
|
|
||||||
use subxt::client::OnlineClientT;
|
|
||||||
|
|
||||||
use subxt::{
|
use subxt::{
|
||||||
backend::BackendExt,
|
backend::BackendExt,
|
||||||
error::{DispatchError, Error},
|
error::{DispatchError, Error},
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ use subxt::{
|
|||||||
SubstrateConfig,
|
SubstrateConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(lightclient)]
|
|
||||||
use subxt::client::OfflineClientT;
|
|
||||||
|
|
||||||
use subxt_signer::sr25519::dev;
|
use subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt_test]
|
#[subxt_test]
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ use subxt::{
|
|||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev;
|
use subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[cfg(lightclient)]
|
|
||||||
use subxt::client::OfflineClientT;
|
|
||||||
|
|
||||||
#[subxt_test]
|
#[subxt_test]
|
||||||
async fn tx_basic_transfer() -> Result<(), subxt::Error> {
|
async fn tx_basic_transfer() -> Result<(), subxt::Error> {
|
||||||
let alice = dev::alice();
|
let alice = dev::alice();
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ use scale_info::{
|
|||||||
};
|
};
|
||||||
use subxt::{Metadata, OfflineClient, SubstrateConfig};
|
use subxt::{Metadata, OfflineClient, SubstrateConfig};
|
||||||
|
|
||||||
#[cfg(lightclient)]
|
|
||||||
use subxt::client::OfflineClientT;
|
|
||||||
|
|
||||||
async fn metadata_to_api(metadata: Metadata, ctx: &TestContext) -> OfflineClient<SubstrateConfig> {
|
async fn metadata_to_api(metadata: Metadata, ctx: &TestContext) -> OfflineClient<SubstrateConfig> {
|
||||||
OfflineClient::new(
|
OfflineClient::new(
|
||||||
ctx.client().genesis_hash(),
|
ctx.client().genesis_hash(),
|
||||||
|
|||||||
@@ -228,12 +228,11 @@ async fn build_light_client<T: Config>(proc: &SubstrateNode) -> Result<OnlineCli
|
|||||||
.await
|
.await
|
||||||
.map_err(|err| format!("Failed to connect to node rpc at {ws_url}: {err}"))?;
|
.map_err(|err| format!("Failed to connect to node rpc at {ws_url}: {err}"))?;
|
||||||
|
|
||||||
// Wait for at least 3 blocks before starting the light client.
|
// Wait for at least 3 blocks before starting the light client.
|
||||||
// Otherwise, the lightclient might error with
|
// Otherwise, the lightclient might error with
|
||||||
// `"Error when retrieving the call proof: No node available for call proof query"`.
|
// `"Error when retrieving the call proof: No node available for call proof query"`.
|
||||||
super::wait_for_number_of_blocks(&client, 4).await;
|
super::wait_for_number_of_blocks(&client, 4).await;
|
||||||
|
|
||||||
|
|
||||||
// Now, configure a light client; fetch the chain spec and modify the bootnodes.
|
// Now, configure a light client; fetch the chain spec and modify the bootnodes.
|
||||||
let bootnode = format!(
|
let bootnode = format!(
|
||||||
"/ip4/127.0.0.1/tcp/{}/p2p/{}",
|
"/ip4/127.0.0.1/tcp/{}/p2p/{}",
|
||||||
@@ -254,5 +253,5 @@ async fn build_light_client<T: Config>(proc: &SubstrateNode) -> Result<OnlineCli
|
|||||||
.map_err(|e| format!("Light client: cannot add relay chain: {e}"))?;
|
.map_err(|e| format!("Light client: cannot add relay chain: {e}"))?;
|
||||||
|
|
||||||
// Instantiate subxt client from this.
|
// Instantiate subxt client from this.
|
||||||
build_unstable_client(rpc)
|
build_unstable_client(rpc.into()).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user