import { read , save } from '../execute/save' ; export type MultisigState = Unknown | Proposed | Executed ; export type Unknown = { kind : 'UNKNOWN' ; } ; export type Proposed = { kind : 'PROPOSED' ; } ; export type Executed = { kind : 'EXECUTED' ; txHash : string ; } ; /**
 * A multisig section in deployments file
 */ interface SavedMultisigSection { [ name ] : SavedMultisigEntry ; } /**
 * A single entry in the multisig section of deployments file
 */ export interface SavedMultisigEntry { id : string ; state : string ; txHash ? : string ; } const multisigDeploymentFileSection = '_multisig' ; function readMultisigSection ( file , network ) { const allMultisigsSection = read < SavedMultisigSection > ( file , network , multisigDeploymentFileSection ) ; if ( ! allMultisigsSection ) return undefined ; else return allMultisigsSection ; } export function readSavedMultisig ( file , network , multisigName ) { const allMultisigsSection = readMultisigSection ( file , network ) ; return allMultisigsSection ? allMultisigsSection [ multisigName ] : undefined ; } export function saveMultisig ( file , network , name , entry ) { const allMultisigsSection = readMultisigSection ( file , network ) ?? { } ; allMultisigsSection [ name ] = entry ; save ( file , network , multisigDeploymentFileSection , allMultisigsSection ) ; }