@aurigami/sdk 1.7.9-dummy → 1.8.1

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.
@@ -37,3 +37,9 @@ export declare const BORROW_NEAR_REWARDS_PER_WEEK: {
37
37
  export declare const HARDCODE_PRICE_TOKENS: {
38
38
  [k: string]: string;
39
39
  };
40
+ export declare const REFERRAL_CAMPAIGNS: {
41
+ [k: string]: {
42
+ start: number;
43
+ end: number;
44
+ };
45
+ };
@@ -37,7 +37,7 @@ export declare class ReferralRead extends BlockchainEntityRead {
37
37
  /**
38
38
  * Top 50 reward earners from the last round, sorted by token amount
39
39
  */
40
- leaderboard(): Promise<ReferralReward[]>;
40
+ leaderboard(campaign: string): Promise<ReferralReward[]>;
41
41
  }
42
42
  export declare class ReferralReadWrite extends ReferralRead {
43
43
  /**
@@ -7,5 +7,6 @@ export declare class TokenAmount {
7
7
  formattedAmount(): string;
8
8
  formattedAmountWithSymbol(): string;
9
9
  rawAmount(): string;
10
+ compare(other: TokenAmount): number;
10
11
  static fromAddressAndAmount(tokenAddress: Address, amount: string, isRaw?: boolean): TokenAmount;
11
12
  }
@@ -160,6 +160,13 @@ Object.entries({
160
160
  var BORROW_NEAR_REWARDS_PER_WEEK = {// currently 0 for all markets
161
161
  };
162
162
  var HARDCODE_PRICE_TOKENS = /*#__PURE__*/Object.fromEntries([[/*#__PURE__*/networkAddresses.tokens.USN.toLowerCase(), '1']]);
163
+ var REFERRAL_CAMPAIGNS = /*#__PURE__*/Object.fromEntries([['referral-2505', {
164
+ start: 1652882400,
165
+ end: 1653487199
166
+ }], ['referrer-2505', {
167
+ start: 1652882400,
168
+ end: 1653487199
169
+ }]]);
163
170
 
164
171
  var decimalRecords = {
165
172
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -1633,6 +1640,10 @@ var TokenAmount = /*#__PURE__*/function () {
1633
1640
  return this.rawAmnt;
1634
1641
  };
1635
1642
 
1643
+ _proto.compare = function compare(other) {
1644
+ return new BigNumber(this.rawAmnt).comparedTo(new BigNumber(other.rawAmnt));
1645
+ };
1646
+
1636
1647
  TokenAmount.fromAddressAndAmount = function fromAddressAndAmount(tokenAddress, amount, isRaw) {
1637
1648
  if (isRaw === void 0) {
1638
1649
  isRaw = true;
@@ -4668,13 +4679,32 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4668
4679
  /*#__PURE__*/
4669
4680
  function () {
4670
4681
  var _referralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(userAddr) {
4682
+ var result, items;
4671
4683
  return runtime_1.wrap(function _callee5$(_context5) {
4672
4684
  while (1) {
4673
4685
  switch (_context5.prev = _context5.next) {
4674
4686
  case 0:
4675
- return _context5.abrupt("return", [referralRewardDummy1, referralRewardDummy2]);
4687
+ _context5.next = 2;
4688
+ return getPaginatedApi('/referral/rewards', {
4689
+ address: userAddr
4690
+ });
4676
4691
 
4677
- case 1:
4692
+ case 2:
4693
+ result = _context5.sent;
4694
+ items = result.items.map(function (item, i) {
4695
+ return {
4696
+ campaign: item.campaign,
4697
+ userAddr: userAddr,
4698
+ isReferrer: item.campaign.includes('referrer'),
4699
+ rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
4700
+ startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
4701
+ endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
4702
+ transactionHash: item == null ? void 0 : item.transactionHash
4703
+ };
4704
+ });
4705
+ return _context5.abrupt("return", items);
4706
+
4707
+ case 5:
4678
4708
  case "end":
4679
4709
  return _context5.stop();
4680
4710
  }
@@ -4696,14 +4726,36 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4696
4726
  _proto.leaderboard =
4697
4727
  /*#__PURE__*/
4698
4728
  function () {
4699
- var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
4729
+ var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(campaign) {
4730
+ var result, items;
4700
4731
  return runtime_1.wrap(function _callee6$(_context6) {
4701
4732
  while (1) {
4702
4733
  switch (_context6.prev = _context6.next) {
4703
4734
  case 0:
4704
- return _context6.abrupt("return", [referralRewardDummy2, referralRewardDummy1]);
4735
+ _context6.next = 2;
4736
+ return getPaginatedApi('/referral/leaderboard', {
4737
+ campaign: campaign
4738
+ });
4705
4739
 
4706
- case 1:
4740
+ case 2:
4741
+ result = _context6.sent;
4742
+ items = result.items.map(function (item, i) {
4743
+ return {
4744
+ campaign: campaign,
4745
+ userAddr: item.user,
4746
+ isReferrer: item.campaign.includes('referrer'),
4747
+ rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
4748
+ startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
4749
+ endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
4750
+ transactionHash: null
4751
+ };
4752
+ });
4753
+ items.sort(function (a, b) {
4754
+ return b.rewardTokenAmount.compare(a.rewardTokenAmount);
4755
+ });
4756
+ return _context6.abrupt("return", items);
4757
+
4758
+ case 6:
4707
4759
  case "end":
4708
4760
  return _context6.stop();
4709
4761
  }
@@ -4711,7 +4763,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4711
4763
  }, _callee6);
4712
4764
  }));
4713
4765
 
4714
- function leaderboard() {
4766
+ function leaderboard(_x6) {
4715
4767
  return _leaderboard.apply(this, arguments);
4716
4768
  }
4717
4769
 
@@ -4785,7 +4837,7 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
4785
4837
  }, _callee8, this);
4786
4838
  }));
4787
4839
 
4788
- function useReferralCode(_x6) {
4840
+ function useReferralCode(_x7) {
4789
4841
  return _useReferralCode.apply(this, arguments);
4790
4842
  }
4791
4843
 
@@ -5308,6 +5360,7 @@ exports.PRICE_WHITELISTED = PRICE_WHITELISTED;
5308
5360
  exports.Papermill = Papermill;
5309
5361
  exports.PapermillRead = PapermillRead;
5310
5362
  exports.PapermillReadWrite = PapermillReadWrite;
5363
+ exports.REFERRAL_CAMPAIGNS = REFERRAL_CAMPAIGNS;
5311
5364
  exports.REWARD_CLAIM_START = REWARD_CLAIM_START;
5312
5365
  exports.Referral = Referral;
5313
5366
  exports.ReferralRead = ReferralRead;