Skip to content

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 runWhat to do
10.x or 11.xChange the version to 12. No spot name was removed or renamed; see From 10 or 11.
9.xFollow this page: new package, renames, then the behaviour changes.
1.x to 8.xThe 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 enable keeps 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 ​

LanguageNeeds
RustRust 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.
PythonPython 3.10 or newer, protobuf 7.35.1+, grpcio 1.85.1+, solders 0.29+.
TypeScriptNode 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 ​

Languagev9 and earlierv12
Rustflint-api-client (Kellnr)flint-sdk (Kellnr), library flint_sdk, spot under flint_sdk::spot
Pythonflint-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 page
sh
npm install @superis-labs/flint @bufbuild/protobuf @solana/kit bignumber.js

In 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 ​

AreaPythonRustTypeScript
Public client (market data, stats, nodes)flint.spot.Clientflint_sdk::spot::ClientClient from /spot
Authenticated maker clientflint.spot.Makerflint_sdk::spot::MakerMaker from /spot
Endpoints, program ids, RPC URLflint.Clusterflint_sdk::ClusterCluster from the root
Quoting core and receiptsflint.spot.quotingflint_sdk::spot::quoting— (no QuotingCore in TypeScript)
Quote builders, units, PDAs, instructionsflint.spot.chainflint_sdk::spot::chain/spot/chain
Taker swaps and aggregatorsflint.spot.swapflint_sdk::spot::swap/spot/swap
Generated protobufflint.proto.spotflint_sdk::proto::spot/proto/spot
Errorsflint.ApiError, AuthError, InputError, …flint_sdk::ErrorApiError, 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 ​

v9v12
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, identityheartbeat, 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 useflint.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), MarketInfoawait 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_slotawait maker.chain_tip() (starts the stream and waits), maker.slot() (cached, None before the first slot)
submit_transaction, submit_transaction_receipt, submit_transactionsmaker.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*, StrategySwitchflint.spot.quoting.*
OnChainFailureflint.spot.quoting.CommitFailed
flint.AuthFlow, flint.ApiKeyAuth, flint.AUTH_DOMAIN_PREFIXflint.spot.KeypairAuthFlow, flint.ApiKey, flint.proto.spot.AUTH_DOMAIN_PREFIX
flint.Endpoints, resolve_endpoints, MAINNET_*_ENDPOINT constantsflint.Cluster
flint.api.rpc.ChainSource.from_urlsflint.spot.ChainSource.from_urls
flint.ResilientStream, ConnectionState, metadata_from_errorwatch_* 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_transactionQuoteBuilder.sign_transactions, then maker.submit / submit_many
flint.swap.*flint.spot.swap.* (renames below)
flint.gen.flint.spot.v1.*flint.proto.spot.*

Rust ​

v9v12
flint_api_client::Client / ClientBuilderflint_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_interceptormaker.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_tablespot::chain::{balance, catalog, units, lookup_tables}; spot::ChainSource
subscribe_maker_fills, subscribe_maker_balancemaker.watch_fills(..), maker.watch_balance(..) → Subscription (a Stream)
ChainTipStreams, ServerState, get_blockhashmaker.chain_tip().await, maker.slot()
errors::{Error, Result}, tonic::Status from callsflint_sdk::{Error, Result}; Error::Api carries the status code
MarketIdentifierRefspot::MarketRef
PROTO_HASH, PROTO_REV, SDK_VERSIONproto::spot::PROTO_HASH, proto::PROTO_REV, flint_sdk::SDK_VERSION

TypeScript ​

v9v12
createClient / SuperisClientClient from /spot
createNodeClient, createEscalationClientclient.nodeInfo(); maker.pageTheTeam()
createMakerClient, MakerClientOptionsawait Maker.connect({ cluster, signer | apiKey | emailSession })
AuthFlow (email login), AuthFlowOptionsEmailAuthFlow, EmailAuthFlowOptions (the "sweetspot.session" storage key is unchanged, so signed-in users stay signed in)
apiKeyInterceptor(key)Maker.connect({ cluster, apiKey })
SessionStorage, SessionSessionStorage from the root, Session from /spot
verifyProgramId, Config, PairCatalogEntry, resolveEndpointsclient.verifyProgramId(), Catalog, Cluster
streamWithBackoff(factory, signal)watch*() → Subscription; resilientStream(factory) from the root
GrpcError, GrpcCode, asGrpcErrorApiError, 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_IDSDEVNET_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):

v9v12
require_sweetspot (request field)require_flint_route
uses_sweetspot, sweetspot_onlyuses_flint, flint_only
NoSweetspotRoute, NonSweetspotLegNoFlintRoute, NonFlintLeg
SWEETSPOT_ROUTE_LABELSFLINT_ROUTE_LABELS
TITAN_SWEETSPOT_DEXTITAN_FLINT_DEX (its value stays "SweetSpot", Titan's venue label)
jupiter_flint_swap, encode_jupiter_flint_routebuild_jupiter_route_swap (the lower-level jupiter_route_swap is private), encode_jupiter_route
load_swap_markets, load_all_swap_marketsload_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=) and order_list_place_and_pop(..., side=), TypeScript orderListPlace(market, side, order) and orderListPlaceAndPop; 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_url instead 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 or collect().
  • 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 under proto.spot and the raw stubs.
  • Errors. gRPC failures surface as ApiError with code, message and the server's diagnostics in server, 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; use Cluster.devnet() / Cluster.mainnet() with overrides, or pass rpc_url. Cluster.custom(...), Cluster.parse(url) and Cluster.local(...) also leave the spot program id unset (v9 silently used mainnet's): pass it, or call with_spot_program_id(id) (TypeScript withSpotProgramId); quoting, verify_program_id() and swap market loads raise an input error naming spot_program_id without it.
  • Watching the chain tip. v9's watchable server_state.current_slot / .blockhash are internal. maker.watch_chain_tip() (TypeScript watchChainTip()) yields the current ChainTip and 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; Rust CommitError::NotSubmitted) instead of reporting landed, and settled() lists those intents in untracked_intents. Python submit_many returns SubmitResult(receipt, failed). A params update that does not set enable keeps 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.book is order_book (orderBook) and watch_market_data is watch_order_book (watchOrderBook). New Maker.submit_and_confirm (submitAndConfirm).
  • Swaps. The min-out guard is a delta checked inside the transaction (no output_balance_before); min_amount_out must be positive unless you set allow_unbounded; extra_fee_hbps is required; aggregator responses are checked and verified against chain.
  • Errors. TransportError kind expired means the transaction can no longer land (resend); timeout means the outcome is unknown. Errors raised after signing carry the signature (Python and TypeScript error.signature, Rust error.signature()). Subscription.lagged counts items a slow reader missed. KeypairAuthFlow.refresh() forces a new session.
  • maker_volume_to_saturation is base volume. RiskParams takes 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, except Receipt.landed_within(timeout), which still takes seconds as a float.
  • 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 no QuotingCore and 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.16 to v0.0.18). Use 12.1.0 or later.
  • Makers that connect with an organization ApiKey can 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::start gained a trailing argument), and one public field went away (QuotingCore.keypair, now core.keypair() and core.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.xv12
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 pass tx_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 rpc feature; they now need the quic feature, which is off by default. Python keeps the [quic] extra.
  • Rust quote inputs are Decimal. Prices, sizes and risk parameters were f64 through 9.2.
  • Lifetimes assume 200 ms slots (Rust). commit_with_duration converts 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 with CommitDisconnected, and status_stream_timeout is gone.

What moves under you, beyond the code:

Coming fromRust toolchainSolana cratesPython floors
1.6 to 1.71.88 → 1.97.1solana-sdk 3 → 4 in your own Cargo.toml toogrpcio 1.83 → 1.85.1, solders 0.27 → 0.29
7.x to 9.x1.91 → 1.97.1already solana-sdk 4grpcio 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.

Built on Solana