Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/docs/01-introduction/04-supported-networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ New routes, networks, and tokens can readily be added by the Sprinter team. Plea

### Supported Networks and Tokens

:::note
Test networks and main networks have different API endpoints. Make sure to use the correct one based on your needs.
:::

:::tip
Hover over network icon or token to show available routes
:::
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/02-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Here’s a quick example of how to use the SDK in your project:
```typescript
import { Sprinter, Environment } from "@chainsafe/sprinter-sdk";

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

sprinter.getUserBalances("0xYourAddressHere").then(console.log);
```
Expand Down Expand Up @@ -74,7 +74,7 @@ function BalancesComponent() {

function App() {
return (
<SprinterContext baseUrl={Environment.MAINNET}>
<SprinterContext baseUrl={Environment.TESTNET}>
<BalancesComponent />
</SprinterContext>
);
Expand Down
10 changes: 7 additions & 3 deletions docs/docs/03-sdk/02-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ npm install @chainsafe/sprinter-sdk

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

:::note
The `baseUrl` should be changed depending on whether you want to interract with test networks or main networks.
:::

### Example: Initialize `Sprinter`

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

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

const ownerAddress = "0xYourAddressHere";
sprinter.getUserBalances(ownerAddress).then(console.log);
Expand All @@ -51,9 +55,9 @@ const tokenSymbol = "USDC";
api.getErc20Balances(ownerAddress, tokenSymbol).then(console.log);
```

## Environment Configuration
## Base url Configuration

You can configure the SDK using environment variables to set the base URL for API requests.
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`.

### Example: Set Base URL

Expand Down
9 changes: 7 additions & 2 deletions docs/docs/03-sdk/03-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ When initializing the `Sprinter` class, you can pass a `baseUrl` configuration o

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

:::note
Test networks and main networks have different API endpoints. Make sure to use the correct one based on your needs.
:::

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

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

// Or using a predefined environment URL
const sprinterWithEnv = new Sprinter({
baseUrl: Environment.MAINNET, // Enum that provides predefined URLs
baseUrl: Environment.TESTNET, // Enum that provides predefined URLs, use `Environment.TESTNET` for mainnet
});
```

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

## Available URLs

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

- **Mainnet**: `https://api.sprinter.buildwithsygma.com/`
- **Testnet**: `https://api.test.sprinter.buildwithsygma.com/`
Expand Down
6 changes: 5 additions & 1 deletion docs/docs/04-react-sdk/02-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ npm install react@latest react-dom@latest

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

:::note
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`
:::

```tsx
import React from "react";
import { SprinterContext } from "@chainsafe/sprinter-react";
Expand All @@ -42,7 +46,7 @@ function App() {
}
```

By passing the `baseUrl`, you specify which environment (testnet or mainnet) to use for API calls.
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.

### Available URLs:

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@types/eslint": "^8.56.11",
"@types/node": "18.19.42",
"eslint": "8.57.0",
"typescript": "^5.0.3",
"prettier": "^3.4.2"
"prettier": "^3.4.2",
"typescript": "^5.0.3"
},
"volta": {
"node": "20.17.0",
Expand Down
Loading