From 4b64d8c3aad3e1fa3d807941e70f2901941c2501 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 20 Nov 2018 23:06:46 +0000 Subject: Allow a `SimpleContractArtifact` to be passed into `deployFrom0xArtifactAsync` --- packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts | 3 ++- packages/contract_templates/contract.handlebars | 3 ++- packages/types/src/index.ts | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index ffd498055..a04b6025e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -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, ): Promise { diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 9c1952ed4..9b2a2b336 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -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, {{> typed_params inputs=ctor.inputs}} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 3c9b6bbc5..fd40f361a 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,7 +1,7 @@ // tslint:disable:max-file-line-count import { BigNumber } from 'bignumber.js'; -import { ContractAbi } from 'ethereum-types'; +import { ContractAbi, ContractNetworks, StandardContractOutput } 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,10 @@ export interface EIP712TypedData { export interface Stats { orderCount: number; } + +export interface SimpleContractArtifact { + schemaVersion: string; + contractName: string; + compilerOutput: StandardContractOutput; + networks: ContractNetworks; +} -- cgit v1.2.3