-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from zianksm/pre-release-v0.1.2
Pre release v0.1.2
- Loading branch information
Showing
52 changed files
with
1,847 additions
and
1,312 deletions.
There are no files selected for viewing
File renamed without changes.
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,5 @@ | ||
[workspace] | ||
members = [ | ||
"dhatu", | ||
"mandala-node-runner", | ||
] |
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 was deleted.
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
# dhatu-identity-registrar | ||
dhatu core libraries | ||
# **Dhatu Core Libraries** |
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,22 +1,106 @@ | ||
use crate::{ | ||
registrar::key_manager::prelude::KeypairGenerationError, | ||
tx::extrinsics::prelude::{reserve::FundsReserveError, CallbackExecutorError}, types::MandalaClientErorr, | ||
}; | ||
|
||
/// the base error enum. this is the expected error type that will be returned. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
/// error when generating password for keypair phrase. | ||
#[error("password generation error : {0}")] | ||
PasswordGenError(String), | ||
Password(#[from] PasswordGenerationError), | ||
|
||
/// error when generating keypair. | ||
#[error("keypair generation error : ")] | ||
KeypairGenError(#[from] KeypairGenerationError), | ||
Keypair(#[from] KeypairGenerationError), | ||
|
||
/// error associated with the underlying blockchain rpc client. | ||
#[error("mandala client error :")] | ||
Client(#[from] MandalaClientErorr), | ||
|
||
/// error associated with reserve funds transactions. | ||
#[error("reserve error : ")] | ||
ReserveError(#[from] FundsReserveError), | ||
Reserve(#[from] FundsReserveError), | ||
|
||
/// error when executing transaction http callback. | ||
#[error("callback executor error : ")] | ||
CallbackError(#[from] CallbackExecutorError) | ||
Callback(#[from] CallbackExecutorError), | ||
|
||
/// transaction related error. | ||
#[error("error when submitting transaction : {0}")] | ||
Transaction(#[from] subxt::Error), | ||
|
||
/// error when encoding calldata to contract pallet payload. | ||
#[error("error when converting to payload : {0}")] | ||
Payload(#[from] ToPayloadError), | ||
|
||
/// error when signing transaction. | ||
#[error("error when signing transaction : {0}")] | ||
Sign(#[from] TxBuilderError), | ||
} | ||
|
||
/// error related to keypair password generation. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum PasswordGenerationError { | ||
#[error("invalid length. password length must be at least 32 characters long!")] | ||
InvalidLength, | ||
} | ||
|
||
/// all error that can happen when generating and parsing keypair related stuff. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum KeypairGenerationError { | ||
/// error parsing keypair. | ||
#[error("{0}")] | ||
PublicAddress(String), | ||
|
||
/// error parsing mnemonic phrase. | ||
#[error("fail to generate mnemonic phrase with {0}")] | ||
MnemonicPhrase(String), | ||
|
||
/// error parsing private key. | ||
#[error("{0}")] | ||
PrivateKey(#[from] sp_core::crypto::SecretStringError), | ||
|
||
/// error recovering keypair. | ||
#[error("{0}")] | ||
Recover(String), | ||
} | ||
|
||
/// error that happens on the underlying blockchain rpc client. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum MandalaClientErorr { | ||
/// error associating with the node connection | ||
#[error("connection Error : {0}")] | ||
Connection(#[from] subxt::Error), | ||
} | ||
|
||
/// reserve funds transaction error | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum FundsReserveError { | ||
/// rpc related error | ||
#[error("{0}")] | ||
RpcError(#[from] subxt::error::Error), | ||
|
||
/// account does not exist, happens when trying | ||
/// to transfer funds to an account that does not exist. | ||
#[error("account does not exist!")] | ||
NonExistentAccount, | ||
} | ||
|
||
/// errors related with executing transaction http callback. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum CallbackExecutorError { | ||
/// failed to parse url. | ||
#[error("{0}")] | ||
InvalidUrl(String), | ||
} | ||
|
||
/// errors that can happen when encoding calldata to pallet contrats payload. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum ToPayloadError { | ||
/// failed to parse account address. | ||
#[error("{0}")] | ||
AddressError(String), | ||
} | ||
|
||
/// errors that can happen when signing transaction. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum TxBuilderError { | ||
#[error("{0}")] | ||
SignErorr(#[from] subxt::Error), | ||
} |
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,6 @@ | ||
#[cfg(feature = "unstable_sp_core")] | ||
pub use sp_core; | ||
#[cfg(feature = "subxt")] | ||
pub use subxt; | ||
#[cfg(feature = "sp-keyring")] | ||
pub use sp_keyring; |
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,31 @@ | ||
//! dhatu core libraries. aims to abstract away the complexity of interacting to substrate blockchain. | ||
//! for now, is meant to be used with mandala based blockchains. but in future, it will be extended to support other substrate based blockchains. | ||
//! # Re-exports | ||
//! ``` | ||
//! #[cfg(feature = "unstable_sp_core")] | ||
//! pub use sp_core; | ||
//! #[cfg(feature = "subxt")] | ||
//! pub use subxt; | ||
//! #[cfg(feature = "sp_keyring")] | ||
//! pub use sp_keyring; | ||
//! ``` | ||
//! due to the unstable nature of substrate modules, they are not re-exported by default. | ||
//! if you want to interact with the some of the low level feature of dhatu and use the raw substrate primitive types, | ||
//! we reccomend you to enable `unstable` feature flag to properly interact with the low level modules. | ||
//! | ||
//! see [ext] for more details. | ||
/// error associated with dhatu | ||
pub mod error; | ||
/// re export external libraries that makes up dhatu. | ||
pub mod ext; | ||
/// crate private modules | ||
pub(crate) mod private; | ||
/// identity registrar, consist of types and modules regarding blockchain identity. | ||
/// i.e keypair. | ||
pub mod registrar; | ||
/// transaction module, consist of extrinsics abstraction. | ||
pub mod tx; | ||
/// global crate level types, code inside this modules is meant to be used globally. | ||
pub mod types; |
Oops, something went wrong.