|
|
|
@ -63,19 +63,23 @@ UniversalDAppUI.prototype.renderInstance = function (contract, address, contract |
|
|
|
|
UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address, contractName) { |
|
|
|
|
var self = this |
|
|
|
|
address = (address.slice(0, 2) === '0x' ? '' : '0x') + address.toString('hex') |
|
|
|
|
var instance = yo`<div class="instance card ${css.instance} ${css.hidesub}" id="instance${address}"></div>` |
|
|
|
|
var instance = yo`<div class="instance ${css.instance} ${css.hidesub}" id="instance${address}"></div>` |
|
|
|
|
var context = self.udapp.context() |
|
|
|
|
|
|
|
|
|
var shortAddress = helper.shortenAddress(address) |
|
|
|
|
var title = yo` |
|
|
|
|
<div class="${css.title} alert alert-dark"> |
|
|
|
|
<button onclick="${(e) => { toggleClass(e) }}"><i class="fa fa-caret-right" aria-hidden="true"></i></button> |
|
|
|
|
<div class="${css.titleText}"> ${contractName} at ${shortAddress} (${context}) </div> |
|
|
|
|
${copyToClipboard(() => address)} |
|
|
|
|
<button class="btn btn-light ${css.titleExpander}" onclick="${(e) => { toggleClass(e) }}"><i class="fa fa-caret-right" aria-hidden="true"></i></button> |
|
|
|
|
<div class="input-group ${css.nameNbuts}"> |
|
|
|
|
<div class="${css.titleText} input-group-prepend"><span class="input-group-text"> ${contractName} at ${shortAddress} (${context})</span></div> |
|
|
|
|
<div class="btn-group"> |
|
|
|
|
<button class="btn btn-secondary">${copyToClipboard(() => address)}</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div>` |
|
|
|
|
|
|
|
|
|
var close = yo`<div class="${css.udappClose}" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></div>` |
|
|
|
|
title.appendChild(close) |
|
|
|
|
var close = yo`<button class="${css.udappClose} btn btn-secondary" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></button>` |
|
|
|
|
title.querySelector('.btn-group').appendChild(close) |
|
|
|
|
|
|
|
|
|
var contractActionsWrapper = yo` |
|
|
|
|
<div class="${css.cActionsWrapper}"> |
|
|
|
@ -94,11 +98,12 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
instance.appendChild(title) |
|
|
|
|
instance.appendChild(contractActionsWrapper) |
|
|
|
|
|
|
|
|
|
// Add the fallback function
|
|
|
|
|
var fallback = self.udapp.getFallbackInterface(contractABI) |
|
|
|
|
if (fallback) { |
|
|
|
|
instance.appendChild(this.getCallButton({ |
|
|
|
|
contractActionsWrapper.appendChild(this.getCallButton({ |
|
|
|
|
funABI: fallback, |
|
|
|
|
address: address, |
|
|
|
|
contractAbi: contractABI, |
|
|
|
@ -111,7 +116,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
// @todo getData cannot be used with overloaded functions
|
|
|
|
|
instance.appendChild(this.getCallButton({ |
|
|
|
|
contractActionsWrapper.appendChild(this.getCallButton({ |
|
|
|
|
funABI: funABI, |
|
|
|
|
address: address, |
|
|
|
|
contractAbi: contractABI, |
|
|
|
|