Skip to content

Commit b031367

Browse files
authored
fix: update events to array to match specs (#58)
1 parent 6a24d5f commit b031367

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

examples/webhook.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,17 @@ async fn main() -> anyhow::Result<()> {
211211
println!("[subscriber] received message: {}", message.message);
212212

213213
let pub_data = server.recv().await;
214-
let decoded = rpc::WatchEventClaims::try_from_str(&pub_data.payload.event_auth).unwrap();
214+
let decoded =
215+
rpc::WatchEventClaims::try_from_str(pub_data.payload.event_auth.first().unwrap()).unwrap();
215216
let decoded_json = serde_json::to_string_pretty(&decoded).unwrap();
216217
println!(
217218
"[webhook] publisher: url={} data={}",
218219
pub_data.url, decoded_json
219220
);
220221

221222
let sub_data = server.recv().await;
222-
let decoded = rpc::WatchEventClaims::try_from_str(&sub_data.payload.event_auth).unwrap();
223+
let decoded =
224+
rpc::WatchEventClaims::try_from_str(sub_data.payload.event_auth.first().unwrap()).unwrap();
223225
let decoded_json = serde_json::to_string_pretty(&decoded).unwrap();
224226
println!(
225227
"[webhook] subscriber: url={} data={}",

relay_rpc/Cargo.toml

+30-11
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,38 @@ version = "0.1.0"
44
edition = "2021"
55

66
[features]
7-
cacao = ["dep:k256", "dep:sha3"]
7+
cacao = [
8+
"dep:k256",
9+
"dep:sha3",
10+
"dep:alloy-providers",
11+
"dep:alloy-transport",
12+
"dep:alloy-transport-http",
13+
"dep:alloy-rpc-types",
14+
"dep:alloy-json-rpc",
15+
"dep:alloy-json-abi",
16+
"dep:alloy-sol-types",
17+
"dep:alloy-primitives",
18+
]
819

920
[dependencies]
1021
bs58 = "0.4"
1122
data-encoding = "2.3"
12-
derive_more = { version = "0.99", default-features = false, features = ["display", "from", "as_ref", "as_mut"] }
23+
derive_more = { version = "0.99", default-features = false, features = [
24+
"display",
25+
"from",
26+
"as_ref",
27+
"as_mut",
28+
] }
1329
serde = { version = "1.0", features = ["derive", "rc"] }
1430
serde-aux = { version = "4.1", default-features = false }
1531
serde_json = "1.0"
1632
thiserror = "1.0"
1733
ed25519-dalek = { git = "https://github.com/dalek-cryptography/ed25519-dalek.git", rev = "7529d65" }
1834
rand = "0.7"
19-
chrono = { version = "0.4", default-features = false, features = ["std", "clock"] }
35+
chrono = { version = "0.4", default-features = false, features = [
36+
"std",
37+
"clock",
38+
] }
2039
regex = "1.7"
2140
once_cell = "1.16"
2241
jsonwebtoken = "8.1"
@@ -25,14 +44,14 @@ sha3 = { version = "0.10", optional = true }
2544
sha2 = { version = "0.10.6" }
2645
reqwest = { version = "0.11", features = ["default-tls"] }
2746
url = "2"
28-
alloy-providers = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
29-
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
30-
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
31-
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
32-
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
33-
alloy-json-abi = "0.6.2"
34-
alloy-sol-types = "0.6.2"
35-
alloy-primitives = "0.6.2"
47+
alloy-providers = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
48+
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
49+
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
50+
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
51+
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
52+
alloy-json-abi = { version = "0.6.2", optional = true }
53+
alloy-sol-types = { version = "0.6.2", optional = true }
54+
alloy-primitives = { version = "0.6.2", optional = true }
3655

3756
[dev-dependencies]
3857
tokio = { version = "1.35.1", features = ["test-util", "macros"] }

relay_rpc/src/rpc/watch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl VerifyableClaims for WatchEventClaims {
116116
#[serde(rename_all = "camelCase")]
117117
pub struct WatchWebhookPayload {
118118
/// JWT with [`WatchEventClaims`] payload.
119-
pub event_auth: String,
119+
pub event_auth: Vec<String>,
120120
}
121121

122122
#[cfg(test)]

0 commit comments

Comments
 (0)