aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/src/compiler.ts4
-rw-r--r--packages/deployer/src/deployer.ts6
-rw-r--r--packages/deployer/src/globals.d.ts1
-rw-r--r--packages/deployer/src/utils/contract.ts17
-rw-r--r--packages/deployer/src/utils/encoder.ts8
-rw-r--r--packages/deployer/src/utils/types.ts4
6 files changed, 20 insertions, 20 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 1f521dca1..4741a9086 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -1,3 +1,4 @@
+import { ContractAbi } from '@0xproject/types';
import { logUtils, promisify } from '@0xproject/utils';
import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
@@ -7,7 +8,6 @@ import * as path from 'path';
import * as requireFromString from 'require-from-string';
import * as semver from 'semver';
import solc = require('solc');
-import * as Web3 from 'web3';
import { binPaths } from './solc/bin_paths';
import {
@@ -189,7 +189,7 @@ export class Compiler {
`Contract ${contractName} not found in ${fileName}. Please make sure your contract has the same name as it's file name`,
);
}
- const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
+ const abi: ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;
const sourceMap = compiled.contracts[contractIdentifier].srcmap;
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts
index 68518a931..7ee45fed5 100644
--- a/packages/deployer/src/deployer.ts
+++ b/packages/deployer/src/deployer.ts
@@ -1,4 +1,4 @@
-import { AbiType, TxData } from '@0xproject/types';
+import { AbiType, ConstructorAbi, ContractAbi, TxData } from '@0xproject/types';
import { logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
@@ -71,7 +71,7 @@ export class Deployer {
gas,
};
const abi = contractNetworkDataIfExists.abi;
- const constructorAbi = _.find(abi, { type: AbiType.Constructor }) as Web3.ConstructorAbi;
+ const constructorAbi = _.find(abi, { type: AbiType.Constructor }) as ConstructorAbi;
const constructorArgs = _.isUndefined(constructorAbi) ? [] : constructorAbi.inputs;
if (constructorArgs.length !== args.length) {
const constructorSignature = `constructor(${_.map(constructorArgs, arg => `${arg.type} ${arg.name}`).join(
@@ -107,7 +107,7 @@ export class Deployer {
* @param txData Tx options used for deployment.
* @return Promise that resolves to a web3 contract instance.
*/
- private async _deployFromAbiAsync(abi: Web3.ContractAbi, args: any[], txData: Web3.TxData): Promise<any> {
+ private async _deployFromAbiAsync(abi: ContractAbi, args: any[], txData: TxData): Promise<any> {
const contract: Web3.Contract<Web3.ContractInstance> = this.web3Wrapper.getContractFromAbi(abi);
const deployPromise = new Promise((resolve, reject) => {
/**
diff --git a/packages/deployer/src/globals.d.ts b/packages/deployer/src/globals.d.ts
index 83db346f9..5b0d495d5 100644
--- a/packages/deployer/src/globals.d.ts
+++ b/packages/deployer/src/globals.d.ts
@@ -2,7 +2,6 @@ declare module 'dirty-chai';
// tslint:disable:completed-docs
declare module 'solc' {
- import * as Web3 from 'web3';
export interface ContractCompilationResult {
srcmap: string;
srcmapRuntime: string;
diff --git a/packages/deployer/src/utils/contract.ts b/packages/deployer/src/utils/contract.ts
index 9c57751ff..9b7baac11 100644
--- a/packages/deployer/src/utils/contract.ts
+++ b/packages/deployer/src/utils/contract.ts
@@ -1,4 +1,5 @@
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
+import { ContractAbi, EventAbi, FunctionAbi, MethodAbi, TxData } from '@0xproject/types';
import { promisify } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -7,14 +8,14 @@ import { AbiType } from './types';
export class Contract implements Web3.ContractInstance {
public address: string;
- public abi: Web3.ContractAbi;
+ public abi: ContractAbi;
private _contract: Web3.ContractInstance;
- private _defaults: Partial<Web3.TxData>;
+ private _defaults: Partial<TxData>;
private _validator: SchemaValidator;
// This class instance is going to be populated with functions and events depending on the ABI
// and we don't know their types in advance
[name: string]: any;
- constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<Web3.TxData>) {
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
this._contract = web3ContractInstance;
this.address = web3ContractInstance.address;
this.abi = web3ContractInstance.abi;
@@ -24,8 +25,8 @@ export class Contract implements Web3.ContractInstance {
this._validator = new SchemaValidator();
}
private _populateFunctions(): void {
- const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as Web3.FunctionAbi[];
- _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => {
+ const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as FunctionAbi[];
+ _.forEach(functionsAbi, (functionAbi: MethodAbi) => {
if (functionAbi.constant) {
const cbStyleCallFunction = this._contract[functionAbi.name].call;
this[functionAbi.name] = promisify(cbStyleCallFunction, this._contract);
@@ -42,8 +43,8 @@ export class Contract implements Web3.ContractInstance {
});
}
private _populateEvents(): void {
- const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as Web3.EventAbi[];
- _.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => {
+ const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as EventAbi[];
+ _.forEach(eventsAbi, (eventAbi: EventAbi) => {
this[eventAbi.name] = this._contract[eventAbi.name];
});
}
@@ -51,7 +52,7 @@ export class Contract implements Web3.ContractInstance {
const promisifiedWithDefaultParams = async (...args: any[]) => {
const promise = new Promise((resolve, reject) => {
const lastArg = args[args.length - 1];
- let txData: Partial<Web3.TxData> = {};
+ let txData: Partial<TxData> = {};
if (this._isTxData(lastArg)) {
txData = args.pop();
}
diff --git a/packages/deployer/src/utils/encoder.ts b/packages/deployer/src/utils/encoder.ts
index e3acde252..4f62662e1 100644
--- a/packages/deployer/src/utils/encoder.ts
+++ b/packages/deployer/src/utils/encoder.ts
@@ -1,15 +1,15 @@
+import { AbiDefinition, ContractAbi, DataItem } from '@0xproject/types';
import * as _ from 'lodash';
-import * as Web3 from 'web3';
import * as web3Abi from 'web3-eth-abi';
import { AbiType } from './types';
export const encoder = {
- encodeConstructorArgsFromAbi(args: any[], abi: Web3.ContractAbi): string {
+ encodeConstructorArgsFromAbi(args: any[], abi: ContractAbi): string {
const constructorTypes: string[] = [];
- _.each(abi, (element: Web3.AbiDefinition) => {
+ _.each(abi, (element: AbiDefinition) => {
if (element.type === AbiType.Constructor) {
- _.each(element.inputs, (input: Web3.DataItem) => {
+ _.each(element.inputs, (input: DataItem) => {
constructorTypes.push(input.type);
});
}
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
index 540b31aff..7cb3958cb 100644
--- a/packages/deployer/src/utils/types.ts
+++ b/packages/deployer/src/utils/types.ts
@@ -1,4 +1,4 @@
-import { TxData } from '@0xproject/types';
+import { ContractAbi, TxData } from '@0xproject/types';
import * as Web3 from 'web3';
import * as yargs from 'yargs';
@@ -23,7 +23,7 @@ export interface ContractNetworkData {
optimizer_enabled: boolean;
keccak256: string;
source_tree_hash: string;
- abi: Web3.ContractAbi;
+ abi: ContractAbi;
bytecode: string;
runtime_bytecode: string;
address?: string;