diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-04-25 02:24:55 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-27 01:33:37 +0800 |
commit | 0e0a46f373e076843fd4118cdafb325fb754141a (patch) | |
tree | 65c012961c6fa72dd258a2e0e0e671a0a6dc64a6 /packages/contracts/src/utils/exchange_wrapper.ts | |
parent | 732202fe8e4f3eb1847515a0c3f8f2d068d35baf (diff) | |
download | dexon-0x-contracts-0e0a46f373e076843fd4118cdafb325fb754141a.tar.gz dexon-0x-contracts-0e0a46f373e076843fd4118cdafb325fb754141a.tar.zst dexon-0x-contracts-0e0a46f373e076843fd4118cdafb325fb754141a.zip |
Update tests and utils
Diffstat (limited to 'packages/contracts/src/utils/exchange_wrapper.ts')
-rw-r--r-- | packages/contracts/src/utils/exchange_wrapper.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 7d06c321b..000905854 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 { AssetProxyId, SignedOrder } from './types'; +import { AssetProxyId, SignedOrder, SignedTransaction } from './types'; export class ExchangeWrapper { private _exchange: ExchangeContract; @@ -207,6 +207,20 @@ export class ExchangeWrapper { const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); return tx; } + public async executeTransactionAsync( + signedTx: SignedTransaction, + from: string, + ): Promise<TransactionReceiptWithDecodedLogs> { + const txHash = await this._exchange.executeTransaction.sendTransactionAsync( + signedTx.salt, + signedTx.signer, + signedTx.data, + signedTx.signature, + { 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); |