File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed
jcli/src/jcli_app/rest/v0 Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -477,3 +477,36 @@ YAML printed on success
477
477
# timestamp of last time gossip was received from node if ever (optional)
478
478
lastGossipReceived : " 2019-10-14T00:45:59.419496188+00:00"
479
479
` ` `
480
+
481
+ ## Get stake pool details
482
+
483
+ Fetches stake pool details
484
+
485
+ ` ` `
486
+ jcli rest v0 stake-pool get <pool-id> <options>
487
+ ```
488
+
489
+ <pool-id > - hex-encoded pool ID
490
+
491
+ The options are
492
+
493
+ - -h <node_addr> - see [ conventions] ( #conventions )
494
+ - --debug - see [ conventions] ( #conventions )
495
+ - --output-format <format > - see [ conventions] ( #conventions )
496
+
497
+ YAML printed on success
498
+
499
+ ``` yaml
500
+ ---
501
+ tax : # pool reward
502
+ fixed : 5 # what get subtracted as fixed value
503
+ ratio : # ratio of tax after fixed amount is subtracted. Expressed as numerator/denominator
504
+ numerator : 1
505
+ denominator : 10000
506
+ max : 100 # limit of tax (optional)
507
+ total_stake : 2000000000000 # total stake pool value
508
+ # bech32-encoded stake pool KES key
509
+ kesPublicKey : kes25519-12-pk1q7susucqwje0lpetqzjgzncgcrjzx7e2guh900qszdjskkeyqpusf3p39r
510
+ # bech32-encoded stake pool VRF key
511
+ vrfPublicKey : vrf_pk1rcm4qm3q9dtwq22x9a4avnan7a3k987zvepuxwekzj3uyu6a8v0s6sdy0l
512
+ ` ` `
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ mod node;
7
7
mod settings;
8
8
mod shutdown;
9
9
mod stake;
10
+ mod stake_pool;
10
11
mod stake_pools;
11
12
mod tip;
12
13
mod utxo;
@@ -33,6 +34,8 @@ pub enum V0 {
33
34
Settings ( settings:: Settings ) ,
34
35
/// Stake information
35
36
Stake ( stake:: Stake ) ,
37
+ /// Stake pool operations
38
+ StakePool ( stake_pool:: StakePool ) ,
36
39
/// Stake pools operations
37
40
StakePools ( stake_pools:: StakePools ) ,
38
41
/// Shutdown node
@@ -54,6 +57,7 @@ impl V0 {
54
57
V0 :: Node ( node) => node. exec ( ) ,
55
58
V0 :: Settings ( settings) => settings. exec ( ) ,
56
59
V0 :: Stake ( stake) => stake. exec ( ) ,
60
+ V0 :: StakePool ( stake_pool) => stake_pool. exec ( ) ,
57
61
V0 :: StakePools ( stake_pools) => stake_pools. exec ( ) ,
58
62
V0 :: Shutdown ( shutdown) => shutdown. exec ( ) ,
59
63
V0 :: Tip ( tip) => tip. exec ( ) ,
Original file line number Diff line number Diff line change
1
+ use crate :: jcli_app:: rest:: Error ;
2
+ use crate :: jcli_app:: utils:: { DebugFlag , HostAddr , OutputFormat , RestApiSender } ;
3
+ use structopt:: StructOpt ;
4
+
5
+ #[ derive( StructOpt ) ]
6
+ #[ structopt( rename_all = "kebab-case" ) ]
7
+ pub enum StakePool {
8
+ /// Get stake pool details
9
+ Get {
10
+ /// hex-encoded pool ID
11
+ pool_id : String ,
12
+ #[ structopt( flatten) ]
13
+ addr : HostAddr ,
14
+ #[ structopt( flatten) ]
15
+ debug : DebugFlag ,
16
+ #[ structopt( flatten) ]
17
+ output_format : OutputFormat ,
18
+ } ,
19
+ }
20
+
21
+ impl StakePool {
22
+ pub fn exec ( self ) -> Result < ( ) , Error > {
23
+ let StakePool :: Get {
24
+ pool_id,
25
+ addr,
26
+ debug,
27
+ output_format,
28
+ } = self ;
29
+ let url = addr
30
+ . with_segments ( & [ "v0" , "stake_pool" , & pool_id] ) ?
31
+ . into_url ( ) ;
32
+ let builder = reqwest:: Client :: new ( ) . get ( url) ;
33
+ let response = RestApiSender :: new ( builder, & debug) . send ( ) ?;
34
+ response. ok_response ( ) ?;
35
+ let status = response. body ( ) . json_value ( ) ?;
36
+ let formatted = output_format. format_json ( status) ?;
37
+ println ! ( "{}" , formatted) ;
38
+ Ok ( ( ) )
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments