diff --git a/packages/next-common/components/papiCallTreeView/valuePanel.js b/packages/next-common/components/papiCallTreeView/valuePanel.js index 2670598ea5..0aa224241a 100644 --- a/packages/next-common/components/papiCallTreeView/valuePanel.js +++ b/packages/next-common/components/papiCallTreeView/valuePanel.js @@ -16,7 +16,7 @@ import AddressUser from "../user/addressUser"; import { useCallContext } from "./callContext"; import interlay from "next-common/utils/consts/settings/interlay"; import kintsugi from "next-common/utils/consts/settings/kintsugi"; -import { isNil } from "lodash-es"; +import { isNil, omit } from "lodash-es"; import EnumPanel from "./enumPanel"; import { isPolkadotAddress } from "next-common/utils/viewfuncs"; @@ -24,6 +24,20 @@ const LongText = dynamic(() => import("next-common/components/longText"), { ssr: false, }); +function u64ArrayToU256(arr) { + if (arr.length !== 4) { + throw new Error("Expected array of 4 u64 values"); + } + + const n = + BigInt(arr[0]) | + (BigInt(arr[1]) << 64n) | + (BigInt(arr[2]) << 128n) | + (BigInt(arr[3]) << 192n); + + return "0x" + n.toString(16).padStart(64, "0"); +} + export function safeHexToString(hex) { if (!hex.startsWith("0x")) { hex = "0x" + hex; @@ -193,6 +207,24 @@ export function ValuePanel({ node }) { } if (rawType === "array") { + if ( + type === "[u64; 4]" && + Array.isArray(node.children) && + node.children.length === 4 + ) { + const value = u64ArrayToU256(node.children.map((child) => child.value)); + return ( + + ); + } + return ; } diff --git a/packages/next-common/utils/callDecoder/typeName.mjs b/packages/next-common/utils/callDecoder/typeName.mjs index acdb655905..3083a3b0ce 100644 --- a/packages/next-common/utils/callDecoder/typeName.mjs +++ b/packages/next-common/utils/callDecoder/typeName.mjs @@ -81,13 +81,6 @@ export function getTypeName(lookupEntry, metadata, typeId) { ) { return "H160"; } - if ( - lookupEntry.len === 4 && - lookupEntry.value.type === "primitive" && - lookupEntry.value.value === "u64" - ) { - return "U256"; - } const innerType = getTypeName( lookupEntry.value,