agora.solana package¶
Subpackages¶
Submodules¶
agora.solana.address module¶
-
exception
agora.solana.address.InvalidPublicKeyError[source]¶ Bases:
ExceptionRaised when an invalid public key is generated.
-
agora.solana.address.create_program_address(program, seeds)[source]¶ Mirrors the implementation of the Solana SDK’s CreateProgramAddress. ProgramAddresses are public keys that _do not_ lie on the ed25519 curve to ensure that there is no associated private key. In the event that the program and seed parameters result in a valid Public key, InvalidPublicKeyError is raised.
:return
PublicKey- Return type:
agora.solana.commitment module¶
-
class
agora.solana.commitment.Commitment(value)[source]¶ Bases:
enum.IntEnumUsed to indicate to Solana nodes which bank state to query. See: https://docs.solana.com/apps/jsonrpc-api#configuring-state-commitment
RECENT: The node will query its most recent block. SINGLE: The node will query the most recent block that has been voted on by supermajority of the cluster. ROOT: The node will query the most recent block having reached maximum lockout on this node. MAX: The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum
lockout.
-
MAX= 3¶
-
RECENT= 0¶
-
ROOT= 2¶
-
SINGLE= 1¶
-
agora.solana.instruction module¶
-
class
agora.solana.instruction.AccountMeta(public_key, is_signer=False, is_writable=False, is_payer=False, is_program=False)[source]¶ Bases:
objectRepresents the account information required for building transactions.
-
classmethod
new(pub, is_signer)[source]¶ Creates a new
AccountMetarepresenting a writable account.- Parameters:
- Return type:
-
classmethod
agora.solana.shortvec module¶
-
agora.solana.shortvec.decode_length(b)[source]¶ Decodes a shortvec-encoded length from the provided bytes
- Parameters:
b (
bytes) – The provided bytes- Return type:
Tuple[int,int]- Returns:
The length decoded from the provided bytes and how many bytes it used.
-
agora.solana.shortvec.encode_length(b, length)[source]¶ Encodes the specified length into the byte array.
- Parameters:
b (
bytearray) – The byte array to encode the len into.length (
int) – The length to encode. Must not exceed 2**16-1.
- Return type:
int- Returns:
The number of bytes written to the array.
agora.solana.transaction module¶
-
class
agora.solana.transaction.Header(num_signatures, num_read_only_signed, num_read_only)[source]¶ Bases:
object
-
class
agora.solana.transaction.Message(header, accounts, recent_blockhash, instructions)[source]¶ Bases:
object
Module contents¶
-
class
agora.solana.Commitment(value)[source]¶ Bases:
enum.IntEnumUsed to indicate to Solana nodes which bank state to query. See: https://docs.solana.com/apps/jsonrpc-api#configuring-state-commitment
RECENT: The node will query its most recent block. SINGLE: The node will query the most recent block that has been voted on by supermajority of the cluster. ROOT: The node will query the most recent block having reached maximum lockout on this node. MAX: The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum
lockout.
-
MAX= 3¶
-
RECENT= 0¶
-
ROOT= 2¶
-
SINGLE= 1¶
-
-
class
agora.solana.Instruction(program, data, accounts=None)[source]¶ Bases:
objectRepresents a transaction instruction.
-
class
agora.solana.Transaction(signatures, message)[source]¶ Bases:
object-
get_signature()[source]¶ Returns the first (payer) Transaction signature
- Return type:
Optional[bytes]- Returns:
The signature, if present, or None
-
-
agora.solana.create_account(subsidizer, address, owner, lamports, size)[source]¶ - Account references
[WRITE, SIGNER] Funding account
[WRITE, SIGNER] New account
- CreateAccount {
// Number of lamports to transfer to the new account lamports: u64, // Number of bytes of memory to allocate space: u64,
// Address of program that will own the new account owner: Pubkey,
}
- Return type:
-
agora.solana.create_program_address(program, seeds)[source]¶ Mirrors the implementation of the Solana SDK’s CreateProgramAddress. ProgramAddresses are public keys that _do not_ lie on the ed25519 curve to ensure that there is no associated private key. In the event that the program and seed parameters result in a valid Public key, InvalidPublicKeyError is raised.
:return
PublicKey- Return type:
-
agora.solana.find_program_address(program, seeds)[source]¶ FindProgramAddress mirrors the implementation of the Solana SDK’s FindProgramAddress. Its primary use case (for Kin and Agora) is for deriving associated accounts.
return:
PublicKey- Return type:
Optional[PublicKey]
-
agora.solana.initialize_account(account, mint, owner)[source]¶ // Accounts expected by this instruction: // // 0. [writable] The account to initialize. // 1. [] The mint this account will be associated with. // 2. [] The new account’s owner/multisignature. // 3. [] Rent sysvar
- Return type:
- Returns:
-
agora.solana.transfer(source, dest, owner, amount)[source]¶ // Accounts expected by this instruction: // // * Single owner/delegate // 0. [writable] The source account. // 1. [writable] The destination account. // 2. [signer] The source account’s owner/delegate. // // * Multisignature owner/delegate // 0. [writable] The source account. // 1. [writable] The destination account. // 2. [] The source account’s multisignature owner/delegate. // 3. ..3+M [signer] M signer accounts. :rtype:
Instruction:return: