rewrite me

This commit is contained in:
Niklas
2022-01-20 15:07:14 +01:00
parent 65fb71a8d3
commit c988c4a16a
3 changed files with 16 additions and 8 deletions
+4 -3
View File
@@ -84,6 +84,7 @@ impl TransportSenderT for Sender {
type Error = SubxtClientError;
async fn send(&mut self, msg: String) -> Result<(), Self::Error> {
log::info!("send: {:?}", msg);
self.0.send(msg).await?;
Ok(())
}
@@ -95,6 +96,7 @@ impl TransportReceiverT for Receiver {
async fn receive(&mut self) -> Result<String, Self::Error> {
let msg = self.0.next().await.expect("channel should be open");
log::info!("rx: {:?}", msg);
Ok(msg)
}
}
@@ -222,7 +224,6 @@ impl<C: ChainSpec + 'static> SubxtClientConfig<C> {
network.transport = TransportConfig::Normal {
enable_mdns: true,
allow_private_ipv4: true,
// wasm_external_transport: None,
};
let telemetry_endpoints = if let Some(port) = self.telemetry {
let endpoints = TelemetryEndpoints::new(vec![(
@@ -248,9 +249,9 @@ impl<C: ChainSpec + 'static> SubxtClientConfig<C> {
telemetry_endpoints,
tokio_handle: self.tokio_handle,
default_heap_pages: Default::default(),
disable_grandpa: Default::default(),
disable_grandpa: true,
execution_strategies: Default::default(),
force_authoring: Default::default(),
force_authoring: true,
keep_blocks: KeepBlocks::All,
keystore_remote: Default::default(),
offchain_worker: Default::default(),
+11 -5
View File
@@ -37,6 +37,11 @@ use test_runtime::node_runtime::{
#[async_std::test]
pub async fn test_embedded_client() {
tracing_subscriber::FmtSubscriber::builder()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.try_init()
.expect("setting default subscriber failed");
let tmp = TempDir::new("subxt-").expect("failed to create tempdir");
let config = SubxtClientConfig {
impl_name: "full-client",
@@ -72,6 +77,7 @@ pub async fn test_embedded_client() {
.build::<DefaultConfig>()
.await
.unwrap();
let api: node_runtime::RuntimeApi<DefaultConfig> =
ext_client.clone().to_runtime_api();
@@ -86,19 +92,19 @@ pub async fn test_embedded_client() {
let bob_address = AccountKeyring::Bob.to_account_id().into();
// verify that we can call dispatchable functions
let success = api
let events = api
.tx()
.balances()
.transfer(bob_address, 100_000_000_000_000_000)
.transfer(bob_address, 100_000)
.sign_and_submit_then_watch(&alice)
.await
.unwrap()
.wait_for_finalized_success()
.await
.unwrap()
.has_event::<system::events::ExtrinsicSuccess>()
.unwrap();
panic!("{:?}", events);
// verify that we receive events
assert!(success);
//assert!(success);
}