Module orca_whirlpool.internal.anchor.instructions.initialize_config
Expand source code
from __future__ import annotations
import typing
from solders.pubkey import Pubkey
from solders.system_program import ID as SYS_PROGRAM_ID
from solders.instruction import Instruction, AccountMeta
from anchorpy.borsh_extension import BorshPubkey
import borsh_construct as borsh
from ..program_id import PROGRAM_ID
class InitializeConfigArgs(typing.TypedDict):
fee_authority: Pubkey
collect_protocol_fees_authority: Pubkey
reward_emissions_super_authority: Pubkey
default_protocol_fee_rate: int
layout = borsh.CStruct(
"fee_authority" / BorshPubkey,
"collect_protocol_fees_authority" / BorshPubkey,
"reward_emissions_super_authority" / BorshPubkey,
"default_protocol_fee_rate" / borsh.U16,
)
class InitializeConfigAccounts(typing.TypedDict):
config: Pubkey
funder: Pubkey
def initialize_config(
args: InitializeConfigArgs,
accounts: InitializeConfigAccounts,
program_id: Pubkey = PROGRAM_ID,
remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None,
) -> Instruction:
keys: list[AccountMeta] = [
AccountMeta(pubkey=accounts["config"], is_signer=True, is_writable=True),
AccountMeta(pubkey=accounts["funder"], is_signer=True, is_writable=True),
AccountMeta(pubkey=SYS_PROGRAM_ID, is_signer=False, is_writable=False),
]
if remaining_accounts is not None:
keys += remaining_accounts
identifier = b"\xd0\x7f\x15\x01\xc2\xbe\xc4F"
encoded_args = layout.build(
{
"fee_authority": args["fee_authority"],
"collect_protocol_fees_authority": args["collect_protocol_fees_authority"],
"reward_emissions_super_authority": args[
"reward_emissions_super_authority"
],
"default_protocol_fee_rate": args["default_protocol_fee_rate"],
}
)
data = identifier + encoded_args
return Instruction(program_id, data, keys)
Functions
def initialize_config(args: InitializeConfigArgs, accounts: InitializeConfigAccounts, program_id: Pubkey = Pubkey( whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc, ), remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None) ‑> solders.instruction.Instruction
-
Expand source code
def initialize_config( args: InitializeConfigArgs, accounts: InitializeConfigAccounts, program_id: Pubkey = PROGRAM_ID, remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None, ) -> Instruction: keys: list[AccountMeta] = [ AccountMeta(pubkey=accounts["config"], is_signer=True, is_writable=True), AccountMeta(pubkey=accounts["funder"], is_signer=True, is_writable=True), AccountMeta(pubkey=SYS_PROGRAM_ID, is_signer=False, is_writable=False), ] if remaining_accounts is not None: keys += remaining_accounts identifier = b"\xd0\x7f\x15\x01\xc2\xbe\xc4F" encoded_args = layout.build( { "fee_authority": args["fee_authority"], "collect_protocol_fees_authority": args["collect_protocol_fees_authority"], "reward_emissions_super_authority": args[ "reward_emissions_super_authority" ], "default_protocol_fee_rate": args["default_protocol_fee_rate"], } ) data = identifier + encoded_args return Instruction(program_id, data, keys)
Classes
class InitializeConfigAccounts (*args, **kwargs)
-
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Expand source code
class InitializeConfigAccounts(typing.TypedDict): config: Pubkey funder: Pubkey
Ancestors
- builtins.dict
Class variables
var config : solders.pubkey.Pubkey
var funder : solders.pubkey.Pubkey
class InitializeConfigArgs (*args, **kwargs)
-
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Expand source code
class InitializeConfigArgs(typing.TypedDict): fee_authority: Pubkey collect_protocol_fees_authority: Pubkey reward_emissions_super_authority: Pubkey default_protocol_fee_rate: int
Ancestors
- builtins.dict
Class variables
var default_protocol_fee_rate : int