@aurigami/sdk 1.12.0-beta2 → 1.12.0-beta4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.12.0-beta2",
2
+ "version": "1.12.0-beta4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -2,9 +2,10 @@ import { TransactionResponse } from '@ethersproject/abstract-provider';
2
2
  import axios from 'axios';
3
3
  import { ethers } from 'ethers';
4
4
  import {
5
- AURORA_PLUS_API_PREFIX, referralRewardDummy1,
5
+ AURORA_PLUS_API_PREFIX,
6
+ referralRewardDummy1,
6
7
  referralRewardDummy2,
7
- REFERRAL_CAMPAIGNS
8
+ REFERRAL_CAMPAIGNS,
8
9
  } from '../consts';
9
10
  import { AuriEnv, BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
10
11
  import { getBlocksTimestamp } from '../helpers';
@@ -115,7 +116,8 @@ export class ReferralRead extends BlockchainEntityRead {
115
116
  * current number of slots under a referral code being used that exceed minimum deposit amount
116
117
  */
117
118
  public async slotsInUse(referralCode: string): Promise<number> {
118
- return 123;
119
+ let result = await AuriAPI.getApi('/referral/slotsInUse', { referralCode: referralCode });
120
+ return result;
119
121
  }
120
122
 
121
123
  public totalReferralSlots() {
@@ -128,10 +130,16 @@ export class ReferralRead extends BlockchainEntityRead {
128
130
  * not reached or withdrew too early
129
131
  */
130
132
  public async userReferralStatus(userAddr: Address): Promise<string> {
131
- if ((await this.getReferralCodeUsed(userAddr)) !== '') {
132
- return 'notQualified';
133
- } else {
134
- return 'notReferred';
133
+ let result: number = await AuriAPI.getApi('/referral/referralStatus', { address: userAddr });
134
+ switch (result) {
135
+ case -1:
136
+ return 'notReferred';
137
+ case 0:
138
+ return 'notQualified';
139
+ case 1:
140
+ return 'Qualified';
141
+ default:
142
+ return 'Withdrawn';
135
143
  }
136
144
  }
137
145
 
@@ -145,6 +153,16 @@ export class ReferralRead extends BlockchainEntityRead {
145
153
 
146
154
  return resp.data.status == 'active';
147
155
  }
156
+
157
+ public async isNewUserAtReferralTime(address: Address): Promise<boolean> {
158
+ let result: boolean = await AuriAPI.getApi('/referral/isNewUser', { address: address });
159
+ return result;
160
+ }
161
+
162
+ public async depositedMoreThanMinimumAmount(address: Address): Promise<boolean> {
163
+ let result: boolean = await AuriAPI.getApi('/referral/depositedEnough', { address: address });
164
+ return result;
165
+ }
148
166
  }
149
167
 
150
168
  export class ReferralReadWrite extends ReferralRead {