diff --git a/index.html b/index.html index 1b81dbe..34e4342 100644 --- a/index.html +++ b/index.html @@ -2852,17 +2852,23 @@ } function filterSmartContracts(options) { - const { type, subType, dynamic = false } = options || {} - let filteredSmartContracts = (floGlobals.smartContracts || []) - .filter(sc => sc.status === 'active') + const { type, subType, dynamic = false } = options || {}; + let filteredSmartContracts = floGlobals.smartContracts || []; if (type) { - filteredSmartContracts = filteredSmartContracts.filter(sc => sc.contractType === type) - if (type === 'continuos-event' && dynamic) - filteredSmartContracts = filteredSmartContracts.filter(sc => sc.oracle_address) + filteredSmartContracts = filteredSmartContracts.filter(sc => { + if (type === 'external-trigger') { + return sc.status !== 'active'; // only inactive contracts can be triggered externally + } else if (type === 'continuos-event' && dynamic) { + return sc.status === 'active' && sc.contractType === type && sc.oracle_address; + } else { + return sc.status === 'active' && sc.contractType === type; + } + }); } - if (subType) - filteredSmartContracts = filteredSmartContracts.filter(sc => sc.contractSubType === subType) - return filteredSmartContracts + if (subType) { + filteredSmartContracts = filteredSmartContracts.filter(sc => sc.contractSubType === subType); + } + return filteredSmartContracts; } function handleSmartContractSelection(actionType) {