service

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 18 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func FromReversedString

func FromReversedString(reversed string) ([]byte, error)

func GetPayload

func GetPayload(pInfo PayloadInfo) (types.Payload, error)

func GetStringArray

func GetStringArray(param util.Params, key string) ([]string, bool)

func GetTransaction

func GetTransaction(cfg *Config, txInfo *TransactionInfo) (*types.Transaction, error)

func ToReversedString

func ToReversedString(hash common.Uint256) string

func Unmarshal

func Unmarshal(result interface{}, target interface{}) error

func UseLogger

func UseLogger(logger elalog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using elalog.

Types

type ArbitratorGroupInfo

type ArbitratorGroupInfo struct {
	OnDutyArbitratorIndex int
	Arbitrators           []string
}

type AssetInfo

type AssetInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Precision   int    `json:"precision"`
	AssetType   int    `json:"assettype"`
	RecordType  int    `jso:"recordtype"`
}

type AttributeInfo

type AttributeInfo struct {
	Usage AttributeUsage `json:"usage"`
	Data  string         `json:"data"`
}

type BlockInfo

type BlockInfo struct {
	Hash              string        `json:"hash"`
	Confirmations     uint32        `json:"confirmations"`
	StrippedSize      uint32        `json:"strippedsize"`
	Size              uint32        `json:"size"`
	Weight            uint32        `json:"weight"`
	Height            uint32        `json:"height"`
	Version           uint32        `json:"version"`
	VersionHex        string        `json:"versionhex"`
	MerkleRoot        string        `json:"merkleroot"`
	Tx                []interface{} `json:"tx"`
	Time              uint32        `json:"time"`
	MedianTime        uint32        `json:"mediantime"`
	Nonce             uint32        `json:"nonce"`
	Bits              uint32        `json:"bits"`
	Difficulty        string        `json:"difficulty"`
	ChainWork         string        `json:"chainwork"`
	PreviousBlockHash string        `json:"previousblockhash"`
	NextBlockHash     string        `json:"nextblockhash"`
	AuxPow            string        `json:"auxpow"`
	MinerInfo         string        `json:"minerinfo"`
}

func GetBlockInfo

func GetBlockInfo(cfg *Config, block *types.Block, verbose bool) BlockInfo

type CoinbaseInfo

type CoinbaseInfo struct {
	CoinbaseData string
}

type Config

type Config struct {
	Server         server.Server
	Chain          *blockchain.BlockChain
	Store          *blockchain.ChainStore
	GenesisAddress string
	TxMemPool      *mempool.TxPool
	PowService     *pow.Service
	SpvService     *spv.Service
	SetLogLevel    func(level elalog.Level)

	GetBlockInfo                func(cfg *Config, block *types.Block, verbose bool) BlockInfo
	GetTransactionInfo          func(cfg *Config, header *types.Header, tx *types.Transaction) *TransactionInfo
	GetTransactionInfoFromBytes func(txInfoBytes []byte) (*TransactionInfo, error)
	GetTransaction              func(cfg *Config, txInfo *TransactionInfo) (*types.Transaction, error)
	GetPayloadInfo              func(p types.Payload, pVersion byte) PayloadInfo
	GetPayload                  func(pInfo PayloadInfo) (types.Payload, error)
}

type CrossChainAssetInfo

type CrossChainAssetInfo struct {
	CrossChainAddress string `json:"crosschainaddress"`
	OutputIndex       uint64 `json:"outputindex"`
	CrossChainAmount  string `json:"crosschainamount"`
}

type ErrorCode

type ErrorCode int
const (
	InvalidParams      ErrorCode = 42002
	InvalidTransaction ErrorCode = 43001
	InvalidAsset       ErrorCode = 43002
	UnknownTransaction ErrorCode = 44001
	UnknownAsset       ErrorCode = 44002
	UnknownBlock       ErrorCode = 44003
	InternalError      ErrorCode = 45002
)

func (ErrorCode) String

func (e ErrorCode) String() string

String returns the ErrorCode as a human-readable name.

type HttpService

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

func NewHttpService

func NewHttpService(cfg *Config) *HttpService

func (*HttpService) CreateAuxBlock

func (s *HttpService) CreateAuxBlock(param util.Params) (interface{}, error)

func (*HttpService) DiscreteMining

func (s *HttpService) DiscreteMining(param util.Params) (interface{}, error)

func (*HttpService) GetAssetByHash

func (s *HttpService) GetAssetByHash(param util.Params) (interface{}, error)

Asset

func (*HttpService) GetAssetList

func (s *HttpService) GetAssetList(params util.Params) (interface{}, error)

func (*HttpService) GetBalanceByAddr

func (s *HttpService) GetBalanceByAddr(param util.Params) (interface{}, error)

func (*HttpService) GetBalanceByAsset

func (s *HttpService) GetBalanceByAsset(param util.Params) (interface{}, error)

func (*HttpService) GetBestBlockHash

func (s *HttpService) GetBestBlockHash(param util.Params) (interface{}, error)

func (*HttpService) GetBlockByHash

func (s *HttpService) GetBlockByHash(param util.Params) (interface{}, error)

func (*HttpService) GetBlockByHeight

func (s *HttpService) GetBlockByHeight(param util.Params) (interface{}, error)

func (*HttpService) GetBlockCount

func (s *HttpService) GetBlockCount(param util.Params) (interface{}, error)

func (*HttpService) GetBlockHash

func (s *HttpService) GetBlockHash(param util.Params) (interface{}, error)

func (*HttpService) GetBlockHeight

func (s *HttpService) GetBlockHeight(param util.Params) (interface{}, error)

func (*HttpService) GetConnectionCount

func (s *HttpService) GetConnectionCount(param util.Params) (interface{}, error)

func (*HttpService) GetExistDepositTransactions

func (s *HttpService) GetExistDepositTransactions(param util.Params) (interface{}, error)

func (*HttpService) GetNeighbors

func (s *HttpService) GetNeighbors(param util.Params) (interface{}, error)

func (*HttpService) GetNodeState

func (s *HttpService) GetNodeState(param util.Params) (interface{}, error)

func (*HttpService) GetRawTransaction

func (s *HttpService) GetRawTransaction(param util.Params) (interface{}, error)

Input JSON string examples for getblock method as following:

func (*HttpService) GetReceivedByAddress

func (s *HttpService) GetReceivedByAddress(param util.Params) (interface{}, error)

func (*HttpService) GetTransactionByHash

func (s *HttpService) GetTransactionByHash(param util.Params) (interface{}, error)

Transaction

func (*HttpService) GetTransactionPool

func (s *HttpService) GetTransactionPool(param util.Params) (interface{}, error)

func (*HttpService) GetTransactionsByHeight

func (s *HttpService) GetTransactionsByHeight(param util.Params) (interface{}, error)

func (*HttpService) GetUnspendsByAddr

func (s *HttpService) GetUnspendsByAddr(param util.Params) (interface{}, error)

func (*HttpService) GetUnspendsByAsset

func (s *HttpService) GetUnspendsByAsset(param util.Params) (interface{}, error)

func (*HttpService) GetWithdrawTransactionByHash

func (s *HttpService) GetWithdrawTransactionByHash(param util.Params) (interface{}, error)

func (*HttpService) GetWithdrawTransactionsByHeight

func (s *HttpService) GetWithdrawTransactionsByHeight(param util.Params) (interface{}, error)

func (*HttpService) SendRawTransaction

func (s *HttpService) SendRawTransaction(param util.Params) (interface{}, error)

func (*HttpService) SendRechargeToSideChainTxByHash

func (s *HttpService) SendRechargeToSideChainTxByHash(param util.Params) (interface{}, error)

func (*HttpService) SetLogLevel

func (s *HttpService) SetLogLevel(param util.Params) (interface{}, error)

func (*HttpService) SubmitAuxBlock

func (s *HttpService) SubmitAuxBlock(param util.Params) (interface{}, error)

func (*HttpService) ToggleMining

func (s *HttpService) ToggleMining(param util.Params) (interface{}, error)

type InputInfo

type InputInfo struct {
	TxID     string `json:"txid"`
	VOut     uint16 `json:"vout"`
	Sequence uint32 `json:"sequence"`
}

type OutputInfo

type OutputInfo struct {
	Value      string `json:"value"`
	Index      uint32 `json:"n"`
	Address    string `json:"address"`
	AssetID    string `json:"assetid"`
	OutputLock uint32 `json:"outputlock"`
}

type PayloadInfo

type PayloadInfo interface{}

func GetPayloadInfo

func GetPayloadInfo(p types.Payload, pVersion byte) PayloadInfo

type ProgramInfo

type ProgramInfo struct {
	Code      string `json:"code"`
	Parameter string `json:"parameter"`
}

type RechargeToSideChainAsset

type RechargeToSideChainAsset struct {
	TargetAddress    string
	Amount           *common.Fixed64
	CrossChainAmount *common.Fixed64
}

type RechargeToSideChainInfo

type RechargeToSideChainInfo struct {
	MainChainTransactionHash *common.Uint256
	DepositAssets            []*RechargeToSideChainAsset
}

type RechargeToSideChainInfoV0

type RechargeToSideChainInfoV0 struct {
	Proof                string
	MainChainTransaction string
}

type RechargeToSideChainInfoV1

type RechargeToSideChainInfoV1 struct {
	MainChainTransactionHash string `json:"mainchaintxhash"`
}

type RegisterAssetInfo

type RegisterAssetInfo struct {
	Asset      Asset
	Amount     string
	Controller string
}

type SideChainPowInfo

type SideChainPowInfo struct {
	BlockHeight     uint32
	SideBlockHash   string
	SideGenesisHash string
	SignedData      string
}

type TransactionInfo

type TransactionInfo struct {
	TxId           string          `json:"txid"`
	Hash           string          `json:"hash"`
	Size           uint32          `json:"size"`
	VSize          uint32          `json:"vsize"`
	Version        uint32          `json:"version"`
	LockTime       uint32          `json:"locktime"`
	Inputs         []InputInfo     `json:"vin"`
	Outputs        []OutputInfo    `json:"vout"`
	BlockHash      string          `json:"blockhash"`
	Confirmations  uint32          `json:"confirmations"`
	Time           uint32          `json:"time"`
	BlockTime      uint32          `json:"blocktime"`
	TxType         TxType          `json:"type"`
	PayloadVersion byte            `json:"payloadversion"`
	Payload        PayloadInfo     `json:"payload"`
	Attributes     []AttributeInfo `json:"attributes"`
	Programs       []ProgramInfo   `json:"programs"`
}

func GetTransactionInfo

func GetTransactionInfo(cfg *Config, header *types.Header, tx *types.Transaction) *TransactionInfo

func GetTransactionInfoFromBytes

func GetTransactionInfoFromBytes(txInfoBytes []byte) (*TransactionInfo, error)

type TransferCrossChainAssetInfo

type TransferCrossChainAssetInfo struct {
	CrossChainAssets []CrossChainAssetInfo `json:"crosschainassets"`
}

type WithdrawOutputInfo

type WithdrawOutputInfo struct {
	CrossChainAddress string `json:"crosschainaddress"`
	CrossChainAmount  string `json:"crosschainamount"`
	OutputAmount      string `json:"outputamount"`
}

type WithdrawTxInfo

type WithdrawTxInfo struct {
	TxID             string                `json:"txid"`
	CrossChainAssets []*WithdrawOutputInfo `json:"crosschainassets"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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