Skip to content

Commit

Permalink
feat(v1.1.0): allow endpoints to define custom headers, if supported.…
Browse files Browse the repository at this point in the history
… feat(): add exptime parameter to futures order req interface.
  • Loading branch information
tiagosiebler committed Nov 18, 2024
1 parent febc39d commit 078f231
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gateio-api",
"version": "1.0.22",
"version": "1.1.0",
"description": "Complete & robust Node.js SDK for Gate.io's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.",
"scripts": {
"clean": "rm -rf dist/*",
Expand Down
11 changes: 9 additions & 2 deletions src/RestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export class RestClient extends BaseRestClient {
console.log(result);

console.log(
`Your approximate latency to exchange server:
`Your approximate latency to exchange server:
One way: ${estimatedOneWayLatency}ms.
Round trip: ${roundTripTime}ms.
`,
Expand Down Expand Up @@ -2473,9 +2473,16 @@ export class RestClient extends BaseRestClient {
* @returns Promise<FuturesOrder>
*/
updateFuturesOrder(params: UpdateFuturesOrderReq): Promise<FuturesOrder> {
const { settle, order_id, ...body } = params;
const { settle, order_id, ...rest } = params;
const { ['x-gate-exptime']: xGateExptime, ...body } = rest;

const headers = xGateExptime
? { 'x-gate-exptime': xGateExptime }
: undefined;

return this.putPrivate(`/futures/${settle}/orders/${order_id}`, {
body: body,
headers: headers,
});
}

Expand Down

0 comments on commit 078f231

Please sign in to comment.