Documentation ¶
Index ¶
- Constants
- Variables
- func NewTransactionFromJSON(request SendTransactionByJSONRequest) (*transaction.Transaction, error)
- func Plugin() *node.Plugin
- type AttachmentsResponse
- type Balance
- type GetTransactionByIDResponse
- type InclusionState
- type Output
- type OutputID
- type SendTransactionByJSONRequest
- type SendTransactionByJSONResponse
- type SendTransactionRequest
- type SendTransactionResponse
- type Signature
- type Transaction
- 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 ( // 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") )
Functions ¶
func NewTransactionFromJSON ¶ added in v0.3.0
func NewTransactionFromJSON(request SendTransactionByJSONRequest) (*transaction.Transaction, error)
NewTransactionFromJSON returns a new transaction from a given JSON request or an error.
Types ¶
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 { Transaction Transaction `json:"transaction,omitempty"` InclusionState InclusionState `json:"inclusion_state,omitempty"` 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 OutputID ¶ added in v0.3.0
type OutputID struct { ID string `json:"id"` Balances []Balance `json:"balances"` InclusionState InclusionState `json:"inclusion_state"` }
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"` Data []byte `json:"data,omitempty"` Signatures []Signature `json:"signatures"` }
SendTransactionByJSONRequest holds the transaction object(json) to send. e.g.,
{ "inputs": string[], "outputs": { "address": string, "balances": { "value": number, "color": string }[]; }[], "data": []byte, "signatures": { "version": number, "publicKey": 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 Signature ¶ added in v0.3.0
type Signature struct { Version byte `json:"version"` PublicKey string `json:"publicKey"` Signature string `json:"signature"` }
Signature defines the struct of a signature.
type Transaction ¶ added in v0.3.0
type Transaction struct { Inputs []string `json:"inputs"` Outputs []Output `json:"outputs"` Signature []byte `json:"signature"` DataPayload []byte `json:"data_payload"` }
Transaction holds the information of a transaction.
func ParseTransaction ¶ added in v0.3.0
func ParseTransaction(t *transaction.Transaction) (txn Transaction)
ParseTransaction handle transaction json object.
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"` Parent1ID string `json:"parent1_id"` Parent2ID string `json:"parent2_id"` Transaction Transaction `json:"transaction"` }
ValueObject holds the information of a value object.