@aurigami/sdk 1.19.0 → 1.19.1
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/SDK.d.ts +2 -0
- package/dist/consts/constants.d.ts +2 -0
- package/dist/helpers/graphql-helpers.d.ts +1 -1
- package/dist/helpers/subgraphQuery.d.ts +1 -0
- package/dist/interactors/misc.d.ts +4 -0
- package/dist/sdk.cjs.development.js +163 -79
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +162 -80
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +20 -0
- package/package.json +1 -1
- package/src/SDK.ts +38 -1
- package/src/consts/constants.ts +5 -0
- package/src/helpers/graphql-helpers.ts +2 -4
- package/src/helpers/helpers.ts +2 -2
- package/src/helpers/subgraphQuery.ts +17 -0
- package/src/interactors/misc.ts +23 -0
- package/src/types/index.ts +24 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -205,6 +205,8 @@ var CACHE_TIMEOUT = 10 * 1000; // 10 seconds
|
|
|
205
205
|
var SD_INCENTIVE_IN_SD = 83.35;
|
|
206
206
|
var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
|
|
207
207
|
var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
|
|
208
|
+
var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
|
|
209
|
+
var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
|
|
208
210
|
|
|
209
211
|
var decimalRecords = {
|
|
210
212
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
@@ -704,18 +706,17 @@ function _getQuery() {
|
|
|
704
706
|
return _getQuery.apply(this, arguments);
|
|
705
707
|
}
|
|
706
708
|
|
|
707
|
-
|
|
708
|
-
function queryGraphQL(_x) {
|
|
709
|
+
function queryGraphQL(_x, _x2) {
|
|
709
710
|
return _queryGraphQL.apply(this, arguments);
|
|
710
711
|
}
|
|
711
712
|
function _queryGraphQL() {
|
|
712
|
-
_queryGraphQL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query) {
|
|
713
|
+
_queryGraphQL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, graphqlUrl) {
|
|
713
714
|
var resp;
|
|
714
715
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
715
716
|
while (1) switch (_context.prev = _context.next) {
|
|
716
717
|
case 0:
|
|
717
718
|
_context.next = 2;
|
|
718
|
-
return axios.post(
|
|
719
|
+
return axios.post(graphqlUrl, {
|
|
719
720
|
query: query
|
|
720
721
|
});
|
|
721
722
|
case 2:
|
|
@@ -922,7 +923,7 @@ function _getBlocksTimestamp() {
|
|
|
922
923
|
});
|
|
923
924
|
for (i = 0; i < lines.length; i += CHUNK_SIZE) {
|
|
924
925
|
query = "{ " + lines.slice(i, i + CHUNK_SIZE).join('\n') + " }";
|
|
925
|
-
promises.push(queryGraphQL(query));
|
|
926
|
+
promises.push(queryGraphQL(query, GRAPHQL_URL));
|
|
926
927
|
}
|
|
927
928
|
// merge all the json objects
|
|
928
929
|
_context5.next = 8;
|
|
@@ -5197,6 +5198,40 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5197
5198
|
}
|
|
5198
5199
|
return getTokenPrice;
|
|
5199
5200
|
}();
|
|
5201
|
+
_proto.calcBorrowPower = /*#__PURE__*/function () {
|
|
5202
|
+
var _calcBorrowPower = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(tokenAmount) {
|
|
5203
|
+
var autoken, moneyMarket, collateralRatio, underlyingPrice, borrowPower;
|
|
5204
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
5205
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5206
|
+
case 0:
|
|
5207
|
+
autoken = networkAddresses.auTokens.find(function (auToken) {
|
|
5208
|
+
return isSameAddress(auToken.underlying, tokenAmount.token.address);
|
|
5209
|
+
});
|
|
5210
|
+
moneyMarket = new MoneyMarketRead(this._networkConnection, autoken.address, autoken.underlying);
|
|
5211
|
+
_context4.next = 4;
|
|
5212
|
+
return moneyMarket.getCollateralRatio();
|
|
5213
|
+
case 4:
|
|
5214
|
+
collateralRatio = _context4.sent;
|
|
5215
|
+
_context4.next = 7;
|
|
5216
|
+
return fetchPrice(tokenAmount.token.address, this._networkConnection.provider);
|
|
5217
|
+
case 7:
|
|
5218
|
+
underlyingPrice = _context4.sent;
|
|
5219
|
+
borrowPower = calcValuation(tokenAmount, new BigNumber(underlyingPrice)).multipliedBy(collateralRatio).multipliedBy(BORROW_LIMIT_BUFFER);
|
|
5220
|
+
return _context4.abrupt("return", {
|
|
5221
|
+
currency: 'USD',
|
|
5222
|
+
amount: borrowPower.toFixed(DECIMAL_PRECISION)
|
|
5223
|
+
});
|
|
5224
|
+
case 10:
|
|
5225
|
+
case "end":
|
|
5226
|
+
return _context4.stop();
|
|
5227
|
+
}
|
|
5228
|
+
}, _callee3, this);
|
|
5229
|
+
}));
|
|
5230
|
+
function calcBorrowPower(_x3) {
|
|
5231
|
+
return _calcBorrowPower.apply(this, arguments);
|
|
5232
|
+
}
|
|
5233
|
+
return calcBorrowPower;
|
|
5234
|
+
}();
|
|
5200
5235
|
_proto.calcHypotheticalStats = function calcHypotheticalStats(_ref) {
|
|
5201
5236
|
var userMarketDetail = _ref.userMarketDetail,
|
|
5202
5237
|
currentBorrowLimit = _ref.currentBorrowLimit,
|
|
@@ -5241,10 +5276,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5241
5276
|
_proto.getPlyCirculatingSupply =
|
|
5242
5277
|
/*#__PURE__*/
|
|
5243
5278
|
function () {
|
|
5244
|
-
var _getPlyCirculatingSupply = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5279
|
+
var _getPlyCirculatingSupply = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
5245
5280
|
var multicallRead, baseBalanceOfCall, listAddrs, calls, callResults, circulatingSupply;
|
|
5246
|
-
return _regeneratorRuntime().wrap(function
|
|
5247
|
-
while (1) switch (
|
|
5281
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
5282
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5248
5283
|
case 0:
|
|
5249
5284
|
multicallRead = new MulticallRead(this._networkConnection);
|
|
5250
5285
|
baseBalanceOfCall = {
|
|
@@ -5258,20 +5293,20 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5258
5293
|
args: [addr]
|
|
5259
5294
|
});
|
|
5260
5295
|
});
|
|
5261
|
-
|
|
5296
|
+
_context5.next = 6;
|
|
5262
5297
|
return multicallRead.aggregate(calls);
|
|
5263
5298
|
case 6:
|
|
5264
|
-
callResults =
|
|
5299
|
+
callResults = _context5.sent;
|
|
5265
5300
|
circulatingSupply = BigNumber$1.from('1' + '0'.repeat(10) + '0'.repeat(getDecimal(this.env.ply.address)));
|
|
5266
5301
|
callResults.forEach(function (result, i) {
|
|
5267
5302
|
circulatingSupply = circulatingSupply.sub(result[0]);
|
|
5268
5303
|
});
|
|
5269
|
-
return
|
|
5304
|
+
return _context5.abrupt("return", new TokenAmount(PLYToken, circulatingSupply.toString()));
|
|
5270
5305
|
case 10:
|
|
5271
5306
|
case "end":
|
|
5272
|
-
return
|
|
5307
|
+
return _context5.stop();
|
|
5273
5308
|
}
|
|
5274
|
-
},
|
|
5309
|
+
}, _callee4, this);
|
|
5275
5310
|
}));
|
|
5276
5311
|
function getPlyCirculatingSupply() {
|
|
5277
5312
|
return _getPlyCirculatingSupply.apply(this, arguments);
|
|
@@ -5279,35 +5314,35 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5279
5314
|
return getPlyCirculatingSupply;
|
|
5280
5315
|
}();
|
|
5281
5316
|
_proto.getUtilisation = /*#__PURE__*/function () {
|
|
5282
|
-
var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5317
|
+
var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userAddr) {
|
|
5283
5318
|
var accountDetail, sumBorrow, sumCol;
|
|
5284
|
-
return _regeneratorRuntime().wrap(function
|
|
5285
|
-
while (1) switch (
|
|
5319
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
5320
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5286
5321
|
case 0:
|
|
5287
|
-
|
|
5322
|
+
_context6.next = 2;
|
|
5288
5323
|
return this.env.auriInternalLens.callStatic.getAccountLiquidityAccrueInterest(userAddr);
|
|
5289
5324
|
case 2:
|
|
5290
|
-
accountDetail =
|
|
5325
|
+
accountDetail = _context6.sent;
|
|
5291
5326
|
sumBorrow = new BigNumber(accountDetail.sumBorrowPlusEffects.toString());
|
|
5292
5327
|
sumCol = new BigNumber(accountDetail.sumCollateral.toString());
|
|
5293
|
-
return
|
|
5328
|
+
return _context6.abrupt("return", sumBorrow.dividedBy(sumCol));
|
|
5294
5329
|
case 6:
|
|
5295
5330
|
case "end":
|
|
5296
|
-
return
|
|
5331
|
+
return _context6.stop();
|
|
5297
5332
|
}
|
|
5298
|
-
},
|
|
5333
|
+
}, _callee5, this);
|
|
5299
5334
|
}));
|
|
5300
|
-
function getUtilisation(
|
|
5335
|
+
function getUtilisation(_x4) {
|
|
5301
5336
|
return _getUtilisation.apply(this, arguments);
|
|
5302
5337
|
}
|
|
5303
5338
|
return getUtilisation;
|
|
5304
5339
|
}();
|
|
5305
5340
|
_proto.sneakAccounts = /*#__PURE__*/function () {
|
|
5306
|
-
var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5341
|
+
var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(accounts, tokenAddresses, dust) {
|
|
5307
5342
|
var _this2 = this;
|
|
5308
5343
|
var _1E18, oracle, tokens, prices, exrate, res, _iterator2, _step2, addr, infos, i, snapshot, bal, bor, balR, borR;
|
|
5309
|
-
return _regeneratorRuntime().wrap(function
|
|
5310
|
-
while (1) switch (
|
|
5344
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
5345
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5311
5346
|
case 0:
|
|
5312
5347
|
if (dust === void 0) {
|
|
5313
5348
|
dust = /*#__PURE__*/new BigNumber(0.1);
|
|
@@ -5317,19 +5352,19 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5317
5352
|
tokens = tokenAddresses.map(function (addr) {
|
|
5318
5353
|
return _this2.env.getContract(addr, abis.abi);
|
|
5319
5354
|
});
|
|
5320
|
-
|
|
5355
|
+
_context7.next = 6;
|
|
5321
5356
|
return oracle.getUnderlyingPrices(tokenAddresses);
|
|
5322
5357
|
case 6:
|
|
5323
|
-
prices =
|
|
5324
|
-
|
|
5358
|
+
prices = _context7.sent;
|
|
5359
|
+
_context7.next = 9;
|
|
5325
5360
|
return this.env.auriInternalLens.callStatic.getExchangeRates(tokenAddresses);
|
|
5326
5361
|
case 9:
|
|
5327
|
-
exrate =
|
|
5362
|
+
exrate = _context7.sent;
|
|
5328
5363
|
res = [];
|
|
5329
5364
|
_iterator2 = _createForOfIteratorHelperLoose(accounts);
|
|
5330
5365
|
case 12:
|
|
5331
5366
|
if ((_step2 = _iterator2()).done) {
|
|
5332
|
-
|
|
5367
|
+
_context7.next = 33;
|
|
5333
5368
|
break;
|
|
5334
5369
|
}
|
|
5335
5370
|
addr = _step2.value;
|
|
@@ -5337,22 +5372,22 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5337
5372
|
i = 0;
|
|
5338
5373
|
case 16:
|
|
5339
5374
|
if (!(i < tokens.length)) {
|
|
5340
|
-
|
|
5375
|
+
_context7.next = 30;
|
|
5341
5376
|
break;
|
|
5342
5377
|
}
|
|
5343
|
-
|
|
5378
|
+
_context7.next = 19;
|
|
5344
5379
|
return tokens[i].getAccountSnapshot(addr);
|
|
5345
5380
|
case 19:
|
|
5346
|
-
snapshot =
|
|
5381
|
+
snapshot = _context7.sent;
|
|
5347
5382
|
bal = snapshot[0].mul(exrate[i]).div(_1E18).mul(prices[i]).div(_1E18);
|
|
5348
5383
|
bor = snapshot[1].mul(prices[i]).div(_1E18);
|
|
5349
5384
|
balR = new BigNumber(bal.toString()).dividedBy(_1E18.toString());
|
|
5350
5385
|
borR = new BigNumber(bor.toString()).dividedBy(_1E18.toString());
|
|
5351
5386
|
if (!(balR.lte(dust) && borR.lte(dust))) {
|
|
5352
|
-
|
|
5387
|
+
_context7.next = 26;
|
|
5353
5388
|
break;
|
|
5354
5389
|
}
|
|
5355
|
-
return
|
|
5390
|
+
return _context7.abrupt("continue", 27);
|
|
5356
5391
|
case 26:
|
|
5357
5392
|
infos.push({
|
|
5358
5393
|
token: getSymbol(tokenAddresses[i]),
|
|
@@ -5361,7 +5396,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5361
5396
|
});
|
|
5362
5397
|
case 27:
|
|
5363
5398
|
++i;
|
|
5364
|
-
|
|
5399
|
+
_context7.next = 16;
|
|
5365
5400
|
break;
|
|
5366
5401
|
case 30:
|
|
5367
5402
|
res.push({
|
|
@@ -5369,40 +5404,40 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5369
5404
|
tokens: infos
|
|
5370
5405
|
});
|
|
5371
5406
|
case 31:
|
|
5372
|
-
|
|
5407
|
+
_context7.next = 12;
|
|
5373
5408
|
break;
|
|
5374
5409
|
case 33:
|
|
5375
|
-
return
|
|
5410
|
+
return _context7.abrupt("return", res);
|
|
5376
5411
|
case 34:
|
|
5377
5412
|
case "end":
|
|
5378
|
-
return
|
|
5413
|
+
return _context7.stop();
|
|
5379
5414
|
}
|
|
5380
|
-
},
|
|
5415
|
+
}, _callee6, this);
|
|
5381
5416
|
}));
|
|
5382
|
-
function sneakAccounts(
|
|
5417
|
+
function sneakAccounts(_x5, _x6, _x7) {
|
|
5383
5418
|
return _sneakAccounts.apply(this, arguments);
|
|
5384
5419
|
}
|
|
5385
5420
|
return sneakAccounts;
|
|
5386
5421
|
}();
|
|
5387
5422
|
_proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
|
|
5388
|
-
var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5423
|
+
var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(userAddress) {
|
|
5389
5424
|
var _this3 = this;
|
|
5390
5425
|
var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator3, _step3, apy;
|
|
5391
|
-
return _regeneratorRuntime().wrap(function
|
|
5392
|
-
while (1) switch (
|
|
5426
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
5427
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5393
5428
|
case 0:
|
|
5394
5429
|
sum = new BigNumber(0);
|
|
5395
5430
|
totalSuppliedValue = new BigNumber(0);
|
|
5396
5431
|
totalBorrowedValue = new BigNumber(0);
|
|
5397
5432
|
netApy = new BigNumber(0);
|
|
5398
|
-
|
|
5433
|
+
_context8.next = 6;
|
|
5399
5434
|
return Promise.all(networkAddresses.auTokens.map(function (auToken) {
|
|
5400
5435
|
var moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
|
|
5401
5436
|
var apyWithoutIncentive = moneyMarket.getApyWithoutIncentive(userAddress);
|
|
5402
5437
|
return apyWithoutIncentive;
|
|
5403
5438
|
}));
|
|
5404
5439
|
case 6:
|
|
5405
|
-
apys =
|
|
5440
|
+
apys = _context8.sent;
|
|
5406
5441
|
for (_iterator3 = _createForOfIteratorHelperLoose(apys); !(_step3 = _iterator3()).done;) {
|
|
5407
5442
|
apy = _step3.value;
|
|
5408
5443
|
sum = sum.plus(apy.sum);
|
|
@@ -5414,37 +5449,37 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5414
5449
|
} else if (sum.lt(0)) {
|
|
5415
5450
|
netApy = sum.div(totalBorrowedValue);
|
|
5416
5451
|
}
|
|
5417
|
-
return
|
|
5452
|
+
return _context8.abrupt("return", netApy);
|
|
5418
5453
|
case 10:
|
|
5419
5454
|
case "end":
|
|
5420
|
-
return
|
|
5455
|
+
return _context8.stop();
|
|
5421
5456
|
}
|
|
5422
|
-
},
|
|
5457
|
+
}, _callee7);
|
|
5423
5458
|
}));
|
|
5424
|
-
function getNetApyWithoutIncentive(
|
|
5459
|
+
function getNetApyWithoutIncentive(_x8) {
|
|
5425
5460
|
return _getNetApyWithoutIncentive.apply(this, arguments);
|
|
5426
5461
|
}
|
|
5427
5462
|
return getNetApyWithoutIncentive;
|
|
5428
5463
|
}();
|
|
5429
5464
|
_proto.getNetApyWithIncentive = /*#__PURE__*/function () {
|
|
5430
|
-
var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5465
|
+
var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userAddress) {
|
|
5431
5466
|
var _this4 = this;
|
|
5432
5467
|
var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator4, _step4, apy;
|
|
5433
|
-
return _regeneratorRuntime().wrap(function
|
|
5434
|
-
while (1) switch (
|
|
5468
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
5469
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5435
5470
|
case 0:
|
|
5436
5471
|
sum = new BigNumber(0);
|
|
5437
5472
|
totalSuppliedValue = new BigNumber(0);
|
|
5438
5473
|
totalBorrowedValue = new BigNumber(0);
|
|
5439
5474
|
netApy = new BigNumber(0);
|
|
5440
|
-
|
|
5475
|
+
_context9.next = 6;
|
|
5441
5476
|
return Promise.all(networkAddresses.auTokens.map(function (auToken) {
|
|
5442
5477
|
var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
|
|
5443
5478
|
var apyWithIncentive = moneyMarket.getApyWithIncentive(userAddress);
|
|
5444
5479
|
return apyWithIncentive;
|
|
5445
5480
|
}));
|
|
5446
5481
|
case 6:
|
|
5447
|
-
apys =
|
|
5482
|
+
apys = _context9.sent;
|
|
5448
5483
|
for (_iterator4 = _createForOfIteratorHelperLoose(apys); !(_step4 = _iterator4()).done;) {
|
|
5449
5484
|
apy = _step4.value;
|
|
5450
5485
|
sum = sum.plus(apy.sum);
|
|
@@ -5456,14 +5491,14 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5456
5491
|
} else if (sum.lt(0)) {
|
|
5457
5492
|
netApy = sum.div(totalBorrowedValue);
|
|
5458
5493
|
}
|
|
5459
|
-
return
|
|
5494
|
+
return _context9.abrupt("return", netApy);
|
|
5460
5495
|
case 10:
|
|
5461
5496
|
case "end":
|
|
5462
|
-
return
|
|
5497
|
+
return _context9.stop();
|
|
5463
5498
|
}
|
|
5464
|
-
},
|
|
5499
|
+
}, _callee8);
|
|
5465
5500
|
}));
|
|
5466
|
-
function getNetApyWithIncentive(
|
|
5501
|
+
function getNetApyWithIncentive(_x9) {
|
|
5467
5502
|
return _getNetApyWithIncentive.apply(this, arguments);
|
|
5468
5503
|
}
|
|
5469
5504
|
return getNetApyWithIncentive;
|
|
@@ -5577,6 +5612,10 @@ function _postApi() {
|
|
|
5577
5612
|
return _postApi.apply(this, arguments);
|
|
5578
5613
|
}
|
|
5579
5614
|
|
|
5615
|
+
function getLiquidationEventsQuery(address, limit) {
|
|
5616
|
+
return "{\n liquidationEvents(\n first: " + limit + ",\n where: {from: \"" + address.toLowerCase() + "\"}\n ) {\n amount\n auTokenSymbol\n blockTime\n from\n id\n underlyingRepayAmountUSD\n underlyingSymbol\n underlyingRepayAmount\n }\n }";
|
|
5617
|
+
}
|
|
5618
|
+
|
|
5580
5619
|
var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
5581
5620
|
_inheritsLoose(SdkRead, _BlockchainEntityRead);
|
|
5582
5621
|
function SdkRead(networkConnection) {
|
|
@@ -5905,6 +5944,49 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5905
5944
|
}
|
|
5906
5945
|
return getUserNotificationSettings;
|
|
5907
5946
|
}();
|
|
5947
|
+
_proto.getLiquidationHistory = /*#__PURE__*/function () {
|
|
5948
|
+
var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(address) {
|
|
5949
|
+
var liquidationHistorySubgraph, liquidationEvents;
|
|
5950
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
5951
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
5952
|
+
case 0:
|
|
5953
|
+
_context15.next = 2;
|
|
5954
|
+
return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
|
|
5955
|
+
case 2:
|
|
5956
|
+
liquidationHistorySubgraph = _context15.sent;
|
|
5957
|
+
liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
|
|
5958
|
+
var value = {
|
|
5959
|
+
amount: event.underlyingRepayAmountUSD.toString(),
|
|
5960
|
+
currency: 'USD'
|
|
5961
|
+
};
|
|
5962
|
+
var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
|
|
5963
|
+
return auToken.name.slice(2).toLowerCase() === event.underlyingSymbol.toLowerCase();
|
|
5964
|
+
}).underlying;
|
|
5965
|
+
var decimal = getDecimal(underlyingAddress);
|
|
5966
|
+
var token = new Token(underlyingAddress, decimal);
|
|
5967
|
+
var tokenAmount = new TokenAmount(token, event.underlyingRepayAmount.toString(), false);
|
|
5968
|
+
return {
|
|
5969
|
+
liquidationTime: event.blockTime,
|
|
5970
|
+
tokenAmount: tokenAmount,
|
|
5971
|
+
value: value,
|
|
5972
|
+
transactionId: event.id.split('-')[0]
|
|
5973
|
+
};
|
|
5974
|
+
});
|
|
5975
|
+
return _context15.abrupt("return", liquidationEvents);
|
|
5976
|
+
case 5:
|
|
5977
|
+
case "end":
|
|
5978
|
+
return _context15.stop();
|
|
5979
|
+
}
|
|
5980
|
+
}, _callee15);
|
|
5981
|
+
}));
|
|
5982
|
+
function getLiquidationHistory(_x20) {
|
|
5983
|
+
return _getLiquidationHistory.apply(this, arguments);
|
|
5984
|
+
}
|
|
5985
|
+
return getLiquidationHistory;
|
|
5986
|
+
}();
|
|
5987
|
+
_proto.calculateBorrowPower = function calculateBorrowPower(tokenAmount) {
|
|
5988
|
+
return this._misc.calcBorrowPower(tokenAmount);
|
|
5989
|
+
};
|
|
5908
5990
|
return SdkRead;
|
|
5909
5991
|
}(BlockchainEntityRead);
|
|
5910
5992
|
var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
@@ -5919,16 +6001,16 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
5919
6001
|
_proto2.claim =
|
|
5920
6002
|
/*#__PURE__*/
|
|
5921
6003
|
function () {
|
|
5922
|
-
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5923
|
-
return _regeneratorRuntime().wrap(function
|
|
5924
|
-
while (1) switch (
|
|
6004
|
+
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
6005
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
6006
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
5925
6007
|
case 0:
|
|
5926
|
-
return
|
|
6008
|
+
return _context16.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
|
|
5927
6009
|
case 1:
|
|
5928
6010
|
case "end":
|
|
5929
|
-
return
|
|
6011
|
+
return _context16.stop();
|
|
5930
6012
|
}
|
|
5931
|
-
},
|
|
6013
|
+
}, _callee16, this);
|
|
5932
6014
|
}));
|
|
5933
6015
|
function claim() {
|
|
5934
6016
|
return _claim.apply(this, arguments);
|
|
@@ -5936,35 +6018,35 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
5936
6018
|
return claim;
|
|
5937
6019
|
}();
|
|
5938
6020
|
_proto2.stake = /*#__PURE__*/function () {
|
|
5939
|
-
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5940
|
-
return _regeneratorRuntime().wrap(function
|
|
5941
|
-
while (1) switch (
|
|
6021
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(amount) {
|
|
6022
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
6023
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
5942
6024
|
case 0:
|
|
5943
|
-
return
|
|
6025
|
+
return _context17.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
|
|
5944
6026
|
case 1:
|
|
5945
6027
|
case "end":
|
|
5946
|
-
return
|
|
6028
|
+
return _context17.stop();
|
|
5947
6029
|
}
|
|
5948
|
-
},
|
|
6030
|
+
}, _callee17, this);
|
|
5949
6031
|
}));
|
|
5950
|
-
function stake(
|
|
6032
|
+
function stake(_x21) {
|
|
5951
6033
|
return _stake.apply(this, arguments);
|
|
5952
6034
|
}
|
|
5953
6035
|
return stake;
|
|
5954
6036
|
}();
|
|
5955
6037
|
_proto2.unstake = /*#__PURE__*/function () {
|
|
5956
|
-
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5957
|
-
return _regeneratorRuntime().wrap(function
|
|
5958
|
-
while (1) switch (
|
|
6038
|
+
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(amount) {
|
|
6039
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
6040
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
5959
6041
|
case 0:
|
|
5960
|
-
return
|
|
6042
|
+
return _context18.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
|
|
5961
6043
|
case 1:
|
|
5962
6044
|
case "end":
|
|
5963
|
-
return
|
|
6045
|
+
return _context18.stop();
|
|
5964
6046
|
}
|
|
5965
|
-
},
|
|
6047
|
+
}, _callee18, this);
|
|
5966
6048
|
}));
|
|
5967
|
-
function unstake(
|
|
6049
|
+
function unstake(_x22) {
|
|
5968
6050
|
return _unstake.apply(this, arguments);
|
|
5969
6051
|
}
|
|
5970
6052
|
return unstake;
|
|
@@ -5991,5 +6073,5 @@ BigNumber.config({
|
|
|
5991
6073
|
DECIMAL_PLACES: 50
|
|
5992
6074
|
});
|
|
5993
6075
|
|
|
5994
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, STADER_ETH, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, USDT_ETH, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlamaAPI, fetchPriceFromDefiLlamaAndCoingecko, fetchPriceFromKyberSwap, fetchPriceFromOneInch, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, prepareParamsAggregator, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
6076
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURIGAMI_SUBGRAPH_URL, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, GRAPHQL_URL, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, STADER_ETH, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, USDT_ETH, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlamaAPI, fetchPriceFromDefiLlamaAndCoingecko, fetchPriceFromKyberSwap, fetchPriceFromOneInch, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, prepareParamsAggregator, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5995
6077
|
//# sourceMappingURL=sdk.esm.js.map
|