Skip to content

Type ethereum.TransactionReceipt | null is not assignable to type ethereum.TransactionReceipt #1090

Open
@adamazad

Description

@adamazad

I have issues accessing event.receipt in a handler:

export function handleMint(event: Mint): void {

  if (event.receipt !== null) {
     // logic to handle receipt
  }

}

image

I added receipt: true per documentation. Definitely doesn't help.

      eventHandlers:
        - event: Mint(indexed address,uint256,uint256)
          handler: handleMint
          receipt: true

Full log:

yarn run v1.22.18
$ graph deploy adamazad/swapr-exp-one subgraph.xdai.yaml --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
  Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
  Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
  Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
✔ Load subgraph from subgraph.xdai.yaml
  Compile data source: Factory => build/Factory/Factory.wasm
  Compile data source: StakingRewardsFactory => build/StakingRewardsFactory/StakingRewardsFactory.wasm
  Compile data source template: Pair => build/templates/Pair/Pair.wasm
⠋ Compile subgraphERROR TS2322: Type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.TransactionReceipt | null' is not assignable to type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.TransactionReceipt'.

     event.receipt.logs.forEach((log) => {
     ~~~~~~~~~~~~~
 in src/mappings/core.ts(303,5)

✖ Failed to compile subgraph: Failed to compile data source template: 1 compile error(s)
Error: Failed to compile data source template: 1 compile error(s)
    at Compiler._compileTemplateMapping (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler/index.js:374:13)
    at /Users/adam/workspace/dxdao/swapr-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler/index.js:231:24
    at updateInDeepMap (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:1971:22)
    at updateInDeepMap (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
    at updateInDeepMap (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
    at Map.updateIn (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:1278:26)
    at /Users/adam/workspace/dxdao/swapr-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler/index.js:230:26
    at /Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:3016:46
    at List.__iterate (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:2206:13)
    at IndexedIterable.mappedSequence.__iterateUncached (/Users/adam/workspace/dxdao/swapr-subgraph/node_modules/immutable/dist/immutable.js:3015:23)
UNCAUGHT EXCEPTION: Error: The AssemblyScript compiler crashed when compiling this file: 'src/mappings/core.ts'
Suggestion: try to comment the whole file and uncomment it little by little while re-running the graph-cli until you isolate the line where the problem happens.
Also, please contact us so we can make the CLI better by handling errors like this. You can reach out in any of these links:
- Discord channel: https://discord.gg/eM8CA6WA9r
- Github issues: https://github.com/graphprotocol/graph-cli/issues
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions