@@ -14,12 +14,8 @@ use sp_runtime::traits::{
14
14
15
15
/// Signing transactions requires a [`Signer`]. This is responsible for
16
16
/// providing the "from" account that the transaction is being signed by,
17
- /// as well as actually signing a SCALE encoded payload. Optionally, a
18
- /// signer can also provide the nonce for the transaction to use.
17
+ /// as well as actually signing a SCALE encoded payload.
19
18
pub trait Signer < T : Config > {
20
- /// Optionally returns a nonce.
21
- fn nonce ( & self ) -> Option < T :: Index > ;
22
-
23
19
/// Return the "from" account ID.
24
20
fn account_id ( & self ) -> & T :: AccountId ;
25
21
@@ -37,7 +33,6 @@ pub trait Signer<T: Config> {
37
33
#[ derive( Clone , Debug ) ]
38
34
pub struct PairSigner < T : Config , P : Pair > {
39
35
account_id : T :: AccountId ,
40
- nonce : Option < T :: Index > ,
41
36
signer : P ,
42
37
}
43
38
53
48
pub fn new ( signer : P ) -> Self {
54
49
let account_id =
55
50
<T :: Signature as Verify >:: Signer :: from ( signer. public ( ) ) . into_account ( ) ;
56
- Self {
57
- account_id,
58
- nonce : None ,
59
- signer,
60
- }
61
- }
62
-
63
- /// Sets the nonce to a new value. By default, the nonce will
64
- /// be retrieved from the node. Setting one here will override that.
65
- pub fn set_nonce ( & mut self , nonce : T :: Index ) {
66
- self . nonce = Some ( nonce) ;
67
- }
68
-
69
- /// Increment the nonce.
70
- pub fn increment_nonce ( & mut self ) {
71
- self . nonce = self . nonce . map ( |nonce| nonce + 1u32 . into ( ) ) ;
51
+ Self { account_id, signer }
72
52
}
73
53
74
54
/// Returns the [`Pair`] implementation used to construct this.
89
69
P : Pair + ' static ,
90
70
P :: Signature : Into < T :: Signature > + ' static ,
91
71
{
92
- fn nonce ( & self ) -> Option < T :: Index > {
93
- self . nonce
94
- }
95
-
96
72
fn account_id ( & self ) -> & T :: AccountId {
97
73
& self . account_id
98
74
}
0 commit comments