File tree 3 files changed +23
-2
lines changed
screens/SettingsSheet/components
3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ interface NetworkNonceInfo {
5
5
nonce : number ;
6
6
}
7
7
8
- type AccountNonceInfo = Record < Network , NetworkNonceInfo > ;
8
+ type AccountNonceInfo = Partial < Record < Network , NetworkNonceInfo > > ;
9
9
10
10
export interface NonceManager {
11
11
[ key : EthereumAddress ] : AccountNonceInfo ;
Original file line number Diff line number Diff line change @@ -88,7 +88,25 @@ export const updateNonce = (
88
88
saveNonceManager ( updatedNonceManager ) ;
89
89
}
90
90
} ;
91
+ export const resetNonces = ( accountAddress : EthereumAddress ) => async (
92
+ dispatch : AppDispatch ,
93
+ getState : AppGetState
94
+ ) => {
95
+ const { nonceManager : currentNonceData } = getState ( ) ;
96
+
97
+ const currentAccountAddress = accountAddress . toLowerCase ( ) ;
91
98
99
+ const updatedNonceManager : NonceManager = {
100
+ ...currentNonceData ,
101
+ [ currentAccountAddress ] : { } ,
102
+ } ;
103
+
104
+ dispatch ( {
105
+ payload : updatedNonceManager ,
106
+ type : NONCE_MANAGER_UPDATE_NONCE ,
107
+ } ) ;
108
+ saveNonceManager ( updatedNonceManager ) ;
109
+ } ;
92
110
// -- Reducer ----------------------------------------- //
93
111
const INITIAL_STATE : NonceManager = { } ;
94
112
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ import { isAuthenticated } from '@/utils/authentication';
57
57
import { DATA_UPDATE_PENDING_TRANSACTIONS_SUCCESS } from '@/redux/data' ;
58
58
import { saveLocalPendingTransactions } from '@/handlers/localstorage/accountLocal' ;
59
59
import { getFCMToken } from '@/notifications/tokens' ;
60
+ import { resetNonces } from '@/redux/nonceManager' ;
60
61
61
62
const DevSection = ( ) => {
62
63
const { navigate } = useNavigation ( ) ;
@@ -213,12 +214,14 @@ const DevSection = () => {
213
214
const clearPendingTransactions = async ( ) => {
214
215
// clear local storage
215
216
saveLocalPendingTransactions ( [ ] , accountAddress , Network . mainnet ) ;
216
-
217
217
// clear redux
218
218
dispatch ( {
219
219
payload : [ ] ,
220
220
type : DATA_UPDATE_PENDING_TRANSACTIONS_SUCCESS ,
221
221
} ) ;
222
+
223
+ // reset nonces
224
+ resetNonces ( accountAddress ) ;
222
225
} ;
223
226
224
227
const clearLocalStorage = async ( ) => {
You can’t perform that action at this time.
0 commit comments