@aurigami/sdk 1.12.0-beta4 → 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/abis/index.d.ts +2 -2
- package/dist/entities/auriEnv.d.ts +3 -3
- package/dist/sdk.cjs.development.js +16 -17
- 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 +16 -17
- 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 +7 -7
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.12.0-
|
|
2
|
+
"version": "1.12.0-beta5",
|
|
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 {
|
|
@@ -39,7 +39,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
39
39
|
* Called to check if a user has a referral code.
|
|
40
40
|
*/
|
|
41
41
|
public async getUserReferralCode(userAddr: Address): Promise<string> {
|
|
42
|
-
const result = await this.env.
|
|
42
|
+
const result = await this.env.referralDirectoryV2.userReferralCode(userAddr);
|
|
43
43
|
return ethers.utils.parseBytes32String(result);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
47
47
|
* Get referral code that a user was referred by, returns empty string if not found.
|
|
48
48
|
*/
|
|
49
49
|
public async getReferralCodeUsed(userAddr: Address): Promise<string> {
|
|
50
|
-
const result = await this.env.
|
|
50
|
+
const result = await this.env.referralDirectoryV2.referralCodeUsed(userAddr);
|
|
51
51
|
return ethers.utils.parseBytes32String(result);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -56,7 +56,7 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
56
56
|
*/
|
|
57
57
|
public async getReferralCodeOwner(code: string): Promise<Address> {
|
|
58
58
|
const referralCode = ethers.utils.formatBytes32String(code);
|
|
59
|
-
return this.env.
|
|
59
|
+
return this.env.referralDirectoryV2.referralCodeOwner(referralCode);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -144,8 +144,8 @@ export class ReferralRead extends BlockchainEntityRead {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
public async isWhitelistedAddress(address: Address): Promise<boolean> {
|
|
147
|
-
let result = await
|
|
148
|
-
return result.
|
|
147
|
+
let result = await this.env.referralDirectoryV2.isUserWhitelisted(address);
|
|
148
|
+
return result.eq(1);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
public async isOnAuroraPlus(address: Address): Promise<boolean> {
|
|
@@ -173,7 +173,7 @@ export class ReferralReadWrite extends ReferralRead {
|
|
|
173
173
|
*/
|
|
174
174
|
public async registerNewReferralCode(): Promise<TransactionResponse> {
|
|
175
175
|
const referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
176
|
-
return this.env.
|
|
176
|
+
return this.env.referralDirectoryV2
|
|
177
177
|
.connect(this._networkConnection.signer!)
|
|
178
178
|
.registerNewUserReferralCode(referralCode);
|
|
179
179
|
}
|
|
@@ -183,7 +183,7 @@ export class ReferralReadWrite extends ReferralRead {
|
|
|
183
183
|
*/
|
|
184
184
|
public async useReferralCode(code: string): Promise<TransactionResponse> {
|
|
185
185
|
const referralCode = ethers.utils.formatBytes32String(code);
|
|
186
|
-
return this.env.
|
|
186
|
+
return this.env.referralDirectoryV2
|
|
187
187
|
.connect(this._networkConnection.signer!)
|
|
188
188
|
.registerReferralCodeUsed(referralCode);
|
|
189
189
|
}
|