aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-27 21:19:23 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-27 23:56:21 +0800
commitd72b7299c66ea6d63eb14595b06456c02b2ad99b (patch)
treee026f0af7f779c0c94ddc1261f630dd8ca923af5 /packages/0x.js/src/contract_wrappers/contract_wrapper.ts
parent066d13f5b7260d28b13195c4f9aed48b4ae96cc3 (diff)
downloaddexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar.gz
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar.bz2
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar.lz
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar.xz
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.tar.zst
dexon-sol-tools-d72b7299c66ea6d63eb14595b06456c02b2ad99b.zip
Move common types out of web3 types
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/contract_wrapper.ts')
-rw-r--r--packages/0x.js/src/contract_wrappers/contract_wrapper.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
index ad7727de5..6c96428ed 100644
--- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
@@ -1,4 +1,4 @@
-import { BlockParamLiteral, LogWithDecodedArgs, RawLog } from '@0xproject/types';
+import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from '@0xproject/types';
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Block, BlockAndLogStreamer } from 'ethereumjs-blockstream';
@@ -35,7 +35,7 @@ export class ContractWrapper {
private _abiDecoder?: AbiDecoder;
private _blockAndLogStreamerIfExists?: BlockAndLogStreamer;
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
- private _filters: { [filterToken: string]: Web3.FilterObject };
+ private _filters: { [filterToken: string]: FilterObject };
private _filterCallbacks: {
[filterToken: string]: EventCallback<ContractEventArgs>;
};
@@ -75,7 +75,7 @@ export class ContractWrapper {
address: string,
eventName: ContractEvents,
indexFilterValues: IndexedFilterValues,
- abi: Web3.ContractAbi,
+ abi: ContractAbi,
callback: EventCallback<ArgsType>,
): string {
const filter = filterUtils.getFilter(address, eventName, indexFilterValues, abi);
@@ -92,7 +92,7 @@ export class ContractWrapper {
eventName: ContractEvents,
blockRange: BlockRange,
indexFilterValues: IndexedFilterValues,
- abi: Web3.ContractAbi,
+ abi: ContractAbi,
): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
const filter = filterUtils.getFilter(address, eventName, indexFilterValues, abi, blockRange);
const logs = await this._web3Wrapper.getLogsAsync(filter);
@@ -100,7 +100,7 @@ export class ContractWrapper {
return logsWithDecodedArguments;
}
protected _tryToDecodeLogOrNoop<ArgsType extends ContractEventArgs>(
- log: Web3.LogEntry,
+ log: LogEntry,
): LogWithDecodedArgs<ArgsType> | RawLog {
if (_.isUndefined(this._abiDecoder)) {
throw new Error(InternalZeroExError.NoAbiDecoder);
@@ -111,7 +111,7 @@ export class ContractWrapper {
protected async _getContractAbiAndAddressFromArtifactsAsync(
artifact: Artifact,
addressIfExists?: string,
- ): Promise<[Web3.ContractAbi, string]> {
+ ): Promise<[ContractAbi, string]> {
let contractAddress: string;
if (_.isUndefined(addressIfExists)) {
if (_.isUndefined(artifact.networks[this._networkId])) {
@@ -125,7 +125,7 @@ export class ContractWrapper {
if (!doesContractExist) {
throw new Error(CONTRACT_NAME_TO_NOT_FOUND_ERROR[artifact.contract_name]);
}
- const abiAndAddress: [Web3.ContractAbi, string] = [artifact.abi, contractAddress];
+ const abiAndAddress: [ContractAbi, string] = [artifact.abi, contractAddress];
return abiAndAddress;
}
protected _getContractAddress(artifact: Artifact, addressIfExists?: string): string {
@@ -139,8 +139,8 @@ export class ContractWrapper {
return addressIfExists;
}
}
- private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, log: Web3.LogEntry): void {
- _.forEach(this._filters, (filter: Web3.FilterObject, filterToken: string) => {
+ private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, log: LogEntry): void {
+ _.forEach(this._filters, (filter: FilterObject, filterToken: string) => {
if (filterUtils.matchesFilter(log, filter)) {
const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>;
const logEvent = {