Skip to content

Commit

Permalink
Extract transaction-status-client-types (#2870)
Browse files Browse the repository at this point in the history
* extract ttransaction-status-client-types and transform associated methods to free funcs: UiInstruction::parse -> parse_ui_instruction; UiInnerInstructions::parse => parse_ui_inner_instructions; UiTransactionStatusMeta::parse -> parse_ui_transaction_status_meta

* replace transaction_status with transaction_status_client_types in rpc_client_api

* update description

* also rip out types used by rpc-client

* unused imports

* fix feature activation after workspace change

* move tests

* sort deps
  • Loading branch information
kevinheavey authored Sep 12, 2024
1 parent 3f2a4ae commit 43b5830
Show file tree
Hide file tree
Showing 21 changed files with 1,045 additions and 938 deletions.
21 changes: 19 additions & 2 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ members = [
"transaction-dos",
"transaction-metrics-tracker",
"transaction-status",
"transaction-status-client-types",
"transaction-view",
"turbine",
"type-overrides",
Expand Down Expand Up @@ -432,7 +433,7 @@ solana-remote-wallet = { path = "remote-wallet", version = "=2.1.0", default-fea
solana-sanitize = { path = "sanitize", version = "=2.1.0" }
solana-serde-varint = { path = "sdk/serde-varint", version = "=2.1.0" }
solana-sha256-hasher = { path = "sdk/sha256-hasher", version = "=2.1.0" }
solana-signature = { path = "sdk/signature", version = "=2.1.0" }
solana-signature = { path = "sdk/signature", version = "=2.1.0", default-features = false }
solana-timings = { path = "timings", version = "=2.1.0" }
solana-unified-scheduler-logic = { path = "unified-scheduler-logic", version = "=2.1.0" }
solana-unified-scheduler-pool = { path = "unified-scheduler-pool", version = "=2.1.0" }
Expand Down Expand Up @@ -461,6 +462,7 @@ solana-test-validator = { path = "test-validator", version = "=2.1.0" }
solana-thin-client = { path = "thin-client", version = "=2.1.0" }
solana-tpu-client = { path = "tpu-client", version = "=2.1.0", default-features = false }
solana-transaction-status = { path = "transaction-status", version = "=2.1.0" }
solana-transaction-status-client-types = { path = "transaction-status-client-types", version = "=2.1.0" }
solana-transaction-metrics-tracker = { path = "transaction-metrics-tracker", version = "=2.1.0" }
solana-turbine = { path = "turbine", version = "=2.1.0" }
solana-type-overrides = { path = "type-overrides", version = "=2.1.0" }
Expand Down
4 changes: 2 additions & 2 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ use {
transaction::{MessageHash, SanitizedTransaction, SimpleAddressLoader},
},
solana_stake_program::{points::PointValue, stake_state},
solana_transaction_status::UiInstruction,
solana_transaction_status::parse_ui_instruction,
solana_unified_scheduler_pool::DefaultSchedulerPool,
solana_vote_program::{
self,
Expand Down Expand Up @@ -759,7 +759,7 @@ fn record_transactions(
let instructions = message
.instructions()
.iter()
.map(|ix| UiInstruction::parse(ix, &message.account_keys(), None))
.map(|ix| parse_ui_instruction(ix, &message.account_keys(), None))
.collect();

let is_simple_vote_tx = tx.is_simple_vote_transaction();
Expand Down
21 changes: 19 additions & 2 deletions programs/sbf/Cargo.lock

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

2 changes: 1 addition & 1 deletion rpc-client-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde_json = { workspace = true }
solana-account-decoder = { workspace = true }
solana-inline-spl = { workspace = true }
solana-sdk = { workspace = true }
solana-transaction-status = { workspace = true }
solana-transaction-status-client-types = { workspace = true }
solana-version = { workspace = true }
thiserror = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion rpc-client-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
clock::{Epoch, Slot},
commitment_config::{CommitmentConfig, CommitmentLevel},
},
solana_transaction_status::{TransactionDetails, UiTransactionEncoding},
solana_transaction_status_client_types::{TransactionDetails, UiTransactionEncoding},
};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion rpc-client-api/src/custom_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use {
crate::response::RpcSimulateTransactionResult,
jsonrpc_core::{Error, ErrorCode},
solana_sdk::clock::Slot,
solana_transaction_status::EncodeError,
solana_transaction_status_client_types::EncodeError,
thiserror::Error,
};

Expand Down
2 changes: 1 addition & 1 deletion rpc-client-api/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
inflation::Inflation,
transaction::{Result, TransactionError},
},
solana_transaction_status::{
solana_transaction_status_client_types::{
ConfirmedTransactionStatusWithSignature, TransactionConfirmationStatus, UiConfirmedBlock,
UiInnerInstructions, UiTransactionReturnData,
},
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde_json = { workspace = true }
solana-account-decoder = { workspace = true }
solana-rpc-client-api = { workspace = true }
solana-sdk = { workspace = true }
solana-transaction-status = { workspace = true }
solana-transaction-status-client-types = { workspace = true }
solana-version = { workspace = true }
solana-vote-program = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/src/mock_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use {
sysvar::epoch_schedule::EpochSchedule,
transaction::{self, Transaction, TransactionError, TransactionVersion},
},
solana_transaction_status::{
solana_transaction_status_client_types::{
option_serializer::OptionSerializer, EncodedConfirmedBlock,
EncodedConfirmedTransactionWithStatusMeta, EncodedTransaction,
EncodedTransactionWithStatusMeta, Rewards, TransactionBinaryEncoding,
Expand Down
10 changes: 5 additions & 5 deletions rpc-client/src/nonblocking/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use {
signature::Signature,
transaction,
},
solana_transaction_status::{
solana_transaction_status_client_types::{
EncodedConfirmedBlock, EncodedConfirmedTransactionWithStatusMeta, TransactionStatus,
UiConfirmedBlock, UiTransactionEncoding,
},
Expand Down Expand Up @@ -2277,7 +2277,7 @@ impl RpcClient {
/// # Examples
///
/// ```
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # use solana_rpc_client_api::client_error::Error;
/// # use solana_rpc_client::nonblocking::rpc_client::RpcClient;
/// # futures::executor::block_on(async {
Expand Down Expand Up @@ -2312,7 +2312,7 @@ impl RpcClient {
/// # Examples
///
/// ```
/// # use solana_transaction_status::{
/// # use solana_transaction_status_client_types::{
/// # TransactionDetails,
/// # UiTransactionEncoding,
/// # };
Expand Down Expand Up @@ -2709,7 +2709,7 @@ impl RpcClient {
/// # signer::keypair::Keypair,
/// # system_transaction,
/// # };
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # futures::executor::block_on(async {
/// # let rpc_client = RpcClient::new_mock("succeeds".to_string());
/// # let alice = Keypair::new();
Expand Down Expand Up @@ -2769,7 +2769,7 @@ impl RpcClient {
/// # system_transaction,
/// # commitment_config::CommitmentConfig,
/// # };
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # futures::executor::block_on(async {
/// # let rpc_client = RpcClient::new_mock("succeeds".to_string());
/// # let alice = Keypair::new();
Expand Down
10 changes: 5 additions & 5 deletions rpc-client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use {
signature::Signature,
transaction::{self, uses_durable_nonce, Transaction, VersionedTransaction},
},
solana_transaction_status::{
solana_transaction_status_client_types::{
EncodedConfirmedBlock, EncodedConfirmedTransactionWithStatusMeta, TransactionStatus,
UiConfirmedBlock, UiTransactionEncoding,
},
Expand Down Expand Up @@ -1968,7 +1968,7 @@ impl RpcClient {
/// ```
/// # use solana_rpc_client_api::client_error::Error;
/// # use solana_rpc_client::rpc_client::RpcClient;
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # let rpc_client = RpcClient::new_mock("succeeds".to_string());
/// # let slot = rpc_client.get_slot()?;
/// let encoding = UiTransactionEncoding::Base58;
Expand Down Expand Up @@ -2002,7 +2002,7 @@ impl RpcClient {
/// # client_error::Error,
/// # };
/// # use solana_rpc_client::rpc_client::RpcClient;
/// # use solana_transaction_status::{
/// # use solana_transaction_status_client_types::{
/// # TransactionDetails,
/// # UiTransactionEncoding,
/// # };
Expand Down Expand Up @@ -2344,7 +2344,7 @@ impl RpcClient {
/// # signer::keypair::Keypair,
/// # system_transaction,
/// # };
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # let rpc_client = RpcClient::new_mock("succeeds".to_string());
/// # let alice = Keypair::new();
/// # let bob = Keypair::new();
Expand Down Expand Up @@ -2397,7 +2397,7 @@ impl RpcClient {
/// # system_transaction,
/// # commitment_config::CommitmentConfig,
/// # };
/// # use solana_transaction_status::UiTransactionEncoding;
/// # use solana_transaction_status_client_types::UiTransactionEncoding;
/// # let rpc_client = RpcClient::new_mock("succeeds".to_string());
/// # let alice = Keypair::new();
/// # let bob = Keypair::new();
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3293,7 +3293,7 @@ pub mod rpc_full {
use {
super::*,
solana_sdk::message::{SanitizedVersionedMessage, VersionedMessage},
solana_transaction_status::UiInnerInstructions,
solana_transaction_status::parse_ui_inner_instructions,
};
#[rpc]
pub trait Full {
Expand Down Expand Up @@ -3884,7 +3884,7 @@ pub mod rpc_full {

let inner_instructions = inner_instructions.map(|info| {
map_inner_instructions(info)
.map(|converted| UiInnerInstructions::parse(converted, &account_keys))
.map(|converted| parse_ui_inner_instructions(converted, &account_keys))
.collect()
});

Expand Down
7 changes: 6 additions & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ solana-sdk-macro = { workspace = true }
solana-secp256k1-recover = { workspace = true }
solana-serde-varint = { workspace = true }
solana-short-vec = { workspace = true }
solana-signature = { workspace = true, features = ["rand", "serde", "verify"], optional = true }
solana-signature = { workspace = true, features = [
"rand",
"serde",
"std",
"verify",
], optional = true }
thiserror = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
25 changes: 25 additions & 0 deletions transaction-status-client-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "solana-transaction-status-client-types"
description = "Core RPC client types for solana-transaction-status"
documentation = "https://docs.rs/solana-transaction-status-client-types"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
base64 = { workspace = true }
bincode = { workspace = true }
bs58 = { workspace = true }
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
solana-account-decoder = { workspace = true }
solana-sdk = { workspace = true }
solana-signature = { workspace = true, default-features = false }
thiserror = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Loading

0 comments on commit 43b5830

Please sign in to comment.