add renderInstanceFromABI

pull/1/head
yann300 7 years ago
parent 187145ea25
commit 53d897f99b
  1. 12
      src/universal-dapp.js

@ -277,7 +277,7 @@ UniversalDApp.prototype.getBalance = function (address, cb) {
} }
UniversalDApp.prototype.renderInstance = function (contract, address, contractName) { UniversalDApp.prototype.renderInstance = function (contract, address, contractName) {
var abi = txHelper.sortAbiFunction(contract.abi) var abi = txHelper.sortAbiFunction(contract)
return this.renderInstanceFromABI(abi, address, contractName) return this.renderInstanceFromABI(abi, address, contractName)
} }
@ -309,22 +309,20 @@ UniversalDApp.prototype.renderInstanceFromABI = function (contractABI, address,
$(instance).toggleClass(`${css.hidesub}`) $(instance).toggleClass(`${css.hidesub}`)
} }
var abi = txHelper.sortAbiFunction(contractABI)
instance.appendChild(title) instance.appendChild(title)
// Add the fallback function // Add the fallback function
var fallback = txHelper.getFallbackInterface(abi) var fallback = txHelper.getFallbackInterface(contractABI)
if (fallback) { if (fallback) {
instance.appendChild(this.getCallButton({ instance.appendChild(this.getCallButton({
funABI: fallback, funABI: fallback,
address: address, address: address,
contractAbi: abi, contractAbi: contractABI,
contractName: contractName contractName: contractName
})) }))
} }
$.each(abi, (i, funABI) => { $.each(contractABI, (i, funABI) => {
if (funABI.type !== 'function') { if (funABI.type !== 'function') {
return return
} }
@ -332,7 +330,7 @@ UniversalDApp.prototype.renderInstanceFromABI = function (contractABI, address,
instance.appendChild(this.getCallButton({ instance.appendChild(this.getCallButton({
funABI: funABI, funABI: funABI,
address: address, address: address,
contractAbi: abi, contractAbi: contractABI,
contractName: contractName contractName: contractName
})) }))
}) })

Loading…
Cancel
Save