| Copyright | (c) 2023 GYELD GMBH |
|---|---|
| License | Apache 2.0 |
| Maintainer | support@geniusyield.co |
| Stability | develop |
| Safe Haskell | None |
| Language | Haskell2010 |
GeniusYield.TxBuilder.Common
Description
Synopsis
- data GYTxBuildResult f
- = GYTxBuildSuccess !(NonEmpty (f GYTxBody))
- | GYTxBuildPartialSuccess !GYValue !(NonEmpty (f GYTxBody))
- | GYTxBuildFailure !GYValue
- | GYTxBuildNoInputs
- pattern InsufficientFundsErr ∷ GYValue → BuildTxException
- buildTxCore ∷ ∀ m f v. (GYTxQueryMonad m, MonadRandom m, Traversable f) ⇒ SystemStart → EraHistory CardanoMode → ProtocolParameters → Set PoolId → GYCoinSelectionStrategy → (GYTxBody → GYUTxOs → GYUTxOs) → [GYAddress] → GYAddress → GYTxOutRef → m [f (GYTxSkeleton v)] → m (Either BuildTxException (GYTxBuildResult f))
Documentation
data GYTxBuildResult f #
Result of building GYTxBodys with the option of recovery from error.
Consider the act of building five GYTxSkeletons into GYTxBodys. If three out of the five succeed, but the next
one fails due to insufficient funds - this type facilitates recovering the three rather than failing outright and discarding
the results.
Constructors
| GYTxBuildSuccess !(NonEmpty (f GYTxBody)) | All given |
| GYTxBuildPartialSuccess !GYValue !(NonEmpty (f GYTxBody)) | Some of the given |
| GYTxBuildFailure !GYValue | None of the given |
| GYTxBuildNoInputs | Input did not contain any |
pattern InsufficientFundsErr ∷ GYValue → BuildTxException #
buildTxCore ∷ ∀ m f v. (GYTxQueryMonad m, MonadRandom m, Traversable f) ⇒ SystemStart → EraHistory CardanoMode → ProtocolParameters → Set PoolId → GYCoinSelectionStrategy → (GYTxBody → GYUTxOs → GYUTxOs) → [GYAddress] → GYAddress → GYTxOutRef → m [f (GYTxSkeleton v)] → m (Either BuildTxException (GYTxBuildResult f)) #
The core implementation of GYTxQueryMonad for building GYTxBodys out of one or more GYTxSkeletons.
Peculiarly, this is parameterized on:
- An "own utxo update" function, this is meant to govern how the set of known "own utxos" is updated after building a transaction skeleton.
If the user chooses not to update this set, based on the newly created GYTxBody, the same own utxos set will be used for the next
transaction in the list (if any). Which may lead to the balancer choosing the same utxo inputs again - resulting in a transaction
conflict.
The function recovers successfully built tx skeletons, in case the list contains several of them. See: GYTxBuildResult.