api

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 42 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultMaxConnections       = 128
	DefaultRateLimiterCacheSize = 64 * 1024 // 64 KB
	DefaultRateLimiterRPS       = 1
	DefaultRateLimiterBurst     = 1
)

Variables

This section is empty.

Functions

func CreateHeadersMiddleware added in v0.9.0

func CreateHeadersMiddleware(headers map[string]string) func(next http.Handler) http.Handler

func JsonContentTypeMiddleware added in v0.9.0

func JsonContentTypeMiddleware(next http.Handler) http.Handler

func Run

func Run(ctx context.Context, address string, n *NodeApi, opts *RunOptions) error

Types

type App

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

func NewApp

func NewApp(apiKey string, scheduler SchedulerEmits, services services.Services,
	cfg *settings.BlockchainSettings) (*App, error)

func (*App) Accounts added in v0.7.0

func (a *App) Accounts() ([]account, error)

func (*App) AddrByAlias added in v0.10.5

func (a *App) AddrByAlias(alias proto.Alias) (proto.Address, error)

func (*App) Addresses added in v0.9.0

func (a *App) Addresses() ([]string, error)

func (*App) AliasesByAddr added in v0.10.5

func (a *App) AliasesByAddr(addr proto.WavesAddress) ([]proto.Alias, error)

func (*App) AssetsDetails added in v0.10.5

func (a *App) AssetsDetails(fullAssetsIDs []crypto.Digest, full bool) ([]AssetDetails, error)

func (*App) AssetsDetailsByID added in v0.10.5

func (a *App) AssetsDetailsByID(fullAssetID crypto.Digest, full bool) (*AssetDetails, error)

func (*App) Block added in v0.10.4

func (a *App) Block(id proto.BlockID) (*proto.Block, error)

func (*App) BlockByHeight added in v0.10.4

func (a *App) BlockByHeight(height proto.Height) (*proto.Block, error)

func (*App) BlockIDToHeight added in v0.10.4

func (a *App) BlockIDToHeight(id proto.BlockID) (proto.Height, error)

func (*App) BlocksFirst

func (a *App) BlocksFirst() (*Block, error)

func (*App) BlocksGenerators

func (a *App) BlocksGenerators() (Generators, error)

func (*App) BlocksHeadersAt added in v0.10.2

func (a *App) BlocksHeadersAt(h proto.Height) (*Block, error)

func (*App) BlocksHeadersByID added in v0.10.2

func (a *App) BlocksHeadersByID(id proto.BlockID) (*Block, error)

func (*App) BlocksHeadersFromTo added in v0.10.2

func (a *App) BlocksHeadersFromTo(from, to proto.Height) ([]*Block, error)

func (*App) BlocksHeadersLast added in v0.10.2

func (a *App) BlocksHeadersLast() (*Block, error)

func (*App) BlocksLast

func (a *App) BlocksLast() (*Block, error)

func (*App) BlocksScoreAt

func (a *App) BlocksScoreAt(at proto.Height) (Score, error)

func (*App) DebugSyncEnabled added in v0.5.0

func (a *App) DebugSyncEnabled(enabled bool)

func (*App) EthereumDAppMethods added in v0.10.0

func (a *App) EthereumDAppMethods(addr proto.WavesAddress) (ethabi.MethodsMap, error)

func (*App) LoadKeys added in v0.5.0

func (a *App) LoadKeys(apiKey string, password []byte) error

func (*App) Miner

func (a *App) Miner() MinerInfo

func (*App) PeersAll

func (a *App) PeersAll() (PeersKnown, error)

PeersAll is a list of all known not banned, not suspended and not blacklisted peers with a publicly available declared address.

func (*App) PeersBlackListed added in v0.10.2

func (a *App) PeersBlackListed() []RestrictedPeerInfo

func (*App) PeersClearBlackList added in v0.10.2

func (a *App) PeersClearBlackList() PeersClearBlackListResponse

func (*App) PeersConnect

func (a *App) PeersConnect(ctx context.Context, apiKey string, addr string) (*PeersConnectResponse, error)

func (*App) PeersConnected

func (a *App) PeersConnected() PeersConnectedResponse

func (*App) PeersKnown added in v0.9.0

func (a *App) PeersKnown() (PeersKnown, error)

func (*App) PeersSpawned

func (a *App) PeersSpawned() PeersSpawnedResponse

func (*App) PeersSuspended

func (a *App) PeersSuspended() []RestrictedPeerInfo

func (*App) PoolTransactions added in v0.5.0

func (a *App) PoolTransactions() int

func (*App) RollbackToHeight added in v0.5.0

func (a *App) RollbackToHeight(apiKey string, height proto.Height) error

TODO Here should be internal message with rollback action

func (*App) TransactionsBroadcast

func (a *App) TransactionsBroadcast(ctx context.Context, b []byte) (proto.Transaction, error)

func (*App) WalletSeeds added in v0.10.5

func (a *App) WalletSeeds() []string

WalletSeeds returns wallet seeds in base58 encoding.

func (*App) WavesRegularBalanceByAddress added in v0.11.0

func (a *App) WavesRegularBalanceByAddress(addr proto.WavesAddress) (WavesRegularBalance, error)

type AssetDetails added in v0.10.5

type AssetDetails struct {
	AssetId              crypto.Digest      `json:"assetId"`
	IssueHeight          proto.Height       `json:"issueHeight"`
	IssueTimestamp       proto.Timestamp    `json:"issueTimestamp,omitempty"`
	Issuer               proto.WavesAddress `json:"issuer"`
	IssuerPublicKey      crypto.PublicKey   `json:"issuerPublicKey"`
	Name                 string             `json:"name"`
	Description          string             `json:"description"`
	Decimals             byte               `json:"decimals"`
	Reissuable           bool               `json:"reissuable"`
	Quantity             uint64             `json:"quantity"`
	Scripted             bool               `json:"scripted"`
	MinSponsoredAssetFee *uint64            `json:"minSponsoredAssetFee"`
	OriginTransactionId  proto.B58Bytes     `json:"originTransactionId,omitempty"`
	SequenceInBlock      uint32             `json:"sequenceInBlock"`
	ScriptDetails        *ScriptDetails     `json:"scriptDetails,omitempty"`
}

type AuthError

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

AuthError represents an authentication error or problem. Deprecated: don't use this error type in new code. Create a new error type or value in 'pkg/api/errors' package.

func (*AuthError) Error added in v0.10.5

func (e *AuthError) Error() string

type Block added in v0.10.0

type Block struct {
	*proto.Block
	Generator proto.WavesAddress `json:"generator"`
	Height    proto.Height       `json:"height"`
}

type ErrorHandler added in v0.9.0

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

func NewErrorHandler added in v0.9.0

func NewErrorHandler(logger *slog.Logger) ErrorHandler

func (*ErrorHandler) Handle added in v0.9.0

func (eh *ErrorHandler) Handle(w http.ResponseWriter, r *http.Request, err error)

type Generator

type Generator struct {
	Height proto.Height     `json:"height"`
	PubKey crypto.PublicKey `json:"pub_key"`
}

type Generators

type Generators []Generator

type HandleErrorFunc added in v0.9.0

type HandleErrorFunc func(w http.ResponseWriter, r *http.Request, err error)

type HandlerFunc added in v0.9.0

type HandlerFunc func(w http.ResponseWriter, r *http.Request) error

func WalletLoadKeys added in v0.5.0

func WalletLoadKeys(app walletLoadKeys) HandlerFunc

type MinerInfo

type MinerInfo struct {
	Scheduler Scheduler
}

type Next

type Next struct {
	PublicKey crypto.PublicKey `json:"public_key"`
	Time      time.Time        `json:"time"`
}

type NodeApi

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

func NewNodeAPI added in v0.11.0

func NewNodeAPI(app *App, state state.State) *NodeApi

func (*NodeApi) AddrByAlias added in v0.10.5

func (a *NodeApi) AddrByAlias(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) Addresses added in v0.9.0

func (a *NodeApi) Addresses(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) AliasesByAddr added in v0.10.5

func (a *NodeApi) AliasesByAddr(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) AssetsDetailsByID added in v0.10.5

func (a *NodeApi) AssetsDetailsByID(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) AssetsDetailsByIDsGet added in v0.10.5

func (a *NodeApi) AssetsDetailsByIDsGet(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) AssetsDetailsByIDsPost added in v0.10.5

func (a *NodeApi) AssetsDetailsByIDsPost(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlockAt

func (a *NodeApi) BlockAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlockHeadersID added in v0.10.2

func (a *NodeApi) BlockHeadersID(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlockHeight

func (a *NodeApi) BlockHeight(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) BlockHeightByID added in v0.10.4

func (a *NodeApi) BlockHeightByID(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlockIDAt added in v0.5.0

func (a *NodeApi) BlockIDAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlockScoreAt

func (a *NodeApi) BlockScoreAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlocksFirst

func (a *NodeApi) BlocksFirst(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) BlocksGenerators

func (a *NodeApi) BlocksGenerators(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) BlocksHeadersAt added in v0.10.2

func (a *NodeApi) BlocksHeadersAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlocksHeadersLast added in v0.10.2

func (a *NodeApi) BlocksHeadersLast(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) BlocksHeadersSeqFromTo added in v0.10.2

func (a *NodeApi) BlocksHeadersSeqFromTo(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) BlocksLast

func (a *NodeApi) BlocksLast(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) BlocksSnapshotAt added in v0.11.0

func (a *NodeApi) BlocksSnapshotAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) EthereumDAppABI added in v0.10.0

func (a *NodeApi) EthereumDAppABI(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) FinalizedHeader added in v0.11.0

func (a *NodeApi) FinalizedHeader(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) FinalizedHeight added in v0.11.0

func (a *NodeApi) FinalizedHeight(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) GeneratorsAt added in v0.11.0

func (a *NodeApi) GeneratorsAt(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) GoMinerInfo added in v0.9.0

func (a *NodeApi) GoMinerInfo(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) NodeStatus added in v0.10.5

func (a *NodeApi) NodeStatus(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersAll

func (a *NodeApi) PeersAll(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersBlackListed added in v0.10.2

func (a *NodeApi) PeersBlackListed(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersClearBlackList added in v0.10.2

func (a *NodeApi) PeersClearBlackList(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersConnect

func (a *NodeApi) PeersConnect(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) PeersConnected

func (a *NodeApi) PeersConnected(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersKnown added in v0.9.0

func (a *NodeApi) PeersKnown(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersSpawned

func (a *NodeApi) PeersSpawned(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) PeersSuspended

func (a *NodeApi) PeersSuspended(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) RollbackTo added in v0.11.0

func (a *NodeApi) RollbackTo(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) RollbackToHeight added in v0.11.0

func (a *NodeApi) RollbackToHeight(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) TransactionInfo added in v0.10.1

func (a *NodeApi) TransactionInfo(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) TransactionsBroadcast

func (a *NodeApi) TransactionsBroadcast(w http.ResponseWriter, r *http.Request) error

func (*NodeApi) WalletAccounts added in v0.7.0

func (a *NodeApi) WalletAccounts(w http.ResponseWriter, _ *http.Request) error

func (*NodeApi) WavesRegularBalanceByAddress added in v0.11.0

func (a *NodeApi) WavesRegularBalanceByAddress(w http.ResponseWriter, r *http.Request) error

type Peer

type Peer struct {
	Address  string `json:"address"`
	LastSeen uint64 `json:"lastSeen,omitempty"`
}

type PeerInfo added in v0.9.0

type PeerInfo struct {
	Address            string `json:"address"`
	DeclaredAddress    string `json:"declaredAddress"`
	PeerName           string `json:"peerName"`
	PeerNonce          uint64 `json:"peerNonce"`
	ApplicationName    string `json:"applicationName"`
	ApplicationVersion string `json:"applicationVersion"`
}

type PeersClearBlackListResponse added in v0.10.2

type PeersClearBlackListResponse struct {
	Result string `json:"result"`
}

type PeersConnectRequest

type PeersConnectRequest struct {
	Host string `json:"host"`
	Port uint16 `json:"port"`
}

type PeersConnectResponse

type PeersConnectResponse struct {
	Hostname string `json:"hostname"`
	Status   string `json:"status"`
}

type PeersConnectedResponse

type PeersConnectedResponse struct {
	Peers []PeerInfo `json:"peers"`
}

type PeersKnown added in v0.9.0

type PeersKnown struct {
	Peers []Peer `json:"peers"`
}

type PeersSpawnedResponse

type PeersSpawnedResponse struct {
	Peers []proto.IpPort `json:"peers"`
}

type RateLimiterOptions added in v0.9.0

type RateLimiterOptions struct {
	MemoryCacheSize      int
	MaxRequestsPerSecond int
	MaxBurst             int
}

func DefaultRateLimiterOptions added in v0.10.6

func DefaultRateLimiterOptions() *RateLimiterOptions

func NewRateLimiterOptionsFromString added in v0.10.6

func NewRateLimiterOptionsFromString(s string) (*RateLimiterOptions, error)

type RestrictedPeerInfo added in v0.10.2

type RestrictedPeerInfo struct {
	Hostname  string `json:"hostname"`
	Timestamp int64  `json:"timestamp"` // nickeskov: timestamp in millis
	Reason    string `json:"reason,omitempty"`
}

type RunOptions added in v0.9.0

type RunOptions struct {
	RateLimiterOpts      *RateLimiterOptions
	LogHttpRequestOpts   bool
	CollectMetrics       bool
	UseRealIPMiddleware  bool
	RequestIDMiddleware  bool
	EnableHeartbeatRoute bool
	RouteNotFoundHandler func(w http.ResponseWriter, r *http.Request)
	MaxConnections       int
	EnableMetaMaskAPI    bool
	EnableMetaMaskAPILog bool
}

func DefaultRunOptions added in v0.9.0

func DefaultRunOptions() *RunOptions

type Scheduler

type Scheduler struct {
	TimeNow time.Time `json:"time_now"`
	Next    []Next    `json:"next"`
}

type SchedulerEmits

type SchedulerEmits interface {
	Emits() []scheduler.Emit
}

type Score

type Score struct {
	Score string `json:"score"`
}

type ScriptDetails added in v0.10.5

type ScriptDetails struct {
	ScriptComplexity uint64         `json:"scriptComplexity"`
	Script           proto.B64Bytes `json:"script"`
}

type WavesRegularBalance added in v0.11.0

type WavesRegularBalance struct {
	Address       proto.WavesAddress `json:"address"`
	Balance       uint64             `json:"balance"`
	Confirmations uint64             `json:"confirmations"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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