@aurigami/sdk 1.12.0 → 1.12.1-beta1
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 -2
- package/dist/entities/auriEnv.d.ts +3 -3
- package/dist/sdk.cjs.development.js +18 -25
- 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 +18 -25
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/abis/index.ts +2 -2
- package/src/consts/constants.ts +1 -0
- package/src/entities/auriEnv.ts +8 -8
- package/src/interactors/Referral.ts +11 -11
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.12.
|
|
2
|
+
"version": "1.12.1-beta1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "^4.5.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aurigami/contracts": "3.
|
|
65
|
+
"@aurigami/contracts": "3.11.3",
|
|
66
66
|
"axios": "^0.26.1",
|
|
67
67
|
"bignumber.js": "^9.0.2",
|
|
68
68
|
"ethers": "^5.6.4"
|
package/src/abis/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import AuriInternalLensABI from '@aurigami/contracts/artifacts/contracts/mock/Au
|
|
|
13
13
|
import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
|
|
14
14
|
import Multicall2ABI from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
|
|
15
15
|
import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
16
|
-
import
|
|
16
|
+
import ReferralDirectoryV2ABI from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
|
|
17
17
|
import PlyGameABI from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
|
|
18
18
|
export {
|
|
19
19
|
AuriOracleABI,
|
|
@@ -25,7 +25,7 @@ export {
|
|
|
25
25
|
ComptrollerABI,
|
|
26
26
|
// FaucetABI,
|
|
27
27
|
EIP20InterfaceABI,
|
|
28
|
-
|
|
28
|
+
ReferralDirectoryV2ABI,
|
|
29
29
|
AuErc20ABI,
|
|
30
30
|
AuETHABI,
|
|
31
31
|
EthRepayHelperABI,
|
package/src/consts/constants.ts
CHANGED
|
@@ -91,6 +91,7 @@ export const networkAddresses: NetworkAddresses = {
|
|
|
91
91
|
PULP_CONTRACT: '0x04ac48711bcdc45b4d223fb021e09da73c71095e'.toLowerCase(),
|
|
92
92
|
PLY_TOKEN_LOCK: MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
|
|
93
93
|
REFERRAL: MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
|
|
94
|
+
REFERRAL_V2: '0xCECd147409B2d64A9A2E5418e3E471E8af19E0bd'.toLowerCase(),
|
|
94
95
|
AURI_INTERNAL_LENS: MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
|
|
95
96
|
PLYGAME: MAINNET_ADDRESSES.plyGame.toLowerCase(),
|
|
96
97
|
},
|
package/src/entities/auriEnv.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
IERC20,
|
|
10
10
|
PlyGame,
|
|
11
11
|
PULP,
|
|
12
|
-
|
|
12
|
+
ReferralDirectoryV2,
|
|
13
13
|
} from '@aurigami/contracts/typechain';
|
|
14
14
|
import { Contract } from 'ethers';
|
|
15
15
|
import { assert } from '../helpers/helpers';
|
|
@@ -26,7 +26,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
26
26
|
private _pulp: PULP | null = null;
|
|
27
27
|
private _auriInternalLens: AuriInternalLens | null = null;
|
|
28
28
|
private _auriAirdrop: AuriAirdrop | null = null;
|
|
29
|
-
private
|
|
29
|
+
private _referralDirectoryV2: ReferralDirectoryV2 | null = null;
|
|
30
30
|
private _oracle: AuriOracle | null = null;
|
|
31
31
|
private _plygame: PlyGame | null = null;
|
|
32
32
|
|
|
@@ -137,14 +137,14 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
137
137
|
return this._auriAirdrop;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
get
|
|
141
|
-
if (!this.
|
|
142
|
-
this.
|
|
143
|
-
networkAddresses.misc.
|
|
144
|
-
abis.
|
|
140
|
+
get referralDirectoryV2(): ReferralDirectoryV2 {
|
|
141
|
+
if (!this._referralDirectoryV2) {
|
|
142
|
+
this._referralDirectoryV2 = this.getContract<ReferralDirectoryV2>(
|
|
143
|
+
networkAddresses.misc.REFERRAL_V2,
|
|
144
|
+
abis.ReferralDirectoryV2ABI.abi
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
|
-
return this.
|
|
147
|
+
return this._referralDirectoryV2;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
get oracle(): AuriOracle {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
2
|
-
import axios from 'axios';
|
|
3
2
|
import { ethers } from 'ethers';
|
|
4
|
-
import {
|
|
3
|
+
import { REFERRAL_CAMPAIGNS } from '../consts';
|
|
5
4
|
import { AuriEnv, BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
|
|
6
5
|
import { getBlocksTimestamp } from '../helpers';
|
|
7
6
|
import * as AuriAPI from '../helpers/aurigami-api';
|
|
@@ -34,7 +33,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
34
33
|
* Called to check if a user has a referral code.
|
|
35
34
|
*/
|
|
36
35
|
public async getUserReferralCode(userAddr: Address): Promise<string> {
|
|
37
|
-
const result = await this.env.
|
|
36
|
+
const result = await this.env.referralDirectoryV2.userReferralCode(userAddr);
|
|
38
37
|
return ethers.utils.parseBytes32String(result);
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -42,7 +41,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
42
41
|
* Get referral code that a user was referred by, returns empty string if not found.
|
|
43
42
|
*/
|
|
44
43
|
public async getReferralCodeUsed(userAddr: Address): Promise<string> {
|
|
45
|
-
const result = await this.env.
|
|
44
|
+
const result = await this.env.referralDirectoryV2.referralCodeUsed(userAddr);
|
|
46
45
|
return ethers.utils.parseBytes32String(result);
|
|
47
46
|
}
|
|
48
47
|
|
|
@@ -51,7 +50,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
51
50
|
*/
|
|
52
51
|
public async getReferralCodeOwner(code: string): Promise<Address> {
|
|
53
52
|
const referralCode = ethers.utils.formatBytes32String(code);
|
|
54
|
-
return this.env.
|
|
53
|
+
return this.env.referralDirectoryV2.referralCodeOwner(referralCode);
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/**
|
|
@@ -138,14 +137,15 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
public async isWhitelistedAddress(address: Address): Promise<boolean> {
|
|
141
|
-
let result = await
|
|
142
|
-
return result.
|
|
140
|
+
let result = await this.env.referralDirectoryV2.isUserWhitelisted(address);
|
|
141
|
+
return result.eq(1);
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
public async isOnAuroraPlus(address: Address): Promise<boolean> {
|
|
146
|
-
|
|
145
|
+
return true;
|
|
146
|
+
// let resp = await axios.get(AURORA_PLUS_API_PREFIX + address);
|
|
147
147
|
|
|
148
|
-
return resp.data.status == 'active';
|
|
148
|
+
// return resp.data.status == 'active';
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
public async isNewUserAtReferralTime(address: Address): Promise<boolean> {
|
|
@@ -167,7 +167,7 @@ export class ReferralReadWrite extends ReferralRead {
|
|
|
167
167
|
*/
|
|
168
168
|
public async registerNewReferralCode(): Promise<TransactionResponse> {
|
|
169
169
|
const referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
170
|
-
return this.env.
|
|
170
|
+
return this.env.referralDirectoryV2
|
|
171
171
|
.connect(this._networkConnection.signer!)
|
|
172
172
|
.registerNewUserReferralCode(referralCode);
|
|
173
173
|
}
|
|
@@ -177,7 +177,7 @@ export class ReferralReadWrite extends ReferralRead {
|
|
|
177
177
|
*/
|
|
178
178
|
public async useReferralCode(code: string): Promise<TransactionResponse> {
|
|
179
179
|
const referralCode = ethers.utils.formatBytes32String(code);
|
|
180
|
-
return this.env.
|
|
180
|
+
return this.env.referralDirectoryV2
|
|
181
181
|
.connect(this._networkConnection.signer!)
|
|
182
182
|
.registerReferralCodeUsed(referralCode);
|
|
183
183
|
}
|