api

package
v0.73.7-preview.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: AGPL-3.0 Imports: 54 Imported by: 0

README

Conventions Followed in datanode/api Code Implementation

Errors

For all types of errors that are handled in the datanode/api scope, please use errors part of the package. Example:

return nil, apiError(codes.InvalidArgument, ErrMalformedRequest)

The purpose is to have a common way of handling error reporting outside of the core component and keep them clean and simple. Some gradual refactoring work on places where the above is not yet applied is welcomed, though as a friendly and respectful reminder - please consider not breaking the current state.

Documentation

Overview

Package api contains code for running the gRPC server.

In order to add a new gRPC endpoint, add proto content (rpc call, request and response messages), then add the endpoint function implementation in `api/somefile.go`. Example:

func (s *tradingService) SomeNewEndpoint(
    ctx context.Context, req *protoapi.SomeNewEndpointRequest,
) (*protoapi.SomeNewEndpointResponse, error) {
    /* Implementation goes here */
    return &protoapi.SomeNewEndpointResponse{/* ... */}, nil
}

Add a test for the newly created endpoint in `api/trading_test.go`.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTrustedProxy indactes a forwarded request that did not pass through a trusted proxy.
	ErrNoTrustedProxy = errors.New("forwarded requests need to pass through a trusted proxy")
	// ErrChannelClosed signals that the channel streaming data is closed.
	ErrChannelClosed = errors.New("channel closed")
	// ErrNotAValidVegaID signals an invalid id.
	ErrNotAValidVegaID = newInvalidArgumentError("not a valid vega id")
	// ErrMissingResourceID signals to the caller that the request expected a
	// resource id but the field is missing or empty.
	ErrMissingResourceID = newInvalidArgumentError("missing resource ID")
	// ErrEmptyMissingMarketID signals to the caller that the request expected a
	// market id but the field is missing or empty.
	ErrEmptyMissingMarketID = newInvalidArgumentError("empty or missing market ID")
	// ErrInvalidMarketID signals to the caller that the request expected a
	// market id but the field is not in the right format.
	ErrInvalidMarketID = newInvalidArgumentError("invalid market ID")
	// ErrMissingPrice signals to the caller that the request expected a price.
	ErrMissingPrice = newInvalidArgumentError("missing price")
	// ErrInvalidOrderPrice signals to the caller that the request expected a valid price.
	ErrInvalidOrderPrice = newInvalidArgumentError("invalid order price")
	// ErrInvalidOrderSize signals to the caller that the request expected a valid size.
	ErrInvalidOrderSize = newInvalidArgumentError("invalid order size")
	// ErrServerShutdown signals to the client that the server  is shutting down.
	ErrServerShutdown = errors.New("server shutdown")
	// ErrStreamClosed signals to the users that the grpc stream is closing.
	ErrStreamClosed = errors.New("stream closed")
	// ErrStreamInternal signals to the users that the grpc stream has an internal problem.
	ErrStreamInternal = errors.New("internal stream failure")
	// ErrNotMapped is when an error cannot be found in the current error map/lookup table.
	ErrNotMapped = errors.New("error not found in error lookup table")
	// ErrMissingPartyID signals that the payload is expected to contain a party id.
	ErrMissingPartyID = newInvalidArgumentError("missing party id")
	// ErrInvalidPartyID signals that the given party id is not a valid ID.
	ErrInvalidPartyID = newInvalidArgumentError("invalid party id")
	// ErrInvalidPagination signals that the pagination is invalid.
	ErrInvalidPagination = newInvalidArgumentError("invalid pagination")
	// ErrInvalidCandleID signals an invalid candle ID submitted.
	ErrInvalidCandleID = newInvalidArgumentError("invalid candle id")
	// ErrInvalidCandleTimestampsRange signals an impossible range with the candle timestamps.
	ErrInvalidCandleTimestampsRange = newInvalidArgumentError("invalid candle timestamps range")
	// ErrInvalidFilter signals that the filter is invalid.
	ErrInvalidFilter = newInvalidArgumentError("invalid filter")
	// ErrMalformedRequest signals that the request was malformed.
	ErrMalformedRequest = newInvalidArgumentError("malformed request")
	// ErrMissingOrderID signals that an order ID was required but not specified.
	ErrMissingOrderID = newInvalidArgumentError("missing orderID parameter")
	// ErrInvalidOrderID signals that an order ID provided was not a valid ID.
	ErrInvalidOrderID = newInvalidArgumentError("invalid orderID parameter")
	// ErrMissingCandleID returned if candle with this id is missing.
	ErrMissingCandleID = newInvalidArgumentError("candle id is a required parameter")
	// ErrMissingProposalID returned if proposal with this id is missing.
	ErrMissingProposalID = newInvalidArgumentError("proposal id is a required parameter")
	// ErrMissingProposalIDAndPartyID returned if proposal id and party id is missing.
	ErrMissingProposalIDAndPartyID = newInvalidArgumentError("missing proposal id and party id")
	// ErrMissingProposalIDOrPartyID returned if proposal id and party id is missing.
	ErrMissingProposalIDOrPartyID = newInvalidArgumentError("missing proposal id or party id")
	// ErrMissingProposalIDOrReference returned if proposal id or reference is missing.
	ErrMissingProposalIDOrReference = newInvalidArgumentError("missing proposal ID or reference")
	// ErrInvalidProposalID returned if proposal id is invalid.
	ErrInvalidProposalID = newInvalidArgumentError("invalid proposal id")
	// ErrMissingWithdrawalID is returned when the withdrawal ID is missing from the request.
	ErrMissingWithdrawalID = newInvalidArgumentError("missing withdrawal ID")
	// ErrInvalidWithdrawalID is returned when the withdrawal ID is not a valid vega ID.
	ErrInvalidWithdrawalID = newInvalidArgumentError("invalid withdrawal ID")
	// ErrMissingOracleSpecID is returned when the ID is missing from the request.
	ErrMissingOracleSpecID = newInvalidArgumentError("missing oracle spec ID")
	// ErrInvalidOracleSpecID is returned when the ID is not a valid ID.
	ErrInvalidOracleSpecID = newInvalidArgumentError("invalid oracle spec ID")
	// ErrMissingDepositID is returned when the deposit ID is missing from the request.
	ErrMissingDepositID = newInvalidArgumentError("missing deposit ID")
	// ErrMissingAssetID is returned when the Asset ID is missing from the request.
	ErrMissingAssetID = newInvalidArgumentError("missing asset ID")
	// ErrInvalidAssetID is returned when the Asset ID is not a valid ID.
	ErrInvalidAssetID = newInvalidArgumentError("invalid asset ID")
	// ErrMissingNodeID is returned when the node ID is missing from the request.
	ErrMissingNodeID = newInvalidArgumentError("missing node id")
	// ErrNegativeOrderVersion is returned when a request is made for an
	// order with a negative version.
	ErrNegativeOrderVersion = newInvalidArgumentError("negative order version")
	// ErrLastPaginationNotSupported is returned when last pagination is not supported.
	ErrLastPaginationNotSupported = newInvalidArgumentError("'last' pagination is not supported")

	// ErrOracleServiceSpecID is returned when there was no data found for the given ID.
	ErrOracleServiceGetSpec = errors.New("failed to retrieve data for oracle spec")
	// ErrERC20InvalidTokenContractAddress is returned when the ERC20 token contract address is invalid.
	ErrERC20InvalidTokenContractAddress = errors.New("invalid erc20 token contract address")
	ErrSendingGRPCHeader                = errors.New("failed to send header")
	ErrEstimateFee                      = errors.New("failed to estimate fee")
	ErrEstimateMargin                   = errors.New("failed to estimate margin")
	// OrderService...
	ErrOrderServiceGetOrders        = errors.New("failed to get orders")
	ErrOrderServiceGetVersions      = errors.New("failed to get order versions")
	ErrOrderNotFound                = errors.New("order not found")
	ErrOrderServiceGetByMarket      = errors.New("failed to get orders for market")
	ErrOrderServiceGetByMarketAndID = errors.New("failed to get orders for market and ID")
	ErrOrderServiceGetByParty       = errors.New("failed to get orders for party")
	ErrOrderServiceGetByReference   = errors.New("failed to get orders for reference")
	ErrOrderServiceGetByTxHash      = errors.New("failed to get orders for tx hash")
	ErrMissingOrderIDParameter      = errors.New("missing orderID parameter")
	// NodeService...
	ErrNodeServiceGetNodes    = errors.New("failed to get nodes")
	ErrNodeServiceGetNodeData = errors.New("failed to get node data")
	ErrNodeServiceGetByTxHash = errors.New("failed to get nodes for tx hash")
	// TradeService...
	ErrTradeServiceGetByParty          = errors.New("failed to get trades for party")
	ErrTradeServiceGetByMarket         = errors.New("failed to get trades for market")
	ErrTradeServiceList                = errors.New("failed to list trades")
	ErrTradeServiceGetPositionsByParty = errors.New("failed to get positions for party")
	ErrTradeServiceGetByOrderID        = errors.New("failed to get trades for order ID")
	ErrTradeServiceGetByTxHash         = errors.New("failed to get trades for tx hash")
	// MarketService...
	ErrMarketServiceGetByID              = errors.New("failed to get market for ID")
	ErrMarketServiceGetAllPaged          = errors.New("failed to get all markets paged")
	ErrMarketServiceGetMarketData        = errors.New("failed to get market data")
	ErrMarketServiceGetMarketDataHistory = errors.New("failed to get market data history")
	ErrMarketServiceGetMarkets           = errors.New("failed to get markets")
	ErrMarketServiceGetByTxHash          = errors.New("failed to get orders for tx hash")
	ErrMarketServiceGetDepth             = errors.New("failed to get market depth")
	// AccountService...
	ErrAccountServiceListAccounts        = errors.New("failed to get accounts")
	ErrFailedToSendSnapshot              = errors.New("failed to send accounts snapshot")
	ErrAccountServiceGetBalances         = errors.New("failed to get balances")
	ErrAccountServiceGetByTxHash         = errors.New("failed to get accounts for tx hash")
	ErrAccountServiceGetBalancesByTxHash = errors.New("failed to get balances for tx hash")
	// DelegationService...
	ErrDelegationServiceGet = errors.New("failed to get delegation")
	// SummaryService...
	ErrSummaryServiceGet = errors.New("failed to get summary")
	// WithdrawalService...
	ErrWithdrawalServiceGet = errors.New("failed to get withdrawal")
	// PositionService...
	ErrPositionServiceGetByParty   = errors.New("failed to get positions for party")
	ErrPositionServiceSendSnapshot = errors.New("failed to send positions snapshot")
	// RiskService...
	ErrRiskServiceGetMarginLevelsByID = errors.New("failed to get margin levels")
	ErrInvalidOrderSide               = newInvalidArgumentError("invalid order side")
	// RiskFactorService...
	ErrRiskFactorServiceGet = errors.New("failed to get risk factor")
	// GovernanceService...
	ErrGovernanceServiceGet          = errors.New("failed to get proposal")
	ErrGovernanceServiceGetProposals = errors.New("failed to get proposals")
	ErrGovernanceServiceGetVotes     = errors.New("failed to get votes")
	// CandleService...
	ErrCandleServiceGetCandleData       = errors.New("failed to get candle data")
	ErrCandleServiceSubscribeToCandles  = errors.New("failed to subscribe to candle data")
	ErrCandleServiceGetCandlesForMarket = errors.New("failed to get candles for market")
	// PartyService...
	ErrPartyServiceGetAll      = errors.New("failed to get parties")
	ErrPartyServiceGetByID     = errors.New("failed to get party for ID")
	ErrPartyServiceGetByTxHash = errors.New("failed to get parties for tx hash")
	// NotaryService...
	ErrNotaryServiceGetByResourceID = errors.New("failed to get notary for resource ID")
	// OracleSpecService...
	// ErrOracleSpecServiceGet is returned when there was no data found for the given ID.
	ErrOracleSpecServiceGet = errors.New("failed retrieve data for oracle spec")
	// ErrOracleSpecServiceGetAll is returned when there was no data found for the given ID.
	ErrOracleSpecServiceGetAll = errors.New("failed retrieve data for oracle specs")
	// OracleDataService...
	// ErrOracleDataServiceGet is returned when there was no data found for the given ID.
	ErrOracleDataServiceGet = errors.New("failed retrieve data for oracle data")
	// AssetService...
	ErrAssetServiceGetAll            = errors.New("failed to get assets")
	ErrAssetServiceGetByID           = errors.New("failed to get asset for ID")
	ErrScalingPriceFromMarketToAsset = errors.New("failed to scale price from market to asset")
	// DepositService...
	ErrDepositServiceGet = errors.New("failed to get deposit")
	// TransferService...
	ErrTransferServiceGet = errors.New("failed to get transfer")
	ErrMissingTransferID  = errors.New("missing transfer id")
	// NetworkLimits...
	ErrGetNetworkLimits = errors.New("failed to get network limits")
	// ErrGetNetworkParameters is returned when the network parameters cannot be retrieved.
	ErrGetNetworkParameters = errors.New("failed to get network parameters")
	// Network History...
	ErrGetConnectedPeerAddresses = errors.New("failed to get connected peer addresses")
	// TimeService...
	ErrTimeServiceGetTimeNow = errors.New("failed to get time now")
	// Blockchain...
	ErrBlockchainBacklogLength = errors.New("failed to get backlog length from blockchain")
	ErrBlockchainNetworkInfo   = errors.New("failed to get network info from blockchain")
	ErrBlockchainGenesisTime   = errors.New("failed to get genesis time from blockchain")
	ErrBlockchainChainID       = errors.New("failed to get chain ID from blockchain")
	// Rewards.
	ErrGetRewards         = errors.New("failed to get rewards")
	ErrRewardsGetByTxHash = errors.New("failed to get rewards for tx hash")
	// Network History.
	ErrGetActivePeerAddresses              = errors.New("failed to get active peer addresses")
	ErrGetMostRecentHistorySegment         = errors.New("failed to get most recent history segment")
	ErrListAllNetworkHistorySegment        = errors.New("failed to list all history segments")
	ErrFetchNetworkHistorySegment          = errors.New("failed to fetch segment")
	ErrNetworkHistoryNotEnabled            = errors.New("network history not enabled")
	ErrCopyHistorySegmentToFile            = errors.New("failed to copy history segment to file")
	ErrGetIpfsAddress                      = errors.New("failed to get node's ipfs address")
	ErrNetworkHistoryNoTableName           = errors.New("no table name for network history supplied")
	ErrNetworkHistoryGetContiguousSegments = newInvalidArgumentError("could not to get contiguous history segments")
	ErrNetworkHistoryOpeningSegment        = errors.New("failed to open network history segment file")
	ErrNetworkHistoryExtractingSegment     = errors.New("failed to extract data from network history segment file")
	ErrNetworkHistoryCreatingZipFile       = errors.New("failed to create zip file writer for network history segment")
	ErrNetworkHistoryServiceNotInitialised = errors.New("network history service not initialised")

	// ErrGetEpoch is returned when the epoch cannot be retrieved.
	ErrGetEpoch     = errors.New("failed to get epoch")
	ErrEpochIDParse = newInvalidArgumentError("failed to parse epoch id")
	// LedgerService...
	ErrLedgerServiceGet    = errors.New("failed to query ledger entries")
	ErrLedgerServiceExport = errors.New("failed to export ledger entries")
	// MultiSigService...
	ErrMultiSigServiceGetAdded   = errors.New("failed to get added multisig events")
	ErrMultiSigServiceGetRemoved = errors.New("failed to get removed multisig events")
	// LiquidityProvisionService...
	ErrLiquidityProvisionServiceGet          = errors.New("failed to get liquidity provision")
	ErrLiquidityProvisionServiceGetProviders = errors.New("failed to get liquidity providers")
	// CheckpointService...
	ErrCheckpointServiceGet = errors.New("failed to get checkpoint")
	// StakeLinkingService...
	ErrStakeLinkingServiceGet = errors.New("failed to get stake linking")
	// CoreSnapshotService...
	ErrCoreSnapshotServiceListSnapshots = errors.New("failed to list core snapshots")
	// ProtocolUpgradeService...
	ErrProtocolUpgradeServiceListProposals = errors.New("failed to list protocol upgrade proposals")
	// KeyRotationService...
	ErrKeyRotationServiceGetPerNode = errors.New("failed to get key rotations for node")
	ErrKeyRotationServiceGetAll     = errors.New("failed to get all key rotations")
	// EthereumKeyRotationService...
	ErrEthereumKeyRotationServiceGetPerNode = errors.New("failed to get ethereum key rotations for node")
	ErrEthereumKeyRotationServiceGetAll     = errors.New("failed to get all ethereum key rotations")
	// BlockService...
	ErrBlockServiceGetLast = errors.New("failed to get last block")
	// Positions...
	ErrPositionsGetByTxHash             = errors.New("failed to get positions for tx hash")
	ErrPositionsInvalidCollateralAmount = newInvalidArgumentError("invalid collateral amount")
	// Ledger entries...
	ErrLedgerEntriesGetByTxHash = errors.New("failed to get ledger entries for tx hash")
	// Transfers...
	ErrTransfersGetByTxHash = errors.New("failed to get transfers for tx hash")
	// Votes...
	ErrVotesGetByTxHash = errors.New("failed to get votes for tx hash")
	// ERC20MultiSigSignerEvents...
	ErrERC20MultiSigSignerAddedEventGetByTxHash   = errors.New("failed to get ERC20 multisig signer add events for tx hash")
	ErrERC20MultiSigSignerRemovedEventGetByTxHash = errors.New("failed to get ERC20 multisig signer removed events for tx hash")
	// Oracles...
	ErrOracleSpecGetByTxHash = errors.New("failed to get oracle spec for tx hash")
	ErrOracleDataGetByTxHash = errors.New("failed to get oracle data for tx hash")
	// Deposits...
	ErrDepositsGetByTxHash = errors.New("failed to get deposits for tx hash")
	// Withdrawals...
	ErrWithdrawalsGetByTxHash = errors.New("failed to get withdrawals for tx hash")
	// Assets...
	ErrAssetsGetByTxHash = errors.New("failed to get assets for tx hash")
	// Liquidity provision...
	ErrLiquidityProvisionGetByTxHash = errors.New("failed to get liquidity provision for tx hash")
	// Proposals...
	ErrProposalsGetByTxHash = errors.New("failed to get proposals for tx hash")
	// Delegations...
	ErrDelegationsGetByTxHash = errors.New("failed to get delegations for tx hash")
	// Signatures...
	ErrSignaturesGetByTxHash = errors.New("failed to get signatures for tx hash")
	// NetworkParamaters...
	ErrNetworkParametersGetByTxHash = errors.New("failed to get network parameters for tx hash")
	ErrNetworkParameterNotFound     = errors.New("network parameter not found")

	// KeyRotations...
	ErrKeyRotationsGetByTxHash = errors.New("failed to get key rotations for tx hash")
	// EthereumKeyRotations...
	ErrEthereumKeyRotationsGetByTxHash = errors.New("failed to get ethereum key rotations for tx hash")
	// ProtocolUpgradeProposals...
	ErrProtocolUpgradeProposalsGetByTxHash = errors.New("failed to get protocol upgrade proposals for tx hash")
	// MarginLevels...
	ErrMarginLevelsGetByTxHash = errors.New("failed to get margin levels for tx hash")

	// TxHashes...
	ErrMissingEmptyTxHash = newInvalidArgumentError("missing or empty transaction hash")
	ErrInvalidTxHash      = newInvalidArgumentError("not a valid transaction hash")

	// Funding Periods.
	ErrListFundingPeriod           = errors.New("failed to get funding periods")
	ErrListFundingPeriodDataPoints = errors.New("failed to get funding period data points")

	// Referral Programs.
	ErrGetCurrentReferralProgram = errors.New("failed to get current referral program")
	ErrGetReferralSetStats       = errors.New("failed to get referral set stats")

	// Fees stats.
	ErrGetFeesStats             = errors.New("failed to get current fees stats")
	ErrFeesStatsRequest         = errors.New("marketID or assetID must be provided")
	ErrGetFeesStatsForParty     = errors.New("failed to get current fees stats for party")
	ErrFeesStatsForPartyRequest = errors.New("fromEpoch must be set when toEpoch is set")

	// Teams.
	ErrListTeams              = errors.New("failed to list teams")
	ErrListTeamReferees       = errors.New("failed to list team referees")
	ErrListTeamRefereeHistory = errors.New("failed to list team referee history")

	// Volume discount Programs.
	ErrGetCurrentVolumeDiscountProgram = errors.New("failed to get current volume discount program")
	ErrGetVolumeDiscountStats          = errors.New("failed to get volume discount stats")

	// Paid liquidity fees.
	ErrListPaidLiquidityFees = errors.New("failed to list paid liquidity fees")
)

API Errors and descriptions.

View Source
var FormatE = formatE

FormatE exports the formatE function (primarily for testing).

Functions

func ErrorMap

func ErrorMap() map[string]int32

ErrorMap returns a map of error to code, which is a mapping between API errors and Vega API specific numeric codes.

Types

type BlockService added in v0.56.0

type BlockService interface {
	GetLastBlock(ctx context.Context) (entities.Block, error)
}

BlockService ...

type Config

type Config struct {
	Level                    encoding.LogLevel `long:"log-level"`
	Timeout                  encoding.Duration `long:"timeout"`
	Port                     int               `long:"port"`
	WebUIPort                int               `long:"web-ui-port"`
	WebUIEnabled             encoding.Bool     `long:"web-ui-enabled"`
	Reflection               encoding.Bool     `long:"reflection"`
	IP                       string            `long:"ip"`
	StreamRetries            int               `long:"stream-retries"`
	CoreNodeIP               string            `long:"core-node-ip"`
	CoreNodeGRPCPort         int               `long:"core-node-grpc-port"`
	RateLimit                ratelimit.Config  `group:"rate-limits"`
	MaxSubscriptionPerClient uint32            `long:"max-subscription-per-client"`
}

Config represents the configuration of the api package.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.

type CoreServiceClient

type CoreServiceClient interface {
	protoapi.CoreServiceClient
}

CoreServiceClient ...

type EventService

type EventService interface {
	ObserveEvents(ctx context.Context, retries int, eTypes []events.Type, batchSize int, filters ...subscribers.EventFilter) (<-chan []*eventspb.BusEvent, chan<- int)
}

EventService ...

type GRPCServer

type GRPCServer struct {
	Config

	FeesStatsService *service.FeesStats
	// contains filtered or unexported fields
}

GRPCServer represent the grpc api provided by the vega node.

func NewGRPCServer

func NewGRPCServer(
	log *logging.Logger,
	config Config,
	coreServiceClient CoreServiceClient,
	eventService *subscribers.Service,
	orderService *service.Order,
	networkLimitsService *service.NetworkLimits,
	marketDataService *service.MarketData,
	tradeService *service.Trade,
	assetService *service.Asset,
	accountService *service.Account,
	rewardService *service.Reward,
	marketsService *service.Markets,
	delegationService *service.Delegation,
	epochService *service.Epoch,
	depositService *service.Deposit,
	withdrawalService *service.Withdrawal,
	governanceService *service.Governance,
	riskFactorService *service.RiskFactor,
	riskService *service.Risk,
	networkParameterService *service.NetworkParameter,
	blockService BlockService,
	checkpointService *service.Checkpoint,
	partyService *service.Party,
	candleService *candlesv2.Svc,
	oracleSpecService *service.OracleSpec,
	oracleDataService *service.OracleData,
	liquidityProvisionService *service.LiquidityProvision,
	positionService *service.Position,
	transferService *service.Transfer,
	stakeLinkingService *service.StakeLinking,
	notaryService *service.Notary,
	multiSigService *service.MultiSig,
	keyRotationService *service.KeyRotations,
	ethereumKeyRotationService *service.EthereumKeyRotation,
	nodeService *service.Node,
	marketDepthService *service.MarketDepth,
	ledgerService *service.Ledger,
	protocolUpgradeService *service.ProtocolUpgrade,
	networkHistoryService NetworkHistoryService,
	coreSnapshotService *service.SnapshotData,
	stopOrderService *service.StopOrders,
	fundingPeriodService *service.FundingPeriods,
	partyActivityStreak *service.PartyActivityStreak,
	referralProgramService *service.ReferralPrograms,
	referralSetsService *service.ReferralSets,
	teamsService *service.Teams,
	vestingStatsService *service.VestingStats,
	FeesStatsService *service.FeesStats,
	fundingPaymentService *service.FundingPayment,
	volumeDiscountStatsService *service.VolumeDiscountStats,
	volumeDiscountProgramService *service.VolumeDiscountPrograms,
	paidLiquidityFeesStatsService *service.PaidLiquidityFeesStats,
	partyLockedBalances *service.PartyLockedBalances,
	partyVestingBalances *service.PartyVestingBalances,
) *GRPCServer

NewGRPCServer create a new instance of the GPRC api for the vega node.

func (*GRPCServer) ReloadConf

func (g *GRPCServer) ReloadConf(cfg Config)

ReloadConf update the internal configuration of the GRPC server.

func (*GRPCServer) Start

func (g *GRPCServer) Start(ctx context.Context, lis net.Listener) error

Start starts the grpc server. Uses default TCP listener if no provided.

type NetworkHistoryService added in v0.67.0

type NetworkHistoryService interface {
	GetHighestBlockHeightHistorySegment() (segment.Full, error)
	ListAllHistorySegments() (segment.Segments[segment.Full], error)
	FetchHistorySegment(ctx context.Context, historySegmentID string) (segment.Full, error)
	GetActivePeerIPAddresses() []string
	CopyHistorySegmentToFile(ctx context.Context, historySegmentID string, outFile string) error
	GetHistorySegmentReader(ctx context.Context, historySegmentID string) (io.ReadSeekCloser, int64, error)
	GetSwarmKeySeed() string
	GetConnectedPeerAddresses() ([]string, error)
	GetIpfsAddress() (string, error)
	GetSwarmKey() string
	GetBootstrapPeers() []string
}

NetworkHistoryService ...

it would be nice to use go:generate go run github.com/golang/mock/mockgen -destination mocks/networkhistory_service_mock.go -package mocks code.vegaprotocol.io/vega/datanode/api NetworkHistoryService however it currently can't handle generic arguments and the generated code is not compilable without a bit of manual tweaking.

type TradingDataServiceV2 added in v0.71.0

type TradingDataServiceV2 struct {
	v2.UnimplementedTradingDataServiceServer

	NetworkHistoryService NetworkHistoryService
	// contains filtered or unexported fields
}

func (*TradingDataServiceV2) EstimateFee added in v0.71.0

EstimateFee estimates the fee for a given market, price and size.

func (*TradingDataServiceV2) EstimateMargin added in v0.71.0

EstimateMargin estimates the margin required for a given order.

func (*TradingDataServiceV2) EstimatePosition added in v0.71.0

func (*TradingDataServiceV2) ExportLedgerEntries added in v0.71.0

ExportLedgerEntries returns a list of ledger entries matching the request.

func (*TradingDataServiceV2) ExportNetworkHistory added in v0.71.0

-- NetworkHistory --.

func (*TradingDataServiceV2) GetActiveNetworkHistoryPeerAddresses added in v0.71.0

GetActiveNetworkHistoryPeerAddresses returns the active network history peer addresses.

func (*TradingDataServiceV2) GetAsset added in v0.71.0

GetAsset gets an asset by ID.

func (*TradingDataServiceV2) GetCurrentReferralProgram added in v0.73.0

func (*TradingDataServiceV2) GetCurrentVolumeDiscountProgram added in v0.73.0

func (*TradingDataServiceV2) GetDeposit added in v0.71.0

GetDeposit gets a deposit by ID.

func (*TradingDataServiceV2) GetERC20ListAssetBundle added in v0.71.0

func (*TradingDataServiceV2) GetERC20SetAssetLimitsBundle added in v0.71.0

GetERC20SetAssetLimitsBundle returns the signature bundle needed to update the asset limits on the ERC20 contract.

func (*TradingDataServiceV2) GetERC20WithdrawalApproval added in v0.71.0

GetERC20WithdrawalApproval returns the signature bundle needed to approve a withdrawal on the ERC20 contract.

func (*TradingDataServiceV2) GetEpoch added in v0.71.0

GetEpoch retrieves data for a specific epoch, if id omitted it gets the current epoch.

func (*TradingDataServiceV2) GetFeesStats added in v0.73.0

func (*TradingDataServiceV2) GetFeesStatsForParty added in v0.73.0

func (*TradingDataServiceV2) GetGovernanceData added in v0.71.0

GetGovernanceData gets governance data.

func (*TradingDataServiceV2) GetLastTrade added in v0.71.0

GetLastTrade returns the last trade for a given market.

func (*TradingDataServiceV2) GetLatestMarketData added in v0.71.0

GetLatestMarketData returns the latest market data for a given market.

func (*TradingDataServiceV2) GetLatestMarketDepth added in v0.71.0

GetLatestMarketDepth returns the latest market depth for a given market.

func (*TradingDataServiceV2) GetMarket added in v0.71.0

GetMarket returns a market by its ID.

func (*TradingDataServiceV2) GetMarketDataHistoryByID added in v0.71.0

GetMarketDataHistoryByID returns the market data history for a given market.

func (*TradingDataServiceV2) GetMostRecentNetworkHistorySegment added in v0.71.0

GetMostRecentNetworkHistorySegment returns the most recent network history segment.

func (*TradingDataServiceV2) GetNetworkData added in v0.71.0

GetNetworkData retrieve network data regarding the nodes of the network.

func (*TradingDataServiceV2) GetNetworkHistoryBootstrapPeers added in v0.71.3

NetworkHistoryBootstrapPeers returns the network history bootstrap peers.

func (*TradingDataServiceV2) GetNetworkHistoryStatus added in v0.71.3

NetworkHistoryStatus returns the network history status.

func (*TradingDataServiceV2) GetNetworkLimits added in v0.71.0

GetNetworkLimits returns the latest network limits.

func (*TradingDataServiceV2) GetNetworkParameter added in v0.71.0

GetNetworkParameter returns a network parameter by key.

func (*TradingDataServiceV2) GetNode added in v0.71.0

GetNode retrieves information about a given node.

func (*TradingDataServiceV2) GetOracleSpec added in v0.71.0

GetOracleSpec gets an oracle spec by ID.

func (*TradingDataServiceV2) GetOrder added in v0.71.0

GetOrder gets an order by ID.

func (*TradingDataServiceV2) GetParty added in v0.71.0

GetParty returns a Party by ID.

func (*TradingDataServiceV2) GetPartyActivityStreak added in v0.73.0

func (*TradingDataServiceV2) GetPartyVestingStats added in v0.73.0

func (*TradingDataServiceV2) GetProtocolUpgradeStatus added in v0.71.0

GetProtocolUpgradeStatus returns the status of the protocol upgrade process.

func (*TradingDataServiceV2) GetReferralSetStats added in v0.73.0

func (*TradingDataServiceV2) GetRiskFactors added in v0.71.0

GetRiskFactors returns the risk factors for a given market.

func (*TradingDataServiceV2) GetStake added in v0.71.0

GetStake returns the stake for a party and the linkings to that stake.

func (*TradingDataServiceV2) GetStopOrder added in v0.72.0

func (*TradingDataServiceV2) GetTransfer added in v0.73.0

func (*TradingDataServiceV2) GetVegaTime added in v0.71.0

GetVegaTime returns the current vega time.

func (*TradingDataServiceV2) GetVestingBalancesSummary added in v0.73.0

func (*TradingDataServiceV2) GetVolumeDiscountStats added in v0.73.0

func (*TradingDataServiceV2) GetWithdrawal added in v0.71.0

GetWithdrawal gets a withdrawal by ID.

func (*TradingDataServiceV2) Info added in v0.71.0

Info returns the version and commit hash of the trading data service.

func (*TradingDataServiceV2) ListAccounts added in v0.71.0

ListAccounts lists accounts matching the request.

func (*TradingDataServiceV2) ListAllLiquidityProvisions added in v0.73.0

ListAllLiquidityProvisions gets a list of liquidity provisions for a given market. This is similar to the list liquidity provisions API but returns a current and pending liquidity provision in the event a provision has been updated by the provider but the updated provision will not be active until the next epoch.

func (*TradingDataServiceV2) ListAllNetworkHistorySegments added in v0.71.0

ListAllNetworkHistorySegments returns all network history segments.

func (*TradingDataServiceV2) ListAllPositions added in v0.71.0

ListAllPositions lists all positions.

func (*TradingDataServiceV2) ListAssets added in v0.71.0

ListAssets gets all assets. If an asset ID is provided, it will return a single asset.

func (*TradingDataServiceV2) ListBalanceChanges added in v0.71.0

ListBalanceChanges returns a list of balance changes matching the request.

func (*TradingDataServiceV2) ListCandleData added in v0.71.0

ListCandleData for a given market, time range and interval. Interval must be a valid postgres interval value.

func (*TradingDataServiceV2) ListCandleIntervals added in v0.71.0

ListCandleIntervals gets all available intervals for a given market along with the corresponding candle id.

func (*TradingDataServiceV2) ListCheckpoints added in v0.71.0

ListCheckpoints returns a list of checkpoints.

func (*TradingDataServiceV2) ListCoreSnapshots added in v0.71.0

ListCoreSnapshots returns a list of core snapshots.

func (*TradingDataServiceV2) ListDelegations added in v0.71.0

ListDelegations returns a list of delegations using cursor pagination.

func (*TradingDataServiceV2) ListDeposits added in v0.71.0

ListDeposits gets deposits for a party.

func (*TradingDataServiceV2) ListERC20MultiSigSignerAddedBundles added in v0.71.0

ListERC20MultiSigSignerAddedBundles returns the signature bundles needed to add a new validator to the multisig control ERC20 contract.

func (*TradingDataServiceV2) ListERC20MultiSigSignerRemovedBundles added in v0.71.0

ListERC20MultiSigSignerRemovedBundles returns the signature bundles needed to add a new validator to the multisig control ERC20 contract.

func (*TradingDataServiceV2) ListEntities added in v0.71.0

func (*TradingDataServiceV2) ListEpochRewardSummaries added in v0.71.0

ListEpochRewardSummaries gets reward summaries for epoch range.

func (*TradingDataServiceV2) ListEthereumKeyRotations added in v0.71.0

ListEthereumKeyRotations returns a list of Ethereum key rotations.

func (*TradingDataServiceV2) ListFundingPayments added in v0.73.0

func (*TradingDataServiceV2) ListFundingPeriodDataPoints added in v0.73.0

func (*TradingDataServiceV2) ListFundingPeriods added in v0.73.0

func (*TradingDataServiceV2) ListGovernanceData added in v0.71.0

ListGovernanceData lists governance data using cursor pagination.

func (*TradingDataServiceV2) ListKeyRotations added in v0.71.0

ListKeyRotations returns a list of key rotations for a given node.

func (*TradingDataServiceV2) ListLatestMarketData added in v0.71.0

ListLatestMarketData returns the latest market data for every market.

func (*TradingDataServiceV2) ListLedgerEntries added in v0.71.0

ListLedgerEntries returns a list of ledger entries matching the request.

func (*TradingDataServiceV2) ListLiquidityProviders added in v0.73.0

func (*TradingDataServiceV2) ListLiquidityProvisions added in v0.71.0

ListLiquidityProvisions gets all liquidity provisions.

func (*TradingDataServiceV2) ListMarginLevels added in v0.71.0

ListMarginLevels lists MarginLevels.

func (*TradingDataServiceV2) ListMarkets added in v0.71.0

ListMarkets lists all markets.

func (*TradingDataServiceV2) ListNetworkParameters added in v0.71.0

ListNetworkParameters returns a list of network parameters.

func (*TradingDataServiceV2) ListNodeSignatures added in v0.71.0

ListNodeSignatures returns the signatures for a given node.

func (*TradingDataServiceV2) ListNodes added in v0.71.0

ListNodes returns information about the nodes on the network.

func (*TradingDataServiceV2) ListOracleData added in v0.71.0

ListOracleData gets all oracle data.

func (*TradingDataServiceV2) ListOracleSpecs added in v0.71.0

ListOracleSpecs gets all oracle specs.

func (*TradingDataServiceV2) ListOrderVersions added in v0.71.0

ListOrderVersions lists order versions using cursor pagination.

func (*TradingDataServiceV2) ListOrders added in v0.71.0

ListOrders lists orders using cursor pagination.

func (*TradingDataServiceV2) ListPaidLiquidityFees added in v0.73.0

func (*TradingDataServiceV2) ListParties added in v0.71.0

ListParties lists Parties.

func (*TradingDataServiceV2) ListPositions deprecated added in v0.71.0

List all Positions.

Deprecated: Use ListAllPositions instead.

func (*TradingDataServiceV2) ListProtocolUpgradeProposals added in v0.71.0

ListProtocolUpgradeProposals returns a list of protocol upgrade proposals.

func (*TradingDataServiceV2) ListReferralSetReferees added in v0.73.0

func (*TradingDataServiceV2) ListReferralSets added in v0.73.0

func (*TradingDataServiceV2) ListRewardSummaries added in v0.71.0

ListRewardSummaries gets reward summaries.

func (*TradingDataServiceV2) ListRewards added in v0.71.0

ListRewards lists Rewards.

func (*TradingDataServiceV2) ListStopOrders added in v0.72.0

func (*TradingDataServiceV2) ListSuccessorMarkets added in v0.72.0

ListSuccessorMarkets returns the successor chain for a given market.

func (*TradingDataServiceV2) ListTeamRefereeHistory added in v0.73.0

func (*TradingDataServiceV2) ListTeamReferees added in v0.73.0

func (*TradingDataServiceV2) ListTeams added in v0.73.0

func (*TradingDataServiceV2) ListTrades added in v0.71.0

ListTrades lists trades by using a cursor based pagination model.

func (*TradingDataServiceV2) ListTransfers added in v0.71.0

ListTransfers lists transfers using cursor pagination. If a pubkey is provided, it will list transfers for that pubkey.

func (*TradingDataServiceV2) ListVotes added in v0.71.0

ListVotes gets all Votes.

func (*TradingDataServiceV2) ListWithdrawals added in v0.71.0

ListWithdrawals gets withdrawals for a party.

func (*TradingDataServiceV2) ObserveAccounts added in v0.71.0

ObserveAccounts streams account balances matching the request.

func (*TradingDataServiceV2) ObserveCandleData added in v0.71.0

ObserveCandleData subscribes to candle updates for a given market and interval. Interval must be a valid postgres interval value.

func (*TradingDataServiceV2) ObserveEventBus added in v0.71.0

ObserveEventBus subscribes to a stream of events.

func (*TradingDataServiceV2) ObserveGovernance added in v0.71.0

ObserveGovernance streams governance updates to the client.

func (*TradingDataServiceV2) ObserveLedgerMovements added in v0.71.0

ObserveLedgerMovements subscribes to a stream of ledger movements.

func (*TradingDataServiceV2) ObserveLiquidityProvisions added in v0.71.0

ObserveLiquidityProvisions subscribes to liquidity provisions.

func (*TradingDataServiceV2) ObserveMarginLevels added in v0.71.0

ObserveMarginLevels subscribes to a stream of Margin Levels.

func (*TradingDataServiceV2) ObserveMarketsData added in v0.71.0

ObserveMarketsData subscribes to market data updates.

func (*TradingDataServiceV2) ObserveMarketsDepth added in v0.71.0

ObserveMarketsDepth subscribes to market depth updates.

func (*TradingDataServiceV2) ObserveMarketsDepthUpdates added in v0.71.0

ObserveMarketsDepthUpdates subscribes to market depth updates.

func (*TradingDataServiceV2) ObserveOrders added in v0.71.0

ObserveOrders subscribes to a stream of orders.

func (*TradingDataServiceV2) ObservePositions added in v0.71.0

ObservePositions subscribes to a stream of Positions.

func (*TradingDataServiceV2) ObserveTrades added in v0.71.0

ObserveTrades opens a subscription to the Trades service.

func (*TradingDataServiceV2) ObserveVotes added in v0.71.0

ObserveVotes streams votes for a given party or proposal.

func (*TradingDataServiceV2) Ping added in v0.71.0

Ping returns a ping response.

type VegaIDsSlice added in v0.71.0

type VegaIDsSlice []string

func (VegaIDsSlice) Ensure added in v0.71.0

func (s VegaIDsSlice) Ensure() error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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