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
03def054
Commit
03def054
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add tech propose
parent
292ab353
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/collective.rs
+21
-11
21 additions, 11 deletions
src/commands/collective.rs
src/display.rs
+5
-0
5 additions, 0 deletions
src/display.rs
with
26 additions
and
11 deletions
src/commands/collective.rs
+
21
−
11
View file @
03def054
...
@@ -8,6 +8,8 @@ pub enum Subcommand {
...
@@ -8,6 +8,8 @@ pub enum Subcommand {
#[default]
#[default]
/// List members of the technical committee
/// List members of the technical committee
Members
,
Members
,
/// Propose a hex encoded call
Propose
{
hex
:
String
},
/// List proposals to the technical committee
/// List proposals to the technical committee
Proposals
,
Proposals
,
/// Vote a proposal to the technical committee
/// Vote a proposal to the technical committee
...
@@ -23,24 +25,18 @@ pub enum Subcommand {
...
@@ -23,24 +25,18 @@ pub enum Subcommand {
/// handle technical committee commands
/// handle technical committee commands
pub
async
fn
handle_command
(
data
:
Data
,
command
:
Subcommand
)
->
Result
<
(),
GcliError
>
{
pub
async
fn
handle_command
(
data
:
Data
,
command
:
Subcommand
)
->
Result
<
(),
GcliError
>
{
let
mut
data
=
data
.build_client
()
.await
?
.build_indexer
()
.await
?
;
let
data
=
data
.build_client
()
.await
?
;
match
command
{
match
command
{
Subcommand
::
Members
=>
{
Subcommand
::
Members
=>
technical_committee_members
(
&
data
)
.await
?
,
data
=
data
.build_client
()
.await
?
;
Subcommand
::
Propose
{
hex
}
=>
technical_committee_propose
(
&
data
,
&
hex
)
.await
?
,
commands
::
collective
::
technical_committee_members
(
&
data
)
.await
?
Subcommand
::
Proposals
=>
technical_committee_proposals
(
data
.client
())
.await
?
,
}
Subcommand
::
Proposals
=>
{
data
=
data
.build_client
()
.await
?
;
commands
::
collective
::
technical_committee_proposals
(
data
.client
())
.await
?
}
Subcommand
::
Vote
{
hash
,
index
,
vote
}
=>
{
Subcommand
::
Vote
{
hash
,
index
,
vote
}
=>
{
data
=
data
.build_client
()
.await
?
;
let
vote
=
match
vote
{
let
vote
=
match
vote
{
0
=>
false
,
0
=>
false
,
1
=>
true
,
1
=>
true
,
_
=>
panic!
(
"Vote must be written 0 if you disagree, or 1 if you agree."
),
_
=>
panic!
(
"Vote must be written 0 if you disagree, or 1 if you agree."
),
};
};
commands
::
collective
::
technical_committee_vote
(
technical_committee_vote
(
&
data
,
hash
,
//Hash::from_str(&hash).expect("Invalid hash formatting"),
&
data
,
hash
,
//Hash::from_str(&hash).expect("Invalid hash formatting"),
index
,
vote
,
index
,
vote
,
)
)
...
@@ -141,3 +137,17 @@ pub async fn technical_committee_vote(
...
@@ -141,3 +137,17 @@ pub async fn technical_committee_vote(
)
)
.await
.await
}
}
/// propose call given as hexadecimal
/// can be generated with `subxt explore` for example
pub
async
fn
technical_committee_propose
(
data
:
&
Data
,
proposal
:
&
str
)
->
Result
<
(),
subxt
::
Error
>
{
let
raw_call
=
hex
::
decode
(
proposal
)
.expect
(
"invalid hex"
);
let
call
=
codec
::
decode_from_bytes
(
raw_call
.into
())
.expect
(
"invalid call"
);
let
payload
=
runtime
::
tx
()
.technical_committee
()
.propose
(
5
,
call
,
100
);
submit_call_and_look_event
::
<
runtime
::
technical_committee
::
events
::
Proposed
,
Payload
<
runtime
::
technical_committee
::
calls
::
types
::
Propose
>
,
>
(
data
,
&
payload
)
.await
}
This diff is collapsed.
Click to expand it.
src/display.rs
+
5
−
0
View file @
03def054
...
@@ -150,3 +150,8 @@ impl DisplayEvent for runtime::sudo::events::Sudid {
...
@@ -150,3 +150,8 @@ impl DisplayEvent for runtime::sudo::events::Sudid {
format!
(
"SUDO call succeeded {:?}"
,
self
)
format!
(
"SUDO call succeeded {:?}"
,
self
)
}
}
}
}
impl
DisplayEvent
for
runtime
::
technical_committee
::
events
::
Proposed
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"proposed {:?}"
,
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