Skip to content

Commit 53af4ae

Browse files
committed
Add env vars
1 parent 21d3814 commit 53af4ae

File tree

8 files changed

+284
-163
lines changed

8 files changed

+284
-163
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
.secret

Cargo.lock

Lines changed: 121 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
borsh = "0.9.3"
8+
clap = { version = "4.5.39", features = ["derive", "env"] }
89
secp256k1 = { version = "0.31.0", features = ["recovery"] }
910
serde = "1.0.219"
1011
serde_arrays = "0.2.0"
@@ -16,4 +17,3 @@ solana-sdk = "2.2.2"
1617
tokio = "1.45.1"
1718
tokio-stream = "0.1.17"
1819
tracing = "0.1.41"
19-
wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" }

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2025 Pyth Contributors.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
# pythnet-watcher
1+
# Pythnet Watcher
2+
3+
This project is a Rust-based utility for listening to messages on **Pythnet**, processing them, and signing them as a **Wormhole guardian**.
4+
5+
---
6+
7+
## 🚀 Getting Started
8+
9+
### 🛠️ Build the Project
10+
11+
```bash
12+
cargo build --release
13+
```
14+
15+
Or for development:
16+
17+
```bash
18+
cargo build
19+
```
20+
21+
---
22+
23+
### ▶️ Run the Project
24+
25+
You can run the project using `cargo run` by passing the required flags:
26+
27+
```bash
28+
cargo run -- \
29+
--pythnet-url wss://api2.pythnet.pyth.network \
30+
--secret-key /path/to/secret.key \
31+
--wormhole-pid H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU \
32+
--accumulator-address G9LV2mp9ua1znRAfYwZz5cPiJMAbo1T6mbjdQsDZuMJg
33+
```
34+
35+
---
36+
37+
### 🌱 Environment Variables (Optional)
38+
39+
Instead of CLI flags, you can also set environment variables:
40+
41+
```bash
42+
export PYTHNET_URL=wss://api2.pythnet.pyth.network
43+
export SECRET_KEY=/path/to/secret.key
44+
export WORMHOLE_PID=H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU
45+
export ACCUMULATOR_ADDRESS=G9LV2mp9ua1znRAfYwZz5cPiJMAbo1T6mbjdQsDZuMJg
46+
47+
cargo run
48+
```
49+
50+
---
51+
52+
### 🧪 Testing Locally
53+
54+
To test in a non-production environment (e.g. with devnet or a local Pythnet fork), just provide a different `--pythnet-url` and optionally use custom `--wormhole-pid` and `--accumulator-address`.

src/config.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::path::PathBuf;
2+
3+
use clap::Parser;
4+
5+
6+
#[derive(Parser, Clone, Debug)]
7+
pub struct RunOptions {
8+
/// The API key to use for auction server authentication.
9+
#[arg(long = "pythnet-url", env = "PYTHNET_URL")]
10+
pub pythnet_url: String,
11+
/// Path to the file containing the secret key.
12+
#[arg(long = "secret-key", env = "SECRET_KEY")]
13+
pub secret_key_path: String,
14+
/// The Wormhole program ID.
15+
#[arg(long = "wormhole-pid", env = "WORMHOLE_PID", default_value = "H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU")]
16+
pub wormhole_pid: String,
17+
/// The address of the accumulator contract.
18+
#[arg(long = "accumulator-address", env = "ACCUMULATOR_ADDRESS", default_value = "G9LV2mp9ua1znRAfYwZz5cPiJMAbo1T6mbjdQsDZuMJg")]
19+
pub accumulator_address: String,
20+
}

0 commit comments

Comments
 (0)