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

✨ Feature: Add streamlined process for finding and cancelling open orders #225

Open
ericsharma opened this issue Aug 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@ericsharma
Copy link
Collaborator

ℹ Overview

Order Execution for placing an order:

    const execute = composePromise(
        ()=>resOrders,
        (txns)=>_sendTransactions(this.algod, txns),
        (orders)=>{
          resOrders = orders;
          return wallet.connector.sign(orders, wallet?.connector?.sk);
        },
        (o)=>structure(this, o),
    );

Order execution for closing an order:

    const execute = composePromise(
        () => resOrders,
        (txns) => _sendTransactions(this.algod, txns),
        (orders) => {
          resOrders = orders;
          return order.wallet.connector.sign(orders, order.wallet?.connector?.sk);
        },
        (o) => structure(this, o),
    );

First thing to note: For placing an order we use the wallet set on the API. For closing an order we use the wallet set on the order. Why can't we use the wallet set on the API for closing an order?

Right now, the process for finding and cancelling an order can be done in many ways. A rough example below:

  const openOrders = await api.http.dexd.fetchOrders("wallet", order.address)

  const mappedOpenOrders = openOrders.map((order) => {
    return { ...order, wallet: api.wallet }
  })

  await api.closeOrder(mappedOpenOrders[0])

For easier to use canceling we should:

  1. discuss the composition of the closeOrder promise in respect to order.wallet
  2. Expose an easy to use method for finding and cancelling orders.
@ericsharma ericsharma added the enhancement New feature or request label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant