Skip to content

Commit

Permalink
[ADP-3406] Scaffold signTxBody for deposit wallet (#4722)
Browse files Browse the repository at this point in the history
- Scaffold `signTxBody` function
- Add `rootXSignKey` field to `WalletState`

### Issue Number

ADP-3406
  • Loading branch information
Anviking authored Aug 8, 2024
2 parents a07db92 + c15ff06 commit 5e82dff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module Cardano.Wallet.Deposit.IO
-- ** Writing to the blockchain
, createPayment
, getBIP32PathsForOwnedInputs
, signTxBody
) where

import Prelude
Expand Down Expand Up @@ -211,6 +212,9 @@ getBIP32PathsForOwnedInputs
getBIP32PathsForOwnedInputs a w =
Wallet.getBIP32PathsForOwnedInputs a <$> readWalletState w

signTxBody :: Write.TxBody -> WalletInstance -> IO (Maybe Write.Tx)
signTxBody txbody w = Wallet.signTxBody txbody <$> readWalletState w

{-----------------------------------------------------------------------------
Logging
------------------------------------------------------------------------------}
Expand Down
10 changes: 8 additions & 2 deletions lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module Cardano.Wallet.Deposit.Pure
, BIP32Path (..)
, DerivationType (..)
, getBIP32PathsForOwnedInputs
, signTxBody

, addTxSubmission
, listTxsInSubmission
Expand All @@ -42,7 +43,8 @@ module Cardano.Wallet.Deposit.Pure
import Prelude

import Cardano.Crypto.Wallet
( XPub
( XPrv
, XPub
)
import Cardano.Wallet.Address.BIP32
( BIP32Path (..)
Expand Down Expand Up @@ -95,7 +97,7 @@ data WalletState = WalletState
, utxoHistory :: !UTxOHistory.UTxOHistory
-- , txHistory :: [Read.Tx]
, submissions :: Sbm.TxSubmissions
-- , credentials :: Maybe (HashedCredentials (KeyOf s))
, rootXSignKey :: Maybe XPrv
-- , info :: !WalletInfo
}

Expand Down Expand Up @@ -151,6 +153,7 @@ fromXPubAndGenesis xpub knownCustomerCount _ =
Address.fromXPubAndCount xpub knownCustomerCount
, utxoHistory = UTxOHistory.empty initialUTxO
, submissions = Sbm.empty
, rootXSignKey = Nothing
}
where
initialUTxO = mempty
Expand Down Expand Up @@ -245,6 +248,9 @@ getBIP32Paths :: WalletState -> [Read.Address] -> [BIP32Path]
getBIP32Paths w =
mapMaybe $ Address.getBIP32Path (addresses w) . Read.toRawAddress

signTxBody :: Write.TxBody -> WalletState -> Maybe Write.Tx
signTxBody _txbody _w = undefined

addTxSubmission :: Write.Tx -> WalletState -> WalletState
addTxSubmission _tx _w = undefined

Expand Down

0 comments on commit 5e82dff

Please sign in to comment.