mirror of
https://github.com/airalab/hs-web3.git
synced 2024-10-04 04:07:20 +03:00
Added polkadot storage page into docs
This commit is contained in:
parent
6d7ac3547a
commit
af105e02d4
@ -9,6 +9,7 @@ Haskell Web3 Documentation
|
||||
getting_started
|
||||
ethereum_node_api
|
||||
polkadot_node_api
|
||||
polkadot_storage
|
||||
ethereum_accounts
|
||||
smart_contracts
|
||||
ipfs_client_api
|
||||
|
26
docs/polkadot_storage.rst
Normal file
26
docs/polkadot_storage.rst
Normal file
@ -0,0 +1,26 @@
|
||||
Polkadot Storage
|
||||
================
|
||||
|
||||
Blockchains that are built with Substrate expose a remote procedure call (RPC) server
|
||||
that can be used to query runtime storage. In Haskell Web3 the standard Web3 provider could be used.
|
||||
|
||||
Lets try to query Polkadot storage with ``runWeb3'`` function using ``ghci``.
|
||||
|
||||
.. code-block:: haskell
|
||||
|
||||
> import Network.Web3.Provider
|
||||
> import Network.Polkadot
|
||||
> runWeb3' (WsProvider "127.0.0.1" 9944) (query "timestamp" "now" [] :: Web3 (Either String Moment))
|
||||
Right (Right 1610689972001)
|
||||
|
||||
The ``query`` function arguments is **section** (or module), **method** and list of arguments (for maps and double maps).
|
||||
|
||||
.. code-block:: haskell
|
||||
|
||||
query :: (JsonRpc m, Decode a) => Text -> Text -> [Argument] -> m a
|
||||
|
||||
Where ``a`` type should be SCALE decodable.
|
||||
|
||||
.. note::
|
||||
|
||||
More usage details available in `Polkadot example <https://github.com/airalab/hs-web3/tree/master/examples/polkadot>`_ app.
|
Loading…
Reference in New Issue
Block a user