Skip to content

Commit 0606525

Browse files
author
tiagosiebler
committed
1.3.0-beta.1: introduce typescript, webpack, better overall browser support, deprecate assert calls
1 parent 6f30c2d commit 0606525

18 files changed

+3357
-666
lines changed

.github/workflows/npmpublish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
registry-url: https://registry.npmjs.org/
4242

4343
#- run: npm ci
44+
- run: npm run build
4445
- run: npm publish
4546
if: steps.version-updated.outputs.has-updated
4647
env:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ node_modules/
1919
.env
2020
.env.test
2121
.cache
22+
lib
23+
bundleReport.html

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,52 @@ Most methods accept JS objects. These can be populated using parameters specifie
2424
- [Bybit API Inverse Documentation](https://bybit-exchange.github.io/docs/inverse/#t-introduction).
2525
- [Bybit API Linear Documentation (not supported yet)](https://bybit-exchange.github.io/docs/linear/#t-introduction)
2626

27+
## Structure
28+
This project uses typescript. Resources are stored in 3 key structures:
29+
- [src](./src) - the whole connector written in typescript
30+
- [lib](./lib) - the javascript version of the project (compiled from typescript). This should not be edited directly, as it will be overwritten with each release.
31+
- [dist](./dist) - the packed bundle of the project for use in browser environments.
32+
2733
### Inverse Contracts
2834
#### Rest client
2935
```javascript
3036
const {RestClient} = require('bybit-api');
3137

3238
const API_KEY = 'xxx';
3339
const PRIVATE_KEY = 'yyy';
40+
const useLivenet = false;
41+
42+
const restInverseOptions = {
43+
// override the max size of the request window (in ms)
44+
recv_window?: number;
45+
46+
// how often to sync time drift with bybit servers
47+
sync_interval_ms?: number | string;
48+
49+
// Default: false. Disable above sync mechanism if true.
50+
disable_time_sync?: boolean;
51+
52+
// Default: false. If true, we'll throw errors if any params are undefined
53+
strict_param_validation?: boolean;
54+
55+
// Optionally override API protocol + domain
56+
// e.g 'https://api.bytick.com'
57+
baseUrl?: string;
58+
59+
// Default: true. whether to try and post-process request exceptions.
60+
parse_exceptions?: boolean;
61+
};
62+
63+
const client = new RestClient(
64+
API_KEY,
65+
PRIVATE_KEY,
66+
67+
// optional, uses testnet by default. Set to 'true' to use livenet.
68+
useLivenet,
3469

35-
const client = new RestClient(API_KEY, PRIVATE_KEY);
70+
// restInverseOptions,
71+
// requestLibraryOptions
72+
);
3673

3774
client.changeUserLeverage({leverage: 4, symbol: 'ETHUSD'})
3875
.then(result => {

index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
const RestClient = require('./lib/rest-client');
2-
const WebsocketClient = require('./lib/websocket-client');
3-
const DefaultLogger = require('./lib/logger');
4-
5-
module.exports = {
6-
RestClient,
7-
WebsocketClient,
8-
DefaultLogger
9-
};
1+
module.exports = require('lib/index');

lib/logger.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)