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
8a835b7a
Commit
8a835b7a
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add smith membership renewal
parent
10ced110
No related branches found
No related tags found
1 merge request
!9
add smith and membership commands
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/commands/smith.rs
+29
-1
29 additions, 1 deletion
src/commands/smith.rs
with
29 additions
and
1 deletion
src/commands/smith.rs
+
29
−
1
View file @
8a835b7a
...
@@ -16,6 +16,8 @@ pub enum Subcommand {
...
@@ -16,6 +16,8 @@ pub enum Subcommand {
Cert
{
to
:
u32
},
Cert
{
to
:
u32
},
/// Claim smith membership
/// Claim smith membership
Claim
,
Claim
,
/// Renew smith membership
Renew
,
/// go online
/// go online
GoOnline
,
GoOnline
,
/// go offline
/// go offline
...
@@ -48,6 +50,9 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
...
@@ -48,6 +50,9 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
Subcommand
::
Claim
=>
{
Subcommand
::
Claim
=>
{
claim_smith_membership
(
&
data
)
.await
?
;
claim_smith_membership
(
&
data
)
.await
?
;
}
}
Subcommand
::
Renew
=>
{
renew_smith_membership
(
&
data
)
.await
?
;
}
Subcommand
::
GoOnline
=>
{
Subcommand
::
GoOnline
=>
{
go_online
(
&
data
)
.await
?
;
go_online
(
&
data
)
.await
?
;
}
}
...
@@ -187,7 +192,7 @@ pub async fn go_online(data: &Data) -> Result<(), GcliError> {
...
@@ -187,7 +192,7 @@ pub async fn go_online(data: &Data) -> Result<(), GcliError> {
Ok
(())
Ok
(())
}
}
///
submit go_offline
///
claim smith membership
pub
async
fn
claim_smith_membership
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
pub
async
fn
claim_smith_membership
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
data
let
progress
=
data
.client
()
.client
()
...
@@ -210,6 +215,29 @@ pub async fn claim_smith_membership(data: &Data) -> Result<(), subxt::Error> {
...
@@ -210,6 +215,29 @@ pub async fn claim_smith_membership(data: &Data) -> Result<(), subxt::Error> {
Ok
(())
Ok
(())
}
}
/// renew smith membership
pub
async
fn
renew_smith_membership
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
data
.client
()
.tx
()
.sign_and_submit_then_watch
(
&
runtime
::
tx
()
.smith_membership
()
.renew_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
::
MembershipRenewed
>
()
?
{
println!
(
"{e:?}"
);
}
Ok
(())
}
/// submit go_offline
/// submit go_offline
pub
async
fn
go_offline
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
pub
async
fn
go_offline
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
data
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