@aurigami/sdk 1.5.0-dummy → 1.5.0-dummy-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.
@@ -1,60 +1,70 @@
1
- import { BlockchainEntityRead } from "./BlockchainEntity";
2
- import { NetworkConnection } from "./types";
3
- import { AuToken } from "@aurigami/contracts/typechain";
1
+ import { BlockchainEntityRead } from './BlockchainEntity';
2
+ import { NetworkConnection } from './types';
3
+ import { AuToken } from '@aurigami/contracts/typechain';
4
4
  import AuTokenABI from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
5
- import { BigNumber as BN, Contract } from "ethers";
5
+ import { BigNumber as BN, Contract } from 'ethers';
6
6
 
7
7
  type SimpleTransfer = {
8
- from: string;
9
- to: string;
10
- amount: BN;
11
- blockNumber: number;
12
- }
13
-
8
+ from: string;
9
+ to: string;
10
+ amount: BN;
11
+ blockNumber: number;
12
+ };
14
13
 
15
14
  export class TransferEventQuery extends BlockchainEntityRead {
16
- auToken: AuToken;
17
-
18
- constructor(
19
- tokenAddr: string,
20
- networkConnection: NetworkConnection
21
- ) {
22
- super(networkConnection);
23
- this.auToken = new Contract(tokenAddr, AuTokenABI.abi, this._networkConnection.provider) as AuToken;
24
- }
25
-
26
- /**
27
- * query ERC20 transfers from/to an address & auto convert them into SimpleTransfer.
28
- * The result will be sorted by blocknumber.
29
- */
30
- async queryERC20TransfersOf(address: string, fromBlock: number, toBlock: number): Promise<SimpleTransfer[]> {
31
- const filters = [
32
- this.auToken.filters.Transfer(address, null),
33
- this.auToken.filters.Transfer(null, address)
34
- ]
35
-
36
- const events = (await Promise.all(filters.map(filter => this.auToken.queryFilter(filter, fromBlock, toBlock)))).flat();
37
-
38
- let results: SimpleTransfer[] = events.map((event) => {
39
- return {
40
- from: event.args![0],
41
- to: event.args![1],
42
- amount: event.args![2],
43
- blockNumber: event.blockNumber,
44
- };
45
- });
46
-
47
- results.sort((a, b) => a.blockNumber - b.blockNumber);
48
-
49
- return results;
50
- }
51
-
52
- /**
53
- * Get the balance of an address at a given block number.
54
- *
55
- * Note that this will return the balance after the block get mined.
56
- */
57
- async queryERC20BalanceAt(address: string, endBlock: number): Promise<BN> {
58
- return this.auToken.balanceOf(address, {blockTag: endBlock + 1});
59
- }
15
+ auToken: AuToken;
16
+
17
+ constructor(tokenAddr: string, networkConnection: NetworkConnection) {
18
+ super(networkConnection);
19
+ this.auToken = new Contract(
20
+ tokenAddr,
21
+ AuTokenABI.abi,
22
+ this._networkConnection.provider
23
+ ) as AuToken;
24
+ }
25
+
26
+ /**
27
+ * query ERC20 transfers from/to an address & auto convert them into SimpleTransfer.
28
+ * The result will be sorted by blocknumber.
29
+ */
30
+ async queryERC20TransfersOf(
31
+ address: string,
32
+ fromBlock: number,
33
+ toBlock: number
34
+ ): Promise<SimpleTransfer[]> {
35
+ const filters = [
36
+ this.auToken.filters.Transfer(address, null),
37
+ this.auToken.filters.Transfer(null, address),
38
+ ];
39
+
40
+ const events = (
41
+ await Promise.all(
42
+ filters.map((filter) =>
43
+ this.auToken.queryFilter(filter, fromBlock, toBlock)
44
+ )
45
+ )
46
+ ).flat();
47
+
48
+ let results: SimpleTransfer[] = events.map((event) => {
49
+ return {
50
+ from: event.args![0],
51
+ to: event.args![1],
52
+ amount: event.args![2],
53
+ blockNumber: event.blockNumber,
54
+ };
55
+ });
56
+
57
+ results.sort((a, b) => a.blockNumber - b.blockNumber);
58
+
59
+ return results;
60
+ }
61
+
62
+ /**
63
+ * Get the balance of an address at a given block number.
64
+ *
65
+ * Note that this will return the balance after the block get mined.
66
+ */
67
+ async queryERC20BalanceAt(address: string, endBlock: number): Promise<BN> {
68
+ return this.auToken.balanceOf(address, { blockTag: endBlock + 1 });
69
+ }
60
70
  }
package/src/types.ts CHANGED
@@ -3,24 +3,24 @@ import { TokenAmount } from './tokenAmount';
3
3
 
4
4
  export enum ComptrollerRewardType {
5
5
  PLY = 0,
6
- AURORA
7
- };
8
- export type NetworkConnection = {
9
- provider: providers.Provider,
10
- signer?: Signer
6
+ AURORA,
11
7
  }
8
+ export type NetworkConnection = {
9
+ provider: providers.Provider;
10
+ signer?: Signer;
11
+ };
12
12
 
13
13
  export type Address = string;
14
14
 
15
15
  export type CurrencyAmount = {
16
- currency: string,
17
- amount: string
16
+ currency: string;
17
+ amount: string;
18
18
  };
19
19
 
20
20
  export type TokenValuation = {
21
- tokenAmount: TokenAmount,
22
- currencyAmount: CurrencyAmount,
23
- }
21
+ tokenAmount: TokenAmount;
22
+ currencyAmount: CurrencyAmount;
23
+ };
24
24
 
25
25
  export type MoneyMarketDetails = {
26
26
  auTokenAddress: string;
@@ -92,10 +92,10 @@ export enum MarketAction {
92
92
  Withdraw,
93
93
  Repay,
94
94
  EnableCollateral,
95
- DisableCollateral
95
+ DisableCollateral,
96
96
  }
97
97
 
98
98
  export type HypotheticalStats = {
99
99
  newBorrowLimit: CurrencyAmount;
100
100
  newBorrowUtilization: number;
101
- }
101
+ };
@@ -1,6 +0,0 @@
1
- import { HardhatUserConfig } from "hardhat/config";
2
- import '@nomiclabs/hardhat-etherscan';
3
- import '@nomiclabs/hardhat-ethers';
4
- import '@nomiclabs/hardhat-waffle';
5
- declare const config: HardhatUserConfig;
6
- export default config;
@@ -1,6 +0,0 @@
1
- import { ethers, Signer } from 'ethers';
2
- export declare const AVAX_DEFAULT_PROVIDER_URL = "https://api.avax.network/ext/bc/C/rpc";
3
- export declare const AVAX_DEFAULT_PROVIDER: ethers.providers.JsonRpcProvider;
4
- export declare const AURORA_DEFAULT_PROVIDER_URL: string;
5
- export declare const AURORA_DEFAULT_PROVIDER: ethers.providers.JsonRpcProvider;
6
- export declare const AURORA_DEFAULT_SIGNER: Signer;
@@ -1,6 +0,0 @@
1
- import { Address } from '../src/types';
2
- import { AuriFairLaunch } from '@aurigami/contracts/typechain';
3
- export declare function impersonate(address: Address): Promise<void>;
4
- export declare function prepareERC20Balance(tokenAddress: Address, tokenHolder: Address, receiver: Address, amount?: string): Promise<void>;
5
- export declare function getFairLaunchContract(): Promise<AuriFairLaunch>;
6
- export declare function createStakingPool(stakeToken: Address): Promise<void>;