@aurigami/sdk 1.11.0 → 1.11.2-dummy1
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/helpers/helpers.d.ts +1 -0
- package/dist/interactors/Referral.d.ts +11 -0
- package/dist/sdk.cjs.development.js +234 -93
- 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 +234 -94
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/consts/dummy.ts +6 -4
- package/src/helpers/helpers.ts +6 -0
- package/src/interactors/PlyGame.ts +12 -2
- package/src/interactors/Referral.ts +36 -3
- package/src/types/index.ts +2 -0
- package/src/a.ts.log +0 -29
package/dist/sdk.esm.js
CHANGED
|
@@ -1207,6 +1207,30 @@ var isSameAddress = function isSameAddress(address1, address2) {
|
|
|
1207
1207
|
var getCurrentTimestamp = function getCurrentTimestamp() {
|
|
1208
1208
|
return Math.trunc(Date.now() / 1000);
|
|
1209
1209
|
};
|
|
1210
|
+
function sleep(_x) {
|
|
1211
|
+
return _sleep.apply(this, arguments);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
function _sleep() {
|
|
1215
|
+
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(duration) {
|
|
1216
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1217
|
+
while (1) {
|
|
1218
|
+
switch (_context.prev = _context.next) {
|
|
1219
|
+
case 0:
|
|
1220
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
1221
|
+
setTimeout(resolve, duration);
|
|
1222
|
+
}));
|
|
1223
|
+
|
|
1224
|
+
case 1:
|
|
1225
|
+
case "end":
|
|
1226
|
+
return _context.stop();
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}, _callee);
|
|
1230
|
+
}));
|
|
1231
|
+
return _sleep.apply(this, arguments);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1210
1234
|
function validateAndParseAddress(address) {
|
|
1211
1235
|
try {
|
|
1212
1236
|
return utils.getAddress(address);
|
|
@@ -1248,35 +1272,35 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1248
1272
|
|
|
1249
1273
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1250
1274
|
}
|
|
1251
|
-
function getBlockTimestamp(
|
|
1275
|
+
function getBlockTimestamp(_x2, _x3) {
|
|
1252
1276
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1253
1277
|
}
|
|
1254
1278
|
|
|
1255
1279
|
function _getBlockTimestamp() {
|
|
1256
|
-
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1280
|
+
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, blockNumber) {
|
|
1257
1281
|
var block;
|
|
1258
|
-
return runtime_1.wrap(function
|
|
1282
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1259
1283
|
while (1) {
|
|
1260
|
-
switch (
|
|
1284
|
+
switch (_context2.prev = _context2.next) {
|
|
1261
1285
|
case 0:
|
|
1262
|
-
|
|
1286
|
+
_context2.next = 2;
|
|
1263
1287
|
return provider.getBlock(blockNumber);
|
|
1264
1288
|
|
|
1265
1289
|
case 2:
|
|
1266
|
-
block =
|
|
1267
|
-
return
|
|
1290
|
+
block = _context2.sent;
|
|
1291
|
+
return _context2.abrupt("return", block.timestamp);
|
|
1268
1292
|
|
|
1269
1293
|
case 4:
|
|
1270
1294
|
case "end":
|
|
1271
|
-
return
|
|
1295
|
+
return _context2.stop();
|
|
1272
1296
|
}
|
|
1273
1297
|
}
|
|
1274
|
-
},
|
|
1298
|
+
}, _callee2);
|
|
1275
1299
|
}));
|
|
1276
1300
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1277
1301
|
}
|
|
1278
1302
|
|
|
1279
|
-
function getBlocksTimestampViaRPC(
|
|
1303
|
+
function getBlocksTimestampViaRPC(_x4, _x5) {
|
|
1280
1304
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1281
1305
|
}
|
|
1282
1306
|
/**
|
|
@@ -1286,11 +1310,11 @@ function getBlocksTimestampViaRPC(_x3, _x4) {
|
|
|
1286
1310
|
*/
|
|
1287
1311
|
|
|
1288
1312
|
function _getBlocksTimestampViaRPC() {
|
|
1289
|
-
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1313
|
+
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blocksNumber) {
|
|
1290
1314
|
var CHUNK_SIZE, results, i, slice, promises;
|
|
1291
|
-
return runtime_1.wrap(function
|
|
1315
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1292
1316
|
while (1) {
|
|
1293
|
-
switch (
|
|
1317
|
+
switch (_context4.prev = _context4.next) {
|
|
1294
1318
|
case 0:
|
|
1295
1319
|
// Promise all 200 blocks at a time, using too many blocks at once will cause the RPC call timeout.
|
|
1296
1320
|
CHUNK_SIZE = 200;
|
|
@@ -1299,58 +1323,58 @@ function _getBlocksTimestampViaRPC() {
|
|
|
1299
1323
|
|
|
1300
1324
|
case 3:
|
|
1301
1325
|
if (!(i < blocksNumber.length)) {
|
|
1302
|
-
|
|
1326
|
+
_context4.next = 14;
|
|
1303
1327
|
break;
|
|
1304
1328
|
}
|
|
1305
1329
|
|
|
1306
1330
|
slice = blocksNumber.slice(i, i + CHUNK_SIZE);
|
|
1307
1331
|
promises = slice.map( /*#__PURE__*/function () {
|
|
1308
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1309
|
-
return runtime_1.wrap(function
|
|
1332
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(blockNumber) {
|
|
1333
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1310
1334
|
while (1) {
|
|
1311
|
-
switch (
|
|
1335
|
+
switch (_context3.prev = _context3.next) {
|
|
1312
1336
|
case 0:
|
|
1313
|
-
return
|
|
1337
|
+
return _context3.abrupt("return", getBlockTimestamp(provider, blockNumber));
|
|
1314
1338
|
|
|
1315
1339
|
case 1:
|
|
1316
1340
|
case "end":
|
|
1317
|
-
return
|
|
1341
|
+
return _context3.stop();
|
|
1318
1342
|
}
|
|
1319
1343
|
}
|
|
1320
|
-
},
|
|
1344
|
+
}, _callee3);
|
|
1321
1345
|
}));
|
|
1322
1346
|
|
|
1323
|
-
return function (
|
|
1347
|
+
return function (_x10) {
|
|
1324
1348
|
return _ref.apply(this, arguments);
|
|
1325
1349
|
};
|
|
1326
1350
|
}());
|
|
1327
|
-
|
|
1328
|
-
|
|
1351
|
+
_context4.t0 = results;
|
|
1352
|
+
_context4.next = 9;
|
|
1329
1353
|
return Promise.all(promises);
|
|
1330
1354
|
|
|
1331
1355
|
case 9:
|
|
1332
|
-
|
|
1333
|
-
results =
|
|
1356
|
+
_context4.t1 = _context4.sent;
|
|
1357
|
+
results = _context4.t0.concat.call(_context4.t0, _context4.t1);
|
|
1334
1358
|
|
|
1335
1359
|
case 11:
|
|
1336
1360
|
i += CHUNK_SIZE;
|
|
1337
|
-
|
|
1361
|
+
_context4.next = 3;
|
|
1338
1362
|
break;
|
|
1339
1363
|
|
|
1340
1364
|
case 14:
|
|
1341
|
-
return
|
|
1365
|
+
return _context4.abrupt("return", results);
|
|
1342
1366
|
|
|
1343
1367
|
case 15:
|
|
1344
1368
|
case "end":
|
|
1345
|
-
return
|
|
1369
|
+
return _context4.stop();
|
|
1346
1370
|
}
|
|
1347
1371
|
}
|
|
1348
|
-
},
|
|
1372
|
+
}, _callee4);
|
|
1349
1373
|
}));
|
|
1350
1374
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1351
1375
|
}
|
|
1352
1376
|
|
|
1353
|
-
function getBlocksTimestamp(
|
|
1377
|
+
function getBlocksTimestamp(_x6, _x7) {
|
|
1354
1378
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1355
1379
|
}
|
|
1356
1380
|
/**
|
|
@@ -1363,18 +1387,18 @@ function getBlocksTimestamp(_x5, _x6) {
|
|
|
1363
1387
|
*/
|
|
1364
1388
|
|
|
1365
1389
|
function _getBlocksTimestamp() {
|
|
1366
|
-
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1390
|
+
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, blockNumbers) {
|
|
1367
1391
|
var CHUNK_SIZE, promises, lines, i, query, results, missingBlocks, missingBlocksTimestamps;
|
|
1368
|
-
return runtime_1.wrap(function
|
|
1392
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1369
1393
|
while (1) {
|
|
1370
|
-
switch (
|
|
1394
|
+
switch (_context5.prev = _context5.next) {
|
|
1371
1395
|
case 0:
|
|
1372
1396
|
if (!(blockNumbers.length == 0)) {
|
|
1373
|
-
|
|
1397
|
+
_context5.next = 2;
|
|
1374
1398
|
break;
|
|
1375
1399
|
}
|
|
1376
1400
|
|
|
1377
|
-
return
|
|
1401
|
+
return _context5.abrupt("return", []);
|
|
1378
1402
|
|
|
1379
1403
|
case 2:
|
|
1380
1404
|
CHUNK_SIZE = 100; // graphql query limit
|
|
@@ -1390,11 +1414,11 @@ function _getBlocksTimestamp() {
|
|
|
1390
1414
|
} // merge all the json objects
|
|
1391
1415
|
|
|
1392
1416
|
|
|
1393
|
-
|
|
1417
|
+
_context5.next = 8;
|
|
1394
1418
|
return Promise.all(promises);
|
|
1395
1419
|
|
|
1396
1420
|
case 8:
|
|
1397
|
-
results =
|
|
1421
|
+
results = _context5.sent.reduce(function (acc, cur) {
|
|
1398
1422
|
return _extends({}, acc, cur);
|
|
1399
1423
|
});
|
|
1400
1424
|
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
@@ -1405,71 +1429,71 @@ function _getBlocksTimestamp() {
|
|
|
1405
1429
|
devLog("These blocks are missing from Aurora GraphQL endpoint: " + missingBlocks.join(', '));
|
|
1406
1430
|
}
|
|
1407
1431
|
|
|
1408
|
-
|
|
1432
|
+
_context5.next = 13;
|
|
1409
1433
|
return getBlocksTimestampViaRPC(provider, missingBlocks);
|
|
1410
1434
|
|
|
1411
1435
|
case 13:
|
|
1412
|
-
missingBlocksTimestamps =
|
|
1436
|
+
missingBlocksTimestamps = _context5.sent;
|
|
1413
1437
|
missingBlocksTimestamps.forEach(function (timestamp, index) {
|
|
1414
1438
|
results["b" + missingBlocks[index]] = {
|
|
1415
1439
|
timestamp: new Date(timestamp * 1000).toISOString()
|
|
1416
1440
|
};
|
|
1417
1441
|
});
|
|
1418
|
-
return
|
|
1442
|
+
return _context5.abrupt("return", blockNumbers.map(function (blockNumber) {
|
|
1419
1443
|
return Math.trunc(new Date(results["b" + blockNumber].timestamp).getTime() / 1000);
|
|
1420
1444
|
}));
|
|
1421
1445
|
|
|
1422
1446
|
case 16:
|
|
1423
1447
|
case "end":
|
|
1424
|
-
return
|
|
1448
|
+
return _context5.stop();
|
|
1425
1449
|
}
|
|
1426
1450
|
}
|
|
1427
|
-
},
|
|
1451
|
+
}, _callee5);
|
|
1428
1452
|
}));
|
|
1429
1453
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1430
1454
|
}
|
|
1431
1455
|
|
|
1432
|
-
function getBlockBeforeTimestamp(
|
|
1456
|
+
function getBlockBeforeTimestamp(_x8, _x9) {
|
|
1433
1457
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1434
1458
|
}
|
|
1435
1459
|
|
|
1436
1460
|
function _getBlockBeforeTimestamp() {
|
|
1437
|
-
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1461
|
+
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider, timestamp) {
|
|
1438
1462
|
var result;
|
|
1439
|
-
return runtime_1.wrap(function
|
|
1463
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1440
1464
|
while (1) {
|
|
1441
|
-
switch (
|
|
1465
|
+
switch (_context6.prev = _context6.next) {
|
|
1442
1466
|
case 0:
|
|
1443
|
-
|
|
1467
|
+
_context6.next = 2;
|
|
1444
1468
|
return getQuery('block', 'getblocknobytime', {
|
|
1445
1469
|
timestamp: timestamp,
|
|
1446
1470
|
closest: 'before'
|
|
1447
1471
|
});
|
|
1448
1472
|
|
|
1449
1473
|
case 2:
|
|
1450
|
-
result =
|
|
1451
|
-
|
|
1474
|
+
result = _context6.sent;
|
|
1475
|
+
_context6.t0 = parseInt(result);
|
|
1452
1476
|
|
|
1453
|
-
if (
|
|
1454
|
-
|
|
1477
|
+
if (_context6.t0) {
|
|
1478
|
+
_context6.next = 8;
|
|
1455
1479
|
break;
|
|
1456
1480
|
}
|
|
1457
1481
|
|
|
1458
|
-
|
|
1482
|
+
_context6.next = 7;
|
|
1459
1483
|
return provider.getBlockNumber();
|
|
1460
1484
|
|
|
1461
1485
|
case 7:
|
|
1462
|
-
|
|
1486
|
+
_context6.t0 = _context6.sent;
|
|
1463
1487
|
|
|
1464
1488
|
case 8:
|
|
1465
|
-
return
|
|
1489
|
+
return _context6.abrupt("return", _context6.t0);
|
|
1466
1490
|
|
|
1467
1491
|
case 9:
|
|
1468
1492
|
case "end":
|
|
1469
|
-
return
|
|
1493
|
+
return _context6.stop();
|
|
1470
1494
|
}
|
|
1471
1495
|
}
|
|
1472
|
-
},
|
|
1496
|
+
}, _callee6);
|
|
1473
1497
|
}));
|
|
1474
1498
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1475
1499
|
}
|
|
@@ -1763,21 +1787,23 @@ var dummyUserMarketDetails = {
|
|
|
1763
1787
|
};
|
|
1764
1788
|
var referralRewardDummy1 = {
|
|
1765
1789
|
campaign: 'testa',
|
|
1766
|
-
startTime:
|
|
1767
|
-
endTime:
|
|
1790
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1791
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 9, 30).getTime() / 1000),
|
|
1768
1792
|
isReferrer: false,
|
|
1769
1793
|
rewardTokenAmount: dummyTokenAmount,
|
|
1770
1794
|
transactionHash: null,
|
|
1771
|
-
userAddr: '0x...123'
|
|
1795
|
+
userAddr: '0x...123',
|
|
1796
|
+
refereeAddress: '0x123..123'
|
|
1772
1797
|
};
|
|
1773
1798
|
var referralRewardDummy2 = {
|
|
1774
1799
|
campaign: 'testb',
|
|
1775
|
-
startTime:
|
|
1776
|
-
endTime:
|
|
1800
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1801
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 31).getTime() / 1000),
|
|
1777
1802
|
isReferrer: true,
|
|
1778
1803
|
rewardTokenAmount: dummyTokenAmount2,
|
|
1779
1804
|
transactionHash: '0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b',
|
|
1780
|
-
userAddr: '0x...456'
|
|
1805
|
+
userAddr: '0x...456',
|
|
1806
|
+
refereeAddress: '0x123..123'
|
|
1781
1807
|
};
|
|
1782
1808
|
|
|
1783
1809
|
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
@@ -2597,6 +2623,7 @@ var helpers = {
|
|
|
2597
2623
|
decimalFactor: decimalFactor,
|
|
2598
2624
|
isSameAddress: isSameAddress,
|
|
2599
2625
|
getCurrentTimestamp: getCurrentTimestamp,
|
|
2626
|
+
sleep: sleep,
|
|
2600
2627
|
validateAndParseAddress: validateAndParseAddress,
|
|
2601
2628
|
getDecimal: getDecimal,
|
|
2602
2629
|
getSymbol: getSymbol,
|
|
@@ -4838,16 +4865,48 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4838
4865
|
var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(txHash) {
|
|
4839
4866
|
var _this3 = this;
|
|
4840
4867
|
|
|
4841
|
-
var tx, filter, betMadeEvents;
|
|
4868
|
+
var tx, i, filter, betMadeEvents;
|
|
4842
4869
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4843
4870
|
while (1) {
|
|
4844
4871
|
switch (_context5.prev = _context5.next) {
|
|
4845
4872
|
case 0:
|
|
4846
4873
|
_context5.next = 2;
|
|
4847
|
-
return this._networkConnection.provider.
|
|
4874
|
+
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4848
4875
|
|
|
4849
4876
|
case 2:
|
|
4850
4877
|
tx = _context5.sent;
|
|
4878
|
+
i = 0;
|
|
4879
|
+
|
|
4880
|
+
case 4:
|
|
4881
|
+
if (!(i < 100 && !tx)) {
|
|
4882
|
+
_context5.next = 13;
|
|
4883
|
+
break;
|
|
4884
|
+
}
|
|
4885
|
+
|
|
4886
|
+
_context5.next = 7;
|
|
4887
|
+
return sleep(1000);
|
|
4888
|
+
|
|
4889
|
+
case 7:
|
|
4890
|
+
_context5.next = 9;
|
|
4891
|
+
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4892
|
+
|
|
4893
|
+
case 9:
|
|
4894
|
+
tx = _context5.sent;
|
|
4895
|
+
|
|
4896
|
+
case 10:
|
|
4897
|
+
i++;
|
|
4898
|
+
_context5.next = 4;
|
|
4899
|
+
break;
|
|
4900
|
+
|
|
4901
|
+
case 13:
|
|
4902
|
+
if (tx) {
|
|
4903
|
+
_context5.next = 15;
|
|
4904
|
+
break;
|
|
4905
|
+
}
|
|
4906
|
+
|
|
4907
|
+
throw new Error("Transaction " + txHash + " takes too long to be mined");
|
|
4908
|
+
|
|
4909
|
+
case 15:
|
|
4851
4910
|
filter = this.env.plygame.filters.BetMade();
|
|
4852
4911
|
betMadeEvents = tx.logs.filter(function (log) {
|
|
4853
4912
|
return isSameAddress(log.topics[0], filter.topics[0]);
|
|
@@ -4861,7 +4920,7 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4861
4920
|
return _this3.parseBetMakeEvent(e);
|
|
4862
4921
|
})));
|
|
4863
4922
|
|
|
4864
|
-
case
|
|
4923
|
+
case 18:
|
|
4865
4924
|
case "end":
|
|
4866
4925
|
return _context5.stop();
|
|
4867
4926
|
}
|
|
@@ -5218,12 +5277,14 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5218
5277
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5219
5278
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5220
5279
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5221
|
-
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null
|
|
5280
|
+
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null,
|
|
5281
|
+
refereeAddress: null
|
|
5222
5282
|
};
|
|
5223
5283
|
});
|
|
5284
|
+
items = [referralRewardDummy1, referralRewardDummy2].concat(items);
|
|
5224
5285
|
return _context5.abrupt("return", items);
|
|
5225
5286
|
|
|
5226
|
-
case
|
|
5287
|
+
case 6:
|
|
5227
5288
|
case "end":
|
|
5228
5289
|
return _context5.stop();
|
|
5229
5290
|
}
|
|
@@ -5266,7 +5327,8 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5266
5327
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5267
5328
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5268
5329
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5269
|
-
transactionHash: null
|
|
5330
|
+
transactionHash: null,
|
|
5331
|
+
refereeAddress: null
|
|
5270
5332
|
};
|
|
5271
5333
|
});
|
|
5272
5334
|
items.sort(function (a, b) {
|
|
@@ -5287,6 +5349,84 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5287
5349
|
}
|
|
5288
5350
|
|
|
5289
5351
|
return leaderboard;
|
|
5352
|
+
}()
|
|
5353
|
+
/**
|
|
5354
|
+
* current number of slots under a referral code being used that exceed minimum deposit amount
|
|
5355
|
+
*/
|
|
5356
|
+
;
|
|
5357
|
+
|
|
5358
|
+
_proto.slotsInUse =
|
|
5359
|
+
/*#__PURE__*/
|
|
5360
|
+
function () {
|
|
5361
|
+
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(referralCode) {
|
|
5362
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
5363
|
+
while (1) {
|
|
5364
|
+
switch (_context7.prev = _context7.next) {
|
|
5365
|
+
case 0:
|
|
5366
|
+
return _context7.abrupt("return", 123);
|
|
5367
|
+
|
|
5368
|
+
case 1:
|
|
5369
|
+
case "end":
|
|
5370
|
+
return _context7.stop();
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
}, _callee7);
|
|
5374
|
+
}));
|
|
5375
|
+
|
|
5376
|
+
function slotsInUse(_x7) {
|
|
5377
|
+
return _slotsInUse.apply(this, arguments);
|
|
5378
|
+
}
|
|
5379
|
+
|
|
5380
|
+
return slotsInUse;
|
|
5381
|
+
}();
|
|
5382
|
+
|
|
5383
|
+
_proto.totalReferralSlots = function totalReferralSlots() {
|
|
5384
|
+
return 500;
|
|
5385
|
+
}
|
|
5386
|
+
/**
|
|
5387
|
+
* a way to determine qualification status of a user. null if not referred yet,
|
|
5388
|
+
* qualified if referred + min deposit, notQualified if referred + min deposit
|
|
5389
|
+
* not reached or withdrew too early
|
|
5390
|
+
*/
|
|
5391
|
+
;
|
|
5392
|
+
|
|
5393
|
+
_proto.userReferralStatus =
|
|
5394
|
+
/*#__PURE__*/
|
|
5395
|
+
function () {
|
|
5396
|
+
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
|
|
5397
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5398
|
+
while (1) {
|
|
5399
|
+
switch (_context8.prev = _context8.next) {
|
|
5400
|
+
case 0:
|
|
5401
|
+
_context8.next = 2;
|
|
5402
|
+
return this.getReferralCodeUsed(userAddr);
|
|
5403
|
+
|
|
5404
|
+
case 2:
|
|
5405
|
+
_context8.t0 = _context8.sent;
|
|
5406
|
+
|
|
5407
|
+
if (!(_context8.t0 !== '')) {
|
|
5408
|
+
_context8.next = 7;
|
|
5409
|
+
break;
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
return _context8.abrupt("return", 'notQualified');
|
|
5413
|
+
|
|
5414
|
+
case 7:
|
|
5415
|
+
return _context8.abrupt("return", 'notReferred');
|
|
5416
|
+
|
|
5417
|
+
case 8:
|
|
5418
|
+
case "end":
|
|
5419
|
+
return _context8.stop();
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
}, _callee8, this);
|
|
5423
|
+
}));
|
|
5424
|
+
|
|
5425
|
+
function userReferralStatus(_x8) {
|
|
5426
|
+
return _userReferralStatus.apply(this, arguments);
|
|
5427
|
+
}
|
|
5428
|
+
|
|
5429
|
+
return userReferralStatus;
|
|
5290
5430
|
}();
|
|
5291
5431
|
|
|
5292
5432
|
return ReferralRead;
|
|
@@ -5308,21 +5448,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5308
5448
|
_proto2.registerNewReferralCode =
|
|
5309
5449
|
/*#__PURE__*/
|
|
5310
5450
|
function () {
|
|
5311
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5451
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
5312
5452
|
var referralCode;
|
|
5313
|
-
return runtime_1.wrap(function
|
|
5453
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
5314
5454
|
while (1) {
|
|
5315
|
-
switch (
|
|
5455
|
+
switch (_context9.prev = _context9.next) {
|
|
5316
5456
|
case 0:
|
|
5317
5457
|
referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5318
|
-
return
|
|
5458
|
+
return _context9.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5319
5459
|
|
|
5320
5460
|
case 2:
|
|
5321
5461
|
case "end":
|
|
5322
|
-
return
|
|
5462
|
+
return _context9.stop();
|
|
5323
5463
|
}
|
|
5324
5464
|
}
|
|
5325
|
-
},
|
|
5465
|
+
}, _callee9, this);
|
|
5326
5466
|
}));
|
|
5327
5467
|
|
|
5328
5468
|
function registerNewReferralCode() {
|
|
@@ -5339,24 +5479,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5339
5479
|
_proto2.useReferralCode =
|
|
5340
5480
|
/*#__PURE__*/
|
|
5341
5481
|
function () {
|
|
5342
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5482
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(code) {
|
|
5343
5483
|
var referralCode;
|
|
5344
|
-
return runtime_1.wrap(function
|
|
5484
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
5345
5485
|
while (1) {
|
|
5346
|
-
switch (
|
|
5486
|
+
switch (_context10.prev = _context10.next) {
|
|
5347
5487
|
case 0:
|
|
5348
5488
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
5349
|
-
return
|
|
5489
|
+
return _context10.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5350
5490
|
|
|
5351
5491
|
case 2:
|
|
5352
5492
|
case "end":
|
|
5353
|
-
return
|
|
5493
|
+
return _context10.stop();
|
|
5354
5494
|
}
|
|
5355
5495
|
}
|
|
5356
|
-
},
|
|
5496
|
+
}, _callee10, this);
|
|
5357
5497
|
}));
|
|
5358
5498
|
|
|
5359
|
-
function useReferralCode(
|
|
5499
|
+
function useReferralCode(_x9) {
|
|
5360
5500
|
return _useReferralCode.apply(this, arguments);
|
|
5361
5501
|
}
|
|
5362
5502
|
|
|
@@ -5370,23 +5510,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5370
5510
|
_proto2.claimReferralRewards =
|
|
5371
5511
|
/*#__PURE__*/
|
|
5372
5512
|
function () {
|
|
5373
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5513
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
|
|
5374
5514
|
var unclaimedRewards, campaigns, tokens;
|
|
5375
|
-
return runtime_1.wrap(function
|
|
5515
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5376
5516
|
while (1) {
|
|
5377
|
-
switch (
|
|
5517
|
+
switch (_context11.prev = _context11.next) {
|
|
5378
5518
|
case 0:
|
|
5379
|
-
|
|
5380
|
-
|
|
5519
|
+
_context11.t0 = this;
|
|
5520
|
+
_context11.next = 3;
|
|
5381
5521
|
return this._networkConnection.signer.getAddress();
|
|
5382
5522
|
|
|
5383
5523
|
case 3:
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
return
|
|
5524
|
+
_context11.t1 = _context11.sent;
|
|
5525
|
+
_context11.next = 6;
|
|
5526
|
+
return _context11.t0.referralRewards.call(_context11.t0, _context11.t1);
|
|
5387
5527
|
|
|
5388
5528
|
case 6:
|
|
5389
|
-
unclaimedRewards =
|
|
5529
|
+
unclaimedRewards = _context11.sent.filter(function (reward) {
|
|
5390
5530
|
return reward.transactionHash == null;
|
|
5391
5531
|
});
|
|
5392
5532
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5395,14 +5535,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5395
5535
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5396
5536
|
return reward.rewardTokenAmount.token.address;
|
|
5397
5537
|
});
|
|
5398
|
-
return
|
|
5538
|
+
return _context11.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5399
5539
|
|
|
5400
5540
|
case 10:
|
|
5401
5541
|
case "end":
|
|
5402
|
-
return
|
|
5542
|
+
return _context11.stop();
|
|
5403
5543
|
}
|
|
5404
5544
|
}
|
|
5405
|
-
},
|
|
5545
|
+
}, _callee11, this);
|
|
5406
5546
|
}));
|
|
5407
5547
|
|
|
5408
5548
|
function claimReferralRewards() {
|
|
@@ -5810,5 +5950,5 @@ BigNumber.config({
|
|
|
5810
5950
|
DECIMAL_PLACES: 50
|
|
5811
5951
|
});
|
|
5812
5952
|
|
|
5813
|
-
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, 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, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, 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, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5953
|
+
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, 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, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, 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, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5814
5954
|
//# sourceMappingURL=sdk.esm.js.map
|