diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-12-21 07:59:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-12-21 08:08:11 +0800 |
commit | 2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce (patch) | |
tree | 2b2354dbdd9686b598035a8211ab808e5974af92 /packages/contracts/deploy/src | |
parent | 23052a5c2efdb51f8d991a5a3bd77b3c3cdc6a9a (diff) | |
download | dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar.gz dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar.bz2 dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar.lz dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar.xz dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.tar.zst dexon-sol-tools-2d53b7d9a499e4fb5791fe34cae5ef118bdfc0ce.zip |
Add some missed underscores, update changelog and comments
Diffstat (limited to 'packages/contracts/deploy/src')
-rw-r--r-- | packages/contracts/deploy/src/utils/contract.ts | 32 |
1 files changed, 16 insertions, 16 deletions
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<Web3.TxData>) { - 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<any> { @@ -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<Web3.TxData> = {}; - 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; } } |