Use union type Order|SignedOrder
This commit is contained in:
@@ -175,7 +175,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
/**
|
||||
* Cancel a given fill amount of an order. Cancellations are cumulative.
|
||||
*/
|
||||
public async cancelOrderAsync(order: Order, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
|
||||
public async cancelOrderAsync(order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
|
||||
assert.doesConformToSchema('order',
|
||||
SchemaValidator.convertToJSONSchemaCompatibleObject(order as object),
|
||||
orderSchema);
|
||||
@@ -234,7 +234,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
/**
|
||||
* Computes the orderHash for a given order and returns it as a hex encoded string.
|
||||
*/
|
||||
public async getOrderHashAsync(order: Order): Promise<string> {
|
||||
public async getOrderHashAsync(order: Order|SignedOrder): Promise<string> {
|
||||
const [orderAddresses, orderValues] = ExchangeWrapper.getOrderAddressesAndValues(order);
|
||||
const exchangeInstance = await this.getExchangeContractAsync();
|
||||
const orderHash = utils.getOrderHashHex(order, exchangeInstance.address);
|
||||
|
@@ -4,7 +4,7 @@ import * as ethABI from 'ethereumjs-abi';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import {orderSchema} from '../schemas/order_schemas';
|
||||
import {SchemaValidator} from './schema_validator';
|
||||
import {Order, SolidityTypes} from '../types';
|
||||
import {Order, SignedOrder, SolidityTypes} from '../types';
|
||||
import {assert} from './assert';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
|
||||
@@ -32,7 +32,7 @@ export const utils = {
|
||||
spawnSwitchErr(name: string, value: any) {
|
||||
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
|
||||
},
|
||||
getOrderHashHex(order: Order, exchangeContractAddr: string): string {
|
||||
getOrderHashHex(order: Order|SignedOrder, exchangeContractAddr: string): string {
|
||||
assert.doesConformToSchema('order',
|
||||
SchemaValidator.convertToJSONSchemaCompatibleObject(order as object),
|
||||
orderSchema);
|
||||
|
Reference in New Issue
Block a user