import { IABIMethod , IETHABI , ILogItem , LogDecoder } from "./ethjs-abi" ; const { decodeParams , encodeMethod , logDecoder , configure : configureABI , } = require ( "qtumjs-ethjs-abi" ) as IETHABI ; configureABI ( { noHexStringPrefix : true } ) ; import { ITransactionLog } from "./QtumRPC" ; export function encodeInputs ( method , args = [ ] ) { const calldata = encodeMethod ( method , args ) ; return calldata ; } export function decodeOutputs ( method , outputData ) { const types = method . outputs . map ( ( output ) => output . type ) ; const result = decodeParams ( types , outputData ) ; const values = [ ] ; for ( let i = 0 ; i < types . length ; i ++ ) { values [ i ] = result [ i ] ; } return values ; } /**
 * A decoded Solidity event log
 */ export interface IDecodedSolidityEvent { /**
     * The event's name
     */ type : string ; /**
     * Event parameters as a key-value map
     */ [ key ] : any ; } export class ContractLogDecoder { private _decoder : LogDecoder ; constructor ( public abi ) { this . _decoder = logDecoder ( abi ) ; } public decode ( rawlog ) { const result = this . _decoder ( [ rawlog ] ) ; if ( result . length === 0 ) { return null ; } const log = result [ 0 ] ; return log as any ; } }