-
Notifications
You must be signed in to change notification settings - Fork 720
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
API additions for automating transaction building #2906
Commits on Jul 8, 2021
-
Tidy up the {to,from}ShelleyTxOut conversion functions
Make them more regular by having both take an era param, fix the names and make them both clearly general in the era.
Configuration menu - View commit details
-
Copy full SHA for 132e0a2 - Browse repository at this point
Copy the full SHA 132e0a2View commit details -
Add rename fromUTxO to fromLedgerUTxO and add toLedgerUTxO
Conversion functions within the API. We'll need both.
Configuration menu - View commit details
-
Copy full SHA for 9147b7b - Browse repository at this point
Copy the full SHA 9147b7bView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for a67dc66 - Browse repository at this point
Copy the full SHA a67dc66View commit details -
Add API evaluateTransactionFee
Compute the transaction fee for a proposed transaction, with the assumption that there will be the given number of key witnesses (i.e. signatures).
1Configuration menu - View commit details
-
Copy full SHA for a8e2460 - Browse repository at this point
Copy the full SHA a8e2460View commit details -
Add API estimateTransactionKeyWitnessCount
Give an approximate count of the number of key witnesses (i.e. signatures) a transaction will need.
1Configuration menu - View commit details
-
Copy full SHA for ead1a15 - Browse repository at this point
Copy the full SHA ead1a15View commit details -
Introduce API concept of ScriptWitnessIndex
This more-or-less mirrors the RdmrPtr, which we generally want to hide, but for some kinds of tx manipulation it is inevitable. In particular we will need it to be able to provide the execution units for each script use, and to perform substitutions.
1Configuration menu - View commit details
-
Copy full SHA for ea5c08f - Browse repository at this point
Copy the full SHA ea5c08fView commit details -
Export collectTxBodyScriptWitnesses and make it use ScriptWitnessIndex
The collectTxBodyScriptWitnesses helper function was previously only being used within makeShelleyTransactionBody, but with the addition of the public ScriptWitnessIndex type, it now makes sense to have it use that and to expose the function. It also makes it clearer what the types ScriptWitnessIndex and AnyScriptWitness are for.
1Configuration menu - View commit details
-
Copy full SHA for 7a6da1f - Browse repository at this point
Copy the full SHA 7a6da1fView commit details -
Add API evaluateTransactionExecutionUnits
Compute the ExecutionUnits needed for each script in the transaction. This works by running all the scripts and counting how many execution units are actually used.
1Configuration menu - View commit details
-
Copy full SHA for ddfe2b4 - Browse repository at this point
Copy the full SHA ddfe2b4View commit details
Commits on Jul 9, 2021
-
That we will use for the auto-balancing tx construction.
1Configuration menu - View commit details
-
Copy full SHA for e20909a - Browse repository at this point
Copy the full SHA e20909aView commit details -
Add API makeTransactionBodyAutoBalance
This is much like 'makeTransactionBody' but with greater automation to calculate suitable values for several things. In particular: * It calculates the correct script 'ExecutionUnits' (ignoring the provided values, which can thus be zero). * It calculates the transaction fees, based on the script 'ExecutionUnits', the current 'ProtocolParameters', and an estimate of the number of key witnesses (i.e. signatures). There is an override for the number of key witnesses. * It accepts a change address, calculates the balance of the transaction and puts the excess change into the change output. * It also checks that the balance is positive and the change is above the minimum threshold. To do this it needs more information than 'makeTransactionBody', all of which can be queried from a local node.
1Configuration menu - View commit details
-
Copy full SHA for 66c86f2 - Browse repository at this point
Copy the full SHA 66c86f2View commit details -
Well, in this case supress since it was not helpful.
Configuration menu - View commit details
-
Copy full SHA for 1600261 - Browse repository at this point
Copy the full SHA 1600261View commit details