Utils
Cluster
solana.utils.cluster
Tools for getting RPC cluster information.
cluster_api_url(cluster=None, tls=True)
Retrieve the RPC API URL for the specified cluster.
:param cluster: The name of the cluster to use. :param tls: If True, use https. Defaults to True.
Source code in src/solana/utils/cluster.py
26 27 28 29 30 31 32 33 34 35 | |
Security TXT
solana.utils.security_txt
Utils for security.txt.
FOOTER = '=======END SECURITY.TXT V1=======\x00'
module-attribute
Footer of the security.txt.
HEADER = '=======BEGIN SECURITY.TXT V1=======\x00'
module-attribute
Header of the security.txt.
NoSecurityTxtFoundError
Raise when security text is not found.
Source code in src/solana/utils/security_txt.py
32 33 | |
SecurityTxt
dataclass
Security txt data.
Source code in src/solana/utils/security_txt.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
parse_security_txt(data)
Parse and extract security.txt section from the data section of the compiled program.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Program data in bytes from the ProgramAccount. |
required |
Returns:
| Type | Description |
|---|---|
SecurityTxt
|
The Security Txt. |
Source code in src/solana/utils/security_txt.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
Validation
solana.utils.validate
Validation utilities.
validate_instruction_keys(instruction, expected)
Verify length of AccountMeta list of a transaction instruction is at least the expected length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instruction
|
Instruction
|
A Instruction object. |
required |
expected
|
int
|
The expected length. |
required |
Source code in src/solana/utils/validate.py
11 12 13 14 15 16 17 18 19 | |
validate_instruction_type(parsed_data, expected_type)
Check that the instruction type of the parsed data matches the expected instruction type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parsed_data
|
Any
|
Parsed instruction data object with |
required |
expected_type
|
IntEnum
|
The expected instruction type. |
required |
Source code in src/solana/utils/validate.py
22 23 24 25 26 27 28 29 30 31 32 | |