@atomiqlabs/chain-evm 2.1.10 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -248,13 +248,22 @@ class EVMSpvVaultContract extends EVMContractBase_1.EVMContractBase {
|
|
|
248
248
|
return Promise.resolve(null);
|
|
249
249
|
});
|
|
250
250
|
const vaults = [];
|
|
251
|
+
let promises = [];
|
|
251
252
|
for (let [identifier, vaultParams] of openedVaults.entries()) {
|
|
253
|
+
if (vaultParams.btcRelayContract.toLowerCase() !== this.btcRelay.contractAddress.toLowerCase())
|
|
254
|
+
continue;
|
|
252
255
|
const [owner, vaultIdStr] = identifier.split(":");
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
promises.push(this.contract.getVault(owner, BigInt(vaultIdStr)).then(vaultState => {
|
|
257
|
+
if (vaultState.spvVaultParametersCommitment === (0, EVMSpvVaultData_1.getVaultParamsCommitment)(vaultParams)) {
|
|
258
|
+
vaults.push(new EVMSpvVaultData_1.EVMSpvVaultData(owner, BigInt(vaultIdStr), vaultState, vaultParams));
|
|
259
|
+
}
|
|
260
|
+
}));
|
|
261
|
+
if (promises.length >= this.Chain.config.maxParallelCalls) {
|
|
262
|
+
await Promise.all(promises);
|
|
263
|
+
promises = [];
|
|
256
264
|
}
|
|
257
265
|
}
|
|
266
|
+
await Promise.all(promises);
|
|
258
267
|
return vaults;
|
|
259
268
|
}
|
|
260
269
|
parseWithdrawalEvent(event) {
|
package/package.json
CHANGED
|
@@ -356,14 +356,24 @@ export class EVMSpvVaultContract<ChainId extends string>
|
|
|
356
356
|
}
|
|
357
357
|
);
|
|
358
358
|
const vaults: EVMSpvVaultData[] = [];
|
|
359
|
+
let promises: Promise<void>[] = [];
|
|
359
360
|
for(let [identifier, vaultParams] of openedVaults.entries()) {
|
|
361
|
+
if(vaultParams.btcRelayContract.toLowerCase()!==this.btcRelay.contractAddress.toLowerCase()) continue;
|
|
362
|
+
|
|
360
363
|
const [owner, vaultIdStr] = identifier.split(":");
|
|
361
364
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
+
promises.push(this.contract.getVault(owner, BigInt(vaultIdStr)).then(vaultState => {
|
|
366
|
+
if(vaultState.spvVaultParametersCommitment === getVaultParamsCommitment(vaultParams)) {
|
|
367
|
+
vaults.push(new EVMSpvVaultData(owner, BigInt(vaultIdStr), vaultState, vaultParams))
|
|
368
|
+
}
|
|
369
|
+
}))
|
|
370
|
+
|
|
371
|
+
if(promises.length>=this.Chain.config.maxParallelCalls) {
|
|
372
|
+
await Promise.all(promises);
|
|
373
|
+
promises = [];
|
|
365
374
|
}
|
|
366
375
|
}
|
|
376
|
+
await Promise.all(promises);
|
|
367
377
|
return vaults;
|
|
368
378
|
}
|
|
369
379
|
|