# Dango SDK > Reference and concept docs for the TypeScript, Python, and Rust Dango SDKs. ## Docs - [TypeScript SDK](/typescript): The TypeScript SDK is a viem-style client for the Dango execution environment. It speaks GraphQL over HTTP and WebSocket to a Dango indexer, signs transactions with EIP-712 typed data, and ships as six packages: `@left-curve/sdk`, `@left-curve/crypto`, `@left-curve/encoding`, `@left-curve/types`, `@left-curve/utils`, and `@left-curve/config`. - [Account](/typescript/types/Account): A single on-chain account belonging to a user. - [AccountDetails](/typescript/types/AccountDetails): `Account` plus the owner's username. Returned by [`getAccountInfo`](../actions/account-factory/getAccountInfo) after resolving the user. - [AccountInfo](/typescript/types/AccountInfo): Account record stored by the account factory (no address attached). - [Address](/typescript/types/Address): A 0x-prefixed hex string identifying an account or contract on Dango. - [AppConfig](/typescript/types/AppConfig): The Dango app-level configuration: system contract addresses, fee rates, liquidation parameters, and minimum deposits. - [Base64](/typescript/types/Base64): A base64-encoded string. - [BlockInfo](/typescript/types/BlockInfo): A block header. Used by `queryStatus` to return the latest block. - [Candle](/typescript/types/Candle): An OHLC candle for a spot pair at a given interval. - [Chain](/typescript/types/Chain): The chain configuration consumed by `createTransport` and the client factories. - [ChainConfig](/typescript/types/ChainConfig): The chain-level configuration: owner, system contracts, permissions, cronjobs. - [Coin](/typescript/types/Coin): A `{ denom, amount }` pair representing some quantity of one token. - [Coins](/typescript/types/Coins): A record mapping denoms to base-unit amount strings. The canonical multi-coin payload across the SDK. - [ContractInfo](/typescript/types/ContractInfo): Contract metadata returned by [`getContractInfo`](../actions/app/getContractInfo). - [Credential](/typescript/types/Credential): The authentication bundle attached to a transaction. Either a standard credential from the primary key or a session credential. - [Denom](/typescript/types/Denom): A token denomination — a chain-unique string identifier. - [Funds](/typescript/types/Funds): Coins attached to a contract call (e.g. inside an `execute` or `transferRemote` message). - [Hex](/typescript/types/Hex): A hex-encoded string. - [IndexedBlock](/typescript/types/IndexedBlock): A block as returned by the indexer — header plus transactions and cron outcomes. - [Key](/typescript/types/Key): A public key that can be associated with a Dango account. Discriminated by key family. - [KeyHash](/typescript/types/KeyHash): Uppercase hex SHA-256 of a public key or credential id. Used to identify keys on chain. - [Message](/typescript/types/Message): A discriminated union of the seven transaction-level messages Dango accepts. - [OrderId](/typescript/types/OrderId): A spot order id. - [PairId](/typescript/types/PairId): The identifier of a spot trading pair — base and quote denom. - [PairParams](/typescript/types/PairParams): Parameters of a single spot trading pair. - [PairStats](/typescript/types/PairStats): 24h indexer-computed stats for a spot pair. - [PairUpdate](/typescript/types/PairUpdate): A pair listing returned by `getPairs` — id plus parameters. - [PerpsCandle](/typescript/types/PerpsCandle): An OHLC candle for a perps pair. - [PerpsEvent](/typescript/types/PerpsEvent): A perps event — fill, liquidation, or deleverage. The `data` field is a discriminated payload. - [PerpsOrderKind](/typescript/types/PerpsOrderKind): A perps order's kind — market or limit. - [PerpsPairParam](/typescript/types/PerpsPairParam): Parameters of a single perps pair. - [PerpsPairStats](/typescript/types/PerpsPairStats): 24h indexer-computed stats for a perps pair. - [PerpsParam](/typescript/types/PerpsParam): Global perps parameters. - [PerpsTrade](/typescript/types/PerpsTrade): A perps trade fill. - [PerpsUserState](/typescript/types/PerpsUserState): A user's perps state — margin, positions, vault shares. - [PerpsUserStateExtended](/typescript/types/PerpsUserStateExtended): Extended perps user state with optional PnL, equity, margin, and liquidation fields. - [Price](/typescript/types/Price): An oracle price entry — current price, EMA, precision, and timestamp. - [PublicKey](/typescript/types/PublicKey): A public key as returned by the indexer — includes metadata like creation time and key type. - [Signature](/typescript/types/Signature): A discriminated signature carried by a credential. One of three families: secp256k1, WebAuthn passkey, or EIP-712. - [Signer](/typescript/types/Signer): The interface all signing implementations satisfy. `signTx` signs a tx; `signArbitrary` signs an off-chain payload. - [SigningSession](/typescript/types/SigningSession): A session-key bundle. Pair the ephemeral session key with the primary-key authorization that legitimizes it. - [Trade](/typescript/types/Trade): A spot trade fill. - [Tx](/typescript/types/Tx): A signed transaction. Holds messages, sender, gas, credential, and metadata. - [User](/typescript/types/User): A user record — index, name, registered keys, and owned accounts. - [First Call](/typescript/getting-started/first-call): Hit the public testnet with a read-only client. No signer needed. - [Installation](/typescript/getting-started/installation): Install `@left-curve/sdk` from your package manager. Node 20 or later is required. - [Project Setup](/typescript/getting-started/project-setup): Wire up signers, chains, and environment variables for a real project. - [BaseError](/typescript/errors/BaseError): Base class for every SDK error. Carries structured metadata for triage. - [HttpRequestError](/typescript/errors/HttpRequestError): Thrown when a GraphQL HTTP request fails — non-2xx response, network failure, or GraphQL errors. - [TimeoutError](/typescript/errors/TimeoutError): Thrown when a request exceeds its configured timeout. - [UrlRequiredError](/typescript/errors/UrlRequiredError): Thrown by `createTransport` when no URL is supplied and the chain config also lacks one. - [Clients](/typescript/concepts/clients): **What this teaches:** when to use `createPublicClient` vs `createSignerClient`, and how both relate to `createBaseClient`. - [Encoding & Types](/typescript/concepts/encoding-and-types): **What this teaches:** base-unit vs human-readable amounts, when to use `Decimal` vs `bigint` vs `number`, and how the SDK's JSON serialization handles snake\_case. - [Error Handling](/typescript/concepts/error-handling): **What this teaches:** the `BaseError` hierarchy, what each error means, and the current limitation around importing them. - [Packages](/typescript/concepts/packages): **What this teaches:** which of the six SDK packages to import from, and when reaching for a sub-package is worth it. - [Rate Limits & Quotas](/typescript/concepts/rate-limits): **What this teaches:** the two server-side limits the indexer enforces, and how to stay under them without auto-throttling. - [Signers & Authentication](/typescript/concepts/signers-and-authentication): **What this teaches:** the `Signer` interface, the two built-in implementations, and how session keys delegate authority. - [Subscriptions](/typescript/concepts/subscriptions): **What this teaches:** the WebSocket subscription model, the WS-only vs HTTP-fallback split, and the connection lifecycle. - [Transactions](/typescript/concepts/transactions): **What this teaches:** the sign → broadcast → poll loop, and where `signAndBroadcastTx` fits. - [createBaseClient](/typescript/clients/createBaseClient): Factory that builds the bare client object — transport, chain, optional signer, and `extend()`. Used internally by `createPublicClient` and `createSignerClient`; reach for it directly only to compose custom action sets. - [createPublicClient](/typescript/clients/createPublicClient): Factory that builds a read-only client extended with every query action. - [createSignerClient](/typescript/clients/createSignerClient): Factory that builds a client with every query action and every signing action. - [cancelConditionalOrder](/typescript/actions/perps/cancelConditionalOrder): Cancel one conditional order, all for a pair, or every conditional order. - [cancelPerpsOrder](/typescript/actions/perps/cancelPerpsOrder): Cancel one or all perps orders. - [depositMargin](/typescript/actions/perps/depositMargin): Deposit `bridge/usdc` collateral into the perps account. - [getAllPerpsPairStats](/typescript/actions/perps/getAllPerpsPairStats): Read 24h stats for every perps pair. - [getFeeRateOverride](/typescript/actions/perps/getFeeRateOverride): Read a per-user fee rate override. - [getPerpsLiquidityDepth](/typescript/actions/perps/getPerpsLiquidityDepth): Read bid and ask depth buckets for a perps pair. - [getPerpsOrdersByUser](/typescript/actions/perps/getPerpsOrdersByUser): List a user's active perps orders. - [getPerpsPairParam](/typescript/actions/perps/getPerpsPairParam): Read the parameters of a single perps pair: tick size, margin ratios, max OI, funding rate cap. - [getPerpsPairParams](/typescript/actions/perps/getPerpsPairParams): Read parameters across every perps pair, paginated. - [getPerpsPairState](/typescript/actions/perps/getPerpsPairState): Read on-chain pair state — long/short OI, funding per unit, and current funding rate. - [getPerpsPairStats](/typescript/actions/perps/getPerpsPairStats): Read 24h indexer-computed stats for a single perps pair. - [getPerpsParam](/typescript/actions/perps/getPerpsParam): Read the global perps parameters: max unlocks, max open orders, fee schedules, funding period, vault config. - [getPerpsState](/typescript/actions/perps/getPerpsState): Read global runtime state — last funding time, vault share supply, insurance fund balance, treasury. - [getPerpsUserState](/typescript/actions/perps/getPerpsUserState): Read the perps state for a single user. - [getPerpsUserStateExtended](/typescript/actions/perps/getPerpsUserStateExtended): Read the extended perps state for a user, with optional PnL, equity, margin, and liquidation flags. - [getPerpsVaultState](/typescript/actions/perps/getPerpsVaultState): Read vault state — share supply, equity, and the vault's own perps positions. - [getVaultSnapshots](/typescript/actions/perps/getVaultSnapshots): Read historical vault equity and share supply snapshots over a height range. - [queryPerpsCandles](/typescript/actions/perps/queryPerpsCandles): Read historical perps candles for a pair at a given interval. Paginated cursor-style. - [queryPerpsEvents](/typescript/actions/perps/queryPerpsEvents): Read perps events — fills, liquidations, deleverages — paginated cursor-style. Optional filters by user, event type, pair, or block height. - [setFeeShareRatio](/typescript/actions/perps/setFeeShareRatio): Opt in as a referrer and set the share ratio rebated to referees. - [setReferral](/typescript/actions/perps/setReferral): Set a referrer/referee mapping for fee sharing. - [submitConditionalOrder](/typescript/actions/perps/submitConditionalOrder): Submit a single trigger-based conditional perps order. - [submitConditionalOrders](/typescript/actions/perps/submitConditionalOrders): Submit a batch of trigger-based conditional perps orders in one transaction. - [submitPerpsOrder](/typescript/actions/perps/submitPerpsOrder): Submit a market or limit perps order, optionally with take-profit and stop-loss children. - [vaultAddLiquidity](/typescript/actions/perps/vaultAddLiquidity): Move USD margin from the caller's trading account into the perps counterparty vault and mint LP shares in return. - [vaultRemoveLiquidity](/typescript/actions/perps/vaultRemoveLiquidity): Burn vault shares to schedule a withdrawal. The corresponding cash is unlocked after the vault cooldown period. - [withdrawMargin](/typescript/actions/perps/withdrawMargin): Withdraw collateral from the perps account. - [getPrices](/typescript/actions/oracle/getPrices): Read oracle prices, paginated. - [accountSubscription](/typescript/actions/indexer/accountSubscription): Subscribe to account creation events for a single user index. WebSocket only. - [allPairStatsSubscription](/typescript/actions/indexer/allPairStatsSubscription): Subscribe to live 24h stats for every spot pair. Uses WebSocket when available; falls back to HTTP polling. - [allPerpsPairStatsSubscription](/typescript/actions/indexer/allPerpsPairStatsSubscription): Subscribe to live 24h stats for every perps pair. Uses WebSocket when available; falls back to HTTP polling. - [blockSubscription](/typescript/actions/indexer/blockSubscription): Subscribe to new finalized blocks. WebSocket only. - [candlesSubscription](/typescript/actions/indexer/candlesSubscription): Subscribe to live spot candles for a pair and interval. WebSocket only. - [eventsByAddressesSubscription](/typescript/actions/indexer/eventsByAddressesSubscription): Subscribe to all events touching a set of addresses. WebSocket only. - [eventsSubscription](/typescript/actions/indexer/eventsSubscription): Subscribe to a filtered live event stream. WebSocket only. - [perpsCandlesSubscription](/typescript/actions/indexer/perpsCandlesSubscription): Subscribe to live perps candles for a pair and interval. WebSocket only. - [perpsTradesSubscription](/typescript/actions/indexer/perpsTradesSubscription): Subscribe to live perps trades for a pair. Uses WebSocket when available; falls back to HTTP polling. - [queryAppSubscription](/typescript/actions/indexer/queryAppSubscription): Subscribe to the live result of a `queryApp` request. Uses WebSocket when available; falls back to HTTP polling. - [queryBlock](/typescript/actions/indexer/queryBlock): Fetch a block (by height or latest) with its transactions and cron outcomes. - [queryIndexer](/typescript/actions/indexer/queryIndexer): Send a raw GraphQL request to the indexer and receive the typed response. - [searchTxs](/typescript/actions/indexer/searchTxs): Search indexed transactions by hash or sender, paginated. - [tradesSubscription](/typescript/actions/indexer/tradesSubscription): Subscribe to live spot trades for a pair. Uses WebSocket when available; falls back to HTTP polling. - [transferSubscription](/typescript/actions/indexer/transferSubscription): Subscribe to live transfer events for a single username. WebSocket only. - [Addr32](/typescript/actions/hyperlane/Addr32): Encode and decode 32-byte Hyperlane addresses. The Hyperlane wire format pads 20-byte EVM addresses to 32 bytes by left-padding with zeros. - [IncrementalMerkleTree](/typescript/actions/hyperlane/IncrementalMerkleTree): Hyperlane outbox-style incremental Merkle tree of depth 32 with Keccak-256 hashing. - [Message](/typescript/actions/hyperlane/Message): Encode a Hyperlane mailbox message. Outputs the binary layout the Hyperlane router expects. - [Metadata](/typescript/actions/hyperlane/Metadata): Encode multisig ISM (Interchain Security Module) metadata: origin merkle tree address, merkle root, index, and validator signatures. - [TokenMessage](/typescript/actions/hyperlane/TokenMessage): Encode a Hyperlane warp-route token message — recipient, amount, and metadata. - [getWithdrawalFee](/typescript/actions/gateway/getWithdrawalFee): Read the withdrawal fee for a denom + remote chain pair. - [transferRemote](/typescript/actions/gateway/transferRemote): Send funds to a remote chain via the gateway contract. - [batchUpdateOrders](/typescript/actions/dex/batchUpdateOrders): Create and/or cancel multiple limit orders in a single transaction. - [dexStatus](/typescript/actions/dex/dexStatus): Read whether the DEX is currently paused. - [getAllPairStats](/typescript/actions/dex/getAllPairStats): Read 24h stats for every trading pair. - [getOrder](/typescript/actions/dex/getOrder): Read the details of a single active limit order by id. - [getPair](/typescript/actions/dex/getPair): Read the parameters of a single base/quote trading pair. - [getPairStats](/typescript/actions/dex/getPairStats): Read 24h indexer-computed stats for a single pair: current price, 24h-ago price, 24h volume, and 24h change. - [getPairs](/typescript/actions/dex/getPairs): Enumerate all trading pairs and their parameters, paginated. - [ordersByUser](/typescript/actions/dex/ordersByUser): List a user's active orders across all pairs. - [provideLiquidity](/typescript/actions/dex/provideLiquidity): Add liquidity to a passive pool. Unbalanced provision is equivalent to an internal swap to reach pool ratio, followed by a balanced provision. - [queryCandles](/typescript/actions/dex/queryCandles): Read historical candles for a pair at a given interval. Paginated cursor-style. - [queryTrades](/typescript/actions/dex/queryTrades): Read historical trades, optionally filtered by address. Paginated cursor-style. - [simulateSwapExactAmountIn](/typescript/actions/dex/simulateSwapExactAmountIn): Quote the output of a swap given an exact input amount and a route. - [simulateSwapExactAmountOut](/typescript/actions/dex/simulateSwapExactAmountOut): Quote the input needed for a swap given an exact output amount and a route. - [simulateWithdrawLiquidity](/typescript/actions/dex/simulateWithdrawLiquidity): Simulate burning a given amount of LP tokens. Returns the base/quote coins the burn would yield. - [swapExactAmountIn](/typescript/actions/dex/swapExactAmountIn): Submit an instant swap with an exact input amount and an optional minimum output for slippage control. - [swapExactAmountOut](/typescript/actions/dex/swapExactAmountOut): Submit an instant swap with an exact output amount. Excess input is refunded. - [withdrawLiquidity](/typescript/actions/dex/withdrawLiquidity): Withdraw passive liquidity from a pair by burning LP tokens. The redemption happens at the pool ratio. - [broadcastTxSync](/typescript/actions/app/broadcastTxSync): Broadcast a signed transaction via the indexer mutation and poll for inclusion. - [configure](/typescript/actions/app/configure): Update the chain config, the app config, or both. Only the chain owner can submit. - [execute](/typescript/actions/app/execute): Execute one or more contract messages in a single transaction, with optional funds attached and EIP-712 typed-data overrides. - [getAppConfig](/typescript/actions/app/getAppConfig): Fetch the app-level configuration: contract addresses, fee rates, liquidation parameters, and minimum deposit per denom. - [getBalance](/typescript/actions/app/getBalance): Read the balance of a single denom for an address. - [getBalances](/typescript/actions/app/getBalances): Read a paginated map of every balance held by an address. - [getCode](/typescript/actions/app/getCode): Fetch a stored Wasm code blob by its hash. - [getCodes](/typescript/actions/app/getCodes): List stored Wasm codes, paginated. - [getContractInfo](/typescript/actions/app/getContractInfo): Fetch a contract's metadata (code hash, label, admin) by address. - [getContractsInfo](/typescript/actions/app/getContractsInfo): List contract metadata across the chain, paginated. - [getSupplies](/typescript/actions/app/getSupplies): Read a paginated map of total supplies across denoms. - [getSupply](/typescript/actions/app/getSupply): Read the total supply of a single token. - [instantiate](/typescript/actions/app/instantiate): Instantiate a contract from an already-uploaded code hash. Returns the derived address and the broadcast receipt. - [migrate](/typescript/actions/app/migrate): Migrate a contract to a new code hash. Only the contract's admin can call this. - [queryApp](/typescript/actions/app/queryApp): Send a generic typed query against the app and receive the matching `QueryResponse` variant. - [queryStatus](/typescript/actions/app/queryStatus): Read the chain id and the latest finalized block. - [queryTx](/typescript/actions/app/queryTx): Fetch an indexed transaction by hash. - [queryWasmRaw](/typescript/actions/app/queryWasmRaw): Read a raw base64 value from a contract's storage at a specific key. - [queryWasmSmart](/typescript/actions/app/queryWasmSmart): Send a typed JSON query to a smart contract and receive the decoded response. - [signAndBroadcastTx](/typescript/actions/app/signAndBroadcastTx): Sign a list of messages with the client signer and broadcast the resulting transaction. The end-to-end entry point for every mutation. - [simulate](/typescript/actions/app/simulate): Gas-simulate an unsigned transaction. Returns the simulated gas usage scaled by a default multiplier. - [storeCode](/typescript/actions/app/storeCode): Upload a Wasm code blob to the chain. - [storeCodeAndInstantiate](/typescript/actions/app/storeCodeAndInstantiate): Upload a Wasm code blob and instantiate it in a single transaction. Returns the derived contract address. - [transfer](/typescript/actions/app/transfer): Send a record of `Address -> Coins` from the sender's account. - [upgrade](/typescript/actions/app/upgrade): Schedule a chain upgrade at a future block. Only the chain owner can submit. - [createSession](/typescript/actions/account-factory/createSession): Sign a `SigningSessionInfo` payload with the client signer and return the credential bundle. The bundle can then drive [`createSessionSigner`](../../concepts/signers-and-authentication) for delegated signing. - [forgotUsername](/typescript/actions/account-factory/forgotUsername): List the users associated with a key hash. Useful for username recovery flows. - [getAccountInfo](/typescript/actions/account-factory/getAccountInfo): Fetch account details (index, owner, username) for a given account address. - [getAccountSeenNonces](/typescript/actions/account-factory/getAccountSeenNonces): Read the most-recent nonces consumed by an account. Used internally by `signAndBroadcastTx` to compute the next nonce. - [getAccountStatus](/typescript/actions/account-factory/getAccountStatus): Read the current user state (`active`, `inactive`, or `frozen`) for an account. - [getAllAccountInfo](/typescript/actions/account-factory/getAllAccountInfo): List every account in the factory, paginated. - [getCodeHash](/typescript/actions/account-factory/getCodeHash): Read the current code hash for newly-created accounts. - [getNextAccountIndex](/typescript/actions/account-factory/getNextAccountIndex): Read the index that the next account for a username will receive. Use this to derive a new account's address before creating it. - [getUser](/typescript/actions/account-factory/getUser): Fetch a user record by index or by name. - [getUserKeys](/typescript/actions/account-factory/getUserKeys): Fetch the list of public keys associated with a user, via the indexer. - [registerAccount](/typescript/actions/account-factory/registerAccount): Register an additional account for an existing user. - [registerUser](/typescript/actions/account-factory/registerUser): Create a new user and their first account in a single transaction. Submitted by the account factory itself (sender-less from the caller's perspective). - [updateKey](/typescript/actions/account-factory/updateKey): Insert or delete a key on the calling account. - [updateUsername](/typescript/actions/account-factory/updateUsername): Change the username on the calling account's user record. - [Dango Rust SDK](/rust): The Rust SDK is a thin GraphQL + REST client over a Dango node, plus key-management and transaction-signing utilities. - [First call](/rust/getting-started/first-call): A five-minute hello-world that queries chain status with `HttpClient`. - [Installation](/rust/getting-started/installation): Add `dango-sdk` to a Cargo project. - [Project setup](/rust/getting-started/project-setup): Wire endpoints, keys, and the async runtime for a real application. - [Clients](/rust/concepts/clients): **What this teaches:** when to use `HttpClient` and when to use `WsClient`, and what each one is wired to under the hood. - [Encoding and types](/rust/concepts/encoding-and-types): **What this teaches:** which crates own which user-facing types, how numeric units are represented, and the shape of GraphQL response data. - [Error handling](/rust/concepts/error-handling): **What this teaches:** the two error shapes in `dango-sdk` — `anyhow::Error` for one-shot calls, [`WsError`](../api/errors/WsError) inside subscription items — and how to recover from each. - [Rate limits and quotas](/rust/concepts/rate-limits): **What this teaches:** the server-side limits on Dango HTTP and WebSocket endpoints, and how to shape Rust client code around them. - [Signers and authentication](/rust/concepts/signers-and-authentication): **What this teaches:** how the `Secret` trait, `Secp256k1`/`Eip712`, and `SingleSigner` fit together to sign Dango transactions. - [Subscriptions](/rust/concepts/subscriptions): **What this teaches:** the `graphql-transport-ws` model, when to multiplex over a [`Session`](../api/clients/Session), and when to open a dedicated connection with [`WsClient::subscribe`](../api/methods/ws-client/subscribe). - [Transactions](/rust/concepts/transactions): **What this teaches:** the full path from `Message` to confirmed transaction, using only `dango-sdk` primitives. - [PageInfo](/rust/api/types/PageInfo): Cursor metadata for indexer GraphQL connections. - [Secret](/rust/api/traits/Secret): A trait abstraction over a private key that can sign Dango transactions. - [SubscriptionStream](/rust/api/subscriptions/SubscriptionStream): A type alias for the pinned, boxed `Stream` returned by every subscription call. - [SubscriptionVariables](/rust/api/subscriptions/SubscriptionVariables): Helper trait for subscription variables with an associated subscription type. Lets users call `vars.subscribe(&ws)` instead of `ws.subscribe::(vars)`. - [WsClient::connect](/rust/api/methods/ws-client/connect): Open a WebSocket connection and return a [`Session`](../../clients/Session) that can host multiple concurrent subscriptions. - [WsClient::from_http_url](/rust/api/methods/ws-client/from_http_url): Construct a `WsClient` from an HTTP URL, rewriting the scheme. - [WsClient::new](/rust/api/methods/ws-client/new): Construct a `WsClient` from a `ws://` or `wss://` URL. - [WsClient::subscribe](/rust/api/methods/ws-client/subscribe): Open a dedicated WebSocket connection and start a single subscription. - [SingleSigner::new](/rust/api/methods/single-signer/new): Construct a bare `SingleSigner` with both `user_index` and `nonce` undefined. - [SingleSigner::new_first_address_available](/rust/api/methods/single-signer/new_first_address_available): Construct a `SingleSigner` by discovering the first account associated with a `Secret`'s `key_hash` via the account factory. - [SingleSigner::query_next_nonce](/rust/api/methods/single-signer/query_next_nonce): Fetch the next unused nonce for this signer's account. - [SingleSigner::query_nonce](/rust/api/methods/single-signer/query_nonce): Fetch the next unused nonce. Trait method of `SequencedSigner` (from `dango_types::signer`). - [SingleSigner::query_user_index](/rust/api/methods/single-signer/query_user_): Fetch this signer's `UserIndex` from the account factory. - [SingleSigner::sign_transaction](/rust/api/methods/single-signer/sign_transaction): Sign a set of messages and produce a broadcast-ready `Tx`. - [SingleSigner::unsigned_transaction](/rust/api/methods/single-signer/unsigned_transaction): Build the `UnsignedTx` for a set of messages without producing a signature. - [SingleSigner::update_nonce](/rust/api/methods/single-signer/update_nonce): Refresh `self.nonce` from the chain. Trait method of `SequencedSigner`. - [SingleSigner::with_nonce](/rust/api/methods/single-signer/with_nonce): Consume `self` and return a `SingleSigner` with `nonce` defined. - [SingleSigner::with_query_nonce](/rust/api/methods/single-signer/with_query_nonce): Fetch the next unused nonce from the account and return a `SingleSigner` with `nonce` defined. - [SingleSigner::with_query_user_index](/rust/api/methods/single-signer/with_query_user_): Fetch the user index from the account factory and return a `SingleSigner` with `user_index` defined. - [SingleSigner::with_user_index](/rust/api/methods/single-signer/with_user_): Consume `self` and return a `SingleSigner` with `user_index` defined. - [Session::subscribe](/rust/api/methods/session/subscribe): Multiplex a new GraphQL subscription onto an existing WebSocket session. - [Keystore::from_file](/rust/api/methods/keystore/from_file): Read and decrypt a keystore file, returning the raw 32-byte private key. - [Keystore::write_to_file](/rust/api/methods/keystore/write_to_file): Encrypt a `Secret`'s private key and write a pretty-printed JSON keystore file. - [broadcast_tx](/rust/api/methods/http-client/broadcast_tx): Submit a signed transaction with `tx-sync` semantics: the node accepts or rejects it from the mempool but does not wait for inclusion. - [paginate_accounts](/rust/api/methods/http-client/paginate_accounts): Fetch every account in the indexer's `accounts` connection, paginating forward. - [paginate_all](/rust/api/methods/http-client/paginate_all): Paginate through every result of a GraphQL connection using cursor-based pagination. - [paginate_blocks](/rust/api/methods/http-client/paginate_blocks): Fetch every record in the indexer's `blocks` connection, paginating forward. - [paginate_events](/rust/api/methods/http-client/paginate_events): Fetch every record in the indexer's `events` connection, paginating forward. - [paginate_messages](/rust/api/methods/http-client/paginate_messages): Fetch every record in the indexer's `messages` connection, paginating forward. - [paginate_transactions](/rust/api/methods/http-client/paginate_transactions): Fetch every record in the indexer's `transactions` connection, paginating forward. - [paginate_transfers](/rust/api/methods/http-client/paginate_transfers): Fetch every record in the indexer's `transfers` connection, paginating forward. - [query_app](/rust/api/methods/http-client/query_app): Run an app-level query against the node at a given height. - [query_block](/rust/api/methods/http-client/query_block): Fetch a block by height. Hits the REST endpoint `GET /block/info[/{height}]`. - [query_block_outcome](/rust/api/methods/http-client/query_block_outcome): Fetch a block's execution outcome. Hits the REST endpoint `GET /block/result[/{height}]`. - [query_store](/rust/api/methods/http-client/query_store): Read a raw key from the chain's state store, optionally with a Merkle proof. - [search_tx](/rust/api/methods/http-client/search_tx): Look up a transaction outcome by hash. - [simulate](/rust/api/methods/http-client/simulate): Dry-run an unsigned transaction against the latest committed state and return its outcome. - [WsError](/rust/api/errors/WsError): The only public typed error in `dango-sdk`. Returned inside subscription stream items. - [HttpClient](/rust/api/clients/HttpClient): A GraphQL + REST client over `reqwest` that talks to a Dango node. - [Keystore](/rust/api/clients/Keystore): An encrypted-on-disk container for a 32-byte private key, using AES-256-GCM with PBKDF2-HMAC-SHA256 key derivation. - [Session](/rust/api/clients/Session): A live WebSocket session that hosts multiple concurrent subscriptions over a single connection. - [SingleSigner](/rust/api/clients/SingleSigner): A typestate builder for signing transactions against Dango's single-signature accounts. - [WsClient](/rust/api/clients/WsClient): A WebSocket factory that speaks `graphql-transport-ws` on top of `tokio-tungstenite` for Dango GraphQL subscriptions. - [Dango Python SDK](/python): Sync Python client for the Dango perpetual futures exchange. Wraps the GraphQL HTTP and WebSocket endpoints behind three classes: `Exchange` for signed actions, `Info` for read queries and subscriptions, and `Secp256k1Wallet`/`SingleSigner` for keys and nonces. - [Migrating from the Hyperliquid Python SDK](/python/migration/hyperliquid): You came from `hyperliquid-python-sdk`. The `dango` package ships an HL-shaped facade under `dango.hyperliquid_compatibility` so most of your code keeps working with one-line import swaps. **Read this page first.** There are sharp edges. - [Missing methods](/python/migration/missing-methods): **What this teaches:** which Hyperliquid-shaped methods exist in the compatibility layer but raise `NotImplementedError`, so you know what to migrate to native equivalents. - [Info.all_mids (HL-compat)](/python/migration/hl-compat/info/all_mids): HL `allMids` — coin name → mid price string. - [Info.candles_snapshot (HL-compat)](/python/migration/hl-compat/info/candles_snapshot): HL `candleSnapshot` — OHLCV candles in a time window. - [Info.disconnect_websocket (HL-compat)](/python/migration/hl-compat/info/disconnect_websocket): Close the underlying WebSocket connection. - [Info.historical_orders (HL-compat)](/python/migration/hl-compat/info/historical_orders): HL `historicalOrders` — reconstruct order lifecycle from persisted + removed events. - [Info.l2_snapshot (HL-compat)](/python/migration/hl-compat/info/l2_snapshot): HL `l2Book` — bid/ask depth at the finest bucket. - [Info.meta (HL-compat)](/python/migration/hl-compat/info/meta): HL `meta` — perp universe metadata. - [Info.meta_and_asset_ctxs (HL-compat)](/python/migration/hl-compat/info/meta_and_asset_ctxs): HL `metaAndAssetCtxs` — meta bundled with per-asset ctx. - [Info.name_to_asset (HL-compat)](/python/migration/hl-compat/info/name_to_asset): HL signature — coin name to integer asset index. - [Info.name_to_pair (HL-compat)](/python/migration/hl-compat/info/name_to_pair): Translate an HL coin name to a Dango `PairId`. Raises `KeyError` on an unknown coin. - [Info.open_orders (HL-compat)](/python/migration/hl-compat/info/open_orders): HL `openOrders` — flatten Dango's keyed order map to a list. - [Info.query_order_by_oid (HL-compat)](/python/migration/hl-compat/info/query_order_by_oid): HL `orderStatus` — fetch one order by id. **`user` is accepted-and-ignored.** - [Info.subscribe (HL-compat)](/python/migration/hl-compat/info/subscribe): Dispatch an HL-shaped `Subscription` dict to the right native subscriber. - [Info.unsubscribe (HL-compat)](/python/migration/hl-compat/info/unsubscribe): Drop a subscription by id. The `subscription` argument is informational. - [Info.user_fills (HL-compat)](/python/migration/hl-compat/info/user_fills): HL `userFills` — flat list of trade fills for one user. - [Info.user_fills_by_time (HL-compat)](/python/migration/hl-compat/info/user_fills_by_time): HL `userFillsByTime` — fills in a time range. - [Info.user_state (HL-compat)](/python/migration/hl-compat/info/user_state): HL `clearinghouseState` — user margin and asset positions. `dex` is accepted-and-ignored. - [bulk_cancel](/python/migration/hl-compat/exchange/bulk_cancel): Cancel multiple open orders by chain `oid` in one batched native call. - [Exchange.bulk_cancel_by_cloid (HL-compat)](/python/migration/hl-compat/exchange/bulk_cancel_by_cloid): Cancel multiple open orders by `cloid` in one batched native call. - [Exchange.bulk_modify_orders_new (HL-compat)](/python/migration/hl-compat/exchange/bulk_modify_orders_new): Batch a list of cancel + submit pairs into one `batch_update_orders` call. - [bulk_orders](/python/migration/hl-compat/exchange/bulk_orders): Place multiple Hyperliquid-style orders in one batched native call. - [cancel](/python/migration/hl-compat/exchange/cancel): Cancel one open order by its on-chain `oid`. The `name` argument is verified for parity (typos fail loudly). - [Exchange.cancel_by_cloid (HL-compat)](/python/migration/hl-compat/exchange/cancel_by_cloid): Cancel one open order by `cloid`. Hashes the 16-byte HL cloid to Uint64. - [Exchange.market_close (HL-compat)](/python/migration/hl-compat/exchange/market_close): Reduce-only market order to close the position in `coin`. **`px` is silently ignored.** - [Exchange.market_open (HL-compat)](/python/migration/hl-compat/exchange/market_open): Place a market order with a slippage cap. **`px` is silently ignored.** - [Exchange.modify_order (HL-compat)](/python/migration/hl-compat/exchange/modify_order): Atomic cancel + replace, emulated as a single batched action. - [order](/python/migration/hl-compat/exchange/order): Place a single Hyperliquid-style order. Routes to the native `submit_order`. - [Exchange.set_expires_after (HL-compat)](/python/migration/hl-compat/exchange/set_expires_after): Record an HL `expiresAfter` ms hint. **Currently a no-op with state storage.** - [Exchange.set_referrer (HL-compat)](/python/migration/hl-compat/exchange/set_referrer): Bind the signer as a referee of `code` (HL username form). - [First call](/python/getting-started/first-call): Read public chain state in five minutes. No wallet, no signing, no env vars. - [Installation](/python/getting-started/installation): Install the `dango` package from PyPI. Requires Python 3.14 or newer. - [Project setup](/python/getting-started/project-setup): Wire up a real project: pick an environment, configure a signer, hold one `Info` and one `Exchange`. - [Clients](/python/concepts/clients): **What this teaches:** which of the three Python SDK classes to construct for each kind of work, and how they share state. - [Encoding & Types](/python/concepts/encoding-and-types): **What this teaches:** how Dango encodes numbers on the wire, where snake\_case vs camelCase boundaries are, and how the SDK's type aliases map to runtime values. - [Error handling](/python/concepts/error-handling): **What this teaches:** what each SDK exception means, where it is raised, and how to recover. - [Rate limits & quotas](/python/concepts/rate-limits): **What this teaches:** the two server-side caps that affect Python SDK users, and how to stay under them. - [Signers & Authentication](/python/concepts/signers): **What this teaches:** how Dango separates keys from accounts, how the `Wallet` protocol abstracts signing, and what `SingleSigner` does on top. - [Subscriptions](/python/concepts/subscriptions): **What this teaches:** how the WebSocket layer is wired, the per-connection limits, and what the callback contract is. - [Transactions](/python/concepts/transactions): **What this teaches:** what happens between `exchange.submit_order(...)` and a tx hash, and what to do when something diverges. - [Addr](/python/api/types/Addr): A Dango account or contract address. `NewType("Addr", str)` — at runtime it is a plain `str`. - [AllForPair](/python/api/types/AllForPair): Cancel every conditional order on one pair. - [Block](/python/api/types/Block): A block payload from the `subscribe_block` stream. Keys are camelCase (indexer wire shape). - [CancelAction](/python/api/types/CancelAction): User-facing form of a cancel request. Pass to [`batch_update_orders`](../methods/exchange/batch_update_orders). - [CandleInterval](/python/api/types/CandleInterval): OHLCV candle interval enum. Wire form is the bare uppercase name. - [ClientOrderId](/python/api/types/ClientOrderId): A client-assigned order id. `NewType("ClientOrderId", str)` — at runtime it is a plain `str` (encoding a `Uint64`). - [ClientOrderIdRef](/python/api/types/ClientOrderIdRef): User-facing wrapper around a client-assigned order id. Disambiguates from `OrderId` at runtime. - [ConditionalOrderRef](/python/api/types/ConditionalOrderRef): User-facing form of a single conditional-order cancel target. - [Connection](/python/api/types/Connection): A page of results plus its `PageInfo` cursors. Generic over the node type. - [Hash256](/python/api/types/Hash256): A 256-bit hash, uppercase hex. `NewType("Hash256", str)` — at runtime it is a plain `str`. - [OrderId](/python/api/types/OrderId): A chain-assigned order id. `NewType("OrderId", str)` — at runtime it is a plain `str` (encoding a `Uint64`). - [OrderRemoved](/python/api/types/OrderRemoved): Event payload for `eventType == "order_removed"`. - [PageInfo](/python/api/types/PageInfo): Cursor-pagination metadata. Mirrors the GraphQL `PageInfo` object. - [PairId](/python/api/types/PairId): A perps pair identifier. `NewType("PairId", str)` — at runtime it is a plain `str`. - [PairParam](/python/api/types/PairParam): Per-pair perps parameters: tick size, margin ratios, vault tuning, bucket sizes. - [PairState](/python/api/types/PairState): Per-pair runtime state: open interest, funding accumulator, current funding rate. - [Param](/python/api/types/Param): Global perps parameters. - [PerpsCandle](/python/api/types/PerpsCandle): One OHLCV candle from the indexer. Keys are camelCase (indexer wire shape). - [PerpsEvent](/python/api/types/PerpsEvent): One indexer event record. Keys are camelCase (indexer wire shape). - [PerpsEventSortBy](/python/api/types/PerpsEventSortBy): Sort order for indexer event queries. - [PerpsPairStats](/python/api/types/PerpsPairStats): 24-hour price and volume stats for one pair. Keys are camelCase (indexer wire shape). - [Position](/python/api/types/Position): One open perps position. Returned inside [`UserState`](./UserState). - [PositionExtended](/python/api/types/PositionExtended): A position plus computed unrealized PnL / funding / liquidation price. - [QueryOrderResponse](/python/api/types/QueryOrderResponse): A resting limit order. The shape returned by [`Info.order`](../methods/info/order). - [QueryOrdersByUserResponseItem](/python/api/types/QueryOrdersByUserResponseItem): One item in [`Info.orders_by_user`](../methods/info/orders_by_user)'s response map. Same shape as `QueryOrderResponse` minus `user` (the map is already keyed by user). - [ReasonForOrderRemoval](/python/api/types/ReasonForOrderRemoval): Reason carried on `OrderRemoved` / `ConditionalOrderRemoved` events. - [SignDoc](/python/api/types/SignDoc): What gets canonical-JSON encoded and SHA-256 hashed before signing. - [State](/python/api/types/State): Global perps runtime state. - [SubmitAction](/python/api/types/SubmitAction): User-facing form of a submit request. Pass to [`batch_update_orders`](../methods/exchange/batch_update_orders). - [TimeInForce](/python/api/types/TimeInForce): Limit-order time-in-force enum. - [Trade](/python/api/types/Trade): A real-time perps trade fill from the `subscribe_perps_trades` stream. Keys are camelCase (indexer wire shape). - [TriggerDirection](/python/api/types/TriggerDirection): Conditional-order trigger direction. - [Tx](/python/api/types/Tx): A signed transaction ready for `Info.broadcast_tx_sync`. - [UnsignedTx](/python/api/types/UnsignedTx): A transaction body ready for `Info.simulate`. - [UserState](/python/api/types/UserState): A user's deposited margin, vault shares, open positions, and pending unlocks. - [UserStateExtended](/python/api/types/UserStateExtended): A user's state plus computed equity / margin / PnL fields. - [run](/python/api/methods/websocket-manager/run): `threading.Thread` entry point. Blocks in `run_forever()` until `stop()`. - [stop](/python/api/methods/websocket-manager/stop): Signal shutdown and close the underlying WebSocket. - [subscribe](/python/api/methods/websocket-manager/subscribe): Register a subscription. Returns an int id usable with `unsubscribe`. - [unsubscribe](/python/api/methods/websocket-manager/unsubscribe): Drop a subscription locally and tell the server to stop streaming. - [all_perps_pair_stats](/python/api/methods/info/all_perps_pair_stats): 24-hour stats for every active pair. - [broadcast_tx_sync](/python/api/methods/info/broadcast_tx_sync): Submit a signed `Tx`. Returns the BroadcastTxOutcome envelope. - [disconnect_websocket](/python/api/methods/info/disconnect_websocket): Close the WebSocket connection and clean up the manager thread. - [liquidity_depth](/python/api/methods/info/liquidity_depth): Aggregated bid/ask depth at a chosen price-bucket granularity. - [order](/python/api/methods/info/order): Fetch a single resting limit order by id. Returns `None` if the order does not exist. - [orders_by_user](/python/api/methods/info/orders_by_user): All resting limit orders for one user, keyed by chain `OrderId`. - [pair_param](/python/api/methods/info/pair_param): Per-pair parameters. Returns `None` if the pair is not configured. - [pair_params](/python/api/methods/info/pair_params): Enumerate per-pair parameters; paginated. - [pair_state](/python/api/methods/info/pair_state): Per-pair runtime state: open interest, funding accumulator, current funding rate. - [pair_states](/python/api/methods/info/pair_states): Enumerate per-pair runtime states; paginated. - [perps_candles](/python/api/methods/info/perps_candles): OHLCV candles for one pair at one interval; cursor-paginated. - [perps_events](/python/api/methods/info/perps_events): Indexer event stream with filter and sort knobs; cursor-paginated. - [perps_events_all](/python/api/methods/info/perps_events_all): Iterate every perps event matching the filter, walking pages internally. - [perps_pair_stats](/python/api/methods/info/perps_pair_stats): 24-hour price/volume stats for one pair. - [perps_param](/python/api/methods/info/perps_param): Global perps parameters: fee schedules, OI caps, funding period, batch size, vault settings. - [perps_state](/python/api/methods/info/perps_state): Global perps runtime state: last funding time, vault share supply, treasury, insurance fund. - [query_app](/python/api/methods/info/query_app): Generic `queryApp` wrapper. Returns the raw kind-keyed envelope. - [query_app_multi](/python/api/methods/info/query_app_multi): Atomically run multiple queries at one block height. Each result is wrapped as `{"Ok": }` or `{"Err": ""}` so partial failures do not abort the batch. - [query_app_smart](/python/api/methods/info/query_app_smart): Convenience wrapper for `{wasm_smart: ...}` queries; unwraps the envelope and returns the contract response directly. - [query_status](/python/api/methods/info/query_status): Chain ID and latest block info. - [simulate](/python/api/methods/info/simulate): Dry-run an `UnsignedTx`. Returns `gas_used`, `gas_limit`, and the simulated result. - [subscribe_block](/python/api/methods/info/subscribe_block): Stream every newly-finalized block. - [subscribe_perps_candles](/python/api/methods/info/subscribe_perps_candles): Stream OHLCV candles for one pair at one interval. - [subscribe_perps_trades](/python/api/methods/info/subscribe_perps_trades): Stream real-time perps trade fills for one pair. - [subscribe_query_app](/python/api/methods/info/subscribe_query_app): Re-run a `queryApp` request every N blocks. The callback receives the contract response under `payload["response"]`. - [subscribe_user_events](/python/api/methods/info/subscribe_user_events): Stream events for one user, optionally filtered by `event_type`. - [unsubscribe](/python/api/methods/info/unsubscribe): Drop a subscription locally and tell the server to stop streaming. - [user_state](/python/api/methods/info/user_state): A user's deposited margin, positions, vault shares, pending unlocks. - [user_state_extended](/python/api/methods/info/user_state_extended): `user_state` plus computed equity, margin, PnL fields. Each computed field is gated by an `include_*` flag so the contract can skip the work when not needed. - [volume](/python/api/methods/info/volume): A user's cumulative trading volume in USD. Used for fee-tier resolution. - [add_liquidity](/python/api/methods/exchange/add_liquidity): Debit USD from the trading margin to mint counterparty-vault LP shares. - [batch_update_orders](/python/api/methods/exchange/batch_update_orders): Submit and cancel multiple orders atomically in one transaction. - [cancel_conditional_order](/python/api/methods/exchange/cancel_conditional_order): Cancel a conditional order by `ConditionalOrderRef`, by `AllForPair`, or `"all"` for every conditional order. - [cancel_order](/python/api/methods/exchange/cancel_order): Cancel an open order by chain `OrderId`, by `ClientOrderIdRef`, or `"all"` to cancel every open order. - [deposit_margin](/python/api/methods/exchange/deposit_margin): Deposit USDC into the perps margin sub-account. Amount is in **base units** (Uint128). - [liquidate](/python/api/methods/exchange/liquidate): Force-close an underwater user's positions. Permissionless — anyone can call. - [remove_liquidity](/python/api/methods/exchange/remove_liquidity): Burn LP shares to schedule a counterparty-vault withdrawal (subject to cooldown). - [set_referral](/python/api/methods/exchange/set_referral): Bind the signer as a referee of `referrer`. Accepts a user\_index `int` or a username `str`. - [submit_conditional_order](/python/api/methods/exchange/submit_conditional_order): Place a conditional (TP/SL) order. Reduce-only by construction. - [submit_limit_order](/python/api/methods/exchange/submit_limit_order): Place a limit order. Convenience wrapper over [`submit_order`](./submit_order). - [submit_market_order](/python/api/methods/exchange/submit_market_order): Place a market order with a slippage cap. Convenience wrapper over [`submit_order`](./submit_order). - [submit_order](/python/api/methods/exchange/submit_order): Place a single perps order. Size is signed: positive = buy, negative = sell. - [withdraw_margin](/python/api/methods/exchange/withdraw_margin): Withdraw USDC from the perps margin sub-account. Amount is in **USD** (6-decimal `UsdValue`). - [dango_decimal](/python/api/helpers/dango_decimal): Return the canonical fixed-decimal string form of `x`. Raises if precision is lost. - [paginate_all](/python/api/helpers/paginate_all): Yield every node across all forward-paginated pages. - [sign_doc_canonical_json](/python/api/helpers/sign_doc_canonical_json): Encode a `SignDoc` as canonical JSON: recursive `sort_keys`, no whitespace, drops `None` from `data`. - [sign_doc_sha256](/python/api/helpers/sign_doc_sha256): SHA-256 digest of a `SignDoc`'s canonical JSON. The 32-byte payload that gets signed. - [ClientError](/python/api/errors/ClientError): Raised on a 4xx HTTP response from the GraphQL endpoint. - [Error](/python/api/errors/Error): Base class for all SDK-raised exceptions. - [GraphQLError](/python/api/errors/GraphQLError): Raised when a GraphQL response carries a non-empty `errors` array, or is missing both `data` and `errors`. - [ServerError](/python/api/errors/ServerError): Raised on a 5xx HTTP response, network-level failure, or non-JSON body from the GraphQL endpoint. - [TxFailed](/python/api/errors/TxFailed): Raised when `broadcastTxSync` returns an `err` result. - [API](/python/api/classes/API): Sync GraphQL POST client. Base class for [`Info`](./Info) and [`Exchange`](./Exchange). - [Exchange](/python/api/classes/Exchange): Build, sign, and broadcast Dango perps transactions on behalf of one account. Subclass of [`API`](./API). - [Info](/python/api/classes/Info): Low-level GraphQL query primitives over HTTP plus subscription transport over WebSocket. Subclass of [`API`](./API). - [Secp256k1Wallet](/python/api/classes/Secp256k1Wallet): Holds a 32-byte secp256k1 secret plus the Dango account address it controls. The only `Wallet`-protocol implementation that ships in tree. - [SingleSigner](/python/api/classes/SingleSigner): Stateful per-account signer; tracks `user_index` and `next_nonce`, produces signed `Tx` envelopes. - [WebsocketManager](/python/api/classes/WebsocketManager): Thread-based `graphql-transport-ws` subscription manager. Subclass of `threading.Thread` (`daemon=True`).