Merge pull request #422 from tiagosiebler/queryEncoding
fix(v3.11.0): ensure private GET requests use serialised/encoded params appended to URL. Update slippage tolerance type to optional.
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.34",
|
"version": "3.11.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.34",
|
"version": "3.11.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.6",
|
"axios": "^1.6.6",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.34",
|
"version": "3.11.0",
|
||||||
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ export interface OrderParamsV5 {
|
|||||||
orderType: OrderTypeV5;
|
orderType: OrderTypeV5;
|
||||||
qty: string;
|
qty: string;
|
||||||
marketUnit?: 'baseCoin' | 'quoteCoin';
|
marketUnit?: 'baseCoin' | 'quoteCoin';
|
||||||
slippageToleranceType: string;
|
slippageToleranceType?: string;
|
||||||
slippageTolerance: string;
|
slippageTolerance?: string;
|
||||||
price?: string;
|
price?: string;
|
||||||
triggerDirection?: 1 | 2;
|
triggerDirection?: 1 | 2;
|
||||||
orderFilter?: OrderFilterV5;
|
orderFilter?: OrderFilterV5;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ interface SignedRequest<T> {
|
|||||||
interface UnsignedRequest<T> {
|
interface UnsignedRequest<T> {
|
||||||
originalParams: T;
|
originalParams: T;
|
||||||
paramsWithSign: T;
|
paramsWithSign: T;
|
||||||
|
serializedParams: string;
|
||||||
sign?: string;
|
sign?: string;
|
||||||
timestamp?: number;
|
timestamp?: number;
|
||||||
recvWindow?: number;
|
recvWindow?: number;
|
||||||
@@ -285,7 +286,9 @@ export default abstract class BaseRestClient {
|
|||||||
return {
|
return {
|
||||||
...options,
|
...options,
|
||||||
headers,
|
headers,
|
||||||
params: signResult.originalParams,
|
url: signResult.serializedParams
|
||||||
|
? options.url + '?' + signResult.serializedParams
|
||||||
|
: options.url,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,35 @@ describe('Private READ V5 REST API Endpoints', () => {
|
|||||||
accountType: accountType,
|
accountType: accountType,
|
||||||
coin: settleCoin,
|
coin: settleCoin,
|
||||||
}),
|
}),
|
||||||
).toMatchObject({ ...successResponseObjectV3() });
|
).toMatchObject({
|
||||||
|
...successResponseObjectV3(),
|
||||||
|
// retMsg: '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getAllCoinsBalance() unified with one symbol', async () => {
|
||||||
|
const result = await api.getAllCoinsBalance({
|
||||||
|
accountType: 'UNIFIED',
|
||||||
|
coin: 'USDT',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.retCode !== 0) {
|
||||||
|
console.error(expect.getState().currentTestName, 'exception: ', result);
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(result).toMatchObject({ ...successResponseObjectV3() });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getAllCoinsBalance() unified with multiple symbols', async () => {
|
||||||
|
const result = await api.getAllCoinsBalance({
|
||||||
|
accountType: 'UNIFIED',
|
||||||
|
coin: 'USDT,ETH',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.retCode !== 0) {
|
||||||
|
console.error(expect.getState().currentTestName, 'exception: ', result);
|
||||||
|
}
|
||||||
|
expect(result).toMatchObject({ ...successResponseObjectV3() });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getTransferableCoinList()', async () => {
|
it('getTransferableCoinList()', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user