Skip to main content

subscribeAmm

Subscribe to seqenced updates of the target AMM endstate of angstrom for block N + 1. This Stream will only start updating once the pool moves from the current block N state.

Params

This subscription method currently does not accept any filtering parameters. Subscribers will receive all empty block attestations emitted by the connected Angstrom node.

ParameterTypeDescription
poolsHashSetthe set of pool_ids to receive updates for

Request

To subscribe, send a JSON-RPC request to the Angstrom WebSocket endpoint:

wscat -c ws://<ANGSTROM_URL>:<ANGSTROM_PORT>
> {"jsonrpc": "2.0", "id": 1, "method": "angstrom_subscribeAmm", "params": [["0x234241..112"]]}

Response

When an

{
"jsonrpc": "2.0",
"method": "angstrom_subscribeAmm",
"params": {
"subscription": "SUBSCRIPTION_ID_EXAMPLE_XYZ789",
"result": {
// What update this is. There are max 120 updates per block
"seq_id": 0,
"current_block:": 123,
"angstrom_pool_id": 0x2341,
"uni_pool_id": 0x21111,
"liquidity": 49412451353253425,
"sqrt_price_x96": 12412451353253425,
"tick": 10040
}
}
}

Using the Slot0 data

These updates allow anyone to simulate swapping on the expected angstrom state after a bundle lands.