Learning to Use Monitor Builder: Builder and Data Type
Monitor.builder (source
// Dialect SDK is configured and must be supplied// below in builder propsconstenvironment:DialectCloudEnvironment='development';constdialectSolanaSdk:DialectSdk<Solana> =Dialect.sdk( { environment, },SolanaSdkFactory.create({// IMPORTANT: must set environment variable DIALECT_SDK_CREDENTIALS// to your dapp's Solana messaging wallet keypair e.g. [170,23, . . . ,300] wallet:NodeDialectSolanaWalletAdapter.create(), }),);// Define a data type to monitortypeYourDataType= { cratio:number; healthRatio:number; resourceId:ResourceId;};// Build a Monitor to detect and deliver notificationsconstmonitor:Monitor<YourDataType> =Monitors.builder({ sdk: dialectSolanaSdk, subscribersCacheTTL:Duration.fromObject({ seconds:5 }),})// Configure data source type.defineDataSource<YourDataType>()