Specifications

sanctumpy.sanctum.SanctumClient

Setup

__init__(private_key=None, network='devnet')

The constructor sets up the client. It allows you to set your Sanctum Trade API key, your wallet private key to perform operations and the Solana network where transactions are set.

Parameters:
  • api_key (str) –

    The Sanctum Trade API authentication key.

  • private_key (str, default: None ) –

    Your wallet private key.

  • network (str, default: 'devnet' ) –

    The Solana network to use.

Data

get_infinity_infos()

Retrieve the main information about the INF token.

Returns:
  • dict –

    Sanctum Infinity information.

get_lst_apy(lst, epochs=None, latest=True)

Retrieve APY inception data for specified tokens.

Parameters:
  • lst (str) –

    The LST token symbol or address.

Returns:
  • float –

    APY inception data for the specified tokens.

get_lst_sol_value(lst)

Retrieve the SOL value of the specified LST.

Parameters:
  • lst (str) –

    The LST token symbol or address.

Returns:
  • float –

    The SOL value of the specified LST.

get_lst_tvl(lst)

Retrieve the TVL of the specified LST.

Parameters:
  • lst (str) –

    The LST token symbol or address.

Returns:
  • float –

    The TVL of the specified LST.

get_lst_infos(lst)

Retrieve the information of the specified LST.

Parameters:
  • lst (str) –

    The LST token symbol or address.

Returns:
  • dict –

    The information of the specified LST (apy, sol_value, tvl).

get_metadata(lst_mint)

Retrieve the metadata of the specified LST.

Parameters:
  • lst_mint (str) –

    The LST token mint.

get_price(lst_mint)

Retrieve the price of the specified LST.

Parameters:
  • lst_mint (str) –

    The LST token mint.

get_quote(from_token, to_token, amount, mode='ExactIn', swap_src=None)

Retrieve the quote for the specified token.

Parameters:
  • from_token (str) –

    The token to sell.

  • to_token (str) –

    The token to buy.

  • amount (float) –

    The amount to sell.

add_liquidity(amount, lst_mint=SOL_ADDRESS, run=False)

Add liquidity to the specified LST.

Parameters:
  • lst_mint (str, default: SOL_ADDRESS ) –

    The LST token mint.

  • amount (float) –

    The amount to add.

remove_liquidity(amount, lst_mint=SOL_ADDRESS, run=False)

Remove liquidity from the specified LST.

Parameters:
  • lst_mint (str, default: SOL_ADDRESS ) –

    The LST token mint.

  • amount (float) –

    The amount to remove.

swap_tokens(from_token, to_token, amount, mode='ExactIn', swap_src='Jup')

Swap tokens from the specified token to the specified token.

Parameters:
  • from_token (str) –

    The token to sell.

  • to_token (str) –

    The token to buy.

  • amount (float) –

    The amount to sell.

  • mode (str, default: 'ExactIn' ) –

    The mode of the swap (ExactIn or ExactOut).

  • swap_src (str, default: 'Jup' ) –

    The source of the swap (Spool, Stakedex, Jup).

Trading

add_liquidity(amount, lst_mint=SOL_ADDRESS, run=False)

Add liquidity to the specified LST.

Parameters:
  • lst_mint (str, default: SOL_ADDRESS ) –

    The LST token mint.

  • amount (float) –

    The amount to add.

remove_liquidity(amount, lst_mint=SOL_ADDRESS, run=False)

Remove liquidity from the specified LST.

Parameters:
  • lst_mint (str, default: SOL_ADDRESS ) –

    The LST token mint.

  • amount (float) –

    The amount to remove.

swap_tokens(from_token, to_token, amount, mode='ExactIn', swap_src='Jup')

Swap tokens from the specified token to the specified token.

Parameters:
  • from_token (str) –

    The token to sell.

  • to_token (str) –

    The token to buy.

  • amount (float) –

    The amount to sell.

  • mode (str, default: 'ExactIn' ) –

    The mode of the swap (ExactIn or ExactOut).

  • swap_src (str, default: 'Jup' ) –

    The source of the swap (Spool, Stakedex, Jup).