carbon-js-sdk 0.6.4 → 0.6.5

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.
@@ -19,6 +19,7 @@ const bignumber_js_1 = require("bignumber.js");
19
19
  const dayjs_1 = __importDefault(require("dayjs"));
20
20
  const long_1 = __importDefault(require("long"));
21
21
  const base_1 = __importDefault(require("./base"));
22
+ const number_1 = require("../util/number");
22
23
  class LiquidityPoolModule extends base_1.default {
23
24
  create(params, opts) {
24
25
  return __awaiter(this, void 0, void 0, function* () {
@@ -164,14 +165,14 @@ class LiquidityPoolModule extends base_1.default {
164
165
  getWeeklyRewardsRealInflation() {
165
166
  var _a;
166
167
  return __awaiter(this, void 0, void 0, function* () {
167
- const { result } = yield this.sdkProvider.insights.Inflation();
168
- const MIN_RATE = new bignumber_js_1.BigNumber(0.0003);
169
- const INITIAL_SUPPLY = new bignumber_js_1.BigNumber(1000000000);
170
- let inflationRate = new bignumber_js_1.BigNumber(result.inflationRate);
171
- if (inflationRate.lt(MIN_RATE)) {
172
- inflationRate = MIN_RATE;
168
+ const mintDataResponse = yield this.sdkProvider.query.inflation.MintData({});
169
+ let weeklyRewards = number_1.BN_ZERO;
170
+ if (mintDataResponse.mintData) {
171
+ const mintData = mintDataResponse.mintData;
172
+ const currentSupply = new bignumber_js_1.BigNumber(mintData.currentSupply);
173
+ const swthInflationRate = new bignumber_js_1.BigNumber(mintData.inflationRate).shiftedBy(-18);
174
+ weeklyRewards = currentSupply.times(swthInflationRate).div(52);
173
175
  }
174
- const weeklyRewards = INITIAL_SUPPLY.div(52).times(inflationRate);
175
176
  // Calculate weekly rewards earned by liquidity providers
176
177
  // Weekly LP Rewards = liquidityRewardRatio * weeklyRewards
177
178
  const distributionParams = yield this.sdkProvider.query.distribution.Params({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",