-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI helper functions for constructing transactions #2335
Conversation
b1c074a
to
6565807
Compare
a39afe2
to
bc7f504
Compare
@@ -213,6 +225,14 @@ instance | |||
instance (CC.Crypto c) => UsesTxOut (AlonzoEra c) where | |||
makeTxOut _proxy addr val = TxOut addr val Shelley.SNothing | |||
|
|||
instance CC.Crypto c => API.CLIHelpers (AlonzoEra c) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I would slightly prefer CLI
rather than CLIHelpers
, for consistency with the other things (e.g. Wallet
rather than WalletHelpers
). And we should paint the bikeshed blue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love blue! (what I love even more than blue is when I don't have to pick the color.... :) ) Happy to change the names, I think "helpers" is superfluous indeed.
|
||
-- | Evaluate the execution budgets needed for all the redeemers in | ||
-- a given transaction. If a redeemer is invalid, a failure is returned instead. | ||
evaluateTransactionExecutionUnits :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention that the Tx already has some ExUnits
in the transaction redeemers, which are then ignored and we pass back appropriately sized ExUnits
later (and merge them into this transaction?). In general I find the use of this function a little confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! I should explain that in the haddocks!!
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Shelley.Spec.Ledger.API.CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these just for the CLI, or can we merge into Wallet
, seeing as these are needed for some Wallet functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. If you think these would be better placed in Wallet, let me know!
Three are in a new class in the API module, one is Alonzo specific.
bc7f504
to
8cb491a
Compare
This PR adds four new functions to be used by the cardano-cli for constructing transactions.
Three of the new functions live in a class,
CLIHelpers
, and are supported in all eras:evaluateTransactionBalance
,evaluateTransactionBalance
,evaluateTransactionFee
. The first two contain default implementations, the class just needs to know the properminfee
andconsumed
function to use. Finally, there is an Alonzo-specific functionevaluateTransactionExecutionUnits
which computes the minimal execution budget for the redeemers in an Alonzo transaction.Additionally, I changed some of the surrounding code (changes separated by commit):
Languages
type is bounded and inflexibletxInfo
now returns a monadic value, as given byEpochInfo m
when converting slots to POSIX time for plutus.totalDeposits
function that has been used since Shelley for determining the deposits needed by a given transaction now takes a predicate instead of a mapping of stake pools. Instead of providing the map, you can now use(Map.notMember pools)
.totExUnits
is now a standalone function instead of aHasField
instance.