From 74fc8d7936d514f40b8a04d74bbc61d9083c4e29 Mon Sep 17 00:00:00 2001 From: Quentin Burg Date: Mon, 18 Dec 2023 10:44:30 +0100 Subject: [PATCH] :memo: add some informations about SDK environment --- docs/book.toml | 4 +++- docs/src/api.md | 2 +- docs/src/library.md | 15 +++++++++++++-- docs/src/tutorial.md | 13 ++++++------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/book.toml b/docs/book.toml index 34914a5..ea74b21 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -22,4 +22,6 @@ boost-title = 2 boost-hierarchy = 2 boost-paragraph = 1 expand = true -heading-split-level = 2 \ No newline at end of file +heading-split-level = 2 + +[preprocessor.embed] diff --git a/docs/src/api.md b/docs/src/api.md index 3812ecb..cac27d8 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -1,3 +1,3 @@ # API -You can find API specifications [here](https://ghostnet.gas-station-api.marigold.dev/docs) \ No newline at end of file + \ No newline at end of file diff --git a/docs/src/library.md b/docs/src/library.md index 075488d..3bf49f4 100644 --- a/docs/src/library.md +++ b/docs/src/library.md @@ -16,7 +16,11 @@ npm install --save @marigold-dev/gas-station-lib #### Explanations -The SDK consists of two classes : `GasStation` and `PermitContract`. +The SDK consists of two classes: `GasStation` and `PermitContract`. + +There are also two variables: + - `GAS_STATION_PUBLIC_API_GHOSTNET` which redirect to [https://ghostnet.gas-station-api.marigold.dev/operation](https://ghostnet.gas-station-api.marigold.dev/operation) + - `GAS_STATION_PUBLIC_API_MAINNET` which redirect to [https://gas-station-api.marigold.dev/operation](https://gas-station-api.marigold.dev/operation) (Not available yet) The `GasStation` class enables easy communication with the Gas Station API without the need to manually initialize the HTTP request. @@ -66,8 +70,15 @@ To begin, you need to import and initialize the `GasStation` object from the SDK ```ts import { GasStation } from '@marigold-dev/gas-station-lib' +const gasApi = new GasStation() +``` + +ℹ️ NOTE: By default, the Gas Station used by the SDK is on Ghostnet but you can also provide a `apiURL` like: +```ts +import { GasStation, GAS_STATION_PUBLIC_API_GHOSTNET} from '@marigold-dev/gas-station-lib' + const gasApi = new GasStation({ - apiURL: 'https://gas-station-api.marigold.dev/' + apiURL: GAS_STATION_PUBLIC_API_GHOSTNET // or the URL directly }) ``` diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index 27bdd66..805ba98 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -31,11 +31,9 @@ The goal here is for the user to initiate the mint action and retrieve their NFT First, we'll setup the GasStation SDK as follows: ```ts -const gasStationAPI = new GasStation({ - apiURL: PUBLIC_GAS_STATION_API -}) +const gasStationAPI = new GasStation() ``` -ℹ️ `PUBLIC_GAS_STATION_API` is an environment variable available in `.env` +ℹ️ `GasStation` class will target the Gas Station deployed on Ghostnet by default. Next, we'll retrieve an instance of our contract, using [Taquito](https://tezostaquito.io/). @@ -81,10 +79,11 @@ For staking, we need a permit. Staking involves transferring our freshly minted To facilitate the development of this new feature, we will also use the TypeScript SDK (for reference, you have all the information [here](./library.md)) To start, let's initialize the `GasStation` and `PermitContract` classes from the SDK: + +ℹ️ `GasStation` class will target the Gas Station deployed on Ghostnet by default. + ```ts -const gasStationApi = new GasStation({ - apiURL: PUBLIC_GAS_STATION_API - }); +const gasStationApi = new GasStation(); const permitContract = new PermitContract(PUBLIC_PERMIT_CONTRACT, Tezos); ```