@imbingox/acex 0.4.0-beta.2 → 0.4.0-beta.3
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/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import { createManagedWebSocket } from "../../internal/managed-websocket.ts";
|
|
|
9
9
|
import type {
|
|
10
10
|
AccountCredentials,
|
|
11
11
|
PositionSide,
|
|
12
|
+
TimeProvider,
|
|
12
13
|
VenueAccountCapabilities,
|
|
13
14
|
VenueOrderCapabilities,
|
|
14
15
|
} from "../../types/index.ts";
|
|
@@ -588,6 +589,7 @@ export class BinancePrivateAdapter implements PrivateUserDataAdapter {
|
|
|
588
589
|
private readonly options: {
|
|
589
590
|
readonly fetchFn?: FetchLike;
|
|
590
591
|
readonly httpTimeoutMs?: number;
|
|
592
|
+
readonly signingClock?: TimeProvider;
|
|
591
593
|
} = {},
|
|
592
594
|
) {}
|
|
593
595
|
|
|
@@ -911,7 +913,11 @@ export class BinancePrivateAdapter implements PrivateUserDataAdapter {
|
|
|
911
913
|
}
|
|
912
914
|
params.set(
|
|
913
915
|
"timestamp",
|
|
914
|
-
`${
|
|
916
|
+
`${
|
|
917
|
+
getNumberOption(accountOptions, "timestamp") ??
|
|
918
|
+
this.options.signingClock?.now() ??
|
|
919
|
+
Date.now()
|
|
920
|
+
}`,
|
|
915
921
|
);
|
|
916
922
|
params.set(
|
|
917
923
|
"recvWindow",
|
package/src/client/runtime.ts
CHANGED
|
@@ -105,7 +105,9 @@ export class AcexClientImpl implements AcexClient, ClientContext {
|
|
|
105
105
|
const marketAdapter = new BinanceMarketAdapter();
|
|
106
106
|
this.marketAdapters = new Map([[marketAdapter.venue, marketAdapter]]);
|
|
107
107
|
const privateAdapters = [
|
|
108
|
-
new BinancePrivateAdapter(
|
|
108
|
+
new BinancePrivateAdapter({
|
|
109
|
+
signingClock: options.clock,
|
|
110
|
+
}),
|
|
109
111
|
new JuplendPrivateAdapter(
|
|
110
112
|
options.account?.juplend?.rpcUrl,
|
|
111
113
|
options.account?.juplend?.jupApiKey,
|
package/src/types/shared.ts
CHANGED
|
@@ -24,6 +24,11 @@ export interface Logger {
|
|
|
24
24
|
error(msg: string, context?: Record<string, unknown>): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export interface TimeProvider {
|
|
28
|
+
/** Millisecond timestamp used for outbound request/signing timestamps. */
|
|
29
|
+
now(): number;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
export interface MarketRuntimeOptions {
|
|
28
33
|
l1InitialMessageTimeoutMs?: number;
|
|
29
34
|
l1StaleAfterMs?: number;
|
|
@@ -48,6 +53,8 @@ export interface AccountRuntimeOptions {
|
|
|
48
53
|
|
|
49
54
|
export interface CreateClientOptions {
|
|
50
55
|
sandbox?: boolean;
|
|
56
|
+
/** Request/signing clock; local receivedAt/freshness clocks stay independent. */
|
|
57
|
+
clock?: TimeProvider;
|
|
51
58
|
logger?: Logger;
|
|
52
59
|
logLevel?: LogLevel;
|
|
53
60
|
market?: MarketRuntimeOptions;
|