1
- use crate :: {
2
- quincey:: Quincey ,
3
- signer:: { LocalOrAws , SignerError } ,
4
- tasks:: oauth:: { Authenticator , SharedToken } ,
5
- } ;
1
+ use crate :: quincey:: Quincey ;
6
2
use alloy:: {
7
3
network:: { Ethereum , EthereumWallet } ,
8
4
primitives:: Address ,
@@ -15,8 +11,14 @@ use alloy::{
15
11
} ,
16
12
} ;
17
13
use 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
+ } ;
20
22
use signet_zenith:: Zenith ;
21
23
use std:: borrow:: Cow ;
22
24
@@ -41,7 +43,7 @@ pub type HostProvider = FillProvider<
41
43
42
44
/// Configuration for a builder running a specific rollup on a specific host
43
45
/// chain.
44
- #[ derive( serde :: Deserialize , Debug , Clone , FromEnv ) ]
46
+ #[ derive( Debug , Clone , FromEnv ) ]
45
47
pub struct BuilderConfig {
46
48
/// The chain ID of the host chain
47
49
#[ from_env( var = "HOST_CHAIN_ID" , desc = "The chain ID of the host chain" ) ]
@@ -129,30 +131,10 @@ pub struct BuilderConfig {
129
131
desc = "Duration in seconds transactions can live in the tx-pool cache"
130
132
) ]
131
133
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
+
156
138
/// The max number of simultaneous block simulations to run.
157
139
#[ from_env(
158
140
var = "CONCURRENCY_LIMIT" ,
@@ -220,7 +202,7 @@ impl BuilderConfig {
220
202
static ONCE : std:: sync:: OnceLock < SharedToken > = std:: sync:: OnceLock :: new ( ) ;
221
203
222
204
ONCE . get_or_init ( || {
223
- let authenticator = Authenticator :: new ( self ) . unwrap ( ) ;
205
+ let authenticator = Authenticator :: new ( & self . oauth ) ;
224
206
let token = authenticator. token ( ) ;
225
207
authenticator. spawn ( ) ;
226
208
token
0 commit comments