89 lines
3 KiB
Protocol Buffer
89 lines
3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package nu.rpc;
|
|
|
|
import "types/block.proto";
|
|
import "types/transaction.proto";
|
|
import "types/story_node.proto";
|
|
import "types/nft.proto";
|
|
|
|
// JSON-RPC v2 method catalog — v0.1
|
|
// All methods over HTTP POST /rpc and WS /ws
|
|
|
|
// ── Queries ──────────────────────────────────────────────────────────────────
|
|
|
|
message GetBlockRequest { uint64 height = 1; }
|
|
message GetBlockResponse { nu.types.Block block = 1; }
|
|
|
|
message GetTxRequest { string tx_id = 1; }
|
|
message GetTxResponse {
|
|
nu.types.Transaction tx = 1;
|
|
nu.types.BlockReceipt receipt = 2;
|
|
}
|
|
|
|
message GetAccountRequest { string address = 1; }
|
|
message GetAccountResponse {
|
|
string address = 1;
|
|
uint64 balance = 2; // NUT micro-units
|
|
uint64 staked = 3;
|
|
uint64 locked = 4;
|
|
uint64 locked_until = 5; // Unix epoch ms
|
|
string pon_score = 6; // decimal string
|
|
repeated string nft_ids = 7;
|
|
}
|
|
|
|
message GetStoryRequest { string story_id = 1; }
|
|
message GetStoryResponse {
|
|
nu.types.Story story = 1;
|
|
repeated nu.types.StoryNode nodes = 2;
|
|
}
|
|
|
|
message GetNodeRequest { string node_id = 1; } // canonical or temp_id
|
|
message GetNodeResponse { nu.types.StoryNode node = 1; }
|
|
|
|
message GetNftRequest { string nft_id = 1; }
|
|
message GetNftResponse { nu.types.Nft nft = 1; }
|
|
|
|
message ListStoriesRequest {
|
|
uint32 page = 1;
|
|
uint32 per_page = 2;
|
|
}
|
|
message ListStoriesResponse {
|
|
repeated nu.types.Story stories = 1;
|
|
uint32 total = 2;
|
|
}
|
|
|
|
message ListPendingVotesRequest { string voter = 1; } // Address; empty = all
|
|
message ListPendingVotesResponse { repeated nu.types.StoryNode nodes = 1; }
|
|
|
|
// ── Mutations ────────────────────────────────────────────────────────────────
|
|
|
|
message SendRawTxRequest { bytes raw_tx = 1; } // protobuf-encoded signed Transaction
|
|
message SendRawTxResponse {
|
|
string tx_id = 1;
|
|
bool queued = 2;
|
|
string error = 3;
|
|
}
|
|
|
|
// ── Chain Info ───────────────────────────────────────────────────────────────
|
|
|
|
message ChainInfoRequest {}
|
|
message ChainInfoResponse {
|
|
uint64 latest_height = 1;
|
|
string latest_hash = 2;
|
|
uint32 validator_count = 3;
|
|
string chain_id = 4; // e.g. "nu-devnet-1"
|
|
}
|
|
|
|
// ── WebSocket Subscriptions (event stream) ───────────────────────────────────
|
|
|
|
message SubscribeRequest {
|
|
repeated string topics = 1;
|
|
// topics: "blocks", "node:<story_id>", "vote:<node_id>", "nft:<address>"
|
|
}
|
|
|
|
message Event {
|
|
string topic = 1;
|
|
string kind = 2; // "new_block" | "node_approved" | "vote_cast" | "nft_minted"
|
|
bytes payload = 3; // protobuf-encoded type depending on kind
|
|
}
|