diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-10-09 18:55:10 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-10-09 22:01:34 +0800 |
commit | 22160df2d2d5aef63c3e2c3f502ac15119b18e07 (patch) | |
tree | c217e59fe3cc34108647bfc9f2ed7b6ae9876421 | |
parent | 31ee8870b80579caf3762c1178043bb5bb6fe4fb (diff) | |
download | dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.gz dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.bz2 dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.lz dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.xz dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.zst dexon-0x-contracts-22160df2d2d5aef63c3e2c3f502ac15119b18e07.zip |
Fix ethers build issue
-rw-r--r-- | packages/base-contract/src/index.ts | 9 | ||||
-rw-r--r-- | packages/contract_templates/contract.handlebars | 4 | ||||
-rw-r--r-- | packages/utils/src/abi_decoder.ts | 7 | ||||
-rw-r--r-- | yarn.lock | 51 |
4 files changed, 19 insertions, 52 deletions
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 981e6fca6..7e0428d92 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -12,12 +12,13 @@ import { TxDataPayable, } from 'ethereum-types'; import * as ethers from 'ethers'; +import { Interface } from 'ethers/utils/interface'; import * as _ from 'lodash'; import { formatABIDataItem } from './utils'; export interface EthersInterfaceByFunctionSignature { - [key: string]: ethers.Interface; + [key: string]: Interface; } const REVERT_ERROR_SELECTOR = '08c379a0'; @@ -101,7 +102,7 @@ export class BaseContract { // if it overflows the corresponding Solidity type, there is a bug in the // encoder, or the encoder performs unsafe type coercion. public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void { - const coder = new ethers.AbiCoder(); + const coder = new ethers.utils.AbiCoder(); const params = abiUtils.parseEthersParams(inputAbi); const rawEncoded = coder.encode(inputAbi, args); const rawDecoded = coder.decode(inputAbi, rawEncoded); @@ -117,7 +118,7 @@ export class BaseContract { } } } - protected _lookupEthersInterface(functionSignature: string): ethers.Interface { + protected _lookupEthersInterface(functionSignature: string): Interface { const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature]; if (_.isUndefined(ethersInterface)) { throw new Error(`Failed to lookup method with function signature '${functionSignature}'`); @@ -154,7 +155,7 @@ export class BaseContract { this._ethersInterfacesByFunctionSignature = {}; _.each(methodAbis, methodAbi => { const functionSignature = abiUtils.getFunctionSignature(methodAbi); - this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.Interface([methodAbi]); + this._ethersInterfacesByFunctionSignature[functionSignature] = new Interface([methodAbi]); }); } } diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 9ae39f44f..de48779d3 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -5,7 +5,7 @@ import { BaseContract } from '@0xproject/base-contract'; import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; +import { Interface } from 'ethers/utils/interface'; import * as _ from 'lodash'; // tslint:enable:no-unused-variable @@ -65,7 +65,7 @@ export class {{contractName}}Contract extends BaseContract { [{{> params inputs=ctor.inputs}}], BaseContract._bigNumberToString, ); - const iface = new ethers.Interface(abi); + const iface = new Interface(abi); const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]); const web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index ea8c91d10..836037f30 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -9,7 +9,8 @@ import { RawLog, SolidityTypes, } from 'ethereum-types'; -import * as ethers from 'ethers'; +import { ethers } from 'ethers'; +import { Interface } from 'ethers/utils/interface'; import * as _ from 'lodash'; import { addressUtils } from './address_utils'; @@ -41,7 +42,7 @@ export class AbiDecoder { return log; } const event = this._methodIds[methodId][numIndexedArgs]; - const ethersInterface = new ethers.Interface([event]); + const ethersInterface = new Interface([event]); const decodedParams: DecodedLogArgs = {}; let topicsIndex = 1; @@ -96,7 +97,7 @@ export class AbiDecoder { if (_.isUndefined(abiArray)) { return; } - const ethersInterface = new ethers.Interface(abiArray); + const ethersInterface = new Interface(abiArray); _.map(abiArray, (abi: AbiDefinition) => { if (abi.type === AbiType.Event) { const topic = ethersInterface.events[abi.name].topic; @@ -5671,9 +5671,9 @@ ethers@3.0.22: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@4.0.0-beta.14: - version "4.0.0-beta.14" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.0-beta.14.tgz#76aa9257b9c93a7604ff4dc11f2a445d07f6459d" +ethers@~4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.4.tgz#d3f85e8b27f4b59537e06526439b0fb15b44dc65" dependencies: "@types/node" "^10.3.2" aes-js "3.0.0" @@ -5681,7 +5681,7 @@ ethers@4.0.0-beta.14: elliptic "6.3.3" hash.js "1.1.3" js-sha3 "0.5.7" - scrypt-js "2.0.3" + scrypt-js "2.0.4" setimmediate "1.0.4" uuid "2.0.1" xmlhttprequest "1.8.0" @@ -6480,45 +6480,6 @@ ganache-core@0xProject/ganache-core#monorepo-dep: merkle-patricia-tree "^2.2.0" pify "^3.0.0" prepend-file "^1.3.1" - seedrandom "~2.4.2" - shebang-loader "0.0.1" - solc "0.4.24" - temp "^0.8.3" - tmp "0.0.31" - web3 "^1.0.0-beta.34" - web3-provider-engine "^14.0.6" - websocket "^1.0.24" - yargs "^7.0.2" - -ganache-core@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.2.1.tgz#c0125d77d3e28d627a812dd002dac21e1d2cc8b7" - dependencies: - abstract-leveldown "^3.0.0" - async "^2.5.0" - bip39 "~2.4.0" - bn.js "4.11.6" - cachedown "^1.0.0" - chai "^3.5.0" - clone "^2.1.1" - eth-sig-util "^2.0.2" - ethereumjs-abi "^0.6.5" - ethereumjs-account "~2.0.4" - ethereumjs-block "~1.2.2" - ethereumjs-tx "1.3.4" - ethereumjs-util "^5.2.0" - ethereumjs-vm "2.3.5" - ethereumjs-wallet "0.6.0" - fake-merkle-patricia-tree "~1.0.1" - heap "~0.2.6" - js-scrypt "^0.2.0" - level-sublevel "^6.6.1" - levelup "^1.1.0" - localstorage-down "^0.6.7" - lodash "^4.17.5" - merkle-patricia-tree "^2.2.0" - pify "^3.0.0" - prepend-file "^1.3.1" request "^2.87.0" seedrandom "~2.4.2" shebang-loader "0.0.1" @@ -13200,6 +13161,10 @@ scrypt-js@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.3.tgz#bb0040be03043da9a012a2cea9fc9f852cfc87d4" +scrypt-js@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" + scrypt.js@0.2.0, scrypt.js@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/scrypt.js/-/scrypt.js-0.2.0.tgz#af8d1465b71e9990110bedfc593b9479e03a8ada" |