Using pumpdev
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
pub struct Executor {
|
||||
pub api_key: String,
|
||||
pub public_key: String,
|
||||
pub private_key: String,
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
pub mod pump_fun;
|
||||
|
||||
use rust_decimal::Decimal;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::executor::pump_fun::PumpDevAccount;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Account {
|
||||
PumpDev(PumpDevAccount),
|
||||
}
|
||||
|
||||
#[allow(async_fn_in_trait, unused_variables)]
|
||||
pub trait Executor {
|
||||
async fn buy(
|
||||
&self,
|
||||
mint: String,
|
||||
amount: Decimal,
|
||||
priority: Decimal,
|
||||
slippage: u16,
|
||||
) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn sell(
|
||||
&self,
|
||||
mint: String,
|
||||
amount: Decimal,
|
||||
priority: Decimal,
|
||||
slippage: u16,
|
||||
) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
use rust_decimal::Decimal;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::executor::Executor;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PumpDevAccount {
|
||||
#[serde(rename = "apiKey")]
|
||||
pub api_key: String,
|
||||
#[serde(rename = "publicKey")]
|
||||
pub public_key: String,
|
||||
#[serde(rename = "privateKey")]
|
||||
pub private_key: String,
|
||||
}
|
||||
|
||||
pub struct PumpDev {
|
||||
pub account: Mutex<PumpDevAccount>,
|
||||
}
|
||||
|
||||
impl Executor for PumpDev {
|
||||
async fn buy(
|
||||
&self,
|
||||
mint: String,
|
||||
amount: Decimal,
|
||||
priority: Decimal,
|
||||
slippage: u16,
|
||||
) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn sell(
|
||||
&self,
|
||||
mint: String,
|
||||
amount: Decimal,
|
||||
priority: Decimal,
|
||||
slippage: u16,
|
||||
) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user