@aurigami/sdk 1.5.2 → 1.5.4
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.d.ts +2 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/sdk.cjs.development.js +17 -5
- 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 +17 -6
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +6 -4
- package/src/airdrop-lottery.ts +1 -1
- package/src/helpers.ts +6 -1
- package/src/priceFetcher.ts +1 -2
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -40,8 +40,10 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
40
40
|
protected _comptroller: Comptroller;
|
|
41
41
|
protected _auriFairLaunch: AuriFairLaunch;
|
|
42
42
|
protected _auriLens: AuriLens;
|
|
43
|
+
protected _stakingRead: StakingRead;
|
|
43
44
|
constructor(networkConnection: NetworkConnection) {
|
|
44
45
|
super(networkConnection);
|
|
46
|
+
this._stakingRead = new StakingRead(networkConnection);
|
|
45
47
|
this._comptroller = new Contract(
|
|
46
48
|
networkAddresses.misc.COMPTROLLER,
|
|
47
49
|
ComptrollerABI.abi,
|
|
@@ -211,7 +213,7 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
public async getPLYWNEARPoolDetails(): Promise<PLYWNEARPoolDetails> {
|
|
214
|
-
return
|
|
216
|
+
return this._stakingRead.getPLYWNEARPoolDetails();
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
public async getTokenPrice(token: Token): Promise<CurrencyAmount> {
|
|
@@ -229,18 +231,18 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
229
231
|
* Get amount and value in $ of staked LP tokens
|
|
230
232
|
*/
|
|
231
233
|
public async stakeBalanceOf(user: string): Promise<TokenValuation> {
|
|
232
|
-
return
|
|
234
|
+
return this._stakingRead.stakeBalanceOf(user);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
/**
|
|
236
238
|
* Get amount and value in $ of LP token in user wallet
|
|
237
239
|
*/
|
|
238
240
|
public async LpBalanceOf(user: string): Promise<TokenValuation> {
|
|
239
|
-
return
|
|
241
|
+
return this._stakingRead.LpBalanceOf(user);
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
public async unclaimedRewardsOf(user: string): Promise<TokenAmount[]> {
|
|
243
|
-
return
|
|
245
|
+
return this._stakingRead.unclaimedRewardsOf(user);
|
|
244
246
|
}
|
|
245
247
|
|
|
246
248
|
public calcHypotheticalStats({
|
package/src/airdrop-lottery.ts
CHANGED
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
getCurrentTimestamp,
|
|
17
17
|
getDecimal,
|
|
18
18
|
isSameAddress,
|
|
19
|
+
assert,
|
|
19
20
|
} from './helpers';
|
|
20
21
|
import AIRDROP_AUTOKEN_INFO from './airdrop_misc/auTokensInfo.json';
|
|
21
22
|
import AIRDROP_WHITELIST_ADDRESSES from './airdrop_misc/whitelist.json';
|
|
22
23
|
import { AuriAirdrop } from '@aurigami/contracts/typechain';
|
|
23
|
-
import assert from 'assert';
|
|
24
24
|
import { TokenAmount } from './tokenAmount';
|
|
25
25
|
import { Token } from './token';
|
|
26
26
|
|
package/src/helpers.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
-
import assert from 'assert';
|
|
3
2
|
import BigNumber from 'bignumber.js';
|
|
4
3
|
import { BigNumber as BN, utils } from 'ethers';
|
|
5
4
|
import { getQuery as getAuroraAPIQuery } from './aurora-api-helpers';
|
|
6
5
|
import { decimalRecords } from './decimals';
|
|
7
6
|
import { Address } from './types';
|
|
8
7
|
|
|
8
|
+
export function assert(condition: boolean, message: string = ''): void {
|
|
9
|
+
if (!condition) {
|
|
10
|
+
throw new Error(message ?? 'Assertion failed');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
export function formatObject(object: Object) {
|
|
10
15
|
return JSON.stringify(object, null, ' ');
|
|
11
16
|
}
|
package/src/priceFetcher.ts
CHANGED
|
@@ -6,14 +6,13 @@ import {
|
|
|
6
6
|
PRICE_WHITELISTED,
|
|
7
7
|
} from './constants';
|
|
8
8
|
import OracleABI from './abis/Oracle.json';
|
|
9
|
-
import { isSameAddress, decimalFactor, getDecimal } from './helpers';
|
|
9
|
+
import { isSameAddress, decimalFactor, getDecimal, assert } from './helpers';
|
|
10
10
|
import { IUniswapV2Pair, PriceOracle } from '@aurigami/contracts/typechain';
|
|
11
11
|
import { TokenAmount } from './tokenAmount';
|
|
12
12
|
import { Address, TokenValuation } from './types';
|
|
13
13
|
import IUniswapV2PairABI from './abis/IUniswapV2Pair.json';
|
|
14
14
|
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
15
15
|
import axios from 'axios';
|
|
16
|
-
import assert from 'assert';
|
|
17
16
|
|
|
18
17
|
const hardcodePLYPrice = true;
|
|
19
18
|
export async function fetchPriceFromCoingeckoAPI(
|