Skip to content

Commit

Permalink
Add BIP32Path type
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed May 6, 2024
1 parent 5a31a0b commit fe0f5ce
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{-# OPTIONS --erasure #-}

module Cardano.Wallet.Address.BIP32 where

open import Haskell.Prelude

open import Haskell.Data.Word.Odd using
( Word31
)

{-----------------------------------------------------------------------------
BIP32 Paths
------------------------------------------------------------------------------}
data DerivationType : Set where
Soft : DerivationType
Hardened : DerivationType

open DerivationType public

{-# COMPILE AGDA2HS DerivationType #-}

-- | An absolute BIP32 Path.
data BIP32Path : Set where
Root : BIP32Path
Segment : BIP32Path DerivationType Word31 BIP32Path

open BIP32Path public

{-# COMPILE AGDA2HS BIP32Path #-}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Cardano.Wallet.Deposit.Everything where

import Cardano.Wallet.Address.BIP32
import Cardano.Wallet.Address.BIP32_Ed25519
import Cardano.Wallet.Address.Hash

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ library
, text >= 1.2.4.1 && < 2.2
, OddWord >= 1.0.1.1 && < 1.1
exposed-modules:
Cardano.Wallet.Address.BIP32
Cardano.Wallet.Address.BIP32_Ed25519
Cardano.Wallet.Address.Encoding
Cardano.Wallet.Address.Hash
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Cardano.Wallet.Address.BIP32 where

import Data.Word.Odd (Word31)

data DerivationType = Soft
| Hardened

data BIP32Path = Root
| Segment BIP32Path DerivationType Word31

0 comments on commit fe0f5ce

Please sign in to comment.