servertypes

package
v0.0.0-...-0f47a2f Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BondByAddressResp

type BondByAddressResp struct {
	BondResp
	Holder          common.Address `json:"holder_address"`
	CreatedAtBlock  uint64         `json:"created_at_block"`
	Principal       uint64         `json:"principal"`
	CouponDate      uint8          `json:"coupon_date"`
	MaturityDate    time.Time      `json:"maturity_date"`
	IntroMessage    string         `json:"intro_msg"`
	LastUpdate      time.Time      `json:"last_update"`
	LastSyncedBlock uint64         `json:"last_synced_block"`
}

BondByAddressResp defines the complete bond details excluding the secure details. Secure bond details require a separate request to access them.

func (*BondByAddressResp) Read

func (r *BondByAddressResp) Read(fn func(fields ...any) error) (interface{}, error)

Reader interface implementation for type BondByAddressResp.

type BondResp

type BondResp struct {
	BondAddress common.Address `json:"bond_address"`
	Issuer      common.Address `json:"issuer_address"`
	CreatedTime time.Time      `json:"created_time"`
	CouponRate  uint8          `json:"coupon_rate"`
	Currency    uint8          `json:"currency"`
	LastStatus  uint8          `json:"last_status"`
}

BondResp defines the response returned in an array form when get bonds local type method is queried by a POA client.

func (*BondResp) Read

func (r *BondResp) Read(fn func(fields ...any) error) (interface{}, error)

Reader interface implementation for type BondResp.

type ChatMsgsResp

type ChatMsgsResp struct {
	Sender          common.Address `json:"sender"`
	BondAddress     common.Address `json:"bond_address"`
	Message         string         `json:"chat_msg"`
	CreatedTime     time.Time      `json:"created_at"`
	LastSyncedBlock uint64         `json:"last_synced_block"`
}

ChatMsgsResp defines the response returned in an array form when get chats local type method is queried by the client.

func (*ChatMsgsResp) Read

func (r *ChatMsgsResp) Read(fn func(fields ...any) error) (interface{}, error)

Reader interface implementation for type ChatMsgsResp.

type LastSyncedBlockResp

type LastSyncedBlockResp uint64

LastSyncedBlockResp defines the block last synced.

func (*LastSyncedBlockResp) Read

func (r *LastSyncedBlockResp) Read(fn func(fields ...any) error) (interface{}, error)

Reader interface implementation for type LastSyncedBlockResp.

type RPCError

type RPCError struct {
	Code    uint16      `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

RPCError defines the error message information sent to the user on happening.

type RPCMessage

type RPCMessage struct {
	ID      uint16       `json:"id"`
	Version string       `json:"jsonrpc"`          // required on a request and a response.
	Method  utils.Method `json:"method,omitempty"` // required on a request
	Sender  *SenderInfo  `json:"sender,omitempty"` // required on a request

	Params []interface{}   `json:"params,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
	Error  *RPCError       `json:"error,omitempty"`
}

RPCMessage defines the structure accepted for all requests and responses. This struct is compatible with JSON-RPC version 2.0.

func (*RPCMessage) PackServerError

func (msg *RPCMessage) PackServerError(shortErr, desc error)

packServerError packs the errors identified into a response ready to be sent to the client.

func (*RPCMessage) PackServerResult

func (msg *RPCMessage) PackServerResult(data interface{})

packServerResult packs the successful result queried into a response ready to be sent to the client.

type SenderInfo

type SenderInfo struct {
	Address common.Address `json:"address"`
	// SigningKey must be encrypted with the session's public key before being sent.
	// Failure to do so could expose the actual user key to hackers.
	// It must be signed via the diffie-hellman passed pubkey.
	SigningKey string `json:"signingkey,omitempty"`
}

SenderInfo defines the required sender information attached in every request.

type ServerKeyResp

type ServerKeyResp struct {
	Pubkey string `json:"pubkey"`
	Expiry uint64 `json:"expiry"` // timestamp in seconds at UTC timezone

	// private field ignored by the JSON encoder.
	SharedKey []byte `json:"-"` // Generate using the remote Pubkey + local private key.
}

ServerKeyResp defines the response returned once the server public key is requested by a POA (Point Of Access) client.

Jump to

Keyboard shortcuts

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