Skip to content

Commit

Permalink
added graphQL for uniswap positions
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Jan 15, 2024
1 parent 083db9d commit 7eb9afb
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 32 deletions.
172 changes: 166 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ edition = "2018"


[dependencies]
anyhow = "1.0.79"
cfonts = "1.1.0"
chrono = "0.4.31"
clap = { version = "4.4.16", features = ["derive"] }
crossterm = "0.27.0"
ethers = "2.0.11"
futures = "0.3.30"
juniper = "0.15.12"
rand = { version = "0.7.3", default-features = false, features = ["std"] }
ratatui = "0.25.0"
serde = "1.0.194"
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::widgets::{
table::{render_table, StatefulTable},
welcome::render_welcome,
};
use anyhow::Result;
use clap::Parser;
use models::event_handling::Event;
use models::states::InputMode;
Expand Down Expand Up @@ -60,7 +61,7 @@ struct Args {
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
async fn main() -> Result<()> {
let _ = std::fs::create_dir("logs");

CombinedLogger::init(vec![
Expand Down
18 changes: 9 additions & 9 deletions src/models/position.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use crate::network::ethers::types::AddressInfo;
use ethers::types::U256;
use juniper::GraphQLObject;

#[derive(Debug, Clone)]
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(description = "Information about a token")]
pub struct Token {
name: String,
symbol: String,
address: AddressInfo,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(description = "Information about a Uniswap position")]
pub struct Position {
token_1: Token,
token_2: Token,
token_1_balance: U256,
token_2_balance: U256,
token_1_fees: U256,
token_2_fees: U256,
token_1_balance: String,
token_2_balance: String,
token_1_fees: String,
token_2_fees: String,
}

0 comments on commit 7eb9afb

Please sign in to comment.