handlers

package
v0.0.0-...-54d343b Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddressValidator validator.Func = func(fl validator.FieldLevel) bool {
	address := fl.Field().String()
	if !strings.HasPrefix(address, "KT") && !strings.HasPrefix(address, "tz") && len(address) != 36 {
		return false
	}
	_, _, err := base58.CheckDecode(address)
	return err == nil
}

AddressValidator -

View Source
var NetworkValidator validator.Func = func(fl validator.FieldLevel) bool {
	network := fl.Field().String()
	return helpers.StringInArray(network, []string{
		consts.Mainnet,
		consts.Babylon,
		consts.Carthage,
		consts.Zeronet,
	})
}

NetworkValidator -

View Source
var OPGValidator validator.Func = func(fl validator.FieldLevel) bool {
	hash := fl.Field().String()
	if !strings.HasPrefix(hash, "o") && len(hash) != 51 {
		return false
	}
	_, _, err := base58.CheckDecode(hash)
	return err == nil
}

OPGValidator -

View Source
var StatusValidator validator.Func = func(fl validator.FieldLevel) bool {
	status := fl.Field().String()
	data := strings.Split(status, ",")
	for i := range data {
		if !helpers.StringInArray(data[i], []string{
			consts.Applied,
			consts.Backtracked,
			consts.Failed,
			consts.Skipped,
		}) {
			return false
		}
	}
	return true
}

StatusValidator -

Functions

This section is empty.

Types

type BigMapItem

type BigMapItem struct {
	Key     interface{} `json:"key"`
	Value   interface{} `json:"value"`
	KeyHash string      `json:"key_hash"`
	Level   int64       `json:"level"`
}

BigMapItem -

type BigMapResponseItem

type BigMapResponseItem struct {
	Item  BigMapItem `json:"data"`
	Count int64      `json:"count"`
}

BigMapResponseItem -

type CodeDiff

type CodeDiff struct {
	Full    string `json:"full,omitempty"`
	Added   int64  `json:"added,omitempty"`
	Removed int64  `json:"removed,omitempty"`
}

CodeDiff -

type Context

type Context struct {
	ES    *elastic.Elastic
	RPCs  map[string]noderpc.Pool
	Dir   string
	DB    database.DB
	OAUTH oauth.Config
}

Context -

func NewContext

func NewContext(e *elastic.Elastic, rpcs map[string]noderpc.Pool, dir string, db database.DB, oauth oauth.Config) *Context

NewContext -

func (*Context) AuthJWTRequired

func (ctx *Context) AuthJWTRequired() gin.HandlerFunc

AuthJWTRequired -

func (*Context) CreateSubscription

func (ctx *Context) CreateSubscription(c *gin.Context)

CreateSubscription -

func (*Context) DeleteSubscription

func (ctx *Context) DeleteSubscription(c *gin.Context)

DeleteSubscription -

func (*Context) GetBigMap

func (ctx *Context) GetBigMap(c *gin.Context)

GetBigMap -

func (*Context) GetBigMapByKeyHash

func (ctx *Context) GetBigMapByKeyHash(c *gin.Context)

GetBigMapByKeyHash -

func (*Context) GetContract

func (ctx *Context) GetContract(c *gin.Context)

GetContract -

func (*Context) GetContractCode

func (ctx *Context) GetContractCode(c *gin.Context)

GetContractCode -

func (*Context) GetContractOperations

func (ctx *Context) GetContractOperations(c *gin.Context)

GetContractOperations -

func (*Context) GetContractRating

func (ctx *Context) GetContractRating(c *gin.Context)

GetContractRating -

func (*Context) GetContractStorage

func (ctx *Context) GetContractStorage(c *gin.Context)

GetContractStorage -

func (*Context) GetDiff

func (ctx *Context) GetDiff(c *gin.Context)

GetDiff -

func (*Context) GetEntrypoints

func (ctx *Context) GetEntrypoints(c *gin.Context)

GetEntrypoints -

func (*Context) GetMempool

func (ctx *Context) GetMempool(c *gin.Context)

GetMempool -

func (*Context) GetMigrationDiff

func (ctx *Context) GetMigrationDiff(c *gin.Context)

GetMigrationDiff -

func (*Context) GetOperation

func (ctx *Context) GetOperation(c *gin.Context)

GetOperation -

func (*Context) GetProjects

func (ctx *Context) GetProjects(c *gin.Context)

GetProjects -

func (*Context) GetRandomContract

func (ctx *Context) GetRandomContract(c *gin.Context)

GetRandomContract -

func (*Context) GetSameContracts

func (ctx *Context) GetSameContracts(c *gin.Context)

GetSameContracts -

func (*Context) GetSimilarContracts

func (ctx *Context) GetSimilarContracts(c *gin.Context)

GetSimilarContracts -

func (*Context) GetUserProfile

func (ctx *Context) GetUserProfile(c *gin.Context)

GetUserProfile -

func (*Context) IsAuthenticated

func (ctx *Context) IsAuthenticated() gin.HandlerFunc

IsAuthenticated -

func (*Context) ListSubscriptions

func (ctx *Context) ListSubscriptions(c *gin.Context)

ListSubscriptions -

func (*Context) OauthCallback

func (ctx *Context) OauthCallback(c *gin.Context)

OauthCallback -

func (*Context) OauthLogin

func (ctx *Context) OauthLogin(c *gin.Context)

OauthLogin -

func (*Context) Recommendations

func (ctx *Context) Recommendations(c *gin.Context)

Recommendations -

func (*Context) Search

func (ctx *Context) Search(c *gin.Context)

Search -

func (*Context) SetAlias

func (ctx *Context) SetAlias(c *gin.Context)

SetAlias -

func (*Context) Vote

func (ctx *Context) Vote(c *gin.Context)

Vote -

type Contract

type Contract struct {
	*models.Contract

	Profile *ProfileInfo `json:"profile,omitempty"`
}

Contract -

type OPGRequest

type OPGRequest struct {
	Hash string `uri:"hash" binding:"required,opg"`
}

OPGRequest -

type OauthParams

type OauthParams struct {
	Provider string `uri:"provider"`
}

OauthParams -

type OauthRequest

type OauthRequest struct {
	State string `form:"state"`
	Code  string `form:"code"`
}

OauthRequest -

type Operation

type Operation struct {
	ID        string    `json:"-"`
	Protocol  string    `json:"protocol"`
	Hash      string    `json:"hash"`
	Internal  bool      `json:"internal"`
	Network   string    `json:"network"`
	Timesatmp time.Time `json:"timestamp"`

	Level         int64           `json:"level"`
	Kind          string          `json:"kind"`
	Source        string          `json:"source"`
	Fee           int64           `json:"fee,omitempty"`
	Counter       int64           `json:"counter,omitempty"`
	GasLimit      int64           `json:"gas_limit,omitempty"`
	StorageLimit  int64           `json:"storage_limit,omitempty"`
	Amount        int64           `json:"amount,omitempty"`
	Destination   string          `json:"destination,omitempty"`
	PublicKey     string          `json:"public_key,omitempty"`
	ManagerPubKey string          `json:"manager_pubkey,omitempty"`
	Balance       int64           `json:"balance,omitempty"`
	Delegate      string          `json:"delegate,omitempty"`
	Status        string          `json:"status"`
	Entrypoint    string          `json:"entrypoint,omitempty"`
	Errors        []cerrors.Error `json:"errors,omitempty"`

	BalanceUpdates []models.BalanceUpdate  `json:"balance_updates,omitempty"`
	Result         *models.OperationResult `json:"result,omitempty"`

	Parameters  interface{} `json:"parameters,omitempty"`
	StorageDiff interface{} `json:"storage_diff,omitempty"`
	Mempool     bool        `json:"mempool"`
}

Operation -

type OperationResponse

type OperationResponse struct {
	Operations []Operation `json:"operations"`
	LastID     string      `json:"last_id"`
}

OperationResponse -

type ProfileInfo

type ProfileInfo struct {
	Subscribed bool `json:"subscribed"`
}

ProfileInfo -

type Subscription

type Subscription struct {
	*Contract

	SubscribedAt time.Time `json:"subscribed_at"`
}

Subscription -

type TimelineItem

type TimelineItem struct {
	Event string    `json:"event"`
	Date  time.Time `json:"date"`
}

TimelineItem -

Jump to

Keyboard shortcuts

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