PsyFi Documentation
  • Welcome to PsyFi
    • Why use PsyFi?
    • PsyFi Product Suite
    • PsyVaults - Vaults Product
      • 🏗️Covered Calls & Secured Puts Vaults Architecture
      • 📶Leveraged Strategy Vaults (Call Spreads & Put Spreads) - Currently Paused
      • 💹Market Making Vaults - Currently Paused
      • 📚PsyVaults Resources
        • PsyFi Vault Contracts
      • 👩‍🏫PsyVaults Tutorials
        • 💵Weekly Bidding on V2 Vaults
        • 💰PsyVault Rewards
          • Auto-Deposit into PsyLend to Earn Rewards
          • Understanding Staking Rewards
          • Boosting your Staking Rewards
      • ❓PsyVaults FAQs
    • PsyLend - Structured Products Lending
      • 👩‍🎓Tutorials - Supplying & Borrowing
      • 🎰Supply & Interest Rate Calculations
      • 🅿️Lending Parameters
      • ⚒️Liquidations
      • 💰Rewards
      • ⚡Fees
      • *️Risks & Insurance Fund
      • PsyLend FAQs
      • PsyLend Glossary
  • PsyFi DAO Audits
    • Audits
  • Build with PsyFi
    • Options Protocol
      • American Style Options
      • Tokenized European Style Options
      • Under-Collateralized European Style Options
      • PsyOptions FAQ
    • Fusion - Airdropping Options - Deprecated
      • 👩‍🏫Fusion Tutorials
        • Users: Option Rewards and What You Can Do With Them
        • Users: Claiming Airdrops Through Fusion
    • Developers
      • Program Integration
      • Client Integration
        • Namespace: instructions
        • Namespace: serumInstructions
        • Namespace: serum utils
        • Enumeration: ClusterName
        • Enumeration: ProgramVersions
        • Class: Validation
      • PsyFi DAO Contributor Support
    • Designers
      • Logos
      • Fonts
  • Options Education
    • Styles of Options
    • Calls & Puts
    • Option Strategies
    • Glossary
  • PSY Token & DAO
    • PSY Tokenomics
      • PSY Token Unlock Schedule
    • Governance Infrastructure & Tokenomics
    • Governance Parameters
    • PSY 2.0: PSY Stake and DeMux Overview [RFC]
    • Governance Tutorials
      • Governance Overview & Walkthrough
      • Initializing a Proposal Using Poseidon [RFC]
      • PsyOptions Protocol Governance Actions
      • Voter Stake Registry Set Up
        • How to Lock Your Own Tokens
        • How to Propose Issuing Locked Tokens
        • How to Propose Clawing Back Granted Tokens
      • PSY 2.0 - How to Stake Your PSY to Start Participating in PSY 2.0 Governance
      • PSY 2.0 - How to Claim Rewards For Staked PSY
      • PSY 2.0 - How to Setup a RewardPool
      • PSY 2.0 - How to perform DeMuX Actions on Reward Pools [RFC]
      • PSY 2.0 - How to view tokens that are sent to DeMux [RFC]
    • Governance FAQ
      • 🐛PSY DAO Bug Bounty
    • Poseidon [RFC]
    • PsyFi DAO Contributors
Powered by GitBook
On this page
  1. Build with PsyFi
  2. Developers
  3. Client Integration

Namespace: serum utils

PreviousNamespace: serumInstructionsNextEnumeration: ClusterName

Last updated 3 years ago

Functions

deriveCoinVault

▸ Const deriveCoinVault(program, optionMarketKey, priceCurrencyKey): Promise<[PublicKey, number]>

Parameters

Name
Type

program

optionMarketKey

PublicKey

priceCurrencyKey

PublicKey

Returns

Promise<[PublicKey, number]>

Defined in

deriveMarketAuthority

▸ Const deriveMarketAuthority(program, dexProgramId, serumMarketKey): Promise<[PublicKey, number]>

Parameters

Name
Type

program

dexProgramId

PublicKey

serumMarketKey

PublicKey

Returns

Promise<[PublicKey, number]>

Defined in

derivePCVault

▸ Const derivePCVault(program, optionMarketKey, priceCurrencyKey): Promise<[PublicKey, number]>

Parameters

Name
Type

program

optionMarketKey

PublicKey

priceCurrencyKey

PublicKey

Returns

Promise<[PublicKey, number]>

Defined in

deriveRequestQueue

▸ Const deriveRequestQueue(program, optionMarketKey, priceCurrencyKey): Promise<[PublicKey, number]>

Parameters

Name
Type

program

optionMarketKey

PublicKey

priceCurrencyKey

PublicKey

Returns

Promise<[PublicKey, number]>

Defined in

deriveSerumMarketAddress

▸ Const deriveSerumMarketAddress(program, optionMarketKey, priceCurrencyKey): Promise<[PublicKey, number]>

Parameters

Name
Type

program

optionMarketKey

PublicKey

priceCurrencyKey

PublicKey

Returns

Promise<[PublicKey, number]>

Defined in

findOpenOrdersAccountsForOwner

▸ Const findOpenOrdersAccountsForOwner(program, dexProgramId, serumMarketAddress): Promise<OpenOrders[]>

Load the open orders for a user based on the Serum DEX and Serum Market address.

Parameters

Name
Type
Description

program

Anchor Psy American program

dexProgramId

PublicKey

Serum DEX program id

serumMarketAddress

PublicKey

Serum market address

Returns

Promise<OpenOrders[]>

Defined in

findOpenOrdersForOptionMarkets

▸ Const findOpenOrdersForOptionMarkets(program, serumProgramId, optionMarketKeys, priceCurrencyKey, optionMetaList?): Promise<Record<string, OpenOrders>>

Load all the open orders for a user based on the Serum DEX and the option market keys.

Parameters

Name
Type
Description

program

Anchor Psy American program

serumProgramId

PublicKey

Serum DEX program id

optionMarketKeys

PublicKey[]

Keys for the Psy American OptionMarket's to load the open orders from

priceCurrencyKey

PublicKey

Key of the pc (aka quote currency) from the serum markets

optionMetaList?

{ expiration: number ; optionContractMintAddress: string ; optionMarketAddress: string ; optionWriterTokenMintAddress: string ; psyOptionsProgramId: string ; quoteAssetMint: string ; quoteAssetPerContract: string ; quoteAssetPoolAddress: string ; serumMarketAddress: string ; serumProgramId: string ; underlyingAssetMint: string ; underlyingAssetPerContract: string ; underlyingAssetPoolAddress: string }[]

Optional list of option meta data to pull serum market data from instead of deriving the address. This is for backwards compatibility

Returns

Promise<Record<string, OpenOrders>>

Defined in

getMarketAndAuthorityInfo

▸ Const getMarketAndAuthorityInfo(program, optionMarketKey, dexProgramId, priceCurrencyKey): Promise<Object>

Given an OptionMarket address and DEX program, generate the Serum market key, market authority, and authority bump seed.

Parameters

Name
Type
Description

program

PsyOptions American V1 Anchor program

optionMarketKey

PublicKey

The key for the OptionMarket

dexProgramId

PublicKey

Serum DEX public key

priceCurrencyKey

PublicKey

-

Returns

Promise<Object>

Defined in

Program<>

Program<>

Program<>

Program<>

Program<>

Program<>

Program<>

Program<>

serumUtils.ts:201
serumUtils.ts:177
serumUtils.ts:215
serumUtils.ts:187
serumUtils.ts:162
serumUtils.ts:19
serumUtils.ts:74
serumUtils.ts:237
PsyAmerican
PsyAmerican
PsyAmerican
PsyAmerican
PsyAmerican
PsyAmerican
PsyAmerican
PsyAmerican