Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/ethereum-decode-params.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@graphprotocol/graph-ts': minor
---

Add `ethereum.decodeParams` for decoding ABI function-parameter data

`ethereum.decode` decodes its input as a single ABI value, which fails for
data whose top-level type is a tuple with a dynamic field (e.g. Gnosis Safe
`execTransaction`): transaction calldata and event data are encoded as ABI
function parameters and have no leading offset word. `ethereum.decodeParams`
decodes that parameter layout correctly. Use it for calldata/event data and
keep `ethereum.decode` for round-tripping `ethereum.encode` output.

Requires a graph-node that supports mapping apiVersion `0.0.10`.
1 change: 1 addition & 0 deletions packages/ts/chain/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export declare namespace ethereum {
function hasCode(address: Address): Wrapped<bool>;
function encode(token: Value): Bytes | null;
function decode(types: string, data: Bytes): Value | null;
function decodeParams(types: string, data: Bytes): Value | null;
}

export namespace ethereum {
Expand Down
Loading