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.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 7383f6b5d..04e6c2feb 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -8,7 +8,7 @@ import { ExchangeContract } from '../contract_wrappers/generated/exchange';
import { constants } from './constants';
import { formatters } from './formatters';
import { LogDecoder } from './log_decoder';
-import { signedOrderUtils } from './signed_order_utils';
+import { orderUtils } from './order_utils';
import { SignedOrder } from './types';
export class ExchangeWrapper {
@@ -24,7 +24,7 @@ export class ExchangeWrapper {
from: string,
opts: { takerTokenFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = signedOrderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
const txHash = await this._exchange.fillOrder.sendTransactionAsync(
params.order,
params.takerTokenFillAmount,
@@ -45,7 +45,7 @@ export class ExchangeWrapper {
from: string,
opts: { takerTokenCancelAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = signedOrderUtils.createCancel(signedOrder, opts.takerTokenCancelAmount);
+ const params = orderUtils.createCancel(signedOrder, opts.takerTokenCancelAmount);
const txHash = await this._exchange.cancelOrder.sendTransactionAsync(
params.order,
params.takerTokenCancelAmount,
@@ -65,7 +65,7 @@ export class ExchangeWrapper {
from: string,
opts: { takerTokenFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = signedOrderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
params.order,
params.takerTokenFillAmount,
@@ -165,14 +165,14 @@ export class ExchangeWrapper {
return tx;
}
public async getOrderHashAsync(signedOrder: SignedOrder): Promise<string> {
- const order = signedOrderUtils.getOrderStruct(signedOrder);
+ const order = orderUtils.getOrderStruct(signedOrder);
const orderHash = await this._exchange.getOrderHash.callAsync(order);
return orderHash;
}
public async isValidSignatureAsync(signedOrder: SignedOrder): Promise<boolean> {
const isValidSignature = await this._exchange.isValidSignature.callAsync(
+ orderUtils.getOrderHashHex(signedOrder),
signedOrder.makerAddress,
- signedOrderUtils.getOrderHashHex(signedOrder),
signedOrder.signature,
);
return isValidSignature;
@@ -195,6 +195,10 @@ export class ExchangeWrapper {
);
return partialAmount;
}
+ public async getFilledTakerTokenAmountAsync(orderHashHex: string): Promise<BigNumber> {
+ const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
+ return filledAmount;
+ }
}
function wrapLogBigNumbers(log: any): any {