From 07b203406ecd807ebba3da7e21ea71b6b845d81b Mon Sep 17 00:00:00 2001 From: Dexter Date: Wed, 22 May 2024 12:34:06 +0100 Subject: [PATCH] docs: add usage docs --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 87f36bb..b42161c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ # Rest clients WIP project that autogenerates types and clients for interacting with the Vega REST APIs + +## Usage + +Install the client you wish to use: + +```bash +npm i @vegaprotocol/rest-client +``` + +or + +```bash +yarn add @vegaprotocol/rest-client +``` + +Then use it in your code: + +```typescript +// Choose API you wish to access; BlockExplorer, Core, CoreState or TradingData +import { BlockExplorer } from "@vegaprotocol/rest-clients"; + +// Set the base URL of for the client you are connecting to. +BlockExplorer.OpenAPI.BASE = "node-url-here"; +const service = BlockExplorer.BlockExplorerService; +service.blockExplorerListTransactions().then((markets) => { + console.log(markets); +}); +```