Wrong contract read bytes32[] (#1216)

Fixes #1176
This commit is contained in:
tom goriunov
2023-09-29 10:45:35 -03:00
committed by GitHub
parent 43f1af2c25
commit 940ee709fc
9 changed files with 25 additions and 4 deletions
+19
View File
@@ -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 = {
+2 -2
View File
@@ -1,6 +1,6 @@
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 (
Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 58 KiB