aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/assert.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-02 22:06:26 +0800
committerFabio Berger <me@fabioberger.com>2017-06-02 22:06:26 +0800
commit844f138908a30fa6daa904beafab85823c6d47d7 (patch)
treebe2402e849e6c67acd27ccb323cd39a08ea103d8 /src/utils/assert.ts
parentb8ff2468776e1c784ff50e5ada1c633ee0d3aeda (diff)
downloaddexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar.gz
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar.bz2
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar.lz
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar.xz
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.tar.zst
dexon-sol-tools-844f138908a30fa6daa904beafab85823c6d47d7.zip
Add setAllowanceAsync, getAllowanceAsync and transferFrom to tokenWrapper
Diffstat (limited to 'src/utils/assert.ts')
-rw-r--r--src/utils/assert.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index 1baf572d1..9a6a132e0 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -1,6 +1,7 @@
import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
import * as Web3 from 'web3';
+import {Web3Wrapper} from '../web3_wrapper';
import {SchemaValidator} from './schema_validator';
const HEX_REGEX = /^0x[0-9A-F]*$/i;
@@ -24,6 +25,11 @@ 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.isSenderAddressAvailable(senderAddress);
+ assert.assert(isSenderAddressAvailable, 'Specified senderAddress isn\'t available through the \
+ supplied web3 instance');
+ },
isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
},