Skip to content

Commit

Permalink
feat: docs POC (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny authored Jul 4, 2024
1 parent 6aca865 commit 8cd800d
Show file tree
Hide file tree
Showing 39 changed files with 15,256 additions and 3,323 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: 'yarn run test:unit'
- name: "Integrations Tests"
run: 'yarn run test:integrations'
- name: Publish to Cloudflare Pages
- name: Publish POC to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand All @@ -36,3 +36,12 @@ jobs:
directory: ./web/.svelte-kit/cloudflare
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
- name: Publish Docs to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 2238a825c5aca59233eab1f221f7aefb
projectName: gopher-docs
directory: ./docs/build
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
8 changes: 8 additions & 0 deletions docs/docs/api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "API",
"position": 4,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important Docusaurus concepts."
}
}
190 changes: 190 additions & 0 deletions docs/docs/api/assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
---
sidebar_position: 3
---

# Fungible Assets

This section explains how to get a list of fungible tokens available on the service.

## /assets/fungible

### Description

Returns a list of supported tokens.

### Endpoint

`GET /assets/fungible`

### Response

The response is a JSON object containing an array of fungible token objects.

### Example Request

```shell
curl -X 'GET' \
'https://gopher.test.buildwithsygma.com/assets/fungible' \
-H 'accept: application/json'
```

### Example Response

```json
{
"data": [
{
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"addresses": {
"1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eb48",
"42161": "0xFF970A61A04b1Ca14834A43f5de4533eBdDB5CC8"
},
"logoURI": "https://example.com/logos/usdc.png"
},
{
"symbol": "DAI",
"name": "Dai Stablecoin",
"decimals": 18,
"addresses": {
"1": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"42161": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
},
"logoURI": "https://example.com/logos/dai.png"
}
]
}
```

### Fields

- `symbol`: The symbol of the token (e.g., "USDC").
- `name`: The name of the token (e.g., "USD Coin").
- `decimals`: The number of decimals the token uses.
- `addresses`: An object mapping chain IDs to token contract addresses.
- `logoURI`: The URI for the token's logo.

### Usage Notes

- The response includes all supported fungible tokens along with their details and addresses on different blockchain networks.

## /assets/fungible/{"{token}"}

### Description

Returns information about a specific token.

### Endpoint

`GET /assets/fungible/{token}`

### Parameters

- `{token}`: The symbol of the token (e.g., "USDC").

### Response

The response is a JSON object containing the details of the specified token.

### Example Request

```shell
curl -X 'GET' \
'https://gopher.test.buildwithsygma.com/assets/fungible/usdc' \
-H 'accept: application/json'
```

### Example Response

```json
{
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"addresses": {
"1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eb48",
"42161": "0xFF970A61A04b1Ca14834A43f5de4533eBdDB5CC8"
},
"logoURI": "https://example.com/logos/usdc.png"
}
```

### Fields

- `symbol`: The symbol of the token (e.g., "USDC").
- `name`: The name of the token (e.g., "USD Coin").
- `decimals`: The number of decimals the token uses.
- `addresses`: An object mapping chain IDs to token contract addresses.
- `logoURI`: The URI for the token's logo.

### Usage Notes

- Replace `{token}` with the symbol of the token you want to retrieve information about.

## /networks/{"{chainID}"}/assets/fungible

### Description

Returns a list of supported tokens for a specific network.

### Endpoint

`GET /networks/{chainID}/assets/fungible`

### Parameters

- `{chainID}`: The ID of the blockchain network.

### Response

The response is a JSON object containing an array of fungible token objects for the specified network.

### Example Request

```shell
curl -X 'GET' \
'https://gopher.test.buildwithsygma.com/networks/1/assets/fungible' \
-H 'accept: application/json'
```

### Example Response

```json
{
"data": [
{
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"addresses": {
"1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eb48"
},
"logoURI": "https://example.com/logos/usdc.png"
},
{
"symbol": "DAI",
"name": "Dai Stablecoin",
"decimals": 18,
"addresses": {
"1": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
},
"logoURI": "https://example.com/logos/dai.png"
}
]
}
```

### Fields

- `symbol`: The symbol of the token (e.g., "USDC").
- `name`: The name of the token (e.g., "USD Coin").
- `decimals`: The number of decimals the token uses.
- `addresses`: An object mapping chain IDs to token contract addresses.
- `logoURI`: The URI for the token's logo.

### Usage Notes

- Replace `{chainID}` with the ID of the blockchain network you want to retrieve supported tokens for.

The above commands return JSON objects with the list of fungible tokens, details about specific tokens, or supported tokens for a specific network.
37 changes: 37 additions & 0 deletions docs/docs/api/get-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
sidebar_position: 1
---

# Get Started

## API Usage

If you prefer using API calls directly or due to limitations of your environment, you can use the Gopher API. This guide provides an overview of the available endpoints and examples of how to interact with them.

You can use the Swagger documentation available at [Gopher Swagger API](https://gopher.test.buildwithsygma.com/swagger/index.html) for more detailed information.

### Example

Example of getting a list of supported networks:

```shell
curl -X 'GET' \
'https://gopher.test.buildwithsygma.com/networks' \
-H 'accept: application/json'
```

### Table of Contents

For more detailed information about each endpoint, please refer to the specific documents:

- [Fungible Assets](assets.md)
- Get all assets information
- Get specific assets information
- Get specific network assets
- [Networks](networks.md)
- Get all supported networks
- [Solutions](solutions.md)
- Token aggregation
- Token aggregation with contract call

Explore each section to understand how to make the most out of the Gopher API.
72 changes: 72 additions & 0 deletions docs/docs/api/networks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
sidebar_position: 2
---

# Networks

This section explains how to get a list of networks available on the service and their details.

## /networks

### Description

Returns a list of supported networks. Each network includes information such as the network ID, name, type, and RPC URLs.

### Endpoint

`GET /networks`

### Response

The response is a JSON object containing an array of network objects.

### Example Request

```shell
curl -X 'GET' \
'https://gopher.test.buildwithsygma.com/networks' \
-H 'accept: application/json'
```

### Example Response

```json
{
"data": [
{
"chainID": 1,
"chainType": "EVM",
"name": "Ethereum Mainnet",
"logoURI": "https://example.com/logos/ethereum.png",
"rpcurls": [
"https://mainnet.ethereumnode.com",
"https://rpc.ankr.com/eth"
]
},
{
"chainID": 42161,
"chainType": "EVM",
"name": "Arbitrum One",
"logoURI": "https://example.com/logos/arbitrum.png",
"rpcurls": [
"https://arb1.arbitrum.io/rpc",
"https://arbitrum.node.com/rpc"
]
}
]
}
```

### Fields

- `chainID`: The unique identifier for the blockchain network.
- `chainType`: The type of the blockchain (e.g., EVM).
- `name`: The name of the blockchain network.
- `logoURI`: The URI of the network's logo.
- `rpcurls`: An array of RPC URLs for the network.

### Usage Notes

- The response includes multiple RPC URLs for redundancy and reliability.

The above command returns a JSON object with the list of supported networks and their details.
Loading

0 comments on commit 8cd800d

Please sign in to comment.