-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
SubQuery Integration
Architecture:
Robonomics Node → SubQuery Indexer → PostgreSQL → GraphQL API → UI/Apps
Implementation:
- Create a SubQuery project specifically for
pallet-robonomics-cps - Subscribe to all CPS pallet events:
NodeCreated,NodeUpdated,NodeMoved,NodeDeleted,MetaSet,PayloadSet,CryptoProfileCreated - Build relational schema in PostgreSQL:
nodes (id, parent_id, owner, meta_type, meta_data, payload_type, payload_data, created_at, updated_at) node_history (node_id, action, block_number, timestamp, old_value, new_value) crypto_profiles (id, algorithm, public_params) node_ownership_index (owner, node_id) - Expose GraphQL queries:
getTreeByRoot(rootId)- materialized tree structuregetNodesByOwner(account)- all nodes for ownergetNodeHistory(nodeId)- audit trailsearchNodes(filters)- advanced filtering
Benefits:
- Battle-tested in Polkadot ecosystem
- Built-in GraphQL API
- Historical data & audit trails
- Automatic schema generation
- Multi-chain support
Example SubQuery Manifest:
specVersion: 1. 0.0
name: robonomics-cps-indexer
version: 1. 0.0
runner:
node:
name: '@subql/node-substrate'
version: '*'
description: 'Indexer for Robonomics CPS Pallet'
repository: 'https://github.com/airalab/robonomics-cps-indexer'
schema:
file: ./schema.graphql
network:
chainId: '0x.. .'
endpoint: 'wss://kusama.rpc.robonomics.network'
dataSources:
- kind: substrate/Runtime
startBlock: 1
mapping:
file: ./dist/index.js
handlers:
- handler: handleNodeCreated
kind: substrate/EventHandler
filter:
module: cps
method: NodeCreated
- handler: handleNodeUpdated
kind: substrate/EventHandler
filter:
module: cps
method: NodeUpdatedReactions are currently unavailable
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request