diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-11 19:52:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-11 19:52:54 +0800 |
commit | 4ac0ead5ce931871cf12fdaa83d87597bfc9979d (patch) | |
tree | 0813864d3920321e64acadebdacfd1525ea4e998 /src/0x.js.ts | |
parent | 4e56c299263cf6a3397a1d7b95fb92a8b61da3c0 (diff) | |
parent | bbe9a811fb28417377ec3d089e0cdd3693480c35 (diff) | |
download | dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar.gz dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar.bz2 dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar.lz dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar.xz dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.tar.zst dexon-sol-tools-4ac0ead5ce931871cf12fdaa83d87597bfc9979d.zip |
Merge pull request #62 from 0xProject/private
Prefix private vars with _
Diffstat (limited to 'src/0x.js.ts')
-rw-r--r-- | src/0x.js.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts index b641739ac..f01c918d6 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -33,7 +33,7 @@ export class ZeroEx { public exchange: ExchangeWrapper; public tokenRegistry: TokenRegistryWrapper; public token: TokenWrapper; - private web3Wrapper: Web3Wrapper; + private _web3Wrapper: Web3Wrapper; /** * Verifies that the elliptic curve signature `signature` was generated * by signing `data` with the private key corresponding to the `signerAddress` address. @@ -128,10 +128,10 @@ export class ZeroEx { * @return An instance of the 0x.js ZeroEx class. */ constructor(web3: Web3) { - this.web3Wrapper = new Web3Wrapper(web3); - this.token = new TokenWrapper(this.web3Wrapper); - this.exchange = new ExchangeWrapper(this.web3Wrapper, this.token); - this.tokenRegistry = new TokenRegistryWrapper(this.web3Wrapper); + this._web3Wrapper = new Web3Wrapper(web3); + this.token = new TokenWrapper(this._web3Wrapper); + this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token); + this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper); } /** * Sets a new provider for the web3 instance used by 0x.js. Updating the provider will stop all @@ -139,7 +139,7 @@ export class ZeroEx { * @param provider The Web3.Provider you would like the 0x.js library to use from now on. */ public async setProviderAsync(provider: Web3.Provider) { - this.web3Wrapper.setProvider(provider); + this._web3Wrapper.setProvider(provider); await this.exchange.invalidateContractInstanceAsync(); this.tokenRegistry.invalidateContractInstance(); this.token.invalidateContractInstances(); @@ -149,7 +149,7 @@ export class ZeroEx { * @return An array of Ethereum addresses available. */ public async getAvailableAddressesAsync(): Promise<string[]> { - const availableAddresses = await this.web3Wrapper.getAvailableAddressesAsync(); + const availableAddresses = await this._web3Wrapper.getAvailableAddressesAsync(); return availableAddresses; } /** @@ -160,7 +160,7 @@ export class ZeroEx { public async getOrderHashHexAsync(order: Order|SignedOrder): Promise<string> { assert.doesConformToSchema('order', order, orderSchema); - const exchangeContractAddr = await this.getExchangeAddressAsync(); + const exchangeContractAddr = await this._getExchangeAddressAsync(); const orderHashHex = utils.getOrderHashHex(order, exchangeContractAddr); return orderHashHex; } @@ -174,10 +174,10 @@ export class ZeroEx { */ public async signOrderHashAsync(orderHash: string, signerAddress: string): Promise<ECSignature> { assert.isHexString('orderHash', orderHash); - await assert.isSenderAddressAsync('signerAddress', signerAddress, this.web3Wrapper); + await assert.isSenderAddressAsync('signerAddress', signerAddress, this._web3Wrapper); let msgHashHex; - const nodeVersion = await this.web3Wrapper.getNodeVersionAsync(); + const nodeVersion = await this._web3Wrapper.getNodeVersionAsync(); const isParityNode = utils.isParityNode(nodeVersion); if (isParityNode) { // Parity node adds the personalMessage prefix itself @@ -188,7 +188,7 @@ export class ZeroEx { msgHashHex = ethUtil.bufferToHex(msgHashBuff); } - const signature = await this.web3Wrapper.signTransactionAsync(signerAddress, msgHashHex); + const signature = await this._web3Wrapper.signTransactionAsync(signerAddress, msgHashHex); let signatureData; const [nodeVersionNumber] = findVersions(nodeVersion); @@ -224,8 +224,8 @@ export class ZeroEx { } return ecSignature; } - private async getExchangeAddressAsync() { - const networkIdIfExists = await this.web3Wrapper.getNetworkIdIfExistsAsync(); + private async _getExchangeAddressAsync() { + const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync(); const exchangeNetworkConfigsIfExists = _.isUndefined(networkIdIfExists) ? undefined : (ExchangeArtifacts as any).networks[networkIdIfExists]; |