Options
All
  • Public
  • Public/Protected
  • All
Menu

The ContractDecoder class. Decodes return values, and spawns the ContractInstanceDecoder class. Also, decodes transactions logs. See below for a method listing.

Hierarchy

  • ContractDecoder

Index

Constructors

Properties

allocations: AllocationInfo
artifact: ContractObject
compilation: Compilation
contextHash: string
contexts: Contexts
contract: Contract
contractNetwork: number
contractNode: AstNode
noBytecodeAllocations: {}

Type declaration

projectDecoder: ProjectDecoder
providerAdapter: ProviderAdapter
stateVariableReferences: StateVariableAllocation[]
userDefinedTypes: TypesById

Accessors

Methods

  • This method is asynchronous.

    Decodes the return value of a call. Return values can be ambiguous, 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: FunctionEntry

      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").

    • options: ReturnOptions = {}

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

    Returns Promise<ReturndataDecoding[]>

  • 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>

  • getCode(address: string, block: RegularizedBlockSpecifier): Promise<Uint8Array>
  • getContractInfo(): ContractInfo
  • getNoBytecodeAllocations(): {}
  • init(): Promise<void>
  • regularizeBlock(block: BlockSpecifier): Promise<RegularizedBlockSpecifier>

Generated using TypeDoc