From 2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 20 Dec 2017 18:59:46 -0500 Subject: Add some missed underscores, update changelog and comments --- packages/contracts/deploy/src/utils/contract.ts | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'packages/contracts/deploy/src') diff --git a/packages/contracts/deploy/src/utils/contract.ts b/packages/contracts/deploy/src/utils/contract.ts index c386e7d1a..ffad9ed70 100644 --- a/packages/contracts/deploy/src/utils/contract.ts +++ b/packages/contracts/deploy/src/utils/contract.ts @@ -15,28 +15,28 @@ export class Contract implements Web3.ContractInstance { // and we don't know their types in advance [name: string]: any; constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial) { - this.contract = web3ContractInstance; + this._contract = web3ContractInstance; this.address = web3ContractInstance.address; this.abi = web3ContractInstance.abi; - this.defaults = defaults; - this.populateEvents(); - this.populateFunctions(); - this.validator = new SchemaValidator(); + this._defaults = defaults; + this._populateEvents(); + this._populateFunctions(); + this._validator = new SchemaValidator(); } private _populateFunctions(): void { const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function); _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { if (functionAbi.constant) { - const cbStyleCallFunction = this.contract[functionAbi.name].call; + const cbStyleCallFunction = this._contract[functionAbi.name].call; this[functionAbi.name] = { - callAsync: promisify(cbStyleCallFunction, this.contract), + callAsync: promisify(cbStyleCallFunction, this._contract), }; } else { - const cbStyleFunction = this.contract[functionAbi.name]; - const cbStyleEstimateGasFunction = this.contract[functionAbi.name].estimateGas; + const cbStyleFunction = this._contract[functionAbi.name]; + const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas; this[functionAbi.name] = { - estimateGasAsync: promisify(cbStyleEstimateGasFunction, this.contract), - sendTransactionAsync: this.promisifyWithDefaultParams(cbStyleFunction), + estimateGasAsync: promisify(cbStyleEstimateGasFunction, this._contract), + sendTransactionAsync: this._promisifyWithDefaultParams(cbStyleFunction), }; } }); @@ -44,7 +44,7 @@ export class Contract implements Web3.ContractInstance { private _populateEvents(): void { const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event); _.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => { - this[eventAbi.name] = this.contract[eventAbi.name]; + this[eventAbi.name] = this._contract[eventAbi.name]; }); } private _promisifyWithDefaultParams(fn: (...args: any[]) => void): (...args: any[]) => Promise { @@ -52,11 +52,11 @@ export class Contract implements Web3.ContractInstance { const promise = new Promise((resolve, reject) => { const lastArg = args[args.length - 1]; let txData: Partial = {}; - if (this.isTxData(lastArg)) { + if (this._isTxData(lastArg)) { txData = args.pop(); } txData = { - ...this.defaults, + ...this._defaults, ...txData, }; const callback = (err: Error, data: any) => { @@ -68,14 +68,14 @@ export class Contract implements Web3.ContractInstance { }; args.push(txData); args.push(callback); - fn.apply(this.contract, args); + fn.apply(this._contract, args); }); return promise; }; return promisifiedWithDefaultParams; } private _isTxData(lastArg: any): boolean { - const isValid = this.validator.isValid(lastArg, schemas.txDataSchema); + const isValid = this._validator.isValid(lastArg, schemas.txDataSchema); return isValid; } } -- cgit v1.2.3