@aurigami/sdk 1.9.7 → 1.11.0-beta

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
@@ -1,5 +1,5 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { BigNumber as BigNumber$1, Contract, utils, ethers } from 'ethers';
2
+ import { BigNumber as BigNumber$1, utils, Contract, ethers } from 'ethers';
3
3
  import { Logger } from 'ethers/lib/utils';
4
4
  import abis$8 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
5
  import abis$9 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
@@ -16,11 +16,12 @@ import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUni
16
16
  import abis$b from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
17
17
  import abis$c from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
18
18
  import abis$7 from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
19
+ import abis$e from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
19
20
  import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
20
21
  export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
21
22
  export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
22
- import { Signer } from '@ethersproject/abstract-signer';
23
23
  import axios from 'axios';
24
+ import { Signer } from '@ethersproject/abstract-signer';
24
25
 
25
26
 
26
27
 
@@ -40,7 +41,8 @@ var index = {
40
41
  EthRepayHelperABI: abis$a,
41
42
  Multicall2ABI: abis$b,
42
43
  PulpABI: abis$c,
43
- AuriInternalLensABI: abis$d
44
+ AuriInternalLensABI: abis$d,
45
+ PlyGameABI: abis$e
44
46
  };
45
47
 
46
48
  var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
@@ -107,7 +109,8 @@ var networkAddresses = {
107
109
  PULP_CONTRACT: /*#__PURE__*/'0x04ac48711bcdc45b4d223fb021e09da73c71095e'.toLowerCase(),
108
110
  PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
109
111
  REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
110
- AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase()
112
+ AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
113
+ PLYGAME: /*#__PURE__*/'0x60bf668CA101060BD83BD644531a38719586B89f'.toLowerCase()
111
114
  },
112
115
  tokens: {
113
116
  AURORA: /*#__PURE__*/'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
@@ -337,160 +340,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
337
340
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
338
341
  }
339
342
 
340
- var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
341
- this._networkConnection = networkConnection;
342
- };
343
- var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
344
- _inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
345
-
346
- function BlockchainEntityReadWrite(networkConnection) {
347
- if (!(networkConnection.signer instanceof Signer)) {
348
- throw Error('Signer is not provided when constructing BlockchainEntityReadWrite');
349
- }
350
-
351
- return _BlockchainEntityRead.call(this, networkConnection) || this;
352
- }
353
-
354
- return BlockchainEntityReadWrite;
355
- }(BlockchainEntityRead);
356
- var BlockchainEntity = /*#__PURE__*/function () {
357
- function BlockchainEntity() {}
358
-
359
- var _proto = BlockchainEntity.prototype;
360
-
361
- _proto.read = function read(networkConnection) {
362
- return new BlockchainEntityRead(networkConnection);
363
- };
364
-
365
- _proto.readWrite = function readWrite(networkConnection) {
366
- return new BlockchainEntityReadWrite(networkConnection);
367
- };
368
-
369
- return BlockchainEntity;
370
- }();
371
-
372
- var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
373
- _inheritsLoose(AuriEnv, _BlockchainEntityRead);
374
-
375
- function AuriEnv() {
376
- var _this;
377
-
378
- _this = _BlockchainEntityRead.apply(this, arguments) || this;
379
- _this._comptroller = null;
380
- _this._auriFairLaunch = null;
381
- _this._auriLens = null;
382
- _this._ply = null;
383
- _this._pulp = null;
384
- _this._auriInternalLens = null;
385
- _this._auriAirdrop = null;
386
- _this._referralDirectory = null;
387
- _this._oracle = null;
388
- return _this;
389
- }
390
-
391
- var _proto = AuriEnv.prototype;
392
-
393
- _proto.getContract = function getContract(address, abi) {
394
- return new Contract(address, abi, this._networkConnection.provider);
395
- };
396
-
397
- _proto.getAuTokenContracts = function getAuTokenContracts() {
398
- var _this2 = this;
399
-
400
- return networkAddresses.auTokens.map(function (auToken) {
401
- var contract = _this2.getContract(auToken.address, abis$1.abi);
402
-
403
- contract.underlying = auToken.underlying;
404
- return contract;
405
- });
406
- };
407
-
408
- _createClass(AuriEnv, [{
409
- key: "comptroller",
410
- get: function get() {
411
- if (!this._comptroller) {
412
- this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$5.abi);
413
- }
414
-
415
- return this._comptroller;
416
- }
417
- }, {
418
- key: "auriFairLaunch",
419
- get: function get() {
420
- if (!this._auriFairLaunch) {
421
- this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$3.abi);
422
- }
423
-
424
- return this._auriFairLaunch;
425
- }
426
- }, {
427
- key: "auriLens",
428
- get: function get() {
429
- if (!this._auriLens) {
430
- this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$4.abi);
431
- }
432
-
433
- return this._auriLens;
434
- }
435
- }, {
436
- key: "ply",
437
- get: function get() {
438
- if (!this._ply) {
439
- this._ply = this.getContract(networkAddresses.tokens.PLY, abis$6.abi);
440
- }
441
-
442
- return this._ply;
443
- }
444
- }, {
445
- key: "pulp",
446
- get: function get() {
447
- if (!this._pulp) {
448
- this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$c.abi);
449
- }
450
-
451
- return this._pulp;
452
- }
453
- }, {
454
- key: "auriInternalLens",
455
- get: function get() {
456
- if (!this._auriInternalLens) {
457
- this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$d.abi);
458
- }
459
-
460
- return this._auriInternalLens;
461
- }
462
- }, {
463
- key: "auriAirdrop",
464
- get: function get() {
465
- if (!this._auriAirdrop) {
466
- this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$2.abi);
467
- }
468
-
469
- return this._auriAirdrop;
470
- }
471
- }, {
472
- key: "referralDirectory",
473
- get: function get() {
474
- if (!this._referralDirectory) {
475
- this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$7.abi);
476
- }
477
-
478
- return this._referralDirectory;
479
- }
480
- }, {
481
- key: "oracle",
482
- get: function get() {
483
- if (!this._oracle) {
484
- this._oracle = this.getContract(networkAddresses.misc.oracle, abis.abi);
485
- }
486
-
487
- return this._oracle;
488
- }
489
- }]);
490
-
491
- return AuriEnv;
492
- }(BlockchainEntityRead);
493
-
494
343
  function createCommonjsModule(fn, module) {
495
344
  return module = { exports: {} }, fn(module, module.exports), module.exports;
496
345
  }
@@ -1252,10 +1101,17 @@ try {
1252
1101
  });
1253
1102
 
1254
1103
  var symbolRecords = /*#__PURE__*/Object.fromEntries( /*#__PURE__*/networkAddresses.auTokens.map(function (e) {
1255
- return [e.address.toLowerCase(), e.name];
1256
- }).concat( /*#__PURE__*/networkAddresses.auTokens.map(function (e) {
1257
- return [e.underlying.toLowerCase(), e.name.slice(2)];
1258
- })));
1104
+ return [e.address, e.name];
1105
+ }) // AuToken
1106
+ .concat(networkAddresses.auTokens.map(function (e) {
1107
+ return [e.underlying, e.name.slice(2)];
1108
+ })) // underlying token
1109
+ .concat([['0x04ac48711bcdc45b4d223fb021e09da73c71095e', 'PULP']]) // others
1110
+ .map(function (_ref) {
1111
+ var address = _ref[0],
1112
+ name = _ref[1];
1113
+ return [address.toLowerCase(), name];
1114
+ }));
1259
1115
 
1260
1116
  var AURORA_API_BASE_URL = 'https://api.aurorascan.dev/api';
1261
1117
  function getQuery(_x, _x2, _x3) {
@@ -1608,27 +1464,215 @@ function _getBlockBeforeTimestamp() {
1608
1464
  case 8:
1609
1465
  return _context5.abrupt("return", _context5.t0);
1610
1466
 
1611
- case 9:
1612
- case "end":
1613
- return _context5.stop();
1614
- }
1467
+ case 9:
1468
+ case "end":
1469
+ return _context5.stop();
1470
+ }
1471
+ }
1472
+ }, _callee5);
1473
+ }));
1474
+ return _getBlockBeforeTimestamp.apply(this, arguments);
1475
+ }
1476
+
1477
+ function devLog(message) {
1478
+ if ('production' !== process.env.NODE_ENV) {
1479
+ var _console;
1480
+
1481
+ for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1482
+ optionalParams[_key - 1] = arguments[_key];
1483
+ }
1484
+
1485
+ (_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
1486
+ }
1487
+ }
1488
+
1489
+ var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
1490
+ this._networkConnection = networkConnection;
1491
+ };
1492
+ var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
1493
+ _inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
1494
+
1495
+ function BlockchainEntityReadWrite(networkConnection) {
1496
+ if (!(networkConnection.signer instanceof Signer)) {
1497
+ throw Error('Signer is not provided when constructing BlockchainEntityReadWrite');
1498
+ }
1499
+
1500
+ return _BlockchainEntityRead.call(this, networkConnection) || this;
1501
+ }
1502
+
1503
+ return BlockchainEntityReadWrite;
1504
+ }(BlockchainEntityRead);
1505
+ var BlockchainEntity = /*#__PURE__*/function () {
1506
+ function BlockchainEntity() {}
1507
+
1508
+ var _proto = BlockchainEntity.prototype;
1509
+
1510
+ _proto.read = function read(networkConnection) {
1511
+ return new BlockchainEntityRead(networkConnection);
1512
+ };
1513
+
1514
+ _proto.readWrite = function readWrite(networkConnection) {
1515
+ return new BlockchainEntityReadWrite(networkConnection);
1516
+ };
1517
+
1518
+ return BlockchainEntity;
1519
+ }();
1520
+
1521
+ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1522
+ _inheritsLoose(AuriEnv, _BlockchainEntityRead);
1523
+
1524
+ function AuriEnv() {
1525
+ var _this;
1526
+
1527
+ _this = _BlockchainEntityRead.apply(this, arguments) || this;
1528
+ _this._comptroller = null;
1529
+ _this._auriFairLaunch = null;
1530
+ _this._auriLens = null;
1531
+ _this._ply = null;
1532
+ _this._pulp = null;
1533
+ _this._auriInternalLens = null;
1534
+ _this._auriAirdrop = null;
1535
+ _this._referralDirectory = null;
1536
+ _this._oracle = null;
1537
+ _this._plygame = null;
1538
+ return _this;
1539
+ }
1540
+
1541
+ var _proto = AuriEnv.prototype;
1542
+
1543
+ _proto.getContract = function getContract(address, abi) {
1544
+ return new Contract(address, abi, this._networkConnection.provider);
1545
+ };
1546
+
1547
+ _proto.getAuTokenContracts = function getAuTokenContracts() {
1548
+ var _this2 = this;
1549
+
1550
+ return networkAddresses.auTokens.map(function (auToken) {
1551
+ var contract = _this2.getContract(auToken.address, abis$1.abi);
1552
+
1553
+ contract.underlying = auToken.underlying;
1554
+ return contract;
1555
+ });
1556
+ }
1557
+ /**
1558
+ * Get AuErc20 contract by its address or underlying name.
1559
+ *
1560
+ * Either address or underlyingName must be provided
1561
+ *
1562
+ */
1563
+ ;
1564
+
1565
+ _proto.getAuErc20Contract = function getAuErc20Contract(_ref) {
1566
+ var address = _ref.address,
1567
+ underlyingName = _ref.underlyingName;
1568
+ assert(address !== undefined || underlyingName !== undefined, 'Either address or underlyingName must be provided');
1569
+
1570
+ if (underlyingName) {
1571
+ var _networkAddresses$auT;
1572
+
1573
+ address = (_networkAddresses$auT = networkAddresses.auTokens.find(function (auToken) {
1574
+ return auToken.name == 'au' + underlyingName;
1575
+ })) == null ? void 0 : _networkAddresses$auT.address;
1576
+ assert(address !== undefined, "AuToken with underlying " + underlyingName + " not found");
1577
+ }
1578
+
1579
+ return this.getContract(address, abis$8.abi);
1580
+ };
1581
+
1582
+ _createClass(AuriEnv, [{
1583
+ key: "comptroller",
1584
+ get: function get() {
1585
+ if (!this._comptroller) {
1586
+ this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$5.abi);
1587
+ }
1588
+
1589
+ return this._comptroller;
1590
+ }
1591
+ }, {
1592
+ key: "auriFairLaunch",
1593
+ get: function get() {
1594
+ if (!this._auriFairLaunch) {
1595
+ this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$3.abi);
1596
+ }
1597
+
1598
+ return this._auriFairLaunch;
1599
+ }
1600
+ }, {
1601
+ key: "auriLens",
1602
+ get: function get() {
1603
+ if (!this._auriLens) {
1604
+ this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$4.abi);
1605
+ }
1606
+
1607
+ return this._auriLens;
1608
+ }
1609
+ }, {
1610
+ key: "ply",
1611
+ get: function get() {
1612
+ if (!this._ply) {
1613
+ this._ply = this.getContract(networkAddresses.tokens.PLY, abis$6.abi);
1614
+ }
1615
+
1616
+ return this._ply;
1617
+ }
1618
+ }, {
1619
+ key: "pulp",
1620
+ get: function get() {
1621
+ if (!this._pulp) {
1622
+ this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$c.abi);
1623
+ }
1624
+
1625
+ return this._pulp;
1626
+ }
1627
+ }, {
1628
+ key: "auriInternalLens",
1629
+ get: function get() {
1630
+ if (!this._auriInternalLens) {
1631
+ this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$d.abi);
1632
+ }
1633
+
1634
+ return this._auriInternalLens;
1635
+ }
1636
+ }, {
1637
+ key: "auriAirdrop",
1638
+ get: function get() {
1639
+ if (!this._auriAirdrop) {
1640
+ this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$2.abi);
1641
+ }
1642
+
1643
+ return this._auriAirdrop;
1644
+ }
1645
+ }, {
1646
+ key: "referralDirectory",
1647
+ get: function get() {
1648
+ if (!this._referralDirectory) {
1649
+ this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$7.abi);
1650
+ }
1651
+
1652
+ return this._referralDirectory;
1653
+ }
1654
+ }, {
1655
+ key: "oracle",
1656
+ get: function get() {
1657
+ if (!this._oracle) {
1658
+ this._oracle = this.getContract(networkAddresses.misc.oracle, abis.abi);
1615
1659
  }
1616
- }, _callee5);
1617
- }));
1618
- return _getBlockBeforeTimestamp.apply(this, arguments);
1619
- }
1620
1660
 
1621
- function devLog(message) {
1622
- if ('production' !== process.env.NODE_ENV) {
1623
- var _console;
1661
+ return this._oracle;
1662
+ }
1663
+ }, {
1664
+ key: "plygame",
1665
+ get: function get() {
1666
+ if (!this._plygame) {
1667
+ this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$e.abi);
1668
+ }
1624
1669
 
1625
- for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1626
- optionalParams[_key - 1] = arguments[_key];
1670
+ return this._plygame;
1627
1671
  }
1672
+ }]);
1628
1673
 
1629
- (_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
1630
- }
1631
- }
1674
+ return AuriEnv;
1675
+ }(BlockchainEntityRead);
1632
1676
 
1633
1677
  var Token = function Token(address, decimals) {
1634
1678
  this.address = address.toLowerCase();
@@ -4584,6 +4628,347 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4584
4628
  return MiscRead;
4585
4629
  }(BlockchainEntityRead);
4586
4630
 
4631
+ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4632
+ _inheritsLoose(PlyGameRead, _BlockchainEntityRead);
4633
+
4634
+ function PlyGameRead(networkConnection) {
4635
+ var _this;
4636
+
4637
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
4638
+ _this.env = new AuriEnv(networkConnection);
4639
+ var plyAddress = networkAddresses.tokens.PLY;
4640
+ var pulpAddress = networkAddresses.tokens.PULP;
4641
+ _this.plyToken = new Token(plyAddress, getDecimal(plyAddress));
4642
+ _this.pulpToken = new Token(pulpAddress, getDecimal(pulpAddress));
4643
+ return _this;
4644
+ }
4645
+
4646
+ var _proto = PlyGameRead.prototype;
4647
+
4648
+ _proto.parseBetMakeEvent = function parseBetMakeEvent(event) {
4649
+ var outcome = ['bigWin', 'win', 'lose', 'noImpact'][event.args.outcome];
4650
+ var amount = event.args.amount;
4651
+ var unlock = amount.mul([10, 1, 0, 0][event.args.outcome]);
4652
+ return {
4653
+ player: event.args.player,
4654
+ amount: new TokenAmount(this.plyToken, amount.toString()),
4655
+ unlockedPulpAmount: new TokenAmount(this.pulpToken, unlock.toString()),
4656
+ outcome: outcome,
4657
+ transactionHash: event.transactionHash,
4658
+ block: event.blockNumber,
4659
+ timestamp: 0
4660
+ };
4661
+ };
4662
+
4663
+ _proto.attachTimestamp = /*#__PURE__*/function () {
4664
+ var _attachTimestamp = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(results) {
4665
+ var blockNumbers, blockstimestamp;
4666
+ return runtime_1.wrap(function _callee$(_context) {
4667
+ while (1) {
4668
+ switch (_context.prev = _context.next) {
4669
+ case 0:
4670
+ blockNumbers = results.map(function (e) {
4671
+ return e.block;
4672
+ });
4673
+ _context.next = 3;
4674
+ return getBlocksTimestamp(this._networkConnection.provider, blockNumbers);
4675
+
4676
+ case 3:
4677
+ blockstimestamp = _context.sent;
4678
+ return _context.abrupt("return", results.map(function (e, i) {
4679
+ return _extends({}, e, {
4680
+ timestamp: blockstimestamp[i]
4681
+ });
4682
+ }));
4683
+
4684
+ case 5:
4685
+ case "end":
4686
+ return _context.stop();
4687
+ }
4688
+ }
4689
+ }, _callee, this);
4690
+ }));
4691
+
4692
+ function attachTimestamp(_x) {
4693
+ return _attachTimestamp.apply(this, arguments);
4694
+ }
4695
+
4696
+ return attachTimestamp;
4697
+ }()
4698
+ /**
4699
+ * Get 100 most recent bets of the market users
4700
+ */
4701
+ ;
4702
+
4703
+ _proto.getUserPlyGameHistory =
4704
+ /*#__PURE__*/
4705
+ function () {
4706
+ var _getUserPlyGameHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(user) {
4707
+ var _this2 = this;
4708
+
4709
+ var block100, filter, events;
4710
+ return runtime_1.wrap(function _callee2$(_context2) {
4711
+ while (1) {
4712
+ switch (_context2.prev = _context2.next) {
4713
+ case 0:
4714
+ _context2.next = 2;
4715
+ return this.env.plygame.getLastBlock(user, 100);
4716
+
4717
+ case 2:
4718
+ block100 = _context2.sent;
4719
+
4720
+ if (!block100.eq(0)) {
4721
+ _context2.next = 5;
4722
+ break;
4723
+ }
4724
+
4725
+ return _context2.abrupt("return", []);
4726
+
4727
+ case 5:
4728
+ filter = this.env.plygame.filters.BetMade(user);
4729
+ _context2.next = 8;
4730
+ return this.env.plygame.queryFilter(filter, block100.toNumber());
4731
+
4732
+ case 8:
4733
+ events = _context2.sent;
4734
+ return _context2.abrupt("return", this.attachTimestamp(events.map(function (event) {
4735
+ return _this2.parseBetMakeEvent(event);
4736
+ })));
4737
+
4738
+ case 10:
4739
+ case "end":
4740
+ return _context2.stop();
4741
+ }
4742
+ }
4743
+ }, _callee2, this);
4744
+ }));
4745
+
4746
+ function getUserPlyGameHistory(_x2) {
4747
+ return _getUserPlyGameHistory.apply(this, arguments);
4748
+ }
4749
+
4750
+ return getUserPlyGameHistory;
4751
+ }()
4752
+ /**
4753
+ * Get current jackpot amount
4754
+ */
4755
+ ;
4756
+
4757
+ _proto.currentJackpotAmount =
4758
+ /*#__PURE__*/
4759
+ function () {
4760
+ var _currentJackpotAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
4761
+ var jackpot;
4762
+ return runtime_1.wrap(function _callee3$(_context3) {
4763
+ while (1) {
4764
+ switch (_context3.prev = _context3.next) {
4765
+ case 0:
4766
+ _context3.next = 2;
4767
+ return this.env.plygame.currentJackpotAmount();
4768
+
4769
+ case 2:
4770
+ jackpot = _context3.sent;
4771
+ return _context3.abrupt("return", new TokenAmount(this.plyToken, jackpot.toString()));
4772
+
4773
+ case 4:
4774
+ case "end":
4775
+ return _context3.stop();
4776
+ }
4777
+ }
4778
+ }, _callee3, this);
4779
+ }));
4780
+
4781
+ function currentJackpotAmount() {
4782
+ return _currentJackpotAmount.apply(this, arguments);
4783
+ }
4784
+
4785
+ return currentJackpotAmount;
4786
+ }();
4787
+
4788
+ _proto.nextJackpotRevealTime = /*#__PURE__*/function () {
4789
+ var _nextJackpotRevealTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
4790
+ return runtime_1.wrap(function _callee4$(_context4) {
4791
+ while (1) {
4792
+ switch (_context4.prev = _context4.next) {
4793
+ case 0:
4794
+ return _context4.abrupt("return", 0);
4795
+
4796
+ case 1:
4797
+ case "end":
4798
+ return _context4.stop();
4799
+ }
4800
+ }
4801
+ }, _callee4);
4802
+ }));
4803
+
4804
+ function nextJackpotRevealTime() {
4805
+ return _nextJackpotRevealTime.apply(this, arguments);
4806
+ }
4807
+
4808
+ return nextJackpotRevealTime;
4809
+ }();
4810
+
4811
+ _proto.earlyUnlockedPulpAmount = /*#__PURE__*/function () {
4812
+ var _earlyUnlockedPulpAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
4813
+ var earlyUnlockedPulpAmount;
4814
+ return runtime_1.wrap(function _callee5$(_context5) {
4815
+ while (1) {
4816
+ switch (_context5.prev = _context5.next) {
4817
+ case 0:
4818
+ _context5.next = 2;
4819
+ return this.env.plygame.totalPlyUnlockedEarly(user);
4820
+
4821
+ case 2:
4822
+ earlyUnlockedPulpAmount = _context5.sent;
4823
+ return _context5.abrupt("return", new TokenAmount(this.pulpToken, earlyUnlockedPulpAmount.toString()));
4824
+
4825
+ case 4:
4826
+ case "end":
4827
+ return _context5.stop();
4828
+ }
4829
+ }
4830
+ }, _callee5, this);
4831
+ }));
4832
+
4833
+ function earlyUnlockedPulpAmount(_x3) {
4834
+ return _earlyUnlockedPulpAmount.apply(this, arguments);
4835
+ }
4836
+
4837
+ return earlyUnlockedPulpAmount;
4838
+ }();
4839
+
4840
+ _proto.getPlyGameResultsInTransaction = /*#__PURE__*/function () {
4841
+ var _getPlyGameResultsInTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(txHash) {
4842
+ var _this3 = this;
4843
+
4844
+ var tx, filter, betMadeEvents;
4845
+ return runtime_1.wrap(function _callee6$(_context6) {
4846
+ while (1) {
4847
+ switch (_context6.prev = _context6.next) {
4848
+ case 0:
4849
+ _context6.next = 2;
4850
+ return this._networkConnection.provider.getTransactionReceipt(txHash);
4851
+
4852
+ case 2:
4853
+ tx = _context6.sent;
4854
+ filter = this.env.plygame.filters.BetMade();
4855
+ betMadeEvents = tx.logs.filter(function (log) {
4856
+ return isSameAddress(log.topics[0], filter.topics[0]);
4857
+ }).map(function (log) {
4858
+ return _extends({}, _this3.env.plygame["interface"].parseLog(log), {
4859
+ blockNumber: tx.blockNumber,
4860
+ transactionHash: txHash
4861
+ });
4862
+ });
4863
+ return _context6.abrupt("return", this.attachTimestamp(betMadeEvents.map(function (e) {
4864
+ return _this3.parseBetMakeEvent(e);
4865
+ })));
4866
+
4867
+ case 6:
4868
+ case "end":
4869
+ return _context6.stop();
4870
+ }
4871
+ }
4872
+ }, _callee6, this);
4873
+ }));
4874
+
4875
+ function getPlyGameResultsInTransaction(_x4) {
4876
+ return _getPlyGameResultsInTransaction.apply(this, arguments);
4877
+ }
4878
+
4879
+ return getPlyGameResultsInTransaction;
4880
+ }();
4881
+
4882
+ return PlyGameRead;
4883
+ }(BlockchainEntityRead);
4884
+ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
4885
+ _inheritsLoose(PlyGameReadWrite, _PlyGameRead);
4886
+
4887
+ function PlyGameReadWrite() {
4888
+ return _PlyGameRead.apply(this, arguments) || this;
4889
+ }
4890
+
4891
+ var _proto2 = PlyGameReadWrite.prototype;
4892
+
4893
+ /**
4894
+ * makes "times" independent bets, but consecutively, of the same amount
4895
+ */
4896
+ _proto2.makeBetMultiple =
4897
+ /*#__PURE__*/
4898
+ function () {
4899
+ var _makeBetMultiple = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount, times) {
4900
+ return runtime_1.wrap(function _callee7$(_context7) {
4901
+ while (1) {
4902
+ switch (_context7.prev = _context7.next) {
4903
+ case 0:
4904
+ return _context7.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetMultiple(amount.rawAmount(), times));
4905
+
4906
+ case 1:
4907
+ case "end":
4908
+ return _context7.stop();
4909
+ }
4910
+ }
4911
+ }, _callee7, this);
4912
+ }));
4913
+
4914
+ function makeBetMultiple(_x5, _x6) {
4915
+ return _makeBetMultiple.apply(this, arguments);
4916
+ }
4917
+
4918
+ return makeBetMultiple;
4919
+ }()
4920
+ /**
4921
+ * Make a single bet
4922
+ */
4923
+ ;
4924
+
4925
+ _proto2.makeBetOnce =
4926
+ /*#__PURE__*/
4927
+ function () {
4928
+ var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
4929
+ return runtime_1.wrap(function _callee8$(_context8) {
4930
+ while (1) {
4931
+ switch (_context8.prev = _context8.next) {
4932
+ case 0:
4933
+ return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
4934
+
4935
+ case 1:
4936
+ case "end":
4937
+ return _context8.stop();
4938
+ }
4939
+ }
4940
+ }, _callee8, this);
4941
+ }));
4942
+
4943
+ function makeBetOnce(_x7) {
4944
+ return _makeBetOnce.apply(this, arguments);
4945
+ }
4946
+
4947
+ return makeBetOnce;
4948
+ }();
4949
+
4950
+ return PlyGameReadWrite;
4951
+ }(PlyGameRead);
4952
+ var PlyGame = /*#__PURE__*/function (_BlockchainEntity) {
4953
+ _inheritsLoose(PlyGame, _BlockchainEntity);
4954
+
4955
+ function PlyGame() {
4956
+ return _BlockchainEntity.call(this) || this;
4957
+ }
4958
+
4959
+ var _proto3 = PlyGame.prototype;
4960
+
4961
+ _proto3.read = function read(networkConnection) {
4962
+ return new PlyGameRead(networkConnection);
4963
+ };
4964
+
4965
+ _proto3.readWrite = function readWrite(networkConnection) {
4966
+ return new PlyGameReadWrite(networkConnection);
4967
+ };
4968
+
4969
+ return PlyGame;
4970
+ }(BlockchainEntity);
4971
+
4587
4972
  var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4588
4973
  _inheritsLoose(ReferralRead, _BlockchainEntityRead);
4589
4974
 
@@ -5391,5 +5776,5 @@ BigNumber.config({
5391
5776
  DECIMAL_PLACES: 50
5392
5777
  });
5393
5778
 
5394
- 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, 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 };
5779
+ 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, symbolRecords, validateAndParseAddress, valuateToken };
5395
5780
  //# sourceMappingURL=sdk.esm.js.map