move script commands around. Move shared endpoint down. Add event annotations to ws client.

This commit is contained in:
tiagosiebler
2021-02-14 16:13:35 +00:00
parent 58337370b9
commit 62750228c4
4 changed files with 22 additions and 9 deletions

View File

@@ -42,6 +42,8 @@ jobs:
- run: npm ci - run: npm ci
if: steps.version-updated.outputs.has-updated if: steps.version-updated.outputs.has-updated
- run: npm run clean
if: steps.version-updated.outputs.has-updated
- run: npm run build - run: npm run build
if: steps.version-updated.outputs.has-updated if: steps.version-updated.outputs.has-updated
- run: npm publish - run: npm publish

View File

@@ -11,8 +11,9 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"clean": "rm -rf lib dist", "clean": "rm -rf lib dist",
"prebuild": "npm run clean", "buildclean": "npm run clean && npm run build",
"build": "tsc", "build": "tsc",
"build:watch": "npm run clean && tsc --watch",
"pack": "webpack --config webpack/webpack.config.js", "pack": "webpack --config webpack/webpack.config.js",
"prepublish": "npm run build", "prepublish": "npm run build",
"betapublish": "npm publish --tag beta" "betapublish": "npm publish --tag beta"

View File

@@ -82,14 +82,6 @@ export default class SharedEndpoints {
return this.requestWrapper.get('v2/private/wallet/balance', params) return this.requestWrapper.get('v2/private/wallet/balance', params)
} }
getAssetExchangeRecords(params?: {
limit?: number;
from?: number;
direction?: string;
}): GenericAPIResponse {
return this.requestWrapper.get('v2/private/exchange-order/list', params);
}
getWalletFundRecords(params?: { getWalletFundRecords(params?: {
start_date?: string; start_date?: string;
end_date?: string; end_date?: string;
@@ -113,6 +105,14 @@ export default class SharedEndpoints {
return this.requestWrapper.get('v2/private/wallet/withdraw/list', params); return this.requestWrapper.get('v2/private/wallet/withdraw/list', params);
} }
getAssetExchangeRecords(params?: {
limit?: number;
from?: number;
direction?: string;
}): GenericAPIResponse {
return this.requestWrapper.get('v2/private/exchange-order/list', params);
}
/** /**
* *
* API Data Endpoints * API Data Endpoints

View File

@@ -75,6 +75,16 @@ const getLinearWsKeyForTopic = (topic: string) => {
return wsKeyLinearPublic; return wsKeyLinearPublic;
} }
export declare interface WebsocketClient {
on(event: 'open', listener: ({ wsKey: string, event: any }) => void): this;
on(event: 'reconnected', listener: ({ wsKey: string, event: any }) => void): this;
on(event: 'reconnect', listener: () => void): this;
on(event: 'close', listener: () => void): this;
on(event: 'response', listener: (response: any) => void): this;
on(event: 'update', listener: (response: any) => void): this;
on(event: 'error', listener: (response: any) => void): this;
}
export class WebsocketClient extends EventEmitter { export class WebsocketClient extends EventEmitter {
private logger: typeof DefaultLogger; private logger: typeof DefaultLogger;
private restClient: InverseClient | LinearClient; private restClient: InverseClient | LinearClient;