kuber-3.1.0.0
Safe HaskellNone
LanguageHaskell2010

Cardano.Kuber.Api

Synopsis

TxBuilder and companion functions

Transaction Builder Object

type TxBuilder = TxBuilder_ ConwayEra #

TxBuilder is not to be directly used but, parts of it are constructed using helper functions. Multiple builder parts can be combined to construct full transaction specification

data TxBuilder_ era #

Instances

Instances details
IsTxBuilderEra era => FromJSON (TxBuilder_ era) # 
Instance details

Defined in Cardano.Kuber.Data.TxBuilderAeson

IsTxBuilderEra era => ToJSON (TxBuilder_ era) # 
Instance details

Defined in Cardano.Kuber.Data.TxBuilderAeson

Monoid (TxBuilder_ era) # 
Instance details

Defined in Cardano.Kuber.Core.TxBuilder

Methods

mempty :: TxBuilder_ era #

mappend :: TxBuilder_ era -> TxBuilder_ era -> TxBuilder_ era #

mconcat :: [TxBuilder_ era] -> TxBuilder_ era #

Semigroup (TxBuilder_ era) # 
Instance details

Defined in Cardano.Kuber.Core.TxBuilder

Methods

(<>) :: TxBuilder_ era -> TxBuilder_ era -> TxBuilder_ era #

sconcat :: NonEmpty (TxBuilder_ era) -> TxBuilder_ era #

stimes :: Integral b => b -> TxBuilder_ era -> TxBuilder_ era #

Transaction Inputs

Add the txin to transaction input

txRedeemTxin :: IsPlutusScript sc => TxIn -> sc -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo-reference containing inline-datum to transaction input. Script code and Reedemer should be passed.

txRedeemUtxo :: IsPlutusScript sc => TxIn -> TxOut CtxUTxO ConwayEra -> sc -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo containing inline-datum to transaction input. Script code and redeemer should be passed for building transaction.

txRedeemUtxoWithDatum :: IsPlutusScript sc => TxIn -> TxOut CtxUTxO ConwayEra -> sc -> HashableScriptData -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo containing datum-hash to transaction input . Script code, datum matching datumHash and redeemer should be passed for building transaction.

txRedeemUtxoWithReferenceScript :: ScriptReferenceTxIn -> TxIn -> TxOut CtxUTxO ConwayEra -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo containing inline-datum to transaction input. Script code is inlined in provided TransactionInput. The script reference input will be automatically added to transaction reference inputs.

txRedeemTxinWithReferenceScript :: ScriptReferenceTxIn -> TxIn -> TxOut CtxUTxO ConwayEra -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script txIn containing inline-datum to transaction input. Script code is inlined in provided TransactionInput. The script reference input will be automatically added to transaction reference inputs.

txRedeemUtxoWithDatumAndReferenceScript :: ScriptReferenceTxIn -> TxIn -> TxOut CtxUTxO ConwayEra -> HashableScriptData -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo txin containing datum-hash to transaction input. Script code is inlined in provided TransactionInput. The script reference input will be automatically added to transaction reference inputs.

txRedeemTxinWithDatumAndReferenceScript :: ScriptReferenceTxIn -> TxIn -> TxOut CtxUTxO ConwayEra -> HashableScriptData -> HashableScriptData -> Maybe ExecutionUnits -> TxBuilder #

Add a script utxo containing datum-hash to transaction input. Script code is inlined in provided TransactionInput. The script reference input will be automatically added to transaction reference inputs.

TxSelections

TxSelections represent Utxos that can be used for balancing a transaction. They will be added to input if required for balancing the transaciton. Such utxos should be related to user's wallet and

txWalletSignKey :: SigningKey PaymentKey -> TxBuilder #

add signkey to the selection. All the utxos from the enterprise address of the signkey will be automatically added to selection too. The TxBuilder containing signkeys when built to transaction, transaction will contain signatures if their utxo is used.

In order to automatically sign tx for address other than enterprise address, both address and signkey must be present in the builder.

Payment functions

txPayTo :: AddressInEra ConwayEra -> Value -> TxBuilder #

Pay to this address in transaction

txPayToPkh :: PubKeyHash -> Value -> TxBuilder #

Pay to the enterprise address of this PublicKeyHash

txPayToScript :: AddressInEra ConwayEra -> Value -> Hash ScriptData -> TxBuilder #

Pay to script address with datumHash

txPayToScriptWithData :: AddressInEra ConwayEra -> Value -> HashableScriptData -> TxBuilder #

Pay to script address and inline the datum in utxo

txPayToScriptWithReference :: IsPlutusScript sc => sc -> Value -> Hash ScriptData -> TxBuilder #

Pay to the script and inline it in the utxo. Script enterprise address is derrived from script hash

txPayToScriptWithDataAndReference :: IsPlutusScript sc => sc -> Value -> HashableScriptData -> TxBuilder #

Pay to script with inline both datum and inline it in datum. Script enterprise address is derrived from script hash

txPayToWithReferenceScript :: AddressInEra ConwayEra -> Value -> TxScript -> TxBuilder #

Pay to address and inline the script in resulting utxo.

Minting functions

txMintSimpleScript :: SimpleScript -> [(AssetName, Quantity)] -> TxBuilder #

Mint token with simple script

txMintPlutusScript :: IsPlutusScript script => script -> HashableScriptData -> [(AssetName, Quantity)] -> TxBuilder #

Mint token with plutus v1 or v2 script

Reference Inputs

Extra Vkey Witnesses in Transaction

txSignBy :: AddressInEra ConwayEra -> TxBuilder #

Mark this address as txExtraKeyWitness in the transaction object.

txSignByPkh :: PubKeyHash -> TxBuilder #

Mark this PublicKeyhash as txExtraKeyWitness in the transaction object.

Explicitly set transaction fee

txSetFee :: Integer -> TxBuilder #

explicitly set Fee for the transaction

Change address to send unbalanced value to. If change address is missing, it is automatically selected from one of the wallet addresses.

Transactoin validity functions

TxSelections

TxSelections represent Utxos that can be used for balancing a transaction. They will be added to input if required for balancing the transaciton. Such utxos should be related to user's wallet and

Payment functions

Minting functions

Reference Inputs

Extra Vkey Witnesses in Transaction

Explicitly set transaction fee

Change address to send unbalanced value to. If change address is missing, it is automatically selected from one of the wallet addresses.

Transactoin validity functions

txVote_ :: TxVote era -> TxBuilder_ era #

Transactoin validity functions

these functions help dealing with plutus validator and cardano-api script types.

class IsPlutusScript sc #

Minimal complete definition

toTxPlutusScript

Instances

Instances details
IsPlutusScript TxPlutusScript # 
Instance details

Defined in Cardano.Kuber.Core.TxScript

IsPlutusVersion ver => IsPlutusScript (PlutusScript ver) # 
Instance details

Defined in Cardano.Kuber.Core.TxScript

IsPlutusVersion ver => IsPlutusScript (Script ver) # 
Instance details

Defined in Cardano.Kuber.Core.TxScript

class IsSimpleScript sc #

Minimal complete definition

toTxSimpleScript

Error Class

data FrameworkError #

Instances

Instances details
FromJSON FrameworkError # 
Instance details

Defined in Cardano.Kuber.Error

ToJSON FrameworkError # 
Instance details

Defined in Cardano.Kuber.Error

Exception FrameworkError # 
Instance details

Defined in Cardano.Kuber.Error

Show FrameworkError # 
Instance details

Defined in Cardano.Kuber.Error

Eq FrameworkError # 
Instance details

Defined in Cardano.Kuber.Error

Wrapper ExUnitsResponseModal (Map ScriptWitnessIndex (Either FrameworkError ExecutionUnits)) # 
Instance details

Defined in Cardano.Kuber.Data.Models

MonadError FrameworkError (Kontract api w FrameworkError) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Kontract and ChainApi related API

data Exception e => Kontract api w e r #

Constructors

KResult !r 
KError !e 
KLift (api -> IO (Either e r)) 

Instances

Instances details
MonadError FrameworkError (Kontract api w FrameworkError) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Exception e => MonadIO (Kontract api w e) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Methods

liftIO :: IO a -> Kontract api w e a #

Exception e => Alternative (Kontract api w e) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Methods

empty :: Kontract api w e a #

(<|>) :: Kontract api w e a -> Kontract api w e a -> Kontract api w e a #

some :: Kontract api w e a -> Kontract api w e [a] #

many :: Kontract api w e a -> Kontract api w e [a] #

Exception e => Applicative (Kontract api w e) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Methods

pure :: a -> Kontract api w e a #

(<*>) :: Kontract api w e (a -> b) -> Kontract api w e a -> Kontract api w e b #

liftA2 :: (a -> b -> c) -> Kontract api w e a -> Kontract api w e b -> Kontract api w e c #

(*>) :: Kontract api w e a -> Kontract api w e b -> Kontract api w e b #

(<*) :: Kontract api w e a -> Kontract api w e b -> Kontract api w e a #

Exception e => Functor (Kontract api w e) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Methods

fmap :: (a -> b) -> Kontract api w e a -> Kontract api w e b #

(<$) :: a -> Kontract api w e b -> Kontract api w e a #

Exception e => Monad (Kontract api w e) # 
Instance details

Defined in Cardano.Kuber.Core.Kontract

Methods

(>>=) :: Kontract api w e a -> (a -> Kontract api w e b) -> Kontract api w e b #

(>>) :: Kontract api w e a -> Kontract api w e b -> Kontract api w e b #

return :: a -> Kontract api w e a #

eitherToKontract :: Exception e => Either e r -> Kontract api w e r #

class HasChainQueryAPI a where #

Instances

Instances details
HasChainQueryAPI LocalNodeConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.LocalNodeChainApi

HasChainQueryAPI ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.LocalNodeChainApi

HasChainQueryAPI RemoteKuberConnection # 
Instance details

Defined in Cardano.Kuber.Http.Client

class HasKuberAPI a where #

Instances

Instances details
HasKuberAPI LocalNodeConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.KuberAPI

HasKuberAPI ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.KuberAPI

HasKuberAPI RemoteKuberConnection # 
Instance details

Defined in Cardano.Kuber.Http.Client

Chain info Structures

newtype ChainConnectInfo #

Instances

Instances details
HasChainQueryAPI ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.LocalNodeChainApi

HasSubmitApi ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.LocalNodeChainApi

HasKuberAPI ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.KuberAPI

HasLocalNodeAPI ChainConnectInfo # 
Instance details

Defined in Cardano.Kuber.Core.LocalNodeChainApi

data RemoteKuberConnection #

Instances

Instances details
HasChainQueryAPI RemoteKuberConnection # 
Instance details

Defined in Cardano.Kuber.Http.Client

HasSubmitApi RemoteKuberConnection # 
Instance details

Defined in Cardano.Kuber.Http.Client

HasKuberAPI RemoteKuberConnection # 
Instance details

Defined in Cardano.Kuber.Http.Client

chainInfoFromEnv :: IO ChainConnectInfo #

Using Environment variables determine the NETWORK. NETWORK can be "mainnet", "testnet" or "networkMagic number". If CARDANO_NODE_SOCKET_PATH environment variable is set, the socket path is set to it's value Otherwise CARDANO_HOME or "$HOME.cardano" is used and the socket path becomes "$CARDANO_HOMEnode.socket"

chainInfoFromEnv' :: EnvVariable -> IO ChainConnectInfo #

Read Network value from the environment variable and then determine connection info If CARDANO_NODE_SOCKET_PATH environment variable is set, the socket path is set to it's value Otherwise CARDANO_HOME or "$HOME.cardano" is used and the socket path becomes "$CARDANO_HOMEnode.socket"

getWorkPath :: [FilePath] -> IO FilePath #

get absolute path given a directory or file path relative to work directory. the absolute path is "CARANO_HOME/...paths" value to the path

getWorkPathFunc :: IO ([FilePath] -> FilePath) #

Get WrokPath calculatin Function getWorkPath function can throw errors. The error is only during initialization So if the function succeeds, it returns pure function to calculate filepath which can be reused.

getNetworkFromEnv :: EnvVariable -> IO (String, NetworkId) #

Given environment variable key, read the environmet variable and return network Id. The value maybe network name or network magic.

updateUtxoEra :: IsTxBuilderEra era => UTxO era1 -> UTxO era #