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