Skip to content

Commit 11de43a

Browse files
committed
feat(ts): add ethereum.decodeParams host binding
Declares the new ethereum.decodeParams host function for decoding ABI function-parameter data (transaction calldata, event data). Pairs with graph-node apiVersion 0.0.10. See graphprotocol/graph-node#5432.
1 parent 7fe67ac commit 11de43a

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@graphprotocol/graph-ts': minor
3+
---
4+
5+
Add `ethereum.decodeParams` for decoding ABI function-parameter data
6+
7+
`ethereum.decode` decodes its input as a single ABI value, which fails for
8+
data whose top-level type is a tuple with a dynamic field (e.g. Gnosis Safe
9+
`execTransaction`): transaction calldata and event data are encoded as ABI
10+
function parameters and have no leading offset word. `ethereum.decodeParams`
11+
decodes that parameter layout correctly. Use it for calldata/event data and
12+
keep `ethereum.decode` for round-tripping `ethereum.encode` output.
13+
14+
Requires a graph-node that supports mapping apiVersion `0.0.10`.

packages/ts/chain/ethereum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export declare namespace ethereum {
99
function hasCode(address: Address): Wrapped<bool>;
1010
function encode(token: Value): Bytes | null;
1111
function decode(types: string, data: Bytes): Value | null;
12+
function decodeParams(types: string, data: Bytes): Value | null;
1213
}
1314

1415
export namespace ethereum {

0 commit comments

Comments
 (0)