The shell manager once it starts, it should query the node to get all the blueprints that this operator is registered in, then it listens for a stream of finality notifications.
In other words, we do this at startup, to get a full view of the world (i.e sync):
let servicesWithBlueprint = await api.rpc.services.queryServicesWithBlueprintsByOperator(ALICE);
Then we should listen for events that are produced by the network, and here are some of them:
/// An new operator has been registered.
Registered {
/// The account that registered as a operator.
provider: T::AccountId,
/// The ID of the service blueprint.
blueprint_id: u64,
/// The preferences for the operator for this specific blueprint.
preferences: OperatorPreferences,
/// The arguments used for registration.
registration_args: Vec<Field<T::Constraints, T::AccountId>>,
}
/// An operator has been unregistered.
Unregistered {
/// The account that unregistered as am operator.
operator: T::AccountId,
/// The ID of the service blueprint.
blueprint_id: u64,
}
Overview
The shell manager once it starts, it should query the node to get all the blueprints that this operator is registered in, then it listens for a stream of finality notifications.
In other words, we do this at startup, to get a full view of the world (i.e sync):
Then we should listen for events that are produced by the network, and here are some of them:
These events should tell you that if the current operator has registered or unregistered from a blueprint. More could be found here: https://github.com/webb-tools/tangle/blob/74ef976802a68b960677277786b91bca13e260a3/pallets/services/src/lib.rs#L196-L330
Task Checklist