Shared types
Cross-cutting parameter and utility types used across every slice of the SDK. They are public because consumers composing their own higher-level actions need to reference the same building blocks. Most are single-property mixins combined into an action’s parameter type via Compute<A & B>, mirroring the @wagmi/core convention.
Import
import type {
ChainIdParameter,
Compute,
ConfigKeyParameter,
ConfigParameter,
DeepPartial,
ExactPartial,
FromParameter,
QueryParameter,
SimulateBeforeWriteParameter,
SymmioQueryOptions,
WebSocketConstructor,
WebSocketLike,
WriteContractParameter,
WriteSolverParameter,
} from "@symmio/trading-core";Parameter mixins
Single-property object types folded into an action’s parameter type. Each carries exactly one field so it can be mixed into many actions without collision.
ChainIdParameter
Optional chain override, mixed into every action’s parameters.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId when omitted.
ConfigParameter
Optional config override accepted by every hook and action.
configConfigoptionalUse this config instead of the one from context.
ConfigKeyParameter
Folded into query keys so a runtime config override yields a fresh key instead of serving stale cache. The query-option factories set it internally; you rarely pass it by hand.
configKeystringoptionalStable fingerprint of the resolved chain config. Set automatically from config.getChainConfigKey(chainId) and
folded into query keys.
FromParameter
Optional sender for write simulations. Named from (not account) so it never collides with an action’s own account / user field.
fromAddressoptionalThe address the simulation runs as (becomes msg.sender). Defaults to the connected wallet in the React layer.
SimulateBeforeWriteParameter
Per-write opt-out for the pre-send dry-run.
simulateBeforeWritebooleanoptionalDry-run via simulateContract before sending; abort if it would revert. Defaults to the config’s
simulateBeforeWrite (itself true).
Query types
QueryParameter
Optional TanStack Query overrides accepted by every read factory.
queryPartial<QueryObserverOptions>optionalPartial TanStack Query options minus queryKey/queryFn/queryHash/queryKeyHashFn (the factory fills those).
Pass staleTime, gcTime, select, enabled, retry, etc.
SymmioQueryOptions
The object every …QueryOptions factory returns: your QueryParameter passthrough with the SDK’s queryKey and queryFn already filled in. Feed it straight into useQuery / queryClient.fetchQuery.
queryKeyqueryKeyThe SDK-owned query key, pre-filled by the factory.
queryFn() => Promise<queryFnData>The SDK-owned fetcher, pre-filled by the factory.
Every other field is passthrough from QueryParameter’s query — staleTime, select, enabled, and the rest.
WebSocket types
Minimal structural types for a WebSocket implementation the SDK can drive. core stays free of a DOM-lib dependency by typing only the members its reconnecting socket relies on. Inject an implementation via createConfig({ webSocketConstructor }); when omitted the SDK falls back to globalThis.WebSocket.
WebSocketLike
The subset of a WebSocket instance the SDK’s reconnecting socket relies on. Both the browser WebSocket and the ws package satisfy this shape.
readyStatenumberCurrent connection state: 0 connecting, 1 open, 2 closing, 3 closed.
send(data: string) => voidSend a string frame.
close(code?: number, reason?: string) => voidBegin closing the connection.
onopen((event: unknown) => void) | nullFired once the connection opens.
onclose((event: { code?: number; reason?: string; wasClean?: boolean }) => void) | nullFired when the connection closes, cleanly or otherwise.
onerror((event: unknown) => void) | nullFired on a transport-level error.
onmessage((event: { data: unknown }) => void) | nullFired for each inbound frame; data is typically a JSON string.
WebSocketConstructor
A constructor compatible with WebSocketLike. Both globalThis.WebSocket and the ws package’s export match.
interface WebSocketConstructor {
new (url: string, protocols?: string | string[]): WebSocketLike;
}TypeScript helpers
Pure type-level utilities — no runtime output.
Compute
Flattens an intersection of object types into a single, readable object so hover-tooltips show the flat shape instead of a chain of intersections. Purely cosmetic.
type Params = Compute<ChainIdParameter & { user: Address; size: bigint }>;
// hover shows: { chainId?: number; user: Address; size: bigint }DeepPartial
Recursive Partial, but arrays are leaves — an overriding array replaces the original wholesale rather than being patched element-by-element. Used by createConfig({ symmioConfig }), where a consumer may override a single deeply-nested per-chain field.
type DeepPartial<type> = type extends readonly unknown[]
? type
: type extends object
? { [key in keyof type]?: DeepPartial<type[key]> }
: type;ExactPartial
Non-widening Partial: every field becomes optional and explicitly | undefined, without dropping undefined from a union member. Used for query-option shapes where each action parameter turns optional.
type ExactPartial<type> = {
[key in keyof type]?: type[key] | undefined;
};Write parameter helpers
Mixin bundles an action extends with its own action-specific fields. Each is an alias for an intersection of the mixins above, kept as one name so an action’s parameter type stays focused on what is unique to it.
WriteContractParameter
The standard mixin set every on-chain write action accepts. It has no account field of its own — the action adds that.
type WriteContractParameter = ChainIdParameter & FromParameter & SimulateBeforeWriteParameter;Composes ChainIdParameter, FromParameter, and SimulateBeforeWriteParameter. An action folds it in and adds its own fields, e.g. Compute<WriteContractParameter & { account: Address; amount: bigint }>.
WriteSolverParameter
The standard mixin set every off-chain solver/hedger write accepts. Same as WriteContractParameter minus simulateBeforeWrite — solver writes POST to an HTTP endpoint and never simulate on-chain.
type WriteSolverParameter = ChainIdParameter & FromParameter;Composes ChainIdParameter and FromParameter; from stays optional. The action adds its own fields, e.g. Compute<WriteSolverParameter & { partyA: Address; order: InstantCloseOrder }>.
Concrete action-parameter types (e.g. DepositForAccountParameters, InstantCloseParameters) are documented on their own action pages, not here.
Related
- Config — the runtime object every action uses.
- Query options — how the query types plug in.
- WebSocket — where
WebSocketLike/WebSocketConstructorare wired in. - Errors — validation errors reference the field names in these mixins.