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. It will update every 100ms. It operates in 2 different modes:

  1. Before PreProposalAggregation: The node will continously build the book from all valid orders for block N inside it's local order storage
  2. After PreProposalAggregation: The node will build the book from the orders in the current PreProposalAggregation - this is too prevent anyone from submitting invalid orders (they are valid, but after the auction, so they will always fail) that will skew UCP in the stream

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.