aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-03-24 03:17:54 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commit8f809e3a292c55e0f6440f9cf7c8746ede7ad583 (patch)
tree084ff67fed5dae3a3a39d452be1025800c264203 /packages/contracts/src/utils
parent3f76985435c18c5b8087f1c681310b40613093e7 (diff)
downloaddexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar.gz
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar.bz2
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar.lz
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar.xz
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.tar.zst
dexon-sol-tools-8f809e3a292c55e0f6440f9cf7c8746ede7ad583.zip
Remove partial cancels
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts23
-rw-r--r--packages/contracts/src/utils/formatters.ts6
-rw-r--r--packages/contracts/src/utils/types.ts1
3 files changed, 6 insertions, 24 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 3f56fd52f..bbe9a1baf 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -34,17 +34,9 @@ export class ExchangeWrapper {
const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
return tx;
}
- public async cancelOrderAsync(
- signedOrder: SignedOrder,
- from: string,
- opts: { takerTokenCancelAmount?: BigNumber } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createCancel(signedOrder, opts.takerTokenCancelAmount);
- const txHash = await this._exchange.cancelOrder.sendTransactionAsync(
- params.order,
- params.takerTokenCancelAmount,
- { from },
- );
+ public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createCancel(signedOrder);
+ const txHash = await this._exchange.cancelOrder.sendTransactionAsync(params.order, { from });
const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
return tx;
}
@@ -156,14 +148,9 @@ export class ExchangeWrapper {
public async batchCancelOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerTokenCancelAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchCancel(orders, opts.takerTokenCancelAmounts);
- const txHash = await this._exchange.batchCancelOrders.sendTransactionAsync(
- params.orders,
- params.takerTokenCancelAmounts,
- { from },
- );
+ const params = formatters.createBatchCancel(orders);
+ const txHash = await this._exchange.batchCancelOrders.sendTransactionAsync(params.orders, { from });
const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
return tx;
}
diff --git a/packages/contracts/src/utils/formatters.ts b/packages/contracts/src/utils/formatters.ts
index 4f6116f06..2b261f967 100644
--- a/packages/contracts/src/utils/formatters.ts
+++ b/packages/contracts/src/utils/formatters.ts
@@ -55,10 +55,9 @@ export const formatters = {
});
return marketFillOrders;
},
- createBatchCancel(signedOrders: SignedOrder[], takerTokenCancelAmounts: BigNumber[] = []) {
+ createBatchCancel(signedOrders: SignedOrder[]) {
const batchCancel: BatchCancelOrders = {
orders: [],
- takerTokenCancelAmounts,
};
_.forEach(signedOrders, signedOrder => {
batchCancel.orders.push({
@@ -74,9 +73,6 @@ export const formatters = {
expirationTimeSeconds: signedOrder.expirationTimeSeconds,
salt: signedOrder.salt,
});
- if (takerTokenCancelAmounts.length < signedOrders.length) {
- batchCancel.takerTokenCancelAmounts.push(signedOrder.takerTokenAmount);
- }
});
return batchCancel;
},
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index 06fe23824..460d0a58a 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -25,7 +25,6 @@ export interface MarketFillOrders {
export interface BatchCancelOrders {
orders: OrderStruct[];
- takerTokenCancelAmounts: BigNumber[];
}
export interface CancelOrdersBefore {