jsonmodels

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0, BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalOutput

func MarshalOutput(output devnetvm.Output) []byte

MarshalOutput uses the json marshaller to marshal a ledgerstate.Output into bytes.

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 devnetvm.Address) *Address

NewAddress returns an Address from the given ledgerstate.Address.

type AliasOutput

type AliasOutput struct {
	Balances           map[string]uint64 `json:"balances"`
	AliasAddress       string            `json:"aliasAddress"`
	StateAddress       string            `json:"stateAddress"`
	StateIndex         uint32            `json:"stateIndex"`
	IsGovernanceUpdate bool              `json:"isGovernanceUpdate"`
	IsOrigin           bool              `json:"isOrigin"`
	IsDelegated        bool              `json:"isDelegated"`

	// marshaled to base64
	StateData          []byte `json:"stateData,omitempty"`
	GovernanceMetadata []byte `json:"governanceMetadata"`
	ImmutableData      []byte `json:"immutableData,omitempty"`

	GoverningAddress   string `json:"governingAddress,omitempty"`
	DelegationTimelock int64  `json:"delegationTimelock,omitempty"`
}

AliasOutput is the JSON model of a ledgerstate.AliasOutput.

func AliasOutputFromLedgerstate

func AliasOutputFromLedgerstate(output devnetvm.Output) (*AliasOutput, error)

AliasOutputFromLedgerstate creates a JSON compatible representation of a ledgerstate output.

func UnmarshalAliasOutputFromBytes

func UnmarshalAliasOutputFromBytes(data []byte) (*AliasOutput, error)

UnmarshalAliasOutputFromBytes uses the json unmarshaler to unmarshal data into an AliasOutput.

func (*AliasOutput) ToLedgerStateOutput

func (a *AliasOutput) ToLedgerStateOutput(id utxo.OutputID) (devnetvm.Output, error)

ToLedgerStateOutput builds a ledgerstate.Output from SigLockedSingleOutput with the given outputID.

type AllowedManaPledgeResponse

type AllowedManaPledgeResponse struct {
	Access    AllowedPledge `json:"accessMana"`
	Consensus AllowedPledge `json:"consensusMana"`
	Error     string        `json:"error,omitempty"`
}

AllowedManaPledgeResponse is the http response.

type AllowedPledge

type AllowedPledge struct {
	IsFilterEnabled bool     `json:"isFilterEnabled"`
	Allowed         []string `json:"allowed,omitempty"`
}

AllowedPledge represents the nodes that mana is allowed to be pledged to.

type Block added in v0.9.2

type Block struct {
	ID                   string   `json:"id"`
	StrongParents        []string `json:"strongParents"`
	WeakParents          []string `json:"weakParents"`
	ShallowLikeParents   []string `json:"shallowLikeParents"`
	StrongChildren       []string `json:"strongChildren"`
	WeakChildren         []string `json:"weakChildren"`
	ShallowLikeChildren  []string `json:"shallowLikeChildren"`
	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"`
	EC                   string   `json:"ec"`
	EI                   uint64   `json:"ei"`
	ECR                  string   `json:"ecr"`
	PrevEC               string   `json:"prevEC"`
	Signature            string   `json:"signature"`
	LatestConfirmedEpoch uint64   `json:"latestConfirmedEpoch"`
}

Block represents the JSON model of a tangle.Block.

type BlockMetadata added in v0.9.2

type BlockMetadata struct {
	ID                    string             `json:"id"`
	ReceivedTime          int64              `json:"receivedTime"`
	Solid                 bool               `json:"solid"`
	SolidificationTime    int64              `json:"solidificationTime"`
	StructureDetails      *StructureDetails  `json:"structureDetails,omitempty"`
	ConflictIDs           []string           `json:"conflictIDs"`
	AddedConflictIDs      []string           `json:"addedConflictIDs"`
	SubtractedConflictIDs []string           `json:"subtractedConflictIDs"`
	Scheduled             bool               `json:"scheduled"`
	ScheduledTime         int64              `json:"scheduledTime"`
	Booked                bool               `json:"booked"`
	BookedTime            int64              `json:"bookedTime"`
	ObjectivelyInvalid    bool               `json:"objectivelyInvalid"`
	SubjectivelyInvalid   bool               `json:"subjectivelyInvalid"`
	ConfirmationState     confirmation.State `json:"confirmationState"`
	ConfirmationStateTime int64              `json:"confirmationStateTime"`
}

BlockMetadata represents the JSON model of the tangle.BlockMetadata.

type ChildConflict added in v0.9.2

type ChildConflict struct {
	ConflictID string `json:"conflictID"`
}

ChildConflict represents the JSON model of a ledger.ChildConflict.

func NewChildConflict added in v0.9.2

func NewChildConflict(childConflict *conflictdag.ChildConflict[utxo.TransactionID]) *ChildConflict

NewChildConflict returns a ChildConflict from the given ledger.ChildConflict.

type Conflict

type Conflict struct {
	OutputID    *OutputID `json:"outputID"`
	ConflictIDs []string  `json:"conflictIDs"`
}

Conflict represents the JSON model of a ledger.Conflict.

func NewConflict

func NewConflict(conflictID utxo.OutputID, conflictIDs []utxo.TransactionID) *Conflict

NewConflict returns a Conflict from the given ledger.ConflictID.

type ConflictWeight added in v0.9.2

type ConflictWeight struct {
	ID                string             `json:"id"`
	Parents           []string           `json:"parents"`
	ConflictIDs       []string           `json:"conflictIDs,omitempty"`
	ConfirmationState confirmation.State `json:"confirmationState"`
	ApprovalWeight    float64            `json:"approvalWeight"`
}

ConflictWeight represents the JSON model of a ledger.Conflict.

func NewConflictWeight added in v0.9.2

func NewConflictWeight(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID], confirmationState confirmation.State, aw float64) ConflictWeight

NewConflictWeight returns a Conflict from the given ledger.Conflict.

type Consumer

type Consumer struct {
	TransactionID string `json:"transactionID"`
	Booked        bool   `json:"booked"`
}

Consumer represents the JSON model of a ledger.Consumer.

func NewConsumer

func NewConsumer(consumer *ledger.Consumer) *Consumer

NewConsumer returns a Consumer from the given ledger.Consumer.

type DataRequest

type DataRequest struct {
	Data        []byte `json:"data"`
	MaxEstimate int64  `json:"maxEstimate"`
}

DataRequest contains the data of the block to send.

type DataResponse

type DataResponse struct {
	ID    string `json:"id,omitempty"`
	Error string `json:"error,omitempty"`
}

DataResponse contains the ID of the block sent.

type EpochBlocksResponse added in v0.9.2

type EpochBlocksResponse struct {
	Blocks []string `json:"blocks"`
}

type EpochInfo added in v0.9.2

type EpochInfo struct {
	EI     uint64 `json:"EI"`
	ECR    string `json:"ECR"`
	PrevEC string `json:"prevEC"`
}

func EpochInfoFromRecord added in v0.9.2

func EpochInfoFromRecord(record *epoch.ECRecord) *EpochInfo

type EpochPendingConflictCountResponse added in v0.9.2

type EpochPendingConflictCountResponse struct {
	PendingConflictCount uint64 `json:"pendingConflictCount"`
}

type EpochTransactionsResponse added in v0.9.2

type EpochTransactionsResponse struct {
	Transactions []string `json:"transactions"`
}

type EpochUTXOsResponse added in v0.9.2

type EpochUTXOsResponse struct {
	SpentOutputs   []string `json:"spentOutputs"`
	CreatedOutputs []string `json:"createdOutputs"`
}

type EpochVotersWeightResponse added in v0.9.2

type EpochVotersWeightResponse struct {
	VotersWeight map[string]*NodeWeight `json:"ecrVoters"`
}

type EpochsResponse added in v0.9.2

type EpochsResponse struct {
	Epochs []*EpochInfo `json:"epochs"`
}

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 EventLogsJSON

type EventLogsJSON struct {
	Pledge []*mana.PledgedEventJSON `json:"pledge"`
	Revoke []*mana.RevokedEventJSON `json:"revoke"`
}

EventLogsJSON is a events log in JSON.

type ExtendedLockedOutput

type ExtendedLockedOutput struct {
	Balances         map[string]uint64 `json:"balances"`
	Address          string            `json:"address"`
	FallbackAddress  string            `json:"fallbackAddress,omitempty"`
	FallbackDeadline int64             `json:"fallbackDeadline,omitempty"`
	TimeLock         int64             `json:"timelock,omitempty"`
	Payload          []byte            `json:"payload,omitempty"`
}

ExtendedLockedOutput is the JSON model of a ledgerstate.ExtendedLockedOutput.

func ExtendedLockedOutputFromLedgerstate

func ExtendedLockedOutputFromLedgerstate(output devnetvm.Output) (*ExtendedLockedOutput, error)

ExtendedLockedOutputFromLedgerstate creates a JSON compatible representation of a ledgerstate output.

func UnmarshalExtendedLockedOutputFromBytes

func UnmarshalExtendedLockedOutputFromBytes(data []byte) (*ExtendedLockedOutput, error)

UnmarshalExtendedLockedOutputFromBytes uses the json unmarshaler to unmarshal data into an ExtendedLockedOutput.

func (*ExtendedLockedOutput) ToLedgerStateOutput

func (e *ExtendedLockedOutput) ToLedgerStateOutput(id utxo.OutputID) (devnetvm.Output, error)

ToLedgerStateOutput builds a ledgerstate.Output from ExtendedLockedOutput with the given outputID.

type FaucetAPIResponse added in v0.9.1

type FaucetAPIResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

FaucetAPIResponse contains the status of facet request through web API.

type FaucetRequest

type FaucetRequest struct {
	Address               string `json:"address"`
	AccessManaPledgeID    string `json:"accessManaPledgeID"`
	ConsensusManaPledgeID string `json:"consensusManaPledgeID"`
	Nonce                 uint64 `json:"nonce"`
}

FaucetRequest contains the address to request funds from faucet.

type FaucetRequestResponse added in v0.9.1

type FaucetRequestResponse struct {
	ID    string `json:"id,omitempty"`
	Error string `json:"error,omitempty"`
}

FaucetRequestResponse contains the ID of the block sent.

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 devnetvm.Address, outputs devnetvm.Outputs) *GetAddressResponse

NewGetAddressResponse returns a GetAddressResponse from the given details.

type GetAllManaResponse

type GetAllManaResponse struct {
	Access             []mana.NodeStr `json:"access"`
	AccessTimestamp    int64          `json:"accessTimestamp"`
	Consensus          []mana.NodeStr `json:"consensus"`
	ConsensusTimestamp int64          `json:"consensusTimestamp"`
	Error              string         `json:"error,omitempty"`
}

GetAllManaResponse is the request to a getAllManaHandler request.

type GetConflictChildrenResponse added in v0.9.2

type GetConflictChildrenResponse struct {
	ConflictID     string           `json:"conflictID"`
	ChildConflicts []*ChildConflict `json:"childConflicts"`
}

GetConflictChildrenResponse represents the JSON model of a response from the GetConflictChildren endpoint.

func NewGetConflictChildrenResponse added in v0.9.2

func NewGetConflictChildrenResponse(conflictID utxo.TransactionID, childConflicts []*conflictdag.ChildConflict[utxo.TransactionID]) *GetConflictChildrenResponse

NewGetConflictChildrenResponse returns a GetConflictChildrenResponse from the given details.

type GetConflictConflictsResponse added in v0.9.2

type GetConflictConflictsResponse struct {
	ConflictID string      `json:"conflictID"`
	Conflicts  []*Conflict `json:"conflicts"`
}

GetConflictConflictsResponse represents the JSON model of a response from the GetConflictConflicts endpoint.

func NewGetConflictConflictsResponse added in v0.9.2

func NewGetConflictConflictsResponse(conflictID utxo.TransactionID, conflictIDsPerConflictID map[utxo.OutputID][]utxo.TransactionID) *GetConflictConflictsResponse

NewGetConflictConflictsResponse returns a GetConflictConflictsResponse from the given details.

type GetConflictVotersResponse added in v0.9.2

type GetConflictVotersResponse struct {
	ConflictID string   `json:"conflictID"`
	Voters     []string `json:"voters"`
}

GetConflictVotersResponse represents the JSON model of a response from the GetConflictVoters endpoint.

func NewGetConflictVotersResponse added in v0.9.2

func NewGetConflictVotersResponse(conflictID utxo.TransactionID, voters *tangle.Voters) *GetConflictVotersResponse

NewGetConflictVotersResponse returns a GetConflictVotersResponse from the given details.

type GetEventLogsRequest

type GetEventLogsRequest struct {
	NodeIDs   []string `json:"nodeIDs"`
	StartTime int64    `json:"startTime"`
	EndTime   int64    `json:"endTime"`
}

GetEventLogsRequest is the request.

type GetEventLogsResponse

type GetEventLogsResponse struct {
	Logs      map[string]*EventLogsJSON `json:"logs"`
	Error     string                    `json:"error,omitempty"`
	StartTime int64                     `json:"startTime"`
	EndTime   int64                     `json:"endTime"`
}

GetEventLogsResponse is the response.

type GetManaRequest

type GetManaRequest struct {
	NodeID string `json:"nodeID"`
}

GetManaRequest is the request for get mana.

type GetManaResponse

type GetManaResponse struct {
	Error              string  `json:"error,omitempty"`
	ShortNodeID        string  `json:"shortNodeID"`
	NodeID             string  `json:"nodeID"`
	Access             float64 `json:"access"`
	AccessTimestamp    int64   `json:"accessTimestamp"`
	Consensus          float64 `json:"consensus"`
	ConsensusTimestamp int64   `json:"consensusTimestamp"`
}

GetManaResponse defines the response for get mana.

type GetNHighestResponse

type GetNHighestResponse struct {
	Error     string         `json:"error,omitempty"`
	Nodes     []mana.NodeStr `json:"nodes,omitempty"`
	Timestamp int64          `json:"timestamp"`
}

GetNHighestResponse holds info about nodes and their mana values.

type GetNeighborsResponse

type GetNeighborsResponse struct {
	KnownPeers []Neighbor `json:"known,omitempty"`
	Chosen     []Neighbor `json:"chosen"`
	Accepted   []Neighbor `json:"accepted"`
	Error      string     `json:"error,omitempty"`
}

GetNeighborsResponse contains information of the autopeering.

type GetOnlineResponse

type GetOnlineResponse struct {
	Online    []OnlineNodeStr `json:"online"`
	Error     string          `json:"error,omitempty"`
	Timestamp int64           `json:"timestamp"`
}

GetOnlineResponse is the response to an online mana request.

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 utxo.OutputID, consumers []*ledger.Consumer) *GetOutputConsumersResponse

NewGetOutputConsumersResponse returns a GetOutputConsumersResponse from the given details.

type GetPercentileRequest

type GetPercentileRequest struct {
	NodeID string `json:"nodeID"`
}

GetPercentileRequest is the request object of mana/percentile.

type GetPercentileResponse

type GetPercentileResponse struct {
	Error              string  `json:"error,omitempty"`
	ShortNodeID        string  `json:"shortNodeID"`
	NodeID             string  `json:"nodeID"`
	Access             float64 `json:"access"`
	AccessTimestamp    int64   `json:"accessTimestamp"`
	Consensus          float64 `json:"consensus"`
	ConsensusTimestamp int64   `json:"consensusTimestamp"`
}

GetPercentileResponse holds info about the mana percentile(s) of a node.

type GetTransactionAttachmentsResponse

type GetTransactionAttachmentsResponse struct {
	TransactionID string   `json:"transactionID"`
	BlockIDs      []string `json:"blockIDs"`
}

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

func NewGetTransactionAttachmentsResponse

func NewGetTransactionAttachmentsResponse(transactionID utxo.TransactionID, blockIDs tangle.BlockIDs) *GetTransactionAttachmentsResponse

NewGetTransactionAttachmentsResponse returns a GetTransactionAttachmentsResponse from the given details.

type GetUnspentOutputResponse

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

GetUnspentOutputResponse represents the JSON model of a response from the GetUnspentOutput endpoint.

type InfoResponse

type InfoResponse struct {
	// version of GoShimmer
	Version string `json:"version,omitempty"`
	// Network Version of the autopeering
	NetworkVersion uint32 `json:"networkVersion,omitempty"`
	// TangleTime sync status
	TangleTime TangleTime `json:"tangleTime,omitempty"`
	// identity ID of the node encoded in base58
	IdentityID string `json:"identityID,omitempty"`
	// identity ID of the node encoded in base58 and truncated to its first 8 bytes
	IdentityIDShort string `json:"identityIDShort,omitempty"`
	// public key of the node encoded in base58
	PublicKey string `json:"publicKey,omitempty"`
	// BlockRequestQueueSize is the number of blocks a node is trying to request from neighbors.
	BlockRequestQueueSize int `json:"blockRequestQueueSize,omitempty"`
	// SolidBlockCount is the number of solid blocks in the node's database.
	SolidBlockCount int `json:"solidBlockCount,omitempty"`
	// TotalBlockCount is the number of blocks in the node's database.
	TotalBlockCount int `json:"totalBlockCount,omitempty"`
	// list of enabled plugins
	EnabledPlugins []string `json:"enabledPlugins,omitempty"`
	// list if disabled plugins
	DisabledPlugins []string `json:"disabledPlugins,omitempty"`
	// Mana values
	Mana Mana `json:"mana,omitempty"`
	// Scheduler is the scheduler.
	Scheduler Scheduler `json:"scheduler"`
	// LastCommittedEpoch contains information about the last committed epoch.
	LastCommittedEpoch EpochInfo
	// RateSetter is the rate setter.
	RateSetter RateSetter `json:"rateSetter"`
	// error of the response
	Error string `json:"error,omitempty"`
}

InfoResponse holds the response of the GET request.

type Input

type Input struct {
	Type               string    `json:"type"`
	ReferencedOutputID *OutputID `json:"referencedOutputID,omitempty"`
	// the referenced output object, omit if not specified
	Output *Output `json:"output,omitempty"`
}

Input represents the JSON model of a ledgerstate.Input.

func NewInput

func NewInput(input devnetvm.Input, referencedOutput ...*Output) *Input

NewInput returns an Input from the given ledgerstate.Input.

type Mana

type Mana struct {
	Access             float64   `json:"access"`
	AccessTimestamp    time.Time `json:"accessTimestamp"`
	Consensus          float64   `json:"consensus"`
	ConsensusTimestamp time.Time `json:"consensusTimestamp"`
}

Mana contains the different mana values of the node.

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 MissingAvailableResponse added in v0.8.1

type MissingAvailableResponse struct {
	Availability map[string][]string `json:"blkavailability,omitempty"`
	Count        int                 `json:"count"`
}

MissingAvailableResponse is a map of blockIDs with the peers that have such block.

type MissingResponse

type MissingResponse struct {
	IDs   []string `json:"ids,omitempty"`
	Count int      `json:"count,omitempty"`
}

MissingResponse is the HTTP response containing all the missing blocks and their count.

type Neighbor

type Neighbor struct {
	ID        string        `json:"id"`        // comparable node identifier
	PublicKey string        `json:"publicKey"` // public key used to verify signatures
	Services  []PeerService `json:"services,omitempty"`
}

Neighbor contains information of a neighbor peer.

type NodeWeight added in v0.9.2

type NodeWeight struct {
	Weights map[string]float64 `json:"weights"`
}

type OnlineNodeStr

type OnlineNodeStr struct {
	OnlineRank int     `json:"rank"`
	ShortID    string  `json:"shortNodeID"`
	ID         string  `json:"nodeID"`
	Mana       float64 `json:"mana"`
}

OnlineNodeStr holds information about online rank, nodeID and mana.

type Output

type Output struct {
	OutputID *OutputID       `json:"outputID,omitempty"`
	Type     string          `json:"type"`
	Output   json.RawMessage `json:"output"`
}

Output represents the JSON model of a ledgerstate.Output.

func NewOutput

func NewOutput(output devnetvm.Output) (result *Output)

NewOutput returns an Output from the given ledgerstate.Output.

func (*Output) ToLedgerstateOutput

func (o *Output) ToLedgerstateOutput() (devnetvm.Output, error)

ToLedgerstateOutput converts the json output object into a goshimmer representation.

type OutputID

type OutputID struct {
	Base58 string `json:"base58"`
}

OutputID represents the JSON model of a ledgerstate.OutputID.

func NewOutputID

func NewOutputID(outputID utxo.OutputID) *OutputID

NewOutputID returns an OutputID from the given ledgerstate.OutputID.

type OutputMetadata

type OutputMetadata struct {
	OutputID              *OutputID          `json:"outputID"`
	ConflictIDs           []string           `json:"conflictIDs"`
	FirstConsumer         string             `json:"firstCount"`
	ConfirmedConsumer     string             `json:"confirmedConsumer,omitempty"`
	ConfirmationState     confirmation.State `json:"confirmationState"`
	ConfirmationStateTime int64              `json:"confirmationStateTime"`
}

OutputMetadata represents the JSON model of the ledger.OutputMetadata.

func NewOutputMetadata

func NewOutputMetadata(outputMetadata *ledger.OutputMetadata, confirmedConsumerID utxo.TransactionID) *OutputMetadata

NewOutputMetadata returns the OutputMetadata from the given ledger.OutputMetadata.

type ParentBlockIDs added in v0.9.2

type ParentBlockIDs struct {
	Type     uint8    `json:"type"`
	BlockIDs []string `json:"blockIDs"`
}

ParentBlockIDs is a json representation of tangle.ParentBlockIDs.

type PastConsensusManaVectorResponse

type PastConsensusManaVectorResponse struct {
	Consensus []mana.NodeStr `json:"consensus"`
	Error     string         `json:"error,omitempty"`
	TimeStamp int64          `json:"timestamp"`
}

PastConsensusManaVectorResponse is the response.

type PastconeRequest

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

PastconeRequest holds the block id to query.

type PastconeResponse

type PastconeResponse struct {
	Exist        bool   `json:"exist,omitempty"`
	PastConeSize int    `json:"pastConeSize,omitempty"`
	Error        string `json:"error,omitempty"`
}

PastconeResponse is the HTTP response containing the number of blocks in the past cone and if all blocks of the past cone exist on the node.

type PeerService

type PeerService struct {
	ID      string `json:"id"`      // ID of the service
	Address string `json:"address"` // network address of the service
}

PeerService contains information about a neighbor peer service.

type PeerToRemove

type PeerToRemove struct {
	PublicKey ed25519.PublicKey `json:"publicKey"`
}

PeerToRemove holds the data that uniquely identifies the peer to be removed, e.g. public key or ID. Only public key is supported for now.

type PostAddressesUnspentOutputsRequest

type PostAddressesUnspentOutputsRequest struct {
	Addresses []string `json:"addresses"`
}

PostAddressesUnspentOutputsRequest is a the request object for the /ledgerstate/addresses/unspentOutputs endpoint.

type PostAddressesUnspentOutputsResponse

type PostAddressesUnspentOutputsResponse struct {
	UnspentOutputs []*WalletOutputsOnAddress `json:"unspentOutputs"`
}

PostAddressesUnspentOutputsResponse is a the response object for the /ledgerstate/addresses/unspentOutputs endpoint.

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(block *tangle.Block) *PostPayloadResponse

NewPostPayloadResponse returns a PostPayloadResponse from the given tangle.Block.

type PostTransactionRequest

type PostTransactionRequest struct {
	TransactionBytes []byte `json:"txn_bytes"`
}

PostTransactionRequest holds the transaction object(bytes) to send.

type PostTransactionResponse

type PostTransactionResponse struct {
	TransactionID string `json:"transaction_id,omitempty"`
	Error         string `json:"error,omitempty"`
}

PostTransactionResponse is the HTTP response from sending transaction.

type RateSetter

type RateSetter struct {
	Rate     float64       `json:"rate"`
	Size     int           `json:"size"`
	Estimate time.Duration `json:"estimate"`
}

RateSetter is the rate setter details.

type Scheduler

type Scheduler struct {
	Running           bool           `json:"running"`
	Rate              string         `json:"rate"`
	MaxBufferSize     int            `json:"maxBufferSize"`
	CurrentBufferSize int            `json:"currentBufferSizer"`
	NodeQueueSizes    map[string]int `json:"nodeQueueSizes"`
	Deficit           float64        `json:"deficit"`
}

Scheduler is the scheduler details.

type SendBlockRequest added in v0.9.2

type SendBlockRequest struct {
	Payload        []byte           `json:"payload"`
	ParentBlockIDs []ParentBlockIDs `json:"parentBlockIDs"`
}

SendBlockRequest contains the data of send block endpoint.

type SigLockedColoredOutput

type SigLockedColoredOutput struct {
	Balances map[string]uint64 `json:"balances"`
	Address  string            `json:"address"`
}

SigLockedColoredOutput is the JSON model of a ledgerstate.SigLockedColoredOutput.

func SigLockedColoredOutputFromLedgerstate

func SigLockedColoredOutputFromLedgerstate(output devnetvm.Output) (*SigLockedColoredOutput, error)

SigLockedColoredOutputFromLedgerstate creates a JSON compatible representation of a ledgerstate output.

func UnmarshalSigLockedColoredOutputFromBytes

func UnmarshalSigLockedColoredOutputFromBytes(data []byte) (*SigLockedColoredOutput, error)

UnmarshalSigLockedColoredOutputFromBytes uses the json unmarshaler to unmarshal data into a SigLockedColoredOutput.

func (*SigLockedColoredOutput) ToLedgerStateOutput

func (s *SigLockedColoredOutput) ToLedgerStateOutput(id utxo.OutputID) (devnetvm.Output, error)

ToLedgerStateOutput builds a ledgerstate.Output from SigLockedSingleOutput with the given outputID.

type SigLockedSingleOutput

type SigLockedSingleOutput struct {
	Balance uint64 `json:"balance"`
	Address string `json:"address"`
}

SigLockedSingleOutput is the JSON model of a ledgerstate.SigLockedSingleOutput.

func SigLockedSingleOutputFromLedgerstate

func SigLockedSingleOutputFromLedgerstate(output devnetvm.Output) (*SigLockedSingleOutput, error)

SigLockedSingleOutputFromLedgerstate creates a JSON compatible representation of a ledgerstate output.

func UnmarshalSigLockedSingleOutputFromBytes

func UnmarshalSigLockedSingleOutputFromBytes(data []byte) (*SigLockedSingleOutput, error)

UnmarshalSigLockedSingleOutputFromBytes uses the json unmarshaler to unmarshal data into a SigLockedSingleOutput.

func (*SigLockedSingleOutput) ToLedgerStateOutput

func (s *SigLockedSingleOutput) ToLedgerStateOutput(id utxo.OutputID) (devnetvm.Output, error)

ToLedgerStateOutput builds a ledgerstate.Output from SigLockedSingleOutput with the given outputID.

type SpammerRequest

type SpammerRequest struct {
	Cmd  string `json:"cmd"`
	IMIF string `json:"imif"`
	Rate int    `json:"rate"`
	Unit string `json:"unit"`
}

SpammerRequest contains the parameters of a spammer request.

type SpammerResponse

type SpammerResponse struct {
	Block string `json:"block"`
	Error string `json:"error"`
}

SpammerResponse is the HTTP response of a spammer request.

type StructureDetails

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

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 TangleTime

type TangleTime struct {
	AcceptedBlockID string `json:"blockID"`
	ATT             int64  `json:"ATT"`
	RATT            int64  `json:"RATT"`
	CTT             int64  `json:"CTT"`
	RCTT            int64  `json:"RCTT"`
	Synced          bool   `json:"synced"`
}

TangleTime contains the TangleTime sync detailed status.

type Transaction

type Transaction struct {
	Version           devnetvm.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 *devnetvm.Transaction) *Transaction

NewTransaction returns a Transaction from the given ledgerstate.Transaction.

type TransactionMetadata

type TransactionMetadata struct {
	TransactionID         string             `json:"transactionID"`
	ConflictIDs           []string           `json:"conflictIDs"`
	Booked                bool               `json:"booked"`
	BookedTime            int64              `json:"bookedTime"`
	ConfirmationState     confirmation.State `json:"confirmationState"`
	ConfirmationStateTime int64              `json:"confirmationStateTime"`
}

TransactionMetadata represents the JSON model of the ledger.TransactionMetadata.

func NewTransactionMetadata

func NewTransactionMetadata(transactionMetadata *ledger.TransactionMetadata) *TransactionMetadata

NewTransactionMetadata returns the TransactionMetadata from the given ledger.TransactionMetadata.

type UnlockBlock

type UnlockBlock struct {
	Type            string                 `json:"type"`
	ReferencedIndex uint16                 `json:"referencedIndex,omitempty"`
	SignatureType   devnetvm.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 devnetvm.UnlockBlock) *UnlockBlock

NewUnlockBlock returns an UnlockBlock from the given ledgerstate.UnlockBlock.

type WalletOutput

type WalletOutput struct {
	Output            Output               `json:"output"`
	Metadata          WalletOutputMetadata `json:"metadata"`
	ConfirmationState confirmation.State   `json:"confirmationState"`
}

WalletOutput represents an output as expected by the wallet lib.

type WalletOutputMetadata

type WalletOutputMetadata struct {
	Timestamp time.Time `json:"timestamp"`
}

WalletOutputMetadata holds metadata about the output.

type WalletOutputsOnAddress

type WalletOutputsOnAddress struct {
	Address Address        `json:"address"`
	Outputs []WalletOutput `json:"outputs"`
}

WalletOutputsOnAddress represents wallet outputs on an address.

Jump to

Keyboard shortcuts

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