View on GitHub
File Changes
    , updateWalletPassphrase
    , walletSyncProgress
    , fetchRewardBalance
+
    , rollbackBlocks
    , ErrWalletAlreadyExists (..)
    , ErrNoSuchWallet (..)
    , ErrListUTxOStatistics (..)
        , PutWallet
        , PutWalletPassphrase
        , GetUTxOsStatistics
+
        , ForceResyncWallet

                      
    , Addresses
        , ListAddresses
        , GetByronWallet
        , ListByronWallets
        , PostByronWallet
+
        , ForceResyncByronWallet

                      
    , ByronTransactions
        , ListByronTransactions
    :<|> PutWallet
    :<|> PutWalletPassphrase
    :<|> GetUTxOsStatistics
+
    :<|> ForceResyncWallet

                      
-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/deleteWallet
type DeleteWallet = "wallets"
    :> "utxos"
    :> Get '[JSON] ApiUtxoStatistics

                      
+
-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/forceResync
+
type ForceResyncWallet = "wallets"
+
    :> Capture "walletId" (ApiT WalletId)
+
    :> "utxos"
+
    :> DeleteNoContent '[Any] NoContent
+

                      
{-------------------------------------------------------------------------------
                                  Addresses

                      
    :<|> DeleteByronWallet
    :<|> GetByronWallet
    :<|> ListByronWallets
+
    :<|> ForceResyncByronWallet

                      
-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/postByronWallet
type PostByronWallet (style :: ByronWalletStyle) = "byron-wallets"
type ListByronWallets = "byron-wallets"
    :> Get '[JSON] [ApiByronWallet]

                      
+
-- | https://input-output-hk.github.io/cardano-wallet/api/#operation/forceResyncByron
+
type ForceResyncByronWallet = "byron-wallets"
+
    :> Capture "walletId" (ApiT WalletId)
+
    :> "utxos"
+
    :> DeleteNoContent '[Any] NoContent
+

                      
{-------------------------------------------------------------------------------
                                 Byron Transactions

                      
        :: ApiT WalletId
        -> WalletPutPassphraseData
        -> ClientM NoContent
+
    , forceResyncWallet
+
        :: ApiT WalletId
+
        -> ClientM NoContent
    , listTransactions
        :: ApiT WalletId
        -> Maybe Iso8601Time
            :<|> _putWallet
            :<|> _putWalletPassphrase
            :<|> _getWalletUtxoStatistics
+
            :<|> _forceResyncWallet
            = wallets

                      
        _listAddresses =
            , postWallet = _postWallet
            , putWallet = _putWallet
            , putWalletPassphrase = _putWalletPassphrase
+
            , forceResyncWallet = _forceResyncWallet
            , listTransactions = _listTransactions
            , postTransaction = _postTransaction
            , postExternalTransaction = _postExternalTransaction
    , getUTxOsStatistics
    , getMigrationInfo
    , migrateWallet
+
    , forceResyncWallet

                      
      -- * Addresses
    , listAddresses
  where
    wid = w ^. typed @(ApiT WalletId)

                      
+
forceResyncWallet
+
    :: forall style w.
+
        ( HasType (ApiT WalletId) w
+
        , Discriminate style
+
        )
+
    => w
+
    -> (Method, Text)
+
forceResyncWallet w = discriminate @style
+
    (endpoint @Api.ForceResyncWallet (wid &))
+
    (endpoint @Api.ForceResyncByronWallet (wid &))
+
  where
+
    wid = w ^. typed @(ApiT WalletId)
+

                      
--
-- Addresses
--
        :<|> putWallet shelley mkShelleyWallet
        :<|> putWalletPassphrase shelley
        :<|> getUTxOsStatistics shelley
+
        :<|> forceResyncWallet shelley

                      
    addresses :: Server (Addresses n)
    addresses = listAddresses shelley
        :<|> liftA2 (\xs ys -> fmap fst $ sortOn snd $ xs ++ ys)
            (listWallets byron  mkLegacyWallet)
            (listWallets icarus mkLegacyWallet)
+
        :<|> (\wid -> withLegacyLayer wid
+
                (byron , forceResyncWallet byron wid)
+
                (icarus, forceResyncWallet icarus wid)
+
             )

                      
    byronTransactions :: Server (ByronTransactions n)
    byronTransactions =
  where
    liftE = throwE . ErrListUTxOStatisticsNoSuchWallet

                      
+
forceResyncWallet
+
    :: forall ctx s t k.
+
        ( ctx ~ ApiLayer s t k
+
        )
+
    => ctx
+
    -> ApiT WalletId
+
    -> Handler NoContent
+
forceResyncWallet ctx (ApiT wid) = do
+
    liftHandler $ withWorkerCtx ctx wid throwE $ \wrk ->
+
        W.rollbackBlocks wrk wid W.slotMinBound
+
    pure NoContent

                      
{-------------------------------------------------------------------------------
                                  Coin Selections