From 432b064601776d4daacfc2415c3da41c91a24d27 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 22 Apr 2018 17:25:28 -0700 Subject: Fix tests --- packages/contracts/src/utils/exchange_wrapper.ts | 21 +++++++++++++++++++-- packages/contracts/src/utils/types.ts | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'packages/contracts/src/utils') diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 26ce8b04e..7d06c321b 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -9,7 +9,7 @@ import { constants } from './constants'; import { formatters } from './formatters'; import { LogDecoder } from './log_decoder'; import { orderUtils } from './order_utils'; -import { SignedOrder } from './types'; +import { AssetProxyId, SignedOrder } from './types'; export class ExchangeWrapper { private _exchange: ExchangeContract; @@ -189,7 +189,24 @@ export class ExchangeWrapper { const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); return tx; } - + public async registerAssetProxyAsync( + assetProxyId: AssetProxyId, + assetProxyAddress: string, + from: string, + opts: { oldAssetProxyAddressIfExists?: string } = {}, + ): Promise { + const oldAssetProxyAddress = _.isUndefined(opts.oldAssetProxyAddressIfExists) + ? ZeroEx.NULL_ADDRESS + : opts.oldAssetProxyAddressIfExists; + const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync( + assetProxyId, + assetProxyAddress, + oldAssetProxyAddress, + { from }, + ); + const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); + return tx; + } public async getOrderHashAsync(signedOrder: SignedOrder): Promise { const order = orderUtils.getOrderStruct(signedOrder); const orderHash = await this._exchange.getOrderHash.callAsync(order); diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 629187e95..bba463bd2 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -93,11 +93,12 @@ export enum ContractName { AccountLevels = 'AccountLevels', EtherDelta = 'EtherDelta', Arbitrage = 'Arbitrage', - AssetProxyDispatcher = 'AssetProxyDispatcher', + TestAssetProxyDispatcher = 'TestAssetProxyDispatcher', ERC20Proxy = 'ERC20Proxy', ERC721Proxy = 'ERC721Proxy', DummyERC721Token = 'DummyERC721Token', LibBytes = 'LibBytes', + Authorizable = 'Authorizable', } export interface Artifact { -- cgit v1.2.3