@aurigami/sdk 1.13.1 → 1.15.0

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,376 @@
1
+ # Change Logs
2
+ # 1.13.1
3
+ - Add `PlyGameRead(...).overallLeaderboard(): Promise<PlyGameLeaderboardItem[]>`: overall ranking of the top 50 users by amount of PULP unlocked
4
+
5
+ # 1.13.0
6
+ - Add `SdkRead(...).getNetApyWithIncentive` and `getNetApyWithoutIncentive`.
7
+
8
+ # 1.12.8:
9
+
10
+ - Add `mintCap(): Promise<TokenAmount>` return the mint cap of the autoken
11
+ - Add `borrowCap(): Promise<TokenAmount>)` return the borrow cap of the autoken
12
+
13
+ # 1.12.7:
14
+
15
+ - Add `(...).queuePosition(address: Address): Promise<number>` return the position of the address in referral queue. -1 if not in queue,
16
+ 999 if not in top 600.
17
+ - `slotsInUse()` now will not accept any param, and return the total slots in total.
18
+
19
+ ## 1.12.6:
20
+
21
+ - Remove `getJackpotResult`, use `getLastJackpotResult` instead.
22
+ - Hide winner address in jackpot result.
23
+
24
+ ## 1.12.3
25
+
26
+ - Add `PlyGameRead(...).getJackpotResult(round:number): Promise<{amount: TokenAmount, winner: Address}>`: return jackpot winner of the given round
27
+
28
+ ## 1.12.2
29
+
30
+ - Use DefiLlama API as an backup for Coingecko
31
+
32
+ ## 1.12.0 + 1.12.1
33
+
34
+ - Use new referral contract
35
+ - Remove referral V1 data
36
+
37
+ - `ReferralRead(...).isNewUserAtReferralTime(address: Address): Promise<boolean>`: Return true if this is a new user of aurigami
38
+ when he got referred
39
+ - `...(...).depositedMoreThanMinimumAmount(address: Address): Promise<boolean>`: Return true if the user has deposited more than the minimum amount (100$)
40
+
41
+ - `ReferralRead(...).isWhitelistedAddress(address: Address): Promise<boolean>`: check whether a user is a whitelisted referrer or not
42
+ - `ReferralRead(...).isOnAuroraPlus(address: Address): Promise<boolean>`: Check whether a user on Aurora+ or not
43
+
44
+ - `ReferralRead(...).slotsInUse(referralCode: string): Promise<number>`
45
+ - `(...).totalReferralSlots(): number` -> return 500
46
+ - `(...).userReferralStatus(userAddr: Address): Promise<string>` -> return `notReferred`, `notQualified`, `Qualified`, or `Withdrawn` base on the user status
47
+ - Type changes: `ReferralReward` now will have `refereeAddress: string | null`
48
+
49
+ ## 1.11.1
50
+
51
+ - PlyGame `getPlyGameResultsInTransaction` get result faster by using `getTransactionReceipt` instead of `waitForTransaction`
52
+
53
+ ## 1.11.0
54
+
55
+ - Add support for Plygame with testing contract
56
+ - Type:
57
+
58
+ ```ts
59
+ export type PlyGameBetResult = {
60
+ player: string;
61
+ outcome: string;
62
+ lostAmount: TokenAmount;
63
+ unlockedPulpAmount: TokenAmount;
64
+
65
+ block: number;
66
+ timestamp: number;
67
+ transactionHash: string;
68
+ };
69
+
70
+ type PlyGameLeaderboardItem = {
71
+ player: string;
72
+ gamesPlayed: number;
73
+ unlockedPulpAmount: TokenAmount;
74
+ };
75
+ ```
76
+
77
+ - Read functions:
78
+
79
+ - `PlyGameRead(...).getUserPlyGameHistory(user) -> Promise<PlyGameBetResult[]>`: Get 100 most recent bets of the market users
80
+ - `(...).currentJackpotAmount(): Promise<TokenAmount>`
81
+ - `(...).earlyUnlockedPulpAmount(user): Promise<TokenAmount>`: get total unlocked pulp amount since launch.
82
+ - `(...).getPlyGameResultsInTransaction(txHash): Promise<PlyGameBetResult[]>`: Return list of bet made from the given transaction.
83
+ - `PlyGameRead(...).leaderboard(): Promise<PlyGameLeaderboardItem[]>`: ranking list of the top 100 users by amount of PULP unlocked
84
+
85
+ - Write functions:
86
+
87
+ - `PlyGameReadWrite(...).makeBetOnce(amount: TokenAmount)`
88
+ - `(...).approve(amount: TokenAmount)`: approve plygame contract spending user's PLY
89
+
90
+ ## 1.10.0
91
+
92
+ - Public `PapermillRead(...).getWeek(timestamp: number): number`
93
+
94
+ ## 1.9.7
95
+
96
+ - Change oracle address
97
+
98
+ ## 1.9.6
99
+
100
+ - Add oracle to ENV
101
+
102
+ ## 1.9.5
103
+
104
+ - Use compound formular to calculate market APY.
105
+
106
+ ## 1.9.4
107
+
108
+ - Allow to set custom dust in sneak account
109
+
110
+ ## 1.9.3
111
+
112
+ - Change ply circulating supply
113
+
114
+ ## 1.9.2
115
+
116
+ - Use 10B for PLY total supply
117
+
118
+ ## 1.9.1
119
+
120
+ - Handle error in fetching LP price
121
+
122
+ ## 1.9.0
123
+
124
+ - Rename `contracts` folder to `interactors`.
125
+ - Catching fetch price error
126
+
127
+ ## 1.8.6
128
+
129
+ - Fix bug in `formattedAmount` when using custom format.
130
+
131
+ ## 1.8.5
132
+
133
+ - Able to customize format in TokenAmount.formattedAmount()
134
+
135
+ ## 1.8.4
136
+
137
+ - Add campaign ids for referrals
138
+
139
+ ## 1.8.3
140
+
141
+ - Markets rewards + staking rewards can be claim in one txn by `SdkReadWrite(...).claim()`
142
+ - Remove `SdkReadWrite(...).claimLpRewards()`
143
+
144
+ ## 1.8.2
145
+
146
+ Bug fix on missing txnHash in referralReward type
147
+
148
+ ## 1.8.1
149
+
150
+ - Change campaign id
151
+
152
+ ## 1.8.0
153
+
154
+ - Return actual data for referral rewards.
155
+ - Change `ReferralRead(...).leaderboard()` to `ReferralRead(...).leaderboard(campaign: string)`: now can get the leaderboard of a given campaign.
156
+
157
+ ## 1.7.9-dummy
158
+
159
+ - Add `userAddr` in ReferralReward type
160
+
161
+ ## 1.7.8-dummy
162
+
163
+ - Update Meta rewards for stNEAR to `1,250,000` META.
164
+
165
+ ## 1.7.7-dummy
166
+
167
+ - [Dummy data] Add `ReferralRead(...).referralRewards(userAddr: Address): Promise<ReferralReward[]>`: Array of rewards, sorted by time of the referral period (from latest to oldest)
168
+ - [Dummy data] Add `ReferralRead(...).leaderboard(): Promise<ReferralReward[]>`: Top 50 reward earners from the last round, sorted by token amount.
169
+
170
+ - Add `ReferralReadWrite(...).claimReferralRewards()`: Claim all unclaimed rewards for a given user
171
+
172
+ New type:
173
+
174
+ ```ts
175
+ export type ReferralReward = {
176
+ campaign: string;
177
+ /**
178
+ * start timetamp of the referral round
179
+ */
180
+ startTime: number;
181
+ /**
182
+ * end timetamp of the referral round
183
+ */
184
+ endTime: number;
185
+ /**
186
+ * referrer's rewards
187
+ */
188
+ isReferrer: boolean;
189
+ /**
190
+ * reward amount
191
+ */
192
+ rewardTokenAmount: TokenAmount;
193
+ /**
194
+ * hash of the transaction on aurorascan (if no, return null)
195
+ */
196
+ transactionHash: string | null;
197
+ };
198
+ ```
199
+
200
+ ## 1.7.3
201
+
202
+ - Add helper functions for Auri monitoring system
203
+
204
+ ## 1.7.1 & 1.7.2
205
+
206
+ - Return correct timestamp in referrals list
207
+
208
+ ## 1.7.0
209
+
210
+ - 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.
211
+
212
+ ## 1.6.9
213
+
214
+ Support internal aurilens
215
+
216
+ ## 1.6.6
217
+
218
+ Use `public readonly` modifier instead of `private/protected` in SDK.
219
+
220
+ ## 1.6.5
221
+
222
+ SDK refactor #2, remove support for loterry campaign. Package size reduced from 3MB -> 200KB
223
+
224
+ ## 1.6.4
225
+
226
+ Return meaningful result instead of INF in `calcLMRewardApr`
227
+
228
+ ## 1.6.3
229
+
230
+ Add USN supports. Hardcoded USN price to $1.
231
+
232
+ ## 1.6.2
233
+
234
+ - 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.
235
+ - Add `ReferralRead(...).getReferralCodeOwner(code: string): Promise<Address>`: Get owner of a referral code, returns zero address if not found.
236
+ - Add `ReferralRead(...).getReferralCodeUsed(userAddr: Address): Promise<string>`: Get referral code that a user was referred by, returns empty string if not found.
237
+ - Add `ReferralReadWrite(...).registerNewReferralCode(): Promise<TransactionResponse>`: Generate a referral code for a given address. Called when an user want to creates his own referral code
238
+ - Add `ReferralReadWrite(...).useReferralCode(code: string): Promise<TransactionResponse>`: Called when an user confirms he is referred by a specified code
239
+
240
+ ## 1.6.1
241
+
242
+ Add `PapermillRead(...).getNextWeekTimestamp(): number`: get the start timestamp of next week of the papermill contract.
243
+
244
+ Add `SdkRead(...).getPlyCirculatingSupply(): Promise<TokenAmount>`: get the ply's circulating supply
245
+
246
+ ## 1.6.0
247
+
248
+ SDK refactor - Why?:
249
+
250
+ - more modular and less coupled.
251
+ - more testable.
252
+ - more maintainable.
253
+
254
+ Things to do:
255
+
256
+ - [x] Restructure the folder structure.
257
+ - Refactor the code - Use composition pattern to SDK class
258
+ - [x] Use address from contract package instead of hardcoded address.
259
+
260
+ ## 1.5.8 + 1.5.9
261
+
262
+ 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.
263
+
264
+ ## 1.5.7
265
+
266
+ - Change return type of `SdkRead(...).LpBalanceOf` and `stakeBalanceOf` from `TokenValuation` to `TokenAmount` to match other functions in the SDK.
267
+ - `totalStakedLiquidity` field in `PLYWNEARPoolDetails` is now `TokenAmount` instead of `TokenValuation`.
268
+
269
+ ```ts
270
+ export type PLYWNEARPoolDetails = {
271
+ totalStakedLiquidity: TokenAmount;
272
+ APYs: TokenAPY[];
273
+ };
274
+ ```
275
+
276
+ ## 1.5.6
277
+
278
+ Add PLYWNEAR pool to ALL_STAKING_POOLS
279
+
280
+ ## 1.5.5
281
+
282
+ Add auPLY market, integrate new fair launch contract
283
+
284
+ Hard code PULP price to 0
285
+
286
+ ## 1.5.4
287
+
288
+ Use browser-friendly assert
289
+
290
+ ## 1.5.2
291
+
292
+ Added `SdkRead(...).unclaimedRewardsOf(userAddress: Address): Promise<TokenAmount[]>` to get unclaimed rewards of a user in LP staking.
293
+
294
+ ## 1.5.1
295
+
296
+ Added `PapermillRead(...).getUnlockPortionAt(userAddress: Address, timestamp: number)`
297
+
298
+ ```ts
299
+ export type TokenAPY = {
300
+ address: string;
301
+ apy: string;
302
+ };
303
+
304
+ export type PLYWNEARPoolDetails = {
305
+ totalStakedLiquidity: TokenValuation;
306
+ APYs: TokenAPY[];
307
+ //apy: string; removed
308
+ };
309
+ ```
310
+
311
+ ## 1.5.0 For staking PLYWNEAR
312
+
313
+ ### Unchanged:
314
+
315
+ - Stake/unstake: Use `SdkReadWrite(...).stake(amount: TokenAmount)` (or `unstake`)
316
+
317
+ ### Rename:
318
+
319
+ - `SdkRead(...).getPlyAuroraPoolDetails` -> `SdkRead(...).getPLYWNEARPoolDetails`
320
+
321
+ ### Add
322
+
323
+ - Read:
324
+ - `SdkRead(...).LpBalanceOf(user: Address):TokenValuation` => amount and $ value of LP token in wallet. To get amount staked, use the old `stakeBalanceOf()` above
325
+ - Type:
326
+ - `TokenValuation` is a type that contains amount and $ value of token.
327
+
328
+ ```ts
329
+ export type TokenValuation = {
330
+ tokenAmount: TokenAmount;
331
+ currencyAmount: CurrencyAmount;
332
+ };
333
+ ```
334
+
335
+ ```ts
336
+ export type PLYWNEARPoolDetails = {
337
+ totalStakedLiquidity: TokenValuation;
338
+ apy: string;
339
+ };
340
+ ```
341
+
342
+ ### Return type changed:
343
+
344
+ - `SdkRead(...).stakeBalanceOf()` will return `TokenValuation` instead of `TokenAmount`
345
+
346
+ ### Remove:
347
+
348
+ - Type `PlyAuroraPoolDetails` removed.
349
+
350
+ ## 1.5.0 For Papermill
351
+
352
+ ### Add
353
+
354
+ - Read functions:
355
+
356
+ - `new PapermillRead(...).getPlyBalance(address: Address): TokenAmount` => PLY balance in user wallet
357
+ - `new PapermillRead(...).getPulpBalance(address: Address): TokenAmount` => PULP balance in user wallet
358
+ - `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()`)
359
+
360
+ - Write functions:
361
+
362
+ - `new PapermillReadWrite(...).redeem(recipient: Address, amount: TokenAmount)` => Redeem Ply from PULP. Set `amount` to `ethers.constants.MaxUint256` for max redeem.
363
+ - `new PapermillReadWrite(...).selfRedeem(amount: TokenAmount)` => Redeem Ply from PULP to msg.sender. This is just a shortcut for the redeem function above.
364
+ - Collect all PLY reward from all markets + staking pool: No added functions, using the old `SdkReadWrite(...).claim()`
365
+
366
+ - Type:
367
+ - `UserLockingDetails` to store all user locking details
368
+
369
+ ### Update
370
+
371
+ - `SdkRead(...).getUserDetails()`: this will include the result from `getLockingDetails`.
372
+
373
+ ### Remove
374
+
375
+ - `SdkRead(...).getLockingDetails()`: Use the `getLockingDetails` in papermill instead if needed.
376
+ - Remove `LockingDetails` type
package/dist/SDK.d.ts CHANGED
@@ -40,6 +40,8 @@ export declare class SdkRead extends BlockchainEntityRead {
40
40
  sneakAccounts(accounts: string[], tokenAddresses: string[], dust?: BigNumber): Promise<types.AccountAuTokensInfo[]>;
41
41
  getNetApyWithoutIncentive(userAddress: types.Address): Promise<BigNumber>;
42
42
  getNetApyWithIncentive(userAddress: types.Address): Promise<BigNumber>;
43
+ setUserNotificationSettings(address: types.Address, mail: string, utilisation: number, liquidation: boolean, captchaResponse: string): Promise<any>;
44
+ unsetUserNotificationSettings(address: types.Address, captchaResponse: string): Promise<any>;
43
45
  }
44
46
  export declare class SdkReadWrite extends SdkRead {
45
47
  /**
@@ -38,4 +38,3 @@ export declare function devLog(message?: any, ...optionalParams: any[]): void;
38
38
  * This method mutates the array and returns a reference to the same array.
39
39
  **/
40
40
  export declare function sortEvents<T extends Result>(events: TypedEvent<T>[]): TypedEvent<T>[];
41
- export declare function Cache(cacheTimeout: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -0,0 +1,2 @@
1
+ export declare function getApi(url: string, params?: Record<string, any>): Promise<any>;
2
+ export declare function postApi(url: string, body: Record<string, any>): Promise<any>;