import { AppABIEncodings , AppInstanceJson } from "./app" ; import { Address , BigNumber , Bytes32 , AssetId , PublicIdentifier , SolidityValueType , HexString , } from "./basic" ; import { OutcomeType } from "./contracts" ; import { enumify } from "./utils" ; type InstallProtocolParams = { initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; proposal : AppInstanceJson ; multisigAddress : Address ; protocolMeta ? : any ; } ; type ProposeProtocolParams = { multisigAddress : Address ; initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; appDefinition : Address ; abiEncodings : AppABIEncodings ; initiatorDeposit : BigNumber ; initiatorDepositAssetId : AssetId ; responderDeposit : BigNumber ; responderDepositAssetId : AssetId ; defaultTimeout : BigNumber ; stateTimeout : BigNumber ; initialState : SolidityValueType ; outcomeType : OutcomeType ; meta ? : any ; protocolMeta ? : any ; } ; type SetupProtocolParams = { initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; multisigAddress : Address ; chainId : number ; protocolMeta ? : any ; } ; type SyncProtocolParams = { initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; multisigAddress : Address ; appIdentityHash : HexString | undefined ; protocolMeta ? : any ; } ; type TakeActionProtocolParams = { initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; multisigAddress : Address ; appIdentityHash : Address ; action : SolidityValueType ; stateTimeout : BigNumber ; protocolMeta ? : any ; } ; type UninstallProtocolParams = { appIdentityHash : Bytes32 ; initiatorIdentifier : PublicIdentifier ; responderIdentifier : PublicIdentifier ; multisigAddress : Address ; blockNumberToUseIfNecessary ? : number ; action ? : SolidityValueType ; stateTimeout ? : BigNumber ; protocolMeta ? : any ; } ; export enum Opcode { IO_SEND , IO_SEND_AND_WAIT , OP_SIGN , PERSIST_APP_INSTANCE , PERSIST_STATE_CHANNEL , OP_VALIDATE } export const ProtocolNames = enumify ( { install : "install" , propose : "propose" , setup : "setup" , sync : "sync" , takeAction : "takeAction" , uninstall : "uninstall" , } ) ; export type ProtocolNames = typeof ProtocolNames [ keyof typeof ProtocolNames ] ; export type ProtocolName = keyof typeof ProtocolNames ; export namespace ProtocolParams { export type Install = InstallProtocolParams ; export type Propose = ProposeProtocolParams ; export type Setup = SetupProtocolParams ; export type Sync = SyncProtocolParams ; export type TakeAction = TakeActionProtocolParams ; export type Uninstall = UninstallProtocolParams ; } export type ProtocolParam = InstallProtocolParams | ProposeProtocolParams | SetupProtocolParams | TakeActionProtocolParams | UninstallProtocolParams ;