2024-07-08 16:13:59 +03:00
|
|
|
interface kns-indexer {
|
2024-05-06 21:12:08 +03:00
|
|
|
/// IndexerRequests are used to query discrete information from the indexer
|
|
|
|
/// for example, if you want to know the human readable name for a namehash,
|
|
|
|
/// you would send a NamehashToName request.
|
|
|
|
/// If you want to know the most recent on-chain routing information for a
|
|
|
|
/// human readable name, you would send a NodeInfo request.
|
|
|
|
/// The block parameter specifies the recency of the data: the indexer will
|
|
|
|
/// not respond until it has processed events up to the specified block.
|
2024-12-17 04:23:14 +03:00
|
|
|
variant indexer-request {
|
2024-05-06 21:12:08 +03:00
|
|
|
/// return the human readable name for a namehash
|
|
|
|
/// returns an Option<String>
|
2024-05-07 02:48:23 +03:00
|
|
|
namehash-to-name(namehash-to-name-request),
|
2024-05-06 21:12:08 +03:00
|
|
|
/// return the most recent on-chain routing information for a node name.
|
|
|
|
/// returns an Option<KnsUpdate>
|
|
|
|
/// set block to 0 if you just want to get the current state of the indexer
|
2024-05-07 02:48:23 +03:00
|
|
|
node-info(node-info-request),
|
2024-05-06 21:12:08 +03:00
|
|
|
/// return the entire state of the indexer at the given block
|
|
|
|
/// set block to 0 if you just want to get the current state of the indexer
|
2024-05-07 02:48:23 +03:00
|
|
|
get-state(get-state-request),
|
2024-05-06 21:12:08 +03:00
|
|
|
}
|
|
|
|
|
2024-12-17 04:23:14 +03:00
|
|
|
variant indexer-response {
|
|
|
|
name(option<string>),
|
|
|
|
node-info(option<wit-kns-update>),
|
|
|
|
get-state(wit-state),
|
|
|
|
}
|
|
|
|
|
2024-05-06 21:12:08 +03:00
|
|
|
record namehash-to-name-request {
|
|
|
|
hash: string,
|
|
|
|
block: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
record node-info-request {
|
|
|
|
name: string,
|
|
|
|
block: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
record get-state-request {
|
|
|
|
block: u64,
|
|
|
|
}
|
2024-12-17 04:23:14 +03:00
|
|
|
|
|
|
|
record wit-kns-update {
|
|
|
|
name: string,
|
|
|
|
public-key: string,
|
|
|
|
ips: list<string>,
|
|
|
|
ports: list<tuple<string, u16>>, // map, but wit doesn't support maps
|
|
|
|
routers: list<string>,
|
|
|
|
}
|
|
|
|
|
|
|
|
record wit-state {
|
|
|
|
chain-id: u64,
|
|
|
|
contract-address: list<u8>, // 20-byte ETH address
|
|
|
|
names: list<tuple<string, string>>, // map, but wit doesn't support maps
|
|
|
|
nodes: list<tuple<string, wit-kns-update>>, // map, but wit doesn't support maps
|
|
|
|
last-block: u64,
|
|
|
|
}
|
2024-05-06 21:12:08 +03:00
|
|
|
}
|
2024-05-16 04:27:07 +03:00
|
|
|
|
2024-07-08 16:13:59 +03:00
|
|
|
world kns-indexer-sys-v0 {
|
|
|
|
import kns-indexer;
|
2024-12-10 01:08:50 +03:00
|
|
|
include process-v1;
|
2024-05-16 04:27:07 +03:00
|
|
|
}
|