@aurigami/sdk 1.12.0-beta3 → 1.12.0-beta5

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
@@ -15,7 +15,7 @@ import abis$d from '@aurigami/contracts/artifacts/contracts/mock/AuriInternalLen
15
15
  import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
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
- import abis$7 from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
18
+ import abis$7 from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
19
19
  import abis$e from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
20
20
  import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
21
21
  export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
@@ -35,7 +35,7 @@ var index = {
35
35
  AuriLensABI: abis$4,
36
36
  ComptrollerABI: abis$5,
37
37
  EIP20InterfaceABI: abis$6,
38
- ReferralDirectoryABI: abis$7,
38
+ ReferralDirectoryV2ABI: abis$7,
39
39
  AuErc20ABI: abis$8,
40
40
  AuETHABI: abis$9,
41
41
  EthRepayHelperABI: abis$a,
@@ -110,6 +110,7 @@ var networkAddresses = {
110
110
  PULP_CONTRACT: /*#__PURE__*/'0x04ac48711bcdc45b4d223fb021e09da73c71095e'.toLowerCase(),
111
111
  PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
112
112
  REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
113
+ REFERRAL_V2: /*#__PURE__*/'0xCECd147409B2d64A9A2E5418e3E471E8af19E0bd'.toLowerCase(),
113
114
  AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
114
115
  PLYGAME: /*#__PURE__*/MAINNET_ADDRESSES.plyGame.toLowerCase()
115
116
  },
@@ -1571,7 +1572,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1571
1572
  _this._pulp = null;
1572
1573
  _this._auriInternalLens = null;
1573
1574
  _this._auriAirdrop = null;
1574
- _this._referralDirectory = null;
1575
+ _this._referralDirectoryV2 = null;
1575
1576
  _this._oracle = null;
1576
1577
  _this._plygame = null;
1577
1578
  return _this;
@@ -1682,13 +1683,13 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1682
1683
  return this._auriAirdrop;
1683
1684
  }
1684
1685
  }, {
1685
- key: "referralDirectory",
1686
+ key: "referralDirectoryV2",
1686
1687
  get: function get() {
1687
- if (!this._referralDirectory) {
1688
- this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$7.abi);
1688
+ if (!this._referralDirectoryV2) {
1689
+ this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$7.abi);
1689
1690
  }
1690
1691
 
1691
- return this._referralDirectory;
1692
+ return this._referralDirectoryV2;
1692
1693
  }
1693
1694
  }, {
1694
1695
  key: "oracle",
@@ -5110,7 +5111,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5110
5111
  switch (_context.prev = _context.next) {
5111
5112
  case 0:
5112
5113
  _context.next = 2;
5113
- return this.env.referralDirectory.userReferralCode(userAddr);
5114
+ return this.env.referralDirectoryV2.userReferralCode(userAddr);
5114
5115
 
5115
5116
  case 2:
5116
5117
  result = _context.sent;
@@ -5145,7 +5146,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5145
5146
  switch (_context2.prev = _context2.next) {
5146
5147
  case 0:
5147
5148
  _context2.next = 2;
5148
- return this.env.referralDirectory.referralCodeUsed(userAddr);
5149
+ return this.env.referralDirectoryV2.referralCodeUsed(userAddr);
5149
5150
 
5150
5151
  case 2:
5151
5152
  result = _context2.sent;
@@ -5180,7 +5181,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5180
5181
  switch (_context3.prev = _context3.next) {
5181
5182
  case 0:
5182
5183
  referralCode = ethers.utils.formatBytes32String(code);
5183
- return _context3.abrupt("return", this.env.referralDirectory.referralCodeOwner(referralCode));
5184
+ return _context3.abrupt("return", this.env.referralDirectoryV2.referralCodeOwner(referralCode));
5184
5185
 
5185
5186
  case 2:
5186
5187
  case "end":
@@ -5454,20 +5455,18 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5454
5455
  switch (_context9.prev = _context9.next) {
5455
5456
  case 0:
5456
5457
  _context9.next = 2;
5457
- return getApi('/referral/whitelisted', {
5458
- address: address
5459
- });
5458
+ return this.env.referralDirectoryV2.isUserWhitelisted(address);
5460
5459
 
5461
5460
  case 2:
5462
5461
  result = _context9.sent;
5463
- return _context9.abrupt("return", result.isWhitelisted);
5462
+ return _context9.abrupt("return", result.eq(1));
5464
5463
 
5465
5464
  case 4:
5466
5465
  case "end":
5467
5466
  return _context9.stop();
5468
5467
  }
5469
5468
  }
5470
- }, _callee9);
5469
+ }, _callee9, this);
5471
5470
  }));
5472
5471
 
5473
5472
  function isWhitelistedAddress(_x9) {
@@ -5506,6 +5505,68 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5506
5505
  return isOnAuroraPlus;
5507
5506
  }();
5508
5507
 
5508
+ _proto.isNewUserAtReferralTime = /*#__PURE__*/function () {
5509
+ var _isNewUserAtReferralTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(address) {
5510
+ var result;
5511
+ return runtime_1.wrap(function _callee11$(_context11) {
5512
+ while (1) {
5513
+ switch (_context11.prev = _context11.next) {
5514
+ case 0:
5515
+ _context11.next = 2;
5516
+ return getApi('/referral/isNewUser', {
5517
+ address: address
5518
+ });
5519
+
5520
+ case 2:
5521
+ result = _context11.sent;
5522
+ return _context11.abrupt("return", result);
5523
+
5524
+ case 4:
5525
+ case "end":
5526
+ return _context11.stop();
5527
+ }
5528
+ }
5529
+ }, _callee11);
5530
+ }));
5531
+
5532
+ function isNewUserAtReferralTime(_x11) {
5533
+ return _isNewUserAtReferralTime.apply(this, arguments);
5534
+ }
5535
+
5536
+ return isNewUserAtReferralTime;
5537
+ }();
5538
+
5539
+ _proto.depositedMoreThanMinimumAmount = /*#__PURE__*/function () {
5540
+ var _depositedMoreThanMinimumAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(address) {
5541
+ var result;
5542
+ return runtime_1.wrap(function _callee12$(_context12) {
5543
+ while (1) {
5544
+ switch (_context12.prev = _context12.next) {
5545
+ case 0:
5546
+ _context12.next = 2;
5547
+ return getApi('/referral/depositedEnough', {
5548
+ address: address
5549
+ });
5550
+
5551
+ case 2:
5552
+ result = _context12.sent;
5553
+ return _context12.abrupt("return", result);
5554
+
5555
+ case 4:
5556
+ case "end":
5557
+ return _context12.stop();
5558
+ }
5559
+ }
5560
+ }, _callee12);
5561
+ }));
5562
+
5563
+ function depositedMoreThanMinimumAmount(_x12) {
5564
+ return _depositedMoreThanMinimumAmount.apply(this, arguments);
5565
+ }
5566
+
5567
+ return depositedMoreThanMinimumAmount;
5568
+ }();
5569
+
5509
5570
  return ReferralRead;
5510
5571
  }(BlockchainEntityRead);
5511
5572
  var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
@@ -5525,21 +5586,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5525
5586
  _proto2.registerNewReferralCode =
5526
5587
  /*#__PURE__*/
5527
5588
  function () {
5528
- var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
5589
+ var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
5529
5590
  var referralCode;
5530
- return runtime_1.wrap(function _callee11$(_context11) {
5591
+ return runtime_1.wrap(function _callee13$(_context13) {
5531
5592
  while (1) {
5532
- switch (_context11.prev = _context11.next) {
5593
+ switch (_context13.prev = _context13.next) {
5533
5594
  case 0:
5534
5595
  referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
5535
- return _context11.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
5596
+ return _context13.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
5536
5597
 
5537
5598
  case 2:
5538
5599
  case "end":
5539
- return _context11.stop();
5600
+ return _context13.stop();
5540
5601
  }
5541
5602
  }
5542
- }, _callee11, this);
5603
+ }, _callee13, this);
5543
5604
  }));
5544
5605
 
5545
5606
  function registerNewReferralCode() {
@@ -5556,24 +5617,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5556
5617
  _proto2.useReferralCode =
5557
5618
  /*#__PURE__*/
5558
5619
  function () {
5559
- var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(code) {
5620
+ var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(code) {
5560
5621
  var referralCode;
5561
- return runtime_1.wrap(function _callee12$(_context12) {
5622
+ return runtime_1.wrap(function _callee14$(_context14) {
5562
5623
  while (1) {
5563
- switch (_context12.prev = _context12.next) {
5624
+ switch (_context14.prev = _context14.next) {
5564
5625
  case 0:
5565
5626
  referralCode = ethers.utils.formatBytes32String(code);
5566
- return _context12.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
5627
+ return _context14.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
5567
5628
 
5568
5629
  case 2:
5569
5630
  case "end":
5570
- return _context12.stop();
5631
+ return _context14.stop();
5571
5632
  }
5572
5633
  }
5573
- }, _callee12, this);
5634
+ }, _callee14, this);
5574
5635
  }));
5575
5636
 
5576
- function useReferralCode(_x11) {
5637
+ function useReferralCode(_x13) {
5577
5638
  return _useReferralCode.apply(this, arguments);
5578
5639
  }
5579
5640
 
@@ -5587,23 +5648,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5587
5648
  _proto2.claimReferralRewards =
5588
5649
  /*#__PURE__*/
5589
5650
  function () {
5590
- var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
5651
+ var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
5591
5652
  var unclaimedRewards, campaigns, tokens;
5592
- return runtime_1.wrap(function _callee13$(_context13) {
5653
+ return runtime_1.wrap(function _callee15$(_context15) {
5593
5654
  while (1) {
5594
- switch (_context13.prev = _context13.next) {
5655
+ switch (_context15.prev = _context15.next) {
5595
5656
  case 0:
5596
- _context13.t0 = this;
5597
- _context13.next = 3;
5657
+ _context15.t0 = this;
5658
+ _context15.next = 3;
5598
5659
  return this._networkConnection.signer.getAddress();
5599
5660
 
5600
5661
  case 3:
5601
- _context13.t1 = _context13.sent;
5602
- _context13.next = 6;
5603
- return _context13.t0.referralRewards.call(_context13.t0, _context13.t1);
5662
+ _context15.t1 = _context15.sent;
5663
+ _context15.next = 6;
5664
+ return _context15.t0.referralRewards.call(_context15.t0, _context15.t1);
5604
5665
 
5605
5666
  case 6:
5606
- unclaimedRewards = _context13.sent.filter(function (reward) {
5667
+ unclaimedRewards = _context15.sent.filter(function (reward) {
5607
5668
  return reward.transactionHash == null;
5608
5669
  });
5609
5670
  campaigns = unclaimedRewards.map(function (reward) {
@@ -5612,14 +5673,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
5612
5673
  tokens = unclaimedRewards.map(function (reward) {
5613
5674
  return reward.rewardTokenAmount.token.address;
5614
5675
  });
5615
- return _context13.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
5676
+ return _context15.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
5616
5677
 
5617
5678
  case 10:
5618
5679
  case "end":
5619
- return _context13.stop();
5680
+ return _context15.stop();
5620
5681
  }
5621
5682
  }
5622
- }, _callee13, this);
5683
+ }, _callee15, this);
5623
5684
  }));
5624
5685
 
5625
5686
  function claimReferralRewards() {