Skip to main content

jupiter_sdk/api/
studio.rs

1use crate::{studio::{DbcFeeCreateTxReq, DbcFeeCreateTxRes, GetDbcFeeReq, GetDbcFeeRes, GetPoolByMintRes, PoolCreateTxReq, PoolSubmitReq, PoolSubmitRes}, JupiterClient, JupiterError};
2
3
4
5
6
7#[derive(Clone)]
8pub struct StudioService<'a>{
9    client: &'a JupiterClient,
10}
11
12
13impl<'a> StudioService<'a> {
14    pub fn new(client: &'a JupiterClient) -> Self {
15        Self { client }
16    }
17
18    pub async fn pool_create_tx(
19        &self,
20        req: &PoolCreateTxReq,
21    ) -> Result<PoolCreateTxReq, JupiterError> {
22        let path = "/studio/v1/dbc-pool/create-tx";
23        self.client.post(&path, req).await
24    }
25
26    pub async fn pool_submit(
27        &self,
28        req: &PoolSubmitReq,
29    ) -> Result<PoolSubmitRes, JupiterError> {
30        let path = "/studio/v1/dbc-pool/submit";
31        self.client.post(&path, req).await
32    }
33
34    pub async fn get_pool_by_mint(
35        &self,
36        mint: String,
37    ) -> Result<GetPoolByMintRes, JupiterError> {
38        let path = format!("/studio/v1/dbc-pool/addresses/{}", mint);
39        self.client.get_json(&path).await
40    }
41
42    pub async fn get_dbc_fee(
43        &self,
44        req: &GetDbcFeeReq,
45    ) -> Result<GetDbcFeeRes, JupiterError> {
46        let path = "/studio/v1/dbc/fee";
47        self.client.get_json_with_query(&path, req).await
48    }
49
50    pub async fn dbc_fee_create_tx(
51        &self,
52        req: &DbcFeeCreateTxReq,
53    ) -> Result<DbcFeeCreateTxRes, JupiterError> {
54        let path = "/studio/v1/dbc/fee/create-tx";
55        self.client.post(&path, req).await
56    }
57}