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