Skip to main content
This page goes from an empty file to a priced, gated open — reading only, sending nothing. It is the sequence every client performs before it shows anyone a button. For a bot that also sends, start with the Quickstart.
Everything here is a read. No keys, no signatures, nothing spent. Sending is the next page.

1. Read the protocol

Three accounts describe the whole system: the config (every governed parameter), the vault (the pool), and one market per asset. Their addresses are derived locally, so you never have to trust an address printed on a web page.
read-protocol.ts
Never cache config.params. Every field in it is governed and can move on chain without a program upgrade. Re-read it, and show the reader how old your copy is.

2. Read how the market is priced

An instruction that reads a price carries a signed quote inside the transaction, not a price account you can read, so a read-only client has no price to fetch from the chain. What it can read is the shape of the market’s oracle: which kind it is, and the floors a settle or a stamp_book must clear.
read-oracle.ts
Quotes and freshness is the reference for the quote itself: how a transaction carries it, and the checks the program applies.

3. Price the open before you offer it

openPreview answers everything a trader needs to see, for the exact terms they are about to take, at the parameters currently in force.
preview.ts
Show barrierPayout next to the confirm button, at the same visual weight as the payout you are excited about — see the venue.

4. Ask what would refuse it

Before you build a transaction, ask the SDK which gate would stop it. openGates evaluates the refusals the program raises for an open, in the program’s order.
An open carries no quote: the fill judges the price, and the price rows do not decide the order. See orders and closes. The checks a quote meets are in quotes and freshness.
what-would-refuse.ts
Building the OpenContext and rendering the whole table is the next page.

5. Put it together

summary.ts

What you have, and what you do not

You now have every number a trader needs to decide, read from chain rather than typed, and every refusal that could stop the trade, before you send anything. What you do not have yet is a signature. An open, an add and a close request carry no price, so there is no quote to obtain for them: see orders and closes. A settle, a stamp_book and set_take_profit carry a signed quote in the same transaction, and a quote’s age is judged at execution, against a governed bound of a small number of slots. Who signs, and how fast, decides whether one of those lands at all. Read session keys before you write the send path.

Session keys

Who signs a trade, and how the program’s session-key delegate works.

Quotes and freshness

What a quote is, why 6007 happens, and how to handle it without lying to the trader.

Reading gates

Build the context, render the table, and explain a refusal properly.

Opening a position

Build the order, size it, simulate, send, and read its sequence number.