aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/exchange_wrapper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils/exchange_wrapper.ts')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts21
1 files changed, 19 insertions, 2 deletions
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<TransactionReceiptWithDecodedLogs> {
+ 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<string> {
const order = orderUtils.getOrderStruct(signedOrder);
const orderHash = await this._exchange.getOrderHash.callAsync(order);