Merge pull request #1198 from ethereum/matomoInfo

Matomo sendTx & startDebugging
pull/1210/head^2
yann300 4 years ago committed by GitHub
commit d471d04880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      apps/remix-ide/src/app/tabs/runTab/contractDropdown.js
  2. 2
      apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js
  3. 26
      apps/remix-ide/src/app/tabs/runTab/settings.js
  4. 8
      apps/remix-ide/src/app/ui/universal-dapp-ui.js
  5. 21
      apps/remix-ide/src/blockchain/blockchain.js
  6. 5
      libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx

@ -48,24 +48,22 @@ class ContractDropdownUI {
} }
listenToContextChange () { listenToContextChange () {
this.blockchain.event.register('contextChanged', () => { this.blockchain.event.register('networkStatus', ({ error, network }) => {
this.blockchain.updateNetwork((err, { name } = {}) => { if (error) {
if (err) { console.log('can\'t detect network')
console.log('can\'t detect network') return
return }
} this.exEnvironment = this.blockchain.getProvider()
this.exEnvironment = this.blockchain.getProvider() this.networkName = network.name
this.networkName = name
const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`) const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`)
// check if an already selected option exist else use default workflow // check if an already selected option exist else use default workflow
if (savedConfig !== null) { if (savedConfig !== null) {
this.setCheckedState(savedConfig) this.setCheckedState(savedConfig)
} else { } else {
this.setCheckedState(this.networkName === 'Main') this.setCheckedState(this.networkName === 'Main')
} }
})
}) })
} }
@ -306,10 +304,10 @@ class ContractDropdownUI {
const data = self.runView.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) const data = self.runView.compilersArtefacts.getCompilerAbstract(contractObject.contract.file)
self.runView.compilersArtefacts.addResolvedContract(helper.addressToString(address), data) self.runView.compilersArtefacts.addResolvedContract(helper.addressToString(address), data)
if (self.ipfsCheckedState) { if (self.ipfsCheckedState) {
_paq.push(['trackEvent', 'udapp', `DeployAndPublish_${this.networkName}`]) _paq.push(['trackEvent', 'udapp', 'DeployAndPublish', this.networkName])
publishToStorage('ipfs', self.runView.fileProvider, self.runView.fileManager, selectedContract) publishToStorage('ipfs', self.runView.fileProvider, self.runView.fileManager, selectedContract)
} else { } else {
_paq.push(['trackEvent', 'udapp', `DeployOnly_${this.networkName}`]) _paq.push(['trackEvent', 'udapp', 'DeployOnly', this.networkName])
} }
} }

@ -55,7 +55,7 @@ class DropdownLogic {
cb(null, 'abi', abi) cb(null, 'abi', abi)
}) })
} else { } else {
_paq.push(['trackEvent', 'udapp', 'AtAddressLoadWithInstance']) _paq.push(['trackEvent', 'udapp', 'AtAddressLoadWithArtifacts'])
cb(null, 'instance') cb(null, 'instance')
} }
} }

@ -97,7 +97,7 @@ class SettingsUI {
Environment Environment
</label> </label>
<div class="${css.environment}"> <div class="${css.environment}">
<select id="selectExEnvOptions" data-id="settingsSelectEnvOptions" onchange=${() => { this.updateNetwork() }} class="form-control ${css.select} custom-select"> <select id="selectExEnvOptions" data-id="settingsSelectEnvOptions" class="form-control ${css.select} custom-select">
<option id="vm-mode" <option id="vm-mode"
title="Execution environment does not connect to any node, everything is local and in memory only." title="Execution environment does not connect to any node, everything is local and in memory only."
value="vm" name="executionContext"> JavaScript VM value="vm" name="executionContext"> JavaScript VM
@ -192,8 +192,17 @@ class SettingsUI {
this.setFinalContext() this.setFinalContext()
}) })
this.blockchain.event.register('networkStatus', ({ error, network }) => {
if (error) {
this.netUI.innerHTML = 'can\'t detect network '
return
}
const networkProvider = this._components.networkModule.getNetworkProvider.bind(this._components.networkModule)
this.netUI.innerHTML = (networkProvider() !== 'vm') ? `${network.name} (${network.id || '-'}) network` : ''
})
setInterval(() => { setInterval(() => {
this.updateNetwork() this.fillAccountsList()
}, 1000) }, 1000)
this.el = el this.el = el
@ -273,7 +282,6 @@ class SettingsUI {
// set the final context. Cause it is possible that this is not the one we've originaly selected // set the final context. Cause it is possible that this is not the one we've originaly selected
this.selectExEnv.value = this.blockchain.getProvider() this.selectExEnv.value = this.blockchain.getProvider()
this.event.trigger('clearInstance', []) this.event.trigger('clearInstance', [])
this.updateNetwork()
this.updatePlusButton() this.updatePlusButton()
} }
@ -390,18 +398,6 @@ class SettingsUI {
}) })
} }
updateNetwork () {
this.blockchain.updateNetwork((err, { id, name } = {}) => {
if (err) {
this.netUI.innerHTML = 'can\'t detect network '
return
}
const network = this._components.networkModule.getNetworkProvider.bind(this._components.networkModule)
this.netUI.innerHTML = (network() !== 'vm') ? `${name} (${id || '-'}) network` : ''
})
this.fillAccountsList()
}
// TODO: unclear what's the goal of accountListCallId, feels like it can be simplified // TODO: unclear what's the goal of accountListCallId, feels like it can be simplified
async fillAccountsList () { async fillAccountsList () {
this.accountListCallId++ this.accountListCallId++

@ -244,8 +244,12 @@ UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, i
outputOverride.appendChild(decoded) outputOverride.appendChild(decoded)
} }
} }
const info = `${lookupOnly ? 'call' : args.funABI.type !== 'fallback' ? 'lowLevelInteracions' : 'transact'}_${this.blockchain.executionContext.executionContext}` let callinfo = ''
_paq.push(['trackEvent', 'udapp', info]) if (lookupOnly) callinfo = 'call'
else if (args.funABI.type === 'fallback' || args.funABI.type === 'receive') callinfo = 'lowLevelInteracions'
else callinfo = 'transact'
_paq.push(['trackEvent', 'udapp', callinfo, this.blockchain.getCurrentNetworkStatus().network.name])
const params = args.funABI.type !== 'fallback' ? inputsValues : '' const params = args.funABI.type !== 'fallback' ? inputsValues : ''
this.blockchain.runOrCallContractMethod( this.blockchain.runOrCallContractMethod(
args.contractName, args.contractName,

@ -41,6 +41,7 @@ class Blockchain {
this.executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) this.executionContext.event.register('contextChanged', this.resetEnvironment.bind(this))
this.networkcallid = 0 this.networkcallid = 0
this.networkStatus = { name: ' - ', id: ' - ' }
this.setupEvents() this.setupEvents()
this.setupProviders() this.setupProviders()
} }
@ -57,6 +58,17 @@ class Blockchain {
this.executionContext.event.register('removeProvider', (name) => { this.executionContext.event.register('removeProvider', (name) => {
this.event.trigger('removeProvider', [name]) this.event.trigger('removeProvider', [name])
}) })
setInterval(() => {
this.detectNetwork((error, network) => {
this.networkStatus = { network, error }
this.event.trigger('networkStatus', [this.networkStatus])
})
}, 1000)
}
getCurrentNetworkStatus () {
return this.networkStatus
} }
setupProviders () { setupProviders () {
@ -197,15 +209,6 @@ class Blockchain {
return this.executionContext.setProviderFromEndpoint(target, context, cb) return this.executionContext.setProviderFromEndpoint(target, context, cb)
} }
updateNetwork (cb) {
this.executionContext.detectNetwork((err, { id, name } = {}) => {
if (err) {
return cb(err)
}
cb(null, { id, name })
})
}
detectNetwork (cb) { detectNetwork (cb) {
return this.executionContext.detectNetwork(cb) return this.executionContext.detectNetwork(cb)
} }

@ -9,6 +9,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
/* eslint-disable-next-line */ /* eslint-disable-next-line */
import './debugger-ui.css' import './debugger-ui.css'
const helper = require('../../../../../apps/remix-ide/src/lib/helper') const helper = require('../../../../../apps/remix-ide/src/lib/helper')
const _paq = (window as any)._paq = (window as any)._paq || []
export const DebuggerUI = (props: DebuggerUIProps) => { export const DebuggerUI = (props: DebuggerUIProps) => {
const debuggerModule = props.debuggerAPI const debuggerModule = props.debuggerAPI
@ -167,7 +168,9 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
const web3 = await debuggerModule.getDebugWeb3() const web3 = await debuggerModule.getDebugWeb3()
try { try {
if (await web3.eth.net.getId() === 42) { const networkId = await web3.eth.net.getId()
_paq.push(['trackEvent', 'debugger', 'startDebugging', networkId])
if (networkId === 42) {
setState(prevState => { setState(prevState => {
return { return {
...prevState, ...prevState,

Loading…
Cancel
Save