Commit ebd4165 1 parent ed0fcc2 commit ebd4165 Copy full SHA for ebd4165
File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
type DeployOptions ,
7
7
createDebugLogger ,
8
8
createPXEClient ,
9
+ retryUntil ,
9
10
} from '@aztec/aztec.js' ;
10
11
import { type AztecNode , type FunctionCall , type PXE } from '@aztec/circuit-types' ;
11
12
import { Fr , deriveSigningKey } from '@aztec/circuits.js' ;
@@ -65,7 +66,18 @@ export class BotFactory {
65
66
const isInit = await this . pxe . isContractInitialized ( account . getAddress ( ) ) ;
66
67
if ( isInit ) {
67
68
this . log . info ( `Account at ${ account . getAddress ( ) . toString ( ) } already initialized` ) ;
68
- return account . register ( ) ;
69
+ const wallet = await account . register ( ) ;
70
+ const blockNumber = await this . pxe . getBlockNumber ( ) ;
71
+ await retryUntil (
72
+ async ( ) => {
73
+ const status = await this . pxe . getSyncStatus ( ) ;
74
+ return blockNumber <= status . blocks ;
75
+ } ,
76
+ 'pxe synch' ,
77
+ 3600 ,
78
+ 1 ,
79
+ ) ;
80
+ return wallet ;
69
81
} else {
70
82
this . log . info ( `Initializing account at ${ account . getAddress ( ) . toString ( ) } ` ) ;
71
83
const sentTx = account . deploy ( ) ;
You can’t perform that action at this time.
0 commit comments