diff options
-rw-r--r-- | src/0x.js.ts | 7 | ||||
-rw-r--r-- | src/web3_wrapper.ts | 2 | ||||
-rw-r--r-- | test/utils/fill_scenarios.ts | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts index 6713ec885..679d748e7 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -124,10 +124,11 @@ export class ZeroEx { this.web3Wrapper.setDefaultAccount(account); } /** - * Gets default account for sending transactions. + * Get the default account set for sending transactions. */ - public getTransactionSenderAccount(): string { - return this.web3Wrapper.getDefaultAccount(); + public async getTransactionSenderAccountIfExistsAsync(): Promise<string|undefined> { + const senderAccountIfExists = await this.web3Wrapper.getSenderAddressIfExistsAsync(); + return senderAccountIfExists; } /** * Computes the orderHash given the order parameters and returns it as a hex encoded string. diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index 900c127d5..49bd8b67d 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -69,7 +69,7 @@ export class Web3Wrapper { const {timestamp} = await promisify(this.web3.eth.getBlock)(blockHash); return timestamp; } - private async getSenderAddressIfExistsAsync(): Promise<string|undefined> { + public async getSenderAddressIfExistsAsync(): Promise<string|undefined> { const defaultAccount = this.web3.eth.defaultAccount; if (!_.isUndefined(defaultAccount)) { return defaultAccount; diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index 26840bb0c..3b66937e6 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -24,12 +24,12 @@ export class FillScenarios { await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinBase, takerAddress, fillableAmount); await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, fillableAmount); - const transactionSenderAccount = this.zeroEx.getTransactionSenderAccount(); + const transactionSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync(); this.zeroEx.setTransactionSenderAccount(makerAddress); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, takerAddress, fillableAmount, makerTokenAddress, fillableAmount, takerTokenAddress, expirationUnixTimestampSec); - this.zeroEx.setTransactionSenderAccount(transactionSenderAccount); + this.zeroEx.setTransactionSenderAccount(transactionSenderAccount as string); return signedOrder; } } |