-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add indy-vdr-proxy BaseLedger impl, introduce tx submitter architectu…
…re (#837) Add indy-vdr-proxy BaseLedger impl, introduce tx submitter architecture Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
- Loading branch information
Showing
26 changed files
with
549 additions
and
168 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
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
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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#[cfg(feature = "modular_libs")] | ||
pub mod modular_libs_profile; | ||
pub mod profile; | ||
#[cfg(feature = "vdr_proxy_ledger")] | ||
pub mod vdr_proxy_profile; | ||
#[cfg(feature = "vdrtools")] | ||
pub mod vdrtools_profile; |
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,47 @@ | ||
use std::sync::Arc; | ||
|
||
use aries_vcx_core::{ | ||
anoncreds::{base_anoncreds::BaseAnonCreds, indy_anoncreds::IndySdkAnonCreds}, | ||
ledger::{ | ||
base_ledger::BaseLedger, indy_vdr_ledger::IndyVdrLedger, request_submitter::vdr_proxy::VdrProxySubmitter, | ||
}, | ||
wallet::{base_wallet::BaseWallet, indy_wallet::IndySdkWallet}, | ||
VdrProxyClient, WalletHandle, | ||
}; | ||
|
||
use super::profile::Profile; | ||
|
||
#[derive(Debug)] | ||
pub struct VdrProxyProfile { | ||
wallet: Arc<dyn BaseWallet>, | ||
ledger: Arc<dyn BaseLedger>, | ||
anoncreds: Arc<dyn BaseAnonCreds>, | ||
} | ||
|
||
impl VdrProxyProfile { | ||
pub fn new(wallet_handle: WalletHandle, client: VdrProxyClient) -> Self { | ||
let wallet = Arc::new(IndySdkWallet::new(wallet_handle)); | ||
let submitter = Arc::new(VdrProxySubmitter::new(Arc::new(client))); | ||
let ledger = Arc::new(IndyVdrLedger::new(wallet.clone(), submitter)); | ||
let anoncreds = Arc::new(IndySdkAnonCreds::new(wallet_handle)); | ||
VdrProxyProfile { | ||
wallet, | ||
ledger, | ||
anoncreds, | ||
} | ||
} | ||
} | ||
|
||
impl Profile for VdrProxyProfile { | ||
fn inject_ledger(self: Arc<Self>) -> Arc<dyn BaseLedger> { | ||
Arc::clone(&self.ledger) | ||
} | ||
|
||
fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> { | ||
Arc::clone(&self.anoncreds) | ||
} | ||
|
||
fn inject_wallet(&self) -> Arc<dyn BaseWallet> { | ||
Arc::clone(&self.wallet) | ||
} | ||
} |
Oops, something went wrong.