Skip to content

Commit

Permalink
cleanup fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Jul 29, 2024
1 parent 2b55a1e commit 962b1e0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 29 deletions.
5 changes: 0 additions & 5 deletions connector/examples/call_gpa_gma_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

Check warning on line 2 in connector/examples/call_gpa_gma_example.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/examples/call_gpa_gma_example.rs
use clap::Parser;

use jsonrpc_core_client::transports::http;
use solana_account_decoder::UiAccountEncoding;
use solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig};
use solana_client::rpc_response::OptionalContext;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use mango_feeds_connector::snapshot::get_snapshot_gma;

Expand Down
6 changes: 0 additions & 6 deletions connector/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,10 @@ pub async fn get_snapshot_gma(
rpc_http_url: &str,
ids: Vec<String>,
) -> anyhow::Result<SnapshotMultipleAccounts> {

info!("Call patched get_snapshot_gma");
let rpc_client = http::connect::<RpcAccountsScanClient>(rpc_http_url)
.await
.map_err_anyhow()?;

// let rpc_client = http::connect::<AccountsDataClient>(rpc_http_url)
// .await
// .map_err_anyhow()?;

let account_info_config = RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
commitment: Some(CommitmentConfig::finalized()),
Expand Down
22 changes: 5 additions & 17 deletions connector/src/solana_rpc_minimal.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

Check warning on line 1 in connector/src/solana_rpc_minimal.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/solana_rpc_minimal.rs

pub mod rpc_accounts_scan {
use std::sync::Arc;
use jsonrpc_core::Result;
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::typed::Subscriber;
use solana_account_decoder::UiAccount;

Check warning on line 6 in connector/src/solana_rpc_minimal.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/solana_rpc_minimal.rs
use solana_rpc_client_api::config::{RpcAccountInfoConfig, RpcProgramAccountsConfig};
use solana_rpc_client_api::response::{Response as RpcResponse, RpcKeyedAccount, SlotUpdate, OptionalContext};
use jsonrpc_pubsub::SubscriptionId as PubSubSubscriptionId;
use solana_rpc_client_api::response::{Response as RpcResponse, RpcKeyedAccount, OptionalContext};

/// this definition is derived from solana-rpc/rpc.rs
/// we want to avoid the heavy dependency to solana-rpc
Expand Down Expand Up @@ -46,15 +43,13 @@ pub mod rpc_pubsub {
use jsonrpc_pubsub::typed::Subscriber;
use solana_account_decoder::UiAccount;
use solana_rpc_client_api::config::{RpcAccountInfoConfig, RpcProgramAccountsConfig};
use solana_rpc_client_api::response::{Response as RpcResponse, RpcKeyedAccount, SlotUpdate, OptionalContext};
use solana_rpc_client_api::response::{Response as RpcResponse, RpcKeyedAccount, SlotUpdate};
use jsonrpc_pubsub::SubscriptionId as PubSubSubscriptionId;

#[rpc]
pub trait RpcSolPubSub {
type Metadata;

// Get notification every time account data is changed
// Accepts pubkey parameter as base-58 encoded string
#[pubsub(
subscription = "accountNotification",
subscribe,
Expand All @@ -68,7 +63,6 @@ pub mod rpc_pubsub {
config: Option<RpcAccountInfoConfig>,
);

// Unsubscribe from account notification subscription.
#[pubsub(
subscription = "accountNotification",
unsubscribe,
Expand All @@ -78,11 +72,8 @@ pub mod rpc_pubsub {
&self,
meta: Option<Self::Metadata>,
id: PubSubSubscriptionId,
) -> jsonrpc_core::Result<bool>;

) -> Result<bool>;

// Get notification every time account data owned by a particular program is changed
// Accepts pubkey parameter as base-58 encoded string
#[pubsub(
subscription = "programNotification",
subscribe,
Expand All @@ -96,7 +87,6 @@ pub mod rpc_pubsub {
config: Option<RpcProgramAccountsConfig>,
);

// Unsubscribe from account notification subscription.
#[pubsub(
subscription = "programNotification",
unsubscribe,
Expand All @@ -106,10 +96,9 @@ pub mod rpc_pubsub {
&self,
meta: Option<Self::Metadata>,
id: PubSubSubscriptionId,
) -> jsonrpc_core::Result<bool>;
) -> Result<bool>;


// Get series of updates for all slots
#[pubsub(
subscription = "slotsUpdatesNotification",
subscribe,
Expand All @@ -121,7 +110,6 @@ pub mod rpc_pubsub {
subscriber: Subscriber<Arc<SlotUpdate>>,
);

// Unsubscribe from slots updates notification subscription.
#[pubsub(
subscription = "slotsUpdatesNotification",
unsubscribe,
Expand All @@ -131,7 +119,7 @@ pub mod rpc_pubsub {
&self,
meta: Option<Self::Metadata>,
id: PubSubSubscriptionId,
) -> jsonrpc_core::Result<bool>;
) -> Result<bool>;

}

Expand Down
1 change: 0 additions & 1 deletion connector/src/websocket_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::{
sync::Arc,
time::{Duration, Instant},
};
use solana_rpc_client::rpc_client::RpcClient;
use tokio::time::timeout;

use crate::snapshot::{
Expand Down

0 comments on commit 962b1e0

Please sign in to comment.