import fs from 'fs' ; import { w3cwebsocket as WebSocket } from 'websocket' ; const main = ( ) : void => { const endpoint = 'wss://karura-rpc-0.aca-api.network' ; console . log ( 'Connecting to ' , endpoint ) ; const ws = new WebSocket ( endpoint ) ; ws . onopen = ( ) : void => { ws . send ( '{"id":"1","jsonrpc":"2.0","method":"state_getMetadata","params":[]}' ) ; } ; ws . onmessage = ( msg ) : void => { const metadata = JSON . parse ( msg . data ) . result ; fs . writeFileSync ( 'packages/types/src/metadata/static-latest.ts' , `export default '${ metadata }'` ) ; console . log ( 'Done' ) ; process . exit ( 0 ) ; } ; } ; main ( ) ;