|
|
|
@ -115,8 +115,25 @@ export function UniversalDappUI(props: UdappProps) { |
|
|
|
|
props.removeInstance(props.index) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const saveContract = () => { |
|
|
|
|
console.log('save is clicked') |
|
|
|
|
const saveContract = async() => { |
|
|
|
|
const address = ethJSUtil.toChecksumAddress(props.instance.address) |
|
|
|
|
const env = await props.plugin.call('blockchain', 'getProvider') |
|
|
|
|
const {network} = await props.plugin.call('blockchain', 'getCurrentNetworkStatus') |
|
|
|
|
const contractToSave = {name: props.instance.contractData.name, address, abi: props.instance.contractData.abi, networkName: network.name} |
|
|
|
|
let savedContracts = localStorage.getItem('savedContracts') |
|
|
|
|
let objToSave = JSON.parse(savedContracts) |
|
|
|
|
if (!objToSave) { |
|
|
|
|
objToSave = {} |
|
|
|
|
objToSave[env] = {} |
|
|
|
|
objToSave[env][network.id] = [] |
|
|
|
|
} else if (!objToSave[env]) { |
|
|
|
|
objToSave[env] = {} |
|
|
|
|
objToSave[env][network.id] = [] |
|
|
|
|
} else if (!objToSave[env][network.id]) { |
|
|
|
|
objToSave[env][network.id] = [] |
|
|
|
|
} |
|
|
|
|
objToSave[env][network.id].push(contractToSave) |
|
|
|
|
localStorage.setItem('savedContracts', JSON.stringify(objToSave)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const runTransaction = (lookupOnly, funcABI: FuncABI, valArr, inputsValues, funcIndex?: number) => { |
|
|
|
|