Skip to content

Commit

Permalink
switch to rpc account provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Feb 20, 2024
1 parent b69fbd7 commit 5e61bc0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use drift_sdk::{
Context, MarketId, MarketType, ModifyOrderParams, RpcSendTransactionConfig, SdkError,
SdkResult, VersionedMessage,
},
AccountProvider, DriftClient, Pubkey, TransactionBuilder, Wallet, WsAccountProvider,
AccountProvider, DriftClient, Pubkey, RpcAccountProvider, TransactionBuilder, Wallet,
};
use futures_util::{stream::FuturesUnordered, StreamExt};
use log::{debug, warn};
Expand Down Expand Up @@ -42,7 +42,7 @@ pub struct AppState {
pub wallet: Wallet,
/// true if gateway is using delegated signing
delegated: bool,
pub client: Arc<DriftClient<WsAccountProvider>>,
pub client: Arc<DriftClient<RpcAccountProvider>>,
dlob_client: DLOBClient,
/// Solana tx commitment level for preflight confirmation
tx_commitment: CommitmentConfig,
Expand Down Expand Up @@ -74,9 +74,7 @@ impl AppState {
Context::MainNet
};

let account_provider = WsAccountProvider::new_with_commitment(endpoint, state_commitment)
.await
.expect("ws connects");
let account_provider = RpcAccountProvider::with_commitment(endpoint, state_commitment);
let client = DriftClient::new(context, account_provider)
.await
.expect("ok");
Expand Down Expand Up @@ -513,7 +511,7 @@ mod tests {
#[tokio::test]
async fn test_pf() {
// flakey needs a mainnet RPC getProgramAccounts
let account_provider = WsAccountProvider::new("https://api.devnet.solana.com")
let account_provider = RpcAccountProvider::new("https://api.devnet.solana.com")
.await
.expect("ws connects");
let client = DriftClient::new(Context::DevNet, account_provider)
Expand Down

0 comments on commit 5e61bc0

Please sign in to comment.