og

package
v0.0.0-...-c772d2a Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownChain

func DownChain()

func GetHashes

func GetHashes(url string) []string

获取该高度的交易hash

func Http

func Http() int

获取最新高度

func HttpHash

func HttpHash(url string) string

获取交易内容

func Normalize

func Normalize(data string) string

This function expects that the json is well-formed.

Types

type Archive

type Archive struct {
	Height       int      `json:"hieght"`
	Type         int      `json:"type"`
	TxHash       string   `json:"tx_hash"`
	OpHash       string   `json:"op_hash"`
	PublicKey    string   `json:"public_key"`
	Signature    string   `json:"signature"`
	Parents      []string `json:"parents"`
	AccountNonce int      `json:"account_nonce"`
	MindNonce    int      `json:"mind_nonce"`
	Weight       int      `json:"weight"`
	Data         string   `json:"data"`
}

type Archives

type Archives []Archive

func ToStruct

func ToStruct(str string) Archives

type ByHash

type ByHash struct {
	Archives
}

func (ByHash) Len

func (s ByHash) Len() int

func (ByHash) Less

func (s ByHash) Less(i, j int) bool

func (ByHash) Swap

func (s ByHash) Swap(i, j int)

type OgArchiveResponse

type OgArchiveResponse struct {
	// TODO: you need to fix the response structure.
	Message string
	Data    interface{}
}

type OgClient

type OgClient struct {
	Config OgClientConfig
	// contains filtered or unexported fields
}

func NewOgClient

func NewOgClient(config OgClientConfig) *OgClient

func (*OgClient) ConsumeQueue

func (o *OgClient) ConsumeQueue()

func (*OgClient) EnqueueSendToLedger

func (o *OgClient) EnqueueSendToLedger(command *core_interface.BlockDBMessage) error

func (*OgClient) InitDefault

func (m *OgClient) InitDefault()

func (*OgClient) Name

func (m *OgClient) Name() string

func (*OgClient) Start

func (m *OgClient) Start()

func (*OgClient) Stop

func (m *OgClient) Stop()

type OgClientConfig

type OgClientConfig struct {
	LedgerUrl  string
	RetryTimes int
}

type Op

type Op struct {
	Order      int    `json:"order"`
	Height     int    `json:"height"`
	IsExecuted bool   `json:"is_executed"`
	TxHash     string `json:"tx_hash"`
	OpHash     string `json:"op_hash"`
	PublicKey  string `json:"public_key"`
	Signature  string `json:"signature"`
	OpStr      string `json:"op_str"`
}

type Result

type Result struct {
	// Type is the json type
	Type Type
	// Raw is the raw json
	Raw string
	// Str is the json string
	Str string
	// Num is the json number
	Num float64
	// Index of raw value in original json, zero means index unknown
	Index int
}

Result represents a json value that is returned from Get().

func Parse

func Parse(json string) Result

Parse parses the json and returns a result.

This function expects that the json is well-formed, and does not validate. Invalid json will not panic, but it may return back unexpected results. If you are consuming JSON from an unpredictable source then you may want to use the Valid function first.

func (Result) Value

func (t Result) Value() interface{}

Value returns one of these types:

bool, for JSON booleans
float64, for JSON numbers
Number, for JSON numbers
string, for JSON string literals
nil, for JSON null
map[string]interface{}, for JSON objects
[]interface{}, for JSON arrays

type TxReq

type TxReq struct {
	Data []byte `json:"data"`
}

type Type

type Type int

Type is Result type

const (
	// Null is a null json value
	Null Type = iota
	// False is a json false boolean
	False
	// Number is json number
	Number
	// String is a json string
	String
	// True is a json true boolean
	True
	// JSON is a raw block of JSON
	JSON
)

Jump to

Keyboard shortcuts

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