value

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0, BSD-2-Clause Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PluginName = "WebAPI Value Endpoint"

PluginName is the name of the web API DRNG endpoint plugin.

Variables

View Source
var (

	// ErrMalformedIdentityID defines a malformed identityID error.
	ErrMalformedIdentityID = fmt.Errorf("malformed identityID")
	// ErrMalformedInputs defines a malformed inputs error.
	ErrMalformedInputs = fmt.Errorf("malformed inputs")
	// ErrMalformedOutputs defines a malformed outputs error.
	ErrMalformedOutputs = fmt.Errorf("malformed outputs")
	// ErrMalformedData defines a malformed data error.
	ErrMalformedData = fmt.Errorf("malformed data")
	// ErrMalformedColor defines a malformed color error.
	ErrMalformedColor = fmt.Errorf("malformed color")
	// ErrMalformedPublicKey defines a malformed publicKey error.
	ErrMalformedPublicKey = fmt.Errorf("malformed publicKey")
	// ErrMalformedSignature defines a malformed signature error.
	ErrMalformedSignature = fmt.Errorf("malformed signature")
	// ErrWrongSignature defines a wrong signature error.
	ErrWrongSignature = fmt.Errorf("wrong signature")
	// ErrSignatureVersion defines a unsupported signature version error.
	ErrSignatureVersion = fmt.Errorf("unsupported signature version")
)
View Source
var (

	// ErrNotAllowedToPledgeManaToNode defines an unsupported node to pledge mana to.
	ErrNotAllowedToPledgeManaToNode = errors.New("not allowed to pledge mana to node")
)

Functions

func NewTransactionFromJSON added in v0.3.0

func NewTransactionFromJSON(request SendTransactionByJSONRequest) (*ledgerstate.Transaction, error)

NewTransactionFromJSON returns a new transaction from a given JSON request or an error.

func Plugin

func Plugin() *node.Plugin

Plugin gets the plugin instance.

Types

type AllowedManaPledgeResponse added in v0.5.0

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

AllowedManaPledgeResponse is the http response.

type AllowedPledge added in v0.5.0

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 AttachmentsResponse added in v0.3.0

type AttachmentsResponse struct {
	Attachments []ValueObject `json:"attachments,omitempty"`
	Error       string        `json:"error,omitempty"`
}

AttachmentsResponse is the HTTP response from retrieving value objects.

type Balance added in v0.3.0

type Balance struct {
	Color string `json:"color"`
	Value int64  `json:"value"`
}

Balance holds the value and the color of token

type GetTransactionByIDResponse added in v0.3.0

type GetTransactionByIDResponse struct {
	TransactionMetadata TransactionMetadata `json:"transactionMetadata"`
	Transaction         Transaction         `json:"transaction"`
	InclusionState      InclusionState      `json:"inclusion_state"`
	Error               string              `json:"error,omitempty"`
}

GetTransactionByIDResponse is the HTTP response from retrieving transaction.

type InclusionState added in v0.3.0

type InclusionState struct {
	Solid       bool `json:"solid,omitempty"`
	Confirmed   bool `json:"confirmed,omitempty"`
	Rejected    bool `json:"rejected,omitempty"`
	Liked       bool `json:"liked,omitempty"`
	Conflicting bool `json:"conflicting,omitempty"`
	Finalized   bool `json:"finalized,omitempty"`
	Preferred   bool `json:"preferred,omitempty"`
}

InclusionState represents the different states of an OutputID

type Input added in v0.4.1

type Input struct {
	ConsumedOutputID string `json:"consumedOutputID"`
}

Input holds the consumedOutputID

type Metadata added in v0.5.0

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

Metadata holds metadata about the output.

type Output added in v0.3.0

type Output struct {
	Type     ledgerstate.OutputType `json:"type"`
	Address  string                 `json:"address"`
	Balances []Balance              `json:"balances"`
}

Output consists an address and balances

type OutputID added in v0.3.0

type OutputID struct {
	ID             string         `json:"id"`
	Balances       []Balance      `json:"balances"`
	InclusionState InclusionState `json:"inclusion_state"`
	Metadata       Metadata       `json:"output_metadata"`
}

OutputID holds the output id and its inclusion state

type SendTransactionByJSONRequest added in v0.3.0

type SendTransactionByJSONRequest struct {
	Inputs        []string      `json:"inputs"`
	Outputs       []Output      `json:"outputs"`
	AManaPledgeID string        `json:"a_mana_pledg"`
	CManaPledgeID string        `json:"c_mana_pledg"`
	Signatures    []UnlockBlock `json:"signatures"`
	Payload       []byte        `json:"payload"`
}

SendTransactionByJSONRequest holds the transaction object(json) to send. e.g.,

{
	"inputs": string[],
 "a_mana_pledge": string,
 "c_mana_pledg": string,
	"outputs": {
	   "type": number,
	   "address": string,
	   "balances": {
		   "value": number,
		   "color": string
	   }[];
	 }[],
	 "signature": []string
 }

type SendTransactionByJSONResponse added in v0.3.0

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

SendTransactionByJSONResponse is the HTTP response from sending transaction.

type SendTransactionRequest added in v0.3.0

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

SendTransactionRequest holds the transaction object(bytes) to send.

type SendTransactionResponse added in v0.3.0

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

SendTransactionResponse is the HTTP response from sending transaction.

type Transaction added in v0.3.0

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 holds the information of a transaction.

func ParseTransaction added in v0.3.0

func ParseTransaction(tx *ledgerstate.Transaction) (txn Transaction)

ParseTransaction handle transaction json object.

type TransactionMetadata added in v0.4.1

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

TransactionMetadata holds the information of a transaction metadata.

type UnlockBlock added in v0.4.1

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

UnlockBlock defines the struct of a signature.

type UnspentOutput added in v0.3.0

type UnspentOutput struct {
	Address   string     `json:"address"`
	OutputIDs []OutputID `json:"output_ids"`
}

UnspentOutput holds the address and the corresponding unspent output ids

type UnspentOutputsRequest added in v0.3.0

type UnspentOutputsRequest struct {
	Addresses []string `json:"addresses,omitempty"`
	Error     string   `json:"error,omitempty"`
}

UnspentOutputsRequest holds the addresses to query.

type UnspentOutputsResponse added in v0.3.0

type UnspentOutputsResponse struct {
	UnspentOutputs []UnspentOutput `json:"unspent_outputs,omitempty"`
	Error          string          `json:"error,omitempty"`
}

UnspentOutputsResponse is the HTTP response from retrieving value objects.

type ValueObject added in v0.3.0

type ValueObject struct {
	ID          string      `json:"id"`
	Parents     []string    `json:"parents"`
	Transaction Transaction `json:"transaction"`
}

ValueObject holds the information of a value object.

Jump to

Keyboard shortcuts

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