Skip to content

Commit

Permalink
Merge #2906
Browse files Browse the repository at this point in the history
2906: API additions for automating transaction building r=Jimbo4350 a=dcoutts

* Add API evaluateTransactionBalance

  Compute the total balance of the proposed transaction. Ultimately a
  valid transaction must be fully balanced: that is have a total value
  of zero.
    
  Finding the (non-zero) balance of partially constructed transaction
  is useful for adjusting a transaction to be fully balanced.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
  • Loading branch information
iohk-bors[bot] and dcoutts authored Jul 13, 2021
2 parents 7cf540d + 1600261 commit e71f81a
Show file tree
Hide file tree
Showing 6 changed files with 994 additions and 70 deletions.
2 changes: 2 additions & 0 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ library
build-depends: aeson >= 1.5.6.0
, aeson-pretty >= 0.8.5
, attoparsec
, array
, base16-bytestring >= 1.0
, base58-bytestring
, bech32 >= 1.1.0
Expand Down Expand Up @@ -127,6 +128,7 @@ library
, ouroboros-network
, ouroboros-network-framework
, plutus-ledger-api
, prettyprinter
, scientific
, shelley-spec-ledger
, small-steps
Expand Down
22 changes: 18 additions & 4 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ module Cardano.Api (
updateProposalSupportedInEra,
scriptDataSupportedInEra,

-- ** Fee calculation
transactionFee,
estimateTransactionFee,
evaluateTransactionFee,
estimateTransactionKeyWitnessCount,

-- ** Script execution units
evaluateTransactionExecutionUnits,
ScriptExecutionError(..),
TransactionValidityIntervalError,

-- ** Transaction balance
evaluateTransactionBalance,

-- ** Building transactions with automated fees and balancing
makeTransactionBodyAutoBalance,
TxBodyErrorAutoBalance(..),

-- * Signing transactions
-- | Creating transaction witnesses one by one, or all in one go.
Tx(Tx),
Expand All @@ -239,10 +257,6 @@ module Cardano.Api (
makeShelleyKeyWitness,
makeShelleyBootstrapWitness,

-- * Fee calculation
transactionFee,
estimateTransactionFee,

-- * Transaction metadata
-- | Embedding additional structured data within transactions.
TxMetadata(..),
Expand Down
Loading

0 comments on commit e71f81a

Please sign in to comment.