handlers

package
v0.0.0-...-2b2340b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDAppRequestPayload

type CreateDAppRequestPayload struct {
	ChainName            string `json:"chain_name"`
	BTCAddressHex        string `json:"btc_address_hex"`
	PublicKeyHex         string `json:"public_key_hex"`
	SmartContractAddress string `json:"smart_contract_address"` //UPDATE: New field
	ChainID              string `json:"chain_id"`
	ChainEndpoint        string `json:"chain_endpoint"`
	RPCUrl               string `json:"rpc_url"`
	AccessToken          string `json:"access_token"`
	TokenContractAddress string `json:"token_contract_address"`
	CustodialGroupID     uint   `json:"custodial_group_id"`
}

type GmpPublicResponse

type GmpPublicResponse[T any] struct {
	Data  T   `json:"data"`
	Total int `json:"total,omitempty"`
}

type Handler

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

func New

func New(
	ctx context.Context, cfg *config.Config, services *services.Services,
) (*Handler, error)

func (*Handler) CreateCustodial

func (h *Handler) CreateCustodial(request *http.Request) (*Result, *types.Error)

func (*Handler) CreateCustodialGroup

func (h *Handler) CreateCustodialGroup(request *http.Request) (*Result, *types.Error)

func (*Handler) CreateDApp

func (h *Handler) CreateDApp(request *http.Request) (*Result, *types.Error)

CreateDApp godoc @Summary Create dApp @Description Creates a new dApp @Tags dApp @Accept json @Produce json @Success 200 {object} PublicResponse[CreateDAppRequestPayload] "Created dApp" @Router /v1/dApp [post]

func (*Handler) CreateStakingPsbt

func (h *Handler) CreateStakingPsbt(request *http.Request) (*Result, *types.Error)

func (*Handler) CreateUnstakingPsbt

func (h *Handler) CreateUnstakingPsbt(request *http.Request) (*Result, *types.Error)

func (*Handler) DeleteDApp

func (h *Handler) DeleteDApp(request *http.Request) (*Result, *types.Error)

DeleteDApp godoc @Summary Delete dApp @Description Deletes a dApp @Tags dApp @Produce json @Success 200 {string} string "Delete successfully" @Router /v1/dApp [delete]

func (*Handler) EstimateTimeSpent

func (h *Handler) EstimateTimeSpent(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPChart

func (h *Handler) GMPChart(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPCumulativeVolume

func (h *Handler) GMPCumulativeVolume(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPSearch

func (h *Handler) GMPSearch(request *http.Request) (*Result, *types.Error)

GMPSearch godoc @Summary Search GMP transactions @Description Search for GMP transactions with filters @Tags gmp @Accept json @Produce json @Success 200 {object} GmpPublicResponse[[]gmp.GMPDocument] "List of GMP" @Router /v1/gmp/searchGMP [post]

func (*Handler) GMPStats

func (h *Handler) GMPStats(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPStatsAVGTimes

func (h *Handler) GMPStatsAVGTimes(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPTopITSAssets

func (h *Handler) GMPTopITSAssets(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPTopUsers

func (h *Handler) GMPTopUsers(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPTotalActiveUsers

func (h *Handler) GMPTotalActiveUsers(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPTotalFee

func (h *Handler) GMPTotalFee(request *http.Request) (*Result, *types.Error)

func (*Handler) GMPTotalVolume

func (h *Handler) GMPTotalVolume(request *http.Request) (*Result, *types.Error)

func (*Handler) GetCovenantParams

func (h *Handler) GetCovenantParams(request *http.Request) (*Result, *types.Error)

func (*Handler) GetCustodialByName

func (h *Handler) GetCustodialByName(request *http.Request) (*Result, *types.Error)

func (*Handler) GetCustodialGroupByName

func (h *Handler) GetCustodialGroupByName(request *http.Request) (*Result, *types.Error)

func (*Handler) GetCustodialGroups

func (h *Handler) GetCustodialGroups(request *http.Request) (*Result, *types.Error)

func (*Handler) GetCustodials

func (h *Handler) GetCustodials(request *http.Request) (*Result, *types.Error)

func (*Handler) GetDApp

func (h *Handler) GetDApp(request *http.Request) (*Result, *types.Error)

GetDApp godoc @Summary Get dApps @Description Retrieves all dApps @Tags dApp @Produce json @Success 200 {object} PublicResponse[[]models.DApp] "List of dApps" @Router /v1/dApp [get]

func (*Handler) GetGMPDataMapping

func (h *Handler) GetGMPDataMapping(request *http.Request) (*Result, *types.Error)

func (*Handler) GetScalarGlobalParams

func (h *Handler) GetScalarGlobalParams(request *http.Request) (*Result, *types.Error)

GetScalarGlobalParams godoc @Summary Get Scalar global parameters @Description Retrieves the global parameters for Scalar, including finality provider details. @Produce json @Success 200 {object} PublicResponse[services.GlobalParamsPublic] "Global parameters" @Router /v1/global-params [get]

func (*Handler) GetShortenCustodialGroups

func (h *Handler) GetShortenCustodialGroups(request *http.Request) (*Result, *types.Error)

func (*Handler) HealthCheck

func (h *Handler) HealthCheck(request *http.Request) (*Result, *types.Error)

HealthCheck godoc @Summary Health check endpoint @Description Health check the service, including ping database connection @Produce json @Success 200 {string} PublicResponse[string] "Server is up and running" @Router /healthcheck [get]

func (*Handler) SearchVault

func (h *Handler) SearchVault(request *http.Request) (*Result, *types.Error)

SearchVault godoc @Summary Search vaults @Description Searches for vaults based on the provided payload @Tags vault @Accept json @Produce json @Success 200 {object} PublicResponse[[]vault.VaultDocument] "List of vaults" @Router /v1/vault/searchVault [post]

func (*Handler) ToggleDApp

func (h *Handler) ToggleDApp(request *http.Request) (*Result, *types.Error)

ToggleDApp godoc @Summary Toggle dApp @Description Toggles a dApp @Tags dApp @Produce json @Success 200 {object} PublicResponse[IdRequestPayload] "Toggled dApp" @Router /v1/dApp [patch]

func (*Handler) UpdateDApp

func (h *Handler) UpdateDApp(request *http.Request) (*Result, *types.Error)

UpdateDApp godoc @Summary Update dApp @Description Updates a dApp @Tags dApp @Produce json @Success 200 {object} PublicResponse[UpdateDAppRequestPayload] "Updated dApp" @Router /v1/dApp [put]

type IdRequestPayload

type IdRequestPayload struct {
	ID string `json:"id"`
}

type PublicResponse

type PublicResponse[T any] struct {
	Data       T                   `json:"data"`
	Pagination *paginationResponse `json:"pagination,omitempty"`
}

type Result

type Result struct {
	Data   interface{}
	Status int
}

func NewGmpResult

func NewGmpResult[T any](data T, total int) *Result

func NewResult

func NewResult[T any](data T) *Result

func NewResultWithPagination

func NewResultWithPagination[T any](data T, pageToken string) *Result

NewResult returns a successful result, with default status code 200

type UpdateDAppRequestPayload

type UpdateDAppRequestPayload struct {
	ID                   string `json:"id"`
	ChainName            string `json:"chain_name"`
	BTCAddressHex        string `json:"btc_address_hex"`
	PublicKeyHex         string `json:"public_key_hex"`
	SmartContractAddress string `json:"smart_contract_address"` //UPDATE: New field
	ChainID              string `json:"chain_id"`
	ChainEndpoint        string `json:"chain_endpoint"`
	RPCUrl               string `json:"rpc_url"`
	AccessToken          string `json:"access_token"`
	TokenContractAddress string `json:"token_contract_address"`
	CustodialGroupID     uint   `json:"custodial_group_id"`
}

Jump to

Keyboard shortcuts

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