Optional
checkHow often to check for changes. 10 minutes by default.
Optional
log?: ((msg) => void)Optional function to log the output.
Optional
metadata?: { Options to restart upon metadata version change.
Optional
runtime?: { Options to restart upon runtime hash change.
A function to stop and cleanup the restarter.
runtimeRestarter({
metadata: {
getMetadataVersion: async () => (await api.rpc.state.getMetadata()).version.toString(),
onMetadataChange: () => process.exit(1),
},
runtime: {
getRuntimeVersionHash: async () => (await api.rpc.state.getRuntimeVersion()).hash.toString(),
onRuntimeChange: () => process.exit(1),
}
log: (msg) => console.log(msg)
})
A helper function that checks the metadata version / runtime version in intervals. If a change is detected, an appropriate callback is executed.