Skip to content

Commit

Permalink
chore(protocol-parser): add changeset for #1099 (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Jul 5, 2023
1 parent 7a0bd74 commit ca50fef
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .changeset/many-phones-study.md
@@ -0,0 +1,25 @@
---
"@latticexyz/protocol-parser": minor
---

feat: add `encodeKeyTuple`, a util to encode key tuples in Typescript (equivalent to key tuple encoding in Solidity and inverse of `decodeKeyTuple`).
Example:

```ts
encodeKeyTuple({ staticFields: ["uint256", "int32", "bytes16", "address", "bool", "int8"], dynamicFields: [] }, [
42n,
-42,
"0x12340000000000000000000000000000",
"0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF",
true,
3,
]);
// [
// "0x000000000000000000000000000000000000000000000000000000000000002a",
// "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd6",
// "0x1234000000000000000000000000000000000000000000000000000000000000",
// "0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff",
// "0x0000000000000000000000000000000000000000000000000000000000000001",
// "0x0000000000000000000000000000000000000000000000000000000000000003",
// ]
```

0 comments on commit ca50fef

Please sign in to comment.