Skip to content

Commit

Permalink
Add WalletId domain impl
Browse files Browse the repository at this point in the history
  • Loading branch information
grod220 committed Apr 2, 2024
1 parent c0b4ba6 commit 5d09b7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/core/keys/src/keys/wallet_id.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use serde::{Deserialize, Serialize};

use penumbra_proto::core::keys::v1;
use penumbra_proto::{penumbra::core::keys::v1 as pb, serializers::bech32str};
use penumbra_proto::{penumbra::core::keys::v1 as pb, serializers::bech32str, DomainType};

/// The hash of a full viewing key, used as an account identifier.
#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(try_from = "pb::WalletId", into = "pb::WalletId")]
pub struct WalletId(pub [u8; 32]);

impl DomainType for WalletId {
type Proto = pb::WalletId;
}

impl TryFrom<v1::WalletId> for WalletId {
type Error = anyhow::Error;

Expand Down

0 comments on commit 5d09b7a

Please sign in to comment.