@aurigami/sdk 1.9.6 → 1.10.0

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';
@@ -19,8 +19,8 @@ import abis$7 from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.so
19
19
  import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
20
20
  export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
21
21
  export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
22
- import { Signer } from '@ethersproject/abstract-signer';
23
22
  import axios from 'axios';
23
+ import { Signer } from '@ethersproject/abstract-signer';
24
24
 
25
25
 
26
26
 
@@ -337,160 +337,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
337
337
  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
338
  }
339
339
 
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.PRICE_ORACLE, abis.abi);
485
- }
486
-
487
- return this._oracle;
488
- }
489
- }]);
490
-
491
- return AuriEnv;
492
- }(BlockchainEntityRead);
493
-
494
340
  function createCommonjsModule(fn, module) {
495
341
  return module = { exports: {} }, fn(module, module.exports), module.exports;
496
342
  }
@@ -1630,6 +1476,185 @@ function devLog(message) {
1630
1476
  }
1631
1477
  }
1632
1478
 
1479
+ var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
1480
+ this._networkConnection = networkConnection;
1481
+ };
1482
+ var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
1483
+ _inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
1484
+
1485
+ function BlockchainEntityReadWrite(networkConnection) {
1486
+ if (!(networkConnection.signer instanceof Signer)) {
1487
+ throw Error('Signer is not provided when constructing BlockchainEntityReadWrite');
1488
+ }
1489
+
1490
+ return _BlockchainEntityRead.call(this, networkConnection) || this;
1491
+ }
1492
+
1493
+ return BlockchainEntityReadWrite;
1494
+ }(BlockchainEntityRead);
1495
+ var BlockchainEntity = /*#__PURE__*/function () {
1496
+ function BlockchainEntity() {}
1497
+
1498
+ var _proto = BlockchainEntity.prototype;
1499
+
1500
+ _proto.read = function read(networkConnection) {
1501
+ return new BlockchainEntityRead(networkConnection);
1502
+ };
1503
+
1504
+ _proto.readWrite = function readWrite(networkConnection) {
1505
+ return new BlockchainEntityReadWrite(networkConnection);
1506
+ };
1507
+
1508
+ return BlockchainEntity;
1509
+ }();
1510
+
1511
+ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1512
+ _inheritsLoose(AuriEnv, _BlockchainEntityRead);
1513
+
1514
+ function AuriEnv() {
1515
+ var _this;
1516
+
1517
+ _this = _BlockchainEntityRead.apply(this, arguments) || this;
1518
+ _this._comptroller = null;
1519
+ _this._auriFairLaunch = null;
1520
+ _this._auriLens = null;
1521
+ _this._ply = null;
1522
+ _this._pulp = null;
1523
+ _this._auriInternalLens = null;
1524
+ _this._auriAirdrop = null;
1525
+ _this._referralDirectory = null;
1526
+ _this._oracle = null;
1527
+ return _this;
1528
+ }
1529
+
1530
+ var _proto = AuriEnv.prototype;
1531
+
1532
+ _proto.getContract = function getContract(address, abi) {
1533
+ return new Contract(address, abi, this._networkConnection.provider);
1534
+ };
1535
+
1536
+ _proto.getAuTokenContracts = function getAuTokenContracts() {
1537
+ var _this2 = this;
1538
+
1539
+ return networkAddresses.auTokens.map(function (auToken) {
1540
+ var contract = _this2.getContract(auToken.address, abis$1.abi);
1541
+
1542
+ contract.underlying = auToken.underlying;
1543
+ return contract;
1544
+ });
1545
+ }
1546
+ /**
1547
+ * Get AuErc20 contract by its address or underlying name.
1548
+ *
1549
+ * Either address or underlyingName must be provided
1550
+ *
1551
+ */
1552
+ ;
1553
+
1554
+ _proto.getAuErc20Contract = function getAuErc20Contract(_ref) {
1555
+ var address = _ref.address,
1556
+ underlyingName = _ref.underlyingName;
1557
+ assert(address !== undefined || underlyingName !== undefined, 'Either address or underlyingName must be provided');
1558
+
1559
+ if (underlyingName) {
1560
+ var _networkAddresses$auT;
1561
+
1562
+ address = (_networkAddresses$auT = networkAddresses.auTokens.find(function (auToken) {
1563
+ return auToken.name == 'au' + underlyingName;
1564
+ })) == null ? void 0 : _networkAddresses$auT.address;
1565
+ console.log(address);
1566
+ assert(address !== undefined, "AuToken with underlying " + underlyingName + " not found");
1567
+ }
1568
+
1569
+ return this.getContract(address, abis$8.abi);
1570
+ };
1571
+
1572
+ _createClass(AuriEnv, [{
1573
+ key: "comptroller",
1574
+ get: function get() {
1575
+ if (!this._comptroller) {
1576
+ this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$5.abi);
1577
+ }
1578
+
1579
+ return this._comptroller;
1580
+ }
1581
+ }, {
1582
+ key: "auriFairLaunch",
1583
+ get: function get() {
1584
+ if (!this._auriFairLaunch) {
1585
+ this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$3.abi);
1586
+ }
1587
+
1588
+ return this._auriFairLaunch;
1589
+ }
1590
+ }, {
1591
+ key: "auriLens",
1592
+ get: function get() {
1593
+ if (!this._auriLens) {
1594
+ this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$4.abi);
1595
+ }
1596
+
1597
+ return this._auriLens;
1598
+ }
1599
+ }, {
1600
+ key: "ply",
1601
+ get: function get() {
1602
+ if (!this._ply) {
1603
+ this._ply = this.getContract(networkAddresses.tokens.PLY, abis$6.abi);
1604
+ }
1605
+
1606
+ return this._ply;
1607
+ }
1608
+ }, {
1609
+ key: "pulp",
1610
+ get: function get() {
1611
+ if (!this._pulp) {
1612
+ this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$c.abi);
1613
+ }
1614
+
1615
+ return this._pulp;
1616
+ }
1617
+ }, {
1618
+ key: "auriInternalLens",
1619
+ get: function get() {
1620
+ if (!this._auriInternalLens) {
1621
+ this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$d.abi);
1622
+ }
1623
+
1624
+ return this._auriInternalLens;
1625
+ }
1626
+ }, {
1627
+ key: "auriAirdrop",
1628
+ get: function get() {
1629
+ if (!this._auriAirdrop) {
1630
+ this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$2.abi);
1631
+ }
1632
+
1633
+ return this._auriAirdrop;
1634
+ }
1635
+ }, {
1636
+ key: "referralDirectory",
1637
+ get: function get() {
1638
+ if (!this._referralDirectory) {
1639
+ this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$7.abi);
1640
+ }
1641
+
1642
+ return this._referralDirectory;
1643
+ }
1644
+ }, {
1645
+ key: "oracle",
1646
+ get: function get() {
1647
+ if (!this._oracle) {
1648
+ this._oracle = this.getContract(networkAddresses.misc.oracle, abis.abi);
1649
+ }
1650
+
1651
+ return this._oracle;
1652
+ }
1653
+ }]);
1654
+
1655
+ return AuriEnv;
1656
+ }(BlockchainEntityRead);
1657
+
1633
1658
  var Token = function Token(address, decimals) {
1634
1659
  this.address = address.toLowerCase();
1635
1660
  this.decimals = decimals;