types

package
v1.69.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: BSD-3-Clause Imports: 12 Imported by: 317

Documentation

Overview

Package types rpc相关的一些结构体定义以及转化函数

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertWalletTxDetailToJSON

func ConvertWalletTxDetailToJSON(in *types.WalletTxDetails, out *WalletTxDetails, coinExec string, coinPrecision int64) error

ConvertWalletTxDetailToJSON conver the wallet tx detail to json

Types

type Account

type Account struct {
	Currency int32  `json:"currency"`
	Balance  int64  `json:"balance"`
	Frozen   int64  `json:"frozen"`
	Addr     string `json:"addr"`
}

Account account information

type AllExecBalance

type AllExecBalance struct {
	Addr        string         `json:"addr"`
	ExecAccount []*ExecAccount `json:"execAccount"`
}

AllExecBalance all exec balance

type Asset

type Asset struct {
	Exec   string `json:"exec"`
	Symbol string `json:"symbol"`
	Amount int64  `json:"amount"`
}

Asset asset

type Block

type Block struct {
	Version    int64          `json:"version"`
	ParentHash string         `json:"parentHash"`
	TxHash     string         `json:"txHash"`
	StateHash  string         `json:"stateHash"`
	Height     int64          `json:"height"`
	BlockTime  int64          `json:"blockTime"`
	Txs        []*Transaction `json:"txs"`
	Difficulty uint32         ` json:"difficulty,omitempty"`
	MainHash   string         ` json:"mainHash,omitempty"`
	MainHeight int64          `json:"mainHeight,omitempty"`
	Signature  *Signature     `json:"signature,omitempty"`
}

Block block information

type BlockDetail

type BlockDetail struct {
	Block    *Block               `json:"block"`
	Receipts []*ReceiptDataResult `json:"recipts"`
}

BlockDetail block detail

type BlockDetails

type BlockDetails struct {
	Items []*BlockDetail `json:"items"`
}

BlockDetails block details

type BlockInfo added in v1.65.1

type BlockInfo struct {
	Height int64  `json:"height,omitempty"`
	Hash   string `json:"hash,omitempty"`
}

BlockInfo parameter

type BlockOverview

type BlockOverview struct {
	Head     *Header  `json:"head"`
	TxCount  int64    `json:"txCount"`
	TxHashes []string `json:"txHashes"`
}

BlockOverview block overview

type BlockParam

type BlockParam struct {
	Start    int64 `json:"start"`
	End      int64 `json:"end"`
	Isdetail bool  `json:"isDetail"`
}

BlockParam block parameter

type BlockSeq added in v1.65.1

type BlockSeq struct {
	Num    int64          `json:"num,omitempty"`
	Seq    *BlockSequence `json:"seq,omitempty"`
	Detail *BlockDetail   `json:"detail,omitempty"`
}

BlockSeq parameter

type BlockSequence added in v1.65.1

type BlockSequence struct {
	Hash string `json:"hash,omitempty"`
	Type int64  `json:"type,omitempty"`
}

BlockSequence parameter

type ChainConfigInfo added in v1.65.3

type ChainConfigInfo struct {
	Title            string `json:"title,omitempty"`
	CoinExec         string `json:"coinExec,omitempty"`
	CoinSymbol       string `json:"coinSymbol,omitempty"`
	CoinPrecision    int64  `json:"coinPrecision,omitempty"`
	TokenPrecision   int64  `json:"tokenPrecision,omitempty"`
	ChainID          int32  `json:"chainID,omitempty"`
	MaxTxFee         int64  `json:"maxTxFee,omitempty"`
	MinTxFeeRate     int64  `json:"minTxFeeRate,omitempty"`
	MaxTxFeeRate     int64  `json:"maxTxFeeRate,omitempty"`
	IsPara           bool   `json:"isPara,omitempty"`
	DefaultAddressID int32  `json:"defaultAddressID"`
}

ChainConfigInfo parameter

type ChainExecutor

type ChainExecutor struct {
	Driver    string          `json:"execer"`
	FuncName  string          `json:"funcName"`
	StateHash string          `json:"stateHash"`
	Payload   json.RawMessage `json:"payload"`
}

ChainExecutor chain executor

type ChainIDInfo added in v1.65.3

type ChainIDInfo struct {
	ChainID int32 `json:"chainID"`
}

ChainIDInfo parameter

type ChannelClient

type ChannelClient struct {
	client.QueueProtocolAPI
	// contains filtered or unexported fields
}

ChannelClient interface

func (*ChannelClient) GetCoinsAccountDB

func (c *ChannelClient) GetCoinsAccountDB() *account.DB

GetCoinsAccountDB return accountdb

func (*ChannelClient) Init

func (c *ChannelClient) Init(name string, s RPCServer, jrpc, grpc interface{})

Init init function

type CreateTx

type CreateTx struct {
	To          string `json:"to,omitempty"`
	Amount      int64  `json:"amount,omitempty"`
	Fee         int64  `json:"fee,omitempty"`
	Note        string `json:"note,omitempty"`
	IsWithdraw  bool   `json:"isWithdraw,omitempty"`
	IsToken     bool   `json:"isToken,omitempty"`
	TokenSymbol string `json:"tokenSymbol,omitempty"`
	ExecName    string `json:"execName,omitempty"` //TransferToExec and Withdraw 的执行器
	Execer      string `json:"execer,omitempty"`   //执行器名称
}

CreateTx 为了简化Note 的创建过程,在json rpc 中,note 采用string 格式

type CreateTxIn

type CreateTxIn struct {
	Execer     string          `json:"execer"`
	ActionName string          `json:"actionName"`
	Payload    json.RawMessage `json:"payload"`
}

CreateTxIn create tx input

type ExecAccount

type ExecAccount struct {
	Execer  string   `json:"execer"`
	Account *Account `json:"account"`
}

ExecAccount exec account

type ExecNameParm

type ExecNameParm struct {
	ExecName string `json:"execname"`
}

ExecNameParm exec name parameter

type Header struct {
	Version    int64      `json:"version"`
	ParentHash string     `json:"parentHash"`
	TxHash     string     `json:"txHash"`
	StateHash  string     `json:"stateHash"`
	Height     int64      `json:"height"`
	BlockTime  int64      `json:"blockTime"`
	TxCount    int64      `json:"txCount"`
	Hash       string     `json:"hash"`
	Difficulty uint32     `json:"difficulty"`
	Signature  *Signature `json:"signature,omitempty"`
}

Header header parameter

type Headers

type Headers struct {
	Items []*Header `json:"items"`
}

Headers defines headers rpc command

type NodeNetinfo

type NodeNetinfo struct {
	Externaladdr string `json:"externalAddr"`
	Localaddr    string `json:"localAddr"`
	Service      bool   `json:"service"`
	Outbounds    int32  `json:"outbounds"`
	Inbounds     int32  `json:"inbounds"`
	Routingtable int32  `json:"routingtable"`
	Peerstore    int32  `json:"peerstore"`
	Ratein       string `json:"ratein"`
	Rateout      string `json:"rateout"`
	Ratetotal    string `json:"ratetotal"`
}

NodeNetinfo node net info

type ParaTxDetail added in v1.65.1

type ParaTxDetail struct {
	Type      int64       `json:"type,omitempty"`
	Header    *Header     `json:"header,omitempty"`
	TxDetails []*TxDetail `json:"txDetail,omitempty"`
	ChildHash string      `json:"childHash,omitempty"`
	Index     uint32      `json:"index,omitempty"`
	Proofs    []string    `json:"proofs,omitempty"`
}

ParaTxDetail parameter

type ParaTxDetails added in v1.65.1

type ParaTxDetails struct {
	Items []*ParaTxDetail `json:"paraTxDetail"`
}

ParaTxDetails parameter

type Peer

type Peer struct {
	Addr           string      `json:"addr"`
	Port           int32       `json:"port"`
	Name           string      `json:"name"`
	MempoolSize    int32       `json:"mempoolSize"`
	Self           bool        `json:"self"`
	Header         *Header     `json:"header"`
	Version        string      `json:"version,omitempty"`
	LocalDBVersion string      `json:"localDBVersion,omitempty"`
	StoreDBVersion string      `json:"storeDBVersion,omitempty"`
	RunningTime    string      `json:"runningTime,omitempty"`
	FullNode       bool        `json:"fullNode,omitempty"`
	Blocked        bool        `json:"blocked,omitempty"`
	Finalized      *SnowChoice `json:"finalized"`
}

Peer information

type PeerList

type PeerList struct {
	Peers []*Peer `json:"peers"`
}

PeerList peer list

type Query4Jrpc

type Query4Jrpc struct {
	Execer   string          `json:"execer"`
	FuncName string          `json:"funcName"`
	Payload  json.RawMessage `json:"payload"`
}

Query4Jrpc query jrpc

type QueryParm

type QueryParm struct {
	Hash string `json:"hash"`
}

QueryParm Query parameter

type RPCServer

type RPCServer interface {
	GetQueueClient() queue.Client
	GRPC() *grpc.Server
	JRPC() *rpc.Server
}

RPCServer interface

type RawParm

type RawParm struct {
	Token string `json:"token"`
	Data  string `json:"data"`
}

RawParm defines raw parameter command

type ReWriteRawTx

type ReWriteRawTx struct {
	Tx     string `json:"tx"`
	To     string `json:"to"`
	Fee    int64  `json:"fee"`
	Expire string `json:"expire"`
	Index  int32  `json:"index"`
}

ReWriteRawTx parameter

type ReceiptData

type ReceiptData struct {
	Ty   int32         `json:"ty"`
	Logs []*ReceiptLog `json:"logs"`
}

ReceiptData defines receipt data rpc command

type ReceiptDataResult

type ReceiptDataResult struct {
	Ty     int32               `json:"ty"`
	TyName string              `json:"tyName"`
	Logs   []*ReceiptLogResult `json:"logs"`
}

ReceiptDataResult receipt data result

func DecodeLog

func DecodeLog(execer []byte, rlog *ReceiptData) (*ReceiptDataResult, error)

DecodeLog decode log

type ReceiptLog

type ReceiptLog struct {
	Ty  int32  `json:"ty"`
	Log string `json:"log"`
}

ReceiptLog defines receipt log command

type ReceiptLogResult

type ReceiptLogResult struct {
	Ty     int32           `json:"ty"`
	TyName string          `json:"tyName"`
	Log    json.RawMessage `json:"log"`
	RawLog string          `json:"rawLog"`
}

ReceiptLogResult receipt log result

type Reply

type Reply struct {
	IsOk bool   `json:"isOK"`
	Msg  string `json:"msg"`
}

Reply info

type ReplyBlkSeq

type ReplyBlkSeq struct {
	Hash string `json:"hash"`
	Type int64  `json:"type"`
}

ReplyBlkSeq reply block sequece

type ReplyBlkSeqs

type ReplyBlkSeqs struct {
	BlkSeqInfos []*ReplyBlkSeq `json:"blkseqInfos"`
}

ReplyBlkSeqs reply block sequences

type ReplyCacheTxList

type ReplyCacheTxList struct {
	Txs []*Transaction `json:"txs,omitempty"`
}

ReplyCacheTxList reply cache tx list

type ReplyHash

type ReplyHash struct {
	Hash string `json:"hash"`
}

ReplyHash reply hash string json

type ReplyHashes

type ReplyHashes struct {
	Hashes []string `json:"hashes"`
}

ReplyHashes reply hashes

type ReplyHeightByTitle added in v1.65.1

type ReplyHeightByTitle struct {
	Title string       `json:"title,omitempty"`
	Items []*BlockInfo `json:"items,omitempty"`
}

ReplyHeightByTitle parameter

type ReplyProperFee

type ReplyProperFee struct {
	ProperFee int64 `json:"properFee"`
}

ReplyProperFee reply proper fee

type ReplyTxInfo

type ReplyTxInfo struct {
	Hash   string   `json:"hash"`
	Height int64    `json:"height"`
	Index  int64    `json:"index"`
	Assets []*Asset `json:"assets"`
}

ReplyTxInfo reply tx information

type ReplyTxInfos

type ReplyTxInfos struct {
	TxInfos []*ReplyTxInfo `json:"txInfos"`
}

ReplyTxInfos reply tx infos

type ReplyTxList

type ReplyTxList struct {
	Txs []*Transaction `json:"txs"`
}

ReplyTxList reply tx list

type ReqAddr

type ReqAddr struct {
	Addr string `json:"addr"`
}

ReqAddr require address

type ReqHashes

type ReqHashes struct {
	Hashes        []string `json:"hashes"`
	DisableDetail bool     `json:"disableDetail"`
}

ReqHashes require hashes

type ReqStrings added in v1.65.3

type ReqStrings struct {
	Datas []string `json:"datas"`
}

ReqStrings require strings

type ReqWalletTransactionList

type ReqWalletTransactionList struct {
	FromTx    string `json:"fromTx"`
	Count     int32  `json:"count"`
	Direction int32  `json:"direction"`
}

ReqWalletTransactionList require wallet transaction list

type Signature

type Signature struct {
	Ty        int32  `json:"ty"`
	Pubkey    string `json:"pubkey"`
	Signature string `json:"signature"`
}

Signature parameter

type SignedTx

type SignedTx struct {
	Unsign string `json:"unsignTx"`
	Sign   string `json:"sign"`
	Pubkey string `json:"pubkey"`
	Ty     int32  `json:"ty"`
}

SignedTx signature tx

type SnowChoice added in v1.69.0

type SnowChoice struct {
	Height int64  `json:"height"`
	Hash   string `json:"hash"`
}

SnowChoice snowman finalized choice

type TimeStatus

type TimeStatus struct {
	NtpTime   string `json:"ntpTime"`
	LocalTime string `json:"localTime"`
	Diff      int64  `json:"diff"`
}

TimeStatus time status

type TransParm

type TransParm struct {
	Execer    string     `json:"execer"`
	Payload   string     `json:"payload"`
	Signature *Signature `json:"signature"`
	Fee       int64      `json:"fee"`
}

TransParm transport parameter

type Transaction

type Transaction struct {
	Execer     string          `json:"execer"`
	Payload    json.RawMessage `json:"payload"`
	RawPayload string          `json:"rawPayload"`
	Signature  *Signature      `json:"signature"`
	Fee        int64           `json:"fee"`
	FeeFmt     string          `json:"feefmt"`
	Expire     int64           `json:"expire"`
	Nonce      int64           `json:"nonce"`
	From       string          `json:"from,omitempty"`
	To         string          `json:"to"`
	Amount     int64           `json:"amount,omitempty"`
	AmountFmt  string          `json:"amountfmt,omitempty"`
	GroupCount int32           `json:"groupCount,omitempty"`
	Header     string          `json:"header,omitempty"`
	Next       string          `json:"next,omitempty"`
	Hash       string          `json:"hash,omitempty"`
	ChainID    int32           `json:"chainID,omitempty"`
}

Transaction parameter

func DecodeTx

func DecodeTx(tx *types.Transaction, coinPrecision int64) (*Transaction, error)

DecodeTx docode transaction

type TransactionDetail

type TransactionDetail struct {
	Tx         *Transaction       `json:"tx"`
	Receipt    *ReceiptDataResult `json:"receipt"`
	Proofs     []string           `json:"proofs"`
	Height     int64              `json:"height"`
	Index      int64              `json:"index"`
	Blocktime  int64              `json:"blockTime"`
	Amount     int64              `json:"amount"`
	Fromaddr   string             `json:"fromAddr"`
	ActionName string             `json:"actionName"`
	Assets     []*Asset           `json:"assets"`
	TxProofs   []*TxProof         `json:"txProofs"`
	FullHash   string             `json:"fullHash"`
}

TransactionDetail transaction detail

type TransactionDetails

type TransactionDetails struct {
	//Txs []*Transaction `json:"txs"`
	Txs []*TransactionDetail `json:"txs"`
}

TransactionDetails transaction details

type TxDetail added in v1.65.1

type TxDetail struct {
	Index   uint32       `json:"index,omitempty"`
	Tx      *Transaction `json:"tx,omitempty"`
	Receipt *ReceiptData `json:"receipt,omitempty"`
	Proofs  []string     `json:"proofs,omitempty"`
}

TxDetail parameter

type TxProof

type TxProof struct {
	Proofs   []string `json:"proofs"`
	Index    uint32   `json:"index"`
	RootHash string   `json:"rootHash"`
}

TxProof :

type WalletAccount

type WalletAccount struct {
	Acc   *Account `json:"acc"`
	Label string   `json:"label"`
}

WalletAccount wallet account

type WalletAccounts

type WalletAccounts struct {
	Wallets []*WalletAccount `json:"wallets"`
}

WalletAccounts Wallet Module

type WalletStatus

type WalletStatus struct {
	IsWalletLock bool `json:"isWalletLock"`
	IsAutoMining bool `json:"isAutoMining"`
	IsHasSeed    bool `json:"isHasSeed"`
	IsTicketLock bool `json:"isTicketLock"`
}

WalletStatus wallet status

type WalletTxDetail

type WalletTxDetail struct {
	Tx         *Transaction       `json:"tx"`
	Receipt    *ReceiptDataResult `json:"receipt"`
	Height     int64              `json:"height"`
	Index      int64              `json:"index"`
	BlockTime  int64              `json:"blockTime"`
	Amount     int64              `json:"amount"`
	FromAddr   string             `json:"fromAddr"`
	TxHash     string             `json:"txHash"`
	ActionName string             `json:"actionName"`
}

WalletTxDetail wallet tx detail

type WalletTxDetails

type WalletTxDetails struct {
	TxDetails []*WalletTxDetail `json:"txDetails"`
}

WalletTxDetails wallet tx details

Jump to

Keyboard shortcuts

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