Uniswap / v3-subgraph

Subgraph for Uniswap V3
GNU General Public License v3.0
344 stars 476 forks source link

Transaction class don't have gasUsed. but index.ts has this. #106

Closed Philip-general closed 1 year ago

Philip-general commented 2 years ago

this is src > utils > index.ts

export function loadTransaction(event: ethereum.Event): Transaction {
  let transaction = Transaction.load(event.transaction.hash.toHexString())
  if (transaction === null) {
    transaction = new Transaction(event.transaction.hash.toHexString())
  }
  transaction.blockNumber = event.block.number
  transaction.timestamp = event.block.timestamp
  transaction.gasUsed = event.transaction.gasUsed
  transaction.gasPrice = event.transaction.gasPrice
  transaction.save()
  return transaction as Transaction
}

the problem is transaction.gasUsed = event.transaction.gasUsed but in ethereum Transaction

  /**
   * An Ethereum transaction.
   */
  export class Transaction {
    constructor(
      public hash: Bytes,
      public index: BigInt,
      public from: Address,
      public to: Address | null,
      public value: BigInt,
      public gasLimit: BigInt,
      public gasPrice: BigInt,
      public input: Bytes,
      public nonce: BigInt,
    ) {}
  }

there is no gasUsed.

so I got this error.

TS2339: Property 'gasUsed' does not exist on type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.Transaction'.

   transaction.gasUsed = event.transaction.gasUsed
                                           ~~~~~~~
 in src/utils/index.ts(90,43)

anyone solve this?

Ujjwalvinze commented 1 year ago

@phillip-101 Facing the exact issue. Please tell how you solved it?

ankitkarna99 commented 8 months ago

Change it to:

transaction.gasUsed = event.transaction.gasLimit