API Reference
Understanding types and functionality through the API spec, distinguished by environment
Off-chain (TypeScript)
WebSocket Subscription Initialization Params
/**
* @property The notification result data containing information about the event topic, data and view results
*/
export type SubscriptionCallback = {
result: {
topics: Hex[],
data: Hex,
simulationResults: Hex[]
}
}
/**
* @property ethCalls Fixed set of ETH calls that must be executed before onData callback is triggered. Multicall3 is recommended. Can be an empty array
* @property context Event sourced selectors to be added to the data field of ETH calls, possible values: topic0, topic1, topic2, topic3, topic4, data and address
* @property onData Callback for a successful reactivity notification
* @property onError Callback for a failed attempt
* @property eventContractSources Alternative contract event source(s) (any on somnia) that will be emitting the logs specified by topicOverrides
* @property topicOverrides Optional filter for specifying topics of interest, otherwise wildcard filter is applied (all events watched)
* @property onlyPushChanges Whether the data should be pushed to the subscriber only if eth_call results are different from the previous
*/
export type WebsocketSubscriptionInitParams = {
ethCalls: EthCall[]
context?: string
onData: (data: SubscriptionCallback) => void
onError?: (error: Error) => void
eventContractSources?: Address[]
topicOverrides?: Hex[]
onlyPushChanges?: boolean
}Solidity Subscription Creation from SDK
Solidity subscription info query from SDK
Last updated