api

package
v0.0.0-...-8e17a21 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEcosystemNotFound = errors.New("Ecosystem not found")
)

Functions

func SendRawRequest

func SendRawRequest(rtype, url, auth string, form *url.Values) ([]byte, error)

func SendRequest

func SendRequest(rtype, url, auth string, form *url.Values, v interface{}) error

func WithCors

func WithCors(h http.Handler) http.Handler

Types

type BlockDetailedInfo

type BlockDetailedInfo struct {
	Header        BlockHeaderInfo  `json:"header"`
	Hash          []byte           `json:"hash"`
	EcosystemID   int64            `json:"-"`
	NodePosition  int64            `json:"node_position"`
	KeyID         int64            `json:"key_id"`
	Time          int64            `json:"time"`
	Tx            int32            `json:"tx_count"`
	RollbacksHash []byte           `json:"rollbacks_hash"`
	MrklRoot      []byte           `json:"mrkl_root"`
	BinData       []byte           `json:"bin_data"`
	SysUpdate     bool             `json:"-"`
	GenBlock      bool             `json:"-"`
	StopCount     int              `json:"stop_count"`
	Transactions  []TxDetailedInfo `json:"transactions"`
}

type BlockHeaderInfo

type BlockHeaderInfo struct {
	BlockID      int64  `json:"block_id"`
	Time         int64  `json:"time"`
	EcosystemID  int64  `json:"-"`
	KeyID        int64  `json:"key_id"`
	NodePosition int64  `json:"node_position"`
	Sign         []byte `json:"-"`
	Hash         []byte `json:"-"`
	Version      int    `json:"version"`
}

type Client

type Client struct {
	KeyID         int64
	AccountID     string
	EcosystemID   int64
	EcosystemName string
	RoleID        int64
	IsMobile      bool
}

Client represents data of client

func (*Client) Prefix

func (c *Client) Prefix() string

type Connect

type Connect struct {
	Auth       string
	Root       string
	PrivateKey []byte
	PublicKey  string
}

func (*Connect) Login

func (connect *Connect) Login() error

func (*Connect) PostTxResult

func (connect *Connect) PostTxResult(name string, form *url.Values) (id int64, msg string, err error)

func (*Connect) SendGet

func (connect *Connect) SendGet(url string, form *url.Values, v interface{}) error

func (*Connect) SendMultipart

func (connect *Connect) SendMultipart(url string, files map[string][]byte, v interface{}) error

func (*Connect) SendPost

func (connect *Connect) SendPost(url string, form *url.Values, v interface{}) error

func (*Connect) WaitTx

func (connect *Connect) WaitTx(hash string) (int64, error)

func (*Connect) WaitTxList

func (connect *Connect) WaitTxList(hashes []string) (map[string]WaitResult, error)

type FullNodeJSON

type FullNodeJSON struct {
	TCPAddress string `json:"tcp_address"`
	APIAddress string `json:"api_address"`
	KeyID      string `json:"key_id"`
	PublicKey  string `json:"public_key"`
	UnbanTime  string `json:"unban_time,er"`
	Stopped    bool   `json:"stopped"`
}

func GetNodesJSON

func GetNodesJSON() []FullNodeJSON

type JWTClaims

type JWTClaims struct {
	UID         string `json:"uid,omitempty"`
	EcosystemID string `json:"ecosystem_id,omitempty"`
	KeyID       string `json:"key_id,omitempty"`
	AccountID   string `json:"account_id,omitempty"`
	RoleID      string `json:"role_id,omitempty"`
	IsMobile    bool   `json:"is_mobile,omitempty"`
	jwt.StandardClaims
}

JWTClaims is storing jwt claims

type Mode

type Mode struct {
	EcosysIDValidator  types.EcosystemIDValidator
	EcosysNameGetter   types.EcosystemNameGetter
	EcosysLookupGetter types.EcosystemLookupGetter
	ContractRunner     types.SmartContractRunner
	ClientTxProcessor  types.ClientTxPreprocessor
}

func (Mode) GetAppParamHandler

func (m Mode) GetAppParamHandler(w http.ResponseWriter, r *http.Request)

func (Mode) SetBlockchainRoutes

func (m Mode) SetBlockchainRoutes(r Router)

func (Mode) SetCommonRoutes

func (m Mode) SetCommonRoutes(r Router)

Route sets routing pathes

type NetworkResult

type NetworkResult struct {
	NetworkID     string         `json:"network_id"`
	CentrifugoURL string         `json:"centrifugo_url"`
	Test          bool           `json:"test"`
	FullNodes     []FullNodeJSON `json:"full_nodes"`
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(m Mode) Router

func (Router) GetAPI

func (r Router) GetAPI() *mux.Router

func (Router) GetAPIVersion

func (r Router) GetAPIVersion(preffix string) *mux.Router

func (Router) NewVersion

func (r Router) NewVersion(preffix string) *mux.Router

type TableName

type TableName struct {
	// contains filtered or unexported fields
}

func ToTableName

func ToTableName(full string) (tableName TableName, err error)

type TxDetailedInfo

type TxDetailedInfo struct {
	Hash         []byte                 `json:"hash"`
	ContractName string                 `json:"contract_name"`
	Params       map[string]interface{} `json:"params"`
	KeyID        int64                  `json:"key_id"`
	Time         int64                  `json:"time"`
	Type         int64                  `json:"type"`
}

type TxInfo

type TxInfo struct {
	Hash         []byte                 `json:"hash"`
	ContractName string                 `json:"contract_name"`
	Params       map[string]interface{} `json:"params"`
	KeyID        int64                  `json:"key_id"`
}

type WaitResult

type WaitResult struct {
	BlockID int64
	Msg     string
}

Jump to

Keyboard shortcuts

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