remove getContract && getContracts

pull/1/head
yann300 7 years ago
parent 980bab63de
commit 207700fad4
  1. 6
      src/app.js
  2. 18
      src/app/tabs/run-tab.js
  3. 4
      src/recorder.js

@ -713,12 +713,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
currentFile: () => {
return config.get('currentFile')
},
getContracts: () => {
return compiler.getContracts()
},
getContract: (name) => {
return compiler.getContract(name)
},
visitContracts: (cb) => {
compiler.visitContracts(cb)
},

@ -30,7 +30,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
clearInstanceElement.addEventListener('click', () => {
event.trigger('clearInstance', [])
})
var recorderInterface = makeRecorder(event, appAPI, appEvents)
var recorderInterface = makeRecorder(event, appAPI, appEvents, opts)
var pendingTxsContainer = yo`
<div class="${css.pendingTxsContainer}">
<div class="${css.pendingTxsText}">
@ -46,7 +46,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
var el = yo`
<div>
${settings(container, appAPI, appEvents, opts)}
${contractDropdown(event, appAPI, appEvents, instanceContainer)}
${contractDropdown(event, appAPI, appEvents, opts, instanceContainer)}
${pendingTxsContainer}
${instanceContainer}
</div>
@ -134,8 +134,8 @@ function updateAccountBalances (container, appAPI) {
/* ------------------------------------------------
RECORDER
------------------------------------------------ */
function makeRecorder (events, appAPI, appEvents) {
var recorder = new Recorder({
function makeRecorder (events, appAPI, appEvents, opts) {
var recorder = new Recorder(opts.compiler, {
events: {
udapp: appEvents.udapp,
executioncontext: executionContext.event,
@ -206,7 +206,7 @@ function makeRecorder (events, appAPI, appEvents) {
section CONTRACT DROPDOWN and BUTTONS
------------------------------------------------ */
function contractDropdown (events, appAPI, appEvents, instanceContainer) {
function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) {
instanceContainer.appendChild(noInstancesText)
var compFails = yo`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-times-circle ${css.errorIcon}" ></i>`
appEvents.compiler.register('compilationFinished', function (success, data, source) {
@ -229,7 +229,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
if (contractName) {
return {
name: contractName,
contract: appAPI.getContract(contractName)
contract: opts.compiler.getContract(contractName)
}
}
return null
@ -256,7 +256,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
function setInputParamsPlaceHolder () {
createButtonInput.value = ''
if (appAPI.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) {
if (opts.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) {
var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi)
if (ctrabi.inputs.length) {
createButtonInput.setAttribute('placeholder', txHelper.inputParametersDeclarationToString(ctrabi.inputs))
@ -281,7 +281,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
var constructor = txHelper.getConstructorInterface(selectedContract.contract.object.abi)
var args = createButtonInput.value
txFormat.buildData(selectedContract.name, selectedContract.contract.object, appAPI.getContracts(), true, constructor, args, (error, data) => {
txFormat.buildData(selectedContract.name, selectedContract.contract.object, opts.compiler.getContracts(), true, constructor, args, (error, data) => {
if (!error) {
appAPI.logMessage(`creation of ${selectedContract.name} pending...`)
appAPI.udapp().createContract(data, (error, txResult) => {
@ -333,7 +333,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, address))
})
} else {
var contract = appAPI.getContract(contractNames.children[contractNames.selectedIndex].innerHTML)
var contract = opts.compiler.getContract(contractNames.children[contractNames.selectedIndex].innerHTML)
instanceContainer.appendChild(appAPI.udappUI().renderInstance(contract.object, address, selectContractNames.value))
}
}

@ -13,7 +13,7 @@ var modal = require('./app/ui/modal-dialog-custom')
*
*/
class Recorder {
constructor (opts = {}) {
constructor (compiler, opts = {}) {
var self = this
self._api = opts.api
self.event = new EventManager()
@ -33,7 +33,7 @@ class Recorder {
if (this.data._listen) {
var record = { value, parameters: payLoad.funArgs }
if (!to) {
var selectedContract = self._api.getContract(payLoad.contractName)
var selectedContract = compiler.getContract(payLoad.contractName)
if (selectedContract) {
var abi = selectedContract.object.abi
var sha3 = ethutil.bufferToHex(ethutil.sha3(abi))

Loading…
Cancel
Save