From 0eb071172f32ec600ad6d1e753b2b04f539c6c5b Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Mar 2024 10:47:51 +0100 Subject: [PATCH] fix parsing int --- libs/remix-lib/src/helpers/txResultHelper.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/remix-lib/src/helpers/txResultHelper.ts b/libs/remix-lib/src/helpers/txResultHelper.ts index e4bf6bbbca..d19a4f1ede 100644 --- a/libs/remix-lib/src/helpers/txResultHelper.ts +++ b/libs/remix-lib/src/helpers/txResultHelper.ts @@ -1,6 +1,8 @@ 'use strict' import { bytesToHex } from '@ethereumjs/util' import { isHexString } from 'ethjs-util' +import { BN } from 'bn.js' +import { isBigInt } from 'web3-validator' function convertToPrefixedHex (input) { if (input === undefined || input === null || isHexString(input)) { @@ -9,6 +11,9 @@ function convertToPrefixedHex (input) { if (typeof input === 'number') { return '0x' + input.toString(16) } + if ((input.constructor && input.constructor.name === 'BigNumber') || BN.isBN(input) || isBigInt(input)) { + return '0x' + input.toString(16) + } try { return bytesToHex(input) @@ -47,10 +52,9 @@ export function resultToRemixTx (txResult, execResult?) { errorMessage = execResult.exceptionError } - console.log('resultToRemixTx', gasUsed, convertToPrefixedHex(gasUsed)) return { transactionHash, - status, + status: convertToPrefixedHex(status), gasUsed: convertToPrefixedHex(gasUsed), error: errorMessage, return: returnValue ? convertToPrefixedHex(returnValue) : undefined,