fix matomo send transaction

pull/5370/head
yann300 4 years ago
parent 01b2cd5fd1
commit 88df66e2b5
  1. 12
      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

@ -48,14 +48,13 @@ 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 = name this.networkName = network.name
const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`) const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`)
@ -66,7 +65,6 @@ class ContractDropdownUI {
this.setCheckedState(this.networkName === 'Main') this.setCheckedState(this.networkName === 'Main')
} }
}) })
})
} }
setCheckedState (value) { setCheckedState (value) {
@ -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)
} }

Loading…
Cancel
Save