Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğ
Ğcli-v2s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Rust
Ğcli-v2s
Commits
e23868d8
Commit
e23868d8
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add new smith commands
parent
a14024bb
No related branches found
No related tags found
1 merge request
!15
update to runtime 800
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/commands/smith.rs
+43
-2
43 additions, 2 deletions
src/commands/smith.rs
src/display.rs
+15
-0
15 additions, 0 deletions
src/display.rs
with
58 additions
and
2 deletions
src/commands/smith.rs
+
43
−
2
View file @
e23868d8
...
...
@@ -56,6 +56,12 @@ pub enum Subcommand {
},
/// List online authorities
ShowOnline
,
/// Invite identity to become smith
Invite
{
target
:
IdtyId
},
/// Accept invitation
Accept
,
/// Certify smith
Certify
{
target
:
IdtyId
},
}
/// handle smith commands
...
...
@@ -81,13 +87,21 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
set_session_keys
(
&
data
,
session_keys
)
.await
?
;
}
Subcommand
::
ShowExpire
{
blocks
,
sessions
}
=>
{
data
=
data
.build_
client
()
.await
?
.build_
indexer
()
.await
?
;
data
=
data
.build_indexer
()
.await
?
;
commands
::
expire
::
monitor_expirations
(
&
data
,
blocks
,
sessions
)
.await
?
}
Subcommand
::
ShowOnline
=>
{
data
=
data
.build_client
()
.await
?
;
online
(
&
data
)
.await
?
}
Subcommand
::
Invite
{
target
}
=>
{
invite_smith
(
&
data
,
target
)
.await
?
}
Subcommand
::
Accept
=>
{
accept_invitation
(
&
data
)
.await
?
}
Subcommand
::
Certify
{
target
}
=>
{
certify_smith
(
&
data
,
target
)
.await
?
}
};
Ok
(())
...
...
@@ -254,3 +268,30 @@ pub async fn online(data: &Data) -> Result<(), anyhow::Error> {
Ok
(())
}
/// invite identity to join smith
pub
async
fn
invite_smith
(
data
:
&
Data
,
target
:
IdtyId
)
->
Result
<
(),
subxt
::
Error
>
{
submit_call_and_look_event
::
<
runtime
::
smith_members
::
events
::
InvitationSent
,
Payload
<
runtime
::
smith_members
::
calls
::
types
::
InviteSmith
>
,
>
(
data
,
&
runtime
::
tx
()
.smith_members
()
.invite_smith
(
target
))
.await
}
/// accept invitation
pub
async
fn
accept_invitation
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
submit_call_and_look_event
::
<
runtime
::
smith_members
::
events
::
InvitationAccepted
,
Payload
<
runtime
::
smith_members
::
calls
::
types
::
AcceptInvitation
>
,
>
(
data
,
&
runtime
::
tx
()
.smith_members
()
.accept_invitation
())
.await
}
/// invite identity to join smith
pub
async
fn
certify_smith
(
data
:
&
Data
,
target
:
IdtyId
)
->
Result
<
(),
subxt
::
Error
>
{
submit_call_and_look_event
::
<
runtime
::
smith_members
::
events
::
CertificationReceived
,
Payload
<
runtime
::
smith_members
::
calls
::
types
::
CertifySmith
>
,
>
(
data
,
&
runtime
::
tx
()
.smith_members
()
.certify_smith
(
target
))
.await
}
This diff is collapsed.
Click to expand it.
src/display.rs
+
15
−
0
View file @
e23868d8
...
...
@@ -60,6 +60,21 @@ impl DisplayEvent for runtime::distance::events::EvaluationRequested {
format!
(
"evaluation requested {:?}"
,
self
)
}
}
impl
DisplayEvent
for
runtime
::
smith_members
::
events
::
InvitationSent
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"sent smith invitation {:?}"
,
self
)
}
}
impl
DisplayEvent
for
runtime
::
smith_members
::
events
::
InvitationAccepted
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"accepted smith invitation {:?}"
,
self
)
}
}
impl
DisplayEvent
for
runtime
::
smith_members
::
events
::
CertificationReceived
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"new smith certification {:?}"
,
self
)
}
}
impl
DisplayEvent
for
runtime
::
identity
::
events
::
IdtyRemoved
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"identity removed {:?}"
,
self
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment