|
|
@ -55,7 +55,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { |
|
|
|
|
|
|
|
|
|
|
|
// PENDING transactions
|
|
|
|
// PENDING transactions
|
|
|
|
function updatePendingTxs (container, appAPI) { |
|
|
|
function updatePendingTxs (container, appAPI) { |
|
|
|
var pendingCount = Object.keys(appAPI.udapp().pendingTransactions()).length |
|
|
|
var pendingCount = Object.keys(opts.udapp.pendingTransactions()).length |
|
|
|
pendingTxsText.innerText = pendingCount + ' pending transactions' |
|
|
|
pendingTxsText.innerText = pendingCount + ' pending transactions' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { |
|
|
|
executionContext.event.register('contextChanged', (context, silent) => { |
|
|
|
executionContext.event.register('contextChanged', (context, silent) => { |
|
|
|
setFinalContext() |
|
|
|
setFinalContext() |
|
|
|
}) |
|
|
|
}) |
|
|
|
fillAccountsList(appAPI, el) |
|
|
|
fillAccountsList(appAPI, opts, el) |
|
|
|
setInterval(() => { |
|
|
|
setInterval(() => { |
|
|
|
updateAccountBalances(container, appAPI) |
|
|
|
updateAccountBalances(container, appAPI) |
|
|
|
updatePendingTxs(container, appAPI) |
|
|
|
updatePendingTxs(container, appAPI) |
|
|
@ -104,10 +104,10 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) { |
|
|
|
return { render () { return container } } |
|
|
|
return { render () { return container } } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function fillAccountsList (appAPI, container) { |
|
|
|
function fillAccountsList (appAPI, opts, container) { |
|
|
|
var $txOrigin = $(container.querySelector('#txorigin')) |
|
|
|
var $txOrigin = $(container.querySelector('#txorigin')) |
|
|
|
$txOrigin.empty() |
|
|
|
$txOrigin.empty() |
|
|
|
appAPI.udapp().getAccounts((err, accounts) => { |
|
|
|
opts.udapp.getAccounts((err, accounts) => { |
|
|
|
if (err) { addTooltip(`Cannot get account list: ${err}`) } |
|
|
|
if (err) { addTooltip(`Cannot get account list: ${err}`) } |
|
|
|
if (accounts && accounts[0]) { |
|
|
|
if (accounts && accounts[0]) { |
|
|
|
for (var a in accounts) { $txOrigin.append($('<option />').val(accounts[a]).text(accounts[a])) } |
|
|
|
for (var a in accounts) { $txOrigin.append($('<option />').val(accounts[a]).text(accounts[a])) } |
|
|
@ -190,8 +190,8 @@ function makeRecorder (events, appAPI, appEvents, opts) { |
|
|
|
} |
|
|
|
} |
|
|
|
if (txArray.length) { |
|
|
|
if (txArray.length) { |
|
|
|
noInstancesText.style.display = 'none' |
|
|
|
noInstancesText.style.display = 'none' |
|
|
|
recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { |
|
|
|
recorder.run(txArray, accounts, options, abis, linkReferences, opts.udapp, (abi, address, contractName) => { |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, contractName)) |
|
|
|
instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, contractName)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -284,7 +284,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) { |
|
|
|
txFormat.buildData(selectedContract.name, selectedContract.contract.object, opts.compiler.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) => { |
|
|
|
opts.udapp.createContract(data, (error, txResult) => { |
|
|
|
if (!error) { |
|
|
|
if (!error) { |
|
|
|
var isVM = executionContext.isVM() |
|
|
|
var isVM = executionContext.isVM() |
|
|
|
if (isVM) { |
|
|
|
if (isVM) { |
|
|
@ -296,7 +296,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) { |
|
|
|
} |
|
|
|
} |
|
|
|
noInstancesText.style.display = 'none' |
|
|
|
noInstancesText.style.display = 'none' |
|
|
|
var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress |
|
|
|
var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstance(selectedContract.contract.object, address, selectContractNames.value)) |
|
|
|
instanceContainer.appendChild(opts.udappUI.renderInstance(selectedContract.contract.object, address, selectContractNames.value)) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error) |
|
|
|
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error) |
|
|
|
} |
|
|
|
} |
|
|
@ -308,7 +308,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) { |
|
|
|
appAPI.logMessage(msg) |
|
|
|
appAPI.logMessage(msg) |
|
|
|
}, (data, runTxCallback) => { |
|
|
|
}, (data, runTxCallback) => { |
|
|
|
// called for libraries deployment
|
|
|
|
// called for libraries deployment
|
|
|
|
appAPI.udapp().runTx(data, runTxCallback) |
|
|
|
opts.udapp.runTx(data, runTxCallback) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -330,11 +330,11 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) { |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
return modalDialogCustom.alert('Failed to parse the current file as JSON ABI.') |
|
|
|
return modalDialogCustom.alert('Failed to parse the current file as JSON ABI.') |
|
|
|
} |
|
|
|
} |
|
|
|
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, address)) |
|
|
|
instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, address)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var contract = opts.compiler.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(opts.udappUI.renderInstance(contract.object, address, selectContractNames.value)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|