@aurigami/sdk 1.6.1 → 1.6.2

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/sdk.esm.js CHANGED
@@ -16,6 +16,7 @@ import EthRepayHelperABI from '@aurigami/contracts/artifacts/contracts/EthRepayH
16
16
  import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
17
17
  import EIP20InterfaceABI from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
18
18
  import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
19
+ import ReferralDirectoryABI from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
19
20
  import FaucetABI from '@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json';
20
21
  import Multicall2ABI from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
21
22
 
@@ -74,7 +75,8 @@ var networkAddresses = {
74
75
  AURI_AIRDROP: /*#__PURE__*/MAINNET_ADDRESSES.auriAirdrop.toLowerCase(),
75
76
  MULTICALL: /*#__PURE__*/MAINNET_ADDRESSES.multicall.toLowerCase(),
76
77
  TEAM_MULTISIG: /*#__PURE__*/'0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE'.toLowerCase(),
77
- PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase()
78
+ PLY_TOKEN_LOCK: /*#__PURE__*/MAINNET_ADDRESSES.plyTokenLock.toLowerCase(),
79
+ REFERRAL: /*#__PURE__*/MAINNET_ADDRESSES.referralDirectory.toLocaleLowerCase()
78
80
  },
79
81
  tokens: {
80
82
  AURORA: /*#__PURE__*/'0x8bec47865ade3b172a928df8f990bc7f2a3b9f79'.toLowerCase(),
@@ -107170,6 +107172,236 @@ var Papermill = /*#__PURE__*/function (_BlockchainEntity) {
107170
107172
  return Papermill;
107171
107173
  }(BlockchainEntity);
107172
107174
 
107175
+ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
107176
+ _inheritsLoose(ReferralRead, _BlockchainEntityRead);
107177
+
107178
+ function ReferralRead(networkConnection) {
107179
+ var _this;
107180
+
107181
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
107182
+ _this._referral = new Contract(networkAddresses.misc.REFERRAL, ReferralDirectoryABI.abi, networkConnection.provider);
107183
+ return _this;
107184
+ }
107185
+ /**
107186
+ * Generate a 10-character referral code
107187
+ * containing alphanumeric characters.
107188
+ */
107189
+
107190
+
107191
+ var _proto = ReferralRead.prototype;
107192
+
107193
+ _proto.generateReferralCode = function generateReferralCode() {
107194
+ var letters = 'abcdefghijklmnopqrstuvwxyz';
107195
+ var numbers = '1234567890';
107196
+ var charset = letters + letters.toUpperCase() + numbers;
107197
+ var R = '';
107198
+
107199
+ for (var i = 0; i < 10; i++) {
107200
+ R += charset[Math.floor(Math.random() * charset.length)];
107201
+ }
107202
+
107203
+ return R;
107204
+ }
107205
+ /**
107206
+ * Get the referral code for a given address, returns empty string if not found.
107207
+ *
107208
+ * Called to check if a user has a referral code.
107209
+ */
107210
+ ;
107211
+
107212
+ _proto.getUserReferralCode =
107213
+ /*#__PURE__*/
107214
+ function () {
107215
+ var _getUserReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(userAddr) {
107216
+ var result;
107217
+ return runtime_1.wrap(function _callee$(_context) {
107218
+ while (1) {
107219
+ switch (_context.prev = _context.next) {
107220
+ case 0:
107221
+ _context.next = 2;
107222
+ return this._referral.userReferralCode(userAddr);
107223
+
107224
+ case 2:
107225
+ result = _context.sent;
107226
+ return _context.abrupt("return", ethers.utils.parseBytes32String(result));
107227
+
107228
+ case 4:
107229
+ case "end":
107230
+ return _context.stop();
107231
+ }
107232
+ }
107233
+ }, _callee, this);
107234
+ }));
107235
+
107236
+ function getUserReferralCode(_x) {
107237
+ return _getUserReferralCode.apply(this, arguments);
107238
+ }
107239
+
107240
+ return getUserReferralCode;
107241
+ }()
107242
+ /**
107243
+ * Get referral code that a user was referred by, returns empty string if not found.
107244
+ */
107245
+ ;
107246
+
107247
+ _proto.getReferralCodeUsed =
107248
+ /*#__PURE__*/
107249
+ function () {
107250
+ var _getReferralCodeUsed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddr) {
107251
+ var result;
107252
+ return runtime_1.wrap(function _callee2$(_context2) {
107253
+ while (1) {
107254
+ switch (_context2.prev = _context2.next) {
107255
+ case 0:
107256
+ _context2.next = 2;
107257
+ return this._referral.referralCodeUsed(userAddr);
107258
+
107259
+ case 2:
107260
+ result = _context2.sent;
107261
+ return _context2.abrupt("return", ethers.utils.parseBytes32String(result));
107262
+
107263
+ case 4:
107264
+ case "end":
107265
+ return _context2.stop();
107266
+ }
107267
+ }
107268
+ }, _callee2, this);
107269
+ }));
107270
+
107271
+ function getReferralCodeUsed(_x2) {
107272
+ return _getReferralCodeUsed.apply(this, arguments);
107273
+ }
107274
+
107275
+ return getReferralCodeUsed;
107276
+ }()
107277
+ /**
107278
+ * Get owner of a referral code, returns zero address if not found.
107279
+ */
107280
+ ;
107281
+
107282
+ _proto.getReferralCodeOwner =
107283
+ /*#__PURE__*/
107284
+ function () {
107285
+ var _getReferralCodeOwner = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(code) {
107286
+ var referralCode;
107287
+ return runtime_1.wrap(function _callee3$(_context3) {
107288
+ while (1) {
107289
+ switch (_context3.prev = _context3.next) {
107290
+ case 0:
107291
+ referralCode = ethers.utils.formatBytes32String(code);
107292
+ return _context3.abrupt("return", this._referral.referralCodeOwner(referralCode));
107293
+
107294
+ case 2:
107295
+ case "end":
107296
+ return _context3.stop();
107297
+ }
107298
+ }
107299
+ }, _callee3, this);
107300
+ }));
107301
+
107302
+ function getReferralCodeOwner(_x3) {
107303
+ return _getReferralCodeOwner.apply(this, arguments);
107304
+ }
107305
+
107306
+ return getReferralCodeOwner;
107307
+ }();
107308
+
107309
+ return ReferralRead;
107310
+ }(BlockchainEntityRead);
107311
+ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
107312
+ _inheritsLoose(ReferralReadWrite, _ReferralRead);
107313
+
107314
+ function ReferralReadWrite() {
107315
+ return _ReferralRead.apply(this, arguments) || this;
107316
+ }
107317
+
107318
+ var _proto2 = ReferralReadWrite.prototype;
107319
+
107320
+ /**
107321
+ * Generate a referral code for a given address.
107322
+ *
107323
+ * Called when an user want to creates his own referral code
107324
+ */
107325
+ _proto2.registerNewReferralCode =
107326
+ /*#__PURE__*/
107327
+ function () {
107328
+ var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
107329
+ var referralCode;
107330
+ return runtime_1.wrap(function _callee4$(_context4) {
107331
+ while (1) {
107332
+ switch (_context4.prev = _context4.next) {
107333
+ case 0:
107334
+ referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
107335
+ return _context4.abrupt("return", this._referral.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
107336
+
107337
+ case 2:
107338
+ case "end":
107339
+ return _context4.stop();
107340
+ }
107341
+ }
107342
+ }, _callee4, this);
107343
+ }));
107344
+
107345
+ function registerNewReferralCode() {
107346
+ return _registerNewReferralCode.apply(this, arguments);
107347
+ }
107348
+
107349
+ return registerNewReferralCode;
107350
+ }()
107351
+ /**
107352
+ * Called when an user confirms he is referred by a specified code
107353
+ */
107354
+ ;
107355
+
107356
+ _proto2.useReferralCode =
107357
+ /*#__PURE__*/
107358
+ function () {
107359
+ var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(code) {
107360
+ var referralCode;
107361
+ return runtime_1.wrap(function _callee5$(_context5) {
107362
+ while (1) {
107363
+ switch (_context5.prev = _context5.next) {
107364
+ case 0:
107365
+ referralCode = ethers.utils.formatBytes32String(code);
107366
+ return _context5.abrupt("return", this._referral.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
107367
+
107368
+ case 2:
107369
+ case "end":
107370
+ return _context5.stop();
107371
+ }
107372
+ }
107373
+ }, _callee5, this);
107374
+ }));
107375
+
107376
+ function useReferralCode(_x4) {
107377
+ return _useReferralCode.apply(this, arguments);
107378
+ }
107379
+
107380
+ return useReferralCode;
107381
+ }();
107382
+
107383
+ return ReferralReadWrite;
107384
+ }(ReferralRead);
107385
+ var Referral = /*#__PURE__*/function (_BlockchainEntity) {
107386
+ _inheritsLoose(Referral, _BlockchainEntity);
107387
+
107388
+ function Referral() {
107389
+ return _BlockchainEntity.call(this) || this;
107390
+ }
107391
+
107392
+ var _proto3 = Referral.prototype;
107393
+
107394
+ _proto3.read = function read(networkConnection) {
107395
+ return new ReferralRead(networkConnection);
107396
+ };
107397
+
107398
+ _proto3.readWrite = function readWrite(networkConnection) {
107399
+ return new ReferralReadWrite(networkConnection);
107400
+ };
107401
+
107402
+ return Referral;
107403
+ }(BlockchainEntity);
107404
+
107173
107405
  var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
107174
107406
  _inheritsLoose(StakingRead, _BlockchainEntityRead);
107175
107407
 
@@ -108110,5 +108342,5 @@ BigNumber.config({
108110
108342
  DECIMAL_PLACES: 50
108111
108343
  });
108112
108344
 
108113
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, getQuery, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
108345
+ export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, getQuery, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
108114
108346
  //# sourceMappingURL=sdk.esm.js.map