use crate::types::chain::AlchemyChain;
use ethers_core::types::Address;
use serde::{Deserialize, Serialize};
mod create_webhook;
mod delete_webhook;
mod nft_filters;
mod team_webhooks;
mod update_webhook;
mod webhook_addresses;
pub use create_webhook::CreateWebhook;
pub use delete_webhook::DeleteWebhook;
pub use nft_filters::{
GetWebhookNftFilters, GetWebhookNftFiltersResponse, UpdateWebhookNftFilters,
UpdateWebhookNftMetadataFilters,
};
pub use team_webhooks::{GetAllWebhooks, GetAllWebhooksResponse};
pub use update_webhook::UpdateWebhook;
pub use webhook_addresses::{
GetWebhookAddresses, GetWebhookAddressesResponse, ReplaceWebhookAddresses,
UpdateWebhookAddresses,
};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Webhook {
id: String,
network: AlchemyChain,
webhook_type: Option<WebhookType>,
webhook_url: String,
is_active: bool,
time_created: u64,
addresses: Option<Vec<Address>>,
version: WebhookVersion,
signing_key: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WebhookResponse {
data: Webhook,
}
impl WebhookResponse {
pub fn data(&self) -> Webhook {
self.data.clone()
}
}
#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum WebhookType {
CustomWebhooks,
MinedTransaction,
DroppedTransaction,
#[default]
AddressActivity,
NftActivity,
NftMetadataUpdate,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum WebhookVersion {
V1,
V2,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmptyResponse {}