Skip to content

Commit

Permalink
Update imports to match private package more
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkchen committed Sep 23, 2020
1 parent 11210b8 commit 0a55752
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 65 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"scripts": {
"prod": "yarn run build",
"chain": "bash scripts/init_chain_internal.sh",
"build": "yarn run build-ts && yarn run tslint && tspath -f",
"build": "yarn run build-dist && yarn run tslint && tspath -f",
"build-ts": "tsc -p tsconfig.json",
"build-dist": "tsc -p tsconfig.dist.json",
"test": "jest --runInBand",
"test:watch": "jest --watch --runInBand",
"tslint": "tslint -c tslint.json -p tsconfig.json",
Expand Down
4 changes: 2 additions & 2 deletions src/api/ERC20API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';
import { Provider } from 'ethers/providers';

import ERC20Wrapper from '@src/wrappers/set-protocol-v2/ERC20Wrapper';
import Assertions from '@src/assertions';
import ERC20Wrapper from '../wrappers/set-protocol-v2/ERC20Wrapper';
import Assertions from '../assertions';

/**
* @title ERC20Wrapper
Expand Down
8 changes: 4 additions & 4 deletions src/api/FeeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { Address } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';

import StreamingFeeModuleWrapper from '@src/wrappers/set-protocol-v2/StreamingFeeModuleWrapper';
import Assertions from '@src/assertions';
import ProtocolViewerWrapper from '@src/wrappers/set-protocol-v2/ProtocolViewerWrapper';
import StreamingFeeModuleWrapper from '../wrappers/set-protocol-v2/StreamingFeeModuleWrapper';
import Assertions from '../assertions';
import ProtocolViewerWrapper from '../wrappers/set-protocol-v2/ProtocolViewerWrapper';
import { StreamingFeeInfo } from '../types';

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class FeeAPI {
* @param tokenAddresses Addresses of ERC20 contracts to check balance for
* @returns Array of streaming fee infos
*/
public async batchFetchStreamingFeeInfo(
public async batchFetchStreamingFeeInfoAsync(
tokenAddresses: Address[],
): Promise<StreamingFeeInfo[]> {
return await this.protocolViewerWrapper.batchFetchStreamingFeeInfo(tokenAddresses);
Expand Down
4 changes: 2 additions & 2 deletions src/api/IssuanceAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { Address } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';

import BasicIssuanceModuleWrapper from '@src/wrappers/set-protocol-v2/BasicIssuanceModuleWrapper';
import Assertions from '@src/assertions';
import BasicIssuanceModuleWrapper from '../wrappers/set-protocol-v2/BasicIssuanceModuleWrapper';
import Assertions from '../assertions';

/**
* @title IssuanceAPI
Expand Down
4 changes: 2 additions & 2 deletions src/api/NavIssuanceAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { Address } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';

import NavIssuanceModuleWrapper from '@src/wrappers/set-protocol-v2/NavIssuanceModuleWrapper';
import Assertions from '@src/assertions';
import NavIssuanceModuleWrapper from '../wrappers/set-protocol-v2/NavIssuanceModuleWrapper';
import Assertions from '../assertions';

/**
* @title NavIssuanceAPI
Expand Down
4 changes: 2 additions & 2 deletions src/api/PriceOracleAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { Provider } from 'ethers/providers';
import { Address } from 'set-protocol-v2/utils/types';
import { BigNumber } from 'ethers/utils';

import PriceOracleWrapper from '../../src/wrappers/set-protocol-v2/PriceOracleWrapper';
import Assertions from '../../src/assertions';
import PriceOracleWrapper from '../wrappers/set-protocol-v2/PriceOracleWrapper';
import Assertions from '../assertions';

/**
* @title PriceOracleAPI
Expand Down
10 changes: 5 additions & 5 deletions src/api/SetTokenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import { Provider } from 'ethers/providers';
import { Address, Position } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';

import SetTokenWrapper from '@src/wrappers/set-protocol-v2/SetTokenWrapper';
import Assertions from '@src/assertions';
import { ModuleState } from '@src/types';
import ProtocolViewerWrapper from '@src/wrappers/set-protocol-v2/ProtocolViewerWrapper';
import SetTokenWrapper from '../wrappers/set-protocol-v2/SetTokenWrapper';
import Assertions from '../assertions';
import { ModuleState } from '../types';
import ProtocolViewerWrapper from '../wrappers/set-protocol-v2/ProtocolViewerWrapper';

/**
* @title SetTokenWrapper
Expand Down Expand Up @@ -59,7 +59,7 @@ export default class SetTokenAPI {
* @param tokenAddresses Addresses of ERC20 contracts to check balance for
* @returns Addresses of managers of the set tokens
*/
public async batchFetchManagers(
public async batchFetchManagersAsync(
tokenAddresses: Address[],
): Promise<Address[]> {
return await this.protocolViewerWrapper.batchFetchManagers(tokenAddresses);
Expand Down
2 changes: 1 addition & 1 deletion src/api/SystemAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Provider } from 'ethers/providers';
import { Address } from 'set-protocol-v2/utils/types';

import ControllerWrapper from '@src/wrappers/set-protocol-v2/ControllerWrapper';
import ControllerWrapper from '../wrappers/set-protocol-v2/ControllerWrapper';

/**
* @title SystemAPI
Expand Down
4 changes: 2 additions & 2 deletions src/api/TradeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { Address } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber, Arrayish } from 'ethers/utils';

import TradeModuleWrapper from '@src/wrappers/set-protocol-v2/TradeModuleWrapper';
import Assertions from '@src/assertions';
import TradeModuleWrapper from '../wrappers/set-protocol-v2/TradeModuleWrapper';
import Assertions from '../assertions';

/**
* @title TradeAPI
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export { BigNumber } from 'ethers/utils';
export {
SetJSConfig,
ModuleState,
} from '@src/types/index';
} from './types/index';

export default Set;
4 changes: 2 additions & 2 deletions src/wrappers/set-protocol-v2/BasicIssuanceModuleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

'use strict';

import { Address } from 'set-protocol-v2/utils/types';
import { Address } from 'set-protocol-v2/dist/utils/types';
import { ContractTransaction } from 'ethers';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';
import { Provider } from 'ethers/providers';
import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';

import ContractWrapper from './ContractWrapper';

Expand Down
29 changes: 0 additions & 29 deletions src/wrappers/set-protocol-v2/ContractWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
SetTokenCreator,
StreamingFeeModule,
TradeModule,
OneInchExchangeAdapter,
NavIssuanceModule,
PriceOracle,
} from 'set-protocol-v2/dist/utils/contracts';
Expand All @@ -41,7 +40,6 @@ import { SetTokenFactory } from 'set-protocol-v2/dist/typechain/SetTokenFactory'
import { SetTokenCreatorFactory } from 'set-protocol-v2/dist/typechain/SetTokenCreatorFactory';
import { StreamingFeeModuleFactory } from 'set-protocol-v2/dist/typechain/StreamingFeeModuleFactory';
import { TradeModuleFactory } from 'set-protocol-v2/dist/typechain/TradeModuleFactory';
import { OneInchExchangeAdapterFactory } from 'set-protocol-v2/dist/typechain/OneInchExchangeAdapterFactory';
import { NavIssuanceModuleFactory } from 'set-protocol-v2/dist/typechain/NavIssuanceModuleFactory';
import { PriceOracleFactory } from 'set-protocol-v2/dist/typechain/PriceOracleFactory';

Expand Down Expand Up @@ -222,33 +220,6 @@ export default class ContractWrapper {
}
}

/**
* Load OneInchExchangeAdapter contract
*
* @param oneInchExchangeAdapterAddress Address of the one inch exchange adapter
* @param callerAddress Address of caller, uses first one on node if none provided.
* @return OneInchExchangeAdapter contract instance
*/
public async loadOneInchExchangeAdapterAsync(
oneInchExchangeAdapterAddress: Address,
callerAddress?: Address,
): OneInchExchangeAdapter {
const signer = (this.provider as JsonRpcProvider).getSigner(callerAddress);
const cacheKey = `OneInchExchangeAdapter_${oneInchExchangeAdapterAddress}_${await signer.getAddress()}`;

if (cacheKey in this.cache) {
return this.cache[cacheKey] as OneInchExchangeAdapter;
} else {
const oneInchExchangeAdapterContract = OneInchExchangeAdapterFactory.connect(
oneInchExchangeAdapterAddress,
signer
);

this.cache[cacheKey] = oneInchExchangeAdapterContract;
return oneInchExchangeAdapterContract;
}
}

/**
* Load Set Token contract
*
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/ERC20Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';
import { Provider } from 'ethers/providers';

import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';
import ContractWrapper from './ContractWrapper';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/NavIssuanceModuleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ContractTransaction } from 'ethers';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber, BigNumberish } from 'ethers/utils';
import { Provider } from 'ethers/providers';
import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';

import ContractWrapper from './ContractWrapper';

Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/ProtocolViewerWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Provider, JsonRpcProvider } from 'ethers/providers';
import { Address } from 'set-protocol-v2/utils/types';

import ContractWrapper from './ContractWrapper';
import { StreamingFeeInfo } from '@src/types';
import { StreamingFeeInfo } from '../../types';

/**
* @title ProtocolViewerWrapper
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/SetTokenWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Address, Position } from 'set-protocol-v2/utils/types';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';

import ContractWrapper from './ContractWrapper';
import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';

/**
* @title SetTokenWrapper
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/StreamingFeeModuleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ContractTransaction } from 'ethers';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber } from 'ethers/utils';
import { Provider } from 'ethers/providers';
import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';

import ContractWrapper from './ContractWrapper';

Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/set-protocol-v2/TradeModuleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ContractTransaction } from 'ethers';
import { TransactionOverrides } from 'set-protocol-v2/dist/typechain';
import { BigNumber, Arrayish } from 'ethers/utils';
import { Provider } from 'ethers/providers';
import { generateTxOpts } from '@src/utils/transactions';
import { generateTxOpts } from '../../utils/transactions';

import ContractWrapper from './ContractWrapper';

Expand Down
4 changes: 2 additions & 2 deletions test/api/FeeAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('FeeAPI', () => {
(ProtocolViewerWrapper as any).mockClear();
});

describe('#batchFetchStreamingFeeInfo', () => {
describe('#batchFetchStreamingFeeInfoAsync', () => {
let subjectSetTokenAddress1: Address;
let subjectSetTokenAddress2: Address;

Expand All @@ -63,7 +63,7 @@ describe('FeeAPI', () => {
});

async function subject(): Promise<StreamingFeeInfo[]> {
return await feeAPI.batchFetchStreamingFeeInfo(
return await feeAPI.batchFetchStreamingFeeInfoAsync(
[subjectSetTokenAddress1, subjectSetTokenAddress2]
);
}
Expand Down
4 changes: 2 additions & 2 deletions test/api/SetTokenAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('SetTokenAPI', () => {
(ProtocolViewerWrapper as any).mockClear();
});

describe('#batchFetchManagers', () => {
describe('#batchFetchManagersAsync', () => {
let subjectSetTokenAddress1: Address;
let subjectSetTokenAddress2: Address;
let setTokenAddresses: Address[];
Expand All @@ -63,7 +63,7 @@ describe('SetTokenAPI', () => {
});

async function subject(): Promise<Address[]> {
return await setTokenAPI.batchFetchManagers(setTokenAddresses);
return await setTokenAPI.batchFetchManagersAsync(setTokenAddresses);
}

it('should call the ProtocolViewerWrapper with correct params', async () => {
Expand Down
6 changes: 6 additions & 0 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"exclude": [
"test/**/*.ts"
]
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
// "declaration": true,
// "declarationDir": "./dist/types",
"declaration": true,
"declarationDir": "./dist/types",
"paths": {
"@src/*": [ "src/*" ],
"@test/*": [ "test/*" ]
Expand Down

0 comments on commit 0a55752

Please sign in to comment.