@aurigami/sdk 1.20.8 → 1.22.0
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/consts/constants.d.ts +3 -2
- package/dist/entities/auriEnv.d.ts +1 -1
- package/dist/helpers/aurigami-api.d.ts +1 -1
- package/dist/sdk.cjs.development.js +34 -30
- 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 +34 -30
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +11 -13
- package/package.json +2 -2
- package/src/SDK.ts +18 -24
- package/src/consts/constants.ts +3 -2
- package/src/entities/auriEnv.ts +4 -4
- package/src/helpers/aurigami-api.ts +2 -2
- package/src/helpers/helpers.ts +2 -2
- package/src/helpers/historicalPriceFetcher.ts +8 -1
- package/src/helpers/priceFetcher.ts +5 -5
- package/src/interactors/misc.ts +2 -5
- package/src/types/index.ts +11 -14
package/dist/sdk.esm.js
CHANGED
|
@@ -106,7 +106,8 @@ var networkAddresses = {
|
|
|
106
106
|
}],
|
|
107
107
|
misc: {
|
|
108
108
|
COMPTROLLER: /*#__PURE__*/MAINNET_ADDRESSES.comptroller.toLowerCase(),
|
|
109
|
-
|
|
109
|
+
DEPRECATED_OLD_ORACLE: /*#__PURE__*/MAINNET_ADDRESSES.oracle.toLowerCase(),
|
|
110
|
+
PYTH_ORACLE: /*#__PURE__*/MAINNET_ADDRESSES.pythOracle.toLowerCase(),
|
|
110
111
|
AURIFAIRLAUNCH: /*#__PURE__*/MAINNET_ADDRESSES.fairLaunch.toLowerCase(),
|
|
111
112
|
AURILENS: /*#__PURE__*/MAINNET_ADDRESSES.auriLens.toLowerCase(),
|
|
112
113
|
ETHREPAYHELPER: /*#__PURE__*/MAINNET_ADDRESSES.ethRepayHelper.toLowerCase(),
|
|
@@ -206,7 +207,7 @@ var SD_INCENTIVE_IN_SD = 83.35;
|
|
|
206
207
|
var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
|
|
207
208
|
var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
|
|
208
209
|
var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
|
|
209
|
-
var GRAPHQL_URL = 'https://explorer.
|
|
210
|
+
var GRAPHQL_URL = 'https://old.explorer.aurora.dev/api/v1/graphql';
|
|
210
211
|
|
|
211
212
|
var decimalRecords = {
|
|
212
213
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
@@ -931,7 +932,7 @@ function _getBlocksTimestamp() {
|
|
|
931
932
|
case 8:
|
|
932
933
|
results = _context5.sent.reduce(function (acc, cur) {
|
|
933
934
|
return _extends({}, acc, cur);
|
|
934
|
-
});
|
|
935
|
+
}, {});
|
|
935
936
|
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
936
937
|
return !results["b" + blockNumber];
|
|
937
938
|
});
|
|
@@ -1176,7 +1177,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1176
1177
|
key: "oracle",
|
|
1177
1178
|
get: function get() {
|
|
1178
1179
|
if (!this._oracle) {
|
|
1179
|
-
this._oracle = this.getContract(networkAddresses.misc.
|
|
1180
|
+
this._oracle = this.getContract(networkAddresses.misc.PYTH_ORACLE, AuriOracleABI.abi);
|
|
1180
1181
|
}
|
|
1181
1182
|
return this._oracle;
|
|
1182
1183
|
}
|
|
@@ -1809,7 +1810,7 @@ function _fetchPriceFromOracle() {
|
|
|
1809
1810
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1810
1811
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1811
1812
|
case 0:
|
|
1812
|
-
oracleContract = new Contract(networkAddresses.misc.
|
|
1813
|
+
oracleContract = new Contract(networkAddresses.misc.PYTH_ORACLE, AuriOracleABI.abi, provider);
|
|
1813
1814
|
_context12.next = 3;
|
|
1814
1815
|
return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
|
|
1815
1816
|
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
@@ -2303,22 +2304,25 @@ function fetchHistoricalPriceFromOracle(_x7, _x8, _x9, _x10) {
|
|
|
2303
2304
|
}
|
|
2304
2305
|
function _fetchHistoricalPriceFromOracle() {
|
|
2305
2306
|
_fetchHistoricalPriceFromOracle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(auTokenAddress, underlyingDecimal, provider, block) {
|
|
2306
|
-
var oracleContract, rawPrice;
|
|
2307
|
+
var oracleAddress, oracleContract, rawPrice;
|
|
2307
2308
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2308
2309
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2309
2310
|
case 0:
|
|
2310
|
-
|
|
2311
|
-
|
|
2311
|
+
// from this block, we switch to use pyth
|
|
2312
|
+
// TODO: add to consts
|
|
2313
|
+
oracleAddress = block < 102438637 ? networkAddresses.misc.DEPRECATED_OLD_ORACLE : networkAddresses.misc.PYTH_ORACLE;
|
|
2314
|
+
oracleContract = new Contract(oracleAddress, AuriOracleABI.abi, provider);
|
|
2315
|
+
_context4.next = 4;
|
|
2312
2316
|
return oracleContract.getUnderlyingPrice(auTokenAddress, {
|
|
2313
2317
|
blockTag: block
|
|
2314
2318
|
})["catch"](function (e) {
|
|
2315
2319
|
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
2316
2320
|
return BigNumber$1.from(0);
|
|
2317
2321
|
});
|
|
2318
|
-
case
|
|
2322
|
+
case 4:
|
|
2319
2323
|
rawPrice = _context4.sent;
|
|
2320
2324
|
return _context4.abrupt("return", processPriceFromOracle$1(rawPrice, underlyingDecimal));
|
|
2321
|
-
case
|
|
2325
|
+
case 6:
|
|
2322
2326
|
case "end":
|
|
2323
2327
|
return _context4.stop();
|
|
2324
2328
|
}
|
|
@@ -5337,7 +5341,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5337
5341
|
dust = /*#__PURE__*/new BigNumber(0.1);
|
|
5338
5342
|
}
|
|
5339
5343
|
_1E18 = BigNumber$1.from(10).pow(18);
|
|
5340
|
-
oracle = this.env.
|
|
5344
|
+
oracle = this.env.oracle;
|
|
5341
5345
|
tokens = tokenAddresses.map(function (addr) {
|
|
5342
5346
|
return _this2.env.getContract(addr, abis.abi);
|
|
5343
5347
|
});
|
|
@@ -5699,10 +5703,6 @@ function _postApi() {
|
|
|
5699
5703
|
return _postApi.apply(this, arguments);
|
|
5700
5704
|
}
|
|
5701
5705
|
|
|
5702
|
-
function getLiquidationEventsQuery(address, limit) {
|
|
5703
|
-
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 }";
|
|
5704
|
-
}
|
|
5705
|
-
|
|
5706
5706
|
var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
5707
5707
|
_inheritsLoose(SdkRead, _BlockchainEntityRead);
|
|
5708
5708
|
function SdkRead(networkConnection) {
|
|
@@ -6046,38 +6046,42 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
6046
6046
|
}();
|
|
6047
6047
|
_proto.getLiquidationHistory = /*#__PURE__*/function () {
|
|
6048
6048
|
var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
|
|
6049
|
-
var
|
|
6049
|
+
var liquidationHistoryResp, blocks, blocksTimestamp, liquidationEvents;
|
|
6050
6050
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
6051
6051
|
while (1) switch (_context16.prev = _context16.next) {
|
|
6052
6052
|
case 0:
|
|
6053
6053
|
_context16.next = 2;
|
|
6054
|
-
return
|
|
6054
|
+
return getPaginatedApi('/liquidate/history', {
|
|
6055
|
+
user: address
|
|
6056
|
+
});
|
|
6055
6057
|
case 2:
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6058
|
+
liquidationHistoryResp = _context16.sent;
|
|
6059
|
+
blocks = liquidationHistoryResp.items.map(function (event) {
|
|
6060
|
+
return event.blockNumber;
|
|
6061
|
+
});
|
|
6062
|
+
_context16.next = 6;
|
|
6063
|
+
return getBlocksTimestamp(this._networkConnection.provider, blocks);
|
|
6064
|
+
case 6:
|
|
6065
|
+
blocksTimestamp = _context16.sent;
|
|
6066
|
+
liquidationEvents = liquidationHistoryResp.items.map(function (event, idx) {
|
|
6062
6067
|
var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
|
|
6063
|
-
return auToken.
|
|
6068
|
+
return auToken.address.toLowerCase() === event.marketRepayToken.toLowerCase();
|
|
6064
6069
|
}).underlying;
|
|
6065
6070
|
var decimal = getDecimal(underlyingAddress);
|
|
6066
6071
|
var token = new Token(underlyingAddress, decimal);
|
|
6067
|
-
var tokenAmount = new TokenAmount(token, event.
|
|
6072
|
+
var tokenAmount = new TokenAmount(token, event.repayAmount.toString(), true);
|
|
6068
6073
|
return {
|
|
6069
|
-
liquidationTime:
|
|
6074
|
+
liquidationTime: blocksTimestamp[idx],
|
|
6070
6075
|
tokenAmount: tokenAmount,
|
|
6071
|
-
|
|
6072
|
-
transactionId: event.id.split('-')[0]
|
|
6076
|
+
transactionId: event.txnHash
|
|
6073
6077
|
};
|
|
6074
6078
|
});
|
|
6075
6079
|
return _context16.abrupt("return", liquidationEvents);
|
|
6076
|
-
case
|
|
6080
|
+
case 9:
|
|
6077
6081
|
case "end":
|
|
6078
6082
|
return _context16.stop();
|
|
6079
6083
|
}
|
|
6080
|
-
}, _callee16);
|
|
6084
|
+
}, _callee16, this);
|
|
6081
6085
|
}));
|
|
6082
6086
|
function getLiquidationHistory(_x21) {
|
|
6083
6087
|
return _getLiquidationHistory.apply(this, arguments);
|