This commit is contained in:
Niklas
2022-02-03 00:37:08 +01:00
parent 8dc7dda99c
commit ae24d3b37b
4 changed files with 25 additions and 17 deletions
+4 -1
View File
@@ -35,6 +35,7 @@ use jsonrpsee::core::{
async_trait,
client::{
Client as JsonRpcClient,
ClientBuilder as JsonRpcClientBuilder,
TransportReceiverT,
TransportSenderT,
},
@@ -153,7 +154,9 @@ impl SubxtClient {
impl From<SubxtClient> for JsonRpcClient {
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)
}
}
+7 -6
View File
@@ -31,6 +31,7 @@ use subxt::{
DefaultExtra
};
use tempdir::TempDir;
use test_runtime::node_runtime::{self, system};
#[async_std::test]
pub async fn test_embedded_client() {
@@ -56,7 +57,7 @@ pub async fn test_embedded_client() {
chain_spec: node_cli::chain_spec::development_config(),
role: Role::Authority(AccountKeyring::Alice),
telemetry: None,
wasm_method: WasmExecutionMethod::Compiled,
wasm_method: WasmExecutionMethod::Interpreted,
tokio_handle: tokio::runtime::Handle::current(),
};
@@ -75,7 +76,7 @@ pub async fn test_embedded_client() {
.await
.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
api.storage()
@@ -88,7 +89,7 @@ pub async fn test_embedded_client() {
let bob_address = AccountKeyring::Bob.to_account_id().into();
// verify that we can call dispatchable functions
let events = api
let success = api
.tx()
.balances()
.transfer(bob_address, 100_000)
@@ -97,10 +98,10 @@ pub async fn test_embedded_client() {
.unwrap()
.wait_for_finalized_success()
.await
.unwrap()
.has_event::<system::events::ExtrinsicSuccess>()
.unwrap();
panic!("{:?}", events);
// verify that we receive events
// assert!(success);
assert!(success);
}