Skip to content

Commit

Permalink
Merge pull request #4977 from bigscoop/gateio_http-requests
Browse files Browse the repository at this point in the history
[gateio] minor: improve http requests
  • Loading branch information
timmolter authored Dec 9, 2024
2 parents 12d7cc9 + fa5797b commit b2e97ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion xchange-gateio-v4/src/test/resources/rest/sign.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export function gen_sign(method, request) {
export function gen_sign(request) {
const method = request.method
const pattern = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
const url = request.url.tryGetSubstituted();
const matches = url.match(pattern);
Expand Down
14 changes: 7 additions & 7 deletions xchange-gateio-v4/src/test/resources/rest/spot.http
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### List personal trading history
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/spot/my_trades
Expand All @@ -14,7 +14,7 @@ Content-Type: application/json
### List spot accounts
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/spot/accounts
Expand All @@ -27,7 +27,7 @@ Content-Type: application/json
### Query account book
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/spot/account_book
Expand All @@ -40,7 +40,7 @@ Content-Type: application/json
### List orders
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/spot/orders?currency_pair=VAI_USDT&status=finished
Expand All @@ -53,7 +53,7 @@ Content-Type: application/json
### Create an order
< {%
import {gen_sign} from 'sign.js'
gen_sign("POST", request);
gen_sign(request);
%}

POST {{api_v4}}/spot/orders
Expand All @@ -74,7 +74,7 @@ Content-Type: application/json
### Cancel a single order
< {%
import {gen_sign} from 'sign.js'
gen_sign("DELETE", request);
gen_sign(request);
%}

DELETE {{api_v4}}/spot/orders/123456?currency_pair=BTC_USDT
Expand All @@ -87,7 +87,7 @@ Content-Type: application/json
### Get a single order
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/spot/orders/745504484392?currency_pair=BTC_USDT
Expand Down
4 changes: 2 additions & 2 deletions xchange-gateio-v4/src/test/resources/rest/wallet.http
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Retrieve withdrawal status
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/wallet/withdraw_status?currency=usdt
Expand All @@ -14,7 +14,7 @@ Content-Type: application/json
### Retrieve transfer records between main and sub accounts
< {%
import {gen_sign} from 'sign.js'
gen_sign("GET", request);
gen_sign(request);
%}

GET {{api_v4}}/wallet/sub_account_transfers
Expand Down
2 changes: 1 addition & 1 deletion xchange-gateio-v4/src/test/resources/rest/withdraw.http
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Withdraw
< {%
import {gen_sign} from 'sign.js'
gen_sign("POST", request);
gen_sign(request);
%}

POST {{api_v4}}/withdrawals
Expand Down

0 comments on commit b2e97ec

Please sign in to comment.