|
|
|
@ -4,6 +4,7 @@ import {TreeView, TreeViewItem} from '@remix-ui/tree-view' // eslint-disable-lin |
|
|
|
|
import {DropdownPanelProps, ExtractData, ExtractFunc} from '../../types' // eslint-disable-line
|
|
|
|
|
import {CopyToClipboard} from '@remix-ui/clipboard' // eslint-disable-line
|
|
|
|
|
import {initialState, reducer} from '../../reducers/calldata' |
|
|
|
|
import {isBigInt} from 'web3-validator' |
|
|
|
|
import './styles/dropdown-panel.css' |
|
|
|
|
|
|
|
|
|
export const DropdownPanel = (props: DropdownPanelProps) => { |
|
|
|
@ -53,6 +54,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { |
|
|
|
|
} |
|
|
|
|
const formatSelfDefault = (key: string | number, data: ExtractData) => { |
|
|
|
|
let value |
|
|
|
|
if (isBigInt(data.self)) data.self = data.self.toString() |
|
|
|
|
if (hexHighlight && typeof data.self === 'string') { |
|
|
|
|
const isHex = data.self.startsWith('0x') || hexHighlight |
|
|
|
|
if (isHex) { |
|
|
|
@ -182,6 +184,10 @@ export const DropdownPanel = (props: DropdownPanelProps) => { |
|
|
|
|
else if (calldata && Object.keys(calldata).length === 0 && calldata.constructor === Object) isEmpty = true |
|
|
|
|
|
|
|
|
|
setState((prevState) => { |
|
|
|
|
const copiableContent = JSON.stringify(calldata, (key, value) => { |
|
|
|
|
if (isBigInt(value)) value = value.toString() |
|
|
|
|
return value |
|
|
|
|
}, '\t').replace(/0xNaN/g, '0x0') |
|
|
|
|
return { |
|
|
|
|
...prevState, |
|
|
|
|
dropdownContent: { |
|
|
|
@ -189,7 +195,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { |
|
|
|
|
display: 'block' |
|
|
|
|
}, |
|
|
|
|
// replace 0xNaN with 0x0
|
|
|
|
|
copiableContent: JSON.stringify(calldata, null, '\t').replace(/0xNaN/g, '0x0'), |
|
|
|
|
copiableContent, |
|
|
|
|
message: { |
|
|
|
|
innerText: isEmpty ? intl.formatMessage({id: 'debugger.noDataAvailable'}) : '', |
|
|
|
|
display: isEmpty ? 'block' : 'none' |
|
|
|
|