1- use crate :: {
2- quincey:: Quincey ,
3- signer:: { LocalOrAws , SignerError } ,
4- tasks:: oauth:: { Authenticator , SharedToken } ,
5- } ;
1+ use crate :: quincey:: Quincey ;
62use alloy:: {
73 network:: { Ethereum , EthereumWallet } ,
84 primitives:: Address ,
@@ -15,8 +11,14 @@ use alloy::{
1511 } ,
1612} ;
1713use eyre:: Result ;
18- use init4_bin_base:: utils:: { calc:: SlotCalculator , from_env:: FromEnv } ;
19- use oauth2:: url;
14+ use init4_bin_base:: {
15+ perms:: { Authenticator , OAuthConfig , SharedToken } ,
16+ utils:: {
17+ calc:: SlotCalculator ,
18+ from_env:: FromEnv ,
19+ signer:: { LocalOrAws , SignerError } ,
20+ } ,
21+ } ;
2022use signet_zenith:: Zenith ;
2123use std:: borrow:: Cow ;
2224
@@ -41,7 +43,7 @@ pub type HostProvider = FillProvider<
4143
4244/// Configuration for a builder running a specific rollup on a specific host
4345/// chain.
44- #[ derive( serde :: Deserialize , Debug , Clone , FromEnv ) ]
46+ #[ derive( Debug , Clone , FromEnv ) ]
4547pub struct BuilderConfig {
4648 /// The chain ID of the host chain
4749 #[ from_env( var = "HOST_CHAIN_ID" , desc = "The chain ID of the host chain" ) ]
@@ -129,30 +131,10 @@ pub struct BuilderConfig {
129131 desc = "Duration in seconds transactions can live in the tx-pool cache"
130132 ) ]
131133 pub tx_pool_cache_duration : u64 ,
132- /// OAuth client ID for the builder.
133- #[ from_env( var = "OAUTH_CLIENT_ID" , desc = "OAuth client ID for the builder" ) ]
134- pub oauth_client_id : String ,
135- /// OAuth client secret for the builder.
136- #[ from_env( var = "OAUTH_CLIENT_SECRET" , desc = "OAuth client secret for the builder" ) ]
137- pub oauth_client_secret : String ,
138- /// OAuth authenticate URL for the builder for performing OAuth logins.
139- #[ from_env(
140- var = "OAUTH_AUTHENTICATE_URL" ,
141- desc = "OAuth authenticate URL for the builder for performing OAuth logins"
142- ) ]
143- pub oauth_authenticate_url : String ,
144- /// OAuth token URL for the builder to get an OAuth2 access token
145- #[ from_env(
146- var = "OAUTH_TOKEN_URL" ,
147- desc = "OAuth token URL for the builder to get an OAuth2 access token"
148- ) ]
149- pub oauth_token_url : String ,
150- /// The oauth token refresh interval in seconds.
151- #[ from_env(
152- var = "AUTH_TOKEN_REFRESH_INTERVAL" ,
153- desc = "The oauth token refresh interval in seconds"
154- ) ]
155- pub oauth_token_refresh_interval : u64 ,
134+
135+ /// Oauth2 configuration for the builder to connect to ini4 services.
136+ pub oauth : OAuthConfig ,
137+
156138 /// The max number of simultaneous block simulations to run.
157139 #[ from_env(
158140 var = "CONCURRENCY_LIMIT" ,
@@ -220,7 +202,7 @@ impl BuilderConfig {
220202 static ONCE : std:: sync:: OnceLock < SharedToken > = std:: sync:: OnceLock :: new ( ) ;
221203
222204 ONCE . get_or_init ( || {
223- let authenticator = Authenticator :: new ( self ) . unwrap ( ) ;
205+ let authenticator = Authenticator :: new ( & self . oauth ) ;
224206 let token = authenticator. token ( ) ;
225207 authenticator. spawn ( ) ;
226208 token
0 commit comments