@@ -93,8 +93,6 @@ pub struct Config {
93
93
pub poll_interval_duration : Duration ,
94
94
/// Whether subscribing to account updates over websocket is enabled
95
95
pub subscriber_enabled : bool ,
96
- /// Configuration for account Subscriber
97
- pub subscriber : subscriber:: Config ,
98
96
/// Capacity of the channel over which the Subscriber sends updates to the Exporter
99
97
pub updates_channel_capacity : usize ,
100
98
}
@@ -105,7 +103,6 @@ impl Default for Config {
105
103
commitment : CommitmentLevel :: Confirmed ,
106
104
poll_interval_duration : Duration :: from_secs ( 30 ) ,
107
105
subscriber_enabled : true ,
108
- subscriber : Default :: default ( ) ,
109
106
updates_channel_capacity : 10000 ,
110
107
}
111
108
}
@@ -125,9 +122,9 @@ pub fn spawn_oracle(
125
122
let ( updates_tx, updates_rx) = mpsc:: channel ( config. updates_channel_capacity ) ;
126
123
if config. subscriber_enabled {
127
124
let subscriber = Subscriber :: new (
128
- config. subscriber . clone ( ) ,
129
125
rpc_url. to_string ( ) ,
130
126
wss_url. to_string ( ) ,
127
+ config. commitment ,
131
128
key_store. program_key . clone ( ) ,
132
129
updates_tx,
133
130
logger. clone ( ) ,
@@ -450,10 +447,6 @@ mod subscriber {
450
447
anyhow,
451
448
Result ,
452
449
} ,
453
- serde:: {
454
- Deserialize ,
455
- Serialize ,
456
- } ,
457
450
slog:: Logger ,
458
451
solana_sdk:: {
459
452
account:: Account ,
@@ -470,30 +463,16 @@ mod subscriber {
470
463
} ,
471
464
} ;
472
465
473
- #[ derive( Clone , Serialize , Deserialize , Debug ) ]
474
- #[ serde( default ) ]
475
- pub struct Config {
476
- /// Commitment level used to read account data
477
- pub commitment : CommitmentLevel ,
478
- }
479
-
480
- impl Default for Config {
481
- fn default ( ) -> Self {
482
- Self {
483
- commitment : CommitmentLevel :: Confirmed ,
484
- }
485
- }
486
- }
487
-
488
466
/// Subscriber subscribes to all changes on the given account, and sends those changes
489
467
/// on updates_tx. This is a convenience wrapper around the Blockchain Shadow crate.
490
468
pub struct Subscriber {
491
- config : Config ,
492
-
493
469
/// HTTP RPC endpoint
494
- pub rpc_url : String ,
470
+ rpc_url : String ,
495
471
/// WSS RPC endpoint
496
- pub wss_url : String ,
472
+ wss_url : String ,
473
+
474
+ /// Commitment level used to read account data
475
+ commitment : CommitmentLevel ,
497
476
498
477
/// Public key of the root account to monitor. Note that all
499
478
/// accounts owned by this account are also monitored.
@@ -507,17 +486,17 @@ mod subscriber {
507
486
508
487
impl Subscriber {
509
488
pub fn new (
510
- config : Config ,
511
489
rpc_url : String ,
512
490
wss_url : String ,
491
+ commitment : CommitmentLevel ,
513
492
account_key : Pubkey ,
514
493
updates_tx : mpsc:: Sender < ( Pubkey , solana_sdk:: account:: Account ) > ,
515
494
logger : Logger ,
516
495
) -> Self {
517
496
Subscriber {
518
- config,
519
497
rpc_url,
520
498
wss_url,
499
+ commitment,
521
500
account_key,
522
501
updates_tx,
523
502
logger,
@@ -559,7 +538,7 @@ mod subscriber {
559
538
self . rpc_url . clone ( ) ,
560
539
self . wss_url . clone ( ) ,
561
540
) ,
562
- commitment : self . config . commitment ,
541
+ commitment : self . commitment ,
563
542
..SyncOptions :: default ( )
564
543
} ,
565
544
)
0 commit comments