marginpy.utils.misc module

load_idl(idl_path: Optional[str] = None) Idl
handle_override(override_key: str, default: Any, overrides: Dict[Any, Any] = {})
async get_or_create_ata(rpc_client: AsyncClient, payer_keypair: Keypair, mint_pk: PublicKey, owner: Optional[PublicKey] = None) PublicKey

Idempotent ATA helper that creates the owner’s ATA if it does not exist yet, and returns its address

Parameters
  • rpc_client (AsyncClient) – RPC client

  • owner_keypair (Keypair) – keypair of ATA owner

  • mint_pk (PublicKey) – ATA mint

Returns

ATA address

Return type

PublicKey