Module

Ctl.Internal.BalanceTx.Sync

Internal module that handles UTxO set synchronization between backend and wallet query layers.

#syncBackendWithWallet

syncBackendWithWallet :: Contract Unit

Wait until all UTxOs that the wallet returns are visible in the query layer.

#syncWalletWithTransaction

syncWalletWithTransaction :: TransactionHash -> Contract Unit

Wait until the wallet can see the UTxOs created by a given transaction. This function assumes that the transaction has already been confirmed (i.e. the backend query layer can see its UTxOs). This function does not have any effect if KeyWallet is used. This function does not have any effect if none of the outputs are at addresses controlled by the wallet. The assumption is that the transaction has at least one output and that it hasn't been consumed by another transaction yet. You don't need to use this function if you use awaitTxConfirmed*.

Theoretically, this function does not work well with UTxO locking feature of Eternl wallet, but in practice, there's a very low chance that the user will lock a UTxO right after submitting a Tx before we see it. Please read doc/query-layers.md for more context.

#syncWalletWithTxInputs

syncWalletWithTxInputs :: Array TransactionInput -> Contract Unit

Waits until all provided transaction inputs appear in the UTxO set provided by the wallet. This is a hacky solution to the problem of wallets not seeing UTxOs that hasn't been fully confirmed at the moment of a sign() call. The problem is, since the wallet can't detect UTxO origin, it can't decide which of the private keys to use for signing. As a result, we get MissingVKeyWitnesses. You don't have to call this function before signTx, because its use is enabled by default.

#getControlledAddresses

getControlledAddresses :: Contract (Set Address)

Get all addresses contolled by a wallet: getUsedAddresses, getUnusedAddresses and getChangeAddress combined. Reward addresses are not included.

#withoutSync

withoutSync :: forall (a :: Type). Contract a -> Contract a

A helper to set synchronizationParams to disabledSynchronizationParams locally, thus skipping the synchronization process during execution of the Contract.

#disabledSynchronizationParams

disabledSynchronizationParams :: ContractSynchronizationParams

Synchronization parameters that make all synchronization primitives a no-op. See doc/query-layers.md for more info.

Modules