rest

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: ISC Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchResultTypeUnknown     = -1
	SearchResultTypeAddress     = 0
	SearchResultTypeTransaction = 1
	SearchResultTypeBlock       = 2
	SearchResultTypeEAD         = 3
)

Variables

This section is empty.

Functions

func AddressParam

func AddressParam(r *http.Request, inQuery bool, key string) (string, error)

func BadRequest

func BadRequest(w http.ResponseWriter, reason string)

func BadRequestErr

func BadRequestErr(w http.ResponseWriter, err error)

func HashParam

func HashParam(r *http.Request, inQuery bool, key string) (string, error)

func InitRouter

func InitRouter(chains map[uint32]*rt.ChainRTO, cfg APIConfig) http.Handler

func Int64Param

func Int64Param(r *http.Request, inQuery bool, key string) (int64, error)

func NotFound

func NotFound(w http.ResponseWriter)

func PageParams

func PageParams(r *http.Request, defaultLimit uint32) (limit, offset uint32, err error)

func ServerError

func ServerError(w http.ResponseWriter)

func SetNetParams

func SetNetParams(params *chaincfg.Params)

func StringArrayParam

func StringArrayParam(r *http.Request, inQuery bool, key string) []string

func StringParam

func StringParam(r *http.Request, inQuery bool, key string) string

func Success

func Success(w http.ResponseWriter, data interface{})

func SuccessAny added in v0.4.11

func SuccessAny(w http.ResponseWriter, data interface{})

func Uint32Param

func Uint32Param(r *http.Request, inQuery bool, key string) (uint32, error)

func Uint64Param

func Uint64Param(r *http.Request, inQuery bool, key string) (uint64, error)

func UseLogger added in v0.4.11

func UseLogger(logger zerolog.Logger)

func WriteResponse

func WriteResponse(w http.ResponseWriter, status int, data ResponseData)

Types

type APIConfig added in v0.4.11

type APIConfig struct {
	EnableCORS           bool
	PgOnly               bool
	WalletSupportEnabled bool
	RPCAddress           string
	RPCUser              string
	RPCPass              string
	Net                  string
}

type AddressSummaryResponse

type AddressSummaryResponse struct {
	Shards []BalanceResponse `json:"shards"`
}

type BalanceResponse

type BalanceResponse struct {
	ShardID       uint32 `json:"shardID"`
	Balance       int64  `json:"balance"`
	BalanceLocked int64  `json:"balanceLocked"`
	Address       string `json:"address,omitempty"` // Used in address summary endpoint, (redundant there -> omitted)
}

type BlockShortInfo

type BlockShortInfo struct {
	Hash   string `json:"hash"`
	Height int64  `json:"height"`
	Mined  string `json:"mined"`
	Size   int64  `json:"size"`
}

type NearestDatesIndexResponse added in v0.4.11

type NearestDatesIndexResponse struct {
	Next     int64 `json:"next"`
	Previous int64 `json:"previous"`
}

type ResponseData

type ResponseData struct {
	Data   interface{} `json:"data,omitempty"`
	Error  string      `json:"error,omitempty"`
	Limit  int64       `json:"limit,omitempty"`
	Offset int64       `json:"offset,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	Type    uint8  `json:"type"`
	ShardID uint32 `json:"shardId"`
}

type ShardInfo

type ShardInfo struct {
	ID                 uint32  `json:"id"`
	GenesisHeight      int64   `json:"genesisHeight"`
	GenesisHash        string  `json:"genesisHash"`
	Blocks             int64   `json:"blocks"`
	CurrentBlockSize   uint64  `json:"currentBlockSize"`
	CurrentBlockWeight uint64  `json:"currentBlockWeight"`
	Difficulty         float64 `json:"difficulty"`
	HashPS             int64   `json:"hashPS"`
}

type TxOperation

type TxOperation struct {
	Index   int    `json:"index"`
	Amount  int64  `json:"amount"`
	Address string `json:"address"`
}

type TxRecord

type TxRecord struct {
	ID             string        `json:"id"`   // TxHash
	Hash           string        `json:"hash"` // TxWitnessHash
	BlockNumber    int64         `json:"blockNumber"`
	CrossShardTx   bool          `json:"crossShardTx"`
	PairedShardID  uint32        `json:"pairedShardID,omitempty"` // present only if cross-shard.
	Timestamp      int64         `json:"timestamp"`
	Confirmations  int64         `json:"confirmations"`  // 0 for mempool
	Amount         int64         `json:"amount"`         // Balance delta by the caller's address perspective.
	SentAmount     int64         `json:"sentAmount"`     // Sent amount by the caller's address perspective.
	ReceivedAmount int64         `json:"receivedAmount"` // Received amount by the caller's address perspective.
	Fee            int64         `json:"fee"`            // Transaction fee
	TotalIn        int64         `json:"totalIn"`
	TotalOut       int64         `json:"totalOut"`
	Senders        []TxOperation `json:"senders"`
	Receivers      []TxOperation `json:"receivers"`
	// contains filtered or unexported fields
}

type TxShortInfo

type TxShortInfo struct {
	Hash        string `json:"hash"`
	BlockNumber int64  `json:"blockNumber"`
	Amount      int64  `json:"amount"`
}

type TxSubmit

type TxSubmit struct {
	Transaction string `json:"transaction"`
}

type UTXO

type UTXO struct {
	TxHash         string `json:"hash"`
	TxOutput       uint16 `json:"output"`
	Amount         int64  `json:"amount"`
	PKScript       string `json:"pkScript"`
	UnlockingBlock int64  `json:"unlockingBlock,omitempty"`
	Spent          bool   `json:"spent"`
	Timestamp      int64  `json:"timestamp,omitempty"` // час орієнтовного розлоку
	Locked         bool   `json:"locked"`
	LockPeriod     int64  `json:"lockPeriod"`
	BlockHash      string `json:"blockHash"`
	BlockTime      int64  `json:"blockTime"`
}

Jump to

Keyboard shortcuts

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