Account is needed for sending transactions to blockchain
Typically account is provided by node. In this case node manage accounts:
encrypt and decrypt private keys, manipulate files etc. In other case web3
can derive account from private key and send to node already signed transactions.
The SOP approach to generic programming is based on viewing
datatypes as a representation (Rep) built from the sum of
products of its components. The components of a datatype
are specified using the Code type family.
The isomorphism between the original Haskell datatype and its
representation is witnessed by the methods of this class,
from and to. So for instances of this class, the following
laws should (in general) hold:
You typically don't define instances of this class by hand, but
rather derive the class instance automatically.
Option 1: Derive via the built-in GHC-generics. For this, you
need to use the DeriveGeneric extension to first derive an
instance of the Generic class from module GHC.Generics.
With this, you can then give an empty instance for Generic, and
the default definitions will just work. The pattern looks as
follows:
Option 2: Derive via Template Haskell. For this, you need to
enable the TemplateHaskell extension. You can then use
deriveGeneric from module Generics.SOP.TH
to have the instance generated for you. The pattern looks as
follows:
Tradeoffs: Whether to use Option 1 or 2 is mainly a matter
of personal taste. The version based on Template Haskell probably
has less run-time overhead.
Non-standard instances:
It is possible to give Generic instances manually that deviate
from the standard scheme, as long as at least
Generic (a, b, c, d, e, f)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, t26, t27, t28, t29)Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan
If your compiler has support for the DeriveGeneric and
DefaultSignatures language extensions (ghc >= 7.2.1),
the get method will have default generic implementations.
To use this option, simply add a deriving Generic clause
to your datatype and declare a Decode instance for it without
giving a definition for get.
Instances104Decode, …
DecodeByteStringDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeInt16Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeInt32Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeInt64Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeInt8Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeBoolDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeWord16Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeWord32Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeWord64Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeWord8Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeHexStringDefined in memory-hexstring-1.1.0.0 · Data.ByteArray.HexString.Internal
DecodeTextDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
DecodeH160Defined in web3-bignum-1.1.0.0 · Data.BigNum
DecodeH256Defined in web3-bignum-1.1.0.0 · Data.BigNum
DecodeH512Defined in web3-bignum-1.1.0.0 · Data.BigNum
DecodeEraDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.Era
DecodeCheckEraDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeCheckGenesisDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeCheckNonceDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeCheckSpecVersionDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeCheckTxVersionDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeCheckWeightDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
DecodeChargeTransactionPaymentDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.TransactionPayment
DecodeMetadataDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Metadata
If your compiler has support for the DeriveGeneric and
DefaultSignatures language extensions (ghc >= 7.2.1),
the put method will have default generic implementations.
To use this option, simply add a deriving Generic clause
to your datatype and declare a Encode instance for it without
giving a definition for put.
Instances105Encode, …
EncodeByteStringDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeInt16Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeInt32Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeInt64Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeInt8Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeBoolDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeWord16Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeWord32Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeWord64Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeWord8Defined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeHexStringDefined in memory-hexstring-1.1.0.0 · Data.ByteArray.HexString.Internal
EncodeTextDefined in scale-1.1.0.0 · Codec.Scale.Core · orphan
EncodeH160Defined in web3-bignum-1.1.0.0 · Data.BigNum
EncodeH256Defined in web3-bignum-1.1.0.0 · Data.BigNum
EncodeH512Defined in web3-bignum-1.1.0.0 · Data.BigNum
EncodeEraDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.Era
EncodeCheckEraDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeCheckGenesisDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeCheckNonceDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeCheckSpecVersionDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeCheckTxVersionDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeCheckWeightDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.System
EncodeChargeTransactionPaymentDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Extrinsic.SignedExtension.TransactionPayment
EncodeMetadataDefined in web3-polkadot-1.1.0.1 · Network.Polkadot.Metadata
A "compact" or general integer encoding is sufficient for encoding
large integers (up to 2**536) and is more efficient at encoding most
values than the fixed-width version.