Skip to content

rafat/api

 
 

Repository files navigation

Vega API

Version: 0.35.0

This repository contains everything you need for interacting with the Vega APIs.

There are currently 3 APIs:

  • gRPC
  • GraphQL
  • REST

gRPC

See https://grpc.io/ for general information on gRPC.

Vega provides a rich gRPC API. For a complete list of endpoints, see proto/api/trading.proto:

  • Use TradingService for:
    • Prepare* endpoints are there for convenience, and will be removed in the near future
    • SubmitTransaction receives and executes a signed transaction. For transaction signing, see go-wallet.
  • Use TradingDataService for public information on:
    • assets, e.g. Ethereum ERC20 tokens
    • balances for accounts: general, margin
    • market data and metadata
    • information on orders and trades
    • Governance data: proposals, votes
    • event stream subscriptions for the above

Before writing your own API client (either manually or using auto-generation), check if a pre-created on is already available. See Auto-generated gRPC clients below.

GraphQL

See https://graphql.org/ for general information on GraphQL.

Vega provides a fully-featured GraphQL API. For the complete schema, see graphql/schema.graphql.

The GraphQL Playground is enabled for convenience on Testnet non-validator nodes: https://lb.testnet.vega.xyz/playground.

It is possible to use nested queries that return only the desired information.

REST

Vega provides a limited REST API. Streaming of events is not supported.

For an OpenAPI json file that describes all available endpoints, see rest/api/trading.swagger.json. The mapping between gRPC endpoints and their REST equivalent is found in rest/grpc-rest-bindings.yml.

Auto-generated gRPC clients

Vega uses buf to auto-generate API clients in various programming languages. The list of currently supported clients is found in buf.gen.yaml, and the full build process is in the Makefile.

The per-language API clients are found in grpc/clients/.

Pull requests for additional languages are gratefully received.

Information for maintainers

Update process - gRPC

# Copy proto files from Core
cd .../api # repo root dir
VEGACORE=/path/to/go/src/vega make preproto

# Generate gRPC API clients, gRPC documentation, REST OpenAPI json.
make proto

# Run tests
GRPC_NODE=veganode.example.com:1234 WALLETSERVER=https://vegawallet.example.com make test

Update process - GraphQL

# Copy schema.graphql from Core
cd .../api/graphql
VEGACORE=/path/to/go/src/vega make pregraphql

# Generate GraphQL documentation
make graphql

Release process

./setversion.sh 1.2.3  # no "v" prefix

Licence

Distributed under the MIT License. See LICENSE for more information.

About

Auto-generated API clients

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 82.5%
  • JavaScript 16.1%
  • Python 1.1%
  • SCSS 0.1%
  • Shell 0.1%
  • Makefile 0.1%