-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
use super::utils::decode_and_deserialize; | ||
use jsonrpc_core::BoxFuture; | ||
use jsonrpc_core::{Error, Result}; | ||
use jsonrpc_derive::rpc; | ||
use solana_account_decoder::parse_token::UiTokenAmount; | ||
use solana_account_decoder::UiAccount; | ||
use solana_client::rpc_config::RpcAccountInfoConfig; | ||
use solana_client::rpc_custom_error::RpcCustomError; | ||
use solana_client::rpc_response::{RpcApiVersion, RpcBlockCommitment}; | ||
use solana_client::rpc_response::RpcResponseContext; | ||
use solana_client::{ | ||
rpc_config::{ | ||
RpcBlockConfig, RpcBlocksConfigWrapper, RpcEncodingConfigWrapper, RpcEpochConfig, | ||
RpcRequestAirdropConfig, RpcSendTransactionConfig, RpcSignatureStatusConfig, | ||
RpcSignaturesForAddressConfig, RpcSimulateTransactionConfig, RpcTransactionConfig, | ||
}, | ||
rpc_response::{ | ||
RpcBlockhash, RpcConfirmedTransactionStatusWithSignature, RpcContactInfo, | ||
RpcInflationReward, RpcPerfSample, RpcPrioritizationFee, RpcSimulateTransactionResult, | ||
}, | ||
}; | ||
use solana_rpc_client_api::response::Response as RpcResponse; | ||
use solana_runtime::commitment::BlockCommitmentArray; | ||
use solana_sdk::clock::UnixTimestamp; | ||
use solana_sdk::transaction::VersionedTransaction; | ||
use solana_send_transaction_service::send_transaction_service::TransactionInfo; | ||
use solana_transaction_status::UiTransactionEncoding; | ||
use solana_transaction_status::{ | ||
EncodedConfirmedTransactionWithStatusMeta, TransactionStatus, UiConfirmedBlock, | ||
}; | ||
|
||
use { | ||
super::*, | ||
solana_sdk::message::{SanitizedVersionedMessage, VersionedMessage}, | ||
solana_transaction_status::parse_ui_inner_instructions, | ||
}; | ||
|
||
#[rpc] | ||
pub trait AccountsData { | ||
type Metadata; | ||
|
||
#[rpc(meta, name = "getAccountInfo")] | ||
fn get_account_info( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_str: String, | ||
config: Option<RpcAccountInfoConfig>, | ||
) -> BoxFuture<Result<RpcResponse<Option<UiAccount>>>>; | ||
|
||
#[rpc(meta, name = "getMultipleAccounts")] | ||
fn get_multiple_accounts( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_strs: Vec<String>, | ||
config: Option<RpcAccountInfoConfig>, | ||
) -> BoxFuture<Result<RpcResponse<Vec<Option<UiAccount>>>>>; | ||
|
||
#[rpc(meta, name = "getBlockCommitment")] | ||
fn get_block_commitment( | ||
&self, | ||
meta: Self::Metadata, | ||
block: Slot, | ||
) -> Result<RpcBlockCommitment<BlockCommitmentArray>>; | ||
|
||
// SPL Token-specific RPC endpoints | ||
// See https://github.com/solana-labs/solana-program-library/releases/tag/token-v2.0.0 for | ||
// program details | ||
|
||
#[rpc(meta, name = "getTokenAccountBalance")] | ||
fn get_token_account_balance( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_str: String, | ||
commitment: Option<CommitmentConfig>, | ||
) -> Result<RpcResponse<UiTokenAmount>>; | ||
|
||
#[rpc(meta, name = "getTokenSupply")] | ||
fn get_token_supply( | ||
&self, | ||
meta: Self::Metadata, | ||
mint_str: String, | ||
commitment: Option<CommitmentConfig>, | ||
) -> Result<RpcResponse<UiTokenAmount>>; | ||
} | ||
|
||
pub struct SurfpoolAccountsDataRpc; | ||
impl AccountsData for SurfpoolAccountsDataRpc { | ||
type Metadata = Option<RunloopContext>; | ||
|
||
fn get_account_info( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_str: String, | ||
config: Option<RpcAccountInfoConfig>, | ||
) -> BoxFuture<Result<RpcResponse<Option<UiAccount>>>> { | ||
unimplemented!() | ||
} | ||
|
||
fn get_multiple_accounts( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_strs: Vec<String>, | ||
config: Option<RpcAccountInfoConfig>, | ||
) -> BoxFuture<Result<RpcResponse<Vec<Option<UiAccount>>>>> { | ||
unimplemented!() | ||
} | ||
|
||
fn get_block_commitment( | ||
&self, | ||
meta: Self::Metadata, | ||
block: Slot, | ||
) -> Result<RpcBlockCommitment<BlockCommitmentArray>> { | ||
unimplemented!() | ||
} | ||
|
||
// SPL Token-specific RPC endpoints | ||
// See https://github.com/solana-labs/solana-program-library/releases/tag/token-v2.0.0 for | ||
// program details | ||
|
||
fn get_token_account_balance( | ||
&self, | ||
meta: Self::Metadata, | ||
pubkey_str: String, | ||
commitment: Option<CommitmentConfig>, | ||
) -> Result<RpcResponse<UiTokenAmount>> { | ||
unimplemented!() | ||
} | ||
|
||
fn get_token_supply( | ||
&self, | ||
meta: Self::Metadata, | ||
mint_str: String, | ||
commitment: Option<CommitmentConfig>, | ||
) -> Result<RpcResponse<UiTokenAmount>> { | ||
unimplemented!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters