|
|
@ -30,7 +30,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { |
|
|
|
clearInstanceElement.addEventListener('click', () => { |
|
|
|
clearInstanceElement.addEventListener('click', () => { |
|
|
|
event.trigger('clearInstance', []) |
|
|
|
event.trigger('clearInstance', []) |
|
|
|
}) |
|
|
|
}) |
|
|
|
var recorderInterface = makeRecorder(event, appAPI, appEvents) |
|
|
|
var recorderInterface = makeRecorder(event, appAPI, appEvents, opts) |
|
|
|
var pendingTxsContainer = yo` |
|
|
|
var pendingTxsContainer = yo` |
|
|
|
<div class="${css.pendingTxsContainer}"> |
|
|
|
<div class="${css.pendingTxsContainer}"> |
|
|
|
<div class="${css.pendingTxsText}"> |
|
|
|
<div class="${css.pendingTxsText}"> |
|
|
@ -46,7 +46,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { |
|
|
|
var el = yo` |
|
|
|
var el = yo` |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
${settings(container, appAPI, appEvents, opts)} |
|
|
|
${settings(container, appAPI, appEvents, opts)} |
|
|
|
${contractDropdown(event, appAPI, appEvents, instanceContainer)} |
|
|
|
${contractDropdown(event, appAPI, appEvents, opts, instanceContainer)} |
|
|
|
${pendingTxsContainer} |
|
|
|
${pendingTxsContainer} |
|
|
|
${instanceContainer} |
|
|
|
${instanceContainer} |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -134,8 +134,8 @@ function updateAccountBalances (container, appAPI) { |
|
|
|
/* ------------------------------------------------ |
|
|
|
/* ------------------------------------------------ |
|
|
|
RECORDER |
|
|
|
RECORDER |
|
|
|
------------------------------------------------ */ |
|
|
|
------------------------------------------------ */ |
|
|
|
function makeRecorder (events, appAPI, appEvents) { |
|
|
|
function makeRecorder (events, appAPI, appEvents, opts) { |
|
|
|
var recorder = new Recorder({ |
|
|
|
var recorder = new Recorder(opts.compiler, { |
|
|
|
events: { |
|
|
|
events: { |
|
|
|
udapp: appEvents.udapp, |
|
|
|
udapp: appEvents.udapp, |
|
|
|
executioncontext: executionContext.event, |
|
|
|
executioncontext: executionContext.event, |
|
|
@ -206,7 +206,7 @@ function makeRecorder (events, appAPI, appEvents) { |
|
|
|
section CONTRACT DROPDOWN and BUTTONS |
|
|
|
section CONTRACT DROPDOWN and BUTTONS |
|
|
|
------------------------------------------------ */ |
|
|
|
------------------------------------------------ */ |
|
|
|
|
|
|
|
|
|
|
|
function contractDropdown (events, appAPI, appEvents, instanceContainer) { |
|
|
|
function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) { |
|
|
|
instanceContainer.appendChild(noInstancesText) |
|
|
|
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>` |
|
|
|
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) { |
|
|
|
appEvents.compiler.register('compilationFinished', function (success, data, source) { |
|
|
@ -229,7 +229,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) { |
|
|
|
if (contractName) { |
|
|
|
if (contractName) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
name: contractName, |
|
|
|
name: contractName, |
|
|
|
contract: appAPI.getContract(contractName) |
|
|
|
contract: opts.compiler.getContract(contractName) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
return null |
|
|
@ -256,7 +256,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) { |
|
|
|
|
|
|
|
|
|
|
|
function setInputParamsPlaceHolder () { |
|
|
|
function setInputParamsPlaceHolder () { |
|
|
|
createButtonInput.value = '' |
|
|
|
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) |
|
|
|
var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi) |
|
|
|
if (ctrabi.inputs.length) { |
|
|
|
if (ctrabi.inputs.length) { |
|
|
|
createButtonInput.setAttribute('placeholder', txHelper.inputParametersDeclarationToString(ctrabi.inputs)) |
|
|
|
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 constructor = txHelper.getConstructorInterface(selectedContract.contract.object.abi) |
|
|
|
var args = createButtonInput.value |
|
|
|
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) { |
|
|
|
if (!error) { |
|
|
|
appAPI.logMessage(`creation of ${selectedContract.name} pending...`) |
|
|
|
appAPI.logMessage(`creation of ${selectedContract.name} pending...`) |
|
|
|
appAPI.udapp().createContract(data, (error, txResult) => { |
|
|
|
appAPI.udapp().createContract(data, (error, txResult) => { |
|
|
@ -333,7 +333,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) { |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, address)) |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, address)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} 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)) |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstance(contract.object, address, selectContractNames.value)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|