The price of a token on NEAR Intents is the ratio inside a trade that
`intents.near` actually executed; there is no pool, oracle or stored price,
and a 1Click quote is an offer. This reads `execute_intents` transactions on
the contract's shard, keeps the `token_diff` legs whose receipt succeeded and
whose intent is in `intents_executed`, and records one trade per asset/counter
pair per outcome, counting each unit once whichever side the taker was on.
- core: event parsing, trade building, shard lookup, price and VWAP, tested
against the logs of mainnet tx 85uy9uCF (USDT on Tron for ZEC).
- data: a NEAR client over the existing RpcClient, live then archival;
migration 0009 (intents_trade, intents_scan, near_token).
- api: a contiguous-cursor scan and a supply/listing poll per chain, and
GET /v1/chains/{chain}/intents/{swaps,price}. Prices are in counter-token
units; no USD until a stablecoin is named by contract.
Gated on `[chains.intents]`, which the config template leaves commented out:
FastNEAR's free RPC sustains about two requests a second against ~1.7 needed
to follow the tip, and neardata allows 30 blocks a minute. It waits for our
own node. A test renders the template and fails if the block is enabled.
Verified end to end against mainnet with ZEC configured: the trade at NEAR
218,261,895 was recorded and served by both routes.
Refs #27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015pkwBsR54NRmZyU4QVhvfj
35 lines
863 B
TOML
35 lines
863 B
TOML
[package]
|
|
name = "blackbeard-data"
|
|
description = "Chain RPC, telemetry feed and Postgres access for blackbeard.observer."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
|
|
[dependencies]
|
|
blackbeard-core.workspace = true
|
|
blackbeard-entities.workspace = true
|
|
|
|
base64.workspace = true
|
|
bigdecimal.workspace = true
|
|
chrono.workspace = true
|
|
futures-util.workspace = true
|
|
hex.workspace = true
|
|
primitive-types.workspace = true
|
|
reqwest.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
sqlx.workspace = true
|
|
thiserror.workspace = true
|
|
tokio.workspace = true
|
|
tokio-tungstenite.workspace = true
|
|
tracing.workspace = true
|
|
url.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true }
|
|
sqlx = { workspace = true }
|
|
chrono = { workspace = true }
|