diff --git a/ts/scripts/marketFilter.ts b/ts/scripts/marketFilter.ts index d087b73..61770d7 100644 --- a/ts/scripts/marketFilter.ts +++ b/ts/scripts/marketFilter.ts @@ -6,7 +6,6 @@ import { ParsedAccountData, PublicKey, } from "@solana/web3.js"; -import BN from "bn.js"; import { Dex, DexMarket, FileKeypair } from "../src"; const main = async () => { @@ -44,8 +43,6 @@ const main = async () => { const market = await dex.initDexMarket(owner.keypair, baseCoin, quoteCoin, { lotSize: 1e-3, tickSize: 1e-2, - feeRate: 10, - quoteDustThreshold: new BN(100), }); console.log( diff --git a/ts/src/dex.ts b/ts/src/dex.ts index 96f9d00..0b0b501 100644 --- a/ts/src/dex.ts +++ b/ts/src/dex.ts @@ -32,7 +32,7 @@ export type MarketParams = { * @param baseGeckoSymbol The symbol used by CoinGecko for the base coin. * @param quoteGeckoSymbol The symbol used by CoinGecko for the quote coin. */ -type MarketMakerOpts = { +export type MarketMakerOpts = { // unref: boolean; durationInSecs: number; orderCount: number; diff --git a/ts/src/market.ts b/ts/src/market.ts index 925df4b..cff47da 100644 --- a/ts/src/market.ts +++ b/ts/src/market.ts @@ -38,15 +38,15 @@ export interface MarketAccounts { * A wrapper class around `serum-ts`'s `Market` class. */ export class DexMarket { - public address: PublicKey; + private _address: PublicKey; - public serumMarket: Market; + private _serumMarket: Market; - public baseCoin: Coin; + private _baseCoin: Coin; - public quoteCoin: Coin; + private _quoteCoin: Coin; - public marketSymbol: string; + private _marketSymbol: string; constructor( address: PublicKey, @@ -54,11 +54,31 @@ export class DexMarket { baseCoin: Coin, quoteCoin: Coin, ) { - this.address = address; - this.serumMarket = serumMarket; - this.baseCoin = baseCoin; - this.quoteCoin = quoteCoin; - this.marketSymbol = `${baseCoin.symbol}/${quoteCoin.symbol}`; + this._address = address; + this._serumMarket = serumMarket; + this._baseCoin = baseCoin; + this._quoteCoin = quoteCoin; + this._marketSymbol = `${baseCoin.symbol}/${quoteCoin.symbol}`; + } + + public get address() { + return this._address; + } + + public get serumMarket() { + return this._serumMarket; + } + + public get baseCoin() { + return this._baseCoin; + } + + public get quoteCoin() { + return this._quoteCoin; + } + + public get marketSymbol() { + return this._marketSymbol; } /** @@ -427,6 +447,19 @@ export class DexMarket { return txSig; } + static async getOrdersForOwner( + owner: Keypair, + serumMarket: SerumMarket, + connection: Connection, + ): Promise { + const orders = await serumMarket.loadOrdersForOwner( + connection, + owner.publicKey, + ); + + return orders; + } + static async getOrCreateOpenOrderAccount( owner: Keypair, serumMarket: SerumMarket,