pub struct SolscanAPI { /* private fields */ }
Expand description
SolscanAPI
is a struct that contains a String
for the SolscanURL and a Client
which is the instance.
Properties:
A doc comment. A doc comment. A doc comment.
base_url
: The base URL for the Solscan API.client
: This is the HTTP client that will be used to make requests to the Solscan API.
Implementations§
Source§impl SolscanAPI
Implementation of the struct called SolscanAPI.
impl SolscanAPI
Implementation of the struct called SolscanAPI.
Sourcepub fn new() -> SolscanAPI
pub fn new() -> SolscanAPI
It creates a new instance of the SolscanAPI struct.
Returns:
A new instance of the SolscanAPI struct.
Sourcepub fn new_with_url(solscan_url: String) -> SolscanAPI
pub fn new_with_url(solscan_url: String) -> SolscanAPI
This function creates a new instance of the SolscanAPI struct, which is used to make custom requests to the Solscan API (mostly useful for mockups)
Arguments:
solscan_url
: The URL of the Solscan API.
Returns:
A new instance of the SolscanAPI struct.
Sourcepub async fn ping_status(
&self,
endpoint: Option<String>,
) -> Result<StatusCode, Error>
pub async fn ping_status( &self, endpoint: Option<String>, ) -> Result<StatusCode, Error>
It checks the status of the endpoint.
Arguments:
endpoint
: The endpoint to ping. If none is provided, the base url will be used.
Returns:
A Result<StatusCode, Error>
Sourcepub async fn get_block_last(
&self,
limit: Option<i64>,
) -> Result<Vec<BlockResult>, SolscanError>
pub async fn get_block_last( &self, limit: Option<i64>, ) -> Result<Vec<BlockResult>, SolscanError>
It gets the last block
Arguments:
limit
: The number of blocks to return.
Returns:
A Result<Vec
Sourcepub async fn get_block_transactions(
&self,
block: i64,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<Vec<TransactionLast>, SolscanError>
pub async fn get_block_transactions( &self, block: i64, offset: Option<i64>, limit: Option<i64>, ) -> Result<Vec<TransactionLast>, SolscanError>
It gets the transactions for a block.
Arguments:
block
: The block number to get transactions for.offset
: The offset of the first transaction to return.limit
: The number of transactions to return.
Returns:
A Result<Vec
Sourcepub async fn get_block_block(
&self,
block: i64,
) -> Result<BlockResult, SolscanError>
pub async fn get_block_block( &self, block: i64, ) -> Result<BlockResult, SolscanError>
It gets the block information for a given block number.
Arguments:
block
: The block number you want to query
Returns:
A Result<BlockResult, SolscanError>
Sourcepub async fn get_transaction_last(
&self,
limit: Option<i64>,
) -> Result<Vec<TransactionLast>, SolscanError>
pub async fn get_transaction_last( &self, limit: Option<i64>, ) -> Result<Vec<TransactionLast>, SolscanError>
It gets the last transactions from the blockchain.
Arguments:
limit
: The number of transactions to return.
Returns:
A Result<Vec
Sourcepub async fn get_transaction(
&self,
signature: &str,
) -> Result<Transaction, SolscanError>
pub async fn get_transaction( &self, signature: &str, ) -> Result<Transaction, SolscanError>
It fetches a transaction from the blockchain.
Arguments:
signature
: The transaction hash
Returns:
A Result<Transaction, SolscanError>
Sourcepub async fn get_account_tokens(
&self,
account: &str,
) -> Result<Vec<Token>, SolscanError>
pub async fn get_account_tokens( &self, account: &str, ) -> Result<Vec<Token>, SolscanError>
It fetches the tokens associated with an account.
Arguments:
account
: The address of the account you want to get the tokens for.
Returns:
A Result<Vec
Sourcepub async fn get_account_transactions(
&self,
account: &str,
before_hash: Option<String>,
limit: Option<i64>,
) -> Result<Vec<TransactionListItem>, SolscanError>
pub async fn get_account_transactions( &self, account: &str, before_hash: Option<String>, limit: Option<i64>, ) -> Result<Vec<TransactionListItem>, SolscanError>
It gets the transactions for a given account.
Arguments:
account
: The address of the account you want to get the transactions for.before_hash
: The hash of the transaction you want to start from.limit
: The number of transactions to return.
Returns:
A Result<Vec
Sourcepub async fn get_account_stake_accounts(
&self,
account: &str,
) -> Result<Vec<Token>, SolscanError>
pub async fn get_account_stake_accounts( &self, account: &str, ) -> Result<Vec<Token>, SolscanError>
It returns a list of accounts that have staked to the given account.
Arguments:
account
: The account address to query
Returns:
A Result<Vec
Sourcepub async fn get_account_spl_transfer(
&self,
account: &str,
form_time: Option<u64>,
to_time: Option<u64>,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<SplTransfer, SolscanError>
pub async fn get_account_spl_transfer( &self, account: &str, form_time: Option<u64>, to_time: Option<u64>, offset: Option<i64>, limit: Option<i64>, ) -> Result<SplTransfer, SolscanError>
It fetches the account spl transfer data from the solscan api.
Arguments:
account
: The account address to queryform_time
: The start time of the query.to_time
: The time to end the search at.offset
: The offset of the first result to return.limit
: The number of results to return.
Returns:
A Result<SplTransfer, SolscanError>
Sourcepub async fn get_account_sol_transfer(
&self,
account: &str,
form_time: Option<u64>,
to_time: Option<u64>,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<SolTransferList, SolscanError>
pub async fn get_account_sol_transfer( &self, account: &str, form_time: Option<u64>, to_time: Option<u64>, offset: Option<i64>, limit: Option<i64>, ) -> Result<SolTransferList, SolscanError>
It gets the SOL transfers for a given account.
Arguments:
account
: The account address to queryform_time
: The start time of the query.to_time
: The timestamp of the last block you want to include in the results.offset
: The offset of the first result to return.limit
: The number of results to return.
Returns:
A Result<SolTransferList, SolscanError>
Sourcepub async fn get_account_account(
&self,
account: &str,
) -> Result<AccountInfo, SolscanError>
pub async fn get_account_account( &self, account: &str, ) -> Result<AccountInfo, SolscanError>
It fetches the account information of the given account.
Arguments:
account
: The account address to query
Returns:
A Result<AccountInfo, SolscanError>
Sourcepub async fn get_token_holders(
&self,
account: &str,
offset: Option<i64>,
limit: Option<i64>,
) -> Result<TokenHolders, SolscanError>
pub async fn get_token_holders( &self, account: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<TokenHolders, SolscanError>
It returns a list of token holders for a given token address.
Arguments:
account
: The address of the token contractoffset
: The offset of the first result to return.limit
: The number of results to return.
Returns:
A Result<TokenHolders, SolscanError>
Sourcepub async fn get_token_meta(
&self,
account: &str,
) -> Result<TokenMeta, SolscanError>
pub async fn get_token_meta( &self, account: &str, ) -> Result<TokenMeta, SolscanError>
It fetches the token meta data for a given token address.
Arguments:
account
: The address of the token contract
Returns:
A Result<TokenMeta, SolscanError>
Sourcepub async fn get_market_token(
&self,
account: &str,
) -> Result<TokenMarketItem, SolscanError>
pub async fn get_market_token( &self, account: &str, ) -> Result<TokenMarketItem, SolscanError>
It fetches the token market item for the given account.
Arguments:
account
: The address of the token contract
Returns:
A Result<TokenMarketItem, SolscanError>
Sourcepub async fn get_chain_info(&self) -> Result<ChainInfo, SolscanError>
pub async fn get_chain_info(&self) -> Result<ChainInfo, SolscanError>
It gets the chain info from the Solana blockchain.
Returns:
A Result<ChainInfo, SolscanError>