use "at address" for abi content

pull/1/head
yann300 7 years ago
parent 43cf513e40
commit 15aec1f3f0
  1. 6
      src/app.js
  2. 4
      src/app/execution/txHelper.js
  3. 9
      src/app/tabs/run-tab.js
  4. 2
      src/universal-dapp.js

@ -538,6 +538,12 @@ function run () {
getSource: (fileName) => { getSource: (fileName) => {
return compiler.getSource(fileName) return compiler.getSource(fileName)
}, },
editorContent: () => {
return editor.get(editor.current())
},
currentFile: () => {
return config.get('currentFile')
},
getContracts: () => { getContracts: () => {
return compiler.getContracts() return compiler.getContracts()
}, },

@ -31,8 +31,8 @@ module.exports = {
return ethJSABI.methodID(funABI.name, types) return ethJSABI.methodID(funABI.name, types)
}, },
sortAbiFunction: function (contract) { sortAbiFunction: function (contractabi) {
var abi = contract.abi.sort(function (a, b) { var abi = contractabi.sort(function (a, b) {
if (a.name > b.name) { if (a.name > b.name) {
return -1 return -1
} else { } else {

@ -1,3 +1,4 @@
/* global confirm */
'use strict' 'use strict'
var $ = require('jquery') var $ = require('jquery')
var yo = require('yo-yo') var yo = require('yo-yo')
@ -338,10 +339,16 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
function loadFromAddress (appAPI) { function loadFromAddress (appAPI) {
noInstancesText.style.display = 'none' noInstancesText.style.display = 'none'
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
var contract = appAPI.getContract(contractNames.children[contractNames.selectedIndex].innerHTML)
var address = atAddressButtonInput.value var address = atAddressButtonInput.value
if (/.(.abi)$/.exec(appAPI.currentFile())) {
if (confirm('Do you really want to interact with ' + address + ' using the current abi definition ?')) {
instanceContainer.appendChild(appAPI.udapp().renderInstance(appAPI.editorContent(), address, ' - '))
}
} else {
var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerText]
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract.object, address, selectContractNames.value)) instanceContainer.appendChild(appAPI.udapp().renderInstance(contract.object, address, selectContractNames.value))
} }
}
// GET NAMES OF ALL THE CONTRACTS // GET NAMES OF ALL THE CONTRACTS
function getContractNames (success, data) { function getContractNames (success, data) {

@ -305,7 +305,7 @@ UniversalDApp.prototype.renderInstance = function (contract, address, contractNa
$(instance).toggleClass(`${css.hidesub}`) $(instance).toggleClass(`${css.hidesub}`)
} }
var abi = txHelper.sortAbiFunction(contract) var abi = txHelper.sortAbiFunction(contractabi)
instance.appendChild(title) instance.appendChild(title)

Loading…
Cancel
Save