@gearbox-protocol/sdk 1.15.0 → 1.15.2

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.
@@ -168,10 +168,12 @@ var PoolRewards = /** @class */ (function () {
168
168
  for (var i = 0; i < keys.length; i++) {
169
169
  var curBlock = keys[i];
170
170
  var nextBlock = i === keys.length - 1 ? toBlock : keys[i + 1];
171
- total = total.add(balancesArr[i]
172
- .mul(nextBlock - curBlock)
173
- .mul(rewardsArr[i])
174
- .div(totalSupplyArr[i]));
171
+ if (!totalSupplyArr[i].isZero()) {
172
+ total = total.add(balancesArr[i]
173
+ .mul(nextBlock - curBlock)
174
+ .mul(rewardsArr[i])
175
+ .div(totalSupplyArr[i]));
176
+ }
175
177
  }
176
178
  return total;
177
179
  };
@@ -59,8 +59,14 @@ var RangedValue = /** @class */ (function () {
59
59
  };
60
60
  RangedValue.prototype.getMapValue = function (index) {
61
61
  var value = this.data.get(index);
62
- if (!value)
63
- throw new Error("Can get value for ".concat(index));
62
+ if (!value) {
63
+ if (this.data.size > 0) {
64
+ throw new Error("Can get value for ".concat(index));
65
+ }
66
+ else {
67
+ return this.initialValue;
68
+ }
69
+ }
64
70
  return value;
65
71
  };
66
72
  Object.defineProperty(RangedValue.prototype, "keys", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",