mirror of
https://github.com/airalab/hs-web3.git
synced 2024-10-04 12:17:32 +03:00
Added Polkadot API reference docs
This commit is contained in:
parent
68a36dab18
commit
1f85772f00
@ -76,7 +76,7 @@ Currently implemented the following Ethereum APIs in modules:
|
||||
``personal_*`` `Network.Ethereum.Api.Personal <http://hackage.haskell.org/package/web3/docs/Network-Ethereum-Api-Personal.html>`_
|
||||
=============== ================
|
||||
|
||||
All modules use descriptive types according to official Ethereum specification. It placed at `Network.Ethereum.Api.Types <http://hackage.haskell.org/package/web3-0.8.1.0/docs/Network-Ethereum-Api-Types.html>`_.
|
||||
All modules use descriptive types according to official Ethereum specification. It placed at `Network.Ethereum.Api.Types <http://hackage.haskell.org/package/web3/docs/Network-Ethereum-Api-Types.html>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -8,6 +8,7 @@ Haskell Web3 Documentation
|
||||
|
||||
getting_started
|
||||
ethereum_node_api
|
||||
polkadot_node_api
|
||||
ethereum_accounts
|
||||
smart_contracts
|
||||
ipfs_client_api
|
||||
|
50
docs/polkadot_node_api.rst
Normal file
50
docs/polkadot_node_api.rst
Normal file
@ -0,0 +1,50 @@
|
||||
Polkadot node API
|
||||
=================
|
||||
|
||||
As same as Ethereum nodes Polkadot node exports HTTP/WebSockets `JSON-RPC` API. For connection with node **hs-web3** use internal tiny JSON-RPC client.
|
||||
|
||||
Lets try to call Polkadot node with ``runWeb3'`` function using ``ghci``.
|
||||
|
||||
.. code-block:: haskell
|
||||
|
||||
> import Network.Web3.Provider
|
||||
> import qualified Network.Polkadot.Api.System as System
|
||||
> runWeb3' (WsProvider "127.0.0.1" 9944) $ System.name
|
||||
Right "Parity Polkadot"
|
||||
|
||||
It can be useful to define function with Polkadot node endpoint location.
|
||||
|
||||
.. code-block:: haskell
|
||||
|
||||
myNode :: Web3 a -> Either Web3Error a
|
||||
myNode = runWeb3' (Wsprovider "127.0.0.1" 9944)
|
||||
|
||||
API Reference
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Currently implemented the following Polkadot APIs in modules:
|
||||
|
||||
================== ================
|
||||
Method prefix Implementation
|
||||
================== ================
|
||||
``account_*`` `Network.Polkadot.Api.Account <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Account.html>`_
|
||||
``author_*`` `Network.Polkadot.Api.Author <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Author.html>`_
|
||||
``babe_*`` `Network.Polkadot.Api.Babe <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Babe.html>`_
|
||||
``chain_*`` `Network.Polkadot.Api.Chain <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Chain.html>`_
|
||||
``childstate_*`` `Network.Polkadot.Api.Childstate <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Childstate.html>`_
|
||||
``contracts_*`` `Network.Polkadot.Api.Contracts <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Contracts.html>`_
|
||||
``engine_*`` `Network.Polkadot.Api.Engine <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Engine.html>`_
|
||||
``grandpa_*`` `Network.Polkadot.Api.Grandpa <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Grandpa.html>`_
|
||||
``offchain_*`` `Network.Polkadot.Api.Offchain <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Offchain.html>`_
|
||||
``payment_*`` `Network.Polkadot.Api.Payment <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Payment.html>`_
|
||||
``rpc_*`` `Network.Polkadot.Api.Rpc <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Rpc.html>`_
|
||||
``state_*`` `Network.Polkadot.Api.State <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-State.html>`_
|
||||
``system_*`` `Network.Polkadot.Api.System <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-System.html>`_
|
||||
================== ================
|
||||
|
||||
All modules use descriptive types located at `Network.Polkadot.Api.Types <http://hackage.haskell.org/package/web3/docs/Network-Polkadot-Api-Types.html>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
See classic API reference at `Hackage web3 page <http://hackage.haskell.org/package/web3>`_.
|
||||
|
@ -15,11 +15,11 @@
|
||||
|
||||
module Network.Polkadot.Api.Rpc where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Data.Aeson (Value)
|
||||
|
||||
import Network.JsonRpc.TinyClient (JsonRpc (..))
|
||||
|
||||
-- | Retrieves the list of RPC methods that are exposed by the node.
|
||||
methods :: JsonRpc m => m [Text]
|
||||
methods :: JsonRpc m => m Value
|
||||
{-# INLINE methods #-}
|
||||
methods = remote "rpc_methods"
|
||||
|
Loading…
Reference in New Issue
Block a user