@lavarage/sdk 6.7.3 → 6.7.4
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.
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -6
- package/dist/index.mjs.map +1 -1
- package/evm.ts +30 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3722,10 +3722,16 @@ function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 42960
|
|
|
3722
3722
|
borrowerOperationsAbi,
|
|
3723
3723
|
provider
|
|
3724
3724
|
);
|
|
3725
|
+
const currentBlock = yield provider.getBlockNumber();
|
|
3725
3726
|
const filter = contract.filters.Buy();
|
|
3726
|
-
const
|
|
3727
|
+
const allEvents = [];
|
|
3728
|
+
for (let start = fromBlock; start <= currentBlock; start += 1e4) {
|
|
3729
|
+
const end = Math.min(start + 9999, currentBlock);
|
|
3730
|
+
const events = yield contract.queryFilter(filter, start, end);
|
|
3731
|
+
allEvents.push(...events);
|
|
3732
|
+
}
|
|
3727
3733
|
return Promise.all(
|
|
3728
|
-
|
|
3734
|
+
allEvents.map((event) => __async(this, null, function* () {
|
|
3729
3735
|
const {
|
|
3730
3736
|
buyer,
|
|
3731
3737
|
tokenCollateral,
|
|
@@ -3757,10 +3763,16 @@ function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
|
3757
3763
|
borrowerOperationsAbi,
|
|
3758
3764
|
provider
|
|
3759
3765
|
);
|
|
3766
|
+
const currentBlock = yield provider.getBlockNumber();
|
|
3760
3767
|
const filter = contract.filters.Sell();
|
|
3761
|
-
const
|
|
3768
|
+
const allEvents = [];
|
|
3769
|
+
for (let start = fromBlock; start <= currentBlock; start += 1e4) {
|
|
3770
|
+
const end = Math.min(start + 9999, currentBlock);
|
|
3771
|
+
const events = yield contract.queryFilter(filter, start, end);
|
|
3772
|
+
allEvents.push(...events);
|
|
3773
|
+
}
|
|
3762
3774
|
return Promise.all(
|
|
3763
|
-
|
|
3775
|
+
allEvents.map((event) => __async(this, null, function* () {
|
|
3764
3776
|
const { buyer, tokenCollateral, loanId, closingPositionSize, profit } = event.args;
|
|
3765
3777
|
const block = yield provider.getBlock(event.blockNumber);
|
|
3766
3778
|
const timestamp = block ? Number(block.timestamp) : 0;
|
|
@@ -3784,10 +3796,16 @@ function getLiquidatedPositionsEvm(provider, borrowerOpsContractAddress, fromBlo
|
|
|
3784
3796
|
borrowerOperationsAbi,
|
|
3785
3797
|
provider
|
|
3786
3798
|
);
|
|
3799
|
+
const currentBlock = yield provider.getBlockNumber();
|
|
3787
3800
|
const filter = contract.filters.Liquidation();
|
|
3788
|
-
const
|
|
3801
|
+
const allEvents = [];
|
|
3802
|
+
for (let start = fromBlock; start <= currentBlock; start += 1e4) {
|
|
3803
|
+
const end = Math.min(start + 9999, currentBlock);
|
|
3804
|
+
const events = yield contract.queryFilter(filter, start, end);
|
|
3805
|
+
allEvents.push(...events);
|
|
3806
|
+
}
|
|
3789
3807
|
return Promise.all(
|
|
3790
|
-
|
|
3808
|
+
allEvents.map((event) => __async(this, null, function* () {
|
|
3791
3809
|
const {
|
|
3792
3810
|
borrower,
|
|
3793
3811
|
tokenCollateral,
|