Appearance
Migrating to SDK v12
SDK v12 is the current release line, and the one every spot maker should run. Since v10 there is one package per language, the spot DEX lives under a spot namespace, its clients are split into a public Client and an authenticated Maker, and typed methods replace the raw protobuf requests. There are no deprecated aliases: every renamed name below fails to import until you change it. Wire formats, endpoints, the SWEETSPOT-AUTH-V1: signing prefix and the program are unchanged, so an old bot and a v12 bot can run side by side during the switch.
This page covers what spot DEX users need. MIGRATION.md at the root of the SDK repository has the complete tables for every language, including the margin exchange.
Where you are starting from
Your bot reports its SDK in the x-flint-sdk header (rust/1.7.12, python/9.2.0); the lockfile (Cargo.lock, uv.lock) or pip show says the same.
| You run | What to do |
|---|---|
| 10.x or 11.x | Change the version to 12. No spot name was removed or renamed; see From 10 or 11. |
| 9.x | Follow this page: new package, renames, then the behaviour changes. |
| 1.x to 8.x | The same, with the extra notes in From 1.x to 8.x. |
Before you switch a live bot
Three changes alter what a quoting bot does on chain or on shutdown. Each is described under Behaviour changes to check:
- Quote prices between two ticks now round away from the touch, so some of your quotes move by under one tick.
- A params update that does not set
enablekeeps the market's last flag instead of re-enabling it. - Closing the SDK sends nothing: quotes stay live until they expire unless you commit a disable first.
Run the new bot on devnet first (Cluster.devnet(), same code), then move one market or a small size on mainnet before the rest.
Requirements
| Language | Needs |
|---|---|
| Rust | Rust 1.97.1 or newer, edition 2024. The SDK builds against the Solana 3.x and 4.x interface crates (solana-sdk 4), so a bot that pins older Solana crates has to move with it. |
| Python | Python 3.10 or newer, protobuf 7.35.1+, grpcio 1.85.1+, solders 0.29+. |
| TypeScript | Node 20.18 or newer; @solana/kit 8 and bignumber.js 10 as peer dependencies. |
The read-only token from the Developer tab of the dashboard pulls flint-sdk from both the Rust and the Python registry. If an older token is refused, take a fresh one from that tab.
Packages
| Language | v9 and earlier | v12 |
|---|---|---|
| Rust | flint-api-client (Kellnr) | flint-sdk (Kellnr), library flint_sdk, spot under flint_sdk::spot |
| Python | flint-api-client (import flint) | flint-sdk (import flint), spot under flint.spot |
| TypeScript | @superis-labs/flint-api-client | @superis-labs/flint, spot under @superis-labs/flint/spot |
toml
# Pick the feature for what you use: "spot" (clients), "spot-quoting"
# (quoting, receipts, program helpers) or "spot-swap" (taking).
flint-sdk = { version = "12", registry = "kellnr", features = ["spot-quoting"] }sh
uv add "flint-sdk[quic]" # with the per-package index pin from the Python SDK pagesh
npm install @superis-labs/flint @bufbuild/protobuf @solana/kit bignumber.jsIn Rust, nothing from the spot DEX builds by default: the default features build the margin exchange's clients. Turn on spot, spot-quoting or spot-swap. In TypeScript, @solana/kit 8 and bignumber.js 10 are now peer dependencies.
In Python, keep pinning the package to Flint's index (explicit = true with uv, --index-url with pip) and never add it with --extra-index-url: see Python SDK: install.
What moved where
| Area | Python | Rust | TypeScript |
|---|---|---|---|
| Public client (market data, stats, nodes) | flint.spot.Client | flint_sdk::spot::Client | Client from /spot |
| Authenticated maker client | flint.spot.Maker | flint_sdk::spot::Maker | Maker from /spot |
| Endpoints, program ids, RPC URL | flint.Cluster | flint_sdk::Cluster | Cluster from the root |
| Quoting core and receipts | flint.spot.quoting | flint_sdk::spot::quoting | — (no QuotingCore in TypeScript) |
| Quote builders, units, PDAs, instructions | flint.spot.chain | flint_sdk::spot::chain | /spot/chain |
| Taker swaps and aggregators | flint.spot.swap | flint_sdk::spot::swap | /spot/swap |
| Generated protobuf | flint.proto.spot | flint_sdk::proto::spot | /proto/spot |
| Errors | flint.ApiError, AuthError, InputError, … | flint_sdk::Error | ApiError, StatusCode from the root |
Connecting
v9 had one spot Client that was both public and authenticated. In v12 the public half is spot.Client; spot.Maker authenticates while it connects and holds a client for the public calls. Every constructor takes a cluster: there is no mainnet default.
rust
use flint_sdk::Cluster;
use flint_sdk::spot::{Client, Maker};
let public = Client::mainnet();
let maker = Maker::connect(keypair.clone(), Cluster::mainnet()).await?;
let pairs = maker.client().pairs().await?;python
from flint import ApiKey, Cluster, spot
public = spot.Client.mainnet()
maker = await spot.Maker.connect(keypair, Cluster.mainnet())
reader = await spot.Maker.connect(ApiKey("org-api-key"), Cluster.mainnet(), maker_id=7)
markets = await maker.client.markets()ts
import { Client, Maker } from "@superis-labs/flint/spot";
import type { KeyPairSigner } from "@solana/kit";
declare const signer: KeyPairSigner;
const publicClient = Client.mainnet();
const signedIn = await Maker.connect({ cluster: "mainnet", signer });
const pairs = await signedIn.client.pairs();Python
| v9 | v12 |
|---|---|
flint.Client(endpoints, keypair, api_key=..., maker_id=...) | await flint.spot.Maker.connect(keypair or flint.ApiKey(key), cluster, maker_id=...) (authenticates) |
keywords auto_session_heartbeat, enable_quic, rpc_urls, identity | heartbeat, quic, solana_rpc_send, chain_source=flint.spot.ChainSource.from_urls(read, send, identity=...) |
Endpoints(public, auth, insecure) | flint.Cluster.custom(...); TLS follows the URL scheme (https:// or http://) and a bare host:port is rejected |
Client() for read-only use | flint.spot.Client.mainnet() / .devnet() / .connect(cluster) |
await client.authenticate() | done by Maker.connect; the session is maker.session |
client.list_markets() (a dict keyed by pair), MarketInfo | await maker.client.markets() → list[flint.spot.Market] (build a dict yourself if you need one) |
client.verify_program_id(program_id, rpc_url, expected_program_id=...) | await flint.spot.Client(cluster).verify_program_id(): checks cluster.spot_program_id against the node and the cluster's RPC; one client per RPC URL |
flint.ChainTip(blockhash, recommended_cu_price, last_valid_block_height) | flint.ChainTip(blockhash, last_valid_block_height, slot, recommended_cu_price, observed_at): construct it by keyword |
client.maker_balance(), maker_fills(), maker_stats(), other maker_* | maker.balance(), maker.fills() (a Pager), maker.stats(), … |
client.historical_fills(request), historical_candles(request) | typed client.historical_fills(...), client.historical_candles(...) on the public spot.Client (also on Maker) → Pager |
start_chain_tip, wait_ready, chain_tip, cached_chain_tip, current_slot | await maker.chain_tip() (starts the stream and waits), maker.slot() (cached, None before the first slot) |
submit_transaction, submit_transaction_receipt, submit_transactions | maker.submit, maker.submit_receipt, maker.submit_many |
client.start_quoting_core(program_id=...) | await maker.start_quoting(program_id=...) |
flint.QuotingCore, PendingTx, RetryConfig, TxSubmitter, Receipt*, Commit*, TxOutcome*, StrategySwitch | flint.spot.quoting.* |
OnChainFailure | flint.spot.quoting.CommitFailed |
flint.AuthFlow, flint.ApiKeyAuth, flint.AUTH_DOMAIN_PREFIX | flint.spot.KeypairAuthFlow, flint.ApiKey, flint.proto.spot.AUTH_DOMAIN_PREFIX |
flint.Endpoints, resolve_endpoints, MAINNET_*_ENDPOINT constants | flint.Cluster |
flint.api.rpc.ChainSource.from_urls | flint.spot.ChainSource.from_urls |
flint.ResilientStream, ConnectionState, metadata_from_error | watch_* methods returning Subscription; flint.streams.resilient; flint.ConnectionState; ApiError.server |
flint.onchain.* | flint.spot.chain.* (quoting.QuoteBuilder, units.human_to_oracle_for_quoting, types.CrossSpreadUpdate, …) |
QuoteMarket.from_market_info(info) | QuoteMarket.from_market(market) |
QuoteMarket(spot_index=...) | QuoteMarket(spot_id=...); CrossSpreadUpdate keeps spot_index |
flint.onchain.tx.sign_transaction / serialize_transaction | QuoteBuilder.sign_transactions, then maker.submit / submit_many |
flint.swap.* | flint.spot.swap.* (renames below) |
flint.gen.flint.spot.v1.* | flint.proto.spot.* |
Rust
| v9 | v12 |
|---|---|
flint_api_client::Client / ClientBuilder | flint_sdk::spot::Maker / MakerBuilder |
client.public() | maker.client() |
api::auth::{AuthFlow, AuthInterceptor, Wallet} | spot::KeypairAuthFlow, interceptor internal, flint_sdk::Wallet |
AuthedChannel + raw MakerServiceClient / TxServiceClient::with_interceptor | maker.raw().maker(), maker.raw().tx() (already authenticated), or maker.balance(..), maker.submit(tx) |
api::config::{refresh, ConfigCache, PairCatalogEntry} | maker.client().pairs(), spot::Catalog |
quoting::* (feature quoting) | spot::quoting::* (feature spot-quoting) |
swap::*, swap::aggregators (features quoting, aggregators) | spot::swap::* (feature spot-swap) |
rpc::{balance, catalog, chain}, market, pricing, quoting::lookup_table | spot::chain::{balance, catalog, units, lookup_tables}; spot::ChainSource |
subscribe_maker_fills, subscribe_maker_balance | maker.watch_fills(..), maker.watch_balance(..) → Subscription (a Stream) |
ChainTipStreams, ServerState, get_blockhash | maker.chain_tip().await, maker.slot() |
errors::{Error, Result}, tonic::Status from calls | flint_sdk::{Error, Result}; Error::Api carries the status code |
MarketIdentifierRef | spot::MarketRef |
PROTO_HASH, PROTO_REV, SDK_VERSION | proto::spot::PROTO_HASH, proto::PROTO_REV, flint_sdk::SDK_VERSION |
TypeScript
| v9 | v12 |
|---|---|
createClient / SuperisClient | Client from /spot |
createNodeClient, createEscalationClient | client.nodeInfo(); maker.pageTheTeam() |
createMakerClient, MakerClientOptions | await Maker.connect({ cluster, signer | apiKey | emailSession }) |
AuthFlow (email login), AuthFlowOptions | EmailAuthFlow, EmailAuthFlowOptions (the "sweetspot.session" storage key is unchanged, so signed-in users stay signed in) |
apiKeyInterceptor(key) | Maker.connect({ cluster, apiKey }) |
SessionStorage, Session | SessionStorage from the root, Session from /spot |
verifyProgramId, Config, PairCatalogEntry, resolveEndpoints | client.verifyProgramId(), Catalog, Cluster |
streamWithBackoff(factory, signal) | watch*() → Subscription; resilientStream(factory) from the root |
GrpcError, GrpcCode, asGrpcError | ApiError, StatusCode, ApiError.from(e) |
| service descriptors at the package root | @superis-labs/flint/proto/spot |
swap namespace / ./swap | @superis-labs/flint/spot/swap |
swap addresses, instructions, layout, token | @superis-labs/flint/spot/chain |
SWEETSPOT_PROGRAM_ID_DEVNET / _MAINNET, SWEETSPOT_PROGRAM_IDS | DEVNET_PROGRAM_ID, MAINNET_PROGRAM_ID, PROGRAM_IDS from /spot/chain |
SWEETSPOT_ERROR_* | errors.ErrorCode.* from /spot/chain |
Money values in models are BigNumber (bignumber.js) and timestamps are Date, instead of the protobuf { value } and { micros } wrappers.
Swap and aggregator renames
No public name contains "sweetspot" any more. The renames are the same in all three languages (camelCase in TypeScript):
| v9 | v12 |
|---|---|
require_sweetspot (request field) | require_flint_route |
uses_sweetspot, sweetspot_only | uses_flint, flint_only |
NoSweetspotRoute, NonSweetspotLeg | NoFlintRoute, NonFlintLeg |
SWEETSPOT_ROUTE_LABELS | FLINT_ROUTE_LABELS |
TITAN_SWEETSPOT_DEX | TITAN_FLINT_DEX (its value stays "SweetSpot", Titan's venue label) |
jupiter_flint_swap, encode_jupiter_flint_route | build_jupiter_route_swap (the lower-level jupiter_route_swap is private), encode_jupiter_route |
load_swap_markets, load_all_swap_markets | load_markets, load_all_markets |
AggregatorSwap.compile(...) (Python, Rust) | compile_aggregator_swap(swap, payer, blockhash) |
The direct-swap guard is now a delta measured inside the transaction (Lighthouse MemoryWrite before the swap, AssertAccountDelta after), so you no longer read the output balance first: output_balance_before (Rust's last DirectSwapParams::new argument, TypeScript outputBalanceBefore) is gone, and min_output_balance / minOutputBalance is min_amount_out / minAmountOut. min_amount_out must be positive unless you pass allow_unbounded (allowUnbounded). quote_exact_in / quote_exact_out take a required extra_fee_hbps (TypeScript { extraFeeHbps }; pass 0 when your venue adds none). Aggregator clients take an RPC (build_swap(rpc, request), quote_swap(rpc, request)), check the returned transaction against an allowlist and your request, and verify it against chain (verify_aggregator_swap) before compile_aggregator_swap accepts it; parse_jupiter_build / parse_titan_quote take the request instead of the taker. load_output_balance stays for your own bookkeeping. See Taking liquidity.
Behaviour changes to check
- Quote prices round away from the touch. Spot quoting used to round every human price to the on-chain grid half-up on both sides, so a bid or ask between two ticks could land half a tick more aggressive than asked. Bid prices now round down and ask prices round up: the oracle fair's buy and sell, the linear-distribution fair's buy and sell start and end, and order-list placements. A price already on the grid is unchanged; one between ticks moves by under one tick, always to the less aggressive side. Offsets, backoffs and the cross spread keep half-up. Order-list placements take the order's side: Python
order_list_place(..., side=)andorder_list_place_and_pop(..., side=), TypeScriptorderListPlace(market, side, order)andorderListPlaceAndPop; Rust orders already carry it. - No default network. Every client and maker takes a cluster. A cluster parsed from a URL has no Solana RPC URL; chain operations on it raise an input error naming
rpc_urlinstead of falling back to mainnet RPC. - Streams are
Subscriptions.watch_*methods return a subscription that reconnects with backoff on its own and exposes its connection state. Drop or close it to stop. - Paged reads are
Pagers. Maker fills, recent quotes and historical fills page by time cursor; iterate pages orcollect(). - Typed models. Prices and sizes are decimals (
Decimal,rust_decimal::Decimal,BigNumber) and timestamps are native date types, not{ value }/{ micros }wrappers. The raw protobuf types are still underproto.spotand therawstubs. - Errors. gRPC failures surface as
ApiErrorwithcode,messageand the server's diagnostics inserver, not as raw gRPC exceptions. - Custom clusters: no RPC standby, no spot program id. v9 fell back to public Solana RPCs (devnet ones for the hosted devnet URL, mainnet ones otherwise).
Cluster.custom(...)without an RPC URL has no standby; useCluster.devnet()/Cluster.mainnet()with overrides, or passrpc_url.Cluster.custom(...),Cluster.parse(url)andCluster.local(...)also leave the spot program id unset (v9 silently used mainnet's): pass it, or callwith_spot_program_id(id)(TypeScriptwithSpotProgramId); quoting,verify_program_id()and swap market loads raise an input error namingspot_program_idwithout it. - Watching the chain tip. v9's watchable
server_state.current_slot/.blockhashare internal.maker.watch_chain_tip()(TypeScriptwatchChainTip()) yields the currentChainTipand then every change, from the gateway streams or the RPC standby, whichever is live. - Receipts and submissions. A receipt whose commit had transactions that never left fails with
CommitNotSubmitted(count,reason; RustCommitError::NotSubmitted) instead of reporting landed, andsettled()lists those intents inuntracked_intents. Pythonsubmit_manyreturnsSubmitResult(receipt, failed). A params update that does not setenablekeeps the market's last flag instead of re-enabling it. Rust retries resend the same signed bytes, and QUIC sends never hold a submit. - Renames (D10).
Client.bookisorder_book(orderBook) andwatch_market_dataiswatch_order_book(watchOrderBook). NewMaker.submit_and_confirm(submitAndConfirm). - Swaps. The min-out guard is a delta checked inside the transaction (no
output_balance_before);min_amount_outmust be positive unless you setallow_unbounded;extra_fee_hbpsis required; aggregator responses are checked and verified against chain. - Errors.
TransportErrorkindexpiredmeans the transaction can no longer land (resend);timeoutmeans the outcome is unknown. Errors raised after signing carry the signature (Python and TypeScripterror.signature, Rusterror.signature()).Subscription.laggedcounts items a slow reader missed.KeypairAuthFlow.refresh()forces a new session. maker_volume_to_saturationis base volume.RiskParamstakes a human base-token volume, lowered to whole base lots, in all three languages; v9 Python and TypeScript took a quote-side notional.- Durations. Python durations are
timedelta, exceptReceipt.landed_within(timeout), which still takes seconds as afloat. - Closing does not pull quotes.
maker.close()sends nothing; commit a disable for every market and wait for it first. - TypeScript makers can sign in with a wallet signer (
Maker.connect({ signer })), submit transactions and stream the chain tip. They still have noQuotingCoreand no session heartbeat.
From 10 or 11
Change the version to 12 and rebuild. Between 10.0.1 and 12.3.0 no name under spot was removed or renamed in any language; versions 11 and 12 follow new deployments of the margin (perps) program, which a spot bot does not touch.
What a spot maker gains:
- 12.1.0 refit the fair-update compute-unit model to the live spot program (releases
v0.0.16tov0.0.18). Use 12.1.0 or later. - Makers that connect with an organization
ApiKeycan submit transactions, run the session heartbeat and read SpreadProtect; when the server refuses an API key's chain-tip streams the SDK polls the RPC for the tip. See API keys. - Receipts keep confirming over RPC after the transaction-status stream closes, and a feed stops resubscribing after a terminal authentication failure.
- TypeScript adds API-key management on
EmailAuthFlow(ApiKeyInfo), maker depth events and ordered external swap events.
Rust needs 1.97.1 or newer.
From 1.x to 8.x
Go straight to 12; there is no need to stop at 9 on the way. From 1.6 through 9.2 the spot SDK was the same package (flint-api-client in Rust and Python, import flint / flint_api_client) and its surface only grew, so the v9 names in the tables on this page are the names your bot uses:
- Python: every public class, function and signature at 1.6.8 and 7.0.1 is still there at 9.2.2; later versions only add names and defaulted keywords.
- Rust: of the public functions a quoting bot calls at 1.6.8, one changed by 9.2.2 (
QuotingCore::startgained a trailing argument), and one public field went away (QuotingCore.keypair, nowcore.keypair()andcore.fee_payer()). The repository's own maker examples are identical at 1.6.8 and 9.2.2.
Names the tables do not list, all Python:
| 1.x to 9.x | v12 |
|---|---|
client.open_tx_status_session(), start_tx_status() | maker.watch_tx_status() |
client.subscribe_spread_protect(), subscribe_quotes() | maker.watch_spread_protect(), maker.watch_quotes() |
client.start_session_heartbeat() | the heartbeat= option of Maker.connect (on by default) |
client.refresh_chain_tip(), wait_ready(), cached_current_slot() | await maker.chain_tip(), maker.slot() |
client.list_quoting_authorities(), list_quoter_sessions(), get_quote() | maker.quoting_authorities(), maker.quoter_sessions(), maker.quote() |
Behaviour that changed in 7.0.4 and 8.0, so it is new to you and not marked as a change in the v9 notes:
- Quotes go out as v1 transactions. Up to 7.x a mainnet bot sent legacy transactions. Since 8.0 the default is Solana v1: 4096-byte packets with the compute budget in the message header, three to four times as many quotes per transaction. Mainnet accepts them. In Python, passing
lookup_tables=now raises at commit unless you also passtx_version=TxVersion.V0; a Solana RPC you configure must accept v1. - The SDK falls back to Solana RPC when the server goes quiet. After 5 seconds of server silence it reads slot, blockhash and a priority fee from RPC, sends through RPC, and settles receipts from
getSignatureStatuses. With nothing configured it uses public endpoints. Endpoints you configure (solana_rpc,solana_rpc_send) receive every submit, not only during an outage. See Quoting through a server outage. - Rust QUIC is its own feature. Sends to the slot leaders were part of the default
rpcfeature; they now need thequicfeature, which is off by default. Python keeps the[quic]extra. - Rust quote inputs are
Decimal. Prices, sizes and risk parameters weref64through 9.2. - Lifetimes assume 200 ms slots (Rust).
commit_with_durationconverts a duration into slots; 1.x and 7.0 assumed 400 ms slots, so the same duration now asks for twice as many slots. - Bounded waits. A strategy switch waits at most 45 seconds for the params transaction to land (
RetryConfig.landing_timeout) and then fails without sending the fair. Python receipts settle from chain when the status stream drops instead of failing withCommitDisconnected, andstatus_stream_timeoutis gone.
What moves under you, beyond the code:
| Coming from | Rust toolchain | Solana crates | Python floors |
|---|---|---|---|
| 1.6 to 1.7 | 1.88 → 1.97.1 | solana-sdk 3 → 4 in your own Cargo.toml too | grpcio 1.83 → 1.85.1, solders 0.27 → 0.29 |
| 7.x to 9.x | 1.91 → 1.97.1 | already solana-sdk 4 | grpcio 1.84 → 1.85.1; from 7.x also solders 0.27 → 0.29 |
Units, instruction encoding and the keypair sign-in did not change before v10. Every item under Behaviour changes to check applies to you as well. Prove the bot on devnet before mainnet.
