-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Which packages are impacted by your issue?
@graphprotocol/graph-ts
graph-tooling/packages/ts/chain/ethereum.ts
Lines 531 to 618 in 4b4ad3e
export class Block { | |
constructor( | |
public hash: Bytes, | |
public parentHash: Bytes, | |
public unclesHash: Bytes, | |
public author: Address, | |
public stateRoot: Bytes, | |
public transactionsRoot: Bytes, | |
public receiptsRoot: Bytes, | |
public number: BigInt, | |
public gasUsed: BigInt, | |
public gasLimit: BigInt, | |
public timestamp: BigInt, | |
public difficulty: BigInt, | |
public totalDifficulty: BigInt, | |
public size: BigInt | null, | |
public baseFeePerGas: BigInt | null, | |
) {} | |
} | |
/** | |
* 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, | |
) {} | |
} | |
/** | |
* An Ethereum transaction receipt. | |
*/ | |
export class TransactionReceipt { | |
constructor( | |
public transactionHash: Bytes, | |
public transactionIndex: BigInt, | |
public blockHash: Bytes, | |
public blockNumber: BigInt, | |
public cumulativeGasUsed: BigInt, | |
public gasUsed: BigInt, | |
public contractAddress: Address, | |
public logs: Array<Log>, | |
public status: BigInt, | |
public root: Bytes, | |
public logsBloom: Bytes, | |
) {} | |
} | |
/** | |
* An Ethereum event log. | |
*/ | |
export class Log { | |
constructor( | |
public address: Address, | |
public topics: Array<Bytes>, | |
public data: Bytes, | |
public blockHash: Bytes, | |
public blockNumber: Bytes, | |
public transactionHash: Bytes, | |
public transactionIndex: BigInt, | |
public logIndex: BigInt, | |
public transactionLogIndex: BigInt, | |
public logType: string, | |
public removed: Wrapped<bool> | null, | |
) {} | |
} | |
/** | |
* Common representation for Ethereum smart contract calls. | |
*/ | |
export class Call { | |
constructor( | |
public to: Address, | |
public from: Address, | |
public block: Block, | |
public transaction: Transaction, | |
public inputValues: Array<EventParam>, | |
public outputValues: Array<EventParam>, | |
) {} | |
} |
Describe the issue
It would be super duper helpful if the ethereum types, e.g. Transaction,
Event`, etc., contained explanatory comments.
Lacking this information leads to uncertainty, e.g.:
- What is the `index` field in the `Transaction` type provided by The Graph? #2035
- If an event was emitted multiple times in the same transaction, can we know the index of the event? #2036
- https://discord.com/channels/438038660412342282/438070183794573313/1276303366221201499
In particular, I see that you provide some types that are not part of the standard Ethereum JavaScript API, e.g. transactionLogIndex
. This index value can be easily misunderstood for the transactionIndex
, which is the index of the tx within the block.
Explanatory comments would provide clarity.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working