jsonmodels

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0, BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalOutput

func MarshalOutput(output ledgerstate.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 ledgerstate.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 ledgerstate.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 ledgerstate.OutputID) (ledgerstate.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 Branch

type Branch struct {
	ID              string              `json:"id"`
	Parents         []string            `json:"parents"`
	ConflictIDs     []string            `json:"conflictIDs,omitempty"`
	GradeOfFinality gof.GradeOfFinality `json:"gradeOfFinality"`
	ApprovalWeight  float64             `json:"approvalWeight"`
}

Branch represents the JSON model of a ledgerstate.Branch.

func NewBranch

func NewBranch(branch *ledgerstate.Branch, gradeOfFinality gof.GradeOfFinality, aw float64) Branch

NewBranch returns a Branch from the given ledgerstate.Branch.

type ChildBranch

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

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 CollectiveBeaconRequest

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

CollectiveBeaconRequest is a request containing a collective beacon response.

type CollectiveBeaconResponse

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

CollectiveBeaconResponse is the HTTP response from broadcasting a collective beacon message.

type Committee

type Committee struct {
	InstanceID    uint32   `json:"instanceID,omitempty"`
	Threshold     uint8    `json:"threshold,omitempty"`
	Identities    []string `json:"identities,omitempty"`
	DistributedPK string   `json:"distributedPK,omitempty"`
}

Committee defines the information about a committee.

type CommitteeResponse

type CommitteeResponse struct {
	Committees []Committee `json:"committees,omitempty"`
	Error      string      `json:"error,omitempty"`
}

CommitteeResponse is the HTTP message containing the DRNG committee.

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 DataRequest

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

DataRequest contains the data of the message to send.

type DataResponse

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

DataResponse contains the ID of the message sent.

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 ledgerstate.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 ledgerstate.OutputID) (ledgerstate.Output, error)

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

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 FaucetResponse

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

FaucetResponse contains the ID of the message 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 ledgerstate.Address, outputs ledgerstate.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 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 GetBranchVotersResponse

type GetBranchVotersResponse struct {
	BranchID string   `json:"branchID"`
	Voters   []string `json:"voters"`
}

GetBranchVotersResponse represents the JSON model of a response from the GetBranchVoters endpoint.

func NewGetBranchVotersResponse

func NewGetBranchVotersResponse(branchID ledgerstate.BranchID, voters *tangle.Voters) *GetBranchVotersResponse

NewGetBranchVotersResponse returns a GetBranchVotersResponse 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 ledgerstate.OutputID, consumers []*ledgerstate.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"`
	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 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"`
	// MessageRequestQueueSize is the number of messages a node is trying to request from neighbors.
	MessageRequestQueueSize int `json:"messageRequestQueueSize,omitempty"`
	// SolidMessageCount is the number of solid messages in the node's database.
	SolidMessageCount int `json:"solidMessageCount,omitempty"`
	// TotalMessageCount is the number of messages in the node's database.
	TotalMessageCount int `json:"totalMessageCount,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"`
	// Mana Delegation Address
	ManaDelegationAddress string `json:"manaDelegationAddress,omitempty"`
	// ManaDecay is the decay coefficient of bm2.
	ManaDecay float64 `json:"mana_decay"`
	// Scheduler is the scheduler.
	Scheduler Scheduler `json:"scheduler"`
	// 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 ledgerstate.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 Message

type Message struct {
	ID                      string   `json:"id"`
	StrongParents           []string `json:"strongParents"`
	WeakParents             []string `json:"weakParents"`
	ShallowLikeParents      []string `json:"shallowLikeParents"`
	ShallowDislikeParents   []string `json:"shallowDislikeParents"`
	StrongApprovers         []string `json:"strongApprovers"`
	WeakApprovers           []string `json:"weakApprovers"`
	ShallowLikeApprovers    []string `json:"shallowLikeApprovers"`
	ShallowDislikeApprovers []string `json:"shallowDislikeApprovers"`
	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.

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"`
	BranchIDs           []string            `json:"branchIDs"`
	AddedBranchIDs      []string            `json:"addedBranchIDs"`
	SubtractedBranchIDs []string            `json:"subtractedBranchIDs"`
	Scheduled           bool                `json:"scheduled"`
	ScheduledTime       int64               `json:"scheduledTime"`
	Booked              bool                `json:"booked"`
	BookedTime          int64               `json:"bookedTime"`
	ObjectivelyInvalid  bool                `json:"objectivelyInvalid"`
	SubjectivelyInvalid bool                `json:"subjectivelyInvalid"`
	GradeOfFinality     gof.GradeOfFinality `json:"gradeOfFinality"`
	GradeOfFinalityTime int64               `json:"gradeOfFinalityTime"`
}

MessageMetadata represents the JSON model of the tangle.MessageMetadata.

type MissingAvailableResponse

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

MissingAvailableResponse is a map of messageIDs with the peers that have such message.

type MissingResponse

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

MissingResponse is the HTTP response containing all the missing messages 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 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 ledgerstate.Output) (result *Output)

NewOutput returns an Output from the given ledgerstate.Output.

func (*Output) ToLedgerstateOutput

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

ToLedgerstateOutput converts the json output object into a goshimmer representation.

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"`
	BranchIDs           []string            `json:"branchIDs"`
	Solid               bool                `json:"solid"`
	SolidificationTime  int64               `json:"solidificationTime"`
	ConsumerCount       int                 `json:"consumerCount"`
	ConfirmedConsumer   string              `json:"confirmedConsumer,omitempty"`
	GradeOfFinality     gof.GradeOfFinality `json:"gradeOfFinality"`
	GradeOfFinalityTime int64               `json:"gradeOfFinalityTime"`
}

OutputMetadata represents the JSON model of the ledgerstate.OutputMetadata.

func NewOutputMetadata

func NewOutputMetadata(outputMetadata *ledgerstate.OutputMetadata, confirmedConsumerID ledgerstate.TransactionID) *OutputMetadata

NewOutputMetadata returns the OutputMetadata from the given ledgerstate.OutputMetadata.

type ParentMessageIDs

type ParentMessageIDs struct {
	Type       uint8    `json:"type"`
	MessageIDs []string `json:"messageIDs"`
}

ParentMessageIDs is a json representation of tangle.ParentMessageIDs.

type PastConsensusManaVectorRequest

type PastConsensusManaVectorRequest struct {
	Timestamp int64 `json:"timestamp"`
}

PastConsensusManaVectorRequest is the request.

type PastConsensusManaVectorResponse

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

PastConsensusManaVectorResponse is the response.

type PastConsensusVectorMetadataResponse

type PastConsensusVectorMetadataResponse struct {
	Metadata *mana.ConsensusBasePastManaVectorMetadata `json:"metadata,omitempty"`
	Error    string                                    `json:"error,omitempty"`
}

PastConsensusVectorMetadataResponse is the response.

type PastconeRequest

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

PastconeRequest holds the message 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 messages in the past cone and if all messages 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 PendingRequest

type PendingRequest struct {
	OutputID string `json:"outputID"`
}

PendingRequest is the pending mana request.

type PendingResponse

type PendingResponse struct {
	Mana      float64 `json:"mana"`
	OutputID  string  `json:"outputID"`
	Error     string  `json:"error,omitempty"`
	Timestamp int64   `json:"timestamp"`
}

PendingResponse is the pending mana response.

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(message *tangle.Message) *PostPayloadResponse

NewPostPayloadResponse returns a PostPayloadResponse from the given tangle.Message.

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 Randomness

type Randomness struct {
	InstanceID uint32    `json:"instanceID,omitempty"`
	Round      uint64    `json:"round,omitempty"`
	Timestamp  time.Time `json:"timestamp,omitempty"`
	Randomness []byte    `json:"randomness,omitempty"`
}

Randomness defines the content of new randomness.

type RandomnessResponse

type RandomnessResponse struct {
	Randomness []Randomness `json:"randomness,omitempty"`
	Error      string       `json:"error,omitempty"`
}

RandomnessResponse is the HTTP message containing the current DRNG randomness.

type RateSetter

type RateSetter struct {
	Rate float64 `json:"rate"`
	Size int     `json:"size"`
}

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"`
}

Scheduler is the scheduler details.

type SendMessageRequest

type SendMessageRequest struct {
	Payload          []byte             `json:"payload"`
	ParentMessageIDs []ParentMessageIDs `json:"parentMessageIDs"`
}

SendMessageRequest contains the data of send message 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 ledgerstate.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 ledgerstate.OutputID) (ledgerstate.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 ledgerstate.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 ledgerstate.OutputID) (ledgerstate.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 {
	Message string `json:"message"`
	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"`
	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 TangleTime

type TangleTime struct {
	MessageID string `json:"messageID"`
	Time      int64  `json:"time"`
	Synced    bool   `json:"synced"`
}

TangleTime contains the TangleTime sync detailed status.

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"`
	BranchIDs           []string            `json:"branchIDs"`
	Solid               bool                `json:"solid"`
	SolidificationTime  int64               `json:"solidificationTime"`
	LazyBooked          bool                `json:"lazyBooked"`
	GradeOfFinality     gof.GradeOfFinality `json:"gradeOfFinality"`
	GradeOfFinalityTime int64               `json:"gradeOfFinalityTime"`
}

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.

type WalletOutput

type WalletOutput struct {
	Output          Output               `json:"output"`
	Metadata        WalletOutputMetadata `json:"metadata"`
	GradeOfFinality gof.GradeOfFinality  `json:"gradeOfFinality"`
}

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