pull/4108/head
yann300 1 year ago
parent b495ae49a5
commit 6145fffbc4
  1. 2
      libs/remix-simulator/src/methods/transactions.ts
  2. 4
      libs/remix-simulator/src/vm-context.ts
  3. 4
      libs/remix-ui/debugger-ui/src/lib/api/debugger-api.ts
  4. 8
      libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx

@ -203,7 +203,7 @@ export class Transactions {
processTx(this.txRunnerInstance, payload, true, (error, result: VMexecutionResult) => {
if (!error && result) {
this.vmContext.addBlock(result.block)
this.vmContext.addBlock(result.block, null, true)
const hash = '0x' + result.tx.hash().toString('hex')
this.vmContext.trackTx(hash, result.block, result.tx)
const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}`

@ -374,7 +374,7 @@ export class VMContext {
return this.currentVm
}
addBlock (block: Block, genesis?: boolean) {
addBlock (block: Block, genesis?: boolean, isCall?: boolean) {
let blockNumber = bigIntToHex(block.header.number)
if (blockNumber === '0x') {
blockNumber = '0x0'
@ -384,7 +384,7 @@ export class VMContext {
this.blocks[blockNumber] = block
this.latestBlockNumber = blockNumber
if (!genesis) this.logsManager.checkBlock(blockNumber, block, this.web3())
if (!isCall && !genesis) this.logsManager.checkBlock(blockNumber, block, this.web3())
}
trackTx (txHash, block, tx) {

@ -14,9 +14,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
const self = this
this.web3Provider = {
sendAsync (payload, callback) {
self.call('web3Provider', 'sendAsync', payload)
.then(result => callback(null, result))
.catch(e => callback(e))
return self.call('web3Provider', 'sendAsync', payload)
}
}
this._web3 = new Web3(this.web3Provider)

@ -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'

Loading…
Cancel
Save