We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
simulate
1 parent 3a7fba4 commit 68f00d3Copy full SHA for 68f00d3
.changeset/poor-cooks-fold.md
@@ -0,0 +1,5 @@
1
+---
2
+"viem": patch
3
4
+
5
+Fixed `simulate` data decoding.
src/actions/public/simulate.ts
@@ -242,13 +242,14 @@ export async function simulate<
242
const logs = call.logs?.map((log) => formatLog(log))
243
const status = call.status === '0x1' ? 'success' : 'failure'
244
245
- const result = abi
246
- ? decodeFunctionResult({
247
- abi,
248
- data,
249
- functionName,
250
- })
251
- : null
+ const result =
+ abi && status === 'success'
+ ? decodeFunctionResult({
+ abi,
+ data,
+ functionName,
+ })
252
+ : null
253
254
const error = (() => {
255
if (status === 'success') return undefined
0 commit comments