-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-add-agent-pref-endpoint' of github.com:Holo-Hos…
…t/hpos-service-crates into feature-add-agent-pref-endpoint
- Loading branch information
Showing
9 changed files
with
327 additions
and
10 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -13,3 +13,4 @@ pub mod pay_invoices; | |
pub mod profile; | ||
pub mod register_happ; | ||
pub mod set_host_happ_prefs; | ||
pub mod summary; |
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,70 @@ | ||
use anyhow::Result; | ||
use holochain_types::dna::AgentPubKey; | ||
use holochain_types::prelude::{FunctionName, ZomeName}; | ||
use hpos_hc_connect::app_connection::CoreAppRoleName; | ||
use hpos_hc_connect::hha_agent::CoreAppAgent; | ||
use hpos_hc_connect::holofuel_types::MigrationCloseStateV1Handler; | ||
|
||
pub async fn get_my_summary() -> Result<()> { | ||
let mut agent = CoreAppAgent::spawn(None).await?; | ||
|
||
let summary: MigrationCloseStateV1Handler = agent | ||
.app | ||
.zome_call_typed( | ||
CoreAppRoleName::Holofuel.into(), | ||
ZomeName::from("transactor"), | ||
FunctionName::from("get_my_summary"), | ||
(), | ||
) | ||
.await?; | ||
|
||
display(summary); | ||
Ok(()) | ||
} | ||
|
||
pub async fn get_agent_summary(pub_key: AgentPubKey) -> Result<()> { | ||
let mut agent = CoreAppAgent::spawn(None).await?; | ||
|
||
let summary: MigrationCloseStateV1Handler = agent | ||
.app | ||
.zome_call_typed( | ||
CoreAppRoleName::Holofuel.into(), | ||
ZomeName::from("transactor"), | ||
FunctionName::from("get_agent_summary"), | ||
pub_key, | ||
) | ||
.await?; | ||
display(summary); | ||
Ok(()) | ||
} | ||
|
||
fn display(summary: MigrationCloseStateV1Handler) { | ||
println!("==================="); | ||
println!("Your Summary: "); | ||
println!("multi_sig_authorizer: {:?}", summary.multi_sig_authorizer); | ||
println!("reserve_setting: {:?}", summary.reserve_setting); | ||
println!("reserve_sale_price: {:?}", summary.reserve_sale_price); | ||
println!("tx_parked_links: {:?}", summary.tx_parked_links); | ||
println!("cs_txs: {:?}", summary.cs_txs); | ||
println!( | ||
"incomplete_invoice_txs: {:?}", | ||
summary.incomplete_invoice_txs | ||
); | ||
println!( | ||
"incomplete_promise_txs: {:?}", | ||
summary.incomplete_promise_txs | ||
); | ||
println!("Number of cs tx: {:?}", summary.cs_txs.len()); | ||
println!( | ||
"Number of incomplete invoice: {:?}", | ||
summary.incomplete_invoice_txs.len() | ||
); | ||
println!( | ||
"Number of incomplete promises: {:?}", | ||
summary.incomplete_promise_txs.len() | ||
); | ||
println!("Number of declined: {:?}", summary.number_of_declined); | ||
println!("opening_balance: {:?}", summary.opening_balance); | ||
println!("closing_balance: {:?}", summary.closing_balance); | ||
println!("==================="); | ||
} |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ pub mod ledger; | |
pub mod pending; | ||
pub mod profile; | ||
pub mod reserve; | ||
pub mod summary; |
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,70 @@ | ||
use anyhow::Result; | ||
use holochain_types::dna::AgentPubKey; | ||
use holochain_types::prelude::{FunctionName, ZomeName}; | ||
use hpos_hc_connect::app_connection::CoreAppRoleName; | ||
use hpos_hc_connect::hf_agent::HfAgent; | ||
use hpos_hc_connect::holofuel_types::MigrationCloseStateV1Handler; | ||
|
||
pub async fn get_my_summary() -> Result<()> { | ||
let mut agent = HfAgent::spawn(None).await?; | ||
|
||
let summary: MigrationCloseStateV1Handler = agent | ||
.app | ||
.zome_call_typed( | ||
CoreAppRoleName::Holofuel.into(), | ||
ZomeName::from("transactor"), | ||
FunctionName::from("get_my_summary"), | ||
(), | ||
) | ||
.await?; | ||
|
||
display(summary); | ||
Ok(()) | ||
} | ||
|
||
pub async fn get_agent_summary(pub_key: AgentPubKey) -> Result<()> { | ||
let mut agent = HfAgent::spawn(None).await?; | ||
|
||
let summary: MigrationCloseStateV1Handler = agent | ||
.app | ||
.zome_call_typed( | ||
CoreAppRoleName::Holofuel.into(), | ||
ZomeName::from("transactor"), | ||
FunctionName::from("get_agent_summary"), | ||
pub_key, | ||
) | ||
.await?; | ||
display(summary); | ||
Ok(()) | ||
} | ||
|
||
fn display(summary: MigrationCloseStateV1Handler) { | ||
println!("==================="); | ||
println!("Your Summary: "); | ||
println!("multi_sig_authorizer: {:?}", summary.multi_sig_authorizer); | ||
println!("reserve_setting: {:?}", summary.reserve_setting); | ||
println!("reserve_sale_price: {:?}", summary.reserve_sale_price); | ||
println!("tx_parked_links: {:?}", summary.tx_parked_links); | ||
println!("cs_txs: {:?}", summary.cs_txs); | ||
println!( | ||
"incomplete_invoice_txs: {:?}", | ||
summary.incomplete_invoice_txs | ||
); | ||
println!( | ||
"incomplete_promise_txs: {:?}", | ||
summary.incomplete_promise_txs | ||
); | ||
println!("Number of cs tx: {:?}", summary.cs_txs.len()); | ||
println!( | ||
"Number of incomplete invoice: {:?}", | ||
summary.incomplete_invoice_txs.len() | ||
); | ||
println!( | ||
"Number of incomplete promises: {:?}", | ||
summary.incomplete_promise_txs.len() | ||
); | ||
println!("Number of declined: {:?}", summary.number_of_declined); | ||
println!("opening_balance: {:?}", summary.opening_balance); | ||
println!("closing_balance: {:?}", summary.closing_balance); | ||
println!("==================="); | ||
} |
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
Oops, something went wrong.