@aurigami/sdk 1.12.8 → 1.12.9-hf

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/ChangeLog.md ADDED
@@ -0,0 +1,371 @@
1
+ # Change Logs
2
+
3
+ # 1.12.8:
4
+
5
+ - Add `mintCap(): Promise<TokenAmount>` return the mint cap of the autoken
6
+ - Add `borrowCap(): Promise<TokenAmount>)` return the borrow cap of the autoken
7
+
8
+ # 1.12.7:
9
+
10
+ - Add `(...).queuePosition(address: Address): Promise<number>` return the position of the address in referral queue. -1 if not in queue,
11
+ 999 if not in top 600.
12
+ - `slotsInUse()` now will not accept any param, and return the total slots in total.
13
+
14
+ ## 1.12.6:
15
+
16
+ - Remove `getJackpotResult`, use `getLastJackpotResult` instead.
17
+ - Hide winner address in jackpot result.
18
+
19
+ ## 1.12.3
20
+
21
+ - Add `PlyGameRead(...).getJackpotResult(round:number): Promise<{amount: TokenAmount, winner: Address}>`: return jackpot winner of the given round
22
+
23
+ ## 1.12.2
24
+
25
+ - Use DefiLlama API as an backup for Coingecko
26
+
27
+ ## 1.12.0 + 1.12.1
28
+
29
+ - Use new referral contract
30
+ - Remove referral V1 data
31
+
32
+ - `ReferralRead(...).isNewUserAtReferralTime(address: Address): Promise<boolean>`: Return true if this is a new user of aurigami
33
+ when he got referred
34
+ - `...(...).depositedMoreThanMinimumAmount(address: Address): Promise<boolean>`: Return true if the user has deposited more than the minimum amount (100$)
35
+
36
+ - `ReferralRead(...).isWhitelistedAddress(address: Address): Promise<boolean>`: check whether a user is a whitelisted referrer or not
37
+ - `ReferralRead(...).isOnAuroraPlus(address: Address): Promise<boolean>`: Check whether a user on Aurora+ or not
38
+
39
+ - `ReferralRead(...).slotsInUse(referralCode: string): Promise<number>`
40
+ - `(...).totalReferralSlots(): number` -> return 500
41
+ - `(...).userReferralStatus(userAddr: Address): Promise<string>` -> return `notReferred`, `notQualified`, `Qualified`, or `Withdrawn` base on the user status
42
+ - Type changes: `ReferralReward` now will have `refereeAddress: string | null`
43
+
44
+ ## 1.11.1
45
+
46
+ - PlyGame `getPlyGameResultsInTransaction` get result faster by using `getTransactionReceipt` instead of `waitForTransaction`
47
+
48
+ ## 1.11.0
49
+
50
+ - Add support for Plygame with testing contract
51
+ - Type:
52
+
53
+ ```ts
54
+ export type PlyGameBetResult = {
55
+ player: string;
56
+ outcome: string;
57
+ lostAmount: TokenAmount;
58
+ unlockedPulpAmount: TokenAmount;
59
+
60
+ block: number;
61
+ timestamp: number;
62
+ transactionHash: string;
63
+ };
64
+
65
+ type PlyGameLeaderboardItem = {
66
+ player: string;
67
+ gamesPlayed: number;
68
+ unlockedPulpAmount: TokenAmount;
69
+ };
70
+ ```
71
+
72
+ - Read functions:
73
+
74
+ - `PlyGameRead(...).getUserPlyGameHistory(user) -> Promise<PlyGameBetResult[]>`: Get 100 most recent bets of the market users
75
+ - `(...).currentJackpotAmount(): Promise<TokenAmount>`
76
+ - `(...).earlyUnlockedPulpAmount(user): Promise<TokenAmount>`: get total unlocked pulp amount since launch.
77
+ - `(...).getPlyGameResultsInTransaction(txHash): Promise<PlyGameBetResult[]>`: Return list of bet made from the given transaction.
78
+ - `PlyGameRead(...).leaderboard(): Promise<PlyGameLeaderboardItem[]>`: ranking list of the top 100 users by amount of PULP unlocked
79
+
80
+ - Write functions:
81
+
82
+ - `PlyGameReadWrite(...).makeBetOnce(amount: TokenAmount)`
83
+ - `(...).approve(amount: TokenAmount)`: approve plygame contract spending user's PLY
84
+
85
+ ## 1.10.0
86
+
87
+ - Public `PapermillRead(...).getWeek(timestamp: number): number`
88
+
89
+ ## 1.9.7
90
+
91
+ - Change oracle address
92
+
93
+ ## 1.9.6
94
+
95
+ - Add oracle to ENV
96
+
97
+ ## 1.9.5
98
+
99
+ - Use compound formular to calculate market APY.
100
+
101
+ ## 1.9.4
102
+
103
+ - Allow to set custom dust in sneak account
104
+
105
+ ## 1.9.3
106
+
107
+ - Change ply circulating supply
108
+
109
+ ## 1.9.2
110
+
111
+ - Use 10B for PLY total supply
112
+
113
+ ## 1.9.1
114
+
115
+ - Handle error in fetching LP price
116
+
117
+ ## 1.9.0
118
+
119
+ - Rename `contracts` folder to `interactors`.
120
+ - Catching fetch price error
121
+
122
+ ## 1.8.6
123
+
124
+ - Fix bug in `formattedAmount` when using custom format.
125
+
126
+ ## 1.8.5
127
+
128
+ - Able to customize format in TokenAmount.formattedAmount()
129
+
130
+ ## 1.8.4
131
+
132
+ - Add campaign ids for referrals
133
+
134
+ ## 1.8.3
135
+
136
+ - Markets rewards + staking rewards can be claim in one txn by `SdkReadWrite(...).claim()`
137
+ - Remove `SdkReadWrite(...).claimLpRewards()`
138
+
139
+ ## 1.8.2
140
+
141
+ Bug fix on missing txnHash in referralReward type
142
+
143
+ ## 1.8.1
144
+
145
+ - Change campaign id
146
+
147
+ ## 1.8.0
148
+
149
+ - Return actual data for referral rewards.
150
+ - Change `ReferralRead(...).leaderboard()` to `ReferralRead(...).leaderboard(campaign: string)`: now can get the leaderboard of a given campaign.
151
+
152
+ ## 1.7.9-dummy
153
+
154
+ - Add `userAddr` in ReferralReward type
155
+
156
+ ## 1.7.8-dummy
157
+
158
+ - Update Meta rewards for stNEAR to `1,250,000` META.
159
+
160
+ ## 1.7.7-dummy
161
+
162
+ - [Dummy data] Add `ReferralRead(...).referralRewards(userAddr: Address): Promise<ReferralReward[]>`: Array of rewards, sorted by time of the referral period (from latest to oldest)
163
+ - [Dummy data] Add `ReferralRead(...).leaderboard(): Promise<ReferralReward[]>`: Top 50 reward earners from the last round, sorted by token amount.
164
+
165
+ - Add `ReferralReadWrite(...).claimReferralRewards()`: Claim all unclaimed rewards for a given user
166
+
167
+ New type:
168
+
169
+ ```ts
170
+ export type ReferralReward = {
171
+ campaign: string;
172
+ /**
173
+ * start timetamp of the referral round
174
+ */
175
+ startTime: number;
176
+ /**
177
+ * end timetamp of the referral round
178
+ */
179
+ endTime: number;
180
+ /**
181
+ * referrer's rewards
182
+ */
183
+ isReferrer: boolean;
184
+ /**
185
+ * reward amount
186
+ */
187
+ rewardTokenAmount: TokenAmount;
188
+ /**
189
+ * hash of the transaction on aurorascan (if no, return null)
190
+ */
191
+ transactionHash: string | null;
192
+ };
193
+ ```
194
+
195
+ ## 1.7.3
196
+
197
+ - Add helper functions for Auri monitoring system
198
+
199
+ ## 1.7.1 & 1.7.2
200
+
201
+ - Return correct timestamp in referrals list
202
+
203
+ ## 1.7.0
204
+
205
+ - Add `ReferralRead(...).getReferralsList(userAddr: Address): Promise<{ user: string; timestamp: number }[]>`: Get 50 latest referrals of the given address, sorted descending by timestamp. Currently the timestamp is dummy data.
206
+
207
+ ## 1.6.9
208
+
209
+ Support internal aurilens
210
+
211
+ ## 1.6.6
212
+
213
+ Use `public readonly` modifier instead of `private/protected` in SDK.
214
+
215
+ ## 1.6.5
216
+
217
+ SDK refactor #2, remove support for loterry campaign. Package size reduced from 3MB -> 200KB
218
+
219
+ ## 1.6.4
220
+
221
+ Return meaningful result instead of INF in `calcLMRewardApr`
222
+
223
+ ## 1.6.3
224
+
225
+ Add USN supports. Hardcoded USN price to $1.
226
+
227
+ ## 1.6.2
228
+
229
+ - Add `ReferralRead(...).getUserReferralCode(userAddr: Address): Promise<string>`: Get the referral code for a given address, returns empty string if not found. Called to check if a user has a referral code.
230
+ - Add `ReferralRead(...).getReferralCodeOwner(code: string): Promise<Address>`: Get owner of a referral code, returns zero address if not found.
231
+ - Add `ReferralRead(...).getReferralCodeUsed(userAddr: Address): Promise<string>`: Get referral code that a user was referred by, returns empty string if not found.
232
+ - Add `ReferralReadWrite(...).registerNewReferralCode(): Promise<TransactionResponse>`: Generate a referral code for a given address. Called when an user want to creates his own referral code
233
+ - Add `ReferralReadWrite(...).useReferralCode(code: string): Promise<TransactionResponse>`: Called when an user confirms he is referred by a specified code
234
+
235
+ ## 1.6.1
236
+
237
+ Add `PapermillRead(...).getNextWeekTimestamp(): number`: get the start timestamp of next week of the papermill contract.
238
+
239
+ Add `SdkRead(...).getPlyCirculatingSupply(): Promise<TokenAmount>`: get the ply's circulating supply
240
+
241
+ ## 1.6.0
242
+
243
+ SDK refactor - Why?:
244
+
245
+ - more modular and less coupled.
246
+ - more testable.
247
+ - more maintainable.
248
+
249
+ Things to do:
250
+
251
+ - [x] Restructure the folder structure.
252
+ - Refactor the code - Use composition pattern to SDK class
253
+ - [x] Use address from contract package instead of hardcoded address.
254
+
255
+ ## 1.5.8 + 1.5.9
256
+
257
+ Fix gas error on claim rewards: Instead of claim all the rewards in all market in 1 txns, we will claim rewards in 2 txns.
258
+
259
+ ## 1.5.7
260
+
261
+ - Change return type of `SdkRead(...).LpBalanceOf` and `stakeBalanceOf` from `TokenValuation` to `TokenAmount` to match other functions in the SDK.
262
+ - `totalStakedLiquidity` field in `PLYWNEARPoolDetails` is now `TokenAmount` instead of `TokenValuation`.
263
+
264
+ ```ts
265
+ export type PLYWNEARPoolDetails = {
266
+ totalStakedLiquidity: TokenAmount;
267
+ APYs: TokenAPY[];
268
+ };
269
+ ```
270
+
271
+ ## 1.5.6
272
+
273
+ Add PLYWNEAR pool to ALL_STAKING_POOLS
274
+
275
+ ## 1.5.5
276
+
277
+ Add auPLY market, integrate new fair launch contract
278
+
279
+ Hard code PULP price to 0
280
+
281
+ ## 1.5.4
282
+
283
+ Use browser-friendly assert
284
+
285
+ ## 1.5.2
286
+
287
+ Added `SdkRead(...).unclaimedRewardsOf(userAddress: Address): Promise<TokenAmount[]>` to get unclaimed rewards of a user in LP staking.
288
+
289
+ ## 1.5.1
290
+
291
+ Added `PapermillRead(...).getUnlockPortionAt(userAddress: Address, timestamp: number)`
292
+
293
+ ```ts
294
+ export type TokenAPY = {
295
+ address: string;
296
+ apy: string;
297
+ };
298
+
299
+ export type PLYWNEARPoolDetails = {
300
+ totalStakedLiquidity: TokenValuation;
301
+ APYs: TokenAPY[];
302
+ //apy: string; removed
303
+ };
304
+ ```
305
+
306
+ ## 1.5.0 For staking PLYWNEAR
307
+
308
+ ### Unchanged:
309
+
310
+ - Stake/unstake: Use `SdkReadWrite(...).stake(amount: TokenAmount)` (or `unstake`)
311
+
312
+ ### Rename:
313
+
314
+ - `SdkRead(...).getPlyAuroraPoolDetails` -> `SdkRead(...).getPLYWNEARPoolDetails`
315
+
316
+ ### Add
317
+
318
+ - Read:
319
+ - `SdkRead(...).LpBalanceOf(user: Address):TokenValuation` => amount and $ value of LP token in wallet. To get amount staked, use the old `stakeBalanceOf()` above
320
+ - Type:
321
+ - `TokenValuation` is a type that contains amount and $ value of token.
322
+
323
+ ```ts
324
+ export type TokenValuation = {
325
+ tokenAmount: TokenAmount;
326
+ currencyAmount: CurrencyAmount;
327
+ };
328
+ ```
329
+
330
+ ```ts
331
+ export type PLYWNEARPoolDetails = {
332
+ totalStakedLiquidity: TokenValuation;
333
+ apy: string;
334
+ };
335
+ ```
336
+
337
+ ### Return type changed:
338
+
339
+ - `SdkRead(...).stakeBalanceOf()` will return `TokenValuation` instead of `TokenAmount`
340
+
341
+ ### Remove:
342
+
343
+ - Type `PlyAuroraPoolDetails` removed.
344
+
345
+ ## 1.5.0 For Papermill
346
+
347
+ ### Add
348
+
349
+ - Read functions:
350
+
351
+ - `new PapermillRead(...).getPlyBalance(address: Address): TokenAmount` => PLY balance in user wallet
352
+ - `new PapermillRead(...).getPulpBalance(address: Address): TokenAmount` => PULP balance in user wallet
353
+ - `new PapermillRead(...).getLockingDetails(address: Address): UserLockingDetails`: Get locking details. This function is for convenience only, because the locking details are already available in the `UserLockingDetails` result (which you can get by calling the old `SdkRead(...).getUserDetails()`)
354
+
355
+ - Write functions:
356
+
357
+ - `new PapermillReadWrite(...).redeem(recipient: Address, amount: TokenAmount)` => Redeem Ply from PULP. Set `amount` to `ethers.constants.MaxUint256` for max redeem.
358
+ - `new PapermillReadWrite(...).selfRedeem(amount: TokenAmount)` => Redeem Ply from PULP to msg.sender. This is just a shortcut for the redeem function above.
359
+ - Collect all PLY reward from all markets + staking pool: No added functions, using the old `SdkReadWrite(...).claim()`
360
+
361
+ - Type:
362
+ - `UserLockingDetails` to store all user locking details
363
+
364
+ ### Update
365
+
366
+ - `SdkRead(...).getUserDetails()`: this will include the result from `getLockingDetails`.
367
+
368
+ ### Remove
369
+
370
+ - `SdkRead(...).getLockingDetails()`: Use the `getLockingDetails` in papermill instead if needed.
371
+ - Remove `LockingDetails` type
@@ -26,6 +26,7 @@ export declare class PlyGameRead extends BlockchainEntityRead {
26
26
  winner: Address;
27
27
  amount: TokenAmount;
28
28
  }>;
29
+ overallLeaderboard(): Promise<PlyGameLeaderboardItem[]>;
29
30
  }
30
31
  export declare class PlyGameReadWrite extends PlyGameRead {
31
32
  /**
@@ -4837,7 +4837,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4837
4837
  return p;
4838
4838
  }, new BigNumber(0));
4839
4839
  _context.next = 19;
4840
- return this.env.comptroller.getAccountLiquidity(userAddress);
4840
+ return this.env.comptroller.getAccountLiquidity(userAddress)["catch"](function (e) {
4841
+ console.log(e);
4842
+ return [ethers.BigNumber.from(0), ethers.BigNumber.from(0)];
4843
+ });
4841
4844
 
4842
4845
  case 19:
4843
4846
  accountLiquidity = _context.sent;
@@ -5513,6 +5516,43 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5513
5516
  return getLastJackpotResult;
5514
5517
  }();
5515
5518
 
5519
+ _proto.overallLeaderboard = /*#__PURE__*/function () {
5520
+ var _overallLeaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
5521
+ var _this5 = this;
5522
+
5523
+ var result;
5524
+ return runtime_1.wrap(function _callee8$(_context8) {
5525
+ while (1) {
5526
+ switch (_context8.prev = _context8.next) {
5527
+ case 0:
5528
+ _context8.next = 2;
5529
+ return getPaginatedApi('/plygame/overallLeaderboard');
5530
+
5531
+ case 2:
5532
+ result = _context8.sent;
5533
+ return _context8.abrupt("return", result.items.map(function (item) {
5534
+ return {
5535
+ player: item.user,
5536
+ unlockedPulpAmount: new TokenAmount(_this5.pulpToken, item.unlockedAmount),
5537
+ gamesPlayed: item.count
5538
+ };
5539
+ }));
5540
+
5541
+ case 4:
5542
+ case "end":
5543
+ return _context8.stop();
5544
+ }
5545
+ }
5546
+ }, _callee8);
5547
+ }));
5548
+
5549
+ function overallLeaderboard() {
5550
+ return _overallLeaderboard.apply(this, arguments);
5551
+ }
5552
+
5553
+ return overallLeaderboard;
5554
+ }();
5555
+
5516
5556
  return PlyGameRead;
5517
5557
  }(BlockchainEntityRead);
5518
5558
  var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
@@ -5530,19 +5570,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
5530
5570
  _proto2.makeBetOnce =
5531
5571
  /*#__PURE__*/
5532
5572
  function () {
5533
- var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
5534
- return runtime_1.wrap(function _callee8$(_context8) {
5573
+ var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
5574
+ return runtime_1.wrap(function _callee9$(_context9) {
5535
5575
  while (1) {
5536
- switch (_context8.prev = _context8.next) {
5576
+ switch (_context9.prev = _context9.next) {
5537
5577
  case 0:
5538
- return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
5578
+ return _context9.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
5539
5579
 
5540
5580
  case 1:
5541
5581
  case "end":
5542
- return _context8.stop();
5582
+ return _context9.stop();
5543
5583
  }
5544
5584
  }
5545
- }, _callee8, this);
5585
+ }, _callee9, this);
5546
5586
  }));
5547
5587
 
5548
5588
  function makeBetOnce(_x5) {
@@ -5553,19 +5593,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
5553
5593
  }();
5554
5594
 
5555
5595
  _proto2.approve = /*#__PURE__*/function () {
5556
- var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
5557
- return runtime_1.wrap(function _callee9$(_context9) {
5596
+ var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
5597
+ return runtime_1.wrap(function _callee10$(_context10) {
5558
5598
  while (1) {
5559
- switch (_context9.prev = _context9.next) {
5599
+ switch (_context10.prev = _context10.next) {
5560
5600
  case 0:
5561
- return _context9.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5601
+ return _context10.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5562
5602
 
5563
5603
  case 1:
5564
5604
  case "end":
5565
- return _context9.stop();
5605
+ return _context10.stop();
5566
5606
  }
5567
5607
  }
5568
- }, _callee9, this);
5608
+ }, _callee10, this);
5569
5609
  }));
5570
5610
 
5571
5611
  function approve(_x6) {