diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2017-12-01 14:11:44 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2017-12-01 14:11:44 +0800 |
commit | ca9518c48cf6d5220f05d467c3388b37c3b5c986 (patch) | |
tree | 421d299ad20362b768ed5617e22484b18ac395ec /packages/contracts/util | |
parent | d44d6ccfd8d1aea61f9302affc5e702cb3339773 (diff) | |
download | dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar.gz dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar.bz2 dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar.lz dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar.xz dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.tar.zst dexon-sol-tools-ca9518c48cf6d5220f05d467c3388b37c3b5c986.zip |
Make class methods that don't use 'this' static
Diffstat (limited to 'packages/contracts/util')
-rw-r--r-- | packages/contracts/util/multi_sig_wrapper.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/contracts/util/multi_sig_wrapper.ts b/packages/contracts/util/multi_sig_wrapper.ts index 3adaab592..4ad970ac9 100644 --- a/packages/contracts/util/multi_sig_wrapper.ts +++ b/packages/contracts/util/multi_sig_wrapper.ts @@ -7,17 +7,7 @@ import {ContractInstance, TransactionDataParams} from './types'; export class MultiSigWrapper { private multiSig: ContractInstance; - constructor(multiSigContractInstance: ContractInstance) { - this.multiSig = multiSigContractInstance; - } - public async submitTransactionAsync(destination: string, from: string, - dataParams: TransactionDataParams, - value: number = 0) { - const {name, abi, args = []} = dataParams; - const encoded = this.encodeFnArgs(name, abi, args); - return this.multiSig.submitTransaction(destination, value, encoded, {from}); - } - public encodeFnArgs(name: string, abi: Web3.AbiDefinition[], args: any[]) { + public static encodeFnArgs(name: string, abi: Web3.AbiDefinition[], args: any[]) { const abiEntity = _.find(abi, {name}) as Web3.MethodAbi; if (_.isUndefined(abiEntity)) { throw new Error(`Did not find abi entry for name: ${name}`); @@ -31,4 +21,14 @@ export class MultiSigWrapper { }); return funcSig + argsData.join(''); } + constructor(multiSigContractInstance: ContractInstance) { + this.multiSig = multiSigContractInstance; + } + public async submitTransactionAsync(destination: string, from: string, + dataParams: TransactionDataParams, + value: number = 0) { + const {name, abi, args = []} = dataParams; + const encoded = MultiSigWrapper.encodeFnArgs(name, abi, args); + return this.multiSig.submitTransaction(destination, value, encoded, {from}); + } } |