diff options
author | Fabio B <kandinsky454@protonmail.ch> | 2019-02-05 22:36:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-05 22:36:06 +0800 |
commit | 69c7c03fb34b3f21f65c40b73baa21184a296fb2 (patch) | |
tree | 467e38250825a25a4bc33b55ff4df32a67ac3033 /packages/order-utils/src | |
parent | 7b583cecb29c24f561c8befa835ba9ef5a6918f6 (diff) | |
parent | 224a58bdf25127786a9b83f37c20015b16cbe3d5 (diff) | |
download | dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar.gz dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar.bz2 dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar.lz dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar.xz dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.tar.zst dexon-0x-contracts-69c7c03fb34b3f21f65c40b73baa21184a296fb2.zip |
Merge pull request #1580 from 0xProject/fix/preSignedSignatureBug
Fix preSigned signature bug in SignatureUtils
Diffstat (limited to 'packages/order-utils/src')
-rw-r--r-- | packages/order-utils/src/signature_utils.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 131144d48..efcc146bf 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -1,4 +1,5 @@ import { ExchangeContract, IValidatorContract, IWalletContract } from '@0x/abi-gen-wrappers'; +import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses'; import * as artifacts from '@0x/contract-artifacts'; import { schemas } from '@0x/json-schemas'; import { ECSignature, Order, SignatureType, SignedOrder, ValidatorSignature } from '@0x/types'; @@ -92,7 +93,14 @@ export const signatureUtils = { assert.isWeb3Provider('provider', provider); assert.isHexString('data', data); assert.isETHAddressHex('signerAddress', signerAddress); - const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider); + const web3Wrapper = new Web3Wrapper(provider); + const networkId = await web3Wrapper.getNetworkIdAsync(); + const addresses = getContractAddressesForNetworkOrThrow(networkId); + const exchangeContract = new ExchangeContract( + artifacts.Exchange.compilerOutput.abi, + addresses.exchange, + provider, + ); const isValid = await exchangeContract.preSigned.callAsync(data, signerAddress); return isValid; }, |