Skip to content

Commit

Permalink
fix: update events to array to match specs (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 authored Feb 12, 2024
1 parent 6a24d5f commit b031367
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
6 changes: 4 additions & 2 deletions examples/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,17 @@ async fn main() -> anyhow::Result<()> {
println!("[subscriber] received message: {}", message.message);

let pub_data = server.recv().await;
let decoded = rpc::WatchEventClaims::try_from_str(&pub_data.payload.event_auth).unwrap();
let decoded =
rpc::WatchEventClaims::try_from_str(pub_data.payload.event_auth.first().unwrap()).unwrap();
let decoded_json = serde_json::to_string_pretty(&decoded).unwrap();
println!(
"[webhook] publisher: url={} data={}",
pub_data.url, decoded_json
);

let sub_data = server.recv().await;
let decoded = rpc::WatchEventClaims::try_from_str(&sub_data.payload.event_auth).unwrap();
let decoded =
rpc::WatchEventClaims::try_from_str(sub_data.payload.event_auth.first().unwrap()).unwrap();
let decoded_json = serde_json::to_string_pretty(&decoded).unwrap();
println!(
"[webhook] subscriber: url={} data={}",
Expand Down
41 changes: 30 additions & 11 deletions relay_rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,38 @@ version = "0.1.0"
edition = "2021"

[features]
cacao = ["dep:k256", "dep:sha3"]
cacao = [
"dep:k256",
"dep:sha3",
"dep:alloy-providers",
"dep:alloy-transport",
"dep:alloy-transport-http",
"dep:alloy-rpc-types",
"dep:alloy-json-rpc",
"dep:alloy-json-abi",
"dep:alloy-sol-types",
"dep:alloy-primitives",
]

[dependencies]
bs58 = "0.4"
data-encoding = "2.3"
derive_more = { version = "0.99", default-features = false, features = ["display", "from", "as_ref", "as_mut"] }
derive_more = { version = "0.99", default-features = false, features = [
"display",
"from",
"as_ref",
"as_mut",
] }
serde = { version = "1.0", features = ["derive", "rc"] }
serde-aux = { version = "4.1", default-features = false }
serde_json = "1.0"
thiserror = "1.0"
ed25519-dalek = { git = "https://github.com/dalek-cryptography/ed25519-dalek.git", rev = "7529d65" }
rand = "0.7"
chrono = { version = "0.4", default-features = false, features = ["std", "clock"] }
chrono = { version = "0.4", default-features = false, features = [
"std",
"clock",
] }
regex = "1.7"
once_cell = "1.16"
jsonwebtoken = "8.1"
Expand All @@ -25,14 +44,14 @@ sha3 = { version = "0.10", optional = true }
sha2 = { version = "0.10.6" }
reqwest = { version = "0.11", features = ["default-tls"] }
url = "2"
alloy-providers = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1" }
alloy-json-abi = "0.6.2"
alloy-sol-types = "0.6.2"
alloy-primitives = "0.6.2"
alloy-providers = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "e6f98e1", optional = true }
alloy-json-abi = { version = "0.6.2", optional = true }
alloy-sol-types = { version = "0.6.2", optional = true }
alloy-primitives = { version = "0.6.2", optional = true }

[dev-dependencies]
tokio = { version = "1.35.1", features = ["test-util", "macros"] }
2 changes: 1 addition & 1 deletion relay_rpc/src/rpc/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl VerifyableClaims for WatchEventClaims {
#[serde(rename_all = "camelCase")]
pub struct WatchWebhookPayload {
/// JWT with [`WatchEventClaims`] payload.
pub event_auth: String,
pub event_auth: Vec<String>,
}

#[cfg(test)]
Expand Down

0 comments on commit b031367

Please sign in to comment.