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
Namespaces
Enumerations
Type aliases
NetworkInfo
Ƭ NetworkInfo: Object
Type declaration
Name | Type |
---|---|
|
|
|
|
Defined in
OptionMarket
Ƭ OptionMarket: Object
Type declaration
Name | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Defined in
OptionMarketWithKey
Ƭ OptionMarketWithKey: OptionMarket
& { key
: PublicKey
}
Defined in
OrderParamsWithFeeRate
Ƭ OrderParamsWithFeeRate<T
>: OrderParams
<T
> & { feeRate?
: number
}
Type parameters
Name |
---|
|
Defined in
PsyAmerican
Ƭ PsyAmerican: Object
Type declaration
Name | Type |
---|---|
| [{ |
| [{ |
| [{ |
|
|
|
|
Defined in
Variables
FEE_OWNER_KEY
• FEE_OWNER_KEY: PublicKey
The fee owner key for the Psy American program
Defined in
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
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
Name | Type |
---|---|
| |
| |
|
Defined in
PsyAmericanIdl
• PsyAmericanIdl: Idl
The Anchor IDL for the Psy American program. Used when creating an Anchor Program.
Copy
Defined in
Functions
chunkArray
▸ Const
chunkArray(myArray
, chunkSize
): any
[][]
Returns an array with arrays of the given size.
Parameters
Name | Type | Description |
---|---|---|
|
| Array to split |
|
| Size of every group |
Returns
any
[][]
Defined in
deriveOptionKeyFromParams
▸ Const
deriveOptionKeyFromParams(__namedParameters
): Promise
<[PublicKey
, number
]>
Get the deterministic address for an Option based on its properties.
Parameters
Name | Type | Description |
---|---|---|
|
| - |
|
| The OptionMarket expiration timestamp in seconds |
|
| The Psy American program ID |
|
| The quote asset amount per option contract |
|
| The quote asset mint address |
|
| The underlying asset amount per option contract |
|
| The underlying asset mint address |
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
Name | Type | Description |
---|---|---|
|
| Quantity of the asset being used to mint or exercise |
Returns
BN
Defined in
getAllOptionAccounts
▸ Const
getAllOptionAccounts(program
): Promise
<OptionMarketWithKey
[]>
Load all OptionMarkets owned by the given program from the blockchain.
Parameters#
Name | Type | Description |
---|---|---|
|
| Anchor Psy American program |
Returns
Promise
<OptionMarketWithKey
[]>
Defined in
getOptionByKey
▸ Const
getOptionByKey(program
, key
): Promise
<OptionMarketWithKey
>
Parameters
Name | Type |
---|---|
|
|
|
|
Returns
Promise
<OptionMarketWithKey
>
Defined in
getOrAddAssociatedTokenAccountTx
▸ Const
getOrAddAssociatedTokenAccountTx(associatedAddress
, mintKey
, provider
, owner?
): Promise
<TransactionInstruction
>
Returns a TransactionInstruction for creating the associated token account if one deos not exist.
Parameters
Name | Type | Description |
---|---|---|
|
| The associated token account address |
|
| The SPL token mint address |
|
| The Anchor provider that has the wallet |
|
| The user's address that owns the associated token account |
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
Name | Type |
---|---|
|
|
|
|
Returns
Promise
<[PublicKey
, BN
]>
Defined in
utils/getVaultOwnerAndNonce.ts:13
parseTransactionError
▸ Const
parseTransactionError(error
): ProgramError
Parameters
Name | Type |
---|---|
|
|
Returns
ProgramError
Defined in
Last updated