@steemit/steem-js 1.0.20 → 1.1.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/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Steem.js
2
2
 
3
- > ⚠️ Under Construction: This SDK is currently under active development. Do not use it in the production environment.
4
-
5
3
  A modern JavaScript/TypeScript library for interacting with the Steem blockchain. Complete refactoring with TypeScript, modern tooling, and improved security.
6
4
 
7
5
  [![npm version](https://img.shields.io/npm/v/@steemit/steem-js.svg)](https://www.npmjs.com/package/@steemit/steem-js)
@@ -2,6 +2,7 @@
2
2
  * Type definitions for dynamically generated API methods.
3
3
  * Runtime routing (condenser_api vs database_api) is defined in methods.ts; see docs/README.md#api-routing.
4
4
  */
5
+ import type { ExtendedAccount, DynamicGlobalProperties, Discussion, SignedBlock, FollowApiObject, AccountHistoryEntry } from '../types/protocol';
5
6
  export type ApiCallback<T = unknown> = (err: Error | null, result?: T) => void;
6
7
  type ApiMethodWithParams<TResult = unknown> = (...args: unknown[]) => Promise<TResult> | void;
7
8
  type ApiMethodNoParams<TResult = unknown> = (callback?: ApiCallback<TResult>) => Promise<TResult> | void;
@@ -10,69 +11,71 @@ type ApiMethodAsync<TParams extends unknown[] = unknown[], TResult = unknown> =
10
11
  type ApiMethodWithAsync<TResult = unknown> = (options: Record<string, unknown>) => Promise<TResult>;
11
12
  /**
12
13
  * Type definitions for all API methods
13
- * This interface provides type safety for dynamically generated methods
14
+ * This interface provides type safety for dynamically generated methods.
15
+ * Return types mirror the C++ node's condenser_api FC_REFLECT structs; see
16
+ * src/types/protocol.ts for the protocol definitions.
14
17
  */
15
18
  export interface ApiMethodSignatures {
16
- getAccounts(accounts: string[], callback?: ApiCallback<any[]>): Promise<any[]> | void;
17
- getAccountsAsync(accounts: string[]): Promise<any[]>;
19
+ getAccounts(accounts: string[], callback?: ApiCallback<ExtendedAccount[]>): Promise<ExtendedAccount[]> | void;
20
+ getAccountsAsync(accounts: string[]): Promise<ExtendedAccount[]>;
18
21
  getAccountsWith(options: {
19
22
  names: string[];
20
- }, callback?: ApiCallback<any[]>): Promise<any[]> | void;
23
+ }, callback?: ApiCallback<ExtendedAccount[]>): Promise<ExtendedAccount[]> | void;
21
24
  getAccountsWithAsync(options: {
22
25
  names: string[];
23
- }): Promise<any[]>;
24
- getAccountHistory(account: string, from: number, limit: number, callback?: ApiCallback<any[]>): Promise<any[]> | void;
25
- getAccountHistoryAsync(account: string, from: number, limit: number): Promise<any[]>;
26
+ }): Promise<ExtendedAccount[]>;
27
+ getAccountHistory(account: string, from: number, limit: number, callback?: ApiCallback<AccountHistoryEntry[]>): Promise<AccountHistoryEntry[]> | void;
28
+ getAccountHistoryAsync(account: string, from: number, limit: number): Promise<AccountHistoryEntry[]>;
26
29
  getAccountHistoryWith(options: {
27
30
  account: string;
28
31
  from: number;
29
32
  limit: number;
30
- }, callback?: ApiCallback<any[]>): Promise<any[]> | void;
33
+ }, callback?: ApiCallback<AccountHistoryEntry[]>): Promise<AccountHistoryEntry[]> | void;
31
34
  getAccountHistoryWithAsync(options: {
32
35
  account: string;
33
36
  from: number;
34
37
  limit: number;
35
- }): Promise<any[]>;
36
- getDynamicGlobalProperties(callback?: ApiCallback<any>): Promise<any> | void;
37
- getDynamicGlobalPropertiesAsync(): Promise<any>;
38
- getDynamicGlobalPropertiesWith(options: Record<string, unknown>, callback?: ApiCallback<any>): Promise<any> | void;
39
- getDynamicGlobalPropertiesWithAsync(options: Record<string, unknown>): Promise<any>;
40
- getContent(author: string, permlink: string, callback?: ApiCallback<any>): Promise<any> | void;
41
- getContentAsync(author: string, permlink: string): Promise<any>;
38
+ }): Promise<AccountHistoryEntry[]>;
39
+ getDynamicGlobalProperties(callback?: ApiCallback<DynamicGlobalProperties>): Promise<DynamicGlobalProperties> | void;
40
+ getDynamicGlobalPropertiesAsync(): Promise<DynamicGlobalProperties>;
41
+ getDynamicGlobalPropertiesWith(options: Record<string, unknown>, callback?: ApiCallback<DynamicGlobalProperties>): Promise<DynamicGlobalProperties> | void;
42
+ getDynamicGlobalPropertiesWithAsync(options: Record<string, unknown>): Promise<DynamicGlobalProperties>;
43
+ getContent(author: string, permlink: string, callback?: ApiCallback<Discussion>): Promise<Discussion> | void;
44
+ getContentAsync(author: string, permlink: string): Promise<Discussion>;
42
45
  getContentWith(options: {
43
46
  author: string;
44
47
  permlink: string;
45
- }, callback?: ApiCallback<any>): Promise<any> | void;
48
+ }, callback?: ApiCallback<Discussion>): Promise<Discussion> | void;
46
49
  getContentWithAsync(options: {
47
50
  author: string;
48
51
  permlink: string;
49
- }): Promise<any>;
50
- getFollowers(following: string, startFollower: string, followType: string, limit: number, callback?: ApiCallback<any[]>): Promise<any[]> | void;
51
- getFollowersAsync(following: string, startFollower: string, followType: string, limit: number): Promise<any[]>;
52
+ }): Promise<Discussion>;
53
+ getFollowers(following: string, startFollower: string, followType: string, limit: number, callback?: ApiCallback<FollowApiObject[]>): Promise<FollowApiObject[]> | void;
54
+ getFollowersAsync(following: string, startFollower: string, followType: string, limit: number): Promise<FollowApiObject[]>;
52
55
  getFollowersWith(options: {
53
56
  following: string;
54
57
  startFollower: string;
55
58
  followType: string;
56
59
  limit: number;
57
- }, callback?: ApiCallback<any[]>): Promise<any[]> | void;
60
+ }, callback?: ApiCallback<FollowApiObject[]>): Promise<FollowApiObject[]> | void;
58
61
  getFollowersWithAsync(options: {
59
62
  following: string;
60
63
  startFollower: string;
61
64
  followType: string;
62
65
  limit: number;
63
- }): Promise<any[]>;
64
- getBlock(blockNum: number, callback?: ApiCallback<any>): Promise<any> | void;
65
- getBlockAsync(blockNum: number): Promise<any>;
66
+ }): Promise<FollowApiObject[]>;
67
+ getBlock(blockNum: number, callback?: ApiCallback<SignedBlock>): Promise<SignedBlock> | void;
68
+ getBlockAsync(blockNum: number): Promise<SignedBlock>;
66
69
  getBlockWith(options: {
67
70
  blockNum: number;
68
- }, callback?: ApiCallback<any>): Promise<any> | void;
71
+ }, callback?: ApiCallback<SignedBlock>): Promise<SignedBlock> | void;
69
72
  getBlockWithAsync(options: {
70
73
  blockNum: number;
71
- }): Promise<any>;
72
- getConfig(callback?: ApiCallback<any>): Promise<any> | void;
73
- getConfigAsync(): Promise<any>;
74
- getConfigWith(options: Record<string, unknown>, callback?: ApiCallback<any>): Promise<any> | void;
75
- getConfigWithAsync(options: Record<string, unknown>): Promise<any>;
74
+ }): Promise<SignedBlock>;
75
+ getConfig(callback?: ApiCallback<Record<string, unknown>>): Promise<Record<string, unknown>> | void;
76
+ getConfigAsync(): Promise<Record<string, unknown>>;
77
+ getConfigWith(options: Record<string, unknown>, callback?: ApiCallback<Record<string, unknown>>): Promise<Record<string, unknown>> | void;
78
+ getConfigWithAsync(options: Record<string, unknown>): Promise<Record<string, unknown>>;
76
79
  [methodName: string]: ApiMethodWithParams | ApiMethodNoParams | ApiMethodWith | ApiMethodAsync<unknown[]> | ApiMethodWithAsync | unknown;
77
80
  }
78
81
  export {};
@@ -4,6 +4,5 @@ export { PrivateKey } from './src/key_private';
4
4
  export { PublicKey } from './src/key_public';
5
5
  export { Signature } from './src/signature';
6
6
  export { normalize as brainKey } from './src/brain_key';
7
- export * as key_utils from './src/key_utils';
8
7
  export * as hash from './src/hash';
9
8
  export { Config as ecc_config } from '../../config';
@@ -4,6 +4,5 @@ export { PrivateKey } from './key_private';
4
4
  export { PublicKey } from './key_public';
5
5
  export { Signature } from './signature';
6
6
  export { normalize as brainKey } from './brain_key';
7
- export * as key_utils from './key_utils';
8
7
  export * as hash from './hash';
9
8
  export { Config as ecc_config } from '../../../config';
@@ -17267,7 +17267,7 @@ function recoverPubKey(curve, e, signature, i) {
17267
17267
  const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
17268
17268
  return Q;
17269
17269
  }
17270
- catch (error) {
17270
+ catch {
17271
17271
  // Fallback to manual implementation if elliptic's method fails
17272
17272
  const G = curve.g;
17273
17273
  // A set LSB signifies that the y-coordinate is odd
@@ -17287,7 +17287,7 @@ function recoverPubKey(curve, e, signature, i) {
17287
17287
  try {
17288
17288
  R = curve.curve.pointFromX(xHexPadded, isYOdd);
17289
17289
  }
17290
- catch (error) {
17290
+ catch {
17291
17291
  // If hex string fails, try with Buffer
17292
17292
  const xBuffer = x.toArrayLike(bufferExports.Buffer, 'be', 32);
17293
17293
  R = curve.curve.pointFromX(xBuffer, isYOdd);
@@ -29737,7 +29737,7 @@ const steem = {
29737
29737
  memo,
29738
29738
  operations,
29739
29739
  utils: utils$3,
29740
- version: '1.0.20',
29740
+ version: '1.1.0',
29741
29741
  config: {
29742
29742
  set: (options) => {
29743
29743
  // If nodes is provided, extract the first node as url for API