Module orca_whirlpool.internal.anchor.instructions.close_bundled_position

Expand source code
from __future__ import annotations
import typing
from solders.pubkey import Pubkey
from solders.instruction import Instruction, AccountMeta
import borsh_construct as borsh
from ..program_id import PROGRAM_ID


class CloseBundledPositionArgs(typing.TypedDict):
    bundle_index: int


layout = borsh.CStruct("bundle_index" / borsh.U16)


class CloseBundledPositionAccounts(typing.TypedDict):
    bundled_position: Pubkey
    position_bundle: Pubkey
    position_bundle_token_account: Pubkey
    position_bundle_authority: Pubkey
    receiver: Pubkey


def close_bundled_position(
    args: CloseBundledPositionArgs,
    accounts: CloseBundledPositionAccounts,
    program_id: Pubkey = PROGRAM_ID,
    remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None,
) -> Instruction:
    keys: list[AccountMeta] = [
        AccountMeta(
            pubkey=accounts["bundled_position"], is_signer=False, is_writable=True
        ),
        AccountMeta(
            pubkey=accounts["position_bundle"], is_signer=False, is_writable=True
        ),
        AccountMeta(
            pubkey=accounts["position_bundle_token_account"],
            is_signer=False,
            is_writable=False,
        ),
        AccountMeta(
            pubkey=accounts["position_bundle_authority"],
            is_signer=True,
            is_writable=False,
        ),
        AccountMeta(pubkey=accounts["receiver"], is_signer=False, is_writable=True),
    ]
    if remaining_accounts is not None:
        keys += remaining_accounts
    identifier = b")$\xd8\xf5\x1bUgC"
    encoded_args = layout.build(
        {
            "bundle_index": args["bundle_index"],
        }
    )
    data = identifier + encoded_args
    return Instruction(program_id, data, keys)

Functions

def close_bundled_position(args: CloseBundledPositionArgs, accounts: CloseBundledPositionAccounts, program_id: Pubkey = Pubkey( whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc, ), remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None) ‑> solders.instruction.Instruction
Expand source code
def close_bundled_position(
    args: CloseBundledPositionArgs,
    accounts: CloseBundledPositionAccounts,
    program_id: Pubkey = PROGRAM_ID,
    remaining_accounts: typing.Optional[typing.List[AccountMeta]] = None,
) -> Instruction:
    keys: list[AccountMeta] = [
        AccountMeta(
            pubkey=accounts["bundled_position"], is_signer=False, is_writable=True
        ),
        AccountMeta(
            pubkey=accounts["position_bundle"], is_signer=False, is_writable=True
        ),
        AccountMeta(
            pubkey=accounts["position_bundle_token_account"],
            is_signer=False,
            is_writable=False,
        ),
        AccountMeta(
            pubkey=accounts["position_bundle_authority"],
            is_signer=True,
            is_writable=False,
        ),
        AccountMeta(pubkey=accounts["receiver"], is_signer=False, is_writable=True),
    ]
    if remaining_accounts is not None:
        keys += remaining_accounts
    identifier = b")$\xd8\xf5\x1bUgC"
    encoded_args = layout.build(
        {
            "bundle_index": args["bundle_index"],
        }
    )
    data = identifier + encoded_args
    return Instruction(program_id, data, keys)

Classes

class CloseBundledPositionAccounts (*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 CloseBundledPositionAccounts(typing.TypedDict):
    bundled_position: Pubkey
    position_bundle: Pubkey
    position_bundle_token_account: Pubkey
    position_bundle_authority: Pubkey
    receiver: Pubkey

Ancestors

  • builtins.dict

Class variables

var bundled_position : solders.pubkey.Pubkey
var position_bundle : solders.pubkey.Pubkey
var position_bundle_authority : solders.pubkey.Pubkey
var position_bundle_token_account : solders.pubkey.Pubkey
var receiver : solders.pubkey.Pubkey
class CloseBundledPositionArgs (*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 CloseBundledPositionArgs(typing.TypedDict):
    bundle_index: int

Ancestors

  • builtins.dict

Class variables

var bundle_index : int