@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/dist/interactors/Referral.d.ts +2 -0
- package/dist/sdk.cjs.development.js +115 -37
- 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 +115 -37
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/interactors/Referral.ts +25 -7
|
@@ -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
|
/**
|
|
@@ -5361,13 +5361,21 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5361
5361
|
/*#__PURE__*/
|
|
5362
5362
|
function () {
|
|
5363
5363
|
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(referralCode) {
|
|
5364
|
+
var result;
|
|
5364
5365
|
return runtime_1.wrap(function _callee7$(_context7) {
|
|
5365
5366
|
while (1) {
|
|
5366
5367
|
switch (_context7.prev = _context7.next) {
|
|
5367
5368
|
case 0:
|
|
5368
|
-
|
|
5369
|
+
_context7.next = 2;
|
|
5370
|
+
return getApi('/referral/slotsInUse', {
|
|
5371
|
+
referralCode: referralCode
|
|
5372
|
+
});
|
|
5369
5373
|
|
|
5370
|
-
case
|
|
5374
|
+
case 2:
|
|
5375
|
+
result = _context7.sent;
|
|
5376
|
+
return _context7.abrupt("return", result);
|
|
5377
|
+
|
|
5378
|
+
case 4:
|
|
5371
5379
|
case "end":
|
|
5372
5380
|
return _context7.stop();
|
|
5373
5381
|
}
|
|
@@ -5396,32 +5404,40 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5396
5404
|
/*#__PURE__*/
|
|
5397
5405
|
function () {
|
|
5398
5406
|
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
|
|
5407
|
+
var result;
|
|
5399
5408
|
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5400
5409
|
while (1) {
|
|
5401
5410
|
switch (_context8.prev = _context8.next) {
|
|
5402
5411
|
case 0:
|
|
5403
5412
|
_context8.next = 2;
|
|
5404
|
-
return
|
|
5413
|
+
return getApi('/referral/referralStatus', {
|
|
5414
|
+
address: userAddr
|
|
5415
|
+
});
|
|
5405
5416
|
|
|
5406
5417
|
case 2:
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
break;
|
|
5412
|
-
}
|
|
5418
|
+
result = _context8.sent;
|
|
5419
|
+
_context8.t0 = result;
|
|
5420
|
+
_context8.next = _context8.t0 === -1 ? 6 : _context8.t0 === 0 ? 7 : _context8.t0 === 1 ? 8 : 9;
|
|
5421
|
+
break;
|
|
5413
5422
|
|
|
5414
|
-
|
|
5423
|
+
case 6:
|
|
5424
|
+
return _context8.abrupt("return", 'notReferred');
|
|
5415
5425
|
|
|
5416
5426
|
case 7:
|
|
5417
|
-
return _context8.abrupt("return", '
|
|
5427
|
+
return _context8.abrupt("return", 'notQualified');
|
|
5418
5428
|
|
|
5419
5429
|
case 8:
|
|
5430
|
+
return _context8.abrupt("return", 'Qualified');
|
|
5431
|
+
|
|
5432
|
+
case 9:
|
|
5433
|
+
return _context8.abrupt("return", 'Withdrawn');
|
|
5434
|
+
|
|
5435
|
+
case 10:
|
|
5420
5436
|
case "end":
|
|
5421
5437
|
return _context8.stop();
|
|
5422
5438
|
}
|
|
5423
5439
|
}
|
|
5424
|
-
}, _callee8
|
|
5440
|
+
}, _callee8);
|
|
5425
5441
|
}));
|
|
5426
5442
|
|
|
5427
5443
|
function userReferralStatus(_x8) {
|
|
@@ -5491,6 +5507,68 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5491
5507
|
return isOnAuroraPlus;
|
|
5492
5508
|
}();
|
|
5493
5509
|
|
|
5510
|
+
_proto.isNewUserAtReferralTime = /*#__PURE__*/function () {
|
|
5511
|
+
var _isNewUserAtReferralTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(address) {
|
|
5512
|
+
var result;
|
|
5513
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5514
|
+
while (1) {
|
|
5515
|
+
switch (_context11.prev = _context11.next) {
|
|
5516
|
+
case 0:
|
|
5517
|
+
_context11.next = 2;
|
|
5518
|
+
return getApi('/referral/isNewUser', {
|
|
5519
|
+
address: address
|
|
5520
|
+
});
|
|
5521
|
+
|
|
5522
|
+
case 2:
|
|
5523
|
+
result = _context11.sent;
|
|
5524
|
+
return _context11.abrupt("return", result);
|
|
5525
|
+
|
|
5526
|
+
case 4:
|
|
5527
|
+
case "end":
|
|
5528
|
+
return _context11.stop();
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
}, _callee11);
|
|
5532
|
+
}));
|
|
5533
|
+
|
|
5534
|
+
function isNewUserAtReferralTime(_x11) {
|
|
5535
|
+
return _isNewUserAtReferralTime.apply(this, arguments);
|
|
5536
|
+
}
|
|
5537
|
+
|
|
5538
|
+
return isNewUserAtReferralTime;
|
|
5539
|
+
}();
|
|
5540
|
+
|
|
5541
|
+
_proto.depositedMoreThanMinimumAmount = /*#__PURE__*/function () {
|
|
5542
|
+
var _depositedMoreThanMinimumAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(address) {
|
|
5543
|
+
var result;
|
|
5544
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
5545
|
+
while (1) {
|
|
5546
|
+
switch (_context12.prev = _context12.next) {
|
|
5547
|
+
case 0:
|
|
5548
|
+
_context12.next = 2;
|
|
5549
|
+
return getApi('/referral/depositedEnough', {
|
|
5550
|
+
address: address
|
|
5551
|
+
});
|
|
5552
|
+
|
|
5553
|
+
case 2:
|
|
5554
|
+
result = _context12.sent;
|
|
5555
|
+
return _context12.abrupt("return", result);
|
|
5556
|
+
|
|
5557
|
+
case 4:
|
|
5558
|
+
case "end":
|
|
5559
|
+
return _context12.stop();
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
}, _callee12);
|
|
5563
|
+
}));
|
|
5564
|
+
|
|
5565
|
+
function depositedMoreThanMinimumAmount(_x12) {
|
|
5566
|
+
return _depositedMoreThanMinimumAmount.apply(this, arguments);
|
|
5567
|
+
}
|
|
5568
|
+
|
|
5569
|
+
return depositedMoreThanMinimumAmount;
|
|
5570
|
+
}();
|
|
5571
|
+
|
|
5494
5572
|
return ReferralRead;
|
|
5495
5573
|
}(BlockchainEntityRead);
|
|
5496
5574
|
var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
@@ -5510,21 +5588,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5510
5588
|
_proto2.registerNewReferralCode =
|
|
5511
5589
|
/*#__PURE__*/
|
|
5512
5590
|
function () {
|
|
5513
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5591
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
|
|
5514
5592
|
var referralCode;
|
|
5515
|
-
return runtime_1.wrap(function
|
|
5593
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
5516
5594
|
while (1) {
|
|
5517
|
-
switch (
|
|
5595
|
+
switch (_context13.prev = _context13.next) {
|
|
5518
5596
|
case 0:
|
|
5519
5597
|
referralCode = ethers.ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5520
|
-
return
|
|
5598
|
+
return _context13.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5521
5599
|
|
|
5522
5600
|
case 2:
|
|
5523
5601
|
case "end":
|
|
5524
|
-
return
|
|
5602
|
+
return _context13.stop();
|
|
5525
5603
|
}
|
|
5526
5604
|
}
|
|
5527
|
-
},
|
|
5605
|
+
}, _callee13, this);
|
|
5528
5606
|
}));
|
|
5529
5607
|
|
|
5530
5608
|
function registerNewReferralCode() {
|
|
@@ -5541,24 +5619,24 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5541
5619
|
_proto2.useReferralCode =
|
|
5542
5620
|
/*#__PURE__*/
|
|
5543
5621
|
function () {
|
|
5544
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5622
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(code) {
|
|
5545
5623
|
var referralCode;
|
|
5546
|
-
return runtime_1.wrap(function
|
|
5624
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
5547
5625
|
while (1) {
|
|
5548
|
-
switch (
|
|
5626
|
+
switch (_context14.prev = _context14.next) {
|
|
5549
5627
|
case 0:
|
|
5550
5628
|
referralCode = ethers.ethers.utils.formatBytes32String(code);
|
|
5551
|
-
return
|
|
5629
|
+
return _context14.abrupt("return", this.env.referralDirectory.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5552
5630
|
|
|
5553
5631
|
case 2:
|
|
5554
5632
|
case "end":
|
|
5555
|
-
return
|
|
5633
|
+
return _context14.stop();
|
|
5556
5634
|
}
|
|
5557
5635
|
}
|
|
5558
|
-
},
|
|
5636
|
+
}, _callee14, this);
|
|
5559
5637
|
}));
|
|
5560
5638
|
|
|
5561
|
-
function useReferralCode(
|
|
5639
|
+
function useReferralCode(_x13) {
|
|
5562
5640
|
return _useReferralCode.apply(this, arguments);
|
|
5563
5641
|
}
|
|
5564
5642
|
|
|
@@ -5572,23 +5650,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5572
5650
|
_proto2.claimReferralRewards =
|
|
5573
5651
|
/*#__PURE__*/
|
|
5574
5652
|
function () {
|
|
5575
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5653
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
5576
5654
|
var unclaimedRewards, campaigns, tokens;
|
|
5577
|
-
return runtime_1.wrap(function
|
|
5655
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
5578
5656
|
while (1) {
|
|
5579
|
-
switch (
|
|
5657
|
+
switch (_context15.prev = _context15.next) {
|
|
5580
5658
|
case 0:
|
|
5581
|
-
|
|
5582
|
-
|
|
5659
|
+
_context15.t0 = this;
|
|
5660
|
+
_context15.next = 3;
|
|
5583
5661
|
return this._networkConnection.signer.getAddress();
|
|
5584
5662
|
|
|
5585
5663
|
case 3:
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
return
|
|
5664
|
+
_context15.t1 = _context15.sent;
|
|
5665
|
+
_context15.next = 6;
|
|
5666
|
+
return _context15.t0.referralRewards.call(_context15.t0, _context15.t1);
|
|
5589
5667
|
|
|
5590
5668
|
case 6:
|
|
5591
|
-
unclaimedRewards =
|
|
5669
|
+
unclaimedRewards = _context15.sent.filter(function (reward) {
|
|
5592
5670
|
return reward.transactionHash == null;
|
|
5593
5671
|
});
|
|
5594
5672
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5597,14 +5675,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5597
5675
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5598
5676
|
return reward.rewardTokenAmount.token.address;
|
|
5599
5677
|
});
|
|
5600
|
-
return
|
|
5678
|
+
return _context15.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5601
5679
|
|
|
5602
5680
|
case 10:
|
|
5603
5681
|
case "end":
|
|
5604
|
-
return
|
|
5682
|
+
return _context15.stop();
|
|
5605
5683
|
}
|
|
5606
5684
|
}
|
|
5607
|
-
},
|
|
5685
|
+
}, _callee15, this);
|
|
5608
5686
|
}));
|
|
5609
5687
|
|
|
5610
5688
|
function claimReferralRewards() {
|