sendtransactionbyjson

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0, BSD-2-Clause Imports: 15 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

This section is empty.

Variables

View Source
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 Handler

func Handler(c echo.Context) error

Handler sends a transaction.

func NewTransactionFromJSON

func NewTransactionFromJSON(request Request) (*transaction.Transaction, error)

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

Types

type Output

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

Output defines the struct of an output.

type Request

type Request struct {
	Inputs     []string    `json:"inputs"`
	Outputs    []Output    `json:"outputs"`
	Data       []byte      `json:"data,omitempty"`
	Signatures []Signature `json:"signatures"`
}

Request 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 Response

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

Response is the HTTP response from sending transaction.

type Signature

type Signature struct {
	Version   byte   `json:"version"`
	PublicKey string `json:"publicKey"`
	Signature string `json:"signature"`
}

Signature defines the struct of a signature.

Jump to

Keyboard shortcuts

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