value

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentsResponse

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

AttachmentsResponse is the HTTP response from retrieving value objects.

type Balance

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

Balance holds the value and the color of token

type GetTransactionByIDResponse

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

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

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

Input holds the consumedOutputID

type Metadata

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

Metadata holds metadata about the output.

type Output

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

Output consists an address and balances

type OutputID

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

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

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

SendTransactionByJSONResponse is the HTTP response from sending transaction.

type SendTransactionRequest

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

SendTransactionRequest holds the transaction object(bytes) to send.

type SendTransactionResponse

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

SendTransactionResponse is the HTTP response from sending transaction.

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

func ParseTransaction

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

ParseTransaction handle transaction json object.

type TransactionMetadata

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

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

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

UnspentOutput holds the address and the corresponding unspent output ids

type UnspentOutputsRequest

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

UnspentOutputsRequest holds the addresses to query.

type UnspentOutputsResponse

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

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