webapi

package
v2.0.3-0...-34c6bb6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package webapi provides types and methods for implementing the wasp http and websocket api

Index

Constants

View Source
const APIVersion = 1

Variables

View Source
var ConfirmedStateLagThreshold uint32

Functions

func AddHealthEndpoint

func AddHealthEndpoint(server echoswagger.ApiRoot, chainService interfaces.ChainService, metricsService interfaces.MetricsService)

func Init

func Init(
	logger log.Logger,
	server echoswagger.ApiRoot,
	waspVersion string,
	config *configuration.Configuration,
	networkProvider peering.NetworkProvider,
	trustedNetworkManager peering.TrustedNetworkManager,
	userManager *userspkg.UserManager,
	chainRecordRegistryProvider registry.ChainRecordRegistryProvider,
	dkShareRegistryProvider registry.DKShareRegistryProvider,
	nodeIdentityProvider registry.NodeIdentityProvider,
	chainsProvider chains.Provider,
	distKeyGenNodeProvider distkeygen.NodeProvider,
	shutdownHandler *shutdown.ShutdownHandler,
	chainMetricsProvider *metrics.ChainMetricsProvider,
	authConfig authentication.AuthConfiguration,
	requestCacheTTL time.Duration,
	websocketService *websocket.Service,
	indexDBPath string,
	accountDumpsPath string,
	pub *publisher.Publisher,
	l1ParamsFetcher parameters.L1ParamsFetcher,
	l1Client clients.L1Client,
	jsonrpcParams *jsonrpc.Parameters,
)

Types

type APIGroupModifier

type APIGroupModifier struct {
	OverrideHandler func(api echoswagger.Api)
	// contains filtered or unexported fields
}

APIGroupModifier is required as it is impossible with echoSwagger to define a group with mixed authentication rules. Most of our routes are protected but very few are not.

While it is possible to create two different groups such as (chainAdm, chainPub), this will pollute the code generation and the documentation itself, as it will create empty groups for controllers that define no public routes, duplicate code files and increase the client lib size even further

Furthermore, it's forbidden to create two groups with the same name to support two different authentication rules. This wrapper adds modifiers to each route that it is assigned to. See: api.go -> loadControllers

func (*APIGroupModifier) Add

func (p *APIGroupModifier) Add(method, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) CallOverrideHandler

func (p *APIGroupModifier) CallOverrideHandler(api echoswagger.Api) echoswagger.Api

func (*APIGroupModifier) DELETE

func (*APIGroupModifier) EchoGroup

func (p *APIGroupModifier) EchoGroup() *echo.Group

func (*APIGroupModifier) GET

func (*APIGroupModifier) HEAD

func (*APIGroupModifier) OPTIONS

func (*APIGroupModifier) PATCH

func (*APIGroupModifier) POST

func (*APIGroupModifier) PUT

func (*APIGroupModifier) SetDescription

func (p *APIGroupModifier) SetDescription(desc string) echoswagger.ApiGroup

func (*APIGroupModifier) SetExternalDocs

func (p *APIGroupModifier) SetExternalDocs(desc, url string) echoswagger.ApiGroup

func (*APIGroupModifier) SetSecurity

func (p *APIGroupModifier) SetSecurity(names ...string) echoswagger.ApiGroup

func (*APIGroupModifier) SetSecurityWithScope

func (p *APIGroupModifier) SetSecurityWithScope(s map[string][]string) echoswagger.ApiGroup

type Mocker

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

func NewMocker

func NewMocker() *Mocker

func (*Mocker) Get

func (m *Mocker) Get(i interface{}) interface{}

func (*Mocker) LoadMockFiles

func (m *Mocker) LoadMockFiles()

Directories

Path Synopsis
Package apierrors provides errors for the webapi
Package apierrors provides errors for the webapi
Package common implements common VM methods
Package common implements common VM methods
controllers
chain
Package chain defines the methods evm chain in the webapi
Package chain defines the methods evm chain in the webapi
controllerutils
Package controllerutils provides utility functions for webapi controllers
Package controllerutils provides utility functions for webapi controllers
corecontracts
Package corecontracts contains routes for webapi core contract interactions
Package corecontracts contains routes for webapi core contract interactions
metrics
Package metrics provides methods for getting chain metrics
Package metrics provides methods for getting chain metrics
node
Package node implements webapi node controller
Package node implements webapi node controller
requests
Package requests handles off-ledger requests
Package requests handles off-ledger requests
users
Package users implements the webapi user methods
Package users implements the webapi user methods
Package corecontracts provides methods for the webapi to interact with core contracts
Package corecontracts provides methods for the webapi to interact with core contracts
Package dto implements the webapi dto
Package dto implements the webapi dto
Package httpserver is an almost 1:1 copy (few removals) from inx-app https://github.com/iotaledger/inx-app/blob/428f260abc503227439635b4a9aea5b12b0317c2/pkg/httpserver/http_server.go To get around the additional dependencies
Package httpserver is an almost 1:1 copy (few removals) from inx-app https://github.com/iotaledger/inx-app/blob/428f260abc503227439635b4a9aea5b12b0317c2/pkg/httpserver/http_server.go To get around the additional dependencies
Package interfaces defines interfaces for various webapi systems
Package interfaces defines interfaces for various webapi systems
Package models implements VM models for the webapi
Package models implements VM models for the webapi
Package params defines parameters for webapi keys
Package params defines parameters for webapi keys
Package routes provides the webapi routes
Package routes provides the webapi routes
Package services defines the services for the evm backend in the webapi
Package services defines the services for the evm backend in the webapi
Package websocket implements the webapi websocket connection
Package websocket implements the webapi websocket connection
commands
Package commands defines websocket commands
Package commands defines websocket commands

Jump to

Keyboard shortcuts

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