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
10ced110
Commit
10ced110
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add smith membership claim
parent
5d268ba1
No related branches found
No related tags found
1 merge request
!9
add smith and membership commands
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
res/metadata.scale
+0
-0
0 additions, 0 deletions
res/metadata.scale
src/commands/smith.rs
+29
-1
29 additions, 1 deletion
src/commands/smith.rs
with
29 additions
and
1 deletion
res/metadata.scale
+
0
−
0
View file @
10ced110
No preview for this file type
This diff is collapsed.
Click to expand it.
src/commands/smith.rs
+
29
−
1
View file @
10ced110
...
...
@@ -14,6 +14,8 @@ pub enum Subcommand {
Request
{
endpoint
:
String
},
/// Emit a smith certification
Cert
{
to
:
u32
},
/// Claim smith membership
Claim
,
/// go online
GoOnline
,
/// go offline
...
...
@@ -41,7 +43,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
let
mut
data
=
data
.build_client
()
.await
?
;
match
command
{
Subcommand
::
Request
{
endpoint
}
=>
{
dbg!
(
request_smith_membership
(
&
data
,
endpoint
)
.await
)
?
;
request_smith_membership
(
&
data
,
endpoint
)
.await
?
;
}
Subcommand
::
Claim
=>
{
claim_smith_membership
(
&
data
)
.await
?
;
}
Subcommand
::
GoOnline
=>
{
go_online
(
&
data
)
.await
?
;
...
...
@@ -182,6 +187,29 @@ pub async fn go_online(data: &Data) -> Result<(), GcliError> {
Ok
(())
}
/// submit go_offline
pub
async
fn
claim_smith_membership
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
data
.client
()
.tx
()
.sign_and_submit_then_watch
(
&
runtime
::
tx
()
.smith_membership
()
.claim_membership
(),
&
PairSigner
::
new
(
data
.keypair
()),
BaseExtrinsicParamsBuilder
::
new
(),
)
.await
?
;
if
data
.args.no_wait
{
return
Ok
(());
}
let
events
=
track_progress
(
progress
)
.await
?
;
if
let
Some
(
e
)
=
events
.find_first
::
<
runtime
::
smith_membership
::
events
::
MembershipAcquired
>
()
?
{
println!
(
"{e:?}"
);
}
Ok
(())
}
/// submit go_offline
pub
async
fn
go_offline
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
data
...
...
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