Skip to main content

hyperstack_stacks/pumpfun/
entity.rs

1use super::types::PumpfunToken;
2use hyperstack_sdk::{Stack, StateView, ViewBuilder, ViewHandle, Views};
3
4pub struct PumpfunStack;
5
6impl Stack for PumpfunStack {
7    type Views = PumpfunStackViews;
8
9    fn name() -> &'static str {
10        "pumpfun-token"
11    }
12
13    fn url() -> &'static str {
14        "wss://pumpfun.stack.usehyperstack.com"
15    }
16}
17
18pub struct PumpfunStackViews {
19    pub pumpfun_token: PumpfunTokenEntityViews,
20}
21
22impl Views for PumpfunStackViews {
23    fn from_builder(builder: ViewBuilder) -> Self {
24        Self {
25            pumpfun_token: PumpfunTokenEntityViews { builder },
26        }
27    }
28}
29
30pub struct PumpfunTokenEntityViews {
31    builder: ViewBuilder,
32}
33
34impl PumpfunTokenEntityViews {
35    pub fn state(&self) -> StateView<PumpfunToken> {
36        StateView::new(
37            self.builder.connection().clone(),
38            self.builder.store().clone(),
39            "PumpfunToken/state".to_string(),
40            self.builder.initial_data_timeout(),
41        )
42    }
43
44    pub fn list(&self) -> ViewHandle<PumpfunToken> {
45        self.builder.view("PumpfunToken/list")
46    }
47}