@aurigami/sdk 1.12.0-beta1 → 1.12.0-beta2
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 +8 -0
- package/dist/interactors/PlyGame.d.ts +0 -5
- package/dist/interactors/Referral.d.ts +11 -0
- package/dist/sdk.cjs.development.js +315 -205
- 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 +314 -206
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/package.json +3 -3
- package/src/consts/constants.ts +1 -1
- package/src/consts/dummy.ts +6 -4
- package/src/helpers/helpers.ts +21 -0
- package/src/interactors/PlyGame.ts +22 -17
- package/src/interactors/Referral.ts +34 -2
- package/src/types/index.ts +4 -2
- package/src/a.ts.log +0 -29
package/dist/sdk.esm.js
CHANGED
|
@@ -111,7 +111,7 @@ var networkAddresses = {
|
|
|
111
111
|
PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
|
|
112
112
|
REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
|
|
113
113
|
AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
|
|
114
|
-
PLYGAME: /*#__PURE__*/
|
|
114
|
+
PLYGAME: /*#__PURE__*/MAINNET_ADDRESSES.plyGame.toLowerCase()
|
|
115
115
|
},
|
|
116
116
|
tokens: {
|
|
117
117
|
AURORA: /*#__PURE__*/'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
|
|
@@ -1208,6 +1208,30 @@ var isSameAddress = function isSameAddress(address1, address2) {
|
|
|
1208
1208
|
var getCurrentTimestamp = function getCurrentTimestamp() {
|
|
1209
1209
|
return Math.trunc(Date.now() / 1000);
|
|
1210
1210
|
};
|
|
1211
|
+
function sleep(_x) {
|
|
1212
|
+
return _sleep.apply(this, arguments);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
function _sleep() {
|
|
1216
|
+
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(duration) {
|
|
1217
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1218
|
+
while (1) {
|
|
1219
|
+
switch (_context.prev = _context.next) {
|
|
1220
|
+
case 0:
|
|
1221
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
1222
|
+
setTimeout(resolve, duration);
|
|
1223
|
+
}));
|
|
1224
|
+
|
|
1225
|
+
case 1:
|
|
1226
|
+
case "end":
|
|
1227
|
+
return _context.stop();
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}, _callee);
|
|
1231
|
+
}));
|
|
1232
|
+
return _sleep.apply(this, arguments);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1211
1235
|
function validateAndParseAddress(address) {
|
|
1212
1236
|
try {
|
|
1213
1237
|
return utils.getAddress(address);
|
|
@@ -1249,35 +1273,35 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1249
1273
|
|
|
1250
1274
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1251
1275
|
}
|
|
1252
|
-
function getBlockTimestamp(
|
|
1276
|
+
function getBlockTimestamp(_x2, _x3) {
|
|
1253
1277
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1254
1278
|
}
|
|
1255
1279
|
|
|
1256
1280
|
function _getBlockTimestamp() {
|
|
1257
|
-
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1281
|
+
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, blockNumber) {
|
|
1258
1282
|
var block;
|
|
1259
|
-
return runtime_1.wrap(function
|
|
1283
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1260
1284
|
while (1) {
|
|
1261
|
-
switch (
|
|
1285
|
+
switch (_context2.prev = _context2.next) {
|
|
1262
1286
|
case 0:
|
|
1263
|
-
|
|
1287
|
+
_context2.next = 2;
|
|
1264
1288
|
return provider.getBlock(blockNumber);
|
|
1265
1289
|
|
|
1266
1290
|
case 2:
|
|
1267
|
-
block =
|
|
1268
|
-
return
|
|
1291
|
+
block = _context2.sent;
|
|
1292
|
+
return _context2.abrupt("return", block.timestamp);
|
|
1269
1293
|
|
|
1270
1294
|
case 4:
|
|
1271
1295
|
case "end":
|
|
1272
|
-
return
|
|
1296
|
+
return _context2.stop();
|
|
1273
1297
|
}
|
|
1274
1298
|
}
|
|
1275
|
-
},
|
|
1299
|
+
}, _callee2);
|
|
1276
1300
|
}));
|
|
1277
1301
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1278
1302
|
}
|
|
1279
1303
|
|
|
1280
|
-
function getBlocksTimestampViaRPC(
|
|
1304
|
+
function getBlocksTimestampViaRPC(_x4, _x5) {
|
|
1281
1305
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1282
1306
|
}
|
|
1283
1307
|
/**
|
|
@@ -1287,11 +1311,11 @@ function getBlocksTimestampViaRPC(_x3, _x4) {
|
|
|
1287
1311
|
*/
|
|
1288
1312
|
|
|
1289
1313
|
function _getBlocksTimestampViaRPC() {
|
|
1290
|
-
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1314
|
+
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blocksNumber) {
|
|
1291
1315
|
var CHUNK_SIZE, results, i, slice, promises;
|
|
1292
|
-
return runtime_1.wrap(function
|
|
1316
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1293
1317
|
while (1) {
|
|
1294
|
-
switch (
|
|
1318
|
+
switch (_context4.prev = _context4.next) {
|
|
1295
1319
|
case 0:
|
|
1296
1320
|
// Promise all 200 blocks at a time, using too many blocks at once will cause the RPC call timeout.
|
|
1297
1321
|
CHUNK_SIZE = 200;
|
|
@@ -1300,58 +1324,58 @@ function _getBlocksTimestampViaRPC() {
|
|
|
1300
1324
|
|
|
1301
1325
|
case 3:
|
|
1302
1326
|
if (!(i < blocksNumber.length)) {
|
|
1303
|
-
|
|
1327
|
+
_context4.next = 14;
|
|
1304
1328
|
break;
|
|
1305
1329
|
}
|
|
1306
1330
|
|
|
1307
1331
|
slice = blocksNumber.slice(i, i + CHUNK_SIZE);
|
|
1308
1332
|
promises = slice.map( /*#__PURE__*/function () {
|
|
1309
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1310
|
-
return runtime_1.wrap(function
|
|
1333
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(blockNumber) {
|
|
1334
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1311
1335
|
while (1) {
|
|
1312
|
-
switch (
|
|
1336
|
+
switch (_context3.prev = _context3.next) {
|
|
1313
1337
|
case 0:
|
|
1314
|
-
return
|
|
1338
|
+
return _context3.abrupt("return", getBlockTimestamp(provider, blockNumber));
|
|
1315
1339
|
|
|
1316
1340
|
case 1:
|
|
1317
1341
|
case "end":
|
|
1318
|
-
return
|
|
1342
|
+
return _context3.stop();
|
|
1319
1343
|
}
|
|
1320
1344
|
}
|
|
1321
|
-
},
|
|
1345
|
+
}, _callee3);
|
|
1322
1346
|
}));
|
|
1323
1347
|
|
|
1324
|
-
return function (
|
|
1348
|
+
return function (_x10) {
|
|
1325
1349
|
return _ref.apply(this, arguments);
|
|
1326
1350
|
};
|
|
1327
1351
|
}());
|
|
1328
|
-
|
|
1329
|
-
|
|
1352
|
+
_context4.t0 = results;
|
|
1353
|
+
_context4.next = 9;
|
|
1330
1354
|
return Promise.all(promises);
|
|
1331
1355
|
|
|
1332
1356
|
case 9:
|
|
1333
|
-
|
|
1334
|
-
results =
|
|
1357
|
+
_context4.t1 = _context4.sent;
|
|
1358
|
+
results = _context4.t0.concat.call(_context4.t0, _context4.t1);
|
|
1335
1359
|
|
|
1336
1360
|
case 11:
|
|
1337
1361
|
i += CHUNK_SIZE;
|
|
1338
|
-
|
|
1362
|
+
_context4.next = 3;
|
|
1339
1363
|
break;
|
|
1340
1364
|
|
|
1341
1365
|
case 14:
|
|
1342
|
-
return
|
|
1366
|
+
return _context4.abrupt("return", results);
|
|
1343
1367
|
|
|
1344
1368
|
case 15:
|
|
1345
1369
|
case "end":
|
|
1346
|
-
return
|
|
1370
|
+
return _context4.stop();
|
|
1347
1371
|
}
|
|
1348
1372
|
}
|
|
1349
|
-
},
|
|
1373
|
+
}, _callee4);
|
|
1350
1374
|
}));
|
|
1351
1375
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1352
1376
|
}
|
|
1353
1377
|
|
|
1354
|
-
function getBlocksTimestamp(
|
|
1378
|
+
function getBlocksTimestamp(_x6, _x7) {
|
|
1355
1379
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1356
1380
|
}
|
|
1357
1381
|
/**
|
|
@@ -1364,18 +1388,18 @@ function getBlocksTimestamp(_x5, _x6) {
|
|
|
1364
1388
|
*/
|
|
1365
1389
|
|
|
1366
1390
|
function _getBlocksTimestamp() {
|
|
1367
|
-
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1391
|
+
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, blockNumbers) {
|
|
1368
1392
|
var CHUNK_SIZE, promises, lines, i, query, results, missingBlocks, missingBlocksTimestamps;
|
|
1369
|
-
return runtime_1.wrap(function
|
|
1393
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1370
1394
|
while (1) {
|
|
1371
|
-
switch (
|
|
1395
|
+
switch (_context5.prev = _context5.next) {
|
|
1372
1396
|
case 0:
|
|
1373
1397
|
if (!(blockNumbers.length == 0)) {
|
|
1374
|
-
|
|
1398
|
+
_context5.next = 2;
|
|
1375
1399
|
break;
|
|
1376
1400
|
}
|
|
1377
1401
|
|
|
1378
|
-
return
|
|
1402
|
+
return _context5.abrupt("return", []);
|
|
1379
1403
|
|
|
1380
1404
|
case 2:
|
|
1381
1405
|
CHUNK_SIZE = 100; // graphql query limit
|
|
@@ -1391,11 +1415,11 @@ function _getBlocksTimestamp() {
|
|
|
1391
1415
|
} // merge all the json objects
|
|
1392
1416
|
|
|
1393
1417
|
|
|
1394
|
-
|
|
1418
|
+
_context5.next = 8;
|
|
1395
1419
|
return Promise.all(promises);
|
|
1396
1420
|
|
|
1397
1421
|
case 8:
|
|
1398
|
-
results =
|
|
1422
|
+
results = _context5.sent.reduce(function (acc, cur) {
|
|
1399
1423
|
return _extends({}, acc, cur);
|
|
1400
1424
|
});
|
|
1401
1425
|
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
@@ -1406,71 +1430,71 @@ function _getBlocksTimestamp() {
|
|
|
1406
1430
|
devLog("These blocks are missing from Aurora GraphQL endpoint: " + missingBlocks.join(', '));
|
|
1407
1431
|
}
|
|
1408
1432
|
|
|
1409
|
-
|
|
1433
|
+
_context5.next = 13;
|
|
1410
1434
|
return getBlocksTimestampViaRPC(provider, missingBlocks);
|
|
1411
1435
|
|
|
1412
1436
|
case 13:
|
|
1413
|
-
missingBlocksTimestamps =
|
|
1437
|
+
missingBlocksTimestamps = _context5.sent;
|
|
1414
1438
|
missingBlocksTimestamps.forEach(function (timestamp, index) {
|
|
1415
1439
|
results["b" + missingBlocks[index]] = {
|
|
1416
1440
|
timestamp: new Date(timestamp * 1000).toISOString()
|
|
1417
1441
|
};
|
|
1418
1442
|
});
|
|
1419
|
-
return
|
|
1443
|
+
return _context5.abrupt("return", blockNumbers.map(function (blockNumber) {
|
|
1420
1444
|
return Math.trunc(new Date(results["b" + blockNumber].timestamp).getTime() / 1000);
|
|
1421
1445
|
}));
|
|
1422
1446
|
|
|
1423
1447
|
case 16:
|
|
1424
1448
|
case "end":
|
|
1425
|
-
return
|
|
1449
|
+
return _context5.stop();
|
|
1426
1450
|
}
|
|
1427
1451
|
}
|
|
1428
|
-
},
|
|
1452
|
+
}, _callee5);
|
|
1429
1453
|
}));
|
|
1430
1454
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1431
1455
|
}
|
|
1432
1456
|
|
|
1433
|
-
function getBlockBeforeTimestamp(
|
|
1457
|
+
function getBlockBeforeTimestamp(_x8, _x9) {
|
|
1434
1458
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1435
1459
|
}
|
|
1436
1460
|
|
|
1437
1461
|
function _getBlockBeforeTimestamp() {
|
|
1438
|
-
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1462
|
+
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider, timestamp) {
|
|
1439
1463
|
var result;
|
|
1440
|
-
return runtime_1.wrap(function
|
|
1464
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1441
1465
|
while (1) {
|
|
1442
|
-
switch (
|
|
1466
|
+
switch (_context6.prev = _context6.next) {
|
|
1443
1467
|
case 0:
|
|
1444
|
-
|
|
1468
|
+
_context6.next = 2;
|
|
1445
1469
|
return getQuery('block', 'getblocknobytime', {
|
|
1446
1470
|
timestamp: timestamp,
|
|
1447
1471
|
closest: 'before'
|
|
1448
1472
|
});
|
|
1449
1473
|
|
|
1450
1474
|
case 2:
|
|
1451
|
-
result =
|
|
1452
|
-
|
|
1475
|
+
result = _context6.sent;
|
|
1476
|
+
_context6.t0 = parseInt(result);
|
|
1453
1477
|
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
1478
|
+
if (_context6.t0) {
|
|
1479
|
+
_context6.next = 8;
|
|
1456
1480
|
break;
|
|
1457
1481
|
}
|
|
1458
1482
|
|
|
1459
|
-
|
|
1483
|
+
_context6.next = 7;
|
|
1460
1484
|
return provider.getBlockNumber();
|
|
1461
1485
|
|
|
1462
1486
|
case 7:
|
|
1463
|
-
|
|
1487
|
+
_context6.t0 = _context6.sent;
|
|
1464
1488
|
|
|
1465
1489
|
case 8:
|
|
1466
|
-
return
|
|
1490
|
+
return _context6.abrupt("return", _context6.t0);
|
|
1467
1491
|
|
|
1468
1492
|
case 9:
|
|
1469
1493
|
case "end":
|
|
1470
|
-
return
|
|
1494
|
+
return _context6.stop();
|
|
1471
1495
|
}
|
|
1472
1496
|
}
|
|
1473
|
-
},
|
|
1497
|
+
}, _callee6);
|
|
1474
1498
|
}));
|
|
1475
1499
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1476
1500
|
}
|
|
@@ -1486,6 +1510,20 @@ function devLog(message) {
|
|
|
1486
1510
|
(_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
|
|
1487
1511
|
}
|
|
1488
1512
|
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Sorts (in place) an array of Events by blocknumber.
|
|
1515
|
+
* This method mutates the array and returns a reference to the same array.
|
|
1516
|
+
**/
|
|
1517
|
+
|
|
1518
|
+
function sortEvents(events) {
|
|
1519
|
+
return events.sort(function (a, b) {
|
|
1520
|
+
if (a.blockNumber == b.blockNumber) {
|
|
1521
|
+
return a.logIndex - b.logIndex;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
return a.blockNumber - b.blockNumber;
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1489
1527
|
|
|
1490
1528
|
var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
|
|
1491
1529
|
this._networkConnection = networkConnection;
|
|
@@ -1750,21 +1788,23 @@ var dummyUserMarketDetails = {
|
|
|
1750
1788
|
};
|
|
1751
1789
|
var referralRewardDummy1 = {
|
|
1752
1790
|
campaign: 'testa',
|
|
1753
|
-
startTime:
|
|
1754
|
-
endTime:
|
|
1791
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1792
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 9, 30).getTime() / 1000),
|
|
1755
1793
|
isReferrer: false,
|
|
1756
1794
|
rewardTokenAmount: dummyTokenAmount,
|
|
1757
1795
|
transactionHash: null,
|
|
1758
|
-
userAddr: '0x...123'
|
|
1796
|
+
userAddr: '0x...123',
|
|
1797
|
+
refereeAddress: '0x123..123'
|
|
1759
1798
|
};
|
|
1760
1799
|
var referralRewardDummy2 = {
|
|
1761
1800
|
campaign: 'testb',
|
|
1762
|
-
startTime:
|
|
1763
|
-
endTime:
|
|
1801
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1802
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 31).getTime() / 1000),
|
|
1764
1803
|
isReferrer: true,
|
|
1765
1804
|
rewardTokenAmount: dummyTokenAmount2,
|
|
1766
1805
|
transactionHash: '0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b',
|
|
1767
|
-
userAddr: '0x...456'
|
|
1806
|
+
userAddr: '0x...456',
|
|
1807
|
+
refereeAddress: '0x123..123'
|
|
1768
1808
|
};
|
|
1769
1809
|
|
|
1770
1810
|
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
@@ -2584,6 +2624,7 @@ var helpers = {
|
|
|
2584
2624
|
decimalFactor: decimalFactor,
|
|
2585
2625
|
isSameAddress: isSameAddress,
|
|
2586
2626
|
getCurrentTimestamp: getCurrentTimestamp,
|
|
2627
|
+
sleep: sleep,
|
|
2587
2628
|
validateAndParseAddress: validateAndParseAddress,
|
|
2588
2629
|
getDecimal: getDecimal,
|
|
2589
2630
|
getSymbol: getSymbol,
|
|
@@ -2594,6 +2635,7 @@ var helpers = {
|
|
|
2594
2635
|
getBlocksTimestamp: getBlocksTimestamp,
|
|
2595
2636
|
getBlockBeforeTimestamp: getBlockBeforeTimestamp,
|
|
2596
2637
|
devLog: devLog,
|
|
2638
|
+
sortEvents: sortEvents,
|
|
2597
2639
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
2598
2640
|
fetchPriceFromCoingecko: fetchPriceFromCoingecko,
|
|
2599
2641
|
fetchLPPositions: fetchLPPositions,
|
|
@@ -4648,11 +4690,14 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4648
4690
|
|
|
4649
4691
|
_proto.parseBetMakeEvent = function parseBetMakeEvent(event) {
|
|
4650
4692
|
var outcome = ['bigWin', 'win', 'lose', 'noImpact'][event.args.outcome];
|
|
4651
|
-
var
|
|
4652
|
-
|
|
4693
|
+
var betAmount = event.args.amount; // 0%, 0%, 100%, 2%
|
|
4694
|
+
// big win, win, lose, no impact
|
|
4695
|
+
|
|
4696
|
+
var lostAmount = betAmount.mul([0, 0, 100, 2][event.args.outcome]).div(100);
|
|
4697
|
+
var unlock = betAmount.mul([10, 1, 0, 0][event.args.outcome]);
|
|
4653
4698
|
return {
|
|
4654
4699
|
player: event.args.player,
|
|
4655
|
-
|
|
4700
|
+
lostAmount: new TokenAmount(this.plyToken, lostAmount.toString()),
|
|
4656
4701
|
unlockedPulpAmount: new TokenAmount(this.pulpToken, unlock.toString()),
|
|
4657
4702
|
outcome: outcome,
|
|
4658
4703
|
transactionHash: event.transactionHash,
|
|
@@ -4732,11 +4777,13 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4732
4777
|
|
|
4733
4778
|
case 8:
|
|
4734
4779
|
events = _context2.sent;
|
|
4780
|
+
// Sort descending by block number
|
|
4781
|
+
sortEvents(events).reverse();
|
|
4735
4782
|
return _context2.abrupt("return", this.attachTimestamp(events.map(function (event) {
|
|
4736
4783
|
return _this2.parseBetMakeEvent(event);
|
|
4737
4784
|
})));
|
|
4738
4785
|
|
|
4739
|
-
case
|
|
4786
|
+
case 11:
|
|
4740
4787
|
case "end":
|
|
4741
4788
|
return _context2.stop();
|
|
4742
4789
|
}
|
|
@@ -4786,49 +4833,26 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4786
4833
|
return currentJackpotAmount;
|
|
4787
4834
|
}();
|
|
4788
4835
|
|
|
4789
|
-
_proto.nextJackpotRevealTime = /*#__PURE__*/function () {
|
|
4790
|
-
var _nextJackpotRevealTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
4791
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
4792
|
-
while (1) {
|
|
4793
|
-
switch (_context4.prev = _context4.next) {
|
|
4794
|
-
case 0:
|
|
4795
|
-
return _context4.abrupt("return", 0);
|
|
4796
|
-
|
|
4797
|
-
case 1:
|
|
4798
|
-
case "end":
|
|
4799
|
-
return _context4.stop();
|
|
4800
|
-
}
|
|
4801
|
-
}
|
|
4802
|
-
}, _callee4);
|
|
4803
|
-
}));
|
|
4804
|
-
|
|
4805
|
-
function nextJackpotRevealTime() {
|
|
4806
|
-
return _nextJackpotRevealTime.apply(this, arguments);
|
|
4807
|
-
}
|
|
4808
|
-
|
|
4809
|
-
return nextJackpotRevealTime;
|
|
4810
|
-
}();
|
|
4811
|
-
|
|
4812
4836
|
_proto.earlyUnlockedPulpAmount = /*#__PURE__*/function () {
|
|
4813
|
-
var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4837
|
+
var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(user) {
|
|
4814
4838
|
var earlyUnlockedPulpAmount;
|
|
4815
|
-
return runtime_1.wrap(function
|
|
4839
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
4816
4840
|
while (1) {
|
|
4817
|
-
switch (
|
|
4841
|
+
switch (_context4.prev = _context4.next) {
|
|
4818
4842
|
case 0:
|
|
4819
|
-
|
|
4843
|
+
_context4.next = 2;
|
|
4820
4844
|
return this.env.plygame.totalPlyUnlockedEarly(user);
|
|
4821
4845
|
|
|
4822
4846
|
case 2:
|
|
4823
|
-
earlyUnlockedPulpAmount =
|
|
4824
|
-
return
|
|
4847
|
+
earlyUnlockedPulpAmount = _context4.sent;
|
|
4848
|
+
return _context4.abrupt("return", new TokenAmount(this.pulpToken, earlyUnlockedPulpAmount.toString()));
|
|
4825
4849
|
|
|
4826
4850
|
case 4:
|
|
4827
4851
|
case "end":
|
|
4828
|
-
return
|
|
4852
|
+
return _context4.stop();
|
|
4829
4853
|
}
|
|
4830
4854
|
}
|
|
4831
|
-
},
|
|
4855
|
+
}, _callee4, this);
|
|
4832
4856
|
}));
|
|
4833
4857
|
|
|
4834
4858
|
function earlyUnlockedPulpAmount(_x3) {
|
|
@@ -4839,19 +4863,51 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4839
4863
|
}();
|
|
4840
4864
|
|
|
4841
4865
|
_proto.getPlyGameResultsInTransaction = /*#__PURE__*/function () {
|
|
4842
|
-
var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4866
|
+
var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(txHash) {
|
|
4843
4867
|
var _this3 = this;
|
|
4844
4868
|
|
|
4845
|
-
var tx, filter, betMadeEvents;
|
|
4846
|
-
return runtime_1.wrap(function
|
|
4869
|
+
var tx, i, filter, betMadeEvents;
|
|
4870
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4847
4871
|
while (1) {
|
|
4848
|
-
switch (
|
|
4872
|
+
switch (_context5.prev = _context5.next) {
|
|
4849
4873
|
case 0:
|
|
4850
|
-
|
|
4874
|
+
_context5.next = 2;
|
|
4851
4875
|
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4852
4876
|
|
|
4853
4877
|
case 2:
|
|
4854
|
-
tx =
|
|
4878
|
+
tx = _context5.sent;
|
|
4879
|
+
i = 0;
|
|
4880
|
+
|
|
4881
|
+
case 4:
|
|
4882
|
+
if (!(i < 100 && !tx)) {
|
|
4883
|
+
_context5.next = 13;
|
|
4884
|
+
break;
|
|
4885
|
+
}
|
|
4886
|
+
|
|
4887
|
+
_context5.next = 7;
|
|
4888
|
+
return sleep(1000);
|
|
4889
|
+
|
|
4890
|
+
case 7:
|
|
4891
|
+
_context5.next = 9;
|
|
4892
|
+
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4893
|
+
|
|
4894
|
+
case 9:
|
|
4895
|
+
tx = _context5.sent;
|
|
4896
|
+
|
|
4897
|
+
case 10:
|
|
4898
|
+
i++;
|
|
4899
|
+
_context5.next = 4;
|
|
4900
|
+
break;
|
|
4901
|
+
|
|
4902
|
+
case 13:
|
|
4903
|
+
if (tx) {
|
|
4904
|
+
_context5.next = 15;
|
|
4905
|
+
break;
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4908
|
+
throw new Error("Transaction " + txHash + " takes too long to be mined");
|
|
4909
|
+
|
|
4910
|
+
case 15:
|
|
4855
4911
|
filter = this.env.plygame.filters.BetMade();
|
|
4856
4912
|
betMadeEvents = tx.logs.filter(function (log) {
|
|
4857
4913
|
return isSameAddress(log.topics[0], filter.topics[0]);
|
|
@@ -4861,16 +4917,16 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4861
4917
|
transactionHash: txHash
|
|
4862
4918
|
});
|
|
4863
4919
|
});
|
|
4864
|
-
return
|
|
4920
|
+
return _context5.abrupt("return", this.attachTimestamp(betMadeEvents.map(function (e) {
|
|
4865
4921
|
return _this3.parseBetMakeEvent(e);
|
|
4866
4922
|
})));
|
|
4867
4923
|
|
|
4868
|
-
case
|
|
4924
|
+
case 18:
|
|
4869
4925
|
case "end":
|
|
4870
|
-
return
|
|
4926
|
+
return _context5.stop();
|
|
4871
4927
|
}
|
|
4872
4928
|
}
|
|
4873
|
-
},
|
|
4929
|
+
}, _callee5, this);
|
|
4874
4930
|
}));
|
|
4875
4931
|
|
|
4876
4932
|
function getPlyGameResultsInTransaction(_x4) {
|
|
@@ -4887,20 +4943,20 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4887
4943
|
_proto.leaderboard =
|
|
4888
4944
|
/*#__PURE__*/
|
|
4889
4945
|
function () {
|
|
4890
|
-
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4946
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
4891
4947
|
var _this4 = this;
|
|
4892
4948
|
|
|
4893
4949
|
var result;
|
|
4894
|
-
return runtime_1.wrap(function
|
|
4950
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4895
4951
|
while (1) {
|
|
4896
|
-
switch (
|
|
4952
|
+
switch (_context6.prev = _context6.next) {
|
|
4897
4953
|
case 0:
|
|
4898
|
-
|
|
4954
|
+
_context6.next = 2;
|
|
4899
4955
|
return getPaginatedApi('/plygame/leaderboard');
|
|
4900
4956
|
|
|
4901
4957
|
case 2:
|
|
4902
|
-
result =
|
|
4903
|
-
return
|
|
4958
|
+
result = _context6.sent;
|
|
4959
|
+
return _context6.abrupt("return", result.items.map(function (item, i) {
|
|
4904
4960
|
return {
|
|
4905
4961
|
player: item.user,
|
|
4906
4962
|
unlockedPulpAmount: new TokenAmount(_this4.pulpToken, item.unlockedAmount),
|
|
@@ -4910,10 +4966,10 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4910
4966
|
|
|
4911
4967
|
case 4:
|
|
4912
4968
|
case "end":
|
|
4913
|
-
return
|
|
4969
|
+
return _context6.stop();
|
|
4914
4970
|
}
|
|
4915
4971
|
}
|
|
4916
|
-
},
|
|
4972
|
+
}, _callee6);
|
|
4917
4973
|
}));
|
|
4918
4974
|
|
|
4919
4975
|
function leaderboard() {
|
|
@@ -4934,57 +4990,28 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4934
4990
|
|
|
4935
4991
|
var _proto2 = PlyGameReadWrite.prototype;
|
|
4936
4992
|
|
|
4937
|
-
/**
|
|
4938
|
-
* makes "times" independent bets, but consecutively, of the same amount
|
|
4939
|
-
*/
|
|
4940
|
-
_proto2.makeBetMultiple =
|
|
4941
|
-
/*#__PURE__*/
|
|
4942
|
-
function () {
|
|
4943
|
-
var _makeBetMultiple = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount, times) {
|
|
4944
|
-
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4945
|
-
while (1) {
|
|
4946
|
-
switch (_context8.prev = _context8.next) {
|
|
4947
|
-
case 0:
|
|
4948
|
-
return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetMultiple(amount.rawAmount(), times));
|
|
4949
|
-
|
|
4950
|
-
case 1:
|
|
4951
|
-
case "end":
|
|
4952
|
-
return _context8.stop();
|
|
4953
|
-
}
|
|
4954
|
-
}
|
|
4955
|
-
}, _callee8, this);
|
|
4956
|
-
}));
|
|
4957
|
-
|
|
4958
|
-
function makeBetMultiple(_x5, _x6) {
|
|
4959
|
-
return _makeBetMultiple.apply(this, arguments);
|
|
4960
|
-
}
|
|
4961
|
-
|
|
4962
|
-
return makeBetMultiple;
|
|
4963
|
-
}()
|
|
4964
4993
|
/**
|
|
4965
4994
|
* Make a single bet
|
|
4966
4995
|
*/
|
|
4967
|
-
;
|
|
4968
|
-
|
|
4969
4996
|
_proto2.makeBetOnce =
|
|
4970
4997
|
/*#__PURE__*/
|
|
4971
4998
|
function () {
|
|
4972
|
-
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4973
|
-
return runtime_1.wrap(function
|
|
4999
|
+
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
|
|
5000
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4974
5001
|
while (1) {
|
|
4975
|
-
switch (
|
|
5002
|
+
switch (_context7.prev = _context7.next) {
|
|
4976
5003
|
case 0:
|
|
4977
|
-
return
|
|
5004
|
+
return _context7.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
|
|
4978
5005
|
|
|
4979
5006
|
case 1:
|
|
4980
5007
|
case "end":
|
|
4981
|
-
return
|
|
5008
|
+
return _context7.stop();
|
|
4982
5009
|
}
|
|
4983
5010
|
}
|
|
4984
|
-
},
|
|
5011
|
+
}, _callee7, this);
|
|
4985
5012
|
}));
|
|
4986
5013
|
|
|
4987
|
-
function makeBetOnce(
|
|
5014
|
+
function makeBetOnce(_x5) {
|
|
4988
5015
|
return _makeBetOnce.apply(this, arguments);
|
|
4989
5016
|
}
|
|
4990
5017
|
|
|
@@ -4992,22 +5019,22 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4992
5019
|
}();
|
|
4993
5020
|
|
|
4994
5021
|
_proto2.approve = /*#__PURE__*/function () {
|
|
4995
|
-
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4996
|
-
return runtime_1.wrap(function
|
|
5022
|
+
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
5023
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4997
5024
|
while (1) {
|
|
4998
|
-
switch (
|
|
5025
|
+
switch (_context8.prev = _context8.next) {
|
|
4999
5026
|
case 0:
|
|
5000
|
-
return
|
|
5027
|
+
return _context8.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
|
|
5001
5028
|
|
|
5002
5029
|
case 1:
|
|
5003
5030
|
case "end":
|
|
5004
|
-
return
|
|
5031
|
+
return _context8.stop();
|
|
5005
5032
|
}
|
|
5006
5033
|
}
|
|
5007
|
-
},
|
|
5034
|
+
}, _callee8, this);
|
|
5008
5035
|
}));
|
|
5009
5036
|
|
|
5010
|
-
function approve(
|
|
5037
|
+
function approve(_x6) {
|
|
5011
5038
|
return _approve.apply(this, arguments);
|
|
5012
5039
|
}
|
|
5013
5040
|
|
|
@@ -5251,12 +5278,14 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5251
5278
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5252
5279
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5253
5280
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5254
|
-
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null
|
|
5281
|
+
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null,
|
|
5282
|
+
refereeAddress: null
|
|
5255
5283
|
};
|
|
5256
5284
|
});
|
|
5285
|
+
items = [referralRewardDummy1, referralRewardDummy2].concat(items);
|
|
5257
5286
|
return _context5.abrupt("return", items);
|
|
5258
5287
|
|
|
5259
|
-
case
|
|
5288
|
+
case 6:
|
|
5260
5289
|
case "end":
|
|
5261
5290
|
return _context5.stop();
|
|
5262
5291
|
}
|
|
@@ -5299,7 +5328,8 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5299
5328
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5300
5329
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5301
5330
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5302
|
-
transactionHash: null
|
|
5331
|
+
transactionHash: null,
|
|
5332
|
+
refereeAddress: null
|
|
5303
5333
|
};
|
|
5304
5334
|
});
|
|
5305
5335
|
items.sort(function (a, b) {
|
|
@@ -5320,33 +5350,111 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5320
5350
|
}
|
|
5321
5351
|
|
|
5322
5352
|
return leaderboard;
|
|
5353
|
+
}()
|
|
5354
|
+
/**
|
|
5355
|
+
* current number of slots under a referral code being used that exceed minimum deposit amount
|
|
5356
|
+
*/
|
|
5357
|
+
;
|
|
5358
|
+
|
|
5359
|
+
_proto.slotsInUse =
|
|
5360
|
+
/*#__PURE__*/
|
|
5361
|
+
function () {
|
|
5362
|
+
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(referralCode) {
|
|
5363
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
5364
|
+
while (1) {
|
|
5365
|
+
switch (_context7.prev = _context7.next) {
|
|
5366
|
+
case 0:
|
|
5367
|
+
return _context7.abrupt("return", 123);
|
|
5368
|
+
|
|
5369
|
+
case 1:
|
|
5370
|
+
case "end":
|
|
5371
|
+
return _context7.stop();
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
}, _callee7);
|
|
5375
|
+
}));
|
|
5376
|
+
|
|
5377
|
+
function slotsInUse(_x7) {
|
|
5378
|
+
return _slotsInUse.apply(this, arguments);
|
|
5379
|
+
}
|
|
5380
|
+
|
|
5381
|
+
return slotsInUse;
|
|
5382
|
+
}();
|
|
5383
|
+
|
|
5384
|
+
_proto.totalReferralSlots = function totalReferralSlots() {
|
|
5385
|
+
return 500;
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* a way to determine qualification status of a user. null if not referred yet,
|
|
5389
|
+
* qualified if referred + min deposit, notQualified if referred + min deposit
|
|
5390
|
+
* not reached or withdrew too early
|
|
5391
|
+
*/
|
|
5392
|
+
;
|
|
5393
|
+
|
|
5394
|
+
_proto.userReferralStatus =
|
|
5395
|
+
/*#__PURE__*/
|
|
5396
|
+
function () {
|
|
5397
|
+
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
|
|
5398
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5399
|
+
while (1) {
|
|
5400
|
+
switch (_context8.prev = _context8.next) {
|
|
5401
|
+
case 0:
|
|
5402
|
+
_context8.next = 2;
|
|
5403
|
+
return this.getReferralCodeUsed(userAddr);
|
|
5404
|
+
|
|
5405
|
+
case 2:
|
|
5406
|
+
_context8.t0 = _context8.sent;
|
|
5407
|
+
|
|
5408
|
+
if (!(_context8.t0 !== '')) {
|
|
5409
|
+
_context8.next = 7;
|
|
5410
|
+
break;
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5413
|
+
return _context8.abrupt("return", 'notQualified');
|
|
5414
|
+
|
|
5415
|
+
case 7:
|
|
5416
|
+
return _context8.abrupt("return", 'notReferred');
|
|
5417
|
+
|
|
5418
|
+
case 8:
|
|
5419
|
+
case "end":
|
|
5420
|
+
return _context8.stop();
|
|
5421
|
+
}
|
|
5422
|
+
}
|
|
5423
|
+
}, _callee8, this);
|
|
5424
|
+
}));
|
|
5425
|
+
|
|
5426
|
+
function userReferralStatus(_x8) {
|
|
5427
|
+
return _userReferralStatus.apply(this, arguments);
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
return userReferralStatus;
|
|
5323
5431
|
}();
|
|
5324
5432
|
|
|
5325
5433
|
_proto.isWhitelistedAddress = /*#__PURE__*/function () {
|
|
5326
|
-
var _isWhitelistedAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5434
|
+
var _isWhitelistedAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(address) {
|
|
5327
5435
|
var result;
|
|
5328
|
-
return runtime_1.wrap(function
|
|
5436
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
5329
5437
|
while (1) {
|
|
5330
|
-
switch (
|
|
5438
|
+
switch (_context9.prev = _context9.next) {
|
|
5331
5439
|
case 0:
|
|
5332
|
-
|
|
5440
|
+
_context9.next = 2;
|
|
5333
5441
|
return getApi('/referral/whitelisted', {
|
|
5334
5442
|
address: address
|
|
5335
5443
|
});
|
|
5336
5444
|
|
|
5337
5445
|
case 2:
|
|
5338
|
-
result =
|
|
5339
|
-
return
|
|
5446
|
+
result = _context9.sent;
|
|
5447
|
+
return _context9.abrupt("return", result.isWhitelisted);
|
|
5340
5448
|
|
|
5341
5449
|
case 4:
|
|
5342
5450
|
case "end":
|
|
5343
|
-
return
|
|
5451
|
+
return _context9.stop();
|
|
5344
5452
|
}
|
|
5345
5453
|
}
|
|
5346
|
-
},
|
|
5454
|
+
}, _callee9);
|
|
5347
5455
|
}));
|
|
5348
5456
|
|
|
5349
|
-
function isWhitelistedAddress(
|
|
5457
|
+
function isWhitelistedAddress(_x9) {
|
|
5350
5458
|
return _isWhitelistedAddress.apply(this, arguments);
|
|
5351
5459
|
}
|
|
5352
5460
|
|
|
@@ -5354,28 +5462,28 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5354
5462
|
}();
|
|
5355
5463
|
|
|
5356
5464
|
_proto.isOnAuroraPlus = /*#__PURE__*/function () {
|
|
5357
|
-
var _isOnAuroraPlus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5465
|
+
var _isOnAuroraPlus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(address) {
|
|
5358
5466
|
var resp;
|
|
5359
|
-
return runtime_1.wrap(function
|
|
5467
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
5360
5468
|
while (1) {
|
|
5361
|
-
switch (
|
|
5469
|
+
switch (_context10.prev = _context10.next) {
|
|
5362
5470
|
case 0:
|
|
5363
|
-
|
|
5471
|
+
_context10.next = 2;
|
|
5364
5472
|
return axios.get(AURORA_PLUS_API_PREFIX + address);
|
|
5365
5473
|
|
|
5366
5474
|
case 2:
|
|
5367
|
-
resp =
|
|
5368
|
-
return
|
|
5475
|
+
resp = _context10.sent;
|
|
5476
|
+
return _context10.abrupt("return", resp.data.status == 'active');
|
|
5369
5477
|
|
|
5370
5478
|
case 4:
|
|
5371
5479
|
case "end":
|
|
5372
|
-
return
|
|
5480
|
+
return _context10.stop();
|
|
5373
5481
|
}
|
|
5374
5482
|
}
|
|
5375
|
-
},
|
|
5483
|
+
}, _callee10);
|
|
5376
5484
|
}));
|
|
5377
5485
|
|
|
5378
|
-
function isOnAuroraPlus(
|
|
5486
|
+
function isOnAuroraPlus(_x10) {
|
|
5379
5487
|
return _isOnAuroraPlus.apply(this, arguments);
|
|
5380
5488
|
}
|
|
5381
5489
|
|
|
@@ -5401,21 +5509,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5401
5509
|
_proto2.registerNewReferralCode =
|
|
5402
5510
|
/*#__PURE__*/
|
|
5403
5511
|
function () {
|
|
5404
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5512
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
|
|
5405
5513
|
var referralCode;
|
|
5406
|
-
return runtime_1.wrap(function
|
|
5514
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5407
5515
|
while (1) {
|
|
5408
|
-
switch (
|
|
5516
|
+
switch (_context11.prev = _context11.next) {
|
|
5409
5517
|
case 0:
|
|
5410
5518
|
referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5411
|
-
return
|
|
5519
|
+
return _context11.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5412
5520
|
|
|
5413
5521
|
case 2:
|
|
5414
5522
|
case "end":
|
|
5415
|
-
return
|
|
5523
|
+
return _context11.stop();
|
|
5416
5524
|
}
|
|
5417
5525
|
}
|
|
5418
|
-
},
|
|
5526
|
+
}, _callee11, this);
|
|
5419
5527
|
}));
|
|
5420
5528
|
|
|
5421
5529
|
function registerNewReferralCode() {
|
|
@@ -5432,24 +5540,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5432
5540
|
_proto2.useReferralCode =
|
|
5433
5541
|
/*#__PURE__*/
|
|
5434
5542
|
function () {
|
|
5435
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5543
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(code) {
|
|
5436
5544
|
var referralCode;
|
|
5437
|
-
return runtime_1.wrap(function
|
|
5545
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
5438
5546
|
while (1) {
|
|
5439
|
-
switch (
|
|
5547
|
+
switch (_context12.prev = _context12.next) {
|
|
5440
5548
|
case 0:
|
|
5441
5549
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
5442
|
-
return
|
|
5550
|
+
return _context12.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5443
5551
|
|
|
5444
5552
|
case 2:
|
|
5445
5553
|
case "end":
|
|
5446
|
-
return
|
|
5554
|
+
return _context12.stop();
|
|
5447
5555
|
}
|
|
5448
5556
|
}
|
|
5449
|
-
},
|
|
5557
|
+
}, _callee12, this);
|
|
5450
5558
|
}));
|
|
5451
5559
|
|
|
5452
|
-
function useReferralCode(
|
|
5560
|
+
function useReferralCode(_x11) {
|
|
5453
5561
|
return _useReferralCode.apply(this, arguments);
|
|
5454
5562
|
}
|
|
5455
5563
|
|
|
@@ -5463,23 +5571,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5463
5571
|
_proto2.claimReferralRewards =
|
|
5464
5572
|
/*#__PURE__*/
|
|
5465
5573
|
function () {
|
|
5466
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5574
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
|
|
5467
5575
|
var unclaimedRewards, campaigns, tokens;
|
|
5468
|
-
return runtime_1.wrap(function
|
|
5576
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
5469
5577
|
while (1) {
|
|
5470
|
-
switch (
|
|
5578
|
+
switch (_context13.prev = _context13.next) {
|
|
5471
5579
|
case 0:
|
|
5472
|
-
|
|
5473
|
-
|
|
5580
|
+
_context13.t0 = this;
|
|
5581
|
+
_context13.next = 3;
|
|
5474
5582
|
return this._networkConnection.signer.getAddress();
|
|
5475
5583
|
|
|
5476
5584
|
case 3:
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
return
|
|
5585
|
+
_context13.t1 = _context13.sent;
|
|
5586
|
+
_context13.next = 6;
|
|
5587
|
+
return _context13.t0.referralRewards.call(_context13.t0, _context13.t1);
|
|
5480
5588
|
|
|
5481
5589
|
case 6:
|
|
5482
|
-
unclaimedRewards =
|
|
5590
|
+
unclaimedRewards = _context13.sent.filter(function (reward) {
|
|
5483
5591
|
return reward.transactionHash == null;
|
|
5484
5592
|
});
|
|
5485
5593
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5488,14 +5596,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5488
5596
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5489
5597
|
return reward.rewardTokenAmount.token.address;
|
|
5490
5598
|
});
|
|
5491
|
-
return
|
|
5599
|
+
return _context13.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5492
5600
|
|
|
5493
5601
|
case 10:
|
|
5494
5602
|
case "end":
|
|
5495
|
-
return
|
|
5603
|
+
return _context13.stop();
|
|
5496
5604
|
}
|
|
5497
5605
|
}
|
|
5498
|
-
},
|
|
5606
|
+
}, _callee13, this);
|
|
5499
5607
|
}));
|
|
5500
5608
|
|
|
5501
5609
|
function claimReferralRewards() {
|
|
@@ -5903,5 +6011,5 @@ BigNumber.config({
|
|
|
5903
6011
|
DECIMAL_PLACES: 50
|
|
5904
6012
|
});
|
|
5905
6013
|
|
|
5906
|
-
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, 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, symbolRecords, validateAndParseAddress, valuateToken };
|
|
6014
|
+
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, 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 };
|
|
5907
6015
|
//# sourceMappingURL=sdk.esm.js.map
|