Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error decoding not working as expected on verified contract #833

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.