Documentation ¶
Overview ¶
* Copyright (c) 2018 - 2019. The Inn4Science Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- type Block
- type BlocksResponse
- type ExplorerApi
- type ExplorerApiError
- type FullBlock
- type FullTx
- type HealthCheck
- type Message
- type Schema
- type ServiceInfo
- type ServiceList
- type ServiceTx
- func (ServiceTx) DecodeSignedTx(rawTx string, schema Schema) (ServiceTx, error)
- func (ServiceTx) DecodeSignedWSchemaProvider(rawTx string, provider func(uint16, uint16) (Schema, error)) (ServiceTx, error)
- func (tx ServiceTx) Hash() (crypto.Hash, error)
- func (tx *ServiceTx) IntoSignedTx(key crypto.SecretKey) (string, error)
- func (ServiceTx) New(schema Schema, author crypto.PublicKey, serviceID uint16, messageID uint16) ServiceTx
- func (tx *ServiceTx) Serialize() ([]byte, error)
- func (tx *ServiceTx) Sign(key crypto.SecretKey) (crypto.Signature, error)
- type Stats
- type TxHashInfo
- type TxResult
- type URL
Constants ¶
const ( TransactionClass = 0 TransactionType = 0 PreCommitClass = 1 PreCommitType = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlocksResponse ¶
type ExplorerApi ¶
type ExplorerApi interface { New(baseURL URL) ExplorerApi SetURL(url URL) ExplorerApi SetHeader(header string, value string) ExplorerApi SystemPath(prefix string) *URL ExplorerPath(prefix string) *URL ServicePath(serviceName, prefix string) *URL Stats() (*Stats, ExplorerApiError) Services() (*ServiceList, ExplorerApiError) HealthCheck() (*HealthCheck, ExplorerApiError) GetBlocks(count uint32, latest uint64, skipEmptyBlocks bool, addTime bool) (*BlocksResponse, ExplorerApiError) GetBlock(height uint64) (*FullBlock, ExplorerApiError) LastBlock() (*FullBlock, ExplorerApiError) GetTx(hash crypto.Hash) (*FullTx, ExplorerApiError) SubmitTx(signedTx string) (*TxResult, ExplorerApiError) GetJSON(fullURL string, dest interface{}) ExplorerApiError PostJSON(fullURL string, body []byte, dest interface{}) ExplorerApiError }
func NewExplorerApi ¶
func NewExplorerApi(baseURL URL) ExplorerApi
type ExplorerApiError ¶ added in v0.5.1
type ExplorerApiError interface { Error() string StatusCode() int Wrap(err error) ExplorerApiError Unwrap() error AsError() error }
func NewError ¶ added in v0.5.1
func NewError(msg string, statusCode int) ExplorerApiError
func WrapError ¶ added in v0.5.1
func WrapError(err error) ExplorerApiError
type FullBlock ¶ added in v0.6.0
type FullBlock struct { Block PreCommits []string `json:"precommits"` Txs []TxHashInfo `json:"txs"` Time time.Time `json:"time"` }
type FullTx ¶
type FullTx struct { Type string `json:"type"` Content struct { Debug json.RawMessage `json:"debug"` Message string `json:"message"` } `json:"content"` Location struct { BlockHeight int `json:"block_height"` PositionInBlock int `json:"position_in_block"` } `json:"location"` LocationProof struct { Val string `json:"val"` } `json:"location_proof"` Status struct { Type string `json:"type"` Code int `json:"code"` Description string `json:"description"` } `json:"status"` }
type HealthCheck ¶ added in v0.6.0
type ServiceInfo ¶ added in v0.6.0
type ServiceList ¶ added in v0.6.0
type ServiceList struct {
Services []ServiceInfo `json:"services"`
}
type ServiceTx ¶
type ServiceTx struct { Message ServiceID uint16 `json:"service_id"` MessageID uint16 `json:"message_id"` Signature crypto.Signature `json:"signature"` // contains filtered or unexported fields }
func (ServiceTx) DecodeSignedTx ¶ added in v0.5.2
func (ServiceTx) DecodeSignedWSchemaProvider ¶ added in v0.6.1
func (ServiceTx) DecodeSignedWSchemaProvider(rawTx string, provider func(uint16, uint16) (Schema, error)) (ServiceTx, error)
DecodeSignedWSchemaProvider ... SchemaProvider should return Schema implementation based on serviceID and messageID.
func (*ServiceTx) IntoSignedTx ¶
IntoSignedTx signs serialized `ServiceTx` with passed key, attach signature and encode to hex.