Skip to content

Commit 0fc224f

Browse files
authored
fix(explorer): array args encoding (#3748)
1 parent 7367a81 commit 0fc224f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎.changeset/clean-berries-juggle.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/explorer": patch
3+
---
4+
5+
Array function arguments are now correctly encoded on the "Interact" page.

‎packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/interact/content/encodeFunctionArgs.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { AbiFunction } from "viem";
33
export function encodeFunctionArgs(args: unknown[], inputs: AbiFunction): unknown[] {
44
const encodedArgs = args.map((arg, i) => {
55
const input = inputs.inputs[i];
6-
if (!input) return arg;
6+
if (!input || !arg) return arg;
77

8+
if (input.type.includes("[]")) return JSON.parse(arg as string);
89
if (input.type === "tuple") return JSON.parse(arg as string);
910
if (input.type === "bool") return arg === "true";
1011

0 commit comments

Comments
 (0)