vistadex TypeScript package provides RFQ creation, WebSocket updates, transaction validation and signing, market data, balances, and positions for approved server-side integrations.
Product context
The Vistadex app starts with Discover, People, and Ideas. Those surfaces connect captured predictions to track records. Long/Short adds account-authorized automated execution for eligible future trades, while users can still submit individual market orders. This SDK guide covers funded market execution and wallet data. ItsgetPositions method reads wallet holdings; it is not a query for someone’s paper portfolio. The SDK contract documented here does not provide person enrollment, tracking billing, private claims, or Long/Short subscription management. Public person links use https://www.vistadex.com/people/username; a web route is not an SDK endpoint or an authorization mechanism.
Requirements
- Node.js
>=18 - A Vistadex client API key
- A Solana keypair for trading methods
- USDC on Solana for buys, or Vistadex position tokens for sells
Install
Create a client
Configuration defaults
You can also supply custom
fetch and WebSocketImpl implementations.
Execute a trade
The recommended two-step flow creates an RFQ and then letssubmitTrade wait for the quote, validate and sign the transaction, submit the user signature, and wait for the filler result.
buy, sell, and trade methods wrap the same lifecycle. The lower-level quote, awaitAuctionResult, signAndSubmitRfq, submitUserSignature, and awaitFillerAction methods are available when an integration needs explicit control.
Wallet helpers
The package exportscreateWallet, keypairFromSecretKey, keypairToSecretKeyBase64, derivePositionMintPda, and signTransactionBase64. Keep generated or imported secret-key material on a trusted server. Use the lower-level PDA and signing helpers only when you also preserve the SDK’s transaction-validation context.
RFQ parameters
Amounts settle with 6 decimal places. An amount must round to at least one settlement unit and remain within the maximum safely encodable 6-decimal amount. The current signing flow supports USD-denominated buys and share-denominated sells.
The direct
POST /rfqs server endpoint requires condition_id without 0x. The SDK normalizes the prefix for you.Market data and portfolio methods
Use
nextCursor while hasMore is true to paginate positions. Position balances are returned both as raw base units and decimal strings.
WebSocket subscriptions
subscribeRfq({ walletAddress, ...callbacks }) opens the user RFQ stream and returns an object with unsubscribe(). It can report subscribed, rfq_created, auction_ended, filler_action, user_signed, error, and close events through the corresponding callbacks.
Automatic reconnection defaults to true. The first reconnect delay defaults to 1,000 ms, doubles after each failed attempt, and is capped at 30,000 ms. Reconnect attempts are unlimited by default. Override those values with autoReconnect, reconnectDelayMs, maxReconnectDelayMs, and maxReconnectAttempts.
Timeouts and response values
- General HTTP requests use the configured
timeoutMs, which defaults to10,000ms. - Event creation polling defaults to
1,000ms between attempts and a60,000ms maximum wait. - The high-level
quote,buy,sell, andtrademethods wait untilauctionEndTimeplus5,000ms for a quote, with a minimum wait of5,000ms, unlessquoteTimeoutMsis supplied. submitTradeuses a60,000ms quote fallback only when it must fetch a missing auction result.awaitAuctionResult,awaitFillerAction, and thesubmitTradefiller phase also default to60,000ms unless their method-specific timeout is supplied.- Before submitting the user signature,
submitTradewaits for its RFQ WebSocket subscription to become ready. The readiness timeout isfillerTimeoutMsclamped to a minimum of1,000ms and a maximum of10,000ms; the wait ends as soon as the subscription is confirmed. - RFQ responses include
auctionDurationMsandauctionEndTime. Use those response fields instead of assuming the server’s configured auction duration. - Fee fields, when present, are RFQ-specific. Do not infer the charged platform fee from the SDK’s independent signing-safety ceiling.
Signing safety
The standard SDK flow validates server-supplied Solana transactions before signing. It binds the transaction to the requested wallet, market, side, amounts, winning filler, programs, accounts, and any returned fee context. If you sign a transaction obtained outside the standard flow, provide an explicitsigningContext. Context-free signing is rejected because the SDK cannot safely determine what the transaction is intended to do.
Errors
SDK failures throwVistadexError. Treat validation failures as non-retryable until the input changes. Network timeouts, temporary 202 event creation responses, and unavailable quotes may be retryable according to your application’s policy.