Client Integration

Public packages

Javascript instruction bindings can be found under @mithraic-labs/psyoptions

A Rust crate will be supported soon to help with Cross Program Invocations!

Rust

Coming soon.

Javascript

American Style Options

@mithraic-labs/psy-american

Installation

yarn add @mithraic-labs/psy-american

Namespaces

Enumerations

Type aliases

NetworkInfo

Ƭ NetworkInfo: Object

Type declaration

Defined in

types.ts:14

OptionMarket

Ƭ OptionMarket: Object

Type declaration

Defined in

types.ts:19


OptionMarketWithKey

Ƭ OptionMarketWithKey: OptionMarket & { key: PublicKey }

Defined in

types.ts:35


OrderParamsWithFeeRate

Ƭ OrderParamsWithFeeRate<T>: OrderParams<T> & { feeRate?: number }

Type parameters

Defined in

types.ts:39


PsyAmerican

Ƭ PsyAmerican: Object

Type declaration

Defined in

psyAmericanTypes.ts:1

Variables

FEE_OWNER_KEY

FEE_OWNER_KEY: PublicKey

The fee owner key for the Psy American program

Defined in

fees.ts:6

NFT_MINT_LAMPORTS

NFT_MINT_LAMPORTS: number

The number of lamports the protocol takes as a fee when minting or exercising an option on an asset that cannot take a 5bps fee. E.g a minting a call option on an NFT

Defined in

fees.ts:13

PSY_AMERICAN_PROGRAM_IDS

PSY_AMERICAN_PROGRAM_IDS: Object

All prior Psy American programIds for all networks so clients that require backwards compatability can maintain it.

Type declaration

Defined in

programIds.ts:7

PsyAmericanIdl

PsyAmericanIdl: Idl

The Anchor IDL for the Psy American program. Used when creating an Anchor Program.

const program = new Program(PsyAmericanIdl, psyAmericanProgramId, provider);

Copy

Defined in

index.ts:25

Functions

chunkArray

Const chunkArray(myArray, chunkSize): any[][]

Returns an array with arrays of the given size.

Parameters

Returns

any[][]

Defined in

utils/chunkArray.ts:7

deriveOptionKeyFromParams

Const deriveOptionKeyFromParams(__namedParameters): Promise<[PublicKey, number]>

Get the deterministic address for an Option based on its properties.

Parameters

Returns

Promise<[PublicKey, number]>

Defined in

utils/deriveOptionKeyFromParams.ts:8

feeAmountPerContract

Const feeAmountPerContract(assetQuantity): BN

Get the protocol's fee amount when minting or exercising. When minting this should be the underlingAmountPerContract. When exercising this should be the quoteAmountPerContract.

Parameters

Returns

BN

Defined in

fees.ts:23

getAllOptionAccounts

Const getAllOptionAccounts(program): Promise<OptionMarketWithKey[]>

Load all OptionMarkets owned by the given program from the blockchain.

Parameters#

Returns

Promise<OptionMarketWithKey[]>

Defined in

OptionMarket.ts:11

getOptionByKey

Const getOptionByKey(program, key): Promise<OptionMarketWithKey>

Parameters

Returns

Promise<OptionMarketWithKey>

Defined in

utils/getOptionByKey.ts:6

getOrAddAssociatedTokenAccountTx

Const getOrAddAssociatedTokenAccountTx(associatedAddress, mintKey, provider, owner?): Promise<TransactionInstruction>

Returns a TransactionInstruction for creating the associated token account if one deos not exist.

Parameters

Returns

Promise<TransactionInstruction>

Defined in

utils/getOrAddAssociatedTokenAccountTx.ts:20

getVaultOwnerAndNonce

Const getVaultOwnerAndNonce(marketPublicKey, dexProgramId): Promise<[PublicKey, BN]>

This is needed for the permissioned serum markets.

TODO can we replace this with PublicKey.findProgramAddress

Parameters

Returns

Promise<[PublicKey, BN]>

Defined in

utils/getVaultOwnerAndNonce.ts:13

parseTransactionError

Const parseTransactionError(error): ProgramError

Parameters

Returns

ProgramError

Defined in

utils/parseTransactionErrors.ts:6

Last updated