@@ -8,7 +8,6 @@ export basics
8
8
9
9
type
10
10
Signer * = ref object of RootObj
11
- lastSeenNonce: ? UInt256
12
11
populateLock: AsyncLock
13
12
SignerError * = object of EthersError
14
13
@@ -93,28 +92,10 @@ template withLock*(signer: Signer, body: untyped) =
93
92
finally :
94
93
signer.populateLock.release ()
95
94
96
-
97
-
98
- method updateNonce * (
99
- signer: Signer ,
100
- nonce: UInt256
101
- ) {.base , gcsafe .} =
102
-
103
- without lastSeen =? signer.lastSeenNonce:
104
- signer.lastSeenNonce = some nonce
105
- return
106
-
107
- if nonce > lastSeen:
108
- signer.lastSeenNonce = some nonce
109
-
110
- method decreaseNonce * (signer: Signer ) {.base , gcsafe .} =
111
- if lastSeen =? signer.lastSeenNonce and lastSeen > 0 :
112
- signer.lastSeenNonce = some lastSeen - 1
113
-
114
95
method populateTransaction * (
115
96
signer: Signer ,
116
97
transaction: Transaction ): Future [Transaction ]
117
- {.base , async : (raises: [CancelledError , AsyncLockError , ProviderError , SignerError ]).} =
98
+ {.base , async : (raises: [CancelledError , ProviderError , SignerError ]).} =
118
99
# # Populates a transaction with sender, chainId, gasPrice, nonce, and gasLimit.
119
100
# # NOTE: to avoid async concurrency issues, this routine should be called with
120
101
# # a lock if it is followed by sendTransaction. For reference, see the `send`
@@ -147,10 +128,8 @@ method populateTransaction*(
147
128
try :
148
129
populated.gasLimit = some (await signer.estimateGas (populated, BlockTag .pending))
149
130
except EstimateGasError as e:
150
- signer.decreaseNonce ()
151
131
raise e
152
132
except ProviderError as e:
153
- signer.decreaseNonce ()
154
133
raiseSignerError (e.msg)
155
134
156
135
else :
@@ -165,7 +144,7 @@ method populateTransaction*(
165
144
method cancelTransaction * (
166
145
signer: Signer ,
167
146
tx: Transaction
168
- ): Future [TransactionResponse ] {.base , async : (raises: [SignerError , ProviderError ]).} =
147
+ ): Future [TransactionResponse ] {.base , async : (raises: [SignerError , CancelledError , AsyncLockError , ProviderError ]).} =
169
148
# cancels a transaction by sending with a 0-valued transaction to ourselves
170
149
# with the failed tx's nonce
171
150
0 commit comments