Skip to content

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
def __init__(self, api_key: str | None = None) -> None:

    # set API
    self.api_key = api_key if api_key is not None else os.environ.get("SOLSCAN_API_V1_KEY")
    if self.api_key is None:
        raise MissingAPIKeyError("no API key is provided during object's creation.")

    # headers setup
    headers = {
        "token": self.api_key
    }
    super().__init__(headers)
    self.headers: dict[str, str]

    # clients
    self.client = SolscanClient(self, headers = self.headers)
    self.async_client = SolscanAsyncClient(self, headers = self.headers)

    # API urls
    self.base_url = "https://pro-api.solscan.io/v1.0/"

    # private attributes
    self._name = "Solscan V1 API"
    self._description = "Interact with Solscan API V1"
    return

_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
def _get_account_tokens(self, sync: bool, account: str) -> GetAccountTokensResponse | Coroutine[None, None, GetAccountTokensResponse]:
    """
        This function refers to the GET **[Account Tokens](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-tokens)** of **V1** API endpoint, 
        and it is used to get tokens balances of an account.

        Parameters:
            account: The account address.

        Returns:
            List of tokens balances of the account.
    """
    # set params
    url = self.base_url + "account/tokens"
    api_params = {
        "account": account
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetAccountTokensResponse(tokens = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetAccountTokensResponse(tokens = content_raw.json())
        return async_request()

_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
def _get_account_transactions(self, 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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-transactions)** of **V1** API endpoint, 
        and it is used to get transactions of an account.

        Parameters:
            account: The account address.
            before_hash: The transaction hash to get transactions before it.
            limit: The number of transactions to get; maximum is 50.

        Returns:
            List of transactions of the account.
    """
    # set params
    url = self.base_url + "account/transactions"
    api_params = {
        "account": account,
        "beforeHash": before_hash,
        "limit": limit
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetAccountTransactionsResponse(transactions = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetAccountTransactionsResponse(transactions = content_raw.json())
        return async_request()

_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
def _get_account_stake_accounts(self, sync: bool, account: str) -> GetAccountStakeAccountsResponse | Coroutine[None, None, GetAccountStakeAccountsResponse]:
    """
        This function refers to the GET **[Account StakeAccounts](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-stakeAccounts)** of **V1** API endpoint, 
        and it is used to get stake accounts of an account.

        Parameters:
            account: The account address.

        Returns:
            List of stake accounts of the account.
    """
    # set params
    url = self.base_url + "account/stakeAccounts"
    api_params = {
        "account": account
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetAccountStakeAccountsResponse(stake_accounts = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetAccountStakeAccountsResponse(stake_accounts = content_raw.json())
        return async_request()

_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
def _get_account_spl_transfers(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-splTransfers)** of **V1** API endpoint, 
        and it is used to get spl transfers of an account.

        Parameters:
            account: The account address.
            utc_from_unix_time: The start time in unix time.
            utc_to_unix_time: The end time in unix time.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            List of spl transfers of the account.
    """
    # set params
    url = self.base_url + "account/splTransfers"
    api_params = {
        "account": account,
        "fromTime": utc_from_unix_time,
        "toTime": utc_to_unix_time,
        "limit": limit,
        "offset": offset
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetAccountSplTransfersResponse,
        params = api_params
    )

_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
def _get_account_sol_transfers(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-solTransfers)** of **V1** API endpoint, 
        and it is used to get sol transfers of an account.

        Parameters:
            account: The account address.
            utc_from_unix_time: The start time in unix time.
            utc_to_unix_time: The end time in unix time.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            List of sol transfers of the account.
    """
    # set params
    url = self.base_url + "account/solTransfers"
    api_params = {
        "account": account,
        "fromTime": utc_from_unix_time,
        "toTime": utc_to_unix_time,
        "limit": limit,
        "offset": offset
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetAccountSolTransfersResponse,
        params = api_params
    )

_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 SolscanExportType.

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
def _get_account_export_transactions(self, 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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-exportTransactions)** 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:
            account: The account address.
            export_type: The export type.
                The supported types are available on [`SolscanExportType`][cyhole.solscan.v1.param.SolscanExportType].
            dt_from: The start time.
            dt_to: The end time.

        Returns:
            List of export transactions of the account.
    """
    # check param consistency
    SolscanExportType.check(export_type)

    # set params
    url = self.base_url + "account/exportTransactions"
    api_params = {
        "account": account,
        "type": export_type,
        "fromTime": int(dt_from.timestamp()),
        "toTime": int(dt_to.timestamp())
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetAccountExportTransactionsResponse(csv = content_raw.text)
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetAccountExportTransactionsResponse(csv = content_raw.text)
        return async_request()

_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
def _get_account_export_rewards(self, sync: bool, account: str, dt_from: datetime, dt_to: datetime) -> GetAccountExportRewardsResponse | Coroutine[None, None, GetAccountExportRewardsResponse]:
    """
        This function refers to the GET **[Account Export Rewards](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-exportRewards)** 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:
            account: The account address.
            dt_from: The start time.
            dt_to: The end time.

        Returns:
            List of export rewards of the account.
    """

    # set params
    url = self.base_url + "account/exportRewards"
    api_params = {
        "account": account,
        "fromTime": int(dt_from.timestamp()),
        "toTime": int(dt_to.timestamp())
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetAccountExportRewardsResponse(csv = content_raw.text)
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetAccountExportRewardsResponse(csv = content_raw.text)
        return async_request()

_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
def _get_account_detail(self, sync: bool, account: str) -> GetAccountDetailResponse | Coroutine[None, None, GetAccountDetailResponse]:
    """
        This function refers to the GET **[Account Detail](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/account-detail)** of **V1** API endpoint, 
        and it is used to get details of an account.

        Parameters:
            account: The account address.

        Returns:
            Details of the account.
    """
    # set params
    url = self.base_url + f"account/{account}"

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetAccountDetailResponse
    )

_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
def _get_token_holders(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/token-holders)** of **V1** API endpoint, 
        and it is used to get token holders of a token.

        Parameters:
            token: The token address.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.
            amount_from: The minimum amount of the token.
            amount_to: The maximum amount of the token

        Returns:
            List of token holders of the token.
    """
    # set params
    url = self.base_url + "token/holders"
    api_params = {
        "tokenAddress": token,
        "limit": limit,
        "offset": offset,
        "fromAmount": amount_from,
        "toAmount": amount_to
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetTokenHoldersResponse,
        params = api_params
    )

_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
def _get_token_meta(self, sync: bool, token: str) -> GetTokenMetaResponse | Coroutine[None, None, GetTokenMetaResponse]:
    """
        This function refers to the GET **[Token Meta](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/token-meta)** of **V1** API endpoint, 
        and it is used to get meta of a token.

        Parameters:
            token: The token address.

        Returns:
            Meta of the token.
    """
    # set params
    url = self.base_url + "token/meta"
    api_params = {
        "tokenAddress": token
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetTokenMetaResponse,
        params = api_params
    )

_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
def _get_token_transfer(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/token-transfer)** of **V1** API endpoint, 
        and it is used to get token transfers of a token.

        Parameters:
            token: The token address.
            account: The account address to filter for.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            List of token transfers of the token.
    """
    # set params
    url = self.base_url + "token/transfer"
    api_params = {
        "tokenAddress": token,
        "address": account,
        "limit": limit,
        "offset": offset
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetTokenTransferResponse,
        params = api_params
    )

_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
def _get_token_list(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/token-list)** of **V1** API endpoint, 
        and it is used to get list of tokens according to Solscan, with additional token's information.

        Parameters:
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            List of tokens.
    """
    # set params
    url = self.base_url + "token/list"
    api_params = {
        "sortBy": sort_by,
        "direction": order_by,
        "limit": limit,
        "offset": offset
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetTokenListResponse,
        params = api_params
    )

_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
def _get_market_token_detail(self, 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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/market-token-detail)** of **V1** API endpoint, 
        and it is used to get market details of a token.

        Parameters:
            token: The token address.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            Market details of the token.
    """
    # set params
    url = self.base_url + f"market/token/{token}"
    api_params = {
        "limit": limit,
        "offset": offset
    }

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetMarketTokenDetailResponse,
        params = api_params
    )

_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
def _get_transaction_last(self, sync: bool, limit: int = 10) -> GetTransactionLastResponse | Coroutine[None, None, GetTransactionLastResponse]:
    """
        This function refers to the GET **[Transaction Last](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/transaction-last)** of **V1** API endpoint, 
        and it is used to get last transactions.

        Parameters:
            limit: The number of transactions to get; maximum is 20.

        Returns:
            Last transactions.
    """
    # set params
    url = self.base_url + "transaction/last"
    api_params = {
        "limit": limit
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetTransactionLastResponse(data = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetTransactionLastResponse(data = content_raw.json())
        return async_request()

_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
def _get_transaction_detail(self, sync: bool, transaction_id: str) -> GetTransactionDetailResponse | Coroutine[None, None, GetTransactionDetailResponse]:
    """
        This function refers to the GET **[Transaction Detail](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/transaction-detail)** of **V1** API endpoint, 
        and it is used to get detail of a transaction.

        Parameters:
            transaction_id: The transaction hash.

        Returns:
            Detail of the transaction.
    """
    # set params
    url = self.base_url + f"transaction/{transaction_id}"

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetTransactionDetailResponse
    )

_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
def _get_block_last(self, sync: bool, limit: int = 10) -> GetBlockLastResponse | Coroutine[None, None, GetBlockLastResponse]:
    """
        This function refers to the GET **[Block Last](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/block-last)** of **V1** API endpoint, 
        and it is used to get last block.

        Parameters:
            limit: The number of blocks to get; maximum is 20.

        Returns:
            Last block.
    """
    # set params
    url = self.base_url + "block/last"
    api_params = {
        "limit": limit
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetBlockLastResponse(data = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetBlockLastResponse(data = content_raw.json())
        return async_request()

_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
def _get_block_detail(self, sync: bool, block_id: int) -> GetBlockDetailResponse | Coroutine[None, None, GetBlockDetailResponse]:
    """
        This function refers to the GET **[Block Detail](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/block-detail)** of **V1** API endpoint, 
        and it is used to get detail of a block.

        Parameters:
            block_id: The block number.

        Returns:
            Detail of the block.
    """
    # set params
    url = self.base_url + f"block/{block_id}"

    # execute request
    return  self.api_return_model(
        sync = sync,
        type = RequestType.GET.value,
        url = url,
        response_model = GetBlockDetailResponse
    )

_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
def _get_block_transactions(
    self,
    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](https://pro-api.solscan.io/pro-api-docs/v2.0/reference/block-transactions)** of **V1** API endpoint, 
        and it is used to get transactions of a block.

        Parameters:
            block_id: The block number.
            limit: The number of transactions to get; maximum is 50.
            offset: The offset of the transactions.

        Returns:
            List of transactions of the block.
    """
    # set params
    url = self.base_url + "block/transactions"
    api_params = {
        "block": block_id,
        "limit": limit,
        "offset": offset
    }

    # execute request
    if sync:
        content_raw = self.client.api(RequestType.GET.value, url, params = api_params)
        return GetBlockTransactionsResponse(transactions = content_raw.json())
    else:
        async def async_request():
            content_raw = await self.async_client.api(RequestType.GET.value, url, params = api_params)
            return GetBlockTransactionsResponse(transactions = content_raw.json())
        return async_request()

_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
def _raise(self, exception: HTTPError) -> SolscanException:
    """
        Internal function used to raise the manage 
        the exceptions raised by the API.

        Parameters:
            exception: the HTTP error returned from Solscan API.

        Raises:
            SolscanException: general exception raised when an unknown error is found.
    """
    try:
        error = SolscanHTTPError(**exception.response.json())
        return SolscanException(f"Code: {error.status}, Message: {error.error.message}")
    except Exception:
        return SolscanException(exception.response.content.decode())