import Web3 from 'web3' ; import { AbiItem } from 'web3-utils' ; export class EthLikeWeb3Pure { private static readonly web3 = new Web3 ( ) ; param contractAbi param methodName param methodArguments return public static encodeFunctionCall ( contractAbi , methodName , methodArguments ) { const methodSignature = contractAbi . find ( abiItem => abiItem . name === methodName ) ; if ( methodSignature === undefined ) { throw Error ( 'No such method in abi' ) ; } return EthLikeWeb3Pure . web3 . eth . abi . encodeFunctionCall ( methodSignature , methodArguments as string [ ] ) ; } param type param parameter return public static async encodeParameter ( type , parameter ) { return EthLikeWeb3Pure . web3 . eth . abi . encodeParameter ( type , parameter ) ; } }