Add additional Ethereum block types: FullBlock, FullBlockWithReceipts#119
Add additional Ethereum block types: FullBlock, FullBlockWithReceipts#119
Conversation
chain/ethereum.ts
Outdated
| /** | ||
| * An Ethereum block with transactions. | ||
| */ | ||
| export class FullBlock { |
There was a problem hiding this comment.
Why not less boilerplate with:
export class FullBlock extends Block {
transactions: Array<Transaction>
}The same trick applies to the other classes that have been introduced. I'm a fan of using interfaces for consistency personally, but don't feel the urge to evangelize it too much today. Here's what that would look like (if I remember correctly, my TS is rusty... lol):
export type FullBlock = Block & {
transactions: Array<Transaction>,
}One nice thing about interfaces here is that if TransactionWithReceipt implements Transaction then FullBlockWithReceipts also implements FullBlock. Type/Interface compatibility isn't a huge concern for this use-case, but it's interesting to discuss.
697aa48 to
5b4b1b6
Compare
|
the logs parameter ( |
|
Hi @zinootje, because logs are the largest part of a receipt, for performance and operating cost reasons they are deliberately left out here. We're designing this so that it is possible for us to add the option of retrieving the receipts with logs. What is your use case for this? |
|
Hi @leoyvens, thanks for the quick response . I am trying to make a subgraph on a dex aggregator. I watch for the event the dex aggregator contract emits on a swap and then i would parse logs of the transaction to see which protocols are used an how. For example if the Dex agregator uses uniswap there will be a event emitted by the uniswappool contract , if it uses bancor a event emited by the bancor poolcontract , ... . |
|
Whats the status here? |
|
Hey @zinootje your request is supported now in graphprotocol/graph-node#3373 (thanks @tilacog ) |
|
See the documentation for this feature here https://thegraph.com/docs/en/developer/create-subgraph-hosted/#transaction-receipts-in-event-handlers. |
This PR contributes to the new feature that allows subgraph developers to choose between different Ethereum block structs to use as the input argument to a block handler mapping function.
New Ethereum block types are included in the Ethereum module:
FullBlock,FullBlockWithReceipts, andTransactionWithReceipt