@steemit/steem-js 1.0.8 → 1.0.10

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/README.md CHANGED
@@ -17,7 +17,7 @@ A modern JavaScript/TypeScript library for interacting with the Steem blockchain
17
17
 
18
18
  ### Requirements
19
19
 
20
- - **Node.js**: >= 18.0.0 (LTS recommended)
20
+ - **Node.js**: >= 20.19.0 (LTS recommended)
21
21
  - **Browser**: Modern browsers with Web Crypto API support
22
22
 
23
23
  ### Installation
@@ -40,7 +40,7 @@ import { steem } from '@steemit/steem-js';
40
40
 
41
41
  // Configure API endpoint
42
42
  steem.config.set({
43
- node: 'https://api.steemit.com',
43
+ nodes: ['https://api.steemit.com'],
44
44
  address_prefix: 'STM'
45
45
  });
46
46
 
@@ -58,7 +58,7 @@ await steem.broadcast.voteAsync(postingWif, 'voter', 'author', 'permlink', 10000
58
58
  ```html
59
59
  <script src="https://cdn.jsdelivr.net/npm/@steemit/steem-js/dist/index.umd.min.js"></script>
60
60
  <script>
61
- steem.config.set({ node: 'https://api.steemit.com' });
61
+ steem.config.set({ nodes: ['https://api.steemit.com'] });
62
62
  steem.api.getAccountsAsync(['username']).then(console.log);
63
63
  </script>
64
64
  ```
@@ -3,7 +3,6 @@ import type { Transport } from './transports/types';
3
3
  import type { TransportOptions } from './transports/types';
4
4
  interface ApiOptions {
5
5
  url?: string;
6
- uri?: string;
7
6
  transport?: string | (new (options: TransportOptions) => Transport);
8
7
  logger?: Logger;
9
8
  useTestNet?: boolean;
@@ -30,15 +29,43 @@ export declare class Api extends EventEmitter {
30
29
  stop(): Promise<void>;
31
30
  send(api: string, data: unknown, callback: unknown): void | Promise<void>;
32
31
  call(method: string, params: unknown[], callback: (err: Error | null, result?: unknown) => void): void;
32
+ /**
33
+ * Promise-based version of call
34
+ * Makes a JSON-RPC call to the Steem blockchain
35
+ * @param method Method name (e.g., 'condenser_api.get_accounts')
36
+ * @param params Parameters array for the method
37
+ * @returns Promise that resolves with the result or rejects with an error
38
+ */
39
+ callAsync(method: string, params: unknown[]): Promise<unknown>;
33
40
  signedCall(method: string, params: unknown[], account: string, key: string, callback: (err: Error | null, result?: unknown) => void): void;
41
+ /**
42
+ * Promise-based version of signedCall
43
+ * Makes an authenticated JSON-RPC call with cryptographic signature
44
+ * @param method Method name (e.g., 'conveyor.is_email_registered')
45
+ * @param params Parameters array for the method
46
+ * @param account Account name to sign the request with
47
+ * @param key Private key (WIF) to sign the request
48
+ * @returns Promise that resolves with the result or rejects with an error
49
+ */
50
+ signedCallAsync(method: string, params: unknown[], account: string, key: string): Promise<unknown>;
34
51
  /**
35
52
  * Verify a signed RPC request
36
53
  * @param signedRequest The signed request to verify
37
54
  * @param callback Callback function
38
55
  */
39
56
  verifySignedRequest(signedRequest: unknown, callback: (err: Error | null, result?: unknown) => void): void;
57
+ /**
58
+ * Promise-based version of verifySignedRequest
59
+ * Verifies a signed RPC request
60
+ * @param signedRequest The signed request to verify
61
+ * @returns Promise that resolves with verification result or rejects with an error
62
+ */
63
+ verifySignedRequestAsync(signedRequest: unknown): Promise<{
64
+ valid: boolean;
65
+ params: unknown;
66
+ }>;
40
67
  setOptions(options: ApiOptions): void;
41
- setUri(url: string): void;
68
+ setUrl(url: string): void;
42
69
  streamBlockNumber(mode?: string | ((err: Error | null, blockNumber?: unknown) => void), callback?: (err: Error | null, blockNumber?: unknown) => void, ts?: number): () => void;
43
70
  streamBlock(mode: string | undefined, callback: (err: Error | null, block?: unknown) => void): () => void;
44
71
  streamTransactions(mode?: string | ((err: Error | null, tx?: unknown) => void), callback?: (err: Error | null, tx?: unknown) => void): () => void;
@@ -46,12 +73,28 @@ export declare class Api extends EventEmitter {
46
73
  broadcastTransactionSynchronousWith(options: {
47
74
  transaction: unknown;
48
75
  }, callback: (err: Error | null, result?: unknown) => void): void;
76
+ /**
77
+ * Promise-based version of broadcastTransactionSynchronousWith
78
+ * Broadcasts a transaction synchronously
79
+ * @param options Options object containing the transaction
80
+ * @returns Promise that resolves with the result or rejects with an error
81
+ */
82
+ broadcastTransactionSynchronousWithAsync(options: {
83
+ transaction: unknown;
84
+ }): Promise<unknown>;
49
85
  /**
50
86
  * Broadcast a transaction to the blockchain.
51
87
  * @param trx The transaction object
52
88
  * @param callback Callback function
53
89
  */
54
90
  broadcastTransaction(trx: unknown, callback: (err: Error | null, result?: unknown) => void): void;
91
+ /**
92
+ * Promise-based version of broadcastTransaction
93
+ * Broadcasts a transaction to the blockchain
94
+ * @param trx The transaction object
95
+ * @returns Promise that resolves with the result or rejects with an error
96
+ */
97
+ broadcastTransactionAsync(trx: unknown): Promise<unknown>;
55
98
  /**
56
99
  * Sign a transaction with the provided private key(s).
57
100
  * @param trx The transaction object
@@ -76,18 +119,40 @@ export declare class Api extends EventEmitter {
76
119
  * @param callback Callback function
77
120
  */
78
121
  broadcastTransactionWithCallback(confirmationCallback: (result: unknown) => void, trx: unknown, callback: (err: Error | null, result?: unknown) => void): void;
122
+ /**
123
+ * Promise-based version of broadcastTransactionWithCallback
124
+ * Note: The confirmationCallback will still be called when the transaction is confirmed
125
+ * @param confirmationCallback Callback function for transaction confirmation
126
+ * @param trx Transaction object to broadcast
127
+ * @returns Promise that resolves with the result or rejects with an error
128
+ */
129
+ broadcastTransactionWithCallbackAsync(confirmationCallback: (result: unknown) => void, trx: unknown): Promise<unknown>;
79
130
  /**
80
131
  * Broadcast a block to the network.
81
132
  * @param block Block object to broadcast
82
133
  * @param callback Callback function
83
134
  */
84
135
  broadcastBlock(block: unknown, callback: (err: Error | null, result?: unknown) => void): void;
136
+ /**
137
+ * Promise-based version of broadcastBlock
138
+ * Broadcasts a block to the network
139
+ * @param block Block object to broadcast
140
+ * @returns Promise that resolves with the result or rejects with an error
141
+ */
142
+ broadcastBlockAsync(block: unknown): Promise<unknown>;
85
143
  /**
86
144
  * Set the maximum block age for transaction acceptance.
87
145
  * @param maxBlockAge Maximum block age in seconds
88
146
  * @param callback Callback function
89
147
  */
90
148
  setMaxBlockAge(maxBlockAge: number, callback: (err: Error | null, result?: unknown) => void): void;
149
+ /**
150
+ * Promise-based version of setMaxBlockAge
151
+ * Sets the maximum block age for transaction acceptance
152
+ * @param maxBlockAge Maximum block age in seconds
153
+ * @returns Promise that resolves with the result or rejects with an error
154
+ */
155
+ setMaxBlockAgeAsync(maxBlockAge: number): Promise<unknown>;
91
156
  /**
92
157
  * Verify transaction authority.
93
158
  * @param trx Transaction object to verify
@@ -2,15 +2,15 @@ import { TransportOptions, JsonRpcRequest } from './types';
2
2
  import { BaseTransport } from './base';
3
3
  /**
4
4
  * Makes a JSON-RPC request using native fetch API
5
- * Universal implementation that works in both Node.js (18+) and browser
5
+ * Universal implementation that works in both Node.js (20.19+) and browser
6
6
  *
7
- * @param uri - The URI to the JSON-RPC endpoint
7
+ * @param url - The URL to the JSON-RPC endpoint
8
8
  * @param request - The JSON-RPC request object
9
9
  * @param fetchMethod - Optional fetch implementation (defaults to global fetch)
10
10
  * @param timeoutMs - Request timeout in milliseconds (default: 30000)
11
11
  * @returns Promise resolving to the JSON-RPC result
12
12
  */
13
- export declare const jsonRpc: (uri: string, request: Partial<JsonRpcRequest>, fetchMethod?: typeof fetch, timeoutMs?: number) => Promise<unknown>;
13
+ export declare const jsonRpc: (url: string, request: Partial<JsonRpcRequest>, fetchMethod?: typeof fetch, timeoutMs?: number) => Promise<unknown>;
14
14
  export declare class HttpTransport extends BaseTransport {
15
15
  constructor(options: TransportOptions);
16
16
  get nonRetriableOperations(): string[];
@@ -1,11 +1,10 @@
1
1
  export interface TransportOptions {
2
2
  url?: string;
3
- uri?: string;
4
3
  /**
5
4
  * WebSocket URL
6
5
  * NOTE: WebSocket functionality is currently not supported.
7
6
  * This field is kept for backward compatibility only.
8
- * Please use HTTP transport (via url or uri field) for API calls.
7
+ * Please use HTTP transport (via url field) for API calls.
9
8
  */
10
9
  websocket?: string;
11
10
  transport?: string | unknown;