Merge pull request #1298 from 0xProject/fix/artifact-type-error

Fix Artifact Interface Type Issue
This commit is contained in:
Fabio B 2018-11-21 11:16:26 +00:00 committed by GitHub
commit a8803431b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 73 additions and 16 deletions

View File

@ -1,4 +1,14 @@
[
{
"version": "1.1.0",
"changes": [
{
"note":
"`deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface",
"pr": 1298
}
]
},
{
"timestamp": 1542208198,
"version": "1.0.5",

View File

@ -32,6 +32,7 @@
"devDependencies": {
"@0x/abi-gen": "^1.0.16",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.2.1",
"@0x/utils": "^2.0.5",
"@0x/web3-wrapper": "^3.1.4",
"ethereum-types": "^1.1.2",

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -1800,7 +1801,7 @@ export class AssetProxyOwnerContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_owners: string[],

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -968,7 +969,7 @@ export class DummyERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -1264,7 +1265,7 @@ export class DummyERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -601,7 +602,7 @@ export class ERC20ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20ProxyContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -508,7 +509,7 @@ export class ERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20TokenContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -601,7 +602,7 @@ export class ERC721ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721ProxyContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -845,7 +846,7 @@ export class ERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721TokenContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -3024,7 +3025,7 @@ export class ExchangeContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ExchangeContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -661,7 +662,7 @@ export class ForwarderContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -60,7 +61,7 @@ export class IValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IValidatorContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -55,7 +56,7 @@ export class IWalletContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IWalletContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -295,7 +296,7 @@ export class OrderValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -787,7 +788,7 @@ export class WETH9Contract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<WETH9Contract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -598,7 +599,7 @@ export class ZRXTokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ZRXTokenContract> {

View File

@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@ -40,7 +41,7 @@ export class {{contractName}}Contract extends BaseContract {
{{/this.constant}}
{{/each}}
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact,
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}

View File

@ -1,4 +1,14 @@
[
{
"version": "1.3.0",
"changes": [
{
"note":
"Add the `SimpleContractArtifact` type, which describes the artifact format published in the `@0x/contract-artifacts` package",
"pr": 1298
}
]
},
{
"version": "1.2.1",
"changes": [

View File

@ -1,7 +1,7 @@
// tslint:disable:max-file-line-count
import { BigNumber } from 'bignumber.js';
import { ContractAbi } from 'ethereum-types';
import { ContractAbi, ContractNetworks, DevdocOutput } from 'ethereum-types';
// HACK: Rather then extending from OrderWithoutExchangeAddress
// we don't, because our docs don't expand inherited types, and it's unnecessarily
@ -626,3 +626,24 @@ export interface EIP712TypedData {
export interface Stats {
orderCount: number;
}
export interface SimpleContractArtifact {
schemaVersion: string;
contractName: string;
compilerOutput: SimpleStandardContractOutput;
networks: ContractNetworks;
}
export interface SimpleStandardContractOutput {
abi: ContractAbi;
evm: SimpleEvmOutput;
devdoc?: DevdocOutput;
}
export interface SimpleEvmOutput {
bytecode: SimpleEvmBytecodeOutput;
}
export interface SimpleEvmBytecodeOutput {
object: string;
}