diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-07-05 09:17:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-05 09:17:57 +0800 |
commit | 74b2308488832290340f3a6c6473ab7340510dfc (patch) | |
tree | be598e0355a72486125cacfad837a2d06342f170 /src/0x.ts | |
parent | 3302d18f6e0a4b7e51b318959c6b2d040ae3c5ed (diff) | |
parent | 371acc0ba12197de735dea20e09d50bbfd524118 (diff) | |
download | dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar.gz dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar.bz2 dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar.lz dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar.xz dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.tar.zst dexon-sol-tools-74b2308488832290340f3a6c6473ab7340510dfc.zip |
Merge pull request #90 from 0xProject/subscribe-token
Add implementation and tests for zeroEx.token.subscribeAsync
Diffstat (limited to 'src/0x.ts')
-rw-r--r-- | src/0x.ts | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -17,7 +17,9 @@ import {ecSignatureSchema} from './schemas/ec_signature_schema'; import {TokenWrapper} from './contract_wrappers/token_wrapper'; import {ProxyWrapper} from './contract_wrappers/proxy_wrapper'; import {ECSignature, ZeroExError, Order, SignedOrder, Web3Provider} from './types'; +import {orderHashSchema} from './schemas/order_hash_schema'; import {orderSchema} from './schemas/order_schemas'; +import {SchemaValidator} from './utils/schema_validator'; // Customize our BigNumber instances bigNumberConfigs.configure(); @@ -110,7 +112,8 @@ export class ZeroEx { // Since this method can be called to check if any arbitrary string conforms to an orderHash's // format, we only assert that we were indeed passed a string. assert.isString('orderHash', orderHash); - const isValidOrderHash = utils.isValidOrderHash(orderHash); + const schemaValidator = new SchemaValidator(); + const isValidOrderHash = schemaValidator.validate(orderHash, orderHashSchema).valid; return isValidOrderHash; } /** @@ -166,10 +169,11 @@ export class ZeroEx { */ public async setProviderAsync(provider: Web3Provider) { this._web3Wrapper.setProvider(provider); - await this.exchange.invalidateContractInstancesAsync(); - this.tokenRegistry.invalidateContractInstance(); - this.token.invalidateContractInstances(); - this.proxy.invalidateContractInstance(); + await (this.exchange as any)._invalidateContractInstancesAsync(); + (this.tokenRegistry as any)._invalidateContractInstance(); + await (this.token as any)._invalidateContractInstancesAsync(); + (this.proxy as any)._invalidateContractInstance(); + (this.etherToken as any)._invalidateContractInstance(); } /** * Get user Ethereum addresses available through the supplied web3 instance available for sending transactions. |