@aurigami/sdk 1.6.11 → 1.7.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/contracts/Referral.d.ts +7 -0
- package/dist/helpers/aurigami-api.d.ts +13 -0
- package/dist/helpers/graphql-helpers.d.ts +1 -0
- package/dist/helpers/helpers.d.ts +7 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/sdk.cjs.development.js +360 -35
- 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 +356 -36
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +4 -1
- package/src/contracts/Referral.ts +16 -0
- package/src/helpers/aurigami-api.ts +42 -0
- package/src/helpers/graphql-helpers.ts +12 -0
- package/src/helpers/helpers.ts +56 -0
- package/src/helpers/index.ts +2 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -21,6 +21,7 @@ import abis$4 from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
|
21
21
|
import abis$a from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
|
|
22
22
|
import { Signer } from '@ethersproject/abstract-signer';
|
|
23
23
|
import axios from 'axios';
|
|
24
|
+
import fetch from 'node-fetch';
|
|
24
25
|
|
|
25
26
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
26
27
|
var ETHAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
@@ -1132,6 +1133,47 @@ function _getQuery() {
|
|
|
1132
1133
|
return _getQuery.apply(this, arguments);
|
|
1133
1134
|
}
|
|
1134
1135
|
|
|
1136
|
+
var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
|
|
1137
|
+
function queryGraphQL(_x) {
|
|
1138
|
+
return _queryGraphQL.apply(this, arguments);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
function _queryGraphQL() {
|
|
1142
|
+
_queryGraphQL = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(query) {
|
|
1143
|
+
var resp;
|
|
1144
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1145
|
+
while (1) {
|
|
1146
|
+
switch (_context.prev = _context.next) {
|
|
1147
|
+
case 0:
|
|
1148
|
+
_context.next = 2;
|
|
1149
|
+
return fetch(GRAPHQL_URL, {
|
|
1150
|
+
headers: {
|
|
1151
|
+
'Content-Type': 'application/json'
|
|
1152
|
+
},
|
|
1153
|
+
method: 'POST',
|
|
1154
|
+
body: JSON.stringify({
|
|
1155
|
+
query: query
|
|
1156
|
+
})
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
case 2:
|
|
1160
|
+
resp = _context.sent;
|
|
1161
|
+
_context.next = 5;
|
|
1162
|
+
return resp.json();
|
|
1163
|
+
|
|
1164
|
+
case 5:
|
|
1165
|
+
return _context.abrupt("return", _context.sent.data);
|
|
1166
|
+
|
|
1167
|
+
case 6:
|
|
1168
|
+
case "end":
|
|
1169
|
+
return _context.stop();
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}, _callee);
|
|
1173
|
+
}));
|
|
1174
|
+
return _queryGraphQL.apply(this, arguments);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1135
1177
|
function assert(condition, message) {
|
|
1136
1178
|
if (message === void 0) {
|
|
1137
1179
|
message = '';
|
|
@@ -1186,14 +1228,6 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1186
1228
|
function getBlockTimestamp(_x, _x2) {
|
|
1187
1229
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1188
1230
|
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Get the block number of the last block that has a timestamp before the given timestamp
|
|
1191
|
-
* @param timestamp input timestamp
|
|
1192
|
-
* @returns return the last block that its timestamp <= the give timestamp
|
|
1193
|
-
* @note Check this API for more information: https://aurorascan.dev/apis#blocks
|
|
1194
|
-
*
|
|
1195
|
-
* This function is much faster than using binary search.
|
|
1196
|
-
*/
|
|
1197
1231
|
|
|
1198
1232
|
function _getBlockTimestamp() {
|
|
1199
1233
|
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider, blockNumber) {
|
|
@@ -1219,47 +1253,192 @@ function _getBlockTimestamp() {
|
|
|
1219
1253
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1220
1254
|
}
|
|
1221
1255
|
|
|
1222
|
-
function
|
|
1256
|
+
function getBlocksTimestampViaRPC(_x3, _x4) {
|
|
1257
|
+
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Get timestamp of multiple blocks.
|
|
1261
|
+
* @note the getBlockTimestamp function is too slow because of the RPC call, even with Promise.all.
|
|
1262
|
+
* So I use the GraphQL endpoint of Aurora instead. You can check it here: https://explorer.mainnet.aurora.dev/graphiql
|
|
1263
|
+
*/
|
|
1264
|
+
|
|
1265
|
+
function _getBlocksTimestampViaRPC() {
|
|
1266
|
+
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(provider, blocksNumber) {
|
|
1267
|
+
var CHUNK_SIZE, results, i, slice, promises;
|
|
1268
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1269
|
+
while (1) {
|
|
1270
|
+
switch (_context3.prev = _context3.next) {
|
|
1271
|
+
case 0:
|
|
1272
|
+
// Promise all 200 blocks at a time, using too many blocks at once will cause the RPC call timeout.
|
|
1273
|
+
CHUNK_SIZE = 200;
|
|
1274
|
+
results = [];
|
|
1275
|
+
i = 0;
|
|
1276
|
+
|
|
1277
|
+
case 3:
|
|
1278
|
+
if (!(i < blocksNumber.length)) {
|
|
1279
|
+
_context3.next = 14;
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
slice = blocksNumber.slice(i, i + CHUNK_SIZE);
|
|
1284
|
+
promises = slice.map( /*#__PURE__*/function () {
|
|
1285
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(blockNumber) {
|
|
1286
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1287
|
+
while (1) {
|
|
1288
|
+
switch (_context2.prev = _context2.next) {
|
|
1289
|
+
case 0:
|
|
1290
|
+
return _context2.abrupt("return", getBlockTimestamp(provider, blockNumber));
|
|
1291
|
+
|
|
1292
|
+
case 1:
|
|
1293
|
+
case "end":
|
|
1294
|
+
return _context2.stop();
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}, _callee2);
|
|
1298
|
+
}));
|
|
1299
|
+
|
|
1300
|
+
return function (_x9) {
|
|
1301
|
+
return _ref.apply(this, arguments);
|
|
1302
|
+
};
|
|
1303
|
+
}());
|
|
1304
|
+
_context3.t0 = results;
|
|
1305
|
+
_context3.next = 9;
|
|
1306
|
+
return Promise.all(promises);
|
|
1307
|
+
|
|
1308
|
+
case 9:
|
|
1309
|
+
_context3.t1 = _context3.sent;
|
|
1310
|
+
results = _context3.t0.concat.call(_context3.t0, _context3.t1);
|
|
1311
|
+
|
|
1312
|
+
case 11:
|
|
1313
|
+
i += CHUNK_SIZE;
|
|
1314
|
+
_context3.next = 3;
|
|
1315
|
+
break;
|
|
1316
|
+
|
|
1317
|
+
case 14:
|
|
1318
|
+
return _context3.abrupt("return", results);
|
|
1319
|
+
|
|
1320
|
+
case 15:
|
|
1321
|
+
case "end":
|
|
1322
|
+
return _context3.stop();
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}, _callee3);
|
|
1326
|
+
}));
|
|
1327
|
+
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
function getBlocksTimestamp(_x5, _x6) {
|
|
1331
|
+
return _getBlocksTimestamp.apply(this, arguments);
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Get the block number of the last block that has a timestamp before the given timestamp
|
|
1335
|
+
* @param timestamp input timestamp
|
|
1336
|
+
* @returns return the last block that its timestamp <= the give timestamp
|
|
1337
|
+
* @note Check this API for more information: https://aurorascan.dev/apis#blocks
|
|
1338
|
+
*
|
|
1339
|
+
* This function is much faster than using binary search.
|
|
1340
|
+
*/
|
|
1341
|
+
|
|
1342
|
+
function _getBlocksTimestamp() {
|
|
1343
|
+
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blockNumbers) {
|
|
1344
|
+
var CHUNK_SIZE, promises, lines, i, query, results, missingBlocks, missingBlocksTimestamps;
|
|
1345
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1346
|
+
while (1) {
|
|
1347
|
+
switch (_context4.prev = _context4.next) {
|
|
1348
|
+
case 0:
|
|
1349
|
+
CHUNK_SIZE = 100; // graphql query limit
|
|
1350
|
+
|
|
1351
|
+
promises = [];
|
|
1352
|
+
lines = blockNumbers.map(function (x) {
|
|
1353
|
+
return "b" + x + ": block(number: " + x + ") { timestamp }";
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
for (i = 0; i < lines.length; i += CHUNK_SIZE) {
|
|
1357
|
+
query = "{ " + lines.slice(i, i + CHUNK_SIZE).join('\n') + " }";
|
|
1358
|
+
promises.push(queryGraphQL(query));
|
|
1359
|
+
} // merge all the json objects
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
_context4.next = 6;
|
|
1363
|
+
return Promise.all(promises);
|
|
1364
|
+
|
|
1365
|
+
case 6:
|
|
1366
|
+
results = _context4.sent.reduce(function (acc, cur) {
|
|
1367
|
+
return _extends({}, acc, cur);
|
|
1368
|
+
});
|
|
1369
|
+
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
1370
|
+
return !results["b" + blockNumber];
|
|
1371
|
+
});
|
|
1372
|
+
|
|
1373
|
+
if (missingBlocks.length > 0) {
|
|
1374
|
+
devLog("These blocks are missing from Aurora GraphQL endpoint: " + missingBlocks.join(', '));
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
_context4.next = 11;
|
|
1378
|
+
return getBlocksTimestampViaRPC(provider, missingBlocks);
|
|
1379
|
+
|
|
1380
|
+
case 11:
|
|
1381
|
+
missingBlocksTimestamps = _context4.sent;
|
|
1382
|
+
missingBlocksTimestamps.forEach(function (timestamp, index) {
|
|
1383
|
+
results["b" + missingBlocks[index]] = {
|
|
1384
|
+
timestamp: new Date(timestamp * 1000).toISOString()
|
|
1385
|
+
};
|
|
1386
|
+
});
|
|
1387
|
+
return _context4.abrupt("return", blockNumbers.map(function (blockNumber) {
|
|
1388
|
+
return Math.trunc(new Date(results["b" + blockNumber].timestamp).getTime() / 1000);
|
|
1389
|
+
}));
|
|
1390
|
+
|
|
1391
|
+
case 14:
|
|
1392
|
+
case "end":
|
|
1393
|
+
return _context4.stop();
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}, _callee4);
|
|
1397
|
+
}));
|
|
1398
|
+
return _getBlocksTimestamp.apply(this, arguments);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
function getBlockBeforeTimestamp(_x7, _x8) {
|
|
1223
1402
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1224
1403
|
}
|
|
1225
1404
|
|
|
1226
1405
|
function _getBlockBeforeTimestamp() {
|
|
1227
|
-
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1406
|
+
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, timestamp) {
|
|
1228
1407
|
var result;
|
|
1229
|
-
return runtime_1.wrap(function
|
|
1408
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1230
1409
|
while (1) {
|
|
1231
|
-
switch (
|
|
1410
|
+
switch (_context5.prev = _context5.next) {
|
|
1232
1411
|
case 0:
|
|
1233
|
-
|
|
1412
|
+
_context5.next = 2;
|
|
1234
1413
|
return getQuery('block', 'getblocknobytime', {
|
|
1235
1414
|
timestamp: timestamp,
|
|
1236
1415
|
closest: 'before'
|
|
1237
1416
|
});
|
|
1238
1417
|
|
|
1239
1418
|
case 2:
|
|
1240
|
-
result =
|
|
1241
|
-
|
|
1419
|
+
result = _context5.sent;
|
|
1420
|
+
_context5.t0 = parseInt(result);
|
|
1242
1421
|
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1422
|
+
if (_context5.t0) {
|
|
1423
|
+
_context5.next = 8;
|
|
1245
1424
|
break;
|
|
1246
1425
|
}
|
|
1247
1426
|
|
|
1248
|
-
|
|
1427
|
+
_context5.next = 7;
|
|
1249
1428
|
return provider.getBlockNumber();
|
|
1250
1429
|
|
|
1251
1430
|
case 7:
|
|
1252
|
-
|
|
1431
|
+
_context5.t0 = _context5.sent;
|
|
1253
1432
|
|
|
1254
1433
|
case 8:
|
|
1255
|
-
return
|
|
1434
|
+
return _context5.abrupt("return", _context5.t0);
|
|
1256
1435
|
|
|
1257
1436
|
case 9:
|
|
1258
1437
|
case "end":
|
|
1259
|
-
return
|
|
1438
|
+
return _context5.stop();
|
|
1260
1439
|
}
|
|
1261
1440
|
}
|
|
1262
|
-
},
|
|
1441
|
+
}, _callee5);
|
|
1263
1442
|
}));
|
|
1264
1443
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1265
1444
|
}
|
|
@@ -1338,6 +1517,91 @@ var dummyUserMarketDetails = {
|
|
|
1338
1517
|
underlyingPrice: '1'
|
|
1339
1518
|
};
|
|
1340
1519
|
|
|
1520
|
+
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
1521
|
+
function getApi(_x, _x2) {
|
|
1522
|
+
return _getApi.apply(this, arguments);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
function _getApi() {
|
|
1526
|
+
_getApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(url, params) {
|
|
1527
|
+
var resp;
|
|
1528
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1529
|
+
while (1) {
|
|
1530
|
+
switch (_context.prev = _context.next) {
|
|
1531
|
+
case 0:
|
|
1532
|
+
if (params === void 0) {
|
|
1533
|
+
params = {};
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
_context.next = 3;
|
|
1537
|
+
return axios.get(AURIGAMI_API_END_POINT + url + '?' + new URLSearchParams(params), {
|
|
1538
|
+
headers: {
|
|
1539
|
+
'Content-Type': 'application/json'
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
case 3:
|
|
1544
|
+
resp = _context.sent;
|
|
1545
|
+
return _context.abrupt("return", resp.data);
|
|
1546
|
+
|
|
1547
|
+
case 5:
|
|
1548
|
+
case "end":
|
|
1549
|
+
return _context.stop();
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}, _callee);
|
|
1553
|
+
}));
|
|
1554
|
+
return _getApi.apply(this, arguments);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
function getPaginatedApi(_x3, _x4, _x5, _x6) {
|
|
1558
|
+
return _getPaginatedApi.apply(this, arguments);
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
function _getPaginatedApi() {
|
|
1562
|
+
_getPaginatedApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(url, params, page, pageSize) {
|
|
1563
|
+
var resp;
|
|
1564
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1565
|
+
while (1) {
|
|
1566
|
+
switch (_context2.prev = _context2.next) {
|
|
1567
|
+
case 0:
|
|
1568
|
+
if (params === void 0) {
|
|
1569
|
+
params = {};
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
if (page === void 0) {
|
|
1573
|
+
page = 1;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
if (pageSize === void 0) {
|
|
1577
|
+
pageSize = 50;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
params = _extends({}, params, {
|
|
1581
|
+
page: page,
|
|
1582
|
+
limit: pageSize
|
|
1583
|
+
});
|
|
1584
|
+
_context2.next = 6;
|
|
1585
|
+
return axios.get(AURIGAMI_API_END_POINT + url + '?' + new URLSearchParams(params), {
|
|
1586
|
+
headers: {
|
|
1587
|
+
'Content-Type': 'application/json'
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
case 6:
|
|
1592
|
+
resp = _context2.sent;
|
|
1593
|
+
return _context2.abrupt("return", resp.data);
|
|
1594
|
+
|
|
1595
|
+
case 8:
|
|
1596
|
+
case "end":
|
|
1597
|
+
return _context2.stop();
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}, _callee2);
|
|
1601
|
+
}));
|
|
1602
|
+
return _getPaginatedApi.apply(this, arguments);
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1341
1605
|
function fetchPriceFromCoingeckoAPI(_x) {
|
|
1342
1606
|
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
1343
1607
|
}
|
|
@@ -2033,7 +2297,10 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2033
2297
|
|
|
2034
2298
|
var helpers = {
|
|
2035
2299
|
__proto__: null,
|
|
2300
|
+
getApi: getApi,
|
|
2301
|
+
getPaginatedApi: getPaginatedApi,
|
|
2036
2302
|
getQuery: getQuery,
|
|
2303
|
+
queryGraphQL: queryGraphQL,
|
|
2037
2304
|
assert: assert,
|
|
2038
2305
|
formatObject: formatObject,
|
|
2039
2306
|
decimalFactor: decimalFactor,
|
|
@@ -2044,6 +2311,8 @@ var helpers = {
|
|
|
2044
2311
|
getSymbol: getSymbol,
|
|
2045
2312
|
calcLMRewardApr: calcLMRewardApr,
|
|
2046
2313
|
getBlockTimestamp: getBlockTimestamp,
|
|
2314
|
+
getBlocksTimestampViaRPC: getBlocksTimestampViaRPC,
|
|
2315
|
+
getBlocksTimestamp: getBlocksTimestamp,
|
|
2047
2316
|
getBlockBeforeTimestamp: getBlockBeforeTimestamp,
|
|
2048
2317
|
devLog: devLog,
|
|
2049
2318
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
@@ -4208,6 +4477,57 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4208
4477
|
}
|
|
4209
4478
|
|
|
4210
4479
|
return getReferralCodeOwner;
|
|
4480
|
+
}()
|
|
4481
|
+
/**
|
|
4482
|
+
* Get referrals of a user, sorted descending by timestamp.
|
|
4483
|
+
*/
|
|
4484
|
+
;
|
|
4485
|
+
|
|
4486
|
+
_proto.getReferralsList =
|
|
4487
|
+
/*#__PURE__*/
|
|
4488
|
+
function () {
|
|
4489
|
+
var _getReferralsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddr) {
|
|
4490
|
+
var result, blocks, blocksTimestamp, items;
|
|
4491
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
4492
|
+
while (1) {
|
|
4493
|
+
switch (_context4.prev = _context4.next) {
|
|
4494
|
+
case 0:
|
|
4495
|
+
_context4.next = 2;
|
|
4496
|
+
return getPaginatedApi('/referral/list', {
|
|
4497
|
+
address: userAddr
|
|
4498
|
+
});
|
|
4499
|
+
|
|
4500
|
+
case 2:
|
|
4501
|
+
result = _context4.sent;
|
|
4502
|
+
blocks = result.items.map(function (item) {
|
|
4503
|
+
return item.blockNumber;
|
|
4504
|
+
});
|
|
4505
|
+
_context4.next = 6;
|
|
4506
|
+
return getBlocksTimestamp(this._networkConnection.provider, blocks);
|
|
4507
|
+
|
|
4508
|
+
case 6:
|
|
4509
|
+
blocksTimestamp = _context4.sent;
|
|
4510
|
+
items = result.items.map(function (item, i) {
|
|
4511
|
+
return {
|
|
4512
|
+
user: item.user,
|
|
4513
|
+
timestamp: blocksTimestamp[i]
|
|
4514
|
+
};
|
|
4515
|
+
});
|
|
4516
|
+
return _context4.abrupt("return", items);
|
|
4517
|
+
|
|
4518
|
+
case 9:
|
|
4519
|
+
case "end":
|
|
4520
|
+
return _context4.stop();
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
}, _callee4, this);
|
|
4524
|
+
}));
|
|
4525
|
+
|
|
4526
|
+
function getReferralsList(_x4) {
|
|
4527
|
+
return _getReferralsList.apply(this, arguments);
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4530
|
+
return getReferralsList;
|
|
4211
4531
|
}();
|
|
4212
4532
|
|
|
4213
4533
|
return ReferralRead;
|
|
@@ -4229,21 +4549,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4229
4549
|
_proto2.registerNewReferralCode =
|
|
4230
4550
|
/*#__PURE__*/
|
|
4231
4551
|
function () {
|
|
4232
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4552
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
4233
4553
|
var referralCode;
|
|
4234
|
-
return runtime_1.wrap(function
|
|
4554
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4235
4555
|
while (1) {
|
|
4236
|
-
switch (
|
|
4556
|
+
switch (_context5.prev = _context5.next) {
|
|
4237
4557
|
case 0:
|
|
4238
4558
|
referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
4239
|
-
return
|
|
4559
|
+
return _context5.abrupt("return", this.referral.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
4240
4560
|
|
|
4241
4561
|
case 2:
|
|
4242
4562
|
case "end":
|
|
4243
|
-
return
|
|
4563
|
+
return _context5.stop();
|
|
4244
4564
|
}
|
|
4245
4565
|
}
|
|
4246
|
-
},
|
|
4566
|
+
}, _callee5, this);
|
|
4247
4567
|
}));
|
|
4248
4568
|
|
|
4249
4569
|
function registerNewReferralCode() {
|
|
@@ -4260,24 +4580,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
4260
4580
|
_proto2.useReferralCode =
|
|
4261
4581
|
/*#__PURE__*/
|
|
4262
4582
|
function () {
|
|
4263
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4583
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(code) {
|
|
4264
4584
|
var referralCode;
|
|
4265
|
-
return runtime_1.wrap(function
|
|
4585
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4266
4586
|
while (1) {
|
|
4267
|
-
switch (
|
|
4587
|
+
switch (_context6.prev = _context6.next) {
|
|
4268
4588
|
case 0:
|
|
4269
4589
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
4270
|
-
return
|
|
4590
|
+
return _context6.abrupt("return", this.referral.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
4271
4591
|
|
|
4272
4592
|
case 2:
|
|
4273
4593
|
case "end":
|
|
4274
|
-
return
|
|
4594
|
+
return _context6.stop();
|
|
4275
4595
|
}
|
|
4276
4596
|
}
|
|
4277
|
-
},
|
|
4597
|
+
}, _callee6, this);
|
|
4278
4598
|
}));
|
|
4279
4599
|
|
|
4280
|
-
function useReferralCode(
|
|
4600
|
+
function useReferralCode(_x5) {
|
|
4281
4601
|
return _useReferralCode.apply(this, arguments);
|
|
4282
4602
|
}
|
|
4283
4603
|
|
|
@@ -4714,5 +5034,5 @@ BigNumber.config({
|
|
|
4714
5034
|
DECIMAL_PLACES: 50
|
|
4715
5035
|
});
|
|
4716
5036
|
|
|
4717
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, 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, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, getQuery, getSymbol, isSameAddress, networkAddresses, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5037
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, 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, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, isSameAddress, networkAddresses, queryGraphQL, symbolRecords, validateAndParseAddress, valuateToken };
|
|
4718
5038
|
//# sourceMappingURL=sdk.esm.js.map
|