@medievalrain/binance-ts 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +46 -45
- package/dist/index.js +3 -6
- package/package.json +12 -14
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,49 @@ import { Client, WebSocket } from "undici";
|
|
|
3
3
|
import * as z4 from "zod/v4/core";
|
|
4
4
|
import { CallbackOptions } from "@medievalrain/emitter";
|
|
5
5
|
|
|
6
|
+
//#region src/shared/base-rest-client.d.ts
|
|
7
|
+
type RawSearchParams = Record<string, string | undefined | null | string[] | number | boolean>;
|
|
8
|
+
declare class BaseRestClient {
|
|
9
|
+
private httpCleint;
|
|
10
|
+
private apiKey?;
|
|
11
|
+
private apiSecret?;
|
|
12
|
+
constructor({
|
|
13
|
+
baseUrl,
|
|
14
|
+
apiKey,
|
|
15
|
+
apiSecret,
|
|
16
|
+
httpOptions
|
|
17
|
+
}: {
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
apiSecret?: string;
|
|
21
|
+
httpOptions?: Client.Options;
|
|
22
|
+
});
|
|
23
|
+
private toSearchParams;
|
|
24
|
+
private parseErrorResponse;
|
|
25
|
+
private parseResponse;
|
|
26
|
+
protected publicRequest<T extends z4.$ZodType>({
|
|
27
|
+
endpoint,
|
|
28
|
+
params,
|
|
29
|
+
schema
|
|
30
|
+
}: {
|
|
31
|
+
endpoint: string;
|
|
32
|
+
params?: RawSearchParams;
|
|
33
|
+
schema: T;
|
|
34
|
+
}): Promise<z4.output<T>>;
|
|
35
|
+
protected privateRequest<T extends z4.$ZodType>({
|
|
36
|
+
endpoint,
|
|
37
|
+
params,
|
|
38
|
+
schema,
|
|
39
|
+
method
|
|
40
|
+
}: {
|
|
41
|
+
endpoint: string;
|
|
42
|
+
params?: RawSearchParams;
|
|
43
|
+
method: "GET" | "POST" | "DELETE";
|
|
44
|
+
schema: T;
|
|
45
|
+
}): Promise<z4.output<T>>;
|
|
46
|
+
private sign;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
6
49
|
//#region src/rest/futures/schema.d.ts
|
|
7
50
|
declare const FuturesTestConnectivitySchema: z.ZodObject<{}, z.core.$strip>;
|
|
8
51
|
declare const FuturesCheckServerTimeSchema: z.ZodObject<{
|
|
@@ -785,49 +828,6 @@ declare const FuturesNewOrderSchema: z.ZodObject<{
|
|
|
785
828
|
goodTillDate: z.ZodOptional<z.ZodNumber>;
|
|
786
829
|
}, z.core.$strip>;
|
|
787
830
|
//#endregion
|
|
788
|
-
//#region src/shared/base-rest-client.d.ts
|
|
789
|
-
type RawSearchParams = Record<string, string | undefined | null | string[] | number | boolean>;
|
|
790
|
-
declare class BaseRestClient {
|
|
791
|
-
private httpCleint;
|
|
792
|
-
private apiKey?;
|
|
793
|
-
private apiSecret?;
|
|
794
|
-
constructor({
|
|
795
|
-
baseUrl,
|
|
796
|
-
apiKey,
|
|
797
|
-
apiSecret,
|
|
798
|
-
httpOptions
|
|
799
|
-
}: {
|
|
800
|
-
baseUrl: string;
|
|
801
|
-
apiKey?: string;
|
|
802
|
-
apiSecret?: string;
|
|
803
|
-
httpOptions?: Client.Options;
|
|
804
|
-
});
|
|
805
|
-
private toSearchParams;
|
|
806
|
-
private parseErrorResponse;
|
|
807
|
-
private parseResponse;
|
|
808
|
-
protected publicRequest<T extends z4.$ZodType>({
|
|
809
|
-
endpoint,
|
|
810
|
-
params,
|
|
811
|
-
schema
|
|
812
|
-
}: {
|
|
813
|
-
endpoint: string;
|
|
814
|
-
params?: RawSearchParams;
|
|
815
|
-
schema: T;
|
|
816
|
-
}): Promise<z4.output<T>>;
|
|
817
|
-
protected privateRequest<T extends z4.$ZodType>({
|
|
818
|
-
endpoint,
|
|
819
|
-
params,
|
|
820
|
-
schema,
|
|
821
|
-
method
|
|
822
|
-
}: {
|
|
823
|
-
endpoint: string;
|
|
824
|
-
params?: RawSearchParams;
|
|
825
|
-
method: "GET" | "POST" | "DELETE";
|
|
826
|
-
schema: T;
|
|
827
|
-
}): Promise<z4.output<T>>;
|
|
828
|
-
private sign;
|
|
829
|
-
}
|
|
830
|
-
//#endregion
|
|
831
831
|
//#region src/rest/futures/types.d.ts
|
|
832
832
|
type FuturesKlineInterval = "1s" | "1m" | "3m" | "5m" | "30m" | "1h" | "2h" | "6h" | "8h" | "12h" | "3d" | "1M";
|
|
833
833
|
type FuturesContractType = z$1.infer<typeof FuturesContractTypeSchema>;
|
|
@@ -1318,7 +1318,7 @@ declare class FuturesRestClient extends BaseRestClient {
|
|
|
1318
1318
|
}>;
|
|
1319
1319
|
incomeHistory(params?: {
|
|
1320
1320
|
symbol?: string;
|
|
1321
|
-
incomeType?:
|
|
1321
|
+
incomeType?: FuturesIncomeType;
|
|
1322
1322
|
startTime?: number;
|
|
1323
1323
|
endTime?: number;
|
|
1324
1324
|
page?: number;
|
|
@@ -1492,7 +1492,8 @@ type OptArgs<CM extends ChannelsMap, K extends keyof CM> = CM[K]["subscriptionOp
|
|
|
1492
1492
|
type WebsocketClient<CM extends ChannelsMap> = { [K in keyof CM]: {
|
|
1493
1493
|
subscribe: (symbols: string[], ...args: OptArgs<CM, K>) => Promise<void>;
|
|
1494
1494
|
unsubscribe: (symbols: string[], ...args: OptArgs<CM, K>) => Promise<void>;
|
|
1495
|
-
|
|
1495
|
+
on: (cb: (data: CM[K]["messageSchema"]) => void, options?: CallbackOptions) => void;
|
|
1496
|
+
off: (cb: (data: CM[K]["messageSchema"]) => void) => void;
|
|
1496
1497
|
} };
|
|
1497
1498
|
//#endregion
|
|
1498
1499
|
//#region src/websocket/futures/types.d.ts
|
package/dist/index.js
CHANGED
|
@@ -563,11 +563,9 @@ var WeightError = class extends ResponseError {
|
|
|
563
563
|
parseWeightResponse(message) {
|
|
564
564
|
const match = message.match(/IP\(([^)]+)\).*?until (\d+)/);
|
|
565
565
|
if (!match) throw new ErrorMessageParsingError("Can't parse weight data");
|
|
566
|
-
const ip = String(match[1]);
|
|
567
|
-
const timestamp = Number(match[2]);
|
|
568
566
|
return {
|
|
569
|
-
ip,
|
|
570
|
-
timestamp
|
|
567
|
+
ip: String(match[1]),
|
|
568
|
+
timestamp: Number(match[2])
|
|
571
569
|
};
|
|
572
570
|
}
|
|
573
571
|
};
|
|
@@ -1064,8 +1062,7 @@ const makeSection = (baseUrl) => {
|
|
|
1064
1062
|
connectionController = new AbortController();
|
|
1065
1063
|
socket.addEventListener("message", parseMessageEvent, { signal: connectionController.signal });
|
|
1066
1064
|
connectionId = 1;
|
|
1067
|
-
|
|
1068
|
-
return subscribe(toSubscribe);
|
|
1065
|
+
return subscribe(Array.from(subscriptions.entries()).filter(([_, state]) => state !== "PENDING_UNSUBSCRIPTION").map(([key]) => key));
|
|
1069
1066
|
}
|
|
1070
1067
|
if (socket.readyState === WebSocket.CONNECTING) socket.addEventListener("open", () => resolve(), { once: true });
|
|
1071
1068
|
if (socket.readyState === WebSocket.CLOSING) socket.addEventListener("close", async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medievalrain/binance-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Binance API SDK",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"type": "module",
|
|
@@ -21,28 +21,26 @@
|
|
|
21
21
|
"test": "vitest"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "24.
|
|
24
|
+
"@types/node": "24.8.0",
|
|
25
25
|
"date-fns": "4.1.0",
|
|
26
|
-
"dotenv": "17.2.
|
|
27
|
-
"oxlint": "1.
|
|
26
|
+
"dotenv": "17.2.3",
|
|
27
|
+
"oxlint": "1.23.0",
|
|
28
28
|
"prettier": "3.6.2",
|
|
29
|
-
"tsdown": "0.15.
|
|
30
|
-
"typescript": "5.9.
|
|
31
|
-
"vitest": "4.0.0-beta.
|
|
32
|
-
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"zod": "^4"
|
|
29
|
+
"tsdown": "0.15.7",
|
|
30
|
+
"typescript": "5.9.3",
|
|
31
|
+
"vitest": "4.0.0-beta.18"
|
|
35
32
|
},
|
|
36
33
|
"dependencies": {
|
|
37
|
-
"@medievalrain/emitter": "0.
|
|
38
|
-
"undici": "7.16.0"
|
|
34
|
+
"@medievalrain/emitter": "0.2.17",
|
|
35
|
+
"undici": "7.16.0",
|
|
36
|
+
"zod": "^4"
|
|
39
37
|
},
|
|
40
38
|
"repository": {
|
|
41
39
|
"type": "git",
|
|
42
40
|
"url": "git+https://github.com/medievalrain/binance-ts.git"
|
|
43
41
|
},
|
|
44
42
|
"engines": {
|
|
45
|
-
"node": ">=22.
|
|
43
|
+
"node": ">=22.20.0"
|
|
46
44
|
},
|
|
47
|
-
"packageManager": "pnpm@10.
|
|
45
|
+
"packageManager": "pnpm@10.18.3"
|
|
48
46
|
}
|