@aurigami/sdk 1.11.1 → 1.11.2-dummy1
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/interactors/Referral.d.ts +11 -0
- package/dist/sdk.cjs.development.js +117 -34
- 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 +117 -34
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/consts/dummy.ts +6 -4
- package/src/interactors/Referral.ts +36 -3
- package/src/types/index.ts +2 -0
- package/src/a.ts.log +0 -29
|
@@ -38,6 +38,17 @@ export declare class ReferralRead extends BlockchainEntityRead {
|
|
|
38
38
|
* Top 50 reward earners from the last round, sorted by token amount
|
|
39
39
|
*/
|
|
40
40
|
leaderboard(campaign: string): Promise<ReferralReward[]>;
|
|
41
|
+
/**
|
|
42
|
+
* current number of slots under a referral code being used that exceed minimum deposit amount
|
|
43
|
+
*/
|
|
44
|
+
slotsInUse(referralCode: string): Promise<number>;
|
|
45
|
+
totalReferralSlots(): number;
|
|
46
|
+
/**
|
|
47
|
+
* a way to determine qualification status of a user. null if not referred yet,
|
|
48
|
+
* qualified if referred + min deposit, notQualified if referred + min deposit
|
|
49
|
+
* not reached or withdrew too early
|
|
50
|
+
*/
|
|
51
|
+
userReferralStatus(userAddr: Address): Promise<string>;
|
|
41
52
|
}
|
|
42
53
|
export declare class ReferralReadWrite extends ReferralRead {
|
|
43
54
|
/**
|
|
@@ -1792,21 +1792,23 @@ var dummyUserMarketDetails = {
|
|
|
1792
1792
|
};
|
|
1793
1793
|
var referralRewardDummy1 = {
|
|
1794
1794
|
campaign: 'testa',
|
|
1795
|
-
startTime:
|
|
1796
|
-
endTime:
|
|
1795
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1796
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 9, 30).getTime() / 1000),
|
|
1797
1797
|
isReferrer: false,
|
|
1798
1798
|
rewardTokenAmount: dummyTokenAmount,
|
|
1799
1799
|
transactionHash: null,
|
|
1800
|
-
userAddr: '0x...123'
|
|
1800
|
+
userAddr: '0x...123',
|
|
1801
|
+
refereeAddress: '0x123..123'
|
|
1801
1802
|
};
|
|
1802
1803
|
var referralRewardDummy2 = {
|
|
1803
1804
|
campaign: 'testb',
|
|
1804
|
-
startTime:
|
|
1805
|
-
endTime:
|
|
1805
|
+
startTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 1).getTime() / 1000),
|
|
1806
|
+
endTime: /*#__PURE__*/Math.trunc( /*#__PURE__*/new Date(2022, 8, 31).getTime() / 1000),
|
|
1806
1807
|
isReferrer: true,
|
|
1807
1808
|
rewardTokenAmount: dummyTokenAmount2,
|
|
1808
1809
|
transactionHash: '0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b',
|
|
1809
|
-
userAddr: '0x...456'
|
|
1810
|
+
userAddr: '0x...456',
|
|
1811
|
+
refereeAddress: '0x123..123'
|
|
1810
1812
|
};
|
|
1811
1813
|
|
|
1812
1814
|
var AURIGAMI_API_END_POINT = 'https://api.aurigami.finance/app/';
|
|
@@ -5276,12 +5278,14 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5276
5278
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5277
5279
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5278
5280
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5279
|
-
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null
|
|
5281
|
+
transactionHash: (_item$transactionHash = item.transactionHash) != null ? _item$transactionHash : null,
|
|
5282
|
+
refereeAddress: null
|
|
5280
5283
|
};
|
|
5281
5284
|
});
|
|
5285
|
+
items = [referralRewardDummy1, referralRewardDummy2].concat(items);
|
|
5282
5286
|
return _context5.abrupt("return", items);
|
|
5283
5287
|
|
|
5284
|
-
case
|
|
5288
|
+
case 6:
|
|
5285
5289
|
case "end":
|
|
5286
5290
|
return _context5.stop();
|
|
5287
5291
|
}
|
|
@@ -5324,7 +5328,8 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5324
5328
|
rewardTokenAmount: TokenAmount.fromAddressAndAmount(item.token, item.amount),
|
|
5325
5329
|
startTime: REFERRAL_CAMPAIGNS[item.campaign].start,
|
|
5326
5330
|
endTime: REFERRAL_CAMPAIGNS[item.campaign].end,
|
|
5327
|
-
transactionHash: null
|
|
5331
|
+
transactionHash: null,
|
|
5332
|
+
refereeAddress: null
|
|
5328
5333
|
};
|
|
5329
5334
|
});
|
|
5330
5335
|
items.sort(function (a, b) {
|
|
@@ -5345,6 +5350,84 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5345
5350
|
}
|
|
5346
5351
|
|
|
5347
5352
|
return leaderboard;
|
|
5353
|
+
}()
|
|
5354
|
+
/**
|
|
5355
|
+
* current number of slots under a referral code being used that exceed minimum deposit amount
|
|
5356
|
+
*/
|
|
5357
|
+
;
|
|
5358
|
+
|
|
5359
|
+
_proto.slotsInUse =
|
|
5360
|
+
/*#__PURE__*/
|
|
5361
|
+
function () {
|
|
5362
|
+
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(referralCode) {
|
|
5363
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
5364
|
+
while (1) {
|
|
5365
|
+
switch (_context7.prev = _context7.next) {
|
|
5366
|
+
case 0:
|
|
5367
|
+
return _context7.abrupt("return", 123);
|
|
5368
|
+
|
|
5369
|
+
case 1:
|
|
5370
|
+
case "end":
|
|
5371
|
+
return _context7.stop();
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
}, _callee7);
|
|
5375
|
+
}));
|
|
5376
|
+
|
|
5377
|
+
function slotsInUse(_x7) {
|
|
5378
|
+
return _slotsInUse.apply(this, arguments);
|
|
5379
|
+
}
|
|
5380
|
+
|
|
5381
|
+
return slotsInUse;
|
|
5382
|
+
}();
|
|
5383
|
+
|
|
5384
|
+
_proto.totalReferralSlots = function totalReferralSlots() {
|
|
5385
|
+
return 500;
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* a way to determine qualification status of a user. null if not referred yet,
|
|
5389
|
+
* qualified if referred + min deposit, notQualified if referred + min deposit
|
|
5390
|
+
* not reached or withdrew too early
|
|
5391
|
+
*/
|
|
5392
|
+
;
|
|
5393
|
+
|
|
5394
|
+
_proto.userReferralStatus =
|
|
5395
|
+
/*#__PURE__*/
|
|
5396
|
+
function () {
|
|
5397
|
+
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
|
|
5398
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5399
|
+
while (1) {
|
|
5400
|
+
switch (_context8.prev = _context8.next) {
|
|
5401
|
+
case 0:
|
|
5402
|
+
_context8.next = 2;
|
|
5403
|
+
return this.getReferralCodeUsed(userAddr);
|
|
5404
|
+
|
|
5405
|
+
case 2:
|
|
5406
|
+
_context8.t0 = _context8.sent;
|
|
5407
|
+
|
|
5408
|
+
if (!(_context8.t0 !== '')) {
|
|
5409
|
+
_context8.next = 7;
|
|
5410
|
+
break;
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5413
|
+
return _context8.abrupt("return", 'notQualified');
|
|
5414
|
+
|
|
5415
|
+
case 7:
|
|
5416
|
+
return _context8.abrupt("return", 'notReferred');
|
|
5417
|
+
|
|
5418
|
+
case 8:
|
|
5419
|
+
case "end":
|
|
5420
|
+
return _context8.stop();
|
|
5421
|
+
}
|
|
5422
|
+
}
|
|
5423
|
+
}, _callee8, this);
|
|
5424
|
+
}));
|
|
5425
|
+
|
|
5426
|
+
function userReferralStatus(_x8) {
|
|
5427
|
+
return _userReferralStatus.apply(this, arguments);
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
return userReferralStatus;
|
|
5348
5431
|
}();
|
|
5349
5432
|
|
|
5350
5433
|
return ReferralRead;
|
|
@@ -5366,21 +5449,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5366
5449
|
_proto2.registerNewReferralCode =
|
|
5367
5450
|
/*#__PURE__*/
|
|
5368
5451
|
function () {
|
|
5369
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5452
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
5370
5453
|
var referralCode;
|
|
5371
|
-
return runtime_1.wrap(function
|
|
5454
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
5372
5455
|
while (1) {
|
|
5373
|
-
switch (
|
|
5456
|
+
switch (_context9.prev = _context9.next) {
|
|
5374
5457
|
case 0:
|
|
5375
5458
|
referralCode = ethers.ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5376
|
-
return
|
|
5459
|
+
return _context9.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5377
5460
|
|
|
5378
5461
|
case 2:
|
|
5379
5462
|
case "end":
|
|
5380
|
-
return
|
|
5463
|
+
return _context9.stop();
|
|
5381
5464
|
}
|
|
5382
5465
|
}
|
|
5383
|
-
},
|
|
5466
|
+
}, _callee9, this);
|
|
5384
5467
|
}));
|
|
5385
5468
|
|
|
5386
5469
|
function registerNewReferralCode() {
|
|
@@ -5397,24 +5480,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5397
5480
|
_proto2.useReferralCode =
|
|
5398
5481
|
/*#__PURE__*/
|
|
5399
5482
|
function () {
|
|
5400
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5483
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(code) {
|
|
5401
5484
|
var referralCode;
|
|
5402
|
-
return runtime_1.wrap(function
|
|
5485
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
5403
5486
|
while (1) {
|
|
5404
|
-
switch (
|
|
5487
|
+
switch (_context10.prev = _context10.next) {
|
|
5405
5488
|
case 0:
|
|
5406
5489
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
5407
|
-
return
|
|
5490
|
+
return _context10.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5408
5491
|
|
|
5409
5492
|
case 2:
|
|
5410
5493
|
case "end":
|
|
5411
|
-
return
|
|
5494
|
+
return _context10.stop();
|
|
5412
5495
|
}
|
|
5413
5496
|
}
|
|
5414
|
-
},
|
|
5497
|
+
}, _callee10, this);
|
|
5415
5498
|
}));
|
|
5416
5499
|
|
|
5417
|
-
function useReferralCode(
|
|
5500
|
+
function useReferralCode(_x9) {
|
|
5418
5501
|
return _useReferralCode.apply(this, arguments);
|
|
5419
5502
|
}
|
|
5420
5503
|
|
|
@@ -5428,23 +5511,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5428
5511
|
_proto2.claimReferralRewards =
|
|
5429
5512
|
/*#__PURE__*/
|
|
5430
5513
|
function () {
|
|
5431
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5514
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
|
|
5432
5515
|
var unclaimedRewards, campaigns, tokens;
|
|
5433
|
-
return runtime_1.wrap(function
|
|
5516
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5434
5517
|
while (1) {
|
|
5435
|
-
switch (
|
|
5518
|
+
switch (_context11.prev = _context11.next) {
|
|
5436
5519
|
case 0:
|
|
5437
|
-
|
|
5438
|
-
|
|
5520
|
+
_context11.t0 = this;
|
|
5521
|
+
_context11.next = 3;
|
|
5439
5522
|
return this._networkConnection.signer.getAddress();
|
|
5440
5523
|
|
|
5441
5524
|
case 3:
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
return
|
|
5525
|
+
_context11.t1 = _context11.sent;
|
|
5526
|
+
_context11.next = 6;
|
|
5527
|
+
return _context11.t0.referralRewards.call(_context11.t0, _context11.t1);
|
|
5445
5528
|
|
|
5446
5529
|
case 6:
|
|
5447
|
-
unclaimedRewards =
|
|
5530
|
+
unclaimedRewards = _context11.sent.filter(function (reward) {
|
|
5448
5531
|
return reward.transactionHash == null;
|
|
5449
5532
|
});
|
|
5450
5533
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5453,14 +5536,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5453
5536
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5454
5537
|
return reward.rewardTokenAmount.token.address;
|
|
5455
5538
|
});
|
|
5456
|
-
return
|
|
5539
|
+
return _context11.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5457
5540
|
|
|
5458
5541
|
case 10:
|
|
5459
5542
|
case "end":
|
|
5460
|
-
return
|
|
5543
|
+
return _context11.stop();
|
|
5461
5544
|
}
|
|
5462
5545
|
}
|
|
5463
|
-
},
|
|
5546
|
+
}, _callee11, this);
|
|
5464
5547
|
}));
|
|
5465
5548
|
|
|
5466
5549
|
function claimReferralRewards() {
|