Skip to content

Commit

Permalink
add ApiConstructTransaction and ApiTxInputExtended
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Jun 10, 2021
1 parent c13f778 commit a7f44a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Cardano.Wallet.Api.Types
( ApiByronWallet
, ApiT (..)
, ApiTransaction
, ApiTxInput (source)
, ApiUtxoStatistics
, ApiWallet
, ApiWalletMigrationPlan (..)
Expand Down Expand Up @@ -588,7 +589,7 @@ spec = describe "BYRON_MIGRATIONS" $ do
inputBalance = fromIntegral
. sum
. fmap (view (#amount . #getQuantity))
. mapMaybe ApiTypes.source
. mapMaybe source
. view #inputs
outputBalance = fromIntegral
. sum
Expand Down
16 changes: 16 additions & 0 deletions lib/core/src/Cardano/Wallet/Api/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ module Cardano.Wallet.Api.Types
, KeyFormat (..)
, ApiPostAccountKeyData (..)
, ApiPostAccountKeyDataWithPurpose (..)
, ApiConstructTransaction (..)
, ApiTxInputExtended (..)

-- * API Types (Byron)
, ApiByronWallet (..)
Expand Down Expand Up @@ -840,7 +842,21 @@ newtype ApiBytesT (base :: Base) bs = ApiBytesT { getApiBytesT :: bs }

data ApiSerialisedTransaction
= ApiSerialisedTransaction (ApiBytesT 'Base64 SerialisedTx)
deriving (Eq, Generic, Show)
deriving anyclass NFData

data ApiTxInputExtended (n :: NetworkDiscriminant) = ApiTxInputExtended
{ source :: !(Maybe (AddressAmount (ApiT Address, Proxy n)))
, input :: !(ApiT TxIn)
, derivationPath :: !(NonEmpty (ApiT DerivationIndex))
} deriving (Eq, Generic, Show)
deriving anyclass NFData

data ApiConstructTransaction (n :: NetworkDiscriminant) = ApiConstructTransaction
{ serializedTransaction :: !ApiSerialisedTransaction
, inputs :: [ApiTxInputExtended n]
} deriving (Eq, Generic, Show)
deriving anyclass NFData

data PostTransactionData (n :: NetworkDiscriminant) = PostTransactionData
{ payments :: !(NonEmpty (AddressAmount (ApiT Address, Proxy n)))
Expand Down

0 comments on commit a7f44a3

Please sign in to comment.