← Contract Hero · WorkLearnPlugins
acc-deepbook-course
All lessons Lesson 1 · DeepBook track

Place & Manage Orders

Trade through a DeepBook BalanceManager. Create and share the on-chain escrow account, deposit funds, rest a limit bid on the book, list and cancel it, then fire a market buy that fills immediately.

createAndShareBalanceManager depositIntoManager placeLimitOrder placeMarketOrder cancelAllOrders
What you'll learn

The account model behind every order

  • ›The BalanceManager lifecycle: create it, share it on chain, then register it with the client so later calls can find it.
  • ›Resting a limit order that sits on the book versus taking with a market order that fills now.
  • ›Settled versus owed reconciliation: the difference between what an order moved and what you can actually withdraw.
Walkthrough

Five sections, end to end

  1. Open the account

    The BalanceManager create, share, then re-extend sequence that registers the account with your client.

    src/sandbox.ts
  2. Deposit & rest

    Fund the BalanceManager, then place a bid priced to rest on the book instead of filling immediately.

    src/orders.ts
  3. Inspect & cancel

    Read your open order IDs back from the chain, then clear the book with a single cancel-all.

    src/orders.ts
  4. Take liquidity

    Fire a market buy that fills immediately, and reconcile the settled balance against what is owed.

    src/orders.ts
  5. Drive it

    Wire the smoke UI, handle the sandbox warmup retry, and pass the live test gate.

    src/App.tsx · src/main.tsx
Run it

Start this lesson

claude code
/acc-deepbook-course:start
# then pick "Place & Manage Orders"

Already installed? Run the start command and choose this lesson from the catalog.

New here? Follow the install steps first. The course brings up a local sandbox and gates each section with pnpm vitest run.