update user builder default transport function
@@ -74,14 +74,19 @@ impl<T> UserBuilder<T> {
}
/// Use the default version of the Transport Client
- pub async fn with_default_transport(mut self) -> Result<Self>
+ pub async fn with_default_transport<NewTransport>(self) -> Result<UserBuilder<NewTransport>>
where
- T: for<'a> Transport<'a> + DefaultTransport,
+ NewTransport: for<'a> Transport<'a> + DefaultTransport,
{
// Separated as a method instead of defaulting at the build method to avoid requiring the bespoke
// bound T: DefaultTransport for all transports
- self.transport = Some(T::try_default().await?);
- Ok(self)
+ Ok(
+ UserBuilder {
+ transport: Some(NewTransport::try_default().await?),
+ id: self.id,
+ psks: self.psks,
+ }
+ )
}
/// Inject a new Pre Shared Key and Id into the User Builder
@@ -99,7 +104,7 @@ impl<T> UserBuilder<T> {
/// let psk2 = Psk::from_seed(b"Psk2");
/// let user = User::builder()
/// .with_identity(Ed25519::from_seed(author_seed))
- /// .with_default_transport()
+ /// .with_default_transport::<tangle::Client>()
/// .await?
/// .with_psk(psk1.to_pskid(), psk1)
/// .with_psk(psk2.to_pskid(), psk2)
@@ -138,8 +143,9 @@ impl<T> UserBuilder<T> {
/// let user_seed = "cryptographically-secure-random-user-seed";
/// let mut user = User::builder()
/// .with_identity(Ed25519::from_seed(user_seed))
- /// .with_default_transport()
+ /// .with_default_transport::<tangle::Client>()
/// .await?
+ /// .with_identity(Ed25519::from_seed(user_seed))
/// .build()?;
///
/// # Ok(())
