protocol

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// RootApiPath For developers, every customized Writing and Read of tripods
	// will base on '/api'.
	RootApiPath = "/api"
	WrCallType  = "writing"
	RdCallType  = "reading"
	AdminType   = "admin"

	TripodNameKey = "tripod_name"
	FuncNameKey   = "func_name"
	BlockHashKey  = "block_hash"
)

Variables

View Source
var (
	Success = 0

	BlockFailure   = 10001
	TxnFailure     = 10002
	ReceiptFailure = 10003
)
View Source
var (
	WrApiPath      = filepath.Join(RootApiPath, WrCallType)
	RdApiPath      = filepath.Join(RootApiPath, RdCallType)
	AdminApiPath   = filepath.Join(RootApiPath, AdminType)
	SubResultsPath = "/subscribe/results"
)

Functions

func GetRdCall

func GetRdCall(ctx *gin.Context) (*RdCall, error)

func RenderError

func RenderError(ctx *gin.Context, code int, err error)

func RenderJson

func RenderJson(ctx *gin.Context, code int, err error, data any)

func RenderSuccess

func RenderSuccess(ctx *gin.Context, data any)

Types

type APIResponse

type APIResponse struct {
	Code   int    `json:"code"`
	ErrMsg string `json:"err_msg"`
	Data   any    `json:"data"`
}

func (*APIResponse) Error

func (a *APIResponse) Error() error

func (*APIResponse) IsSuccess

func (a *APIResponse) IsSuccess() bool

type SignedWrCall

type SignedWrCall struct {
	Pubkey    []byte  `json:"pubkey"`
	Address   []byte  `json:"address"`
	Signature []byte  `json:"signature"`
	Call      *WrCall `json:"call"`
}

func GetSignedWrCall

func GetSignedWrCall(ctx *gin.Context) (*SignedWrCall, error)

func (*SignedWrCall) GetFuncName

func (s *SignedWrCall) GetFuncName() string

func (*SignedWrCall) GetTripod

func (s *SignedWrCall) GetTripod() string

type WritingPostBody

type WritingPostBody struct {
	// hex string
	Pubkey string `json:"pubkey"`
	// hex string
	Address string `json:"address"`
	// hex string
	Signature string  `json:"signature"`
	Call      *WrCall `json:"call"`
}

Jump to

Keyboard shortcuts

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