|
|
|
@ -117,9 +117,8 @@ export function UniversalDappUI(props: UdappProps) { |
|
|
|
|
const {network} = await props.plugin.call('blockchain', 'getCurrentNetworkStatus') |
|
|
|
|
const savedContracts = localStorage.getItem('savedContracts') |
|
|
|
|
const savedContractsJson = JSON.parse(savedContracts) |
|
|
|
|
const instanceIndex = savedContractsJson[env][network.id].findIndex(instance => instance.address === props.instance.address) |
|
|
|
|
const instanceIndex = savedContractsJson[env][network.id].findIndex(instance => instance && instance.address === props.instance.address) |
|
|
|
|
delete savedContractsJson[env][network.id][instanceIndex] |
|
|
|
|
savedContractsJson[env][network.id].filter(Boolean) // To remove null entries
|
|
|
|
|
localStorage.setItem('savedContracts', JSON.stringify(savedContractsJson)) |
|
|
|
|
} |
|
|
|
|
props.removeInstance(props.index, props.isSavedContract) |
|
|
|
@ -145,6 +144,10 @@ export function UniversalDappUI(props: UdappProps) { |
|
|
|
|
} |
|
|
|
|
objToSave[env][network.id].push(props.instance) |
|
|
|
|
localStorage.setItem('savedContracts', JSON.stringify(objToSave)) |
|
|
|
|
// Add contract to saved contracts list on UI
|
|
|
|
|
await props.plugin.call('udapp', 'addSavedInstance', props.instance.address, props.instance.contractData.abi, props.instance.name) |
|
|
|
|
// Remove contract from deployed contracts list on UI
|
|
|
|
|
props.removeInstance(props.index, false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const runTransaction = (lookupOnly, funcABI: FuncABI, valArr, inputsValues, funcIndex?: number) => { |
|
|
|
|