Skip to content

Commit c9a7e15

Browse files
authored
fix(explorer): encode big integer arguments (#3777)
1 parent 87e6447 commit c9a7e15

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changeset/wicked-suits-jog.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+
Big integer values are now encoded correctly when calling functions from "Interact" page.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export function encodeFunctionArgs(args: unknown[], inputs: AbiFunction): unknow
88
if (input.type.includes("[]")) return JSON.parse(arg as string);
99
if (input.type === "tuple") return JSON.parse(arg as string);
1010
if (input.type === "bool") return arg === "true";
11+
if (input.type.startsWith("uint") || input.type.startsWith("int")) {
12+
if (typeof arg === "string" && arg.endsWith("n")) return arg.slice(0, -1);
13+
return arg;
14+
}
1115

1216
return arg;
1317
});

0 commit comments

Comments
 (0)