diff --git a/src/signer.rs b/src/signer.rs index f22a03a75f..fec75018fe 100644 --- a/src/signer.rs +++ b/src/signer.rs @@ -41,7 +41,7 @@ use std::{ }; /// Extrinsic signer. -pub trait Signer>: Send + Sync { +pub trait Signer> { /// Returns the account id. fn account_id(&self) -> &T::AccountId; @@ -111,7 +111,7 @@ where T: System + 'static, T::AccountId: Into + 'static, S: Encode + 'static + Send + Sync, - E: SignedExtra + 'static + Send + Sync, + E: SignedExtra + 'static, P: Pair + 'static, P::Signature: Into + 'static, { @@ -139,11 +139,43 @@ where > { let signature = extrinsic.using_encoded(|payload| self.signer.sign(payload)); let (call, extra, _) = extrinsic.deconstruct(); - Box::pin(futures::future::ready(Ok(UncheckedExtrinsic::new_signed( + Box::pin(futures::future::ok(UncheckedExtrinsic::new_signed( call, self.account_id.clone().into(), signature.into(), extra, - )))) + ))) + } +} + +impl Signer for Box> +where + T: System, + S: Encode, + E: SignedExtra, +{ + fn account_id(&self) -> &T::AccountId { + (**self).account_id() + } + + fn nonce(&self) -> Option { + (**self).nonce() + } + + fn sign( + &self, + extrinsic: SignedPayload, + ) -> Pin< + Box< + dyn Future< + Output = Result< + UncheckedExtrinsic, + String, + >, + > + Send + + Sync, + >, + > { + (**self).sign(extrinsic) } }