convert

package
v0.29.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2023 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyMessage = errors.New("protobuf message is empty")
View Source
var ValidChainIds = map[string]bool{
	flow.Mainnet.String():           true,
	flow.Testnet.String():           true,
	flow.Sandboxnet.String():        true,
	flow.Benchnet.String():          true,
	flow.Localnet.String():          true,
	flow.Emulator.String():          true,
	flow.BftTestnet.String():        true,
	flow.MonotonicEmulator.String(): true,
}

Functions

func AccountKeyToMessage

func AccountKeyToMessage(a flow.AccountPublicKey) (*entities.AccountKey, error)

func AccountToMessage

func AccountToMessage(a *flow.Account) (*entities.Account, error)

func Address

func Address(rawAddress []byte, chain flow.Chain) (flow.Address, error)

Address validates the input address and returns a Flow address if valid and error otherwise

func AggregatedSignaturesToMessages

func AggregatedSignaturesToMessages(a []flow.AggregatedSignature) []*entities.AggregatedSignature

func BlockHeaderToMessage

func BlockHeaderToMessage(h *flow.Header, signerIDs flow.IdentifierList) (*entities.BlockHeader, error)

func BlockID

func BlockID(blockID []byte) (flow.Identifier, error)

func BlockIDs

func BlockIDs(blockIDs [][]byte) ([]flow.Identifier, error)

func BlockSealToMessage

func BlockSealToMessage(s *flow.Seal) *entities.BlockSeal

func BlockSealsToMessages

func BlockSealsToMessages(b []*flow.Seal) []*entities.BlockSeal

func BlockToMessage

func BlockToMessage(h *flow.Block, signerIDs flow.IdentifierList) (*entities.Block, error)

func BlockToMessageLight

func BlockToMessageLight(h *flow.Block) *entities.Block

func BytesToInmemSnapshot

func BytesToInmemSnapshot(bytes []byte) (*inmem.Snapshot, error)

BytesToInmemSnapshot converts an array of bytes to `inmem.Snapshot`

func ChunkToMessage

func ChunkToMessage(chunk *flow.Chunk) *entities.Chunk

func CollectionGuaranteesToMessages

func CollectionGuaranteesToMessages(c []*flow.CollectionGuarantee) []*entities.CollectionGuarantee

func CollectionID

func CollectionID(collectionID []byte) (flow.Identifier, error)

func CollectionToMessage

func CollectionToMessage(c *flow.Collection) (*entities.Collection, error)

func EventToMessage

func EventToMessage(e flow.Event) *entities.Event

func EventType

func EventType(eventType string) (string, error)

func EventsToMessages

func EventsToMessages(flowEvents []flow.Event) []*entities.Event

func ExecutionResultToMessage

func ExecutionResultToMessage(er *flow.ExecutionResult) (*entities.ExecutionResult, error)

func ExecutionResultsToMessages

func ExecutionResultsToMessages(e []*flow.ExecutionResult) ([]*entities.ExecutionResult, error)

func IdentifierToMessage

func IdentifierToMessage(i flow.Identifier) []byte

func IdentifiersToMessages

func IdentifiersToMessages(l []flow.Identifier) [][]byte

func LightCollectionToMessage

func LightCollectionToMessage(c *flow.LightCollection) (*entities.Collection, error)

func MessageToAccount

func MessageToAccount(m *entities.Account) (*flow.Account, error)

func MessageToAccountKey

func MessageToAccountKey(m *entities.AccountKey) (*flow.AccountPublicKey, error)

func MessageToBlock

func MessageToBlock(m *entities.Block) (*flow.Block, error)

func MessageToBlockHeader

func MessageToBlockHeader(m *entities.BlockHeader) (*flow.Header, error)

func MessageToBlockSeal

func MessageToBlockSeal(m *entities.BlockSeal) (*flow.Seal, error)

func MessageToChainId

func MessageToChainId(m string) (*flow.ChainID, error)

MessageToChainId checks chainId from enumeration to prevent a panic on Chain() being called

func MessageToChunk

func MessageToChunk(m *entities.Chunk) (*flow.Chunk, error)

func MessageToEvent

func MessageToEvent(m *entities.Event) flow.Event

func MessageToExecutionResult

func MessageToExecutionResult(m *entities.ExecutionResult) (*flow.ExecutionResult, error)

func MessageToIdentifier

func MessageToIdentifier(b []byte) flow.Identifier

func MessageToServiceEvent

func MessageToServiceEvent(m *entities.ServiceEvent) (*flow.ServiceEvent, error)

func MessageToSignature

func MessageToSignature(m []byte) crypto.Signature

func MessageToStateCommitment

func MessageToStateCommitment(bytes []byte) (sc flow.StateCommitment, err error)

func MessageToTransaction

func MessageToTransaction(m *entities.Transaction, chain flow.Chain) (flow.TransactionBody, error)

func MessagesToAggregatedSignatures

func MessagesToAggregatedSignatures(m []*entities.AggregatedSignature) []flow.AggregatedSignature

func MessagesToBlockSeals

func MessagesToBlockSeals(m []*entities.BlockSeal) ([]*flow.Seal, error)

func MessagesToChunkList

func MessagesToChunkList(m []*entities.Chunk) (flow.ChunkList, error)

func MessagesToCollectionGuarantees

func MessagesToCollectionGuarantees(m []*entities.CollectionGuarantee) []*flow.CollectionGuarantee

func MessagesToEvents

func MessagesToEvents(l []*entities.Event) []flow.Event

func MessagesToExecutionResults

func MessagesToExecutionResults(m []*entities.ExecutionResult) ([]*flow.ExecutionResult, error)

func MessagesToIdentifiers

func MessagesToIdentifiers(l [][]byte) []flow.Identifier

func MessagesToServiceEventList

func MessagesToServiceEventList(m []*entities.ServiceEvent) (flow.ServiceEventList, error)

func MessagesToSignatures

func MessagesToSignatures(m [][]byte) []crypto.Signature

func PayloadFromMessage

func PayloadFromMessage(m *entities.Block) (*flow.Payload, error)

func ServiceEventToMessage

func ServiceEventToMessage(event flow.ServiceEvent) (*entities.ServiceEvent, error)

func SignatureToMessage

func SignatureToMessage(s crypto.Signature) []byte

func SignaturesToMessages

func SignaturesToMessages(s []crypto.Signature) [][]byte

func SnapshotToBytes

func SnapshotToBytes(snapshot protocol.Snapshot) ([]byte, error)

SnapshotToBytes converts a `protocol.Snapshot` to bytes, encoded as JSON

func StateCommitmentToMessage

func StateCommitmentToMessage(s flow.StateCommitment) []byte

func TransactionID

func TransactionID(txID []byte) (flow.Identifier, error)

func TransactionToMessage

func TransactionToMessage(tb flow.TransactionBody) *entities.Transaction

func TransactionsToMessages

func TransactionsToMessages(transactions []*flow.TransactionBody) []*entities.Transaction

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL