From 255da32d290cbf6258ddfc49d875abcf32322673 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 4 Oct 2018 16:56:01 -0700 Subject: Update testnet-faucets and website to work with new artifacts and abi-gen wrappers --- packages/website/ts/blockchain.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index b1181e4c6..14ab73531 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -374,7 +374,7 @@ export class Blockchain { return unavailableTakerAmount; } public getExchangeContractAddressIfExists(): string | undefined { - return this._contractWrappers.exchange.getContractAddress(); + return this._contractWrappers.exchange.address; } public async validateFillOrderThrowIfInvalidAsync( signedOrder: SignedOrder, @@ -859,9 +859,23 @@ export class Blockchain { shouldUserLedgerProvider, ); if (!_.isUndefined(this._contractWrappers)) { - this._contractWrappers.setProvider(provider, networkId); + this._contractWrappers.setProvider(provider); } else { - this._contractWrappers = new ContractWrappers(provider, { networkId }); + const contractWrappersConfig = { + networkId, + // TODO(albrow): Load in real contract addresses here. + contractAddresses: { + erc20Proxy: '', + erc721Proxy: '', + zrxToken: '', + etherToken: '', + exchange: '', + assetProxyOwner: '', + forwarder: '', + orderValidator: '', + }, + }; + this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); } if (!_.isUndefined(this._zeroEx)) { this._zeroEx.setProvider(provider, networkId); -- cgit From 1e9ea09f087c7b3120e758d931a88812b655da08 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 9 Oct 2018 23:10:33 -0700 Subject: Introduce new contract-addresses package and use it everywhere --- packages/website/ts/blockchain.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 14ab73531..8a2489e07 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -1,4 +1,5 @@ import { ZeroEx } from '0x.js'; +import { getContractAddressesForNetwork } from '@0xproject/contract-addresses'; import { BlockRange, ContractWrappers, @@ -863,17 +864,7 @@ export class Blockchain { } else { const contractWrappersConfig = { networkId, - // TODO(albrow): Load in real contract addresses here. - contractAddresses: { - erc20Proxy: '', - erc721Proxy: '', - zrxToken: '', - etherToken: '', - exchange: '', - assetProxyOwner: '', - forwarder: '', - orderValidator: '', - }, + contractAddresses: getContractAddressesForNetwork(networkId), }; this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); } -- cgit From 974ec23ecd2a445523e0550c0a7f69329d6959f1 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 10 Oct 2018 16:04:37 -0700 Subject: Apply various PR feedback --- packages/website/ts/blockchain.ts | 2 -- 1 file changed, 2 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 8a2489e07..de1622686 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -1,5 +1,4 @@ import { ZeroEx } from '0x.js'; -import { getContractAddressesForNetwork } from '@0xproject/contract-addresses'; import { BlockRange, ContractWrappers, @@ -864,7 +863,6 @@ export class Blockchain { } else { const contractWrappersConfig = { networkId, - contractAddresses: getContractAddressesForNetwork(networkId), }; this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); } -- cgit From 5509bf5aebe0cb2c97e4750850521a089cc0ed99 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Mon, 15 Oct 2018 18:04:29 -0700 Subject: Update website to use the new unsubscribeAll method in contract-wrappers --- packages/website/ts/blockchain.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index de1622686..8955bbc30 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -859,13 +859,12 @@ export class Blockchain { shouldUserLedgerProvider, ); if (!_.isUndefined(this._contractWrappers)) { - this._contractWrappers.setProvider(provider); - } else { - const contractWrappersConfig = { - networkId, - }; - this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); + this._contractWrappers.unsubscribeAll(); } + const contractWrappersConfig = { + networkId, + }; + this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); if (!_.isUndefined(this._zeroEx)) { this._zeroEx.setProvider(provider, networkId); } else { -- cgit