Skip to content

Commit ddc7608

Browse files
TbautBeroBurny
andauthored
chore(docs): Make the docs clearer regarding base url for test networks and main networks (#113)
closes #111 - set Testnet as the default everywhere - attempt at making the docs clearer. --------- Co-authored-by: Bernard Stojanović <[email protected]>
1 parent f5f6fcf commit ddc7608

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

docs/docs/01-introduction/04-supported-networks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ New routes, networks, and tokens can readily be added by the Sprinter team. Plea
1919

2020
### Supported Networks and Tokens
2121

22+
:::note
23+
Test networks and main networks have different API endpoints. Make sure to use the correct one based on your needs.
24+
:::
25+
2226
:::tip
2327
Hover over network icon or token to show available routes
2428
:::

docs/docs/02-quick-start.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Here’s a quick example of how to use the SDK in your project:
3131
```typescript
3232
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";
3333

34-
const sprinter = new Sprinter({ baseUrl: Environment.MAINNET });
34+
const sprinter = new Sprinter({ baseUrl: Environment.TESTNET });
3535

3636
sprinter.getUserBalances("0xYourAddressHere").then(console.log);
3737
```
@@ -74,7 +74,7 @@ function BalancesComponent() {
7474

7575
function App() {
7676
return (
77-
<SprinterContext baseUrl={Environment.MAINNET}>
77+
<SprinterContext baseUrl={Environment.TESTNET}>
7878
<BalancesComponent />
7979
</SprinterContext>
8080
);

docs/docs/03-sdk/02-installation.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ npm install @chainsafe/sprinter-sdk
2727

2828
Once the SDK is installed, you can initialize it to interact with blockchain networks and fetch data like user balances and supported tokens.
2929

30+
:::note
31+
The `baseUrl` should be changed depending on whether you want to interract with test networks or main networks.
32+
:::
33+
3034
### Example: Initialize `Sprinter`
3135

3236
```typescript
3337
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";
3438

35-
const sprinter = new Sprinter({ baseUrl: Environment.MAINNET });
39+
const sprinter = new Sprinter({ baseUrl: Environment.TESTNET });
3640

3741
const ownerAddress = "0xYourAddressHere";
3842
sprinter.getUserBalances(ownerAddress).then(console.log);
@@ -51,9 +55,9 @@ const tokenSymbol = "USDC";
5155
api.getErc20Balances(ownerAddress, tokenSymbol).then(console.log);
5256
```
5357

54-
## Environment Configuration
58+
## Base url Configuration
5559

56-
You can configure the SDK using environment variables to set the base URL for API requests.
60+
The base url will define the url used for API requests. If you want to make calls to test networks (e.g Sepolia, BaseSepolia...) you should use the test endpoint available from the exported `Environment` Enum: `Environment.TESTNET`. For main networks you can use `Environment.MAINNET`.
5761

5862
### Example: Set Base URL
5963

docs/docs/03-sdk/03-configuration.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ When initializing the `Sprinter` class, you can pass a `baseUrl` configuration o
1616

1717
The `baseUrl` is the API server endpoint. You can either set it manually or use the predefined `Environment` enum to simplify configuration.
1818

19+
:::note
20+
Test networks and main networks have different API endpoints. Make sure to use the correct one based on your needs.
21+
:::
22+
1923
```typescript
2024
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";
2125

@@ -26,7 +30,7 @@ const sprinter = new Sprinter({
2630

2731
// Or using a predefined environment URL
2832
const sprinterWithEnv = new Sprinter({
29-
baseUrl: Environment.MAINNET, // Enum that provides predefined URLs
33+
baseUrl: Environment.TESTNET, // Enum that provides predefined URLs, use `Environment.TESTNET` for mainnet
3034
});
3135
```
3236

@@ -61,7 +65,8 @@ setBaseUrl(process.env.SPRINTER_URL);
6165

6266
## Available URLs
6367

64-
Here are the URLs you can use for the `baseUrl`:
68+
Here are the URLs you can use for the `baseUrl`.
69+
If you interract with test networks (e.g Sepolia, BaseSepolia...) use the Testnet url otherwise use the Mainnet one.
6570

6671
- **Mainnet**: `https://api.sprinter.buildwithsygma.com/`
6772
- **Testnet**: `https://api.test.sprinter.buildwithsygma.com/`

docs/docs/04-react-sdk/02-installation.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ npm install react@latest react-dom@latest
2828

2929
Once the installation is complete, wrap your app’s component tree with `SprinterContext` to provide access to Sprinter’s functionalities across your React components.
3030

31+
:::note
32+
The `baseUrl` should be changed depending on whether you want to interract with test networks or main networks. E.g for Sepolia or BaseSepolia use `Environment.TESTNET`, otherwise use `Environment.MAINNET`
33+
:::
34+
3135
```tsx
3236
import React from "react";
3337
import { SprinterContext } from "@chainsafe/sprinter-react";
@@ -42,7 +46,7 @@ function App() {
4246
}
4347
```
4448

45-
By passing the `baseUrl`, you specify which environment (testnet or mainnet) to use for API calls.
49+
By passing the `baseUrl`, you specify which endpoint to use for API calls. If you interract with test networks (e.g Sepolia, BaseSepolia...) use the Testnet url otherwise use the Mainnet one.
4650

4751
### Available URLs:
4852

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"@types/eslint": "^8.56.11",
2727
"@types/node": "18.19.42",
2828
"eslint": "8.57.0",
29-
"typescript": "^5.0.3",
30-
"prettier": "^3.4.2"
29+
"prettier": "^3.4.2",
30+
"typescript": "^5.0.3"
3131
},
3232
"volta": {
3333
"node": "20.17.0",

0 commit comments

Comments
 (0)