Options
All
  • Public
  • Public/Protected
  • All
Menu

The ProjectEncoder class. Can wrap values; can also encode transactions and resolve overloads if sufficient information is provided. See below for a method listing.

Hierarchy

  • ProjectEncoder

Index

Constructors

Properties

allocations: AllocationInfo
compilations: Compilation[]
contractsAndContexts: AbiData.Allocate.ContractAndContexts[] = []
ens: any
ensCache: ENSCache = {}
networkId: number
provider: Provider
referenceDeclarations: {}

Type declaration

registryAddress: string = undefined
userDefinedTypes: TypesById

Methods

  • This method is asynchronous.

    Constructs a contract instance encoder for a given instance of a contract in this project. Unlike forInstance, this method doesn't require an artifact; it will automatically detect the class of the given contract. If it's not in the project, or the encoder can't identify it, you'll get an exception.

    Parameters

    • address: string

      The address of the contract instance to encoder for. If an invalid address is provided, this method will throw an exception.

    • block: BlockSpecifier = "latest"

      You can include this argument to specify that this should be based on the addresses content's at a specific block (if say the contract has since self-destructed).

    Returns Promise<ContractInstanceEncoder>

  • This method is asynchronous.

    Constructs a contract encoder for a given contract in this project.

    Parameters

    • artifact: ContractObject

      The contract the encoder is for. If you want to encode contract creation transactions, it must have all of its libraries linked.

      Note: The contract must be one that the encoder knows about; otherwise you will have problems.

    Returns Promise<ContractEncoder>

  • This method is asynchronous.

    Constructs a contract encoder for a given contract in this project.

    Parameters

    • contract: ContractConstructorObject

      The contract the encoder is for. If you want to encode contract creation transactions, it must have all of its libraries linked.

      Note: The contract must be one that the encoder knows about; otherwise you will have problems.

    Returns Promise<ContractEncoder>

  • This method is asynchronous.

    Constructs a contract instance encoder for a given contract instance.

    Parameters

    • artifact: ContractObject

      The artifact for the contract the encoder is for. If you want to encode contract creation transactions, it must have all of its libraries linked.

      Note: The contract must be one that the encoder knows about; otherwise you will have problems.

    • Optional address: string

      The address of the contract instance. If omitted, but the project encoder has a provider or network ID, it will be autodetected. If there is no provider or network ID, it must be included.

      If an invalid address is provided, this method will throw an exception.

    Returns Promise<ContractInstanceEncoder>

  • getNetworkId(): number
  • getReferenceDeclarations(): {}
  • init(): Promise<void>
  • resolveENSName(input: string): Promise<string>
  • wrap(dataType: Type, input: unknown): Promise<Value>
  • This method is asynchronous.

    This method recognizes user input for a given data type and attempts to interpret it as a value of that type. It will throw a TypeMismatchError if it cannot do this.

    For documentation of the accepted forms of input, see ContractEncoder.encodeTransaction.

    Parameters

    • dataType: Type

      The data type that the given value is to be interpreted as.

    • input: unknown

      The value to be interpreted. This can take a number of forms depending on the data type, as documented above.

    Returns Promise<Value>

    The interpreted value wrapped as a Value object.

Generated using TypeDoc