Interaction¶
cyhole.solscan.v1.Solscan
¶
Solscan(api_key: str | None = None)
Bases: Interaction
Class used to connect only Solscan V1 API, one of them most popular Solana chain explorer. To have access Solscan Pro API is required to have a valid API key.
Check API Documentation for all the details on the available endpoints.
Solscan API is currently divided into two versions:
- v1 - the first and classic version of the Pro API.
- v2 - a new and improved version of the Pro API, with more endpoints and features. This version is under development and may have some changes.
Info
This Interaction is dedicated to the Solscan Pro API v1.0.
Use cyhole.solscan.SolscanV2 or cyhole.solscan.v2.Solscan for the Solscan Pro API v2.0.
If the API key is not provided during the object creation, then it is automatically
retrieved from environment variable SOLSCAN_API_V1_KEY.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
specifies the API key for Solscan Pro API v1. |
None
|
Example
Source code in src/cyhole/solscan/v1/interaction.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
_get_account_tokens
¶
_get_account_tokens(
sync: Literal[True], account: str
) -> GetAccountTokensResponse
_get_account_tokens(
sync: Literal[False], account: str
) -> Coroutine[None, None, GetAccountTokensResponse]
_get_account_tokens(
sync: bool, account: str
) -> (
GetAccountTokensResponse
| Coroutine[None, None, GetAccountTokensResponse]
)
This function refers to the GET Account Tokens of V1 API endpoint, and it is used to get tokens balances of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
Returns:
| Type | Description |
|---|---|
GetAccountTokensResponse | Coroutine[None, None, GetAccountTokensResponse]
|
List of tokens balances of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
_get_account_transactions
¶
_get_account_transactions(
sync: Literal[True],
account: str,
before_hash: str | None = None,
limit: int | None = None,
) -> GetAccountTransactionsResponse
_get_account_transactions(
sync: Literal[False],
account: str,
before_hash: str | None = None,
limit: int | None = None,
) -> Coroutine[None, None, GetAccountTransactionsResponse]
_get_account_transactions(
sync: bool,
account: str,
before_hash: str | None = None,
limit: int | None = None,
) -> (
GetAccountTransactionsResponse
| Coroutine[None, None, GetAccountTransactionsResponse]
)
This function refers to the GET Account Transactions of V1 API endpoint, and it is used to get transactions of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
before_hash
|
str | None
|
The transaction hash to get transactions before it. |
None
|
limit
|
int | None
|
The number of transactions to get; maximum is 50. |
None
|
Returns:
| Type | Description |
|---|---|
GetAccountTransactionsResponse | Coroutine[None, None, GetAccountTransactionsResponse]
|
List of transactions of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
_get_account_stake_accounts
¶
_get_account_stake_accounts(
sync: Literal[True], account: str
) -> GetAccountStakeAccountsResponse
_get_account_stake_accounts(
sync: Literal[False], account: str
) -> Coroutine[None, None, GetAccountStakeAccountsResponse]
_get_account_stake_accounts(
sync: bool, account: str
) -> (
GetAccountStakeAccountsResponse
| Coroutine[None, None, GetAccountStakeAccountsResponse]
)
This function refers to the GET Account StakeAccounts of V1 API endpoint, and it is used to get stake accounts of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
Returns:
| Type | Description |
|---|---|
GetAccountStakeAccountsResponse | Coroutine[None, None, GetAccountStakeAccountsResponse]
|
List of stake accounts of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
_get_account_spl_transfers
¶
_get_account_spl_transfers(
sync: Literal[True],
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> GetAccountSplTransfersResponse
_get_account_spl_transfers(
sync: Literal[False],
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetAccountSplTransfersResponse]
_get_account_spl_transfers(
sync: bool,
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> (
GetAccountSplTransfersResponse
| Coroutine[None, None, GetAccountSplTransfersResponse]
)
This function refers to the GET Account SplTransfers of V1 API endpoint, and it is used to get spl transfers of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
utc_from_unix_time
|
int | None
|
The start time in unix time. |
None
|
utc_to_unix_time
|
int | None
|
The end time in unix time. |
None
|
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetAccountSplTransfersResponse | Coroutine[None, None, GetAccountSplTransfersResponse]
|
List of spl transfers of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
_get_account_sol_transfers
¶
_get_account_sol_transfers(
sync: Literal[True],
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> GetAccountSolTransfersResponse
_get_account_sol_transfers(
sync: Literal[False],
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetAccountSolTransfersResponse]
_get_account_sol_transfers(
sync: bool,
account: str,
utc_from_unix_time: int | None = None,
utc_to_unix_time: int | None = None,
limit: int = 10,
offset: int | None = None,
) -> (
GetAccountSolTransfersResponse
| Coroutine[None, None, GetAccountSolTransfersResponse]
)
This function refers to the GET Account SolTransfers of V1 API endpoint, and it is used to get sol transfers of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
utc_from_unix_time
|
int | None
|
The start time in unix time. |
None
|
utc_to_unix_time
|
int | None
|
The end time in unix time. |
None
|
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetAccountSolTransfersResponse | Coroutine[None, None, GetAccountSolTransfersResponse]
|
List of sol transfers of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
_get_account_export_transactions
¶
_get_account_export_transactions(
sync: Literal[True],
account: str,
export_type: str,
dt_from: datetime,
dt_to: datetime,
) -> GetAccountExportTransactionsResponse
_get_account_export_transactions(
sync: Literal[False],
account: str,
export_type: str,
dt_from: datetime,
dt_to: datetime,
) -> Coroutine[
None, None, GetAccountExportTransactionsResponse
]
_get_account_export_transactions(
sync: bool,
account: str,
export_type: str,
dt_from: datetime,
dt_to: datetime,
) -> (
GetAccountExportTransactionsResponse
| Coroutine[
None, None, GetAccountExportTransactionsResponse
]
)
This function refers to the GET Account Export Transactions of V1 API endpoint, and it is used to get export transactions of an account in CSV format.
Info
The limit of the export transactions is 5000. Moreover, it is possible to execute the export transactions only for 1 time for every minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
export_type
|
str
|
The export type.
The supported types are available on |
required |
dt_from
|
datetime
|
The start time. |
required |
dt_to
|
datetime
|
The end time. |
required |
Returns:
| Type | Description |
|---|---|
GetAccountExportTransactionsResponse | Coroutine[None, None, GetAccountExportTransactionsResponse]
|
List of export transactions of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
_get_account_export_rewards
¶
_get_account_export_rewards(
sync: Literal[True],
account: str,
dt_from: datetime,
dt_to: datetime,
) -> GetAccountExportRewardsResponse
_get_account_export_rewards(
sync: Literal[False],
account: str,
dt_from: datetime,
dt_to: datetime,
) -> Coroutine[None, None, GetAccountExportRewardsResponse]
_get_account_export_rewards(
sync: bool,
account: str,
dt_from: datetime,
dt_to: datetime,
) -> (
GetAccountExportRewardsResponse
| Coroutine[None, None, GetAccountExportRewardsResponse]
)
This function refers to the GET Account Export Rewards of V1 API endpoint, and it is used to get export rewards of an account in CSV format.
Info
The limit of the export rewards is 5000 for request. Moreover, it is possible to execute the request only 1 time for every minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
dt_from
|
datetime
|
The start time. |
required |
dt_to
|
datetime
|
The end time. |
required |
Returns:
| Type | Description |
|---|---|
GetAccountExportRewardsResponse | Coroutine[None, None, GetAccountExportRewardsResponse]
|
List of export rewards of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
_get_account_detail
¶
_get_account_detail(
sync: Literal[True], account: str
) -> GetAccountDetailResponse
_get_account_detail(
sync: Literal[False], account: str
) -> Coroutine[None, None, GetAccountDetailResponse]
_get_account_detail(
sync: bool, account: str
) -> (
GetAccountDetailResponse
| Coroutine[None, None, GetAccountDetailResponse]
)
This function refers to the GET Account Detail of V1 API endpoint, and it is used to get details of an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
str
|
The account address. |
required |
Returns:
| Type | Description |
|---|---|
GetAccountDetailResponse | Coroutine[None, None, GetAccountDetailResponse]
|
Details of the account. |
Source code in src/cyhole/solscan/v1/interaction.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
_get_token_holders
¶
_get_token_holders(
sync: Literal[True],
token: str,
limit: int = 10,
offset: int | None = None,
amount_from: int | None = None,
amount_to: int | None = None,
) -> GetTokenHoldersResponse
_get_token_holders(
sync: Literal[False],
token: str,
limit: int = 10,
offset: int | None = None,
amount_from: int | None = None,
amount_to: int | None = None,
) -> Coroutine[None, None, GetTokenHoldersResponse]
_get_token_holders(
sync: bool,
token: str,
limit: int = 10,
offset: int | None = None,
amount_from: int | None = None,
amount_to: int | None = None,
) -> (
GetTokenHoldersResponse
| Coroutine[None, None, GetTokenHoldersResponse]
)
This function refers to the GET Token Holders of V1 API endpoint, and it is used to get token holders of a token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The token address. |
required |
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
amount_from
|
int | None
|
The minimum amount of the token. |
None
|
amount_to
|
int | None
|
The maximum amount of the token |
None
|
Returns:
| Type | Description |
|---|---|
GetTokenHoldersResponse | Coroutine[None, None, GetTokenHoldersResponse]
|
List of token holders of the token. |
Source code in src/cyhole/solscan/v1/interaction.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | |
_get_token_meta
¶
_get_token_meta(
sync: Literal[True], token: str
) -> GetTokenMetaResponse
_get_token_meta(
sync: Literal[False], token: str
) -> Coroutine[None, None, GetTokenMetaResponse]
_get_token_meta(
sync: bool, token: str
) -> (
GetTokenMetaResponse
| Coroutine[None, None, GetTokenMetaResponse]
)
This function refers to the GET Token Meta of V1 API endpoint, and it is used to get meta of a token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The token address. |
required |
Returns:
| Type | Description |
|---|---|
GetTokenMetaResponse | Coroutine[None, None, GetTokenMetaResponse]
|
Meta of the token. |
Source code in src/cyhole/solscan/v1/interaction.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
_get_token_transfer
¶
_get_token_transfer(
sync: Literal[True],
token: str,
account: str | None = None,
limit: int = 10,
offset: int | None = None,
) -> GetTokenTransferResponse
_get_token_transfer(
sync: Literal[False],
token: str,
account: str | None = None,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetTokenTransferResponse]
_get_token_transfer(
sync: bool,
token: str,
account: str | None = None,
limit: int = 10,
offset: int | None = None,
) -> (
GetTokenTransferResponse
| Coroutine[None, None, GetTokenTransferResponse]
)
This function refers to the GET Token Transfer of V1 API endpoint, and it is used to get token transfers of a token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The token address. |
required |
account
|
str | None
|
The account address to filter for. |
None
|
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetTokenTransferResponse | Coroutine[None, None, GetTokenTransferResponse]
|
List of token transfers of the token. |
Source code in src/cyhole/solscan/v1/interaction.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
_get_token_list
¶
_get_token_list(
sync: Literal[True],
sort_by: str = SolscanSort.MARKET_CAP.value,
order_by: str = SolscanOrder.DESCENDING.value,
limit: int = 10,
offset: int | None = None,
) -> GetTokenListResponse
_get_token_list(
sync: Literal[False],
sort_by: str = SolscanSort.MARKET_CAP.value,
order_by: str = SolscanOrder.DESCENDING.value,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetTokenListResponse]
_get_token_list(
sync: bool,
sort_by: str = SolscanSort.MARKET_CAP.value,
order_by: str = SolscanOrder.DESCENDING.value,
limit: int = 10,
offset: int | None = None,
) -> (
GetTokenListResponse
| Coroutine[None, None, GetTokenListResponse]
)
This function refers to the GET Token List of V1 API endpoint, and it is used to get list of tokens according to Solscan, with additional token's information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetTokenListResponse | Coroutine[None, None, GetTokenListResponse]
|
List of tokens. |
Source code in src/cyhole/solscan/v1/interaction.py
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | |
_get_market_token_detail
¶
_get_market_token_detail(
sync: Literal[True],
token: str,
limit: int = 10,
offset: int | None = None,
) -> GetMarketTokenDetailResponse
_get_market_token_detail(
sync: Literal[False],
token: str,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetMarketTokenDetailResponse]
_get_market_token_detail(
sync: bool,
token: str,
limit: int = 10,
offset: int | None = None,
) -> (
GetMarketTokenDetailResponse
| Coroutine[None, None, GetMarketTokenDetailResponse]
)
This function refers to the GET Market Token Detail of V1 API endpoint, and it is used to get market details of a token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The token address. |
required |
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetMarketTokenDetailResponse | Coroutine[None, None, GetMarketTokenDetailResponse]
|
Market details of the token. |
Source code in src/cyhole/solscan/v1/interaction.py
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
_get_transaction_last
¶
_get_transaction_last(
sync: Literal[True], limit: int = 10
) -> GetTransactionLastResponse
_get_transaction_last(
sync: Literal[False], limit: int = 10
) -> Coroutine[None, None, GetTransactionLastResponse]
_get_transaction_last(
sync: bool, limit: int = 10
) -> (
GetTransactionLastResponse
| Coroutine[None, None, GetTransactionLastResponse]
)
This function refers to the GET Transaction Last of V1 API endpoint, and it is used to get last transactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
The number of transactions to get; maximum is 20. |
10
|
Returns:
| Type | Description |
|---|---|
GetTransactionLastResponse | Coroutine[None, None, GetTransactionLastResponse]
|
Last transactions. |
Source code in src/cyhole/solscan/v1/interaction.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
_get_transaction_detail
¶
_get_transaction_detail(
sync: Literal[True], transaction_id: str
) -> GetTransactionDetailResponse
_get_transaction_detail(
sync: Literal[False], transaction_id: str
) -> Coroutine[None, None, GetTransactionDetailResponse]
_get_transaction_detail(
sync: bool, transaction_id: str
) -> (
GetTransactionDetailResponse
| Coroutine[None, None, GetTransactionDetailResponse]
)
This function refers to the GET Transaction Detail of V1 API endpoint, and it is used to get detail of a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transaction_id
|
str
|
The transaction hash. |
required |
Returns:
| Type | Description |
|---|---|
GetTransactionDetailResponse | Coroutine[None, None, GetTransactionDetailResponse]
|
Detail of the transaction. |
Source code in src/cyhole/solscan/v1/interaction.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | |
_get_block_last
¶
_get_block_last(
sync: Literal[True], limit: int = 10
) -> GetBlockLastResponse
_get_block_last(
sync: Literal[False], limit: int = 10
) -> Coroutine[None, None, GetBlockLastResponse]
_get_block_last(
sync: bool, limit: int = 10
) -> (
GetBlockLastResponse
| Coroutine[None, None, GetBlockLastResponse]
)
This function refers to the GET Block Last of V1 API endpoint, and it is used to get last block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
The number of blocks to get; maximum is 20. |
10
|
Returns:
| Type | Description |
|---|---|
GetBlockLastResponse | Coroutine[None, None, GetBlockLastResponse]
|
Last block. |
Source code in src/cyhole/solscan/v1/interaction.py
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
_get_block_detail
¶
_get_block_detail(
sync: Literal[True], block_id: int
) -> GetBlockDetailResponse
_get_block_detail(
sync: Literal[False], block_id: int
) -> Coroutine[None, None, GetBlockDetailResponse]
_get_block_detail(
sync: bool, block_id: int
) -> (
GetBlockDetailResponse
| Coroutine[None, None, GetBlockDetailResponse]
)
This function refers to the GET Block Detail of V1 API endpoint, and it is used to get detail of a block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_id
|
int
|
The block number. |
required |
Returns:
| Type | Description |
|---|---|
GetBlockDetailResponse | Coroutine[None, None, GetBlockDetailResponse]
|
Detail of the block. |
Source code in src/cyhole/solscan/v1/interaction.py
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | |
_get_block_transactions
¶
_get_block_transactions(
sync: Literal[True],
block_id: int,
limit: int = 10,
offset: int | None = None,
) -> GetBlockTransactionsResponse
_get_block_transactions(
sync: Literal[False],
block_id: int,
limit: int = 10,
offset: int | None = None,
) -> Coroutine[None, None, GetBlockTransactionsResponse]
_get_block_transactions(
sync: bool,
block_id: int,
limit: int = 10,
offset: int | None = None,
) -> (
GetBlockTransactionsResponse
| Coroutine[None, None, GetBlockTransactionsResponse]
)
This function refers to the GET Block Transactions of V1 API endpoint, and it is used to get transactions of a block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_id
|
int
|
The block number. |
required |
limit
|
int
|
The number of transactions to get; maximum is 50. |
10
|
offset
|
int | None
|
The offset of the transactions. |
None
|
Returns:
| Type | Description |
|---|---|
GetBlockTransactionsResponse | Coroutine[None, None, GetBlockTransactionsResponse]
|
List of transactions of the block. |
Source code in src/cyhole/solscan/v1/interaction.py
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | |
_raise
¶
_raise(exception: HTTPError) -> SolscanException
Internal function used to raise the manage the exceptions raised by the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
HTTPError
|
the HTTP error returned from Solscan API. |
required |
Raises:
| Type | Description |
|---|---|
SolscanException
|
general exception raised when an unknown error is found. |
Source code in src/cyhole/solscan/v1/interaction.py
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | |