@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/abis/index.d.ts +2 -2
- package/dist/entities/auriEnv.d.ts +3 -3
- package/dist/interactors/Referral.d.ts +2 -0
- package/dist/sdk.cjs.development.js +101 -40
- 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 +101 -40
- 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 +17 -7
package/dist/abis/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ import AuriInternalLensABI from '@aurigami/contracts/artifacts/contracts/mock/Au
|
|
|
12
12
|
import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
|
|
13
13
|
import Multicall2ABI from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
|
|
14
14
|
import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
15
|
-
import
|
|
15
|
+
import ReferralDirectoryV2ABI from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
|
|
16
16
|
import PlyGameABI from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
|
|
17
|
-
export { AuriOracleABI, AuTokenABI, IUniswapV2PairABI, AuriAirdropABI, AuriFairLaunchABI, AuriLensABI, ComptrollerABI, EIP20InterfaceABI,
|
|
17
|
+
export { AuriOracleABI, AuTokenABI, IUniswapV2PairABI, AuriAirdropABI, AuriFairLaunchABI, AuriLensABI, ComptrollerABI, EIP20InterfaceABI, ReferralDirectoryV2ABI, AuErc20ABI, AuETHABI, EthRepayHelperABI, Multicall2ABI, PulpABI, AuriInternalLensABI, PlyGameABI, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuErc20, AuriAirdrop, AuriFairLaunch, AuriInternalLens, AuriLens, AuriOracle, Comptroller, IERC20, PlyGame, PULP,
|
|
1
|
+
import { AuErc20, AuriAirdrop, AuriFairLaunch, AuriInternalLens, AuriLens, AuriOracle, Comptroller, IERC20, PlyGame, PULP, ReferralDirectoryV2 } from '@aurigami/contracts/typechain';
|
|
2
2
|
import { Contract } from 'ethers';
|
|
3
3
|
import { AuTokenWithUnderlying } from '../types';
|
|
4
4
|
import { BlockchainEntityRead } from './BlockchainEntity';
|
|
@@ -10,7 +10,7 @@ export declare class AuriEnv extends BlockchainEntityRead {
|
|
|
10
10
|
private _pulp;
|
|
11
11
|
private _auriInternalLens;
|
|
12
12
|
private _auriAirdrop;
|
|
13
|
-
private
|
|
13
|
+
private _referralDirectoryV2;
|
|
14
14
|
private _oracle;
|
|
15
15
|
private _plygame;
|
|
16
16
|
getContract<CType extends Contract>(address: string, abi: any): CType;
|
|
@@ -32,7 +32,7 @@ export declare class AuriEnv extends BlockchainEntityRead {
|
|
|
32
32
|
get pulp(): PULP;
|
|
33
33
|
get auriInternalLens(): AuriInternalLens;
|
|
34
34
|
get auriAirdrop(): AuriAirdrop;
|
|
35
|
-
get
|
|
35
|
+
get referralDirectoryV2(): ReferralDirectoryV2;
|
|
36
36
|
get oracle(): AuriOracle;
|
|
37
37
|
get plygame(): PlyGame;
|
|
38
38
|
}
|
|
@@ -51,6 +51,8 @@ export declare class ReferralRead extends BlockchainEntityRead {
|
|
|
51
51
|
userReferralStatus(userAddr: Address): Promise<string>;
|
|
52
52
|
isWhitelistedAddress(address: Address): Promise<boolean>;
|
|
53
53
|
isOnAuroraPlus(address: Address): Promise<boolean>;
|
|
54
|
+
isNewUserAtReferralTime(address: Address): Promise<boolean>;
|
|
55
|
+
depositedMoreThanMinimumAmount(address: Address): Promise<boolean>;
|
|
54
56
|
}
|
|
55
57
|
export declare class ReferralReadWrite extends ReferralRead {
|
|
56
58
|
/**
|
|
@@ -21,7 +21,7 @@ var abis$a = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mo
|
|
|
21
21
|
var IUniswapV2PairABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json'));
|
|
22
22
|
var abis$b = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json'));
|
|
23
23
|
var abis$c = _interopDefault(require('@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json'));
|
|
24
|
-
var abis$d = _interopDefault(require('@aurigami/contracts/artifacts/contracts/
|
|
24
|
+
var abis$d = _interopDefault(require('@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json'));
|
|
25
25
|
var abis$e = _interopDefault(require('@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json'));
|
|
26
26
|
var MAINNET_ADDRESSES = _interopDefault(require('@aurigami/contracts/deployments/aurora_mainnet.json'));
|
|
27
27
|
var aurora_testnet_json = _interopDefault(require('@aurigami/contracts/deployments/aurora_testnet.json'));
|
|
@@ -40,7 +40,7 @@ var index = {
|
|
|
40
40
|
AuriLensABI: abis$4,
|
|
41
41
|
ComptrollerABI: abis$7,
|
|
42
42
|
EIP20InterfaceABI: abis$9,
|
|
43
|
-
|
|
43
|
+
ReferralDirectoryV2ABI: abis$d,
|
|
44
44
|
AuErc20ABI: abis,
|
|
45
45
|
AuETHABI: abis$1,
|
|
46
46
|
EthRepayHelperABI: abis$8,
|
|
@@ -115,6 +115,7 @@ var networkAddresses = {
|
|
|
115
115
|
PULP_CONTRACT: /*#__PURE__*/'0x04ac48711bcdc45b4d223fb021e09da73c71095e'.toLowerCase(),
|
|
116
116
|
PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
|
|
117
117
|
REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLowerCase(),
|
|
118
|
+
REFERRAL_V2: /*#__PURE__*/'0xCECd147409B2d64A9A2E5418e3E471E8af19E0bd'.toLowerCase(),
|
|
118
119
|
AURI_INTERNAL_LENS: /*#__PURE__*/MAINNET_ADDRESSES.auriInternalLens.toLowerCase(),
|
|
119
120
|
PLYGAME: /*#__PURE__*/MAINNET_ADDRESSES.plyGame.toLowerCase()
|
|
120
121
|
},
|
|
@@ -1576,7 +1577,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1576
1577
|
_this._pulp = null;
|
|
1577
1578
|
_this._auriInternalLens = null;
|
|
1578
1579
|
_this._auriAirdrop = null;
|
|
1579
|
-
_this.
|
|
1580
|
+
_this._referralDirectoryV2 = null;
|
|
1580
1581
|
_this._oracle = null;
|
|
1581
1582
|
_this._plygame = null;
|
|
1582
1583
|
return _this;
|
|
@@ -1687,13 +1688,13 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1687
1688
|
return this._auriAirdrop;
|
|
1688
1689
|
}
|
|
1689
1690
|
}, {
|
|
1690
|
-
key: "
|
|
1691
|
+
key: "referralDirectoryV2",
|
|
1691
1692
|
get: function get() {
|
|
1692
|
-
if (!this.
|
|
1693
|
-
this.
|
|
1693
|
+
if (!this._referralDirectoryV2) {
|
|
1694
|
+
this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$d.abi);
|
|
1694
1695
|
}
|
|
1695
1696
|
|
|
1696
|
-
return this.
|
|
1697
|
+
return this._referralDirectoryV2;
|
|
1697
1698
|
}
|
|
1698
1699
|
}, {
|
|
1699
1700
|
key: "oracle",
|
|
@@ -5111,7 +5112,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5111
5112
|
switch (_context.prev = _context.next) {
|
|
5112
5113
|
case 0:
|
|
5113
5114
|
_context.next = 2;
|
|
5114
|
-
return this.env.
|
|
5115
|
+
return this.env.referralDirectoryV2.userReferralCode(userAddr);
|
|
5115
5116
|
|
|
5116
5117
|
case 2:
|
|
5117
5118
|
result = _context.sent;
|
|
@@ -5146,7 +5147,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5146
5147
|
switch (_context2.prev = _context2.next) {
|
|
5147
5148
|
case 0:
|
|
5148
5149
|
_context2.next = 2;
|
|
5149
|
-
return this.env.
|
|
5150
|
+
return this.env.referralDirectoryV2.referralCodeUsed(userAddr);
|
|
5150
5151
|
|
|
5151
5152
|
case 2:
|
|
5152
5153
|
result = _context2.sent;
|
|
@@ -5181,7 +5182,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5181
5182
|
switch (_context3.prev = _context3.next) {
|
|
5182
5183
|
case 0:
|
|
5183
5184
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
5184
|
-
return _context3.abrupt("return", this.env.
|
|
5185
|
+
return _context3.abrupt("return", this.env.referralDirectoryV2.referralCodeOwner(referralCode));
|
|
5185
5186
|
|
|
5186
5187
|
case 2:
|
|
5187
5188
|
case "end":
|
|
@@ -5455,20 +5456,18 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5455
5456
|
switch (_context9.prev = _context9.next) {
|
|
5456
5457
|
case 0:
|
|
5457
5458
|
_context9.next = 2;
|
|
5458
|
-
return
|
|
5459
|
-
address: address
|
|
5460
|
-
});
|
|
5459
|
+
return this.env.referralDirectoryV2.isUserWhitelisted(address);
|
|
5461
5460
|
|
|
5462
5461
|
case 2:
|
|
5463
5462
|
result = _context9.sent;
|
|
5464
|
-
return _context9.abrupt("return", result.
|
|
5463
|
+
return _context9.abrupt("return", result.eq(1));
|
|
5465
5464
|
|
|
5466
5465
|
case 4:
|
|
5467
5466
|
case "end":
|
|
5468
5467
|
return _context9.stop();
|
|
5469
5468
|
}
|
|
5470
5469
|
}
|
|
5471
|
-
}, _callee9);
|
|
5470
|
+
}, _callee9, this);
|
|
5472
5471
|
}));
|
|
5473
5472
|
|
|
5474
5473
|
function isWhitelistedAddress(_x9) {
|
|
@@ -5507,6 +5506,68 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5507
5506
|
return isOnAuroraPlus;
|
|
5508
5507
|
}();
|
|
5509
5508
|
|
|
5509
|
+
_proto.isNewUserAtReferralTime = /*#__PURE__*/function () {
|
|
5510
|
+
var _isNewUserAtReferralTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(address) {
|
|
5511
|
+
var result;
|
|
5512
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5513
|
+
while (1) {
|
|
5514
|
+
switch (_context11.prev = _context11.next) {
|
|
5515
|
+
case 0:
|
|
5516
|
+
_context11.next = 2;
|
|
5517
|
+
return getApi('/referral/isNewUser', {
|
|
5518
|
+
address: address
|
|
5519
|
+
});
|
|
5520
|
+
|
|
5521
|
+
case 2:
|
|
5522
|
+
result = _context11.sent;
|
|
5523
|
+
return _context11.abrupt("return", result);
|
|
5524
|
+
|
|
5525
|
+
case 4:
|
|
5526
|
+
case "end":
|
|
5527
|
+
return _context11.stop();
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
}, _callee11);
|
|
5531
|
+
}));
|
|
5532
|
+
|
|
5533
|
+
function isNewUserAtReferralTime(_x11) {
|
|
5534
|
+
return _isNewUserAtReferralTime.apply(this, arguments);
|
|
5535
|
+
}
|
|
5536
|
+
|
|
5537
|
+
return isNewUserAtReferralTime;
|
|
5538
|
+
}();
|
|
5539
|
+
|
|
5540
|
+
_proto.depositedMoreThanMinimumAmount = /*#__PURE__*/function () {
|
|
5541
|
+
var _depositedMoreThanMinimumAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(address) {
|
|
5542
|
+
var result;
|
|
5543
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
5544
|
+
while (1) {
|
|
5545
|
+
switch (_context12.prev = _context12.next) {
|
|
5546
|
+
case 0:
|
|
5547
|
+
_context12.next = 2;
|
|
5548
|
+
return getApi('/referral/depositedEnough', {
|
|
5549
|
+
address: address
|
|
5550
|
+
});
|
|
5551
|
+
|
|
5552
|
+
case 2:
|
|
5553
|
+
result = _context12.sent;
|
|
5554
|
+
return _context12.abrupt("return", result);
|
|
5555
|
+
|
|
5556
|
+
case 4:
|
|
5557
|
+
case "end":
|
|
5558
|
+
return _context12.stop();
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
}, _callee12);
|
|
5562
|
+
}));
|
|
5563
|
+
|
|
5564
|
+
function depositedMoreThanMinimumAmount(_x12) {
|
|
5565
|
+
return _depositedMoreThanMinimumAmount.apply(this, arguments);
|
|
5566
|
+
}
|
|
5567
|
+
|
|
5568
|
+
return depositedMoreThanMinimumAmount;
|
|
5569
|
+
}();
|
|
5570
|
+
|
|
5510
5571
|
return ReferralRead;
|
|
5511
5572
|
}(BlockchainEntityRead);
|
|
5512
5573
|
var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
@@ -5526,21 +5587,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5526
5587
|
_proto2.registerNewReferralCode =
|
|
5527
5588
|
/*#__PURE__*/
|
|
5528
5589
|
function () {
|
|
5529
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5590
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
|
|
5530
5591
|
var referralCode;
|
|
5531
|
-
return runtime_1.wrap(function
|
|
5592
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
5532
5593
|
while (1) {
|
|
5533
|
-
switch (
|
|
5594
|
+
switch (_context13.prev = _context13.next) {
|
|
5534
5595
|
case 0:
|
|
5535
5596
|
referralCode = ethers.ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5536
|
-
return
|
|
5597
|
+
return _context13.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5537
5598
|
|
|
5538
5599
|
case 2:
|
|
5539
5600
|
case "end":
|
|
5540
|
-
return
|
|
5601
|
+
return _context13.stop();
|
|
5541
5602
|
}
|
|
5542
5603
|
}
|
|
5543
|
-
},
|
|
5604
|
+
}, _callee13, this);
|
|
5544
5605
|
}));
|
|
5545
5606
|
|
|
5546
5607
|
function registerNewReferralCode() {
|
|
@@ -5557,24 +5618,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5557
5618
|
_proto2.useReferralCode =
|
|
5558
5619
|
/*#__PURE__*/
|
|
5559
5620
|
function () {
|
|
5560
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5621
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(code) {
|
|
5561
5622
|
var referralCode;
|
|
5562
|
-
return runtime_1.wrap(function
|
|
5623
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
5563
5624
|
while (1) {
|
|
5564
|
-
switch (
|
|
5625
|
+
switch (_context14.prev = _context14.next) {
|
|
5565
5626
|
case 0:
|
|
5566
5627
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
5567
|
-
return
|
|
5628
|
+
return _context14.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5568
5629
|
|
|
5569
5630
|
case 2:
|
|
5570
5631
|
case "end":
|
|
5571
|
-
return
|
|
5632
|
+
return _context14.stop();
|
|
5572
5633
|
}
|
|
5573
5634
|
}
|
|
5574
|
-
},
|
|
5635
|
+
}, _callee14, this);
|
|
5575
5636
|
}));
|
|
5576
5637
|
|
|
5577
|
-
function useReferralCode(
|
|
5638
|
+
function useReferralCode(_x13) {
|
|
5578
5639
|
return _useReferralCode.apply(this, arguments);
|
|
5579
5640
|
}
|
|
5580
5641
|
|
|
@@ -5588,23 +5649,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5588
5649
|
_proto2.claimReferralRewards =
|
|
5589
5650
|
/*#__PURE__*/
|
|
5590
5651
|
function () {
|
|
5591
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5652
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
5592
5653
|
var unclaimedRewards, campaigns, tokens;
|
|
5593
|
-
return runtime_1.wrap(function
|
|
5654
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
5594
5655
|
while (1) {
|
|
5595
|
-
switch (
|
|
5656
|
+
switch (_context15.prev = _context15.next) {
|
|
5596
5657
|
case 0:
|
|
5597
|
-
|
|
5598
|
-
|
|
5658
|
+
_context15.t0 = this;
|
|
5659
|
+
_context15.next = 3;
|
|
5599
5660
|
return this._networkConnection.signer.getAddress();
|
|
5600
5661
|
|
|
5601
5662
|
case 3:
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
return
|
|
5663
|
+
_context15.t1 = _context15.sent;
|
|
5664
|
+
_context15.next = 6;
|
|
5665
|
+
return _context15.t0.referralRewards.call(_context15.t0, _context15.t1);
|
|
5605
5666
|
|
|
5606
5667
|
case 6:
|
|
5607
|
-
unclaimedRewards =
|
|
5668
|
+
unclaimedRewards = _context15.sent.filter(function (reward) {
|
|
5608
5669
|
return reward.transactionHash == null;
|
|
5609
5670
|
});
|
|
5610
5671
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5613,14 +5674,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5613
5674
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5614
5675
|
return reward.rewardTokenAmount.token.address;
|
|
5615
5676
|
});
|
|
5616
|
-
return
|
|
5677
|
+
return _context15.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5617
5678
|
|
|
5618
5679
|
case 10:
|
|
5619
5680
|
case "end":
|
|
5620
|
-
return
|
|
5681
|
+
return _context15.stop();
|
|
5621
5682
|
}
|
|
5622
5683
|
}
|
|
5623
|
-
},
|
|
5684
|
+
}, _callee15, this);
|
|
5624
5685
|
}));
|
|
5625
5686
|
|
|
5626
5687
|
function claimReferralRewards() {
|