@@ -3,7 +3,7 @@ import { etherscanUrl, formatBN } from "@gearbox-protocol/sdk";
33import type { OptimisticResult } from "@gearbox-protocol/types/optimist" ;
44import type { Markdown } from "@vlad-yakovlev/telegram-md" ;
55import { md } from "@vlad-yakovlev/telegram-md" ;
6- import type { Address , TransactionReceipt } from "viem" ;
6+ import type { Address , BaseError , TransactionReceipt } from "viem" ;
77
88import type { Config } from "../../config/index.js" ;
99import { DI } from "../../di.js" ;
@@ -320,6 +320,80 @@ Error: ${md.inlineCode(this.#error)}`,
320320 }
321321}
322322
323+ export class ProviderRotationSuccessMessage
324+ extends BaseMessage
325+ implements INotifierMessage
326+ {
327+ #oldT: string ;
328+ #newT: string ;
329+ #reason: string ;
330+
331+ constructor ( oldT : string , newT : string , reason ?: BaseError ) {
332+ super ( { } ) ;
333+ this . #oldT = oldT ;
334+ this . #newT = newT ;
335+ this . #reason = reason ? `: ${ reason . shortMessage } ${ reason . details } ` : "" ;
336+ }
337+
338+ public get plain ( ) : string {
339+ return `[${ this . network } ] rotated rpc provider from ${ this . #oldT} to ${ this . #newT} ${ this . #reason} ` ;
340+ }
341+
342+ public get markdown ( ) : string {
343+ return md . build (
344+ md `[${ this . network } ] rotated rpc provider from ${ md . bold ( this . #oldT) } to ${ md . bold ( this . #newT) } ${ this . #reason} ` ,
345+ ) ;
346+ }
347+ }
348+
349+ export class ProviderRotationErrorMessage
350+ extends BaseMessage
351+ implements INotifierMessage
352+ {
353+ #oldT: string ;
354+ #reason: string ;
355+
356+ constructor ( oldT : string , reason ?: BaseError ) {
357+ super ( { } ) ;
358+ this . #oldT = oldT ;
359+ this . #reason = reason ? `: ${ reason . shortMessage } ${ reason . details } ` : "" ;
360+ }
361+
362+ public get plain ( ) : string {
363+ return `[${ this . network } ] failed to rotate rpc provider from ${ this . #oldT} ${ this . #reason} ` ;
364+ }
365+
366+ public get markdown ( ) : string {
367+ return md . build (
368+ md `[${ this . network } ] failed to rotate rpc provider from ${ md . bold ( this . #oldT) } ${ this . #reason} ` ,
369+ ) ;
370+ }
371+ }
372+
373+ export class ZeroHFAccountsMessage
374+ extends BaseMessage
375+ implements INotifierMessage
376+ {
377+ #count: number ;
378+ #badTokens: string ;
379+
380+ constructor ( count : number , badTokens : string ) {
381+ super ( { } ) ;
382+ this . #count = count ;
383+ this . #badTokens = badTokens ;
384+ }
385+
386+ public get plain ( ) : string {
387+ return `[${ this . network } ] found ${ this . #count} accounts with HF=0, bad tokens: ${ this . #badTokens} ` ;
388+ }
389+
390+ public get markdown ( ) : string {
391+ return md . build (
392+ md `[${ this . network } ] found ${ this . #count} accounts with HF=0, bad tokens: ${ this . #badTokens} ` ,
393+ ) ;
394+ }
395+ }
396+
323397function callsPlain ( calls ?: string [ ] ) : string {
324398 return calls ? calls . map ( c => ` ➤ ${ c } ` ) . join ( "\n" ) : "-" ;
325399}
0 commit comments