File tree 2 files changed +21
-6
lines changed
packages/cli/package/src/lib
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -140,23 +140,36 @@ export async function resolveDeployment() {
140
140
141
141
async function createContracts ( signerOrProvider : Provider | Signer ) {
142
142
const { Contracts } = await import ( "@fluencelabs/deal-ts-clients" ) ;
143
- const contracts = new Contracts ( signerOrProvider , await resolveDeployment ( ) ) ;
143
+
144
+ const newContracts = new Contracts (
145
+ signerOrProvider ,
146
+ await resolveDeployment ( ) ,
147
+ ) ;
148
+
149
+ if ( contracts !== undefined || readonlyContracts !== undefined ) {
150
+ return newContracts ;
151
+ }
144
152
145
153
await setTryTimeout (
146
154
"check if blockchain client is connected" ,
147
155
async ( ) => {
156
+ dbg (
157
+ "Going to run contracts.diamond.bytesPerRam() to check if blockchain client is connected" ,
158
+ ) ;
159
+
148
160
// By calling this method we ensure that the blockchain client is connected
149
- await contracts . diamond . minDealDepositedEpochs ( ) ;
161
+ await newContracts . diamond . bytesPerRam ( ) ;
162
+ dbg ( "Blockchain client is connected" ) ;
150
163
} ,
151
164
( err ) => {
152
165
commandObj . error (
153
- `Check if blockchain client is connected by running contracts.diamond.minDealDepositedEpochs () failed: ${ stringifyUnknown ( err ) } ` ,
166
+ `Check if blockchain client is connected by running contracts.diamond.bytesPerRam () failed: ${ stringifyUnknown ( err ) } ` ,
154
167
) ;
155
168
} ,
156
169
1000 * 5 , // 5 seconds
157
170
) ;
158
171
159
- return contracts ;
172
+ return newContracts ;
160
173
}
161
174
162
175
export async function ensureJsonRpcProvider ( ) : Promise < Provider > {
Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ export async function setTryTimeout<T, U>(
48
48
try {
49
49
dbg ( `Trying to ${ yellowMessage } ` ) ;
50
50
const res = await callbackToTry ( ) ;
51
- clearTimeout ( timeout ) ;
52
- isTrying = false ;
53
51
54
52
if ( attemptCounter > 1 ) {
55
53
commandObj . logToStderr (
56
54
`Succeeded to ${ yellowMessage } after ${ numToStr ( attemptCounter ) } attempts` ,
57
55
) ;
56
+ } else {
57
+ dbg ( `Succeeded to ${ yellowMessage } ` ) ;
58
58
}
59
59
60
+ clearTimeout ( timeout ) ;
61
+ isTrying = false ;
60
62
return res ;
61
63
} catch ( e ) {
62
64
if ( failCondition !== undefined && failCondition ( e ) ) {
You can’t perform that action at this time.
0 commit comments