File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export const setupWalletsForWorker = async (
45
45
server . log . warn ( `Wallet address not found for chain ${ slug } .` ) ;
46
46
continue ;
47
47
}
48
- const walletNonce = await getWalletNonce (
48
+ const walletBlockchainNonce = await getWalletNonce (
49
49
walletAddress ,
50
50
sdk . getProvider ( ) ,
51
51
) ;
@@ -59,10 +59,20 @@ export const setupWalletsForWorker = async (
59
59
lastUsedNonce = walletDataInDB . lastUsedNonce ;
60
60
}
61
61
62
+ // lastUsedNonce should be set to -1 if blockchainNonce is 0
63
+ if (
64
+ BigNumber . from ( walletBlockchainNonce ) . eq ( BigNumber . from ( 0 ) ) &&
65
+ BigNumber . from ( lastUsedNonce ) . eq ( BigNumber . from ( 0 ) )
66
+ ) {
67
+ lastUsedNonce = - 1 ;
68
+ }
69
+
62
70
const walletData = {
63
71
walletAddress : walletAddress . toLowerCase ( ) ,
64
72
chainId : getChainBySlug ( slug ) . chainId . toString ( ) ,
65
- blockchainNonce : BigNumber . from ( walletNonce ?? 0 ) . toNumber ( ) ,
73
+ blockchainNonce : BigNumber . from (
74
+ walletBlockchainNonce ?? 0 ,
75
+ ) . toNumber ( ) ,
66
76
lastSyncedTimestamp : new Date ( ) ,
67
77
lastUsedNonce,
68
78
walletType : slug ,
You can’t perform that action at this time.
0 commit comments