Revert solana-tokens to RpcClient (#13623)
* Revert solana-tokens to RpcClient * Fixup check_payer_balances tests * Use RpcClient::new_with_commitment in other tests Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
||||
use chrono::prelude::*;
|
||||
use pickledb::{error::Error, PickleDb, PickleDbDumpPolicy};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use solana_banks_client::TransactionStatus;
|
||||
use solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Signature, transaction::Transaction};
|
||||
use solana_transaction_status::TransactionStatus;
|
||||
use std::{cmp::Ordering, fs, io, path::Path};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||
@ -306,6 +306,7 @@ mod tests {
|
||||
slot: 0,
|
||||
confirmations: Some(1),
|
||||
err: None,
|
||||
status: Ok(()),
|
||||
};
|
||||
assert_eq!(
|
||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||
@ -332,6 +333,7 @@ mod tests {
|
||||
slot: 0,
|
||||
confirmations: None,
|
||||
err: Some(TransactionError::AccountNotFound),
|
||||
status: Ok(()),
|
||||
};
|
||||
assert_eq!(
|
||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||
@ -355,6 +357,7 @@ mod tests {
|
||||
slot: 0,
|
||||
confirmations: None,
|
||||
err: None,
|
||||
status: Ok(()),
|
||||
};
|
||||
assert_eq!(
|
||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||
|
@ -1,9 +1,7 @@
|
||||
use solana_banks_client::start_tcp_client;
|
||||
use solana_cli_config::{Config, CONFIG_FILE};
|
||||
use solana_client::rpc_client::RpcClient;
|
||||
use solana_tokens::{arg_parser::parse_args, args::Command, commands};
|
||||
use std::{env, error::Error, path::Path, process};
|
||||
use tokio::runtime::Runtime;
|
||||
use url::Url;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let command_args = parse_args(env::args_os())?;
|
||||
@ -18,19 +16,14 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
Config::default()
|
||||
};
|
||||
let json_rpc_url = command_args.url.unwrap_or(config.json_rpc_url);
|
||||
let rpc_banks_url = Config::compute_rpc_banks_url(&json_rpc_url);
|
||||
let url = Url::parse(&rpc_banks_url)?;
|
||||
let host_port = (url.host_str().unwrap(), url.port().unwrap());
|
||||
|
||||
let runtime = Runtime::new().unwrap();
|
||||
let mut banks_client = runtime.block_on(start_tcp_client(&host_port))?;
|
||||
let client = RpcClient::new(json_rpc_url);
|
||||
|
||||
match command_args.command {
|
||||
Command::DistributeTokens(args) => {
|
||||
runtime.block_on(commands::process_allocations(&mut banks_client, &args))?;
|
||||
commands::process_allocations(&client, &args)?;
|
||||
}
|
||||
Command::Balances(args) => {
|
||||
runtime.block_on(commands::process_balances(&mut banks_client, &args))?;
|
||||
commands::process_balances(&client, &args)?;
|
||||
}
|
||||
Command::TransactionLog(args) => {
|
||||
commands::process_transaction_log(&args)?;
|
||||
|
Reference in New Issue
Block a user