-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes for new democracy tutorial * enable enactment and add command * verbose list-communities * fixed CI + nice date info for list-proposals * cosmetics * parse nominal income as float * fixes * move more fetch helpers to APi traits * move bazaar fetchers as well * carg fix * fmt * add get_cycle_duration * add electorate estimate
- Loading branch information
Showing
24 changed files
with
605 additions
and
244 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,11 @@ name = "encointer-client-notee" | |
authors = ["encointer.org <[email protected]>"] | ||
edition = "2021" | ||
#keep with node version. major, minor and patch | ||
version = "1.8.1" | ||
version = "1.8.2" | ||
|
||
[dependencies] | ||
# todo migrate to clap >=3 https://github.com/encointer/encointer-node/issues/107 | ||
chrono = "0.4.35" | ||
clap = "2.33" | ||
clap-nested = "0.4.0" | ||
env_logger = { workspace = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use crate::Api; | ||
use encointer_node_notee_runtime::AccountId; | ||
use encointer_primitives::{ | ||
bazaar::{Business, BusinessIdentifier, OfferingData}, | ||
communities::CommunityIdentifier, | ||
}; | ||
|
||
use substrate_api_client::{ac_compose_macros::rpc_params, rpc::Request}; | ||
|
||
#[maybe_async::maybe_async(?Send)] | ||
pub trait BazaarApi { | ||
async fn get_businesses(&self, cid: CommunityIdentifier) -> Option<Vec<Business<AccountId>>>; | ||
async fn get_offerings(&self, cid: CommunityIdentifier) -> Option<Vec<OfferingData>>; | ||
async fn get_offerings_for_business( | ||
&self, | ||
cid: CommunityIdentifier, | ||
account_id: AccountId, | ||
) -> Option<Vec<OfferingData>>; | ||
} | ||
|
||
#[maybe_async::maybe_async(?Send)] | ||
impl BazaarApi for Api { | ||
async fn get_businesses(&self, cid: CommunityIdentifier) -> Option<Vec<Business<AccountId>>> { | ||
self.client() | ||
.request("encointer_bazaarGetBusinesses", rpc_params![cid]) | ||
.await | ||
.expect("Could not find any businesses...") | ||
} | ||
|
||
async fn get_offerings(&self, cid: CommunityIdentifier) -> Option<Vec<OfferingData>> { | ||
self.client() | ||
.request("encointer_bazaarGetOfferings", rpc_params![cid]) | ||
.await | ||
.expect("Could not find any business offerings...") | ||
} | ||
|
||
async fn get_offerings_for_business( | ||
&self, | ||
cid: CommunityIdentifier, | ||
account_id: AccountId, | ||
) -> Option<Vec<OfferingData>> { | ||
let b_id = BusinessIdentifier::new(cid, account_id); | ||
self.client() | ||
.request("encointer_bazaarGetOfferingsForBusiness", rpc_params![b_id]) | ||
.await | ||
.expect("Could not find any business offerings...") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::{Api, Moment, Result}; | ||
use std::time::Duration; | ||
use substrate_api_client::GetStorage; | ||
|
||
#[maybe_async::maybe_async(?Send)] | ||
pub trait DemocracyApi { | ||
async fn get_proposal_lifetime(&self) -> Result<Duration>; | ||
async fn get_confirmation_period(&self) -> Result<Duration>; | ||
} | ||
|
||
#[maybe_async::maybe_async(?Send)] | ||
impl DemocracyApi for Api { | ||
async fn get_proposal_lifetime(&self) -> Result<Duration> { | ||
Ok(Duration::from_millis( | ||
self.get_constant::<Moment>("EncointerDemocracy", "ProposalLifetime").await?, | ||
)) | ||
} | ||
async fn get_confirmation_period(&self) -> Result<Duration> { | ||
Ok(Duration::from_millis( | ||
self.get_constant::<Moment>("EncointerDemocracy", "ConfirmationPeriod").await?, | ||
)) | ||
} | ||
} |
Oops, something went wrong.