# Class ProjectDecoder

The ProjectDecoder class. Decodes transactions and logs. See below for a method listing.

#### Hierarchy

- ProjectDecoder

- Defined in decoder/lib/decoders.ts:55

#####
Index

### Constructors

constructor

### Properties

addProjectInfoNonce
allocations
codeCache
compilations
contexts
contractsAndContexts
deployedContexts
ens
ensCache
ensSettings
providerAdapter
referenceDeclarations
userDefinedTypes
userDefinedTypesByCompilation

### Methods

abifyCalldataDecoding
abifyLogDecoding
abifyReturndataDecoding
addAdditionalProjectInfo
addCompilations
decodeLog
decodeLogWithAdditionalOptions
decodeTransaction
decodeTransactionWithAdditionalContexts
events
eventsWithAdditionalContexts
forAddress
forArtifact
forInstance
getAllocations
getCode
getContextByAddress
getDeployedContexts
getEnsSettings
getProviderAdapter
getReferenceDeclarations
getUserDefinedTypes
init
interpretAggregate
interpretBlockhashedMulticall
interpretCallInAggregate
interpretCallInMulti
interpretDeadlinedMulticall
interpretMulticall
interpretTryAggregate
regularizeBlock
reverseEnsResolve
withMulticallInterpretations

## Constructors

### `Protected` constructor

- new ProjectDecoder(compilations, provider, ensSettings?): ProjectDecoder
- `Protected`

  #### Parameters

  - ##### compilations: Compilation[]

  - ##### provider: Provider

  - ##### `Optional` ensSettings: EnsSettings

  #### Returns ProjectDecoder

  - Defined in decoder/lib/decoders.ts:79

## Properties

### `Private` addProjectInfoNonce

addProjectInfoNonce: number = 0

- Defined in decoder/lib/decoders.ts:74

### `Private` allocations

allocations: AllocationInfo

- Defined in decoder/lib/decoders.ts:66

### `Private` codeCache

codeCache: CodeCache = {}

- Defined in decoder/lib/decoders.ts:68

### `Private` compilations

compilations: Compilation[]

- Defined in decoder/lib/decoders.ts:58

### `Private` contexts

contexts: Contexts = {}

- Defined in decoder/lib/decoders.ts:59

### `Private` contractsAndContexts

contractsAndContexts: AbiData.Allocate.ContractAndContexts[] = []

- Defined in decoder/lib/decoders.ts:61

### `Private` deployedContexts

deployedContexts: Contexts = {}

- Defined in decoder/lib/decoders.ts:60

### `Private` ens

ens: any

- Defined in decoder/lib/decoders.ts:71

### `Private` ensCache

ensCache: {
[address: string]: Uint8Array | null;
} = {}

#### Type declaration

- ##### [address: string]: Uint8Array | null

- Defined in decoder/lib/decoders.ts:69

### `Private` ensSettings

ensSettings: EnsSettings

- Defined in decoder/lib/decoders.ts:72

### `Private` providerAdapter

providerAdapter: ProviderAdapter

- Defined in decoder/lib/decoders.ts:56

### `Private` referenceDeclarations

referenceDeclarations: {
[compilationId: string]: AstNodes;
}

#### Type declaration

- ##### [compilationId: string]: AstNodes

- Defined in decoder/lib/decoders.ts:63

### `Private` userDefinedTypes

userDefinedTypes: TypesById

- Defined in decoder/lib/decoders.ts:65

### `Private` userDefinedTypesByCompilation

userDefinedTypesByCompilation: TypesByCompilationAndId

- Defined in decoder/lib/decoders.ts:64

## Methods

### abifyCalldataDecoding

- abifyCalldataDecoding(decoding): CalldataDecoding

- Takes a [[CalldataDecoding]], which may have been produced in full mode or ABI mode, and converts it to its ABI mode equivalent. See the README for more information.

  Please only use on decodings produced by this same decoder instance; use on decodings produced by other instances may not work consistently.

  #### Parameters

  - ##### decoding: CalldataDecoding

    The decoding to abify

  #### Returns CalldataDecoding

  - Defined in decoder/lib/decoders.ts:669

### abifyLogDecoding

- abifyLogDecoding(decoding): LogDecoding

- Takes a [[LogDecoding]], which may have been produced in full mode or ABI mode, and converts it to its ABI mode equivalent. See the README for more information.

  Please only use on decodings produced by this same decoder instance; use on decodings produced by other instances may not work consistently.

  #### Parameters

  - ##### decoding: LogDecoding

    The decoding to abify

  #### Returns LogDecoding

  - Defined in decoder/lib/decoders.ts:681

### abifyReturndataDecoding

- abifyReturndataDecoding(decoding): ReturndataDecoding

- Takes a [[ReturndataDecoding]], which may have been produced in full mode or ABI mode, and converts it to its ABI mode equivalent. See the README for more information.

  Please only use on decodings produced by this same decoder instance; use on decodings produced by other instances may not work consistently.

  #### Parameters

  - ##### decoding: ReturndataDecoding

    The decoding to abify

  #### Returns ReturndataDecoding

  - Defined in decoder/lib/decoders.ts:694

### addAdditionalProjectInfo

- addAdditionalProjectInfo(projectInfo): Promise<void>

- This function is asynchronous.

  Adds additional compilations to the decoder like [[addCompilations]], but allows it to be specified in more general forms.

  #### Parameters

  - ##### projectInfo: Compilations.ProjectInfo

    Information about the additional compilations or contracts to be decoded. This may come in several forms; see the type documentation for more information. If passing in `{ compilations: ... }`, take care that the compilations have different IDs from others passed in so far, otherwise this will error. If passed in in another form, an ID will be assigned automatically, which should generally avoid any collisions.

  #### Returns Promise<void>

  - Defined in decoder/lib/decoders.ts:315

### addCompilations

- addCompilations(compilations): Promise<void>

- This function is asynchronous.

  Adds compilations to the decoder after it has started. Note it is only presently possible to do this with a `ProjectDecoder` and not with the other decoder classes.

  #### Parameters

  - ##### compilations: Compilation[]

    The compilations to be added. Take care that these have IDs distinct from those the decoder already has.

  #### Returns Promise<void>

  - Defined in decoder/lib/decoders.ts:199

### decodeLog

- decodeLog(log, options?): Promise<LogDecoding[]>

- This method is asynchronous.

  Takes a [[Log]] object and decodes it. Logs can be ambiguous, so this function returns an array of [[LogDecoding|LogDecodings]].

  Note that logs are decoded in strict mode, so (with one exception) 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. The one exception to this is that indexed parameters of reference type cannot meaningfully be decoded, so those will decode to an error.

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

  1. Non-anonymous events coming from the contract itself (these will moreover be ordered from most derived to most base)
  2. Non-anonymous events coming from libraries
  3. Anonymous events coming from the contract itself (again, ordered from most derived to most base)
  4. Anonymous events coming from libraries

  You can check the kind and class.contractKind fields 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.

  Using `options.extras = "on"` or `options.extras = "necessary"` will change the above behavior; see the documentation on [[ExtrasAllowed]] for more.

  If absolutely necessary, you can also set `options.disableChecks = true` to allow looser decoding. Only use this option if you know what you are doing.

  #### Parameters

  - ##### log: Log

    The log to be decoded.

  - ##### options: DecodeLogOptions = {}

    Options for controlling decoding.

  #### Returns Promise<LogDecoding[]>

  - Defined in decoder/lib/decoders.ts:545

### `Protected` decodeLogWithAdditionalOptions

- decodeLogWithAdditionalOptions(log, options?, additionalContexts?): Promise<LogDecoding[]>
- `Protected`

  #### Parameters

  - ##### log: Log

  - ##### options: EventOptions = {}

  - ##### additionalContexts: Contexts = {}

  #### Returns Promise<LogDecoding[]>

  - Defined in decoder/lib/decoders.ts:555

### decodeTransaction

- decodeTransaction(transaction): Promise<CalldataDecoding>

- This method is asynchronous.

  Takes a [[Transaction]] object and decodes it. The result is a [[CalldataDecoding]]; see the documentation on that interface for more.

  Note that decoding of transactions sent to libraries is presently not supported and may have unreliable results. Limited support for this is planned for future versions.

  #### Parameters

  - ##### transaction: Transaction

    The transaction to be decoded.

  #### Returns Promise<CalldataDecoding>

  - Defined in decoder/lib/decoders.ts:383

### `Protected` decodeTransactionWithAdditionalContexts

- decodeTransactionWithAdditionalContexts(transaction, additionalContexts?, additionalAllocations?): Promise<CalldataDecoding>
- `Protected`

  #### Parameters

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CalldataDecoding>

  - Defined in decoder/lib/decoders.ts:429

### events

- events(options?): Promise<DecodedLog[]>

- This method is asynchronous.

  Gets all events meeting certain conditions and decodes them. This function is fairly rudimentary at the moment but more functionality will be added in the future.

  #### Parameters

  - ##### options: EventOptions = {}

    Used to determine what events to fetch and how to decode them; see the documentation on the [[EventOptions]] type for more.

  #### Returns Promise<DecodedLog[]>

  An array of [[DecodedLog|DecodedLogs]]. These consist of a log together with its possible decodings; see that type for more info. And see [[decodeLog]] for more info on how log decoding works in general.

  #### Example

      `events({name: "TestEvent"})` -- get events named "TestEvent"
        from the most recent block

  - Defined in decoder/lib/decoders.ts:610

### `Protected` eventsWithAdditionalContexts

- eventsWithAdditionalContexts(options?, additionalContexts?): Promise<DecodedLog[]>
- `Protected`

  #### Parameters

  - ##### options: EventOptions = {}

  - ##### additionalContexts: Contexts = {}

  #### Returns Promise<DecodedLog[]>

  - Defined in decoder/lib/decoders.ts:619

### forAddress

- forAddress(address, block?): Promise<ContractInstanceDecoder>

- This method is asynchronous.

  Constructs a contract instance decoder 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 decoder can't identify it, you'll get an exception.

  #### Parameters

  - ##### address: string

    The address of the contract instance to decode. 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<ContractInstanceDecoder>

  - Defined in decoder/lib/decoders.ts:795

### forArtifact

- forArtifact(artifact): Promise<ContractDecoder>

- This method is asynchronous.

  Constructs a contract decoder for a given contract artifact.

  #### Parameters

  - ##### artifact: ContractObject

    The artifact for the contract.

    A contract constructor object may be substituted for the artifact, so if you're not sure which you're dealing with, it's OK.

    Note: The artifact must be for a contract that the decoder knows about; otherwise you will have problems.

  #### Returns Promise<ContractDecoder>

  - Defined in decoder/lib/decoders.ts:736

### forInstance

- forInstance(artifact, address?): Promise<ContractInstanceDecoder>

- This method is asynchronous.

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

  #### Parameters

  - ##### artifact: ContractObject

    The artifact for the contract.

    A contract constructor object may be substituted for the artifact, so if you're not sure which you're dealing with, it's OK.

    Note: The artifact must be for a contract that the decoder knows about; otherwise you will have problems.

  - ##### `Optional` address: string

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

  #### Returns Promise<ContractInstanceDecoder>

  - Defined in decoder/lib/decoders.ts:774

### `Protected` getAllocations

- getAllocations(): AllocationInfo
- `Protected`

  #### Returns AllocationInfo

  - Defined in decoder/lib/decoders.ts:850

### `Protected` getCode

- getCode(address, block): Promise<Uint8Array>
- `Protected`

  #### Parameters

  - ##### address: string

  - ##### block: RegularizedBlockSpecifier

  #### Returns Promise<Uint8Array>

  - Defined in decoder/lib/decoders.ts:329

### `Private` getContextByAddress

- getContextByAddress(address, block, constructorBinary?, additionalContexts?): Promise<Context>

- #### Parameters

  - ##### address: string

  - ##### block: RegularizedBlockSpecifier

  - ##### `Optional` constructorBinary: string

  - ##### additionalContexts: Contexts = {}

  #### Returns Promise<Context>

  - Defined in decoder/lib/decoders.ts:704

### `Protected` getDeployedContexts

- getDeployedContexts(): Contexts
- `Protected`

  #### Returns Contexts

  - Defined in decoder/lib/decoders.ts:871

### `Protected` getEnsSettings

- getEnsSettings(): EnsSettings
- `Protected`

  #### Returns EnsSettings

  - Defined in decoder/lib/decoders.ts:864

### `Protected` getProviderAdapter

- getProviderAdapter(): ProviderAdapter
- `Protected`

  #### Returns ProviderAdapter

  - Defined in decoder/lib/decoders.ts:857

### `Protected` getReferenceDeclarations

- getReferenceDeclarations(): {
  [compilationId: string]: AstNodes;
  }
- `Protected`

  #### Returns {
  [compilationId: string]: AstNodes;
  }

  - ##### [compilationId: string]: AstNodes

  - Defined in decoder/lib/decoders.ts:836

### `Protected` getUserDefinedTypes

- getUserDefinedTypes(): TypesById
- `Protected`

  #### Returns TypesById

  - Defined in decoder/lib/decoders.ts:843

### `Protected` init

- init(): Promise<void>
- `Protected`

  WARNING: this code is copypasted (w/slight modifications) from encoder!!

  #### Returns Promise<void>

  - Defined in decoder/lib/decoders.ts:155

### `Private` interpretAggregate

- interpretAggregate(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<CallInterpretationInfo[]>

- #### Parameters

  - ##### decoding: CalldataDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CallInterpretationInfo[]>

  - Defined in decoder/lib/decoders.ts:991

### `Private` interpretBlockhashedMulticall

- interpretBlockhashedMulticall(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<BlockhashedMulticallInfo>

- #### Parameters

  - ##### decoding: CalldataDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<BlockhashedMulticallInfo>

  - Defined in decoder/lib/decoders.ts:1169

### `Private` interpretCallInAggregate

- interpretCallInAggregate(callResult, transaction, additionalContexts?, additionalAllocations?): Promise<CallInterpretationInfo>

- #### Parameters

  - ##### callResult: StructResult | TupleResult

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CallInterpretationInfo>

  - Defined in decoder/lib/decoders.ts:1033

### `Private` interpretCallInMulti

- interpretCallInMulti(callResult, transaction, additionalContexts?, additionalAllocations?): Promise<CalldataDecoding>

- #### Parameters

  - ##### callResult: BytesResult

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CalldataDecoding>

  - Defined in decoder/lib/decoders.ts:969

### `Private` interpretDeadlinedMulticall

- interpretDeadlinedMulticall(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<DeadlinedMulticallInfo>

- #### Parameters

  - ##### decoding: CalldataDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<DeadlinedMulticallInfo>

  - Defined in decoder/lib/decoders.ts:1127

### `Private` interpretMulticall

- interpretMulticall(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<CalldataDecoding[]>

- #### Parameters

  - ##### decoding: CalldataDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CalldataDecoding[]>

  - Defined in decoder/lib/decoders.ts:933

### `Private` interpretTryAggregate

- interpretTryAggregate(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<TryAggregateInfo>

- #### Parameters

  - ##### decoding: CalldataDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<TryAggregateInfo>

  - Defined in decoder/lib/decoders.ts:1079

### `Protected` regularizeBlock

- regularizeBlock(block): Promise<RegularizedBlockSpecifier>
- `Protected`

  #### Parameters

  - ##### block: BlockSpecifier

  #### Returns Promise<RegularizedBlockSpecifier>

  - Defined in decoder/lib/decoders.ts:359

### `Protected` reverseEnsResolve

- reverseEnsResolve(address): Promise<Uint8Array>
- `Protected`

  #### Parameters

  - ##### address: string

  #### Returns Promise<Uint8Array>

  - Defined in decoder/lib/decoders.ts:392

### `Private` withMulticallInterpretations

- withMulticallInterpretations(decoding, transaction, additionalContexts?, additionalAllocations?): Promise<CalldataDecoding>

- #### Parameters

  - ##### decoding: FunctionDecoding

  - ##### transaction: Transaction

  - ##### additionalContexts: Contexts = {}

  - ##### `Optional` additionalAllocations: {
    [selector: string]: FunctionCalldataAndReturndataAllocation;
    }

    - ##### [selector: string]: FunctionCalldataAndReturndataAllocation

  #### Returns Promise<CalldataDecoding>

  - Defined in decoder/lib/decoders.ts:877

Generated using TypeDoc