Skip to content
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ client
});
```

TestNet REST for spot and futures is `baseUrlKey: 'testnet'` (`https://api-testnet.gateapi.io/api/v4`). `baseUrlKey: 'futuresTestnet'` is that same host, kept so older configs keep working. WebSocket TestNet is `useTestnet: true` on `WebsocketClient`.

See [RestClient](./src/RestClient.ts) for further information, or the [examples](./examples/) for lots of usage examples.

## WebSockets
Expand Down
7 changes: 4 additions & 3 deletions docs/GATE_SDK_QUICKSTART_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1738,11 +1738,12 @@ Gate TestNet is a separate environment with separate credentials. Use it for all
| REST API | `https://api-testnet.gateapi.io/api/v4` |
| Spot WebSocket | `wss://ws-testnet.gate.com/v4/ws/spot` |
| USDT perpetual WebSocket | `wss://ws-testnet.gate.com/v4/ws/futures/usdt` |
| Options WebSocket | `wss://ws-testnet.gate.com/v4/ws/options` |

Set the REST API host with `baseUrl` and the WebSocket host with `wsUrl`. Prefer explicit hosts for TestNet examples:
Set the REST API host with `baseUrl` or `baseUrlKey`, and the WebSocket host with `wsUrl` or `useTestnet: true`. Prefer explicit hosts for TestNet examples:

- Spot WebSocket TestNet is not wired through `useTestnet: true` in this SDK. The Spot testnet map entry is a stub (`NoTestnetForSpotWebsockets!`), so set `wsUrl` to the Spot TestNet host above.
- For Futures-only REST TestNet, the SDK also accepts `baseUrlKey: 'futuresTestnet'`, which resolves to `https://fx-api-testnet.gateio.ws/api/v4`. The Global TestNet REST host in the table is the host used by the Spot and Futures order examples in this guide.
- `baseUrlKey: 'testnet'` uses `https://api-testnet.gateapi.io/api/v4` for spot and futures. `baseUrlKey: 'futuresTestnet'` is the same host, kept so older configs keep working.
- `useTestnet: true` selects the TestNet WebSocket host for that connection, including Spot and Options. BTC perpetual and delivery TestNet hosts stay on the URLs in the current Gate docs (`wss://fx-ws-testnet.gateio.ws/...`). Announcements still have no TestNet host.

```javascript
import { RestClient, WebsocketClient } from 'gateio-api';
Expand Down
896 changes: 448 additions & 448 deletions docs/endpointFunctionList.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions examples/Rest/futures/testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const gateRestClient = new RestClient({
*/

/*
* Futures TestNet trading:
* 'https://fx-api-testnet.gateio.ws/api/v4'
* Futures TestNet trading (alias of `testnet`, spot and futures):
* 'https://api-testnet.gateapi.io/api/v4'
* Older host https://fx-api-testnet.gateio.ws/api/v4 now returns 502.
* baseUrlKey: 'testnet' is the same host.
*/
baseUrlKey: 'futuresTestnet',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RestClient } from 'gateio-api';

// This example shows how to call this Gate.io API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "gateio-api" for Gate.io exchange
// This Gate.io API SDK is available on npm via "npm install gateio-api"
// ENDPOINT: /futures/{settle}/price_orders/amend
// ENDPOINT: /futures/{settle}/price_orders/amend/{order_id}
// METHOD: PUT
// PUBLIC: NO

Expand Down
Loading
Loading