@aurigami/sdk 1.11.1 → 1.12.0-beta1

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/sdk.esm.js CHANGED
@@ -49,6 +49,7 @@ var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
49
49
  var ETHAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
50
50
  var AURORA_CHAINID = 1313161554;
51
51
  var DECIMAL_PRECISION = 10;
52
+ var AURORA_PLUS_API_PREFIX = 'https://aurora.plus/api/wallet/';
52
53
  var networkAddresses = {
53
54
  auTokens: [{
54
55
  name: 'auUSDC',
@@ -110,7 +111,7 @@ var networkAddresses = {
110
111
  PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
111
112
  REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
112
113
  AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
113
- PLYGAME: /*#__PURE__*/MAINNET_ADDRESSES.plyGame.toLowerCase()
114
+ PLYGAME: /*#__PURE__*/'0x60bf668CA101060BD83BD644531a38719586B89f'.toLowerCase()
114
115
  },
115
116
  tokens: {
116
117
  AURORA: /*#__PURE__*/'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
@@ -1207,30 +1208,6 @@ var isSameAddress = function isSameAddress(address1, address2) {
1207
1208
  var getCurrentTimestamp = function getCurrentTimestamp() {
1208
1209
  return Math.trunc(Date.now() / 1000);
1209
1210
  };
1210
- function sleep(_x) {
1211
- return _sleep.apply(this, arguments);
1212
- }
1213
-
1214
- function _sleep() {
1215
- _sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(duration) {
1216
- return runtime_1.wrap(function _callee$(_context) {
1217
- while (1) {
1218
- switch (_context.prev = _context.next) {
1219
- case 0:
1220
- return _context.abrupt("return", new Promise(function (resolve) {
1221
- setTimeout(resolve, duration);
1222
- }));
1223
-
1224
- case 1:
1225
- case "end":
1226
- return _context.stop();
1227
- }
1228
- }
1229
- }, _callee);
1230
- }));
1231
- return _sleep.apply(this, arguments);
1232
- }
1233
-
1234
1211
  function validateAndParseAddress(address) {
1235
1212
  try {
1236
1213
  return utils.getAddress(address);
@@ -1272,35 +1249,35 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
1272
1249
 
1273
1250
  return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
1274
1251
  }
1275
- function getBlockTimestamp(_x2, _x3) {
1252
+ function getBlockTimestamp(_x, _x2) {
1276
1253
  return _getBlockTimestamp.apply(this, arguments);
1277
1254
  }
1278
1255
 
1279
1256
  function _getBlockTimestamp() {
1280
- _getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, blockNumber) {
1257
+ _getBlockTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider, blockNumber) {
1281
1258
  var block;
1282
- return runtime_1.wrap(function _callee2$(_context2) {
1259
+ return runtime_1.wrap(function _callee$(_context) {
1283
1260
  while (1) {
1284
- switch (_context2.prev = _context2.next) {
1261
+ switch (_context.prev = _context.next) {
1285
1262
  case 0:
1286
- _context2.next = 2;
1263
+ _context.next = 2;
1287
1264
  return provider.getBlock(blockNumber);
1288
1265
 
1289
1266
  case 2:
1290
- block = _context2.sent;
1291
- return _context2.abrupt("return", block.timestamp);
1267
+ block = _context.sent;
1268
+ return _context.abrupt("return", block.timestamp);
1292
1269
 
1293
1270
  case 4:
1294
1271
  case "end":
1295
- return _context2.stop();
1272
+ return _context.stop();
1296
1273
  }
1297
1274
  }
1298
- }, _callee2);
1275
+ }, _callee);
1299
1276
  }));
1300
1277
  return _getBlockTimestamp.apply(this, arguments);
1301
1278
  }
1302
1279
 
1303
- function getBlocksTimestampViaRPC(_x4, _x5) {
1280
+ function getBlocksTimestampViaRPC(_x3, _x4) {
1304
1281
  return _getBlocksTimestampViaRPC.apply(this, arguments);
1305
1282
  }
1306
1283
  /**
@@ -1310,11 +1287,11 @@ function getBlocksTimestampViaRPC(_x4, _x5) {
1310
1287
  */
1311
1288
 
1312
1289
  function _getBlocksTimestampViaRPC() {
1313
- _getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blocksNumber) {
1290
+ _getBlocksTimestampViaRPC = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(provider, blocksNumber) {
1314
1291
  var CHUNK_SIZE, results, i, slice, promises;
1315
- return runtime_1.wrap(function _callee4$(_context4) {
1292
+ return runtime_1.wrap(function _callee3$(_context3) {
1316
1293
  while (1) {
1317
- switch (_context4.prev = _context4.next) {
1294
+ switch (_context3.prev = _context3.next) {
1318
1295
  case 0:
1319
1296
  // Promise all 200 blocks at a time, using too many blocks at once will cause the RPC call timeout.
1320
1297
  CHUNK_SIZE = 200;
@@ -1323,58 +1300,58 @@ function _getBlocksTimestampViaRPC() {
1323
1300
 
1324
1301
  case 3:
1325
1302
  if (!(i < blocksNumber.length)) {
1326
- _context4.next = 14;
1303
+ _context3.next = 14;
1327
1304
  break;
1328
1305
  }
1329
1306
 
1330
1307
  slice = blocksNumber.slice(i, i + CHUNK_SIZE);
1331
1308
  promises = slice.map( /*#__PURE__*/function () {
1332
- var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(blockNumber) {
1333
- return runtime_1.wrap(function _callee3$(_context3) {
1309
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(blockNumber) {
1310
+ return runtime_1.wrap(function _callee2$(_context2) {
1334
1311
  while (1) {
1335
- switch (_context3.prev = _context3.next) {
1312
+ switch (_context2.prev = _context2.next) {
1336
1313
  case 0:
1337
- return _context3.abrupt("return", getBlockTimestamp(provider, blockNumber));
1314
+ return _context2.abrupt("return", getBlockTimestamp(provider, blockNumber));
1338
1315
 
1339
1316
  case 1:
1340
1317
  case "end":
1341
- return _context3.stop();
1318
+ return _context2.stop();
1342
1319
  }
1343
1320
  }
1344
- }, _callee3);
1321
+ }, _callee2);
1345
1322
  }));
1346
1323
 
1347
- return function (_x10) {
1324
+ return function (_x9) {
1348
1325
  return _ref.apply(this, arguments);
1349
1326
  };
1350
1327
  }());
1351
- _context4.t0 = results;
1352
- _context4.next = 9;
1328
+ _context3.t0 = results;
1329
+ _context3.next = 9;
1353
1330
  return Promise.all(promises);
1354
1331
 
1355
1332
  case 9:
1356
- _context4.t1 = _context4.sent;
1357
- results = _context4.t0.concat.call(_context4.t0, _context4.t1);
1333
+ _context3.t1 = _context3.sent;
1334
+ results = _context3.t0.concat.call(_context3.t0, _context3.t1);
1358
1335
 
1359
1336
  case 11:
1360
1337
  i += CHUNK_SIZE;
1361
- _context4.next = 3;
1338
+ _context3.next = 3;
1362
1339
  break;
1363
1340
 
1364
1341
  case 14:
1365
- return _context4.abrupt("return", results);
1342
+ return _context3.abrupt("return", results);
1366
1343
 
1367
1344
  case 15:
1368
1345
  case "end":
1369
- return _context4.stop();
1346
+ return _context3.stop();
1370
1347
  }
1371
1348
  }
1372
- }, _callee4);
1349
+ }, _callee3);
1373
1350
  }));
1374
1351
  return _getBlocksTimestampViaRPC.apply(this, arguments);
1375
1352
  }
1376
1353
 
1377
- function getBlocksTimestamp(_x6, _x7) {
1354
+ function getBlocksTimestamp(_x5, _x6) {
1378
1355
  return _getBlocksTimestamp.apply(this, arguments);
1379
1356
  }
1380
1357
  /**
@@ -1387,18 +1364,18 @@ function getBlocksTimestamp(_x6, _x7) {
1387
1364
  */
1388
1365
 
1389
1366
  function _getBlocksTimestamp() {
1390
- _getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, blockNumbers) {
1367
+ _getBlocksTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(provider, blockNumbers) {
1391
1368
  var CHUNK_SIZE, promises, lines, i, query, results, missingBlocks, missingBlocksTimestamps;
1392
- return runtime_1.wrap(function _callee5$(_context5) {
1369
+ return runtime_1.wrap(function _callee4$(_context4) {
1393
1370
  while (1) {
1394
- switch (_context5.prev = _context5.next) {
1371
+ switch (_context4.prev = _context4.next) {
1395
1372
  case 0:
1396
1373
  if (!(blockNumbers.length == 0)) {
1397
- _context5.next = 2;
1374
+ _context4.next = 2;
1398
1375
  break;
1399
1376
  }
1400
1377
 
1401
- return _context5.abrupt("return", []);
1378
+ return _context4.abrupt("return", []);
1402
1379
 
1403
1380
  case 2:
1404
1381
  CHUNK_SIZE = 100; // graphql query limit
@@ -1414,11 +1391,11 @@ function _getBlocksTimestamp() {
1414
1391
  } // merge all the json objects
1415
1392
 
1416
1393
 
1417
- _context5.next = 8;
1394
+ _context4.next = 8;
1418
1395
  return Promise.all(promises);
1419
1396
 
1420
1397
  case 8:
1421
- results = _context5.sent.reduce(function (acc, cur) {
1398
+ results = _context4.sent.reduce(function (acc, cur) {
1422
1399
  return _extends({}, acc, cur);
1423
1400
  });
1424
1401
  missingBlocks = blockNumbers.filter(function (blockNumber) {
@@ -1429,71 +1406,71 @@ function _getBlocksTimestamp() {
1429
1406
  devLog("These blocks are missing from Aurora GraphQL endpoint: " + missingBlocks.join(', '));
1430
1407
  }
1431
1408
 
1432
- _context5.next = 13;
1409
+ _context4.next = 13;
1433
1410
  return getBlocksTimestampViaRPC(provider, missingBlocks);
1434
1411
 
1435
1412
  case 13:
1436
- missingBlocksTimestamps = _context5.sent;
1413
+ missingBlocksTimestamps = _context4.sent;
1437
1414
  missingBlocksTimestamps.forEach(function (timestamp, index) {
1438
1415
  results["b" + missingBlocks[index]] = {
1439
1416
  timestamp: new Date(timestamp * 1000).toISOString()
1440
1417
  };
1441
1418
  });
1442
- return _context5.abrupt("return", blockNumbers.map(function (blockNumber) {
1419
+ return _context4.abrupt("return", blockNumbers.map(function (blockNumber) {
1443
1420
  return Math.trunc(new Date(results["b" + blockNumber].timestamp).getTime() / 1000);
1444
1421
  }));
1445
1422
 
1446
1423
  case 16:
1447
1424
  case "end":
1448
- return _context5.stop();
1425
+ return _context4.stop();
1449
1426
  }
1450
1427
  }
1451
- }, _callee5);
1428
+ }, _callee4);
1452
1429
  }));
1453
1430
  return _getBlocksTimestamp.apply(this, arguments);
1454
1431
  }
1455
1432
 
1456
- function getBlockBeforeTimestamp(_x8, _x9) {
1433
+ function getBlockBeforeTimestamp(_x7, _x8) {
1457
1434
  return _getBlockBeforeTimestamp.apply(this, arguments);
1458
1435
  }
1459
1436
 
1460
1437
  function _getBlockBeforeTimestamp() {
1461
- _getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider, timestamp) {
1438
+ _getBlockBeforeTimestamp = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(provider, timestamp) {
1462
1439
  var result;
1463
- return runtime_1.wrap(function _callee6$(_context6) {
1440
+ return runtime_1.wrap(function _callee5$(_context5) {
1464
1441
  while (1) {
1465
- switch (_context6.prev = _context6.next) {
1442
+ switch (_context5.prev = _context5.next) {
1466
1443
  case 0:
1467
- _context6.next = 2;
1444
+ _context5.next = 2;
1468
1445
  return getQuery('block', 'getblocknobytime', {
1469
1446
  timestamp: timestamp,
1470
1447
  closest: 'before'
1471
1448
  });
1472
1449
 
1473
1450
  case 2:
1474
- result = _context6.sent;
1475
- _context6.t0 = parseInt(result);
1451
+ result = _context5.sent;
1452
+ _context5.t0 = parseInt(result);
1476
1453
 
1477
- if (_context6.t0) {
1478
- _context6.next = 8;
1454
+ if (_context5.t0) {
1455
+ _context5.next = 8;
1479
1456
  break;
1480
1457
  }
1481
1458
 
1482
- _context6.next = 7;
1459
+ _context5.next = 7;
1483
1460
  return provider.getBlockNumber();
1484
1461
 
1485
1462
  case 7:
1486
- _context6.t0 = _context6.sent;
1463
+ _context5.t0 = _context5.sent;
1487
1464
 
1488
1465
  case 8:
1489
- return _context6.abrupt("return", _context6.t0);
1466
+ return _context5.abrupt("return", _context5.t0);
1490
1467
 
1491
1468
  case 9:
1492
1469
  case "end":
1493
- return _context6.stop();
1470
+ return _context5.stop();
1494
1471
  }
1495
1472
  }
1496
- }, _callee6);
1473
+ }, _callee5);
1497
1474
  }));
1498
1475
  return _getBlockBeforeTimestamp.apply(this, arguments);
1499
1476
  }
@@ -1509,20 +1486,6 @@ function devLog(message) {
1509
1486
  (_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
1510
1487
  }
1511
1488
  }
1512
- /**
1513
- * Sorts (in place) an array of Events by blocknumber.
1514
- * This method mutates the array and returns a reference to the same array.
1515
- **/
1516
-
1517
- function sortEvents(events) {
1518
- return events.sort(function (a, b) {
1519
- if (a.blockNumber == b.blockNumber) {
1520
- return a.logIndex - b.logIndex;
1521
- }
1522
-
1523
- return a.blockNumber - b.blockNumber;
1524
- });
1525
- }
1526
1489
 
1527
1490
  var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
1528
1491
  this._networkConnection = networkConnection;
@@ -2621,7 +2584,6 @@ var helpers = {
2621
2584
  decimalFactor: decimalFactor,
2622
2585
  isSameAddress: isSameAddress,
2623
2586
  getCurrentTimestamp: getCurrentTimestamp,
2624
- sleep: sleep,
2625
2587
  validateAndParseAddress: validateAndParseAddress,
2626
2588
  getDecimal: getDecimal,
2627
2589
  getSymbol: getSymbol,
@@ -2632,7 +2594,6 @@ var helpers = {
2632
2594
  getBlocksTimestamp: getBlocksTimestamp,
2633
2595
  getBlockBeforeTimestamp: getBlockBeforeTimestamp,
2634
2596
  devLog: devLog,
2635
- sortEvents: sortEvents,
2636
2597
  fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
2637
2598
  fetchPriceFromCoingecko: fetchPriceFromCoingecko,
2638
2599
  fetchLPPositions: fetchLPPositions,
@@ -4687,14 +4648,11 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4687
4648
 
4688
4649
  _proto.parseBetMakeEvent = function parseBetMakeEvent(event) {
4689
4650
  var outcome = ['bigWin', 'win', 'lose', 'noImpact'][event.args.outcome];
4690
- var betAmount = event.args.amount; // 0%, 0%, 100%, 2%
4691
- // big win, win, lose, no impact
4692
-
4693
- var lostAmount = betAmount.mul([0, 0, 100, 2][event.args.outcome]).div(100);
4694
- var unlock = betAmount.mul([10, 1, 0, 0][event.args.outcome]);
4651
+ var amount = event.args.amount;
4652
+ var unlock = amount.mul([10, 1, 0, 0][event.args.outcome]);
4695
4653
  return {
4696
4654
  player: event.args.player,
4697
- lostAmount: new TokenAmount(this.plyToken, lostAmount.toString()),
4655
+ amount: new TokenAmount(this.plyToken, amount.toString()),
4698
4656
  unlockedPulpAmount: new TokenAmount(this.pulpToken, unlock.toString()),
4699
4657
  outcome: outcome,
4700
4658
  transactionHash: event.transactionHash,
@@ -4774,13 +4732,11 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4774
4732
 
4775
4733
  case 8:
4776
4734
  events = _context2.sent;
4777
- // Sort descending by block number
4778
- sortEvents(events).reverse();
4779
4735
  return _context2.abrupt("return", this.attachTimestamp(events.map(function (event) {
4780
4736
  return _this2.parseBetMakeEvent(event);
4781
4737
  })));
4782
4738
 
4783
- case 11:
4739
+ case 10:
4784
4740
  case "end":
4785
4741
  return _context2.stop();
4786
4742
  }
@@ -4830,81 +4786,72 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4830
4786
  return currentJackpotAmount;
4831
4787
  }();
4832
4788
 
4833
- _proto.earlyUnlockedPulpAmount = /*#__PURE__*/function () {
4834
- var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(user) {
4835
- var earlyUnlockedPulpAmount;
4789
+ _proto.nextJackpotRevealTime = /*#__PURE__*/function () {
4790
+ var _nextJackpotRevealTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
4836
4791
  return runtime_1.wrap(function _callee4$(_context4) {
4837
4792
  while (1) {
4838
4793
  switch (_context4.prev = _context4.next) {
4839
4794
  case 0:
4840
- _context4.next = 2;
4841
- return this.env.plygame.totalPlyUnlockedEarly(user);
4842
-
4843
- case 2:
4844
- earlyUnlockedPulpAmount = _context4.sent;
4845
- return _context4.abrupt("return", new TokenAmount(this.pulpToken, earlyUnlockedPulpAmount.toString()));
4795
+ return _context4.abrupt("return", 0);
4846
4796
 
4847
- case 4:
4797
+ case 1:
4848
4798
  case "end":
4849
4799
  return _context4.stop();
4850
4800
  }
4851
4801
  }
4852
- }, _callee4, this);
4802
+ }, _callee4);
4853
4803
  }));
4854
4804
 
4855
- function earlyUnlockedPulpAmount(_x3) {
4856
- return _earlyUnlockedPulpAmount.apply(this, arguments);
4805
+ function nextJackpotRevealTime() {
4806
+ return _nextJackpotRevealTime.apply(this, arguments);
4857
4807
  }
4858
4808
 
4859
- return earlyUnlockedPulpAmount;
4809
+ return nextJackpotRevealTime;
4860
4810
  }();
4861
4811
 
4862
- _proto.getPlyGameResultsInTransaction = /*#__PURE__*/function () {
4863
- var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(txHash) {
4864
- var _this3 = this;
4865
-
4866
- var tx, i, filter, betMadeEvents;
4812
+ _proto.earlyUnlockedPulpAmount = /*#__PURE__*/function () {
4813
+ var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
4814
+ var earlyUnlockedPulpAmount;
4867
4815
  return runtime_1.wrap(function _callee5$(_context5) {
4868
4816
  while (1) {
4869
4817
  switch (_context5.prev = _context5.next) {
4870
4818
  case 0:
4871
4819
  _context5.next = 2;
4872
- return this._networkConnection.provider.getTransactionReceipt(txHash);
4820
+ return this.env.plygame.totalPlyUnlockedEarly(user);
4873
4821
 
4874
4822
  case 2:
4875
- tx = _context5.sent;
4876
- i = 0;
4823
+ earlyUnlockedPulpAmount = _context5.sent;
4824
+ return _context5.abrupt("return", new TokenAmount(this.pulpToken, earlyUnlockedPulpAmount.toString()));
4877
4825
 
4878
4826
  case 4:
4879
- if (!(i < 100 && !tx)) {
4880
- _context5.next = 13;
4881
- break;
4882
- }
4883
-
4884
- _context5.next = 7;
4885
- return sleep(1000);
4886
-
4887
- case 7:
4888
- _context5.next = 9;
4889
- return this._networkConnection.provider.getTransactionReceipt(txHash);
4827
+ case "end":
4828
+ return _context5.stop();
4829
+ }
4830
+ }
4831
+ }, _callee5, this);
4832
+ }));
4890
4833
 
4891
- case 9:
4892
- tx = _context5.sent;
4834
+ function earlyUnlockedPulpAmount(_x3) {
4835
+ return _earlyUnlockedPulpAmount.apply(this, arguments);
4836
+ }
4893
4837
 
4894
- case 10:
4895
- i++;
4896
- _context5.next = 4;
4897
- break;
4838
+ return earlyUnlockedPulpAmount;
4839
+ }();
4898
4840
 
4899
- case 13:
4900
- if (tx) {
4901
- _context5.next = 15;
4902
- break;
4903
- }
4841
+ _proto.getPlyGameResultsInTransaction = /*#__PURE__*/function () {
4842
+ var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(txHash) {
4843
+ var _this3 = this;
4904
4844
 
4905
- throw new Error("Transaction " + txHash + " takes too long to be mined");
4845
+ var tx, filter, betMadeEvents;
4846
+ return runtime_1.wrap(function _callee6$(_context6) {
4847
+ while (1) {
4848
+ switch (_context6.prev = _context6.next) {
4849
+ case 0:
4850
+ _context6.next = 2;
4851
+ return this._networkConnection.provider.getTransactionReceipt(txHash);
4906
4852
 
4907
- case 15:
4853
+ case 2:
4854
+ tx = _context6.sent;
4908
4855
  filter = this.env.plygame.filters.BetMade();
4909
4856
  betMadeEvents = tx.logs.filter(function (log) {
4910
4857
  return isSameAddress(log.topics[0], filter.topics[0]);
@@ -4914,16 +4861,16 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4914
4861
  transactionHash: txHash
4915
4862
  });
4916
4863
  });
4917
- return _context5.abrupt("return", this.attachTimestamp(betMadeEvents.map(function (e) {
4864
+ return _context6.abrupt("return", this.attachTimestamp(betMadeEvents.map(function (e) {
4918
4865
  return _this3.parseBetMakeEvent(e);
4919
4866
  })));
4920
4867
 
4921
- case 18:
4868
+ case 6:
4922
4869
  case "end":
4923
- return _context5.stop();
4870
+ return _context6.stop();
4924
4871
  }
4925
4872
  }
4926
- }, _callee5, this);
4873
+ }, _callee6, this);
4927
4874
  }));
4928
4875
 
4929
4876
  function getPlyGameResultsInTransaction(_x4) {
@@ -4940,20 +4887,20 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4940
4887
  _proto.leaderboard =
4941
4888
  /*#__PURE__*/
4942
4889
  function () {
4943
- var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
4890
+ var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
4944
4891
  var _this4 = this;
4945
4892
 
4946
4893
  var result;
4947
- return runtime_1.wrap(function _callee6$(_context6) {
4894
+ return runtime_1.wrap(function _callee7$(_context7) {
4948
4895
  while (1) {
4949
- switch (_context6.prev = _context6.next) {
4896
+ switch (_context7.prev = _context7.next) {
4950
4897
  case 0:
4951
- _context6.next = 2;
4898
+ _context7.next = 2;
4952
4899
  return getPaginatedApi('/plygame/leaderboard');
4953
4900
 
4954
4901
  case 2:
4955
- result = _context6.sent;
4956
- return _context6.abrupt("return", result.items.map(function (item, i) {
4902
+ result = _context7.sent;
4903
+ return _context7.abrupt("return", result.items.map(function (item, i) {
4957
4904
  return {
4958
4905
  player: item.user,
4959
4906
  unlockedPulpAmount: new TokenAmount(_this4.pulpToken, item.unlockedAmount),
@@ -4963,10 +4910,10 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4963
4910
 
4964
4911
  case 4:
4965
4912
  case "end":
4966
- return _context6.stop();
4913
+ return _context7.stop();
4967
4914
  }
4968
4915
  }
4969
- }, _callee6);
4916
+ }, _callee7);
4970
4917
  }));
4971
4918
 
4972
4919
  function leaderboard() {
@@ -4987,28 +4934,57 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
4987
4934
 
4988
4935
  var _proto2 = PlyGameReadWrite.prototype;
4989
4936
 
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
+ }()
4990
4964
  /**
4991
4965
  * Make a single bet
4992
4966
  */
4967
+ ;
4968
+
4993
4969
  _proto2.makeBetOnce =
4994
4970
  /*#__PURE__*/
4995
4971
  function () {
4996
- var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
4997
- return runtime_1.wrap(function _callee7$(_context7) {
4972
+ var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
4973
+ return runtime_1.wrap(function _callee9$(_context9) {
4998
4974
  while (1) {
4999
- switch (_context7.prev = _context7.next) {
4975
+ switch (_context9.prev = _context9.next) {
5000
4976
  case 0:
5001
- return _context7.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
4977
+ return _context9.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
5002
4978
 
5003
4979
  case 1:
5004
4980
  case "end":
5005
- return _context7.stop();
4981
+ return _context9.stop();
5006
4982
  }
5007
4983
  }
5008
- }, _callee7, this);
4984
+ }, _callee9, this);
5009
4985
  }));
5010
4986
 
5011
- function makeBetOnce(_x5) {
4987
+ function makeBetOnce(_x7) {
5012
4988
  return _makeBetOnce.apply(this, arguments);
5013
4989
  }
5014
4990
 
@@ -5016,22 +4992,22 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
5016
4992
  }();
5017
4993
 
5018
4994
  _proto2.approve = /*#__PURE__*/function () {
5019
- var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
5020
- return runtime_1.wrap(function _callee8$(_context8) {
4995
+ var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
4996
+ return runtime_1.wrap(function _callee10$(_context10) {
5021
4997
  while (1) {
5022
- switch (_context8.prev = _context8.next) {
4998
+ switch (_context10.prev = _context10.next) {
5023
4999
  case 0:
5024
- return _context8.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5000
+ return _context10.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5025
5001
 
5026
5002
  case 1:
5027
5003
  case "end":
5028
- return _context8.stop();
5004
+ return _context10.stop();
5029
5005
  }
5030
5006
  }
5031
- }, _callee8, this);
5007
+ }, _callee10, this);
5032
5008
  }));
5033
5009
 
5034
- function approve(_x6) {
5010
+ function approve(_x8) {
5035
5011
  return _approve.apply(this, arguments);
5036
5012
  }
5037
5013
 
@@ -5346,6 +5322,66 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5346
5322
  return leaderboard;
5347
5323
  }();
5348
5324
 
5325
+ _proto.isWhitelistedAddress = /*#__PURE__*/function () {
5326
+ var _isWhitelistedAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address) {
5327
+ var result;
5328
+ return runtime_1.wrap(function _callee7$(_context7) {
5329
+ while (1) {
5330
+ switch (_context7.prev = _context7.next) {
5331
+ case 0:
5332
+ _context7.next = 2;
5333
+ return getApi('/referral/whitelisted', {
5334
+ address: address
5335
+ });
5336
+
5337
+ case 2:
5338
+ result = _context7.sent;
5339
+ return _context7.abrupt("return", result.isWhitelisted);
5340
+
5341
+ case 4:
5342
+ case "end":
5343
+ return _context7.stop();
5344
+ }
5345
+ }
5346
+ }, _callee7);
5347
+ }));
5348
+
5349
+ function isWhitelistedAddress(_x7) {
5350
+ return _isWhitelistedAddress.apply(this, arguments);
5351
+ }
5352
+
5353
+ return isWhitelistedAddress;
5354
+ }();
5355
+
5356
+ _proto.isOnAuroraPlus = /*#__PURE__*/function () {
5357
+ var _isOnAuroraPlus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(address) {
5358
+ var resp;
5359
+ return runtime_1.wrap(function _callee8$(_context8) {
5360
+ while (1) {
5361
+ switch (_context8.prev = _context8.next) {
5362
+ case 0:
5363
+ _context8.next = 2;
5364
+ return axios.get(AURORA_PLUS_API_PREFIX + address);
5365
+
5366
+ case 2:
5367
+ resp = _context8.sent;
5368
+ return _context8.abrupt("return", resp.data.status == 'active');
5369
+
5370
+ case 4:
5371
+ case "end":
5372
+ return _context8.stop();
5373
+ }
5374
+ }
5375
+ }, _callee8);
5376
+ }));
5377
+
5378
+ function isOnAuroraPlus(_x8) {
5379
+ return _isOnAuroraPlus.apply(this, arguments);
5380
+ }
5381
+
5382
+ return isOnAuroraPlus;
5383
+ }();
5384
+
5349
5385
  return ReferralRead;
5350
5386
  }(BlockchainEntityRead);
5351
5387
  var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
@@ -5365,21 +5401,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5365
5401
  _proto2.registerNewReferralCode =
5366
5402
  /*#__PURE__*/
5367
5403
  function () {
5368
- var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
5404
+ var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
5369
5405
  var referralCode;
5370
- return runtime_1.wrap(function _callee7$(_context7) {
5406
+ return runtime_1.wrap(function _callee9$(_context9) {
5371
5407
  while (1) {
5372
- switch (_context7.prev = _context7.next) {
5408
+ switch (_context9.prev = _context9.next) {
5373
5409
  case 0:
5374
5410
  referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
5375
- return _context7.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
5411
+ return _context9.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
5376
5412
 
5377
5413
  case 2:
5378
5414
  case "end":
5379
- return _context7.stop();
5415
+ return _context9.stop();
5380
5416
  }
5381
5417
  }
5382
- }, _callee7, this);
5418
+ }, _callee9, this);
5383
5419
  }));
5384
5420
 
5385
5421
  function registerNewReferralCode() {
@@ -5396,24 +5432,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5396
5432
  _proto2.useReferralCode =
5397
5433
  /*#__PURE__*/
5398
5434
  function () {
5399
- var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(code) {
5435
+ var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(code) {
5400
5436
  var referralCode;
5401
- return runtime_1.wrap(function _callee8$(_context8) {
5437
+ return runtime_1.wrap(function _callee10$(_context10) {
5402
5438
  while (1) {
5403
- switch (_context8.prev = _context8.next) {
5439
+ switch (_context10.prev = _context10.next) {
5404
5440
  case 0:
5405
5441
  referralCode = ethers.utils.formatBytes32String(code);
5406
- return _context8.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
5442
+ return _context10.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
5407
5443
 
5408
5444
  case 2:
5409
5445
  case "end":
5410
- return _context8.stop();
5446
+ return _context10.stop();
5411
5447
  }
5412
5448
  }
5413
- }, _callee8, this);
5449
+ }, _callee10, this);
5414
5450
  }));
5415
5451
 
5416
- function useReferralCode(_x7) {
5452
+ function useReferralCode(_x9) {
5417
5453
  return _useReferralCode.apply(this, arguments);
5418
5454
  }
5419
5455
 
@@ -5427,23 +5463,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5427
5463
  _proto2.claimReferralRewards =
5428
5464
  /*#__PURE__*/
5429
5465
  function () {
5430
- var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
5466
+ var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
5431
5467
  var unclaimedRewards, campaigns, tokens;
5432
- return runtime_1.wrap(function _callee9$(_context9) {
5468
+ return runtime_1.wrap(function _callee11$(_context11) {
5433
5469
  while (1) {
5434
- switch (_context9.prev = _context9.next) {
5470
+ switch (_context11.prev = _context11.next) {
5435
5471
  case 0:
5436
- _context9.t0 = this;
5437
- _context9.next = 3;
5472
+ _context11.t0 = this;
5473
+ _context11.next = 3;
5438
5474
  return this._networkConnection.signer.getAddress();
5439
5475
 
5440
5476
  case 3:
5441
- _context9.t1 = _context9.sent;
5442
- _context9.next = 6;
5443
- return _context9.t0.referralRewards.call(_context9.t0, _context9.t1);
5477
+ _context11.t1 = _context11.sent;
5478
+ _context11.next = 6;
5479
+ return _context11.t0.referralRewards.call(_context11.t0, _context11.t1);
5444
5480
 
5445
5481
  case 6:
5446
- unclaimedRewards = _context9.sent.filter(function (reward) {
5482
+ unclaimedRewards = _context11.sent.filter(function (reward) {
5447
5483
  return reward.transactionHash == null;
5448
5484
  });
5449
5485
  campaigns = unclaimedRewards.map(function (reward) {
@@ -5452,14 +5488,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5452
5488
  tokens = unclaimedRewards.map(function (reward) {
5453
5489
  return reward.rewardTokenAmount.token.address;
5454
5490
  });
5455
- return _context9.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
5491
+ return _context11.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
5456
5492
 
5457
5493
  case 10:
5458
5494
  case "end":
5459
- return _context9.stop();
5495
+ return _context11.stop();
5460
5496
  }
5461
5497
  }
5462
- }, _callee9, this);
5498
+ }, _callee11, this);
5463
5499
  }));
5464
5500
 
5465
5501
  function claimReferralRewards() {
@@ -5867,5 +5903,5 @@ BigNumber.config({
5867
5903
  DECIMAL_PLACES: 50
5868
5904
  });
5869
5905
 
5870
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
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 };
5871
5907
  //# sourceMappingURL=sdk.esm.js.map