@@ -21,11 +21,15 @@ import {
21
21
RpcResponseAndContext ,
22
22
SendOptions ,
23
23
SignatureResult ,
24
+ SignaturesForAddressOptions ,
25
+ SignatureStatus ,
26
+ SignatureStatusConfig ,
24
27
SimulatedTransactionResponse ,
25
28
SimulateTransactionConfig ,
26
29
TokenAmount ,
27
30
TransactionResponse ,
28
31
TransactionSignature ,
32
+ VersionedMessage ,
29
33
VersionedTransaction ,
30
34
VersionedTransactionResponse ,
31
35
} from "@solana/web3.js" ;
@@ -300,4 +304,79 @@ export class CachedConnection implements SolendRPCConnection {
300
304
) )
301
305
) ;
302
306
}
307
+ async getSignatureStatus (
308
+ signature : TransactionSignature ,
309
+ config ?: SignatureStatusConfig
310
+ ) : Promise < RpcResponseAndContext < SignatureStatus | null > > {
311
+ const key = `getSignatureStatus_${ signature } _${ JSON . stringify ( config ) } ` ;
312
+ return (
313
+ ( await this . cache . get ( key ) ) ||
314
+ ( await this . cache . set (
315
+ key ,
316
+ this . connection . getSignatureStatus ( signature , config )
317
+ ) )
318
+ ) ;
319
+ }
320
+
321
+ async getSignatureStatuses (
322
+ signatures : Array < TransactionSignature > ,
323
+ config ?: SignatureStatusConfig
324
+ ) : Promise < RpcResponseAndContext < Array < SignatureStatus | null > > > {
325
+ const key = `getSignatureStatuses_${ signatures
326
+ . map ( ( sig ) => sig )
327
+ . join ( "_" ) } _${ JSON . stringify ( config ) } `;
328
+ return (
329
+ ( await this . cache . get ( key ) ) ||
330
+ ( await this . cache . set (
331
+ key ,
332
+ this . connection . getSignatureStatuses ( signatures , config )
333
+ ) )
334
+ ) ;
335
+ }
336
+
337
+ async getSignaturesForAddress (
338
+ address : PublicKey ,
339
+ options ?: SignaturesForAddressOptions ,
340
+ commitment ?: Finality
341
+ ) : Promise < Array < ConfirmedSignatureInfo > > {
342
+ const key = `getSignaturesForAddress_${ address . toBase58 ( ) } _${ JSON . stringify (
343
+ options
344
+ ) } _${ commitment } `;
345
+ return (
346
+ ( await this . cache . get ( key ) ) ||
347
+ ( await this . cache . set (
348
+ key ,
349
+ this . connection . getSignaturesForAddress ( address , options , commitment )
350
+ ) )
351
+ ) ;
352
+ }
353
+
354
+ async getBlocks (
355
+ startSlot : number ,
356
+ endSlot ?: number ,
357
+ commitment ?: Finality
358
+ ) : Promise < Array < number > > {
359
+ const key = `getBlocks_${ startSlot } _${ endSlot } _${ commitment } ` ;
360
+ return (
361
+ ( await this . cache . get ( key ) ) ||
362
+ ( await this . cache . set (
363
+ key ,
364
+ this . connection . getBlocks ( startSlot , endSlot , commitment )
365
+ ) )
366
+ ) ;
367
+ }
368
+
369
+ async getFeeForMessage (
370
+ message : VersionedMessage ,
371
+ commitment ?: Commitment
372
+ ) : Promise < RpcResponseAndContext < number | null > > {
373
+ const key = `getFeeForMessage_${ JSON . stringify ( message ) } _${ commitment } ` ;
374
+ return (
375
+ ( await this . cache . get ( key ) ) ||
376
+ ( await this . cache . set (
377
+ key ,
378
+ this . connection . getFeeForMessage ( message , commitment )
379
+ ) )
380
+ ) ;
381
+ }
303
382
}
0 commit comments