Commit e82a7a02 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Wrong contract read bytes32[] (#1216)

Fixes #1176
parent dbd4452d
......@@ -73,6 +73,25 @@ export const read: Array<SmartContractReadMethod> = [
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
method_id: '69598efe',
name: 'totalPartitions',
constant: true,
payable: false,
outputs: [
{
type: 'bytes32[]',
name: 'bytes32[]',
value: [
'0x7265736572766564000000000000000000000000000000000000000000000000',
'0x6973737565640000000000000000000000000000000000000000000000000000',
],
},
],
stateMutability: 'view',
type: 'function',
},
];
export const readResultSuccess: SmartContractQueryMethodReadSuccess = {
......
import type { Abi } from 'abitype';
export type SmartContractMethodArgType = 'address' | 'uint256' | 'bool' | 'string' | 'bytes' | 'bytes32';
export type SmartContractMethodArgType = 'address' | 'uint256' | 'bool' | 'string' | 'bytes' | 'bytes32' | 'bytes32[]';
export type SmartContractMethodStateMutability = 'view' | 'nonpayable' | 'payable';
export interface SmartContract {
......@@ -91,7 +91,7 @@ export interface SmartContractMethodInput {
}
export interface SmartContractMethodOutput extends SmartContractMethodInput {
value?: string | boolean;
value?: string | boolean | object;
}
export interface SmartContractQueryMethodReadSuccess {
......
......@@ -9,7 +9,7 @@ import config from 'configs/app';
import { WEI } from 'lib/consts';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
function castValueToString(value: number | string | boolean | bigint | undefined): string {
function castValueToString(value: number | string | boolean | object | bigint | undefined): string {
switch (typeof value) {
case 'string':
return value;
......@@ -21,6 +21,8 @@ function castValueToString(value: number | string | boolean | bigint | undefined
return value.toLocaleString(undefined, { useGrouping: false });
case 'bigint':
return value.toString();
case 'object':
return JSON.stringify(value, undefined, 2);
}
}
......@@ -54,7 +56,7 @@ const ContractMethodStatic = ({ data }: Props) => {
);
}
return <chakra.span wordBreak="break-all">({ data.type }): { String(value) }</chakra.span>;
return <chakra.span wordBreak="break-all" whiteSpace="pre-wrap">({ data.type }): { String(value) }</chakra.span>;
})();
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment