This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
@dexon-foundation/truffle-decoder with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
This module provides interfaces for decoding contract state and events.
import decoder from 'truffle-contract-decoder'; const contractDecoder = await decoder.for(instance: TruffleContract);
number | "latest"
An instance of this
class represents a decoder for a
TruffleContract deployed instance.
contractDecoder.state(block: BlockNumber = "latest"): Promise<Interface ContractState>
contractDecoder.variable(variable: string, block: BlockNumber = "latest"): Promise<Interface DecodedVariable>
contractDecoder.events(name: string | null = null, block: BlockNumber = "latest"): Promise<Interface ContractEvent>
contractDecoder.onEvent(name: string, callback: Function(event: ContractEvent, callback: Function(err: Error | falsy = null)))