Skip to content

Commit bbdab15

Browse files
authored
Merge pull request #21 from flashbots/builder-jwt
Add optional builder jwt token param
2 parents 7611f43 + 84ca212 commit bbdab15

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/main.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ struct Args {
3131
#[arg(long, env)]
3232
jwt_path: Option<PathBuf>,
3333

34+
/// JWT token for authentication for the builder
35+
#[arg(long, env)]
36+
builder_jwt_token: Option<String>,
37+
38+
/// Path to the JWT secret file for the builder
39+
#[arg(long, env)]
40+
builder_jwt_path: Option<PathBuf>,
41+
3442
/// URL of the local l2 execution engine
3543
#[arg(long, env)]
3644
l2_url: String,
@@ -91,11 +99,21 @@ async fn main() -> Result<()> {
9199
}
92100
};
93101

102+
let builder_jwt_secret = match (args.builder_jwt_path, args.builder_jwt_token) {
103+
(Some(file), None) => {
104+
JwtSecret::from_file(&file).map_err(|e| Error::InvalidArgs(e.to_string()))?
105+
}
106+
(None, Some(secret)) => {
107+
JwtSecret::from_hex(secret).map_err(|e| Error::InvalidArgs(e.to_string()))?
108+
}
109+
_ => jwt_secret,
110+
};
111+
94112
// Initialize the l2 client
95113
let l2_client = create_client(&args.l2_url, jwt_secret)?;
96114

97115
// Initialize the builder client
98-
let builder_client = create_client(&args.builder_url, jwt_secret)?;
116+
let builder_client = create_client(&args.builder_url, builder_jwt_secret)?;
99117

100118
let eth_engine_api = EthEngineApi::new(
101119
Arc::new(l2_client),

0 commit comments

Comments
 (0)