Skip to content

Commit

Permalink
chore(): cleaning on examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Jun 12, 2024
1 parent ad1fb3c commit 63386c6
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 63 deletions.
11 changes: 9 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Examples

These samples can be executed using `ts-node`:
These samples can be executed using `ts-node` or `tsx`:

```
ts-node ./examples/ws-public.ts
```

Most examples also have minimal typescript, so if you rename them to "js" they should execute fine with just node. TypeScript is recommended but completely optional:

```
ts-node ./examples/rest-spot-public.ts
node ./examples/spot/getTickers.js
```
3 changes: 2 additions & 1 deletion examples/futures/getBalances.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src';
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/futures/getOrders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src';
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/futures/getTickers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/futures/submitLimitOrder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/futures/submitMarketOrder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
36 changes: 0 additions & 36 deletions examples/rest-private.ts

This file was deleted.

3 changes: 2 additions & 1 deletion examples/spot/getBalances.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/spot/getOrders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/spot/getTickers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/spot/submitLimitOrder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
3 changes: 2 additions & 1 deletion examples/spot/submitMarketOrder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RestClient } from '../../src'; // Import the RestClient from the src directory
import { RestClient } from '../../src'; // For an easy demonstration, import from the src dir. Normally though, see below to import from the npm installed version instead.
// import { RestClient } from 'gateio-api'; // Import the RestClient from the published version of this SDK, installed via NPM (npm install gateio-api)

// Define the account object with API key and secret
const account = {
Expand Down
5 changes: 1 addition & 4 deletions examples/ws-private-perp-futures-wsapi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { LogParams, WebsocketClient } from '../src';
import {
WSAPILoginResponse,
WSAPIResponse,
} from '../src/types/websockets/wsAPI';
// import { LogParams, WebsocketClient } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

const account = {
key: process.env.API_KEY || 'apiKeyHere',
Expand Down
4 changes: 2 additions & 2 deletions examples/ws-private-perp-futures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { LogParams, WebsocketClient } from '../src';
import { WsTopicRequest } from '../src/lib/websocket/websocket-util';
import { LogParams, WebsocketClient, WsTopicRequest } from '../src';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

const account = {
key: process.env.API_KEY || 'apiKeyHere',
Expand Down
5 changes: 1 addition & 4 deletions examples/ws-private-spot-wsapi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { LogParams, WebsocketClient } from '../src';
import {
WSAPILoginResponse,
WSAPIResponse,
} from '../src/types/websockets/wsAPI';
// import { LogParams, WebsocketClient } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const account = {
Expand Down
4 changes: 2 additions & 2 deletions examples/ws-private-spot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { LogParams, WebsocketClient } from '../src';
import { WsTopicRequest } from '../src/lib/websocket/websocket-util';
import { LogParams, WebsocketClient, WsTopicRequest } from '../src';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const account = {
Expand Down
4 changes: 2 additions & 2 deletions examples/ws-public.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { LogParams, WebsocketClient } from '../src';
import { WsTopicRequest } from '../src/lib/websocket/websocket-util';
import { LogParams, WebsocketClient, WsTopicRequest } from '../src';
// import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // normally you should install this module via npm: `npm install gateio-api`

// const customLogger = {
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './lib/logger.js';
export * from './lib/websocket/websocket-util.js';
export * from './RestClient.js';
export * from './WebsocketClient.js';

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.linting.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"module": "commonjs",
"outDir": "dist/cjs",
"target": "esnext",
"rootDir": "../"
"rootDir": "../",
"allowJs": true
},
"include": [
"src/**/*.*",
Expand Down

0 comments on commit 63386c6

Please sign in to comment.