Documentation ¶
Index ¶
- Constants
- Variables
- func NewTransactionFromJSON(request SendTransactionByJSONRequest) (*ledgerstate.Transaction, error)
- func Plugin() *node.Plugin
- type AllowedManaPledgeResponse
- type AllowedPledge
- type AttachmentsResponse
- type Balance
- type GetTransactionByIDResponse
- type InclusionState
- type Input
- type Metadata
- type Output
- type OutputID
- type SendTransactionByJSONRequest
- type SendTransactionByJSONResponse
- type SendTransactionRequest
- type SendTransactionResponse
- type Transaction
- type TransactionMetadata
- type UnlockBlock
- type UnspentOutput
- type UnspentOutputsRequest
- type UnspentOutputsResponse
- type ValueObject
Constants ¶
const PluginName = "WebAPI Value Endpoint"
PluginName is the name of the web API DRNG endpoint plugin.
Variables ¶
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") )
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.
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 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 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.