diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 22:22:56 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 22:22:56 +0800 |
commit | bac6833436960d2a7eb50d89e94fed226a16008b (patch) | |
tree | 69556bb591ecd1fc5ebcd3e2da8c688d5cbaccd0 /test/utils | |
parent | eb5c9ae70886cb1a14ae154f363f052a76b24479 (diff) | |
download | dexon-0x-contracts-bac6833436960d2a7eb50d89e94fed226a16008b.tar.gz dexon-0x-contracts-bac6833436960d2a7eb50d89e94fed226a16008b.tar.zst dexon-0x-contracts-bac6833436960d2a7eb50d89e94fed226a16008b.zip |
Make methods accept senderAccount
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/fill_scenarios.ts | 13 | ||||
-rw-r--r-- | test/utils/order_factory.ts | 2 |
2 files changed, 3 insertions, 12 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index d186593b9..075906eaa 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -54,19 +54,14 @@ export class FillScenarios { public async createPartiallyFilledSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, takerAddress: string, fillableAmount: BigNumber.BigNumber, partialFillAmount: BigNumber.BigNumber) { - const prevSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync(); + const prevSenderAccount = await this.zeroEx.getAvailableAccountsAsync(); const [makerAddress] = this.userAddresses; const signedOrder = await this.createAsymmetricFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, fillableAmount, ); - - this.zeroEx.setTransactionSenderAccount(takerAddress); const shouldCheckTransfer = false; - await this.zeroEx.exchange.fillOrderAsync(signedOrder, partialFillAmount, shouldCheckTransfer); - - // Re-set sender account so as to avoid introducing side-effects - this.zeroEx.setTransactionSenderAccount(prevSenderAccount as string); + await this.zeroEx.exchange.fillOrderAsync(signedOrder, partialFillAmount, shouldCheckTransfer, takerAddress); return signedOrder; } private async createAsymmetricFillableSignedOrderWithFeesAsync( @@ -89,14 +84,10 @@ export class FillScenarios { await this.zeroEx.token.setProxyAllowanceAsync(this.zrxTokenAddress, takerAddress, takerFee); } - const prevTransactionSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync(); - this.zeroEx.setTransactionSenderAccount(makerAddress); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, takerAddress, makerFee, takerFee, makerFillableAmount, makerTokenAddress, takerFillableAmount, takerTokenAddress, feeRecepient, expirationUnixTimestampSec); - // We re-set the transactionSender to avoid introducing side-effects - this.zeroEx.setTransactionSenderAccount(prevTransactionSenderAccount as string); return signedOrder; } } diff --git a/test/utils/order_factory.ts b/test/utils/order_factory.ts index 373dbddc6..6f5fa7286 100644 --- a/test/utils/order_factory.ts +++ b/test/utils/order_factory.ts @@ -36,7 +36,7 @@ export const orderFactory = { expirationUnixTimestampSec, }; const orderHash = await zeroEx.getOrderHashHexAsync(order); - const ecSignature = await zeroEx.signOrderHashAsync(orderHash); + const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker); const signedOrder: SignedOrder = _.assign(order, {ecSignature}); return signedOrder; }, |