jsonmodels

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Type   string `json:"type"`
	Base58 string `json:"base58"`
}

Address represents the JSON model of a ledgerstate.Address.

func NewAddress

func NewAddress(address ledgerstate.Address) *Address

NewAddress returns an Address from the given ledgerstate.Address.

type Branch

type Branch struct {
	ID                 string   `json:"id"`
	Type               string   `json:"type"`
	Parents            []string `json:"parents"`
	ConflictIDs        []string `json:"conflictIDs,omitempty"`
	Liked              bool     `json:"liked"`
	MonotonicallyLiked bool     `json:"monotonicallyLiked"`
	Finalized          bool     `json:"finalized"`
	InclusionState     string   `json:"inclusionState"`
}

Branch represents the JSON model of a ledgerstate.Branch.

func NewBranch

func NewBranch(branch ledgerstate.Branch) Branch

NewBranch returns a Branch from the given ledgerstate.Branch.

type ChildBranch

type ChildBranch struct {
	BranchID   string `json:"branchID"`
	BranchType string `json:"type"`
}

ChildBranch represents the JSON model of a ledgerstate.ChildBranch.

func NewChildBranch

func NewChildBranch(childBranch *ledgerstate.ChildBranch) *ChildBranch

NewChildBranch returns a ChildBranch from the given ledgerstate.ChildBranch.

type Conflict

type Conflict struct {
	OutputID  *OutputID `json:"outputID"`
	BranchIDs []string  `json:"branchIDs"`
}

Conflict represents the JSON model of a ledgerstate.Conflict.

func NewConflict

func NewConflict(conflictID ledgerstate.ConflictID, branchIDs []ledgerstate.BranchID) *Conflict

NewConflict returns a Conflict from the given ledgerstate.ConflictID.

type Consumer

type Consumer struct {
	TransactionID string `json:"transactionID"`
	Valid         string `json:"valid"`
}

Consumer represents the JSON model of a ledgerstate.Consumer.

func NewConsumer

func NewConsumer(consumer *ledgerstate.Consumer) *Consumer

NewConsumer returns a Consumer from the given ledgerstate.Consumer.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents the JSON model of an error response from an API endpoint.

func NewErrorResponse

func NewErrorResponse(err error) *ErrorResponse

NewErrorResponse returns am ErrorResponse from the given error.

type GetAddressResponse

type GetAddressResponse struct {
	Address *Address  `json:"address"`
	Outputs []*Output `json:"outputs"`
}

GetAddressResponse represents the JSON model of a response from the GetAddress endpoint.

func NewGetAddressResponse

func NewGetAddressResponse(address ledgerstate.Address, outputs ledgerstate.Outputs) *GetAddressResponse

NewGetAddressResponse returns a GetAddressResponse from the given details.

type GetBranchChildrenResponse

type GetBranchChildrenResponse struct {
	BranchID      string         `json:"branchID"`
	ChildBranches []*ChildBranch `json:"childBranches"`
}

GetBranchChildrenResponse represents the JSON model of a response from the GetBranchChildren endpoint.

func NewGetBranchChildrenResponse

func NewGetBranchChildrenResponse(branchID ledgerstate.BranchID, childBranches []*ledgerstate.ChildBranch) *GetBranchChildrenResponse

NewGetBranchChildrenResponse returns a GetBranchChildrenResponse from the given details.

type GetBranchConflictsResponse

type GetBranchConflictsResponse struct {
	BranchID  string      `json:"branchID"`
	Conflicts []*Conflict `json:"conflicts"`
}

GetBranchConflictsResponse represents the JSON model of a response from the GetBranchConflicts endpoint.

func NewGetBranchConflictsResponse

func NewGetBranchConflictsResponse(branchID ledgerstate.BranchID, branchIDsPerConflictID map[ledgerstate.ConflictID][]ledgerstate.BranchID) *GetBranchConflictsResponse

NewGetBranchConflictsResponse returns a GetBranchConflictsResponse from the given details.

type GetOutputConsumersResponse

type GetOutputConsumersResponse struct {
	OutputID  *OutputID   `json:"outputID"`
	Consumers []*Consumer `json:"consumers"`
}

GetOutputConsumersResponse represents the JSON model of a response from the GetOutputConsumers endpoint.

func NewGetOutputConsumersResponse

func NewGetOutputConsumersResponse(outputID ledgerstate.OutputID, consumers []*ledgerstate.Consumer) *GetOutputConsumersResponse

NewGetOutputConsumersResponse returns a GetOutputConsumersResponse from the given details.

type GetTransactionAttachmentsResponse

type GetTransactionAttachmentsResponse struct {
	TransactionID string   `json:"transactionID"`
	MessageIDs    []string `json:"messageIDs"`
}

GetTransactionAttachmentsResponse represents the JSON model of a response from the GetTransactionAttachments endpoint.

func NewGetTransactionAttachmentsResponse

func NewGetTransactionAttachmentsResponse(transactionID ledgerstate.TransactionID, messageIDs tangle.MessageIDs) *GetTransactionAttachmentsResponse

NewGetTransactionAttachmentsResponse returns a GetTransactionAttachmentsResponse from the given details.

type Input

type Input struct {
	Type               string    `json:"type"`
	ReferencedOutputID *OutputID `json:"referencedOutputID,omitempty"`
}

Input represents the JSON model of a ledgerstate.Input.

func NewInput

func NewInput(input ledgerstate.Input) *Input

NewInput returns an Input from the given ledgerstate.Input.

type Markers

type Markers struct {
	Markers      map[markersPackage.SequenceID]markersPackage.Index `json:"markers"`
	HighestIndex markersPackage.Index                               `json:"highestIndex"`
	LowestIndex  markersPackage.Index                               `json:"lowestIndex"`
}

Markers represents the JSON model of the markers.Markers.

func NewMarkers

func NewMarkers(markers *markersPackage.Markers) *Markers

NewMarkers returns the Markers from the given markers.Markers.

type Message

type Message struct {
	ID              string   `json:"id"`
	StrongParents   []string `json:"strongParents"`
	WeakParents     []string `json:"weakParents"`
	StrongApprovers []string `json:"strongApprovers"`
	WeakApprovers   []string `json:"weakApprovers"`
	IssuerPublicKey string   `json:"issuerPublicKey"`
	IssuingTime     int64    `json:"issuingTime"`
	SequenceNumber  uint64   `json:"sequenceNumber"`
	PayloadType     string   `json:"payloadType"`
	TransactionID   string   `json:"transactionID,omitempty"`
	Payload         []byte   `json:"payload"`
	Signature       string   `json:"signature"`
}

Message represents the JSON model of a tangle.Message.

func NewMessage

func NewMessage(message *tangle.Message) Message

NewMessage returns a Message from the given tangle.Message.

type MessageMetadata

type MessageMetadata struct {
	ID                 string            `json:"id"`
	ReceivedTime       int64             `json:"receivedTime"`
	Solid              bool              `json:"solid"`
	SolidificationTime int64             `json:"solidificationTime"`
	StructureDetails   *StructureDetails `json:"structureDetails,omitempty"`
	BranchID           string            `json:"branchID"`
	Scheduled          bool              `json:"scheduled"`
	Booked             bool              `json:"booked"`
	Eligible           bool              `json:"eligible"`
	Invalid            bool              `json:"invalid"`
}

MessageMetadata represents the JSON model of the tangle.MessageMetadata.

func NewMessageMetadata

func NewMessageMetadata(metadata *tangle.MessageMetadata) MessageMetadata

NewMessageMetadata returns MessageMetadata from the given tangle.MessageMetadata.

type Output

type Output struct {
	OutputID *OutputID         `json:"outputID,omitempty"`
	Type     string            `json:"type"`
	Balances map[string]uint64 `json:"balances"`
	Address  string            `json:"address"`
}

Output represents the JSON model of a ledgerstate.Output.

func NewOutput

func NewOutput(output ledgerstate.Output) *Output

NewOutput returns an Output from the given ledgerstate.Output.

type OutputID

type OutputID struct {
	Base58        string `json:"base58"`
	TransactionID string `json:"transactionID"`
	OutputIndex   uint16 `json:"outputIndex"`
}

OutputID represents the JSON model of a ledgerstate.OutputID.

func NewOutputID

func NewOutputID(outputID ledgerstate.OutputID) *OutputID

NewOutputID returns an OutputID from the given ledgerstate.OutputID.

type OutputMetadata

type OutputMetadata struct {
	OutputID           *OutputID `json:"outputID"`
	BranchID           string    `json:"branchID"`
	Solid              bool      `json:"solid"`
	SolidificationTime int64     `json:"solidificationTime"`
	ConsumerCount      int       `json:"consumerCount"`
	FirstConsumer      string    `json:"firstConsumer"`
	Finalized          bool      `json:"finalized"`
}

OutputMetadata represents the JSON model of the ledgerstate.OutputMetadata.

func NewOutputMetadata

func NewOutputMetadata(outputMetadata *ledgerstate.OutputMetadata) *OutputMetadata

NewOutputMetadata returns the OutputMetadata from the given ledgerstate.OutputMetadata.

type PostPayloadRequest

type PostPayloadRequest struct {
	Payload []byte `json:"payload"`
}

PostPayloadRequest represents the JSON model of a PostPayload request.

type PostPayloadResponse

type PostPayloadResponse struct {
	ID string `json:"id"`
}

PostPayloadResponse represents the JSON model of a PostPayload response.

func NewPostPayloadResponse

func NewPostPayloadResponse(message *tangle.Message) *PostPayloadResponse

NewPostPayloadResponse returns a PostPayloadResponse from the given tangle.Message.

type StructureDetails

type StructureDetails struct {
	Rank          uint64   `json:"rank"`
	IsPastMarker  bool     `json:"isPastMarker"`
	PastMarkers   *Markers `json:"pastMarkers"`
	FutureMarkers *Markers `json:"futureMarkers"`
}

StructureDetails represents the JSON model of the markers.StructureDetails.

func NewStructureDetails

func NewStructureDetails(structureDetails *markersPackage.StructureDetails) *StructureDetails

NewStructureDetails returns the StructureDetails from the given markers.StructureDetails.

type Transaction

type Transaction struct {
	Version           ledgerstate.TransactionEssenceVersion `json:"version"`
	Timestamp         int64                                 `json:"timestamp"`
	AccessPledgeID    string                                `json:"accessPledgeID"`
	ConsensusPledgeID string                                `json:"consensusPledgeID"`
	Inputs            []*Input                              `json:"inputs"`
	Outputs           []*Output                             `json:"outputs"`
	UnlockBlocks      []*UnlockBlock                        `json:"unlockBlocks"`
	DataPayload       []byte                                `json:"dataPayload"`
}

Transaction represents the JSON model of a ledgerstate.Transaction.

func NewTransaction

func NewTransaction(transaction *ledgerstate.Transaction) *Transaction

NewTransaction returns a Transaction from the given ledgerstate.Transaction.

type TransactionMetadata

type TransactionMetadata struct {
	TransactionID      string `json:"transactionID"`
	BranchID           string `json:"branchID"`
	Solid              bool   `json:"solid"`
	SolidificationTime int64  `json:"solidificationTime"`
	Finalized          bool   `json:"finalized"`
	LazyBooked         bool   `json:"lazyBooked"`
}

TransactionMetadata represents the JSON model of the ledgerstate.TransactionMetadata.

func NewTransactionMetadata

func NewTransactionMetadata(transactionMetadata *ledgerstate.TransactionMetadata) *TransactionMetadata

NewTransactionMetadata returns the TransactionMetadata from the given ledgerstate.TransactionMetadata.

type UnlockBlock

type UnlockBlock struct {
	Type            string                    `json:"type"`
	ReferencedIndex uint16                    `json:"referencedIndex,omitempty"`
	SignatureType   ledgerstate.SignatureType `json:"signatureType,omitempty"`
	PublicKey       string                    `json:"publicKey,omitempty"`
	Signature       string                    `json:"signature,omitempty"`
}

UnlockBlock represents the JSON model of a ledgerstate.UnlockBlock.

func NewUnlockBlock

func NewUnlockBlock(unlockBlock ledgerstate.UnlockBlock) *UnlockBlock

NewUnlockBlock returns an UnlockBlock from the given ledgerstate.UnlockBlock.

Jump to

Keyboard shortcuts

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