Options
All
  • Public
  • Public/Protected
  • All
Menu

Dex is a wrapper class for a deployed Serum Dex program.

Hierarchy

  • Dex

Index

Constructors

  • new Dex(address: PublicKey, connection: Connection): Dex
  • Parameters

    • address: PublicKey
    • connection: Connection

    Returns Dex

Properties

_address: PublicKey
_coins: Coin[]
_connection: Connection
_markets: DexMarket[]

Accessors

  • get address(): PublicKey
  • get connection(): Connection

Methods

  • createCoin(symbol: string, decimals: number, payer: Keypair, mintAuthority: Keypair, freezeAuthority: null | Keypair, keypair?: Keypair): Promise<Coin>
  • Create a Coin object to be associated with the Dex.

    Parameters

    • symbol: string

      The symbol of the coin to create

    • decimals: number

      The decimals of the coin to create

    • payer: Keypair

      The payer Keypair to use for the transactions

    • mintAuthority: Keypair

      The optional mint authority Keypair to use for the mint

    • freezeAuthority: null | Keypair

      The optionals freeze authority Keypair to use for the mint

    • Optional keypair: Keypair

      The optional keypair for the Mint to be created, defaults to a random one

    Returns Promise<Coin>

  • getCoin(symbol: string): null | Coin
  • Fetch one of the Coin objects associated with the Dex by symbol.

    Parameters

    • symbol: string

      The symbol of the coin to fetch

    Returns null | Coin

  • Fetch a DexMarket object associated with the Dex by the base coin and quote coin.

    Parameters

    • baseCoin: Coin

      The base Coin of the market to fetch

    • quoteCoin: Coin

      The quote Coin of the market to fetch

    Returns null | DexMarket

  • Initialize a DexMarket instance associated with the Dex.

    Parameters

    • payer: Keypair

      The payer Keypair to use for the transactions

    • baseCoin: Coin

      The base Coin of the market to create

    • quoteCoin: Coin

      The quote Coin of the market to create

    • marketParams: MarketParams

      The parameters required to create the market

    Returns Promise<DexMarket>

  • Runs a crank on a separate node process for the given DexMarket for specified duration.

    Parameters

    • market: DexMarket

      The DexMarket to run a crank for

    • owner: FileKeypair

      The owner FileKeypair consuming events.

    • opts: CrankOpts

      The crank options used

    Returns ChildProcess

  • Runs a Market Making on a separate node process for durationInSecs seconds.

    Parameters

    • market: DexMarket

      The DexMarket to run market maker on

    • owner: FileKeypair

      The owner Keypair to use for the market making.

    • opts: MarketMakerOpts

      The market making options used.

    Returns ChildProcess

Generated using TypeDoc