{-# LANGUAGE FlexibleContexts  #-}
{-# LANGUAGE OverloadedStrings #-}

-- |
-- Module      :  Network.Polkadot.Rpc.Account
-- Copyright   :  Aleksandr Krupenkin 2016-2024
-- License     :  Apache-2.0
--
-- Maintainer  :  mail@akru.me
-- Stability   :  experimental
-- Portability :  portable
--
-- Polkadot RPC methods with `account` prefix.
--

module Network.Polkadot.Rpc.Account where

import           Data.Text                  (Text)
import           Network.JsonRpc.TinyClient (JsonRpc (..))

-- | Retrieves the next accountIndex as available on the node.
nextIndex :: JsonRpc m
          => Text
          -- ^ AccountId
          -> m Int
{-# INLINE nextIndex #-}
nextIndex :: forall (m :: * -> *). JsonRpc m => Text -> m Int
nextIndex = Text -> Text -> m Int
forall a. Remote m a => Text -> a
forall (m :: * -> *) a. (JsonRpc m, Remote m a) => Text -> a
remote Text
"account_nextIndex"