Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides a library interface that is intended to be the complete API for Cole covering everything, including exposing constructors for the lower level types.
Synopsis
- module Bcc.Api
- data SomeColeSigningKey
- data family Hash keyrole ∷ Type
- data Address addrtype where
- ColeAddress ∷ Address → Address ColeAddr
- data NetworkId
- data TxBody era where
- ColeTxBody ∷ Annotated Tx ByteString → TxBody ColeEra
- newtype TxId = TxId (Hash StandardCrypto EraIndependentTxBody)
- data TxIn = TxIn TxId TxIx
- data TxOut era = TxOut (AddressInEra era) (TxOutValue era) (TxOutDatumHash era)
- newtype TxIx = TxIx Word
- newtype Entropic = Entropic Integer
- data Tx era where
- ColeTx ∷ ATxAux ByteString → Tx ColeEra
- data KeyWitness era where
- ColeKeyWitness ∷ TxInWitness → KeyWitness ColeEra
- data WitnessNetworkIdOrColeAddress
- class Show e ⇒ Error e where
- displayError ∷ e → String
- data FileError e
- data LocalNodeConnectInfo mode = LocalNodeConnectInfo (ConsensusModeParams mode) NetworkId FilePath
- data ColeMode
- data ConsensusMode mode where
- data LocalNodeClientProtocols block point tip tx txerr query m = LocalNodeClientProtocols (LocalChainSyncClient block point tip m) (Maybe (LocalTxSubmissionClient tx txerr m ())) (Maybe (LocalStateQueryClient block point query m ()))
- newtype ChainSyncClient header point tip (m ∷ Type → Type) a = ChainSyncClient {
- runChainSyncClient ∷ m (ClientStIdle header point tip m a)
- newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a = LocalTxSubmissionClient (m (LocalTxClientStIdle tx reject m a))
- newtype LocalStateQueryClient block point (query ∷ Type → Type) (m ∷ Type → Type) a = LocalStateQueryClient {
- runLocalStateQueryClient ∷ m (ClientStIdle block point query m a)
- newtype NetworkMagic = NetworkMagic {}
- newtype ColeUpdateProposal = ColeUpdateProposal {
- unColeUpdateProposal ∷ AProposal ByteString
- data ColeProtocolParametersUpdate = ColeProtocolParametersUpdate {
- bPpuScriptVersion ∷ !(Maybe Word16)
- bPpuSlotDuration ∷ !(Maybe Natural)
- bPpuMaxBlockSize ∷ !(Maybe Natural)
- bPpuMaxHeaderSize ∷ !(Maybe Natural)
- bPpuMaxTxSize ∷ !(Maybe Natural)
- bPpuMaxProposalSize ∷ !(Maybe Natural)
- bPpuMpcThd ∷ !(Maybe EntropicPortion)
- bPpuHeavyDelThd ∷ !(Maybe EntropicPortion)
- bPpuUpdateVoteThd ∷ !(Maybe EntropicPortion)
- bPpuUpdateProposalThd ∷ !(Maybe EntropicPortion)
- bPpuUpdateProposalTTL ∷ !(Maybe SlotNumber)
- bPpuSoftforkRule ∷ !(Maybe SoftforkRule)
- bPpuTxFeePolicy ∷ !(Maybe TxFeePolicy)
- bPpuUnlockStakeEpoch ∷ !(Maybe EpochNumber)
- makeColeUpdateProposal ∷ NetworkId → ProtocolVersion → SoftwareVersion → SystemTag → InstallerHash → SomeColeSigningKey → ColeProtocolParametersUpdate → ColeUpdateProposal
- toColeLedgerUpdateProposal ∷ ColeUpdateProposal → GenTx ColeBlock
- makeProtocolParametersUpdate ∷ ColeProtocolParametersUpdate → ProtocolParametersUpdate
- newtype ColeVote = ColeVote {
- unColeVote ∷ AVote ByteString
- makeColeVote ∷ NetworkId → SomeColeSigningKey → ColeUpdateProposal → Bool → ColeVote
- toColeLedgertoColeVote ∷ ColeVote → GenTx ColeBlock
- fromColeTxIn ∷ TxIn → TxIn
- toColeEntropic ∷ Entropic → Maybe Entropic
- toColeNetworkMagic ∷ NetworkId → NetworkMagic
- toColeProtocolMagicId ∷ NetworkId → ProtocolMagicId
- toColeRequiresNetworkMagic ∷ NetworkId → RequiresNetworkMagic
Documentation
module Bcc.Api
Cryptographic key interface
data SomeColeSigningKey Source #
Hashes
data family Hash keyrole ∷ Type Source #
Instances
Payment addresses
Constructing and inspecting Cole payment addresses
data Address addrtype where Source #
Addresses are used as locations where assets live. The address determines the rights needed to spend assets at the address: in particular holding some signing key or being able to satisfy the conditions of a script.
There are currently two types of address:
- Cole addresses, which use the type tag
ColeAddr
; and - Sophie addresses, which use the type tag
SophieAddr
. Notably, Sophie addresses support scripts and stake delegation.
The address type is subtly from the ledger era in which each
address type is valid: while Cole addresses are the only choice in the
Cole era, the Sophie era and all subsequent eras support both Cole and
Sophie addresses. The Address
type param only says the type of the address
(either Cole or Sophie). The AddressInEra
type connects the address type
with the era in which it is supported.
ColeAddress ∷ Address → Address ColeAddr | Cole addresses were the only supported address type in the original Cole era. |
Instances
Building transactions
Constructing and inspecting transactions
data TxBody era where Source #
ColeTxBody ∷ Annotated Tx ByteString → TxBody ColeEra |
Instances
Eq (TxBody era) Source # | |
Show (TxBody era) Source # | |
HasTypeProxy era ⇒ HasTypeProxy (TxBody era) Source # | |
IsBccEra era ⇒ SerialiseAsCBOR (TxBody era) Source # | |
Defined in Bcc.Api.TxBody serialiseToCBOR ∷ TxBody era → ByteString Source # deserialiseFromCBOR ∷ AsType (TxBody era) → ByteString → Either DecoderError (TxBody era) Source # | |
IsBccEra era ⇒ HasTextEnvelope (TxBody era) Source # | |
Defined in Bcc.Api.TxBody textEnvelopeType ∷ AsType (TxBody era) → TextEnvelopeType Source # textEnvelopeDefaultDescr ∷ TxBody era → TextEnvelopeDescr Source # | |
data AsType (TxBody era) Source # | |
Defined in Bcc.Api.TxBody |
TxId (Hash StandardCrypto EraIndependentTxBody) |
Instances
Eq TxId Source # | |
Ord TxId Source # | |
Show TxId Source # | |
IsString TxId Source # | |
Defined in Bcc.Api.TxBody fromString ∷ String → TxId Source # | |
FromJSON TxId Source # | |
Defined in Bcc.Api.TxBody | |
ToJSON TxId Source # | |
Defined in Bcc.Api.TxBody | |
FromJSONKey TxId Source # | |
Defined in Bcc.Api.TxBody fromJSONKey ∷ FromJSONKeyFunction TxId fromJSONKeyList ∷ FromJSONKeyFunction [TxId] | |
ToJSONKey TxId Source # | |
Defined in Bcc.Api.TxBody toJSONKey ∷ ToJSONKeyFunction TxId toJSONKeyList ∷ ToJSONKeyFunction [TxId] | |
HasTypeProxy TxId Source # | |
SerialiseAsRawBytes TxId Source # | |
Defined in Bcc.Api.TxBody | |
data AsType TxId Source # | |
Defined in Bcc.Api.TxBody |
Instances
Eq TxIn Source # | |
Ord TxIn Source # | |
Show TxIn Source # | |
ToJSON TxIn Source # | |
Defined in Bcc.Api.TxBody | |
ToJSONKey TxIn Source # | |
Defined in Bcc.Api.TxBody toJSONKey ∷ ToJSONKeyFunction TxIn toJSONKeyList ∷ ToJSONKeyFunction [TxIn] |
TxOut (AddressInEra era) (TxOutValue era) (TxOutDatumHash era) |
Instances
Eq (TxOut era) Source # | |
Show (TxOut era) Source # | |
Generic (TxOut era) Source # | |
IsBccEra era ⇒ ToJSON (TxOut era) Source # | |
Defined in Bcc.Api.TxBody toEncoding ∷ TxOut era → Encoding # toJSONList ∷ [TxOut era] → Value # toEncodingList ∷ [TxOut era] → Encoding # | |
type Rep (TxOut era) Source # | |
Defined in Bcc.Api.TxBody type Rep (TxOut era) = D1 ('MetaData "TxOut" "Bcc.Api.TxBody" "bcc-api-1.99.0-inplace" 'False) (C1 ('MetaCons "TxOut" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AddressInEra era)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxOutValue era)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxOutDatumHash era))))) |
Instances
Instances
Enum Entropic Source # | |
Defined in Bcc.Api.Value succ ∷ Entropic → Entropic Source # pred ∷ Entropic → Entropic Source # toEnum ∷ Int → Entropic Source # fromEnum ∷ Entropic → Int Source # enumFrom ∷ Entropic → [Entropic] Source # enumFromThen ∷ Entropic → Entropic → [Entropic] Source # enumFromTo ∷ Entropic → Entropic → [Entropic] Source # enumFromThenTo ∷ Entropic → Entropic → Entropic → [Entropic] Source # | |
Eq Entropic Source # | |
Num Entropic Source # | |
Defined in Bcc.Api.Value | |
Ord Entropic Source # | |
Show Entropic Source # | |
Semigroup Entropic Source # | |
Monoid Entropic Source # | |
FromJSON Entropic Source # | |
Defined in Bcc.Api.Value | |
ToJSON Entropic Source # | |
Defined in Bcc.Api.Value toEncoding ∷ Entropic → Encoding # toJSONList ∷ [Entropic] → Value # toEncodingList ∷ [Entropic] → Encoding # | |
FromCBOR Entropic Source # | |
ToCBOR Entropic Source # | |
Signing transactions
Creating transaction witnesses one by one, or all in one go.
ColeTx ∷ ATxAux ByteString → Tx ColeEra |
Instances
Eq (Tx era) Source # | |
Show (Tx era) Source # | |
HasTypeProxy era ⇒ HasTypeProxy (Tx era) Source # | |
IsBccEra era ⇒ SerialiseAsCBOR (Tx era) Source # | |
Defined in Bcc.Api.Tx serialiseToCBOR ∷ Tx era → ByteString Source # deserialiseFromCBOR ∷ AsType (Tx era) → ByteString → Either DecoderError (Tx era) Source # | |
IsBccEra era ⇒ HasTextEnvelope (Tx era) Source # | |
Defined in Bcc.Api.Tx textEnvelopeType ∷ AsType (Tx era) → TextEnvelopeType Source # textEnvelopeDefaultDescr ∷ Tx era → TextEnvelopeDescr Source # | |
data AsType (Tx era) Source # | |
Defined in Bcc.Api.Tx |
Incremental signing and separate witnesses
data KeyWitness era where Source #
ColeKeyWitness ∷ TxInWitness → KeyWitness ColeEra |
Instances
Eq (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx (==) ∷ KeyWitness era → KeyWitness era → Bool Source # (/=) ∷ KeyWitness era → KeyWitness era → Bool Source # | |
Show (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx | |
HasTypeProxy era ⇒ HasTypeProxy (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx data AsType (KeyWitness era) Source # proxyToAsType ∷ Proxy (KeyWitness era) → AsType (KeyWitness era) Source # | |
IsBccEra era ⇒ SerialiseAsCBOR (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx serialiseToCBOR ∷ KeyWitness era → ByteString Source # deserialiseFromCBOR ∷ AsType (KeyWitness era) → ByteString → Either DecoderError (KeyWitness era) Source # | |
IsBccEra era ⇒ HasTextEnvelope (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx | |
data AsType (KeyWitness era) Source # | |
Defined in Bcc.Api.Tx |
data WitnessNetworkIdOrColeAddress Source #
Either a network ID or a Cole address to be used in constructing a Sophie bootstrap witness.
WitnessNetworkId !NetworkId | Network ID. If this value is used in the construction of a Sophie bootstrap witness,
the result will not consist of a derivation path. If that is required,
specify a |
WitnessColeAddress !(Address ColeAddr) | Cole address. If this value is used in the construction of a Sophie bootstrap witness, both the network ID and derivation path will be extracted from the address and used in the construction of the witness. |
Errors
class Show e ⇒ Error e where Source #
displayError ∷ e → String Source #
Instances
Instances
Low level protocol interaction with a Bcc node
data LocalNodeConnectInfo mode Source #
The Cole-only consensus mode consists of only the Cole era.
This was used on the mainnet before the deployment of the multi-era
BccMode
. It is now of little practical use, though it illustrates
how a single-era consensus mode works. It may be sensible to remove this
at some stage.
data ConsensusMode mode where Source #
This GADT provides a value-level representation of all the consensus modes. This enables pattern matching on the era to allow them to be treated in a non-uniform way.
Instances
Show (ConsensusMode mode) Source # | |
Defined in Bcc.Api.Modes |
data LocalNodeClientProtocols block point tip tx txerr query m Source #
The protocols we can use with a local node. Use in conjunction with
connectToLocalNode
.
These protocols use the types from the rest of this API. The conversion
to/from the types used by the underlying wire formats is handled by
connectToLocalNode
.
LocalNodeClientProtocols (LocalChainSyncClient block point tip m) (Maybe (LocalTxSubmissionClient tx txerr m ())) (Maybe (LocalStateQueryClient block point query m ())) |
Chain sync protocol
newtype ChainSyncClient header point tip (m ∷ Type → Type) a #
ChainSyncClient | |
|
Local tx submission
newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a #
LocalTxSubmissionClient (m (LocalTxClientStIdle tx reject m a)) |
Local state query
newtype LocalStateQueryClient block point (query ∷ Type → Type) (m ∷ Type → Type) a #
LocalStateQueryClient | |
|
Address
newtype NetworkMagic #
Instances
Eq NetworkMagic | |
Defined in Shardagnostic.Network.Magic (==) ∷ NetworkMagic → NetworkMagic → Bool Source # (/=) ∷ NetworkMagic → NetworkMagic → Bool Source # | |
Show NetworkMagic | |
Defined in Shardagnostic.Network.Magic | |
Generic NetworkMagic | |
Defined in Shardagnostic.Network.Magic from ∷ NetworkMagic → Rep NetworkMagic x Source # to ∷ Rep NetworkMagic x → NetworkMagic Source # | |
NoThunks NetworkMagic | |
Defined in Shardagnostic.Network.Magic noThunks ∷ Context → NetworkMagic → IO (Maybe ThunkInfo) wNoThunks ∷ Context → NetworkMagic → IO (Maybe ThunkInfo) | |
type Rep NetworkMagic | |
Defined in Shardagnostic.Network.Magic type Rep NetworkMagic = D1 ('MetaData "NetworkMagic" "Shardagnostic.Network.Magic" "shardagnostic-network-0.1.0.0-5c350aed8ecd813d3e0e78a45ca35fdda83036491303e35a58d283b38c865e88" 'True) (C1 ('MetaCons "NetworkMagic" 'PrefixI 'True) (S1 ('MetaSel ('Just "unNetworkMagic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) |
Update Proposal
newtype ColeUpdateProposal Source #
Cole era update proposal
ColeUpdateProposal | |
|
Instances
Eq ColeUpdateProposal Source # | |
Defined in Bcc.Api.SpecialCole | |
Show ColeUpdateProposal Source # | |
Defined in Bcc.Api.SpecialCole | |
HasTypeProxy ColeUpdateProposal Source # | |
Defined in Bcc.Api.SpecialCole data AsType ColeUpdateProposal Source # | |
SerialiseAsRawBytes ColeUpdateProposal Source # | |
data AsType ColeUpdateProposal Source # | |
Defined in Bcc.Api.SpecialCole |
data ColeProtocolParametersUpdate Source #
ColeProtocolParametersUpdate | |
|
Instances
makeColeUpdateProposal ∷ NetworkId → ProtocolVersion → SoftwareVersion → SystemTag → InstallerHash → SomeColeSigningKey → ColeProtocolParametersUpdate → ColeUpdateProposal Source #
toColeLedgerUpdateProposal ∷ ColeUpdateProposal → GenTx ColeBlock Source #
makeProtocolParametersUpdate ∷ ColeProtocolParametersUpdate → ProtocolParametersUpdate Source #
Vote
Cole era votes
ColeVote | |
|
toColeLedgertoColeVote ∷ ColeVote → GenTx ColeBlock Source #
Conversions
fromColeTxIn ∷ TxIn → TxIn Source #
toColeEntropic ∷ Entropic → Maybe Entropic Source #
toColeNetworkMagic ∷ NetworkId → NetworkMagic Source #
toColeProtocolMagicId ∷ NetworkId → ProtocolMagicId Source #
toColeRequiresNetworkMagic ∷ NetworkId → RequiresNetworkMagic Source #