Options
Public
  • Public
  • Public/Protected
  • All
Menu

Class ContractDecoder

The ContractDecoder class. Spawns the ContractInstanceDecoder class. Also, decodes transactions and logs. See below for a method listing.

Hierarchy

  • ContractDecoder

Index

Constructors

Protected constructor

Properties

Private allocations

allocations: AllocationInfo

Private artifact

artifact: Artifact

Private compilation

compilation: Compilation

Private contextHash

contextHash: string

Private contexts

contexts: DecoderContexts

Private contract

contract: Contract

Private contractNetwork

contractNetwork: string

Private contractNode

contractNode: AstNode

Private noBytecodeAllocations

noBytecodeAllocations: object

Type declaration

Private stateVariableReferences

stateVariableReferences: StateVariableAllocation[]

Private userDefinedTypes

userDefinedTypes: TypesById

Private web3

web3: Web3

Private wireDecoder

wireDecoder: WireDecoder

Accessors

Private context

Methods

abifyCalldataDecoding

abifyLogDecoding

decodeLog

decodeReturnValue

  • This method is asynchronous.

    Decodes the return value of a call. Return values can be ambiguous, so this so this function returns an array of ReturndataDecodings.

    Note that return values are decoded in strict mode, so none of the decodings should contain errors; if a decoding would contain an error, instead it is simply excluded from the list of possible decodings.

    If there are multiple possible decodings, they will always be listed in the following order:

    1. The decoded return value from a successful call.
    2. The decoded revert message from a call that reverted with a message.
    3. A decoding indicating that the call reverted with no message.
    4. A decoding indicating that the call self-destructed.

    You can check the kind and field to distinguish between these.

    If no possible decodings are found, the returned array of decodings will be empty.

    Note that different decodings may use different decoding modes.

    Decoding creation calls with this method is not supported. If you simply want to decode a revert message from an arbitrary call that you know failed, you may also want to see the decodeRevert function in @truffle/codec.

    Parameters

    • abi: FunctionAbiEntry

      The abi entry for the function call whose return value is being decoded.

    • data: string

      The data to be decoded, as a hex string (beginning with "0x").

    • Default value options: ReturnOptions = {}

      Additional options, such as the block the call occurred in. See ReturnOptions for more information.

    Returns Promise<ReturndataDecoding[]>

Protected decodeReturnValueWithAdditionalContexts

decodeTransaction

events

forInstance

  • This method is asynchronous.

    Constructs a contract instance decoder for a given instance of this contract.

    Parameters

    • Optional address: string

      The address of the contract instance decode. If left out, it will be autodetected. If an invalid address is provided, this method will throw an exception.

    Returns Promise<ContractInstanceDecoder>

Protected getAllocations

Private getCode

  • getCode(address: string, block: DecoderTypes.RegularizedBlockSpecifier): Promise<Uint8Array>
  • Parameters

    • address: string
    • block: DecoderTypes.RegularizedBlockSpecifier

    Returns Promise<Uint8Array>

Protected getContractInfo

  • getContractInfo(): ContractInfo

Protected getStateVariableReferences

Protected getWireDecoder

Protected init

  • init(): Promise<void>

Private regularizeBlock

  • regularizeBlock(block: DecoderTypes.BlockSpecifier): Promise<DecoderTypes.RegularizedBlockSpecifier>
  • Parameters

    • block: DecoderTypes.BlockSpecifier

    Returns Promise<DecoderTypes.RegularizedBlockSpecifier>

Generated using TypeDoc