Adds /quantus/near/tx/<hash> and /quantus/near/intents/<account>, the last two parts of #44. A transaction is assembled from our own nodes where possible. The node tracking the signer's shard returns the transaction. Each receipt it lacks is fetched from the node tracking that receipt's receiver, using EXPERIMENTAL_receipt and a light client proof. A public node is used only when ours cannot serve all of it. The page says which source it used. Once a transaction is complete and every block it touched is final, it is stored in near_tx (migration 0020) as raw JSON and decoded on every read, so decoder fixes apply to stored transactions too. The decoder in blackbeard-core::near_tx orders the receipt tree, decodes function-call arguments, parses EVENT_JSON lines into amounts tied to their tokens, and reads the BRIDGED_FROM, WITHDRAW_TO and refund memos. It is tested against the bridge mint piPTXyoq and the failed swap with refund E4ysnVht. The account page shows balances in intents.near, read live from frankie, the account's intent signing keys, and the QTC activity this observer indexes. It says that activity is not the account's whole history. The bridge, fills and swap tables now link to these pages instead of nearblocks. Both pages still link out to nearblocks. Closes #44 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015tyzzRVjH9AdwGtYwsH5VC
28 lines
1.4 KiB
SQL
28 lines
1.4 KiB
SQL
-- Whole NEAR transactions, kept once nothing about them can change.
|
|
-- blackbeard/observer#44.
|
|
--
|
|
-- A transaction page assembles a transaction from three nodes, a receipt at a
|
|
-- time, or from a rate-limited public node, and our nodes keep about a day and
|
|
-- a half of history. Neither is a cost to pay on every view, and the first
|
|
-- stops being possible at all once the nodes prune. A transaction is written
|
|
-- here only when it is complete (every receipt it spawned has an outcome) and
|
|
-- every block it touched is final, so a row never needs revisiting.
|
|
--
|
|
-- Not chain-scoped: NEAR is one chain, and the same transaction is the same
|
|
-- row whichever Quantus chain's page linked to it.
|
|
create table near_tx (
|
|
hash text primary key,
|
|
signer text not null,
|
|
-- `own` or `public`: which kind of node it was read from.
|
|
source text not null check (source in ('own', 'public')),
|
|
-- EXPERIMENTAL_tx_status, proofs and gas profiles stripped. Stored raw and
|
|
-- decoded on every read, so a fix to the decoder applies to every
|
|
-- transaction already kept.
|
|
status jsonb not null,
|
|
-- {"<block hash>": [height, unix milliseconds]} for every block it touched.
|
|
blocks jsonb not null,
|
|
-- {"<account>": shard} for every account a receipt executed on.
|
|
shards jsonb not null,
|
|
stored_at timestamptz not null default now()
|
|
);
|