@aurigami/sdk 1.5.10 → 1.6.0-no-src

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.
Files changed (55) hide show
  1. package/dist/SDK.d.ts +23 -16
  2. package/dist/consts/deployments.d.ts +3 -0
  3. package/dist/{dummy.d.ts → consts/dummy.d.ts} +3 -3
  4. package/dist/consts/index.d.ts +4 -0
  5. package/dist/{MoneyMarket.d.ts → contracts/MoneyMarket.d.ts} +3 -5
  6. package/dist/{Papermill.d.ts → contracts/Papermill.d.ts} +25 -4
  7. package/dist/{Staking.d.ts → contracts/Staking.d.ts} +8 -3
  8. package/dist/{airdrop-lottery.d.ts → contracts/airdrop-lottery.d.ts} +12 -4
  9. package/dist/contracts/index.d.ts +4 -0
  10. package/dist/{BlockchainEntity.d.ts → entities/BlockchainEntity.d.ts} +1 -1
  11. package/dist/entities/index.d.ts +3 -0
  12. package/dist/{tokenAmount.d.ts → entities/tokenAmount.d.ts} +1 -1
  13. package/dist/{helpers.d.ts → helpers/helpers.d.ts} +10 -1
  14. package/dist/helpers/index.d.ts +4 -0
  15. package/dist/{priceFetcher.d.ts → helpers/priceFetcher.d.ts} +2 -2
  16. package/dist/{transfer-event-query.d.ts → helpers/transfer-event-query.d.ts} +11 -2
  17. package/dist/index.d.ts +4 -11
  18. package/dist/sdk.cjs.development.js +1994 -104381
  19. package/dist/sdk.cjs.development.js.map +1 -1
  20. package/dist/sdk.cjs.production.min.js +1 -1
  21. package/dist/sdk.cjs.production.min.js.map +1 -1
  22. package/dist/sdk.esm.js +1990 -104384
  23. package/dist/sdk.esm.js.map +1 -1
  24. package/dist/{types.d.ts → types/index.d.ts} +15 -1
  25. package/package.json +12 -13
  26. package/src/BlockchainEntity.ts +0 -33
  27. package/src/MoneyMarket.ts +0 -510
  28. package/src/Papermill.ts +0 -262
  29. package/src/SDK.ts +0 -366
  30. package/src/Staking.ts +0 -183
  31. package/src/abis/Faucet.json +0 -157
  32. package/src/abis/IUniswapV2Pair.json +0 -663
  33. package/src/abis/Oracle.json +0 -247
  34. package/src/abis/dummy.json +0 -3
  35. package/src/airdrop-lottery.ts +0 -327
  36. package/src/airdrop_misc/auTokensInfo.json +0 -34
  37. package/src/airdrop_misc/whitelist.example.txt +0 -4
  38. package/src/airdrop_misc/whitelist.json +0 -102629
  39. package/src/aurora-api-helpers.ts +0 -20
  40. package/src/constants.ts +0 -143
  41. package/src/decimals.ts +0 -24
  42. package/src/deployments/aurora_mainnet.json +0 -31
  43. package/src/deployments/aurora_testnet.json +0 -31
  44. package/src/dummy.ts +0 -38
  45. package/src/helpers.ts +0 -91
  46. package/src/index.ts +0 -20
  47. package/src/priceFetcher.ts +0 -309
  48. package/src/token.ts +0 -21
  49. package/src/tokenAmount.ts +0 -42
  50. package/src/transfer-event-query.ts +0 -70
  51. package/src/types.ts +0 -106
  52. /package/dist/{constants.d.ts → consts/constants.d.ts} +0 -0
  53. /package/dist/{decimals.d.ts → consts/decimals.d.ts} +0 -0
  54. /package/dist/{token.d.ts → entities/token.d.ts} +0 -0
  55. /package/dist/{aurora-api-helpers.d.ts → helpers/aurora-api-helpers.d.ts} +0 -0
package/dist/SDK.d.ts CHANGED
@@ -1,31 +1,38 @@
1
1
  import { AuriFairLaunch, AuriLens, Comptroller } from '@aurigami/contracts/typechain';
2
2
  import { TransactionResponse } from '@ethersproject/abstract-provider';
3
- import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
4
- import { StakingRead } from './Staking';
5
- import { Token } from './token';
6
- import { TokenAmount } from './tokenAmount';
7
- import { CurrencyAmount, HypotheticalStats, MarketAction, NetworkConnection, PLYWNEARPoolDetails, UserDetails, UserMarketDetails } from './types';
3
+ import { StakingRead } from './contracts';
4
+ import { BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from './entities';
5
+ import * as types from './types';
8
6
  export declare class SdkRead extends BlockchainEntityRead {
9
7
  protected _comptroller: Comptroller;
10
8
  protected _auriFairLaunch: AuriFairLaunch;
11
9
  protected _auriLens: AuriLens;
12
10
  protected _stakingRead: StakingRead;
13
- constructor(networkConnection: NetworkConnection);
14
- getUserDetails(userAddress: string): Promise<UserDetails>;
15
- getPLYWNEARPoolDetails(): Promise<PLYWNEARPoolDetails>;
16
- getTokenPrice(token: Token): Promise<CurrencyAmount>;
11
+ constructor(networkConnection: types.NetworkConnection);
12
+ getUserDetails(userAddress: string): Promise<types.UserDetails>;
13
+ getPLYWNEARPoolDetails(): Promise<types.PLYWNEARPoolDetails>;
14
+ getTokenPrice(token: Token): Promise<types.CurrencyAmount>;
15
+ /**
16
+ * Get amount of staked LP tokens
17
+ */
17
18
  stakeBalanceOf(user: string): Promise<TokenAmount>;
19
+ /**
20
+ * Get amount of LP token in user wallet
21
+ */
18
22
  LpBalanceOf(user: string): Promise<TokenAmount>;
19
23
  unclaimedRewardsOf(user: string): Promise<TokenAmount[]>;
20
24
  calcHypotheticalStats({ userMarketDetail, currentBorrowLimit, currentBorrowValuation, action, tokenAmount, }: {
21
- userMarketDetail: UserMarketDetails;
22
- currentBorrowLimit: CurrencyAmount;
23
- currentBorrowValuation: CurrencyAmount;
24
- action: MarketAction;
25
+ userMarketDetail: types.UserMarketDetails;
26
+ currentBorrowLimit: types.CurrencyAmount;
27
+ currentBorrowValuation: types.CurrencyAmount;
28
+ action: types.MarketAction;
25
29
  tokenAmount?: TokenAmount;
26
- }): HypotheticalStats;
30
+ }): types.HypotheticalStats;
27
31
  }
28
32
  export declare class SdkReadWrite extends SdkRead {
33
+ /**
34
+ * Claim PLY reward in all markets + staking pools
35
+ */
29
36
  claim(): Promise<TransactionResponse>;
30
37
  claimLpRewards(): Promise<TransactionResponse>;
31
38
  stake(amount: TokenAmount): Promise<TransactionResponse>;
@@ -34,6 +41,6 @@ export declare class SdkReadWrite extends SdkRead {
34
41
  }
35
42
  export declare class SDK extends BlockchainEntity {
36
43
  constructor();
37
- read(networkConnection: NetworkConnection): SdkRead;
38
- readWrite(networkConnection: NetworkConnection): SdkReadWrite;
44
+ read(networkConnection: types.NetworkConnection): SdkRead;
45
+ readWrite(networkConnection: types.NetworkConnection): SdkReadWrite;
39
46
  }
@@ -0,0 +1,3 @@
1
+ import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
2
+ import TESTNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_testnet.json';
3
+ export { MAINNET_ADDRESSES, TESTNET_ADDRESSES };
@@ -1,6 +1,6 @@
1
- import { Token } from './token';
2
- import { TokenAmount } from './tokenAmount';
3
- import { UserMarketDetails } from './types';
1
+ import { Token } from '../entities';
2
+ import { TokenAmount } from '../entities';
3
+ import { UserMarketDetails } from '../types';
4
4
  export declare const dummyToken: Token;
5
5
  export declare const dummyPly: Token;
6
6
  export declare const dummyPlyAurora: Token;
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './decimals';
3
+ export * from './dummy';
4
+ export * from './deployments';
@@ -1,11 +1,9 @@
1
- import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
2
- import { MoneyMarketDetails, NetworkConnection, Address } from './types';
3
- import { BigNumber as BN } from 'ethers';
4
1
  import { AuErc20, AuETH, AuriLens, Comptroller, EthRepayHelper } from '@aurigami/contracts/typechain';
5
2
  import { TransactionResponse } from '@ethersproject/abstract-provider';
6
3
  import BigNumber from 'bignumber.js';
7
- import { Token } from './token';
8
- import { TokenAmount } from './tokenAmount';
4
+ import { BigNumber as BN } from 'ethers';
5
+ import { BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from '../entities';
6
+ import { Address, MoneyMarketDetails, NetworkConnection } from '../types';
9
7
  declare type RewardSpeeds = {
10
8
  plyRewardSupplySpeed: BN;
11
9
  plyRewardBorrowSpeed: BN;
@@ -1,9 +1,7 @@
1
- import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
2
- import { NetworkConnection, Address, UserLockingDetails } from './types';
3
1
  import { AuriFairLaunch, AuriLens, Comptroller, IERC20, PULP } from '@aurigami/contracts/typechain';
4
2
  import { TransactionResponse } from '@ethersproject/abstract-provider';
5
- import { Token } from './token';
6
- import { TokenAmount } from './tokenAmount';
3
+ import { BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from '../entities';
4
+ import { Address, NetworkConnection, UserLockingDetails } from '../types';
7
5
  export declare class PapermillRead extends BlockchainEntityRead {
8
6
  plyToken: Token;
9
7
  pulpToken: Token;
@@ -15,15 +13,38 @@ export declare class PapermillRead extends BlockchainEntityRead {
15
13
  constructor(networkConnection: NetworkConnection);
16
14
  getPlyBalance(userAddress: Address): Promise<TokenAmount>;
17
15
  getPulpBalance(userAddress: Address): Promise<TokenAmount>;
16
+ /**
17
+ * Get all unclaimed PLY reward of the user in all markets + all staking pools
18
+ */
18
19
  getUnclaimedPlyReward(userAddress: Address): Promise<TokenAmount>;
19
20
  private getWeek;
21
+ /**
22
+ * Get all locking details of the user in all markets + all staking pools
23
+ */
20
24
  getLockingDetails(userAddress: Address): Promise<UserLockingDetails>;
25
+ /**
26
+ * Get the first timestamp that the unlockPortion reach the target
27
+ *
28
+ * @param userAddress currently doesn't matter
29
+ * @param targetUnlockPortion unlockPortion target
30
+ */
21
31
  getTimestampToUnlock(userAddress: Address, targetUnlockPortion: number): Promise<number>;
22
32
  getUnlockPortionAt(userAddress: Address, timestamp: number): Promise<number>;
23
33
  }
24
34
  export declare class PapermillReadWrite extends PapermillRead {
25
35
  constructor(networkConnection: NetworkConnection);
36
+ /**
37
+ * Redeem PLY from PULP and transfer PLY to another address
38
+ * @param recipient Address that will receive the PLY.
39
+ * @param amount Amount of PULP to be converted to PLY.
40
+ * Set to ethers.constants.MaxUint256 for max redeem.
41
+ */
26
42
  redeem(recipient: Address, amount: TokenAmount): Promise<TransactionResponse>;
43
+ /**
44
+ * Redeem PLY from PULP and transfer PLY to msg.sender
45
+ * @param amount Amount of PULP to be converted to PLY.
46
+ * Set to ethers.constants.MaxUint256 for max redeem.
47
+ */
27
48
  selfRedeem(amount: TokenAmount): Promise<TransactionResponse>;
28
49
  }
29
50
  export declare class Papermill extends BlockchainEntity {
@@ -1,15 +1,20 @@
1
1
  import { AuriFairLaunch, AuriLens, Comptroller } from '@aurigami/contracts/typechain';
2
2
  import { TransactionResponse } from '@ethersproject/abstract-provider';
3
- import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
4
- import { TokenAmount } from './tokenAmount';
5
- import { NetworkConnection, PLYWNEARPoolDetails } from './types';
3
+ import { BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
4
+ import { NetworkConnection, PLYWNEARPoolDetails } from '../types';
6
5
  export declare class StakingRead extends BlockchainEntityRead {
7
6
  protected _comptroller: Comptroller;
8
7
  protected _auriFairLaunch: AuriFairLaunch;
9
8
  protected _auriLens: AuriLens;
10
9
  constructor(networkConnection: NetworkConnection);
11
10
  getPLYWNEARPoolDetails(): Promise<PLYWNEARPoolDetails>;
11
+ /**
12
+ * Get amount of staked LP tokens
13
+ */
12
14
  stakeBalanceOf(user: string): Promise<TokenAmount>;
15
+ /**
16
+ * Get amount of LP token in user wallet
17
+ */
13
18
  LpBalanceOf(user: string): Promise<TokenAmount>;
14
19
  unclaimedRewardsOf(user: string): Promise<TokenAmount[]>;
15
20
  }
@@ -1,8 +1,7 @@
1
- import { TransactionResponse } from '@ethersproject/abstract-provider';
2
- import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
3
- import { Address, NetworkConnection } from './types';
4
1
  import { AuriAirdrop } from '@aurigami/contracts/typechain';
5
- import { TokenAmount } from './tokenAmount';
2
+ import { TransactionResponse } from '@ethersproject/abstract-provider';
3
+ import { BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
4
+ import { Address, NetworkConnection } from '../types';
6
5
  export declare class AirdropRead extends BlockchainEntityRead {
7
6
  protected _airDrop: AuriAirdrop;
8
7
  private _whitelistedAddresses;
@@ -11,10 +10,19 @@ export declare class AirdropRead extends BlockchainEntityRead {
11
10
  countWhitelistedAddresses(): number;
12
11
  isWhitelisted(user: string): boolean;
13
12
  hasCompletedChallenge(user: string): Promise<boolean>;
13
+ /**
14
+ * Get redeemable rewards amount of user
15
+ */
14
16
  getRedeemableReward(campaign: string, token: Address, user: Address): Promise<TokenAmount>;
15
17
  }
16
18
  export declare class AirdropReadWrite extends AirdropRead {
19
+ /**
20
+ * Transfer rewards from multiple campaigns to msg.sender
21
+ */
17
22
  redeemMultiple(campaigns: string[], tokens: Address[]): Promise<TransactionResponse>;
23
+ /**
24
+ * Redeem reward from a single campaign
25
+ */
18
26
  redeemSingle(campaign: string, token: Address): Promise<TransactionResponse>;
19
27
  }
20
28
  export declare class Airdrop extends BlockchainEntity {
@@ -0,0 +1,4 @@
1
+ export * from './airdrop-lottery';
2
+ export * from './MoneyMarket';
3
+ export * from './Papermill';
4
+ export * from './Staking';
@@ -1,4 +1,4 @@
1
- import { NetworkConnection } from './types';
1
+ import { NetworkConnection } from '../types';
2
2
  export declare class BlockchainEntityRead {
3
3
  protected _networkConnection: NetworkConnection;
4
4
  constructor(networkConnection: NetworkConnection);
@@ -0,0 +1,3 @@
1
+ export * from './BlockchainEntity';
2
+ export * from './token';
3
+ export * from './tokenAmount';
@@ -1,5 +1,5 @@
1
1
  import { Token } from './token';
2
- import { Address } from './types';
2
+ import { Address } from '../types';
3
3
  export declare class TokenAmount {
4
4
  readonly token: Token;
5
5
  private rawAmnt;
@@ -1,6 +1,6 @@
1
1
  import { Provider } from '@ethersproject/abstract-provider';
2
2
  import BigNumber from 'bignumber.js';
3
- import { Address } from './types';
3
+ import { Address } from '../types';
4
4
  export declare function assert(condition: boolean, message?: string): void;
5
5
  export declare function formatObject(object: Object): string;
6
6
  export declare function decimalFactor(decimal: number): string;
@@ -10,4 +10,13 @@ export declare function validateAndParseAddress(address: Address): Address;
10
10
  export declare function getDecimal(address: Address): number;
11
11
  export declare function calcLMRewardApr(rewardsValue: BigNumber, totalStakeValue: BigNumber, frequencyPerYear: number): BigNumber;
12
12
  export declare function getBlockTimestamp(provider: Provider, blockNumber: number): Promise<number>;
13
+ /**
14
+ * Get the block number of the last block that has a timestamp before the given timestamp
15
+ * @param timestamp input timestamp
16
+ * @returns return the last block that its timestamp <= the give timestamp
17
+ * @note Check this API for more information: https://aurorascan.dev/apis#blocks
18
+ *
19
+ * This function is much faster than using binary search.
20
+ */
13
21
  export declare function getBlockBeforeTimestamp(provider: Provider, timestamp: number): Promise<number>;
22
+ export declare function devLog(message?: any, ...optionalParams: any[]): void;
@@ -0,0 +1,4 @@
1
+ export * from './aurora-api-helpers';
2
+ export * from './helpers';
3
+ export * from './priceFetcher';
4
+ export * from './transfer-event-query';
@@ -1,7 +1,7 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { providers, BigNumber as BN } from 'ethers';
3
- import { TokenAmount } from './tokenAmount';
4
- import { Address, TokenValuation } from './types';
3
+ import { TokenAmount } from '../entities/tokenAmount';
4
+ import { Address, TokenValuation } from '../types';
5
5
  export declare function fetchPriceFromCoingeckoAPI(id: string): Promise<BigNumber>;
6
6
  export declare function fetchPriceFromCoingecko(id: Address): Promise<BigNumber>;
7
7
  export declare function fetchLPPositions(LPAddress: Address, provider: providers.Provider): Promise<{
@@ -1,5 +1,5 @@
1
- import { BlockchainEntityRead } from './BlockchainEntity';
2
- import { NetworkConnection } from './types';
1
+ import { BlockchainEntityRead } from '../entities/BlockchainEntity';
2
+ import { NetworkConnection } from '../types';
3
3
  import { AuToken } from '@aurigami/contracts/typechain';
4
4
  import { BigNumber as BN } from 'ethers';
5
5
  declare type SimpleTransfer = {
@@ -11,7 +11,16 @@ declare type SimpleTransfer = {
11
11
  export declare class TransferEventQuery extends BlockchainEntityRead {
12
12
  auToken: AuToken;
13
13
  constructor(tokenAddr: string, networkConnection: NetworkConnection);
14
+ /**
15
+ * query ERC20 transfers from/to an address & auto convert them into SimpleTransfer.
16
+ * The result will be sorted by blocknumber.
17
+ */
14
18
  queryERC20TransfersOf(address: string, fromBlock: number, toBlock: number): Promise<SimpleTransfer[]>;
19
+ /**
20
+ * Get the balance of an address at a given block number.
21
+ *
22
+ * Note that this will return the balance after the block get mined.
23
+ */
15
24
  queryERC20BalanceAt(address: string, endBlock: number): Promise<BN>;
16
25
  }
17
26
  export {};
package/dist/index.d.ts CHANGED
@@ -1,13 +1,6 @@
1
- export * from './SDK';
2
- export * from './MoneyMarket';
3
- export * from './BlockchainEntity';
1
+ export * from './consts';
2
+ export * from './contracts';
3
+ export * from './entities';
4
4
  export * from './helpers';
5
- export * from './constants';
6
- export * from './dummy';
7
- export * from './priceFetcher';
8
- export * from './token';
9
- export * from './tokenAmount';
10
5
  export * from './types';
11
- export * from './airdrop-lottery';
12
- export * from './transfer-event-query';
13
- export * from './Papermill';
6
+ export * from './SDK';