Skip to content

Commit

Permalink
Add TxMetadata arg to signTx
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Sep 1, 2020
1 parent 846d00d commit 1ef320e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ import Cardano.Wallet.Primitive.Types
, TransactionInfo (..)
, Tx
, TxMeta (..)
, TxMetadata
, TxOut (..)
, TxStatus (..)
, UTxO (..)
Expand Down Expand Up @@ -1566,9 +1567,10 @@ signTx
=> ctx
-> WalletId
-> Passphrase "raw"
-> Maybe TxMetadata
-> UnsignedTx
-> ExceptT ErrSignPayment IO (Tx, TxMeta, UTCTime, SealedTx)
signTx ctx wid pwd (UnsignedTx inpsNE outsNE) = db & \DBLayer{..} -> do
signTx ctx wid pwd md (UnsignedTx inpsNE outsNE) = db & \DBLayer{..} -> do
withRootKey @_ @s ctx wid pwd ErrSignPaymentWithRootKey $ \xprv scheme -> do
let pwdP = preparePassphrase scheme pwd
nodeTip <- withExceptT ErrSignPaymentNetwork $ currentNodeTip nl
Expand All @@ -1592,7 +1594,6 @@ signTx ctx wid pwd (UnsignedTx inpsNE outsNE) = db & \DBLayer{..} -> do
nl = ctx ^. networkLayer @t
inps = NE.toList inpsNE
outs = NE.toList outsNE
md = Nothing -- no metadata

-- | Makes a fully-resolved coin selection for the given set of payments.
selectCoinsExternal
Expand Down
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ postTransaction
postTransaction ctx genChange (ApiT wid) body = do
let pwd = coerce $ getApiT $ body ^. #passphrase
let outs = coerceCoin <$> (body ^. #payments)
let md = Nothing -- fixme: implement in #2073

let selfRewardCredentials (rootK, pwdP) =
(getRawKey $ deriveRewardAccount @k pwdP rootK, pwdP)
Expand Down Expand Up @@ -1251,7 +1252,7 @@ postTransaction ctx genChange (ApiT wid) body = do
pure (selection, credentials)

(tx, meta, time, wit) <- withWorkerCtx ctx wid liftE liftE $ \wrk -> liftHandler $
W.signPayment @_ @s @t @k wrk wid genChange credentials pwd selection
W.signPayment @_ @s @t @k wrk wid genChange credentials pwd md selection

withWorkerCtx ctx wid liftE liftE $ \wrk -> liftHandler $
W.submitTx @_ @s @t @k wrk wid (tx, meta, wit)
Expand Down Expand Up @@ -1528,7 +1529,7 @@ migrateWallet ctx (ApiT wid) migrateData = do

forM migration $ \cs -> do
(tx, meta, time, wit) <- withWorkerCtx ctx wid liftE liftE
$ \wrk -> liftHandler $ W.signTx @_ @s @t @k wrk wid pwd cs
$ \wrk -> liftHandler $ W.signTx @_ @s @t @k wrk wid pwd Nothing cs
withWorkerCtx ctx wid liftE liftE
$ \wrk -> liftHandler $ W.submitTx @_ @_ @t wrk wid (tx, meta, wit)
liftIO $ mkApiTransaction
Expand Down

0 comments on commit 1ef320e

Please sign in to comment.