Sign Up for Free

RunKit +

Try any Node.js package right in your browser

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:

var truffleDecoder = require("@dexon-foundation/truffle-decoder")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@dexon-foundation/truffle-decoder v1.0.16

A library that provides both high and low level decoding of Ethereum contract variables

Truffle Contract Decoder

This module provides interfaces for decoding contract state and events.

Usage

import decoder from 'truffle-contract-decoder';

const contractDecoder = await decoder.for(instance: TruffleContract);

Types

BlockNumber

number | "latest"

ContractDecoder

An instance of this class represents a decoder for a TruffleContract deployed instance.

Methods

state

contractDecoder.state(block: BlockNumber = "latest"): Promise<Interface ContractState>

variable

contractDecoder.variable(variable: string, block: BlockNumber = "latest"): Promise<Interface DecodedVariable>

events

contractDecoder.events(name: string | null = null, block: BlockNumber = "latest"): Promise<Interface ContractEvent[]>

onEvent

contractDecoder.onEvent(name: string, callback: Function(event: ContractEvent, callback: Function(err: Error | falsy = null)))

ContractState

DecodedVariable

ContractEvent

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free