@aurigami/sdk 1.11.0-beta5 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/helpers.d.ts +1 -0
- package/dist/interactors/PlyGame.d.ts +0 -5
- package/dist/sdk.cjs.development.js +155 -149
- 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 +155 -150
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/consts/constants.ts +1 -1
- package/src/helpers/helpers.ts +6 -0
- package/src/interactors/PlyGame.ts +13 -15
|
@@ -8,6 +8,7 @@ export declare function formatObject(object: Object): string;
|
|
|
8
8
|
export declare function decimalFactor(decimal: number): string;
|
|
9
9
|
export declare const isSameAddress: (address1: Address, address2: Address) => boolean;
|
|
10
10
|
export declare const getCurrentTimestamp: () => number;
|
|
11
|
+
export declare function sleep(duration: number): Promise<void>;
|
|
11
12
|
export declare function validateAndParseAddress(address: Address): Address;
|
|
12
13
|
export declare function getDecimal(address: Address): number;
|
|
13
14
|
export declare function getSymbol(address: Address): string;
|
|
@@ -16,7 +16,6 @@ export declare class PlyGameRead extends BlockchainEntityRead {
|
|
|
16
16
|
* Get current jackpot amount
|
|
17
17
|
*/
|
|
18
18
|
currentJackpotAmount(): Promise<TokenAmount>;
|
|
19
|
-
nextJackpotRevealTime(): Promise<number>;
|
|
20
19
|
earlyUnlockedPulpAmount(user: Address): Promise<TokenAmount>;
|
|
21
20
|
getPlyGameResultsInTransaction(txHash: Address): Promise<PlyGameBetResult[]>;
|
|
22
21
|
/**
|
|
@@ -25,10 +24,6 @@ export declare class PlyGameRead extends BlockchainEntityRead {
|
|
|
25
24
|
leaderboard(): Promise<PlyGameLeaderboardItem[]>;
|
|
26
25
|
}
|
|
27
26
|
export declare class PlyGameReadWrite extends PlyGameRead {
|
|
28
|
-
/**
|
|
29
|
-
* makes "times" independent bets, but consecutively, of the same amount
|
|
30
|
-
*/
|
|
31
|
-
makeBetMultiple(amount: TokenAmount, times: number): Promise<TransactionResponse>;
|
|
32
27
|
/**
|
|
33
28
|
* Make a single bet
|
|
34
29
|
*/
|
|
@@ -115,7 +115,7 @@ var networkAddresses = {
|
|
|
115
115
|
PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
|
|
116
116
|
REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
|
|
117
117
|
AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
|
|
118
|
-
PLYGAME: /*#__PURE__*/
|
|
118
|
+
PLYGAME: /*#__PURE__*/MAINNET_ADDRESSES.plyGame.toLowerCase()
|
|
119
119
|
},
|
|
120
120
|
tokens: {
|
|
121
121
|
AURORA: /*#__PURE__*/'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
|
|
@@ -1212,6 +1212,30 @@ var isSameAddress = function isSameAddress(address1, address2) {
|
|
|
1212
1212
|
var getCurrentTimestamp = function getCurrentTimestamp() {
|
|
1213
1213
|
return Math.trunc(Date.now() / 1000);
|
|
1214
1214
|
};
|
|
1215
|
+
function sleep(_x) {
|
|
1216
|
+
return _sleep.apply(this, arguments);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
function _sleep() {
|
|
1220
|
+
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(duration) {
|
|
1221
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1222
|
+
while (1) {
|
|
1223
|
+
switch (_context.prev = _context.next) {
|
|
1224
|
+
case 0:
|
|
1225
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
1226
|
+
setTimeout(resolve, duration);
|
|
1227
|
+
}));
|
|
1228
|
+
|
|
1229
|
+
case 1:
|
|
1230
|
+
case "end":
|
|
1231
|
+
return _context.stop();
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}, _callee);
|
|
1235
|
+
}));
|
|
1236
|
+
return _sleep.apply(this, arguments);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1215
1239
|
function validateAndParseAddress(address) {
|
|
1216
1240
|
try {
|
|
1217
1241
|
return ethers.utils.getAddress(address);
|
|
@@ -1253,35 +1277,35 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1253
1277
|
|
|
1254
1278
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1255
1279
|
}
|
|
1256
|
-
function getBlockTimestamp(
|
|
1280
|
+
function getBlockTimestamp(_x2, _x3) {
|
|
1257
1281
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1258
1282
|
}
|
|
1259
1283
|
|
|
1260
1284
|
function _getBlockTimestamp() {
|
|
1261
|
-
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1285
|
+
_getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, blockNumber) {
|
|
1262
1286
|
var block;
|
|
1263
|
-
return runtime_1.wrap(function
|
|
1287
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1264
1288
|
while (1) {
|
|
1265
|
-
switch (
|
|
1289
|
+
switch (_context2.prev = _context2.next) {
|
|
1266
1290
|
case 0:
|
|
1267
|
-
|
|
1291
|
+
_context2.next = 2;
|
|
1268
1292
|
return provider.getBlock(blockNumber);
|
|
1269
1293
|
|
|
1270
1294
|
case 2:
|
|
1271
|
-
block =
|
|
1272
|
-
return
|
|
1295
|
+
block = _context2.sent;
|
|
1296
|
+
return _context2.abrupt("return", block.timestamp);
|
|
1273
1297
|
|
|
1274
1298
|
case 4:
|
|
1275
1299
|
case "end":
|
|
1276
|
-
return
|
|
1300
|
+
return _context2.stop();
|
|
1277
1301
|
}
|
|
1278
1302
|
}
|
|
1279
|
-
},
|
|
1303
|
+
}, _callee2);
|
|
1280
1304
|
}));
|
|
1281
1305
|
return _getBlockTimestamp.apply(this, arguments);
|
|
1282
1306
|
}
|
|
1283
1307
|
|
|
1284
|
-
function getBlocksTimestampViaRPC(
|
|
1308
|
+
function getBlocksTimestampViaRPC(_x4, _x5) {
|
|
1285
1309
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1286
1310
|
}
|
|
1287
1311
|
/**
|
|
@@ -1291,11 +1315,11 @@ function getBlocksTimestampViaRPC(_x3, _x4) {
|
|
|
1291
1315
|
*/
|
|
1292
1316
|
|
|
1293
1317
|
function _getBlocksTimestampViaRPC() {
|
|
1294
|
-
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1318
|
+
_getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blocksNumber) {
|
|
1295
1319
|
var CHUNK_SIZE, results, i, slice, promises;
|
|
1296
|
-
return runtime_1.wrap(function
|
|
1320
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1297
1321
|
while (1) {
|
|
1298
|
-
switch (
|
|
1322
|
+
switch (_context4.prev = _context4.next) {
|
|
1299
1323
|
case 0:
|
|
1300
1324
|
// Promise all 200 blocks at a time, using too many blocks at once will cause the RPC call timeout.
|
|
1301
1325
|
CHUNK_SIZE = 200;
|
|
@@ -1304,58 +1328,58 @@ function _getBlocksTimestampViaRPC() {
|
|
|
1304
1328
|
|
|
1305
1329
|
case 3:
|
|
1306
1330
|
if (!(i < blocksNumber.length)) {
|
|
1307
|
-
|
|
1331
|
+
_context4.next = 14;
|
|
1308
1332
|
break;
|
|
1309
1333
|
}
|
|
1310
1334
|
|
|
1311
1335
|
slice = blocksNumber.slice(i, i + CHUNK_SIZE);
|
|
1312
1336
|
promises = slice.map( /*#__PURE__*/function () {
|
|
1313
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1314
|
-
return runtime_1.wrap(function
|
|
1337
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(blockNumber) {
|
|
1338
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1315
1339
|
while (1) {
|
|
1316
|
-
switch (
|
|
1340
|
+
switch (_context3.prev = _context3.next) {
|
|
1317
1341
|
case 0:
|
|
1318
|
-
return
|
|
1342
|
+
return _context3.abrupt("return", getBlockTimestamp(provider, blockNumber));
|
|
1319
1343
|
|
|
1320
1344
|
case 1:
|
|
1321
1345
|
case "end":
|
|
1322
|
-
return
|
|
1346
|
+
return _context3.stop();
|
|
1323
1347
|
}
|
|
1324
1348
|
}
|
|
1325
|
-
},
|
|
1349
|
+
}, _callee3);
|
|
1326
1350
|
}));
|
|
1327
1351
|
|
|
1328
|
-
return function (
|
|
1352
|
+
return function (_x10) {
|
|
1329
1353
|
return _ref.apply(this, arguments);
|
|
1330
1354
|
};
|
|
1331
1355
|
}());
|
|
1332
|
-
|
|
1333
|
-
|
|
1356
|
+
_context4.t0 = results;
|
|
1357
|
+
_context4.next = 9;
|
|
1334
1358
|
return Promise.all(promises);
|
|
1335
1359
|
|
|
1336
1360
|
case 9:
|
|
1337
|
-
|
|
1338
|
-
results =
|
|
1361
|
+
_context4.t1 = _context4.sent;
|
|
1362
|
+
results = _context4.t0.concat.call(_context4.t0, _context4.t1);
|
|
1339
1363
|
|
|
1340
1364
|
case 11:
|
|
1341
1365
|
i += CHUNK_SIZE;
|
|
1342
|
-
|
|
1366
|
+
_context4.next = 3;
|
|
1343
1367
|
break;
|
|
1344
1368
|
|
|
1345
1369
|
case 14:
|
|
1346
|
-
return
|
|
1370
|
+
return _context4.abrupt("return", results);
|
|
1347
1371
|
|
|
1348
1372
|
case 15:
|
|
1349
1373
|
case "end":
|
|
1350
|
-
return
|
|
1374
|
+
return _context4.stop();
|
|
1351
1375
|
}
|
|
1352
1376
|
}
|
|
1353
|
-
},
|
|
1377
|
+
}, _callee4);
|
|
1354
1378
|
}));
|
|
1355
1379
|
return _getBlocksTimestampViaRPC.apply(this, arguments);
|
|
1356
1380
|
}
|
|
1357
1381
|
|
|
1358
|
-
function getBlocksTimestamp(
|
|
1382
|
+
function getBlocksTimestamp(_x6, _x7) {
|
|
1359
1383
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1360
1384
|
}
|
|
1361
1385
|
/**
|
|
@@ -1368,18 +1392,18 @@ function getBlocksTimestamp(_x5, _x6) {
|
|
|
1368
1392
|
*/
|
|
1369
1393
|
|
|
1370
1394
|
function _getBlocksTimestamp() {
|
|
1371
|
-
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1395
|
+
_getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, blockNumbers) {
|
|
1372
1396
|
var CHUNK_SIZE, promises, lines, i, query, results, missingBlocks, missingBlocksTimestamps;
|
|
1373
|
-
return runtime_1.wrap(function
|
|
1397
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1374
1398
|
while (1) {
|
|
1375
|
-
switch (
|
|
1399
|
+
switch (_context5.prev = _context5.next) {
|
|
1376
1400
|
case 0:
|
|
1377
1401
|
if (!(blockNumbers.length == 0)) {
|
|
1378
|
-
|
|
1402
|
+
_context5.next = 2;
|
|
1379
1403
|
break;
|
|
1380
1404
|
}
|
|
1381
1405
|
|
|
1382
|
-
return
|
|
1406
|
+
return _context5.abrupt("return", []);
|
|
1383
1407
|
|
|
1384
1408
|
case 2:
|
|
1385
1409
|
CHUNK_SIZE = 100; // graphql query limit
|
|
@@ -1395,11 +1419,11 @@ function _getBlocksTimestamp() {
|
|
|
1395
1419
|
} // merge all the json objects
|
|
1396
1420
|
|
|
1397
1421
|
|
|
1398
|
-
|
|
1422
|
+
_context5.next = 8;
|
|
1399
1423
|
return Promise.all(promises);
|
|
1400
1424
|
|
|
1401
1425
|
case 8:
|
|
1402
|
-
results =
|
|
1426
|
+
results = _context5.sent.reduce(function (acc, cur) {
|
|
1403
1427
|
return _extends({}, acc, cur);
|
|
1404
1428
|
});
|
|
1405
1429
|
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
@@ -1410,71 +1434,71 @@ function _getBlocksTimestamp() {
|
|
|
1410
1434
|
devLog("These blocks are missing from Aurora GraphQL endpoint: " + missingBlocks.join(', '));
|
|
1411
1435
|
}
|
|
1412
1436
|
|
|
1413
|
-
|
|
1437
|
+
_context5.next = 13;
|
|
1414
1438
|
return getBlocksTimestampViaRPC(provider, missingBlocks);
|
|
1415
1439
|
|
|
1416
1440
|
case 13:
|
|
1417
|
-
missingBlocksTimestamps =
|
|
1441
|
+
missingBlocksTimestamps = _context5.sent;
|
|
1418
1442
|
missingBlocksTimestamps.forEach(function (timestamp, index) {
|
|
1419
1443
|
results["b" + missingBlocks[index]] = {
|
|
1420
1444
|
timestamp: new Date(timestamp * 1000).toISOString()
|
|
1421
1445
|
};
|
|
1422
1446
|
});
|
|
1423
|
-
return
|
|
1447
|
+
return _context5.abrupt("return", blockNumbers.map(function (blockNumber) {
|
|
1424
1448
|
return Math.trunc(new Date(results["b" + blockNumber].timestamp).getTime() / 1000);
|
|
1425
1449
|
}));
|
|
1426
1450
|
|
|
1427
1451
|
case 16:
|
|
1428
1452
|
case "end":
|
|
1429
|
-
return
|
|
1453
|
+
return _context5.stop();
|
|
1430
1454
|
}
|
|
1431
1455
|
}
|
|
1432
|
-
},
|
|
1456
|
+
}, _callee5);
|
|
1433
1457
|
}));
|
|
1434
1458
|
return _getBlocksTimestamp.apply(this, arguments);
|
|
1435
1459
|
}
|
|
1436
1460
|
|
|
1437
|
-
function getBlockBeforeTimestamp(
|
|
1461
|
+
function getBlockBeforeTimestamp(_x8, _x9) {
|
|
1438
1462
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1439
1463
|
}
|
|
1440
1464
|
|
|
1441
1465
|
function _getBlockBeforeTimestamp() {
|
|
1442
|
-
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1466
|
+
_getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider, timestamp) {
|
|
1443
1467
|
var result;
|
|
1444
|
-
return runtime_1.wrap(function
|
|
1468
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1445
1469
|
while (1) {
|
|
1446
|
-
switch (
|
|
1470
|
+
switch (_context6.prev = _context6.next) {
|
|
1447
1471
|
case 0:
|
|
1448
|
-
|
|
1472
|
+
_context6.next = 2;
|
|
1449
1473
|
return getQuery('block', 'getblocknobytime', {
|
|
1450
1474
|
timestamp: timestamp,
|
|
1451
1475
|
closest: 'before'
|
|
1452
1476
|
});
|
|
1453
1477
|
|
|
1454
1478
|
case 2:
|
|
1455
|
-
result =
|
|
1456
|
-
|
|
1479
|
+
result = _context6.sent;
|
|
1480
|
+
_context6.t0 = parseInt(result);
|
|
1457
1481
|
|
|
1458
|
-
if (
|
|
1459
|
-
|
|
1482
|
+
if (_context6.t0) {
|
|
1483
|
+
_context6.next = 8;
|
|
1460
1484
|
break;
|
|
1461
1485
|
}
|
|
1462
1486
|
|
|
1463
|
-
|
|
1487
|
+
_context6.next = 7;
|
|
1464
1488
|
return provider.getBlockNumber();
|
|
1465
1489
|
|
|
1466
1490
|
case 7:
|
|
1467
|
-
|
|
1491
|
+
_context6.t0 = _context6.sent;
|
|
1468
1492
|
|
|
1469
1493
|
case 8:
|
|
1470
|
-
return
|
|
1494
|
+
return _context6.abrupt("return", _context6.t0);
|
|
1471
1495
|
|
|
1472
1496
|
case 9:
|
|
1473
1497
|
case "end":
|
|
1474
|
-
return
|
|
1498
|
+
return _context6.stop();
|
|
1475
1499
|
}
|
|
1476
1500
|
}
|
|
1477
|
-
},
|
|
1501
|
+
}, _callee6);
|
|
1478
1502
|
}));
|
|
1479
1503
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1480
1504
|
}
|
|
@@ -2602,6 +2626,7 @@ var helpers = {
|
|
|
2602
2626
|
decimalFactor: decimalFactor,
|
|
2603
2627
|
isSameAddress: isSameAddress,
|
|
2604
2628
|
getCurrentTimestamp: getCurrentTimestamp,
|
|
2629
|
+
sleep: sleep,
|
|
2605
2630
|
validateAndParseAddress: validateAndParseAddress,
|
|
2606
2631
|
getDecimal: getDecimal,
|
|
2607
2632
|
getSymbol: getSymbol,
|
|
@@ -4806,72 +4831,81 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4806
4831
|
return currentJackpotAmount;
|
|
4807
4832
|
}();
|
|
4808
4833
|
|
|
4809
|
-
_proto.
|
|
4810
|
-
var
|
|
4834
|
+
_proto.earlyUnlockedPulpAmount = /*#__PURE__*/function () {
|
|
4835
|
+
var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(user) {
|
|
4836
|
+
var earlyUnlockedPulpAmount;
|
|
4811
4837
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
4812
4838
|
while (1) {
|
|
4813
4839
|
switch (_context4.prev = _context4.next) {
|
|
4814
4840
|
case 0:
|
|
4815
|
-
|
|
4841
|
+
_context4.next = 2;
|
|
4842
|
+
return this.env.plygame.totalPlyUnlockedEarly(user);
|
|
4816
4843
|
|
|
4817
|
-
case
|
|
4844
|
+
case 2:
|
|
4845
|
+
earlyUnlockedPulpAmount = _context4.sent;
|
|
4846
|
+
return _context4.abrupt("return", new TokenAmount(this.pulpToken, earlyUnlockedPulpAmount.toString()));
|
|
4847
|
+
|
|
4848
|
+
case 4:
|
|
4818
4849
|
case "end":
|
|
4819
4850
|
return _context4.stop();
|
|
4820
4851
|
}
|
|
4821
4852
|
}
|
|
4822
|
-
}, _callee4);
|
|
4853
|
+
}, _callee4, this);
|
|
4823
4854
|
}));
|
|
4824
4855
|
|
|
4825
|
-
function
|
|
4826
|
-
return
|
|
4856
|
+
function earlyUnlockedPulpAmount(_x3) {
|
|
4857
|
+
return _earlyUnlockedPulpAmount.apply(this, arguments);
|
|
4827
4858
|
}
|
|
4828
4859
|
|
|
4829
|
-
return
|
|
4860
|
+
return earlyUnlockedPulpAmount;
|
|
4830
4861
|
}();
|
|
4831
4862
|
|
|
4832
|
-
_proto.
|
|
4833
|
-
var
|
|
4834
|
-
var
|
|
4863
|
+
_proto.getPlyGameResultsInTransaction = /*#__PURE__*/function () {
|
|
4864
|
+
var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(txHash) {
|
|
4865
|
+
var _this3 = this;
|
|
4866
|
+
|
|
4867
|
+
var tx, i, filter, betMadeEvents;
|
|
4835
4868
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
4836
4869
|
while (1) {
|
|
4837
4870
|
switch (_context5.prev = _context5.next) {
|
|
4838
4871
|
case 0:
|
|
4839
4872
|
_context5.next = 2;
|
|
4840
|
-
return this.
|
|
4873
|
+
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4841
4874
|
|
|
4842
4875
|
case 2:
|
|
4843
|
-
|
|
4844
|
-
|
|
4876
|
+
tx = _context5.sent;
|
|
4877
|
+
i = 0;
|
|
4845
4878
|
|
|
4846
4879
|
case 4:
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
}, _callee5, this);
|
|
4852
|
-
}));
|
|
4880
|
+
if (!(i < 100 && !tx)) {
|
|
4881
|
+
_context5.next = 13;
|
|
4882
|
+
break;
|
|
4883
|
+
}
|
|
4853
4884
|
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
}
|
|
4885
|
+
_context5.next = 7;
|
|
4886
|
+
return sleep(1000);
|
|
4857
4887
|
|
|
4858
|
-
|
|
4859
|
-
|
|
4888
|
+
case 7:
|
|
4889
|
+
_context5.next = 9;
|
|
4890
|
+
return this._networkConnection.provider.getTransactionReceipt(txHash);
|
|
4860
4891
|
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
var _this3 = this;
|
|
4892
|
+
case 9:
|
|
4893
|
+
tx = _context5.sent;
|
|
4864
4894
|
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
case 0:
|
|
4870
|
-
_context6.next = 2;
|
|
4871
|
-
return this._networkConnection.provider.waitForTransaction(txHash, 1);
|
|
4895
|
+
case 10:
|
|
4896
|
+
i++;
|
|
4897
|
+
_context5.next = 4;
|
|
4898
|
+
break;
|
|
4872
4899
|
|
|
4873
|
-
case
|
|
4874
|
-
tx
|
|
4900
|
+
case 13:
|
|
4901
|
+
if (tx) {
|
|
4902
|
+
_context5.next = 15;
|
|
4903
|
+
break;
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4906
|
+
throw new Error("Transaction " + txHash + " takes too long to be mined");
|
|
4907
|
+
|
|
4908
|
+
case 15:
|
|
4875
4909
|
filter = this.env.plygame.filters.BetMade();
|
|
4876
4910
|
betMadeEvents = tx.logs.filter(function (log) {
|
|
4877
4911
|
return isSameAddress(log.topics[0], filter.topics[0]);
|
|
@@ -4881,16 +4915,16 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4881
4915
|
transactionHash: txHash
|
|
4882
4916
|
});
|
|
4883
4917
|
});
|
|
4884
|
-
return
|
|
4918
|
+
return _context5.abrupt("return", this.attachTimestamp(betMadeEvents.map(function (e) {
|
|
4885
4919
|
return _this3.parseBetMakeEvent(e);
|
|
4886
4920
|
})));
|
|
4887
4921
|
|
|
4888
|
-
case
|
|
4922
|
+
case 18:
|
|
4889
4923
|
case "end":
|
|
4890
|
-
return
|
|
4924
|
+
return _context5.stop();
|
|
4891
4925
|
}
|
|
4892
4926
|
}
|
|
4893
|
-
},
|
|
4927
|
+
}, _callee5, this);
|
|
4894
4928
|
}));
|
|
4895
4929
|
|
|
4896
4930
|
function getPlyGameResultsInTransaction(_x4) {
|
|
@@ -4907,20 +4941,20 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4907
4941
|
_proto.leaderboard =
|
|
4908
4942
|
/*#__PURE__*/
|
|
4909
4943
|
function () {
|
|
4910
|
-
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4944
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
4911
4945
|
var _this4 = this;
|
|
4912
4946
|
|
|
4913
4947
|
var result;
|
|
4914
|
-
return runtime_1.wrap(function
|
|
4948
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4915
4949
|
while (1) {
|
|
4916
|
-
switch (
|
|
4950
|
+
switch (_context6.prev = _context6.next) {
|
|
4917
4951
|
case 0:
|
|
4918
|
-
|
|
4952
|
+
_context6.next = 2;
|
|
4919
4953
|
return getPaginatedApi('/plygame/leaderboard');
|
|
4920
4954
|
|
|
4921
4955
|
case 2:
|
|
4922
|
-
result =
|
|
4923
|
-
return
|
|
4956
|
+
result = _context6.sent;
|
|
4957
|
+
return _context6.abrupt("return", result.items.map(function (item, i) {
|
|
4924
4958
|
return {
|
|
4925
4959
|
player: item.user,
|
|
4926
4960
|
unlockedPulpAmount: new TokenAmount(_this4.pulpToken, item.unlockedAmount),
|
|
@@ -4930,10 +4964,10 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4930
4964
|
|
|
4931
4965
|
case 4:
|
|
4932
4966
|
case "end":
|
|
4933
|
-
return
|
|
4967
|
+
return _context6.stop();
|
|
4934
4968
|
}
|
|
4935
4969
|
}
|
|
4936
|
-
},
|
|
4970
|
+
}, _callee6);
|
|
4937
4971
|
}));
|
|
4938
4972
|
|
|
4939
4973
|
function leaderboard() {
|
|
@@ -4954,57 +4988,28 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4954
4988
|
|
|
4955
4989
|
var _proto2 = PlyGameReadWrite.prototype;
|
|
4956
4990
|
|
|
4957
|
-
/**
|
|
4958
|
-
* makes "times" independent bets, but consecutively, of the same amount
|
|
4959
|
-
*/
|
|
4960
|
-
_proto2.makeBetMultiple =
|
|
4961
|
-
/*#__PURE__*/
|
|
4962
|
-
function () {
|
|
4963
|
-
var _makeBetMultiple = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount, times) {
|
|
4964
|
-
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4965
|
-
while (1) {
|
|
4966
|
-
switch (_context8.prev = _context8.next) {
|
|
4967
|
-
case 0:
|
|
4968
|
-
return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetMultiple(amount.rawAmount(), times));
|
|
4969
|
-
|
|
4970
|
-
case 1:
|
|
4971
|
-
case "end":
|
|
4972
|
-
return _context8.stop();
|
|
4973
|
-
}
|
|
4974
|
-
}
|
|
4975
|
-
}, _callee8, this);
|
|
4976
|
-
}));
|
|
4977
|
-
|
|
4978
|
-
function makeBetMultiple(_x5, _x6) {
|
|
4979
|
-
return _makeBetMultiple.apply(this, arguments);
|
|
4980
|
-
}
|
|
4981
|
-
|
|
4982
|
-
return makeBetMultiple;
|
|
4983
|
-
}()
|
|
4984
4991
|
/**
|
|
4985
4992
|
* Make a single bet
|
|
4986
4993
|
*/
|
|
4987
|
-
;
|
|
4988
|
-
|
|
4989
4994
|
_proto2.makeBetOnce =
|
|
4990
4995
|
/*#__PURE__*/
|
|
4991
4996
|
function () {
|
|
4992
|
-
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4993
|
-
return runtime_1.wrap(function
|
|
4997
|
+
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
|
|
4998
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4994
4999
|
while (1) {
|
|
4995
|
-
switch (
|
|
5000
|
+
switch (_context7.prev = _context7.next) {
|
|
4996
5001
|
case 0:
|
|
4997
|
-
return
|
|
5002
|
+
return _context7.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
|
|
4998
5003
|
|
|
4999
5004
|
case 1:
|
|
5000
5005
|
case "end":
|
|
5001
|
-
return
|
|
5006
|
+
return _context7.stop();
|
|
5002
5007
|
}
|
|
5003
5008
|
}
|
|
5004
|
-
},
|
|
5009
|
+
}, _callee7, this);
|
|
5005
5010
|
}));
|
|
5006
5011
|
|
|
5007
|
-
function makeBetOnce(
|
|
5012
|
+
function makeBetOnce(_x5) {
|
|
5008
5013
|
return _makeBetOnce.apply(this, arguments);
|
|
5009
5014
|
}
|
|
5010
5015
|
|
|
@@ -5012,22 +5017,22 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
5012
5017
|
}();
|
|
5013
5018
|
|
|
5014
5019
|
_proto2.approve = /*#__PURE__*/function () {
|
|
5015
|
-
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5016
|
-
return runtime_1.wrap(function
|
|
5020
|
+
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
5021
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5017
5022
|
while (1) {
|
|
5018
|
-
switch (
|
|
5023
|
+
switch (_context8.prev = _context8.next) {
|
|
5019
5024
|
case 0:
|
|
5020
|
-
return
|
|
5025
|
+
return _context8.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
|
|
5021
5026
|
|
|
5022
5027
|
case 1:
|
|
5023
5028
|
case "end":
|
|
5024
|
-
return
|
|
5029
|
+
return _context8.stop();
|
|
5025
5030
|
}
|
|
5026
5031
|
}
|
|
5027
|
-
},
|
|
5032
|
+
}, _callee8, this);
|
|
5028
5033
|
}));
|
|
5029
5034
|
|
|
5030
|
-
function approve(
|
|
5035
|
+
function approve(_x6) {
|
|
5031
5036
|
return _approve.apply(this, arguments);
|
|
5032
5037
|
}
|
|
5033
5038
|
|
|
@@ -5963,6 +5968,7 @@ exports.networkAddresses = networkAddresses;
|
|
|
5963
5968
|
exports.queryGraphQL = queryGraphQL;
|
|
5964
5969
|
exports.referralRewardDummy1 = referralRewardDummy1;
|
|
5965
5970
|
exports.referralRewardDummy2 = referralRewardDummy2;
|
|
5971
|
+
exports.sleep = sleep;
|
|
5966
5972
|
exports.sortEvents = sortEvents;
|
|
5967
5973
|
exports.symbolRecords = symbolRecords;
|
|
5968
5974
|
exports.validateAndParseAddress = validateAndParseAddress;
|