Skip to content

Commit

Permalink
fix: error decoding not working as expected on verified contract (#833)
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Le Ponner <[email protected]>
  • Loading branch information
ericleponner authored Jan 5, 2024
1 parent 33e7ac3 commit e49b4c5
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/components/values/FunctionError.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
</template>
</Property>

<template v-for="arg in errorInputs" :key="arg.name">
<Property :custom-nb-col-class="customNbColClass">
<template v-slot:name>{{ arg.name != "" ? arg.name : "message" }}</template>
<template v-slot:value>
<FunctionValue :ntv="arg"/>
</template>
</Property>
</template>

</div><template v-else>

<Property :custom-nb-col-class="customNbColClass" id="functionInput">
Expand Down Expand Up @@ -82,10 +91,11 @@ import {FunctionCallAnalyzer} from "@/utils/analyzer/FunctionCallAnalyzer";
import Property from "@/components/Property.vue";
import {decodeSolidityErrorMessage} from "@/schemas/HederaUtils";
import StringValue from "@/components/values/StringValue.vue";
import FunctionValue from "@/components/values/FunctionValue.vue";

export default defineComponent({
name: 'FunctionError',
components: {StringValue, Property, HexaValue},
components: {FunctionValue, StringValue, Property, HexaValue},
props: {
analyzer: {
type: Object as PropType<FunctionCallAnalyzer>,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/analyzer/FunctionCallAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class FunctionCallAnalyzer {

private readonly updateTransactionDescription = async () => {
const i = this.contractAnalyzer.interface.value
const input = this.input.value
const input = this.normalizedInput.value
if (i !== null && input !== null) {
try {
const td = i.parseTransaction({data: input})
Expand All @@ -206,7 +206,7 @@ export class FunctionCallAnalyzer {
private readonly updateOutputResult = () => {
const td = this.transactionDescription.value
const i = this.contractAnalyzer.interface.value
const output = this.output.value
const output = this.normalizedOutput.value
if (td !== null && i !== null && output !== null) {
try {
this.outputResult.value = i.decodeFunctionResult(td.fragment as ethers.FunctionFragment, output)
Expand All @@ -223,7 +223,7 @@ export class FunctionCallAnalyzer {

private readonly updateErrorDescription = async() => {
const i = this.contractAnalyzer.interface.value
const error = this.error.value
const error = this.normalizedError.value
if (i !== null && error !== null && error !== "0x") {
try {
const ed = i.parseError(error)
Expand Down
288 changes: 288 additions & 0 deletions tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts

Large diffs are not rendered by default.

0 comments on commit e49b4c5

Please sign in to comment.