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
c397f84b
Commit
c397f84b
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add certify command
parent
020be31e
No related branches found
No related tags found
1 merge request
!9
add smith and membership commands
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/commands.rs
+1
-0
1 addition, 0 deletions
src/commands.rs
src/commands/account.rs
+1
-1
1 addition, 1 deletion
src/commands/account.rs
src/commands/certification.rs
+31
-0
31 additions, 0 deletions
src/commands/certification.rs
src/commands/identity.rs
+8
-0
8 additions, 0 deletions
src/commands/identity.rs
with
41 additions
and
1 deletion
src/commands.rs
+
1
−
0
View file @
c397f84b
pub
mod
account
;
pub
mod
blockchain
;
pub
mod
certification
;
pub
mod
collective
;
pub
mod
expire
;
pub
mod
identity
;
...
...
This diff is collapsed.
Click to expand it.
src/commands/account.rs
+
1
−
1
View file @
c397f84b
...
...
@@ -32,7 +32,7 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
match
command
{
Subcommand
::
Balance
=>
{
data
=
data
.fetch_system_properties
()
.await
?
;
commands
::
account
::
get_balance
(
data
)
.await
?
get_balance
(
data
)
.await
?
}
Subcommand
::
Transfer
{
amount
,
...
...
This diff is collapsed.
Click to expand it.
src/commands/certification.rs
0 → 100644
+
31
−
0
View file @
c397f84b
use
crate
::
*
;
/// submit a certification and track progress
pub
async
fn
certify
(
data
:
&
Data
,
receiver
:
u32
)
->
Result
<
(),
anyhow
::
Error
>
{
let
progress
=
data
.client
()
.tx
()
.sign_and_submit_then_watch
(
&
runtime
::
tx
()
.cert
()
.add_cert
(
data
.idty_index
(),
receiver
),
&
PairSigner
::
new
(
data
.keypair
()),
BaseExtrinsicParamsBuilder
::
new
(),
)
.await
?
;
let
events
=
track_progress
(
progress
)
.await
?
;
// look for the expected event
let
new_cert_event
=
events
.find_first
::
<
runtime
::
cert
::
events
::
NewCert
>
()
?
;
let
renew_cert_event
=
events
.find_first
::
<
runtime
::
cert
::
events
::
RenewedCert
>
()
?
;
if
let
Some
(
event
)
=
new_cert_event
{
println!
(
"{event:?}"
);
}
if
let
Some
(
event
)
=
renew_cert_event
{
println!
(
"{event:?}"
);
}
Ok
(())
}
This diff is collapsed.
Click to expand it.
src/commands/identity.rs
+
8
−
0
View file @
c397f84b
...
...
@@ -30,6 +30,8 @@ pub enum Subcommand {
///
/// To be called by the certified not-yet-member account, to become member.
Confirm
{
name
:
String
},
/// Certify an identity
Certify
{
target
:
u32
},
/// Revoke an identity immediately
Revoke
,
/// Generate a revocation document for the provided account
...
...
@@ -61,6 +63,12 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
Subcommand
::
Confirm
{
name
}
=>
{
commands
::
identity
::
confirm_identity
(
data
.keypair
(),
data
.client
(),
name
)
.await
?
;
}
Subcommand
::
Certify
{
target
}
=>
{
data
=
data
.fetch_idty_index
()
.await
?
;
// TODO fetch target username / key / index
// and ask user to confirm certification
commands
::
certification
::
certify
(
&
data
,
target
)
.await
?
;
}
Subcommand
::
Revoke
=>
{
data
=
data
.fetch_idty_index
()
.await
?
;
commands
::
identity
::
revoke_identity
(
data
)
.await
?
;
...
...
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