Skip to content

Commit

Permalink
feat(e2e): add node url to Client (#2399)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwht authored Feb 11, 2025
1 parent 7338425 commit 31dfd7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/e2e/macro/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn build_full_client(
let mut client = ::ink_e2e::Client::<
::ink_e2e::PolkadotConfig,
#environment
>::new(node_rpc.rpc(), contracts).await?;
>::new(node_rpc.rpc(), contracts, node_rpc.url().to_string()).await?;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions crates/e2e/src/subxt_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ where
{
api: ReviveApi<C, E>,
contracts: ContractsRegistry,
url: String,
}

impl<C, E> Client<C, E>
Expand All @@ -133,10 +134,12 @@ where
pub async fn new<P: Into<PathBuf>>(
client: subxt::backend::rpc::RpcClient,
contracts: impl IntoIterator<Item = P>,
url: String,
) -> Result<Self, subxt::Error> {
Ok(Self {
api: ReviveApi::new(client).await?,
contracts: ContractsRegistry::new(contracts),
url,
})
}

Expand Down Expand Up @@ -312,6 +315,11 @@ where
DispatchError::decode_from(dispatch_err_encoded, self.api.client.metadata())
.expect("failed to decode valid dispatch error")
}

/// Returns the URL of the running node.
pub fn url(&self) -> &str {
&self.url
}
}

#[async_trait]
Expand Down

0 comments on commit 31dfd7d

Please sign in to comment.