service

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 21 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRPCServiceLevel added in v0.2.0

func CheckRPCServiceLevel(configurationPermitted string, level config.RPCServiceLevel) interface{}

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 http.Params, key string) ([]string, bool)

func GetTransaction

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

func RPCServiceLevelFromString added in v0.2.0

func RPCServiceLevelFromString(str string) config.RPCServiceLevel

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 types.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)
	ConfigurationPermitted string

	GetBlockInfo                func(cfg *Config, block *types.Block, verbose bool) BlockInfo
	GetTransactionInfo          func(cfg *Config, header interfaces.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 (
	InvalidTransaction    ErrorCode = -32000
	ResolverInternalError ErrorCode = -32001
	UnknownTransaction    ErrorCode = -32002
	UnknownAsset          ErrorCode = -32003
	UnknownBlock          ErrorCode = -32004
	InvalidAsset          ErrorCode = -32005
	InvalidRequest        ErrorCode = -32600
	MethodNotFound        ErrorCode = -32601
	InvalidParams         ErrorCode = -32602
	InternalError         ErrorCode = -32603
	InvalidMethod         ErrorCode = -32604
	ParseError            ErrorCode = -32700
)

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) CheckIllegalEvidence added in v0.1.2

func (s *HttpService) CheckIllegalEvidence(param http.Params) (interface{}, error)

func (*HttpService) CreateAuxBlock

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

func (*HttpService) DiscreteMining

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

func (*HttpService) GetAssetByHash

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

Asset

func (*HttpService) GetAssetList

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

func (*HttpService) GetBalanceByAddr

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

func (*HttpService) GetBalanceByAsset

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

func (*HttpService) GetBestBlockHash

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

func (*HttpService) GetBlockByHash

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

func (*HttpService) GetBlockByHeight

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

func (*HttpService) GetBlockCount

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

func (*HttpService) GetBlockHash

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

func (*HttpService) GetBlockHeight

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

func (*HttpService) GetBlockTransactionsDetail added in v0.1.5

func (s *HttpService) GetBlockTransactionsDetail(block *types.Block, filter func(*types.Transaction) bool) []*types.Transaction

func (*HttpService) GetConnectionCount

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

func (*HttpService) GetExistDepositTransactions

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

func (*HttpService) GetIllegalEvidenceByHeight added in v0.1.2

func (s *HttpService) GetIllegalEvidenceByHeight(param http.Params) (interface{}, error)

func (*HttpService) GetNeighbors

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

func (*HttpService) GetRawTransaction

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

Input JSON string examples for getblock method as following:

func (*HttpService) GetReceivedByAddress

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

func (*HttpService) GetTransactionByHash

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

Transaction

func (*HttpService) GetTransactionPool

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

func (*HttpService) GetTransactionsByHeight

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

func (*HttpService) GetUnspendsByAddr

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

func (*HttpService) GetUnspendsByAsset

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

func (*HttpService) GetWithdrawTransactionByHash

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

func (*HttpService) GetWithdrawTransactionsByHeight

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

func (*HttpService) GetWithdrawTxsInfo added in v0.1.5

func (s *HttpService) GetWithdrawTxsInfo(txs []*types.Transaction) interface{}

func (*HttpService) SendRawTransaction

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

func (*HttpService) SendRechargeToSideChainTxByHash

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

func (*HttpService) SetLogLevel

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

func (*HttpService) SubmitAuxBlock

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

func (*HttpService) ToggleMining

func (s *HttpService) ToggleMining(param http.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      types.Asset
	Amount     string
	Controller string
}

type SideChainPowInfo

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

type SidechainIllegalDataInfo added in v0.1.2

type SidechainIllegalDataInfo struct {
	IllegalType     uint8  `json:"illegaltype"`
	Height          uint32 `json:"height"`
	IllegalSigner   string `json:"illegalsigner"`
	Evidence        string `json:"evidence"`
	CompareEvidence string `json:"compareevidence"`
}

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         types.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 interfaces.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"`
	TargetData        string `json:"targetdata"`
}

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