jsonrpc

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

  • Copyright (c) IBAX. All rights reserved.
  • See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------

Index

Constants

View Source
const (
	ErrCodeDefault             = -32000
	ErrCodeInvalidInput        = -32001
	ErrCodeResourceNotFound    = -32002
	ErrCodeResourceUnavailable = -32003
	ErrCodeTransactionRejected = -32004
	ErrCodeMethodNotSupported  = -32005
	ErrCodeLimitExceeded       = -32006
	ErrCodeParseError          = -32007
	ErrCodeInvalidRequest      = -32008
	ErrCodeMethodNotFound      = -32009
	ErrCodeInvalidParams       = -32010
	ErrCodeInternalError       = -32011
	ErrCodeNotFound            = -32012
	ErrCodeUnknownUID          = -32013
	ErrCodeUnauthorized        = -32014
	ErrCodeParamsInvalid       = -32015
)
View Source
const (
	NamespaceDebug space = "debug"

	NamespaceIBAX  space = "ibax"
	NamespaceAdmin space = "admin"
	NamespaceNet   space = "net"
)
View Source
const JsonRPCVersion = "2.0"

Variables

This section is empty.

Functions

func ContextRequestTimeout

func ContextRequestTimeout(ctx context.Context) (time.Duration, bool)

func GetNamespace

func GetNamespace(name space) string

func GetStructValue

func GetStructValue(structObject any) reflect.Value

func InitJwtSecret

func InitJwtSecret(secret []byte)

func NewAccountsApi

func NewAccountsApi(m Mode) *accountsApi

func NewAuthApi

func NewAuthApi(mode Mode) *authApi

func NewBlockChainApi

func NewBlockChainApi() *blockChainApi

func NewCommonApi

func NewCommonApi(m Mode) *commonApi

func NewDataApi

func NewDataApi() *dataApi

func NewMiddlewares

func NewMiddlewares(srv http.Handler, m Mode) http.Handler

func NewNetworkApi

func NewNetworkApi() *networkApi

func NewTransactionApi

func NewTransactionApi() *transactionApi

func RequestHandlerFunc

func RequestHandlerFunc(fn requestHandlerFunc) *requestHandlerFunc

RequestHandlerFunc is a helper for handling JSONRPC Requests over HTTP It can be used by microservices to handle JSONRPC methods. For example:

http.Handle("/", RequestHandlerFunc(func(ctx context.Context, r *Request) (interface{}, *Error) {
		if r.Method != "eth_blockNumber" {
			return nil, MethodNotSupported(fmt.Sprintf("unsupported method %s", r.Method))
		}

		return "0x123456", nil
	}))

func WriteBatchResponse

func WriteBatchResponse(w http.ResponseWriter, resp any)

func WriteResponse

func WriteResponse(w http.ResponseWriter, request *Request, result any, e *Error)

Types

type AccountOrKeyId

type AccountOrKeyId struct {
	KeyId   int64  `json:"key_id,omitempty"`
	Account string `json:"account,omitempty"`
}

func (*AccountOrKeyId) UnmarshalJSON

func (bh *AccountOrKeyId) UnmarshalJSON(data []byte) error

UnmarshalJSON verify input, keyId is preferred

func (*AccountOrKeyId) Validate

func (bh *AccountOrKeyId) Validate(r *http.Request) error

type AppContentResult

type AppContentResult struct {
	Snippets  []sqldb.Snippet  `json:"snippets"`
	Pages     []sqldb.Page     `json:"pages"`
	Contracts []sqldb.Contract `json:"contracts"`
}

type AppParamsForm

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

func (*AppParamsForm) AcceptNames

func (f *AppParamsForm) AcceptNames(names string)

func (*AppParamsForm) Validate

func (f *AppParamsForm) Validate(r *http.Request) error

type AppParamsResult

type AppParamsResult struct {
	App  int64         `json:"app_id"`
	List []ParamResult `json:"list"`
}

type Auth

type Auth struct {
	Mode
}

type AuthStatusResponse

type AuthStatusResponse struct {
	IsActive  bool  `json:"active"`
	ExpiresAt int64 `json:"exp,omitempty"`
}

type BalanceResult

type BalanceResult struct {
	Amount      string `json:"amount"`
	Digits      int64  `json:"digits"`
	Total       string `json:"total"`
	Utxo        string `json:"utxo"`
	TokenSymbol string `json:"token_symbol"`
}

type BatchRequest

type BatchRequest []*Request

type BatchResponse

type BatchResponse []*Response

type BlockDetailedInfo

type BlockDetailedInfo struct {
	Header        BlockHeaderInfo  `json:"header"`
	Hash          string           `json:"hash"`
	EcosystemID   int64            `json:"-"`
	NodePosition  int64            `json:"node_position"`
	KeyID         int64            `json:"key_id"`
	Time          int64            `json:"time"`
	Tx            int32            `json:"tx_count"`
	Size          string           `json:"size"`
	RollbacksHash string           `json:"rollbacks_hash"`
	MerkleRoot    string           `json:"merkle_root"`
	BinData       string           `json:"bin_data"`
	SysUpdate     bool             `json:"-"`
	GenBlock      bool             `json:"-"`
	StopCount     int              `json:"stop_count"`
	Transactions  []TxDetailedInfo `json:"transactions"`
}

type BlockHeaderInfo

type BlockHeaderInfo struct {
	BlockID      int64  `json:"block_id"`
	Time         int64  `json:"time"`
	EcosystemID  int64  `json:"-"`
	KeyID        int64  `json:"key_id"`
	NodePosition int64  `json:"node_position"`
	Sign         []byte `json:"-"`
	Hash         string `json:"-"`
	Version      int    `json:"version"`
}

type BlockIdOrHash

type BlockIdOrHash struct {
	Id   int64  `json:"id,omitempty"`
	Hash string `json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockIdOrHash) GetBlock

func (bh *BlockIdOrHash) GetBlock() (int64, bool)

func (*BlockIdOrHash) GetHash

func (bh *BlockIdOrHash) GetHash() ([]byte, bool)

func (*BlockIdOrHash) UnmarshalJSON

func (bh *BlockIdOrHash) UnmarshalJSON(data []byte) error

func (*BlockIdOrHash) Validate

func (bh *BlockIdOrHash) Validate(r *http.Request) error

type BlockInfoResult

type BlockInfoResult struct {
	Hash          string `json:"hash"`
	EcosystemID   int64  `json:"ecosystem_id"`
	KeyID         int64  `json:"key_id"`
	Time          int64  `json:"time"`
	Tx            int32  `json:"tx_count"`
	RollbacksHash string `json:"rollbacks_hash"`
	NodePosition  int64  `json:"node_position"`
	ConsensusMode int32  `json:"consensus_mode"`
}

type ContentResult

type ContentResult struct {
	Menu       string          `json:"menu,omitempty"`
	MenuTree   json.RawMessage `json:"menutree,omitempty"`
	Title      string          `json:"title,omitempty"`
	Tree       json.RawMessage `json:"tree"`
	NodesCount int64           `json:"nodesCount,omitempty"`
}

type DebugApi

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

func NewDebugApi

func NewDebugApi() *DebugApi

func (*DebugApi) GetApis

func (p *DebugApi) GetApis() []any

type EcosystemInfo

type EcosystemInfo struct {
	Id           int64  `json:"id"`
	Name         string `json:"name"`
	Digits       int64  `json:"digits"`
	TokenSymbol  string `json:"token_symbol"`
	TokenName    string `json:"token_name"`
	TotalAmount  string `json:"total_amount"`
	IsWithdraw   bool   `json:"is_withdraw"`
	Withdraw     string `json:"withdraw"`
	IsEmission   bool   `json:"is_emission"`
	Emission     string `json:"emission"`
	Introduction string `json:"introduction"`
	Creator      string `json:"creator"`
}

type Error

type Error struct {
	Code    ErrorCode      `json:"code"`
	Message string         `json:"message"`
	Data    map[string]any `json:"data,omitempty"`
}

func DefaultError

func DefaultError(message string) *Error

func InternalError

func InternalError(message string, data ...map[string]any) *Error

func InvalidInput

func InvalidInput(message string, data ...map[string]any) *Error

func InvalidParamsError

func InvalidParamsError(message string, data ...map[string]any) *Error

func InvalidRequest

func InvalidRequest(message string, data ...map[string]any) *Error

func LimitExceeded

func LimitExceeded(message string, data ...map[string]any) *Error

func MethodNotFound

func MethodNotFound(method string, data ...map[string]any) *Error

func MethodNotSupported

func MethodNotSupported(method string, data ...map[string]any) *Error

func NewError

func NewError(code ErrorCode, message string, data ...map[string]any) *Error

func NotFoundError

func NotFoundError() *Error

func ParseError

func ParseError(message string) *Error

func ResourceNotFound

func ResourceNotFound(message string, data ...map[string]any) *Error

func ResourceUnavailable

func ResourceUnavailable(message string, data ...map[string]any) *Error

func TransactionRejected

func TransactionRejected(message string, data ...map[string]any) *Error

func UnUnknownUIDError

func UnUnknownUIDError() *Error

func UnauthorizedError

func UnauthorizedError() *Error

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode int

type GetContractResult

type GetContractResult struct {
	ID         uint32          `json:"id"`
	StateID    uint32          `json:"state"`
	TableID    string          `json:"tableid"`
	WalletID   string          `json:"walletid"`
	TokenID    string          `json:"tokenid"`
	Address    string          `json:"address"`
	Fields     []contractField `json:"fields"`
	Name       string          `json:"name"`
	AppId      uint32          `json:"app_id"`
	Ecosystem  uint32          `json:"ecosystem"`
	Conditions string          `json:"conditions"`
}

type GetUIDResult

type GetUIDResult struct {
	UID         string `json:"uid,omitempty"`
	Token       string `json:"token,omitempty"`
	Expire      string `json:"expire,omitempty"`
	EcosystemID string `json:"ecosystem_id,omitempty"`
	KeyID       string `json:"key_id,omitempty"`
	Address     string `json:"address,omitempty"`
	NetworkID   string `json:"network_id,omitempty"`
	Cryptoer    string `json:"cryptoer"`
	Hasher      string `json:"hasher"`
}

type HistoryResult

type HistoryResult struct {
	List []map[string]string `json:"list"`
}

type HonorNodeJSON

type HonorNodeJSON struct {
	TCPAddress string `json:"tcp_address"`
	APIAddress string `json:"api_address"`
	PublicKey  string `json:"public_key"`
	UnbanTime  string `json:"unban_time"`
	Stopped    bool   `json:"stopped"`
}

type ID

type ID struct {
	// At most one of Num or Str may be nonzero. If both are zero
	// valued, then IsNum specifies which field's value is to be used
	// as the ID.
	Num uint64
	Str string

	// IsString controls whether the Num or Str field's value should be
	// used as the ID, when both are zero valued. It must always be
	// set to true if the request ID is a string.
	IsString bool
}

ID represents a JSON-RPC 2.0 request ID, which may be either a string or number (or null, which is unsupported).

func IntID

func IntID(i uint64) ID

func StringID

func StringID(s string) ID

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type IbaxApi

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

func NewIbaxApi

func NewIbaxApi(m Mode) *IbaxApi

func (*IbaxApi) GetApis

func (p *IbaxApi) GetApis() []any

type JWTClaims

type JWTClaims struct {
	UID         string `json:"uid,omitempty"`
	EcosystemID string `json:"ecosystem_id,omitempty"`
	KeyID       string `json:"key_id,omitempty"`
	AccountID   string `json:"account_id,omitempty"`
	RoleID      string `json:"role_id,omitempty"`
	jwt.RegisteredClaims
}

JWTClaims is storing jwt claims

type KeyInfoResult

type KeyInfoResult struct {
	Account    string              `json:"account"`
	Ecosystems []*keyEcosystemInfo `json:"ecosystems"`
}

type ListForm

type ListForm struct {
	Name string `json:"name"` //table name
	// contains filtered or unexported fields
}

func (*ListForm) Validate

func (f *ListForm) Validate(r *http.Request) error

type ListResult

type ListResult struct {
	Count int64               `json:"count"`
	List  []map[string]string `json:"list"`
}

type ListWhereForm

type ListWhereForm struct {
	ListForm
	Order string `json:"order"`
	Where any    `json:"where"`
}

func (*ListWhereForm) Validate

func (f *ListWhereForm) Validate(r *http.Request) error

type LoginResult

type LoginResult struct {
	Token       string        `json:"token,omitempty"`
	EcosystemID string        `json:"ecosystem_id,omitempty"`
	KeyID       string        `json:"key_id,omitempty"`
	Account     string        `json:"account,omitempty"`
	NotifyKey   string        `json:"notify_key,omitempty"`
	IsNode      bool          `json:"isnode"`
	IsOwner     bool          `json:"isowner"`
	IsCLB       bool          `json:"clb"`
	Timestamp   string        `json:"timestamp,omitempty"`
	Roles       []rolesResult `json:"roles,omitempty"`
}

type MemberInfo

type MemberInfo struct {
	ID         int64  `json:"id"`
	MemberName string `json:"member_name"`
	ImageID    *int64 `json:"image_id"`
	MemberInfo string `json:"member_info"`
}

type Method

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

func (*Method) Delete

func (a *Method) Delete(name string)

func (*Method) New

func (a *Method) New(structObject any) (name string)

type Mode

type Mode struct {
	EcosystemGetter   types.EcosystemGetter
	ContractRunner    types.SmartContractRunner
	ClientTxProcessor types.ClientTxPreprocessor
}

type MultiTxInfoResult

type MultiTxInfoResult struct {
	Results map[string]*TxInfoResult `json:"results"`
}

type NetApi

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

func NewNetApi

func NewNetApi() *NetApi

func (*NetApi) GetApis

func (p *NetApi) GetApis() []any

type NetworkResult

type NetworkResult struct {
	NetworkID     string          `json:"network_id"`
	CentrifugoURL string          `json:"centrifugo_url"`
	Test          bool            `json:"test"`
	Private       bool            `json:"private"`
	HonorNodes    []HonorNodeJSON `json:"honor_nodes"`
}

type NewApiService

type NewApiService interface {
	New(structObject any) (name string)
	Delete(name string)
}

type NotSingle

type NotSingle struct {
}

type Param

type Param json.RawMessage

Params is an ARRAY of json.RawMessages. This is because *Ethereum* RPCs always use arrays is their input parameter; this differs from the official JSONRPC spec, which allows parameters of any type. But, this assumption makes handling Params in our Ethereum API use-cases *so* much easier.

func (Param) MarshalJSON

func (m Param) MarshalJSON() ([]byte, error)

MarshalJSON returns m as the JSON encoding of m.

func (*Param) UnmarshalJSON

func (m *Param) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

type ParamResult

type ParamResult struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Value      string `json:"value"`
	Conditions string `json:"conditions"`
}

type Params

type Params []Param

func MakeParams

func MakeParams(params ...any) (Params, error)

MakeParams generates JSONRPC parameters from its inputs, and should be used for complex dynamic data which may fail to marshal, in which case the error is propagated to the caller.

Examples:

params, err := jsonrpc.MakeParams(someComplexObject, "string", true)

func MustParams

func MustParams(params ...any) Params

MakeParams can be used to generate JSONRPC Params field from well-known data, which should not fail.

Examples:

request.Params = jsonrpc.MustParams("latest", true)

func (Params) UnmarshalInto

func (p Params) UnmarshalInto(receivers ...any) error

UnmarshalInto will decode Params into the passed in values, which must be pointer receivers. The type of the passed in value is used to Unmarshal the data. UnmarshalInto will fail if the parameters cannot be converted to the passed-in types.

Example:

var blockNum string
var fullBlock bool
err := request.Params.UnmarshalInto(&blockNum, &fullBlock)

IMPORTANT: While Go will compile with non-pointer receivers, the Unmarshal attempt will *always* fail with an error.

func (Params) UnmarshalSingleParam

func (p Params) UnmarshalSingleParam(pos int, receiver any) error

UnmarshalSingleParam can be used in the (rare) case where only one of the Request.Params is needed. For example we use this in Smart Routing to extract the blockNum value from RPCs without decoding the entire Params array.

Example:

err := request.Params.UnmarshalSingleParam(pos, &blockNum)

func (Params) UnmarshalValue

func (p Params) UnmarshalValue(types []reflect.Type) (args []reflect.Value, err error)

type ParamsResult

type ParamsResult struct {
	List []ParamResult `json:"list"`
}

type PartModel

type PartModel interface {
	SetTablePrefix(prefix string)
	Get(name string) (bool, error)
}

type RawResponse

type RawResponse struct {
	JSONRPC string           `json:"jsonrpc"`
	ID      ID               `json:"id"`
	Result  json.RawMessage  `json:"result,omitempty"`
	Error   *json.RawMessage `json:"error,omitempty"`
}

RawResponse keeps Result and Error as unparsed JSON It is meant to be used to deserialize JSONPRC responses from downstream components while Response is meant to be used to craft our own responses to clients.

func (RawResponse) MarshalJSON

func (r RawResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0" property.

func (*RawResponse) UnmarshalJSON

func (r *RawResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Request

type Request struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	ID      ID     `json:"id"`
	Params  Params `json:"params"`
}

func MakeRequest

func MakeRequest(id int, method string, params ...any) (*Request, error)

MakeRequest builds a Request from all its parts, but returns an error if the params cannot be marshalled.

func MustRequest

func MustRequest(id int, method string, params ...any) *Request

MustRequest builds a request from all its parts but panics if the params cannot be marshaled, so should only be used with well-known parameter data.

func NewRequest

func NewRequest() *Request

func (Request) MarshalJSON

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0" property.

func (*Request) UnmarshalJSON

func (r *Request) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RequestContext

type RequestContext struct {
	context.Context
}

func (*RequestContext) HTTPRequest

func (rc *RequestContext) HTTPRequest() *http.Request

func (*RequestContext) HTTPResponseWriter

func (rc *RequestContext) HTTPResponseWriter() http.ResponseWriter

func (*RequestContext) RawJSON

func (rc *RequestContext) RawJSON() json.RawMessage

type RequestWithNetwork

type RequestWithNetwork struct {
	*Request
	Network string `json:"network"`
}

func (RequestWithNetwork) MarshalJSON

func (r RequestWithNetwork) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0" property.

func (*RequestWithNetwork) UnmarshalJSON

func (r *RequestWithNetwork) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Response

type Response struct {
	JSONRPC string `json:"jsonrpc"`
	ID      ID     `json:"id"`
	Result  any    `json:"result,omitempty"`
	Error   any    `json:"error,omitempty"`
}

func NewResponse

func NewResponse() *Response

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0" property.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RowResult

type RowResult struct {
	Value map[string]string `json:"value"`
}

type RpcApis

type RpcApis interface {
	GetApis() []any
}

type RpcServers

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

func (*RpcServers) Modules

func (r *RpcServers) Modules() ([]string, *Error)

type SectionsForm

type SectionsForm struct {
	Lang string `schema:"lang"`
	// contains filtered or unexported fields
}

func (*SectionsForm) Validate

func (f *SectionsForm) Validate(r *http.Request) error

type Server

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

func NewServer

func NewServer(m Mode) *Server

func (*Server) RegisterName

func (s *Server) RegisterName(namespace string, function any) error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Stop

func (s *Server) Stop()

type TableCountResult

type TableCountResult struct {
	Count int64       `json:"count"`
	List  []tableInfo `json:"list"`
}

type TableResult

type TableResult struct {
	Name       string       `json:"name"`
	Insert     string       `json:"insert"`
	NewColumn  string       `json:"new_column"`
	Update     string       `json:"update"`
	Read       string       `json:"read,omitempty"`
	Filter     string       `json:"filter,omitempty"`
	Conditions string       `json:"conditions"`
	AppID      string       `json:"app_id"`
	Columns    []columnInfo `json:"columns"`
}

type TxDetailResult

type TxDetailResult struct {
}

type TxDetailedInfo

type TxDetailedInfo struct {
	Hash         string         `json:"hash"`
	ContractName string         `json:"contract_name"`
	Params       map[string]any `json:"params"`
	KeyID        int64          `json:"key_id"`
	Time         int64          `json:"time"`
	Type         byte           `json:"type"`
	Size         string         `json:"size"`
}

type TxInfo

type TxInfo struct {
	Hash         string         `json:"hash"`
	ContractName string         `json:"contract_name"`
	Params       map[string]any `json:"params"`
	KeyID        int64          `json:"key_id"`
}

type TxInfoResult

type TxInfoResult struct {
	BlockID int64         `json:"blockid"`
	Confirm int           `json:"confirm"`
	Data    *smart.TxInfo `json:"data"`
}

type UserClient

type UserClient struct {
	KeyID         int64
	AccountID     string
	EcosystemID   int64
	EcosystemName string
	RoleID        int64
}

func (*UserClient) Prefix

func (c *UserClient) Prefix() string

Jump to

Keyboard shortcuts

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