ault-sdk-ts 0.0.2-alpha.6 → 0.0.2-alpha.8

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.
@@ -9,18 +9,15 @@ export declare class DexWsClient {
9
9
  private pendingCommands;
10
10
  private reconnectAttempt;
11
11
  private reconnectTimer;
12
- private authenticated;
13
12
  private connectResolvers;
14
13
  constructor(url: string, opts?: DexWsOptions);
15
14
  get state(): WsConnectionState;
16
- get isAuthenticated(): boolean;
17
15
  connect(): Promise<void>;
18
16
  disconnect(): void;
19
17
  subscribe<T extends string>(topic: T, handlers: SubscriptionHandlers<PayloadFor<T>>, options?: {
20
18
  ttl?: number;
21
19
  }): Subscription;
22
20
  unsubscribe(topic: string): void;
23
- authenticate(address?: string, signMessage?: (msg: string) => Promise<string>): Promise<void>;
24
21
  on<E extends keyof DexWsEventMap>(event: E, handler: DexWsEventMap[E]): () => void;
25
22
  private createSocket;
26
23
  private handleMessage;
@@ -16,13 +16,7 @@ export interface WsUnsubscribeCommand {
16
16
  action: "unsubscribe";
17
17
  topic: string;
18
18
  }
19
- export interface WsAuthenticateCommand {
20
- action: "authenticate";
21
- address: string;
22
- signature: string;
23
- message: string;
24
- }
25
- export type WsClientCommand = WsSubscribeCommand | WsUnsubscribeCommand | WsAuthenticateCommand;
19
+ export type WsClientCommand = WsSubscribeCommand | WsUnsubscribeCommand;
26
20
  export interface WsCommandResponse {
27
21
  action: string;
28
22
  topic?: string;
@@ -30,7 +24,23 @@ export interface WsCommandResponse {
30
24
  error?: string;
31
25
  ttl?: number;
32
26
  }
33
- export type PayloadFor<T extends string> = T extends `orderbook:${string}` ? OrderbookResponse : T extends `trades:${string}` ? TradeResponse[] : T extends `ticker:${string}` ? TickerResponse : T extends `chart:${string}` ? OHLCVEntry : T extends `orders:${string}` ? OrderResponse[] : T extends `balances:${string}` ? BalancesResponse : T extends `mytrades:${string}` ? TradeResponse[] : unknown;
27
+ /**
28
+ * Payload for the `chain:block` topic. Emitted once per new block regardless
29
+ * of market activity so subscribers can drive liveness indicators.
30
+ *
31
+ * The block header fields (hash, proposer, tx_count, gas_used, gas_wanted)
32
+ * are optional because older chain versions may not supply them.
33
+ */
34
+ export interface BlockUpdate {
35
+ height: number;
36
+ timestamp: number;
37
+ hash?: string;
38
+ proposer?: string;
39
+ tx_count?: number;
40
+ gas_used?: number;
41
+ gas_wanted?: number;
42
+ }
43
+ export type PayloadFor<T extends string> = T extends `orderbook:${string}` ? OrderbookResponse : T extends `trades:${string}` ? TradeResponse[] : T extends `ticker:${string}` ? TickerResponse : T extends `chart:${string}` ? OHLCVEntry : T extends `orders:${string}` ? OrderResponse[] : T extends `balances:${string}` ? BalancesResponse : T extends `mytrades:${string}` ? TradeResponse[] : T extends "chain:block" ? BlockUpdate : unknown;
34
44
  export interface SubscriptionHandlers<T> {
35
45
  onData: (data: T, message: WsServerMessage<T>) => void;
36
46
  onError?: (error: Error) => void;
@@ -51,10 +61,6 @@ export interface DexWsOptions {
51
61
  reconnectDelay?: number;
52
62
  /** Max reconnect delay in ms (default: 30000). */
53
63
  maxReconnectDelay?: number;
54
- /** Sign a plain-text message and return the base64 signature. */
55
- signMessage?: (message: string) => Promise<string>;
56
- /** Blockchain address for authentication. */
57
- address?: string;
58
64
  }
59
65
  export interface DexWsEventMap {
60
66
  open: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ault-sdk-ts",
3
- "version": "0.0.2-alpha.6",
3
+ "version": "0.0.2-alpha.8",
4
4
  "description": "TypeScript SDK for the Ault blockchain with high-level transaction methods and REST query clients",
5
5
  "keywords": [
6
6
  "ault",