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 /src/utils | |
parent | eb5c9ae70886cb1a14ae154f363f052a76b24479 (diff) | |
download | dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.gz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.bz2 dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.lz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.xz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.zst dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.zip |
Make methods accept senderAccount
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/assert.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 5a31e1b16..2396b8534 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -26,10 +26,14 @@ export const assert = { const web3 = new Web3(); this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); }, - async isSenderAddressAvailableAsync(web3Wrapper: Web3Wrapper, senderAddress: string) { - const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAddress); - assert.assert(isSenderAddressAvailable, 'Specified senderAddress isn\'t available through the \ - supplied web3 instance'); + async isSenderAccountHexAsync(web3Wrapper: Web3Wrapper, senderAccount: string): Promise<void> { + assert.isETHAddressHex('senderAccount', senderAccount); + await assert.isSenderAccountAvailableAsync(web3Wrapper, senderAccount); + }, + async isSenderAccountAvailableAsync(web3Wrapper: Web3Wrapper, senderAccount: string): Promise<void> { + const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAccount); + assert.assert(isSenderAddressAvailable, `Specified senderAccount ${senderAccount} isn't available through the \ + supplied web3 instance`); }, isNumber(variableName: string, value: number): void { this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value)); |