import { DefaultFlavor , FilecoinFlavorName } from "@ganache/flavors" ; import { Definitions } from "@ganache/options" ; export type ServerConfig = { options : { defaultValue readonly ws : { type : boolean ; hasDefault : true ; legacy : { deprecated ws : boolean ; } ; } ; defaultValue readonly wsBinary : { type : boolean | "auto" ; hasDefault : true ; } ; defaultValue readonly rpcEndpoint : { type : string ; hasDefault : true ; } ; } ; } ; const normalize = < T > ( rawInput ) => rawInput ; export const ServerOptions = { ws : { normalize , cliDescription : "Enable a websocket server." , default : ( ) => true , legacyName : "ws" , cliType : "boolean" } , wsBinary : { normalize , cliDescription : "Whether or not websockets should response with binary data (ArrayBuffers) or strings." , default : ( ) => "auto" , cliChoices : [ "true" , "false" , "auto" ] as any [ ] } , rpcEndpoint : { normalize , cliDescription : "Defines the endpoint route the HTTP and WebSocket servers will listen on." , default : ( config , flavor ) => { switch ( flavor ) { case FilecoinFlavorName : return "/rpc/v0" ; case DefaultFlavor : default : return "/" ; } } , defaultDescription : '"/" (Ethereum), "/rpc/v0" (Filecoin)' } } ;