Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract away details in placeOrder #183

Open
metaproph3t opened this issue Oct 24, 2023 · 2 comments
Open

Abstract away details in placeOrder #183

metaproph3t opened this issue Oct 24, 2023 · 2 comments

Comments

@metaproph3t
Copy link
Collaborator

Today, it's a bit cumbersome to specify all of the fields in PlaceOrderArgs and the other fields that placeOrder takes

It would be nice to have a placeOrder interface that looks something like:

public async placeOrder(
      market: PublicKey,
      side: Side,
      priceLots: BN,
      maxBaseLots: BN,
      maxQuoteLots: BN,
      orderType: OrderType,
      expiryTimestamp: BN = new BN(0),
      selfTradeBehavior: SelfTradeBehavior = SelfTradeBehavior.DecrementTake,
      limit: number = 255,
      userTokenAccount?: PublicKey,
      clientOrderId?: BN,
   ): Promise<BN>
  • openOrdersAccount could be set by a call .setOpenOrdersAccount() on the client
  • the MarketAccount could be pulled either from on-chain or from a cache
  • if userTokenAccount isn't provided, default could be associated token account for the user's public key
  • clientId could start at 0 and increment each time, unless explicitly specified, and be returned by the function

that way, you would only need to specify 5 params instead of 15

@wiseaidev
Copy link
Contributor

Solved this issue in openbook, you only need 3 params:
Screenshot from 2024-06-11 08-12-09

Have a look at the ob_client module for more info about the refactor i did to the client code.

@cxp-13
Copy link

cxp-13 commented Aug 15, 2024

Solved this issue in openbook, you only need 3 params: Screenshot from 2024-06-11 08-12-09在openbook中解决了这个问题,你只需要3个参数:

Have a look at the ob_client module for more info about the refactor i did to the client code.查看 ob_client 模块,了解有关我对客户端代码进行的重构的更多信息。

why don't fix it on this repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants