@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/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Api } from './api';
2
1
  import * as auth from './auth';
3
2
  import * as broadcast from './broadcast';
4
3
  import * as formatter from './formatter';
@@ -7,7 +6,7 @@ import * as operations from './operations';
7
6
  import * as serializer from './serializer';
8
7
  import * as utils from './utils';
9
8
  declare const steem: {
10
- api: Api;
9
+ api: import("./api").Api;
11
10
  auth: typeof auth;
12
11
  broadcast: typeof broadcast;
13
12
  formatter: typeof formatter;
@@ -29,3 +28,4 @@ declare const steem: {
29
28
  };
30
29
  export { steem };
31
30
  export * from './crypto';
31
+ export { Api } from './api';
package/dist/index.js CHANGED
@@ -31,12 +31,10 @@ class Config {
31
31
  const DEFAULT_CONFIG = {
32
32
  address_prefix: 'STM',
33
33
  chain_id: '0000000000000000000000000000000000000000000000000000000000000000',
34
- // Default API endpoint: api.steemit.com
35
- node: 'https://api.steemit.com',
34
+ // Default API endpoints: api.steemit.com
36
35
  nodes: [
37
36
  'https://api.steemit.com'
38
- ],
39
- uri: 'https://api.steemit.com'
37
+ ]
40
38
  };
41
39
  // Singleton config instance
42
40
  const config = new Config();
@@ -274,7 +272,7 @@ function requireBn$1 () {
274
272
  if (hasRequiredBn$1) return bn$1.exports;
275
273
  hasRequiredBn$1 = 1;
276
274
  (function (module) {
277
- (function (module, exports$1) {
275
+ (function (module, exports) {
278
276
 
279
277
  // Utils
280
278
  function assert (val, msg) {
@@ -317,7 +315,7 @@ function requireBn$1 () {
317
315
  if (typeof module === 'object') {
318
316
  module.exports = BN;
319
317
  } else {
320
- exports$1.BN = BN;
318
+ exports.BN = BN;
321
319
  }
322
320
 
323
321
  BN.BN = BN;
@@ -3749,9 +3747,9 @@ var hasRequiredUtils$2;
3749
3747
  function requireUtils$2 () {
3750
3748
  if (hasRequiredUtils$2) return utils$1;
3751
3749
  hasRequiredUtils$2 = 1;
3752
- (function (exports$1) {
3750
+ (function (exports) {
3753
3751
 
3754
- var utils = exports$1;
3752
+ var utils = exports;
3755
3753
 
3756
3754
  function toArray(msg, enc) {
3757
3755
  if (Array.isArray(msg))
@@ -3816,9 +3814,9 @@ var hasRequiredUtils$1;
3816
3814
  function requireUtils$1 () {
3817
3815
  if (hasRequiredUtils$1) return utils$2;
3818
3816
  hasRequiredUtils$1 = 1;
3819
- (function (exports$1) {
3817
+ (function (exports) {
3820
3818
 
3821
- var utils = exports$1;
3819
+ var utils = exports;
3822
3820
  var BN = requireBn$1();
3823
3821
  var minAssert = requireMinimalisticAssert();
3824
3822
  var minUtils = requireUtils$2();
@@ -6042,9 +6040,9 @@ var hasRequiredCurve;
6042
6040
  function requireCurve () {
6043
6041
  if (hasRequiredCurve) return curve;
6044
6042
  hasRequiredCurve = 1;
6045
- (function (exports$1) {
6043
+ (function (exports) {
6046
6044
 
6047
- var curve = exports$1;
6045
+ var curve = exports;
6048
6046
 
6049
6047
  curve.base = requireBase();
6050
6048
  curve.short = requireShort();
@@ -7348,8 +7346,8 @@ var hasRequiredHash;
7348
7346
  function requireHash () {
7349
7347
  if (hasRequiredHash) return hash;
7350
7348
  hasRequiredHash = 1;
7351
- (function (exports$1) {
7352
- var hash = exports$1;
7349
+ (function (exports) {
7350
+ var hash = exports;
7353
7351
 
7354
7352
  hash.utils = requireUtils();
7355
7353
  hash.common = requireCommon$1();
@@ -8162,9 +8160,9 @@ var hasRequiredCurves;
8162
8160
  function requireCurves () {
8163
8161
  if (hasRequiredCurves) return curves;
8164
8162
  hasRequiredCurves = 1;
8165
- (function (exports$1) {
8163
+ (function (exports) {
8166
8164
 
8167
- var curves = exports$1;
8165
+ var curves = exports;
8168
8166
 
8169
8167
  var hash = requireHash();
8170
8168
  var curve = requireCurve();
@@ -9403,9 +9401,9 @@ var hasRequiredElliptic;
9403
9401
  function requireElliptic () {
9404
9402
  if (hasRequiredElliptic) return elliptic;
9405
9403
  hasRequiredElliptic = 1;
9406
- (function (exports$1) {
9404
+ (function (exports) {
9407
9405
 
9408
- var elliptic = exports$1;
9406
+ var elliptic = exports;
9409
9407
 
9410
9408
  elliptic.version = require$$0$1.version;
9411
9409
  elliptic.utils = requireUtils$1();
@@ -9432,7 +9430,7 @@ function requireBn () {
9432
9430
  if (hasRequiredBn) return bn.exports;
9433
9431
  hasRequiredBn = 1;
9434
9432
  (function (module) {
9435
- (function (module, exports$1) {
9433
+ (function (module, exports) {
9436
9434
 
9437
9435
  // Utils
9438
9436
  function assert (val, msg) {
@@ -9475,7 +9473,7 @@ function requireBn () {
9475
9473
  if (typeof module === 'object') {
9476
9474
  module.exports = BN;
9477
9475
  } else {
9478
- exports$1.BN = BN;
9476
+ exports.BN = BN;
9479
9477
  }
9480
9478
 
9481
9479
  BN.BN = BN;
@@ -14407,24 +14405,24 @@ class Address {
14407
14405
  * @returns Buffer with random bytes
14408
14406
  */
14409
14407
  function randomBytes(size) {
14410
- // Always try Web Crypto API first (works in both browser and Node.js 18+)
14408
+ // Always try Web Crypto API first (works in both browser and Node.js 20.19+)
14411
14409
  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
14412
14410
  const array = new Uint8Array(size);
14413
14411
  crypto.getRandomValues(array);
14414
14412
  return Buffer.from(array);
14415
14413
  }
14416
14414
  // Fallback to Node.js crypto only if Web Crypto API is not available
14417
- // This code path should not be reached in Node.js 18+ (which has Web Crypto API)
14415
+ // This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
14418
14416
  // and is kept as a safety fallback for edge cases.
14419
14417
  // In browser builds, Rollup will tree-shake this code away because
14420
14418
  // the condition above will always be true in browsers.
14421
14419
  //
14422
- // Note: This SDK requires Node.js >= 18.0.0 (see package.json engines field).
14423
- // Node.js 18+ has Web Crypto API, so this fallback is rarely needed.
14424
- // In ESM mode, require is undefined, but since Node.js 18+ has Web Crypto API,
14420
+ // Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
14421
+ // Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
14422
+ // In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
14425
14423
  // this code path won't be reached in ESM mode with the minimum required version.
14426
14424
  try {
14427
- // Use dynamic require as a safety fallback (for Node.js < 18 edge cases)
14425
+ // Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
14428
14426
  // eslint-disable-next-line @typescript-eslint/no-require-imports
14429
14427
  const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
14430
14428
  if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
@@ -14435,7 +14433,7 @@ function randomBytes(size) {
14435
14433
  // Ignore require errors in browser environments or ESM mode
14436
14434
  }
14437
14435
  // If neither Web Crypto API nor Node.js crypto is available, throw error
14438
- throw new Error('Random bytes generation is not available. This library requires either Web Crypto API (browser/Node.js 18+) or Node.js crypto module.');
14436
+ throw new Error('Random bytes generation is not available. This library requires either Web Crypto API (browser/Node.js 20.19+) or Node.js crypto module.');
14439
14437
  }
14440
14438
 
14441
14439
  /**
@@ -15388,11 +15386,11 @@ var hasRequiredRetry$1;
15388
15386
  function requireRetry$1 () {
15389
15387
  if (hasRequiredRetry$1) return retry$2;
15390
15388
  hasRequiredRetry$1 = 1;
15391
- (function (exports$1) {
15389
+ (function (exports) {
15392
15390
  var RetryOperation = requireRetry_operation();
15393
15391
 
15394
- exports$1.operation = function(options) {
15395
- var timeouts = exports$1.timeouts(options);
15392
+ exports.operation = function(options) {
15393
+ var timeouts = exports.timeouts(options);
15396
15394
  return new RetryOperation(timeouts, {
15397
15395
  forever: options && (options.forever || options.retries === Infinity),
15398
15396
  unref: options && options.unref,
@@ -15400,7 +15398,7 @@ function requireRetry$1 () {
15400
15398
  });
15401
15399
  };
15402
15400
 
15403
- exports$1.timeouts = function(options) {
15401
+ exports.timeouts = function(options) {
15404
15402
  if (options instanceof Array) {
15405
15403
  return [].concat(options);
15406
15404
  }
@@ -15437,7 +15435,7 @@ function requireRetry$1 () {
15437
15435
  return timeouts;
15438
15436
  };
15439
15437
 
15440
- exports$1.createTimeout = function(attempt, opts) {
15438
+ exports.createTimeout = function(attempt, opts) {
15441
15439
  var random = (opts.randomize)
15442
15440
  ? (Math.random() + 1)
15443
15441
  : 1;
@@ -15448,7 +15446,7 @@ function requireRetry$1 () {
15448
15446
  return timeout;
15449
15447
  };
15450
15448
 
15451
- exports$1.wrap = function(obj, options, methods) {
15449
+ exports.wrap = function(obj, options, methods) {
15452
15450
  if (options instanceof Array) {
15453
15451
  methods = options;
15454
15452
  options = null;
@@ -15468,7 +15466,7 @@ function requireRetry$1 () {
15468
15466
  var original = obj[method];
15469
15467
 
15470
15468
  obj[method] = function retryWrapper(original) {
15471
- var op = exports$1.operation(options);
15469
+ var op = exports.operation(options);
15472
15470
  var args = Array.prototype.slice.call(arguments, 1);
15473
15471
  var callback = args.pop();
15474
15472
 
@@ -15561,15 +15559,15 @@ class JsonRpcError extends Error {
15561
15559
  }
15562
15560
  /**
15563
15561
  * Makes a JSON-RPC request using native fetch API
15564
- * Universal implementation that works in both Node.js (18+) and browser
15562
+ * Universal implementation that works in both Node.js (20.19+) and browser
15565
15563
  *
15566
- * @param uri - The URI to the JSON-RPC endpoint
15564
+ * @param url - The URL to the JSON-RPC endpoint
15567
15565
  * @param request - The JSON-RPC request object
15568
15566
  * @param fetchMethod - Optional fetch implementation (defaults to global fetch)
15569
15567
  * @param timeoutMs - Request timeout in milliseconds (default: 30000)
15570
15568
  * @returns Promise resolving to the JSON-RPC result
15571
15569
  */
15572
- const jsonRpc = async (uri, request, fetchMethod = fetch, timeoutMs = 30000) => {
15570
+ const jsonRpc = async (url, request, fetchMethod = fetch, timeoutMs = 30000) => {
15573
15571
  const payload = {
15574
15572
  jsonrpc: '2.0',
15575
15573
  ...request
@@ -15582,7 +15580,7 @@ const jsonRpc = async (uri, request, fetchMethod = fetch, timeoutMs = 30000) =>
15582
15580
  }, timeoutMs);
15583
15581
  });
15584
15582
  // Create the fetch promise
15585
- const fetchPromise = fetchMethod(uri, {
15583
+ const fetchPromise = fetchMethod(url, {
15586
15584
  method: 'POST',
15587
15585
  headers: {
15588
15586
  'Content-Type': 'application/json',
@@ -15631,9 +15629,9 @@ class HttpTransport extends BaseTransport {
15631
15629
  if (typeof callback !== 'function') {
15632
15630
  callback = () => { };
15633
15631
  }
15634
- const uri = this.options.uri;
15635
- if (!uri) {
15636
- throw new Error('HTTP transport requires a valid URI');
15632
+ const url = this.options.url;
15633
+ if (!url) {
15634
+ throw new Error('HTTP transport requires a valid URL');
15637
15635
  }
15638
15636
  const fetchMethod = this.options.fetchMethod || fetch;
15639
15637
  const id = data.id;
@@ -15644,7 +15642,7 @@ class HttpTransport extends BaseTransport {
15644
15642
  if (!isBroadcast && retryOptions) {
15645
15643
  const operation = typeof retryOptions === 'object' ? retry.operation(retryOptions) : retry.operation();
15646
15644
  operation.attempt((currentAttempt) => {
15647
- fetchMethod(uri, {
15645
+ fetchMethod(url, {
15648
15646
  method: 'POST',
15649
15647
  body: JSON.stringify({
15650
15648
  jsonrpc: '2.0',
@@ -15678,7 +15676,7 @@ class HttpTransport extends BaseTransport {
15678
15676
  });
15679
15677
  }
15680
15678
  else {
15681
- fetchMethod(uri, {
15679
+ fetchMethod(url, {
15682
15680
  method: 'POST',
15683
15681
  body: JSON.stringify({
15684
15682
  jsonrpc: '2.0',
@@ -15908,7 +15906,7 @@ function requireLong () {
15908
15906
  if (value >= TWO_PWR_64_DBL)
15909
15907
  return MAX_UNSIGNED_VALUE;
15910
15908
  } else {
15911
- if (value <= -TWO_PWR_63_DBL)
15909
+ if (value <= -9223372036854776e3)
15912
15910
  return MIN_VALUE;
15913
15911
  if (value + 1 >= TWO_PWR_63_DBL)
15914
15912
  return MAX_VALUE;
@@ -20653,7 +20651,7 @@ function fromNumber(value, unsigned) {
20653
20651
  if (value < 0) return UZERO;
20654
20652
  if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
20655
20653
  } else {
20656
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
20654
+ if (value <= -9223372036854776e3) return MIN_VALUE;
20657
20655
  if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
20658
20656
  }
20659
20657
  if (value < 0) return fromNumber(-value, unsigned).neg();
@@ -22618,7 +22616,6 @@ class Api extends EventEmitter {
22618
22616
  _setTransport(options) {
22619
22617
  // Use HTTP transport only
22620
22618
  if (options.url && options.url.match(/^((http|https)?:\/\/)/)) {
22621
- options.uri = options.url;
22622
22619
  options.transport = 'http';
22623
22620
  this._transportType = options.transport;
22624
22621
  this.options = options;
@@ -22644,9 +22641,10 @@ class Api extends EventEmitter {
22644
22641
  }
22645
22642
  }
22646
22643
  else {
22647
- // Default to HTTP for https://api.steemit.com
22648
- const defaultNode = getConfig().get('node') || 'https://api.steemit.com';
22649
- options.uri = defaultNode;
22644
+ // Default to HTTP using first node from config.nodes
22645
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
22646
+ const defaultNode = nodes[0] || 'https://api.steemit.com';
22647
+ options.url = defaultNode;
22650
22648
  options.transport = 'http';
22651
22649
  this._transportType = options.transport;
22652
22650
  this.options = options;
@@ -22729,9 +22727,28 @@ class Api extends EventEmitter {
22729
22727
  }
22730
22728
  const id = ++this.seqNo;
22731
22729
  const fetchMethod = this.options.fetchMethod || fetch;
22732
- jsonRpc(this.options.uri, { method, params, id }, fetchMethod)
22730
+ jsonRpc(this.options.url, { method, params, id }, fetchMethod)
22733
22731
  .then(res => { callback(null, res); }, err => { callback(err); });
22734
22732
  }
22733
+ /**
22734
+ * Promise-based version of call
22735
+ * Makes a JSON-RPC call to the Steem blockchain
22736
+ * @param method Method name (e.g., 'condenser_api.get_accounts')
22737
+ * @param params Parameters array for the method
22738
+ * @returns Promise that resolves with the result or rejects with an error
22739
+ */
22740
+ callAsync(method, params) {
22741
+ return new Promise((resolve, reject) => {
22742
+ this.call(method, params, (err, result) => {
22743
+ if (err) {
22744
+ reject(err);
22745
+ }
22746
+ else {
22747
+ resolve(result);
22748
+ }
22749
+ });
22750
+ });
22751
+ }
22735
22752
  signedCall(method, params, account, key, callback) {
22736
22753
  if (this._transportType !== 'http') {
22737
22754
  callback(new Error('RPC methods can only be called when using http transport'));
@@ -22747,9 +22764,30 @@ class Api extends EventEmitter {
22747
22764
  return;
22748
22765
  }
22749
22766
  const fetchMethod = this.options.fetchMethod || fetch;
22750
- jsonRpc(this.options.uri, request, fetchMethod)
22767
+ jsonRpc(this.options.url, request, fetchMethod)
22751
22768
  .then(res => { callback(null, res); }, err => { callback(err); });
22752
22769
  }
22770
+ /**
22771
+ * Promise-based version of signedCall
22772
+ * Makes an authenticated JSON-RPC call with cryptographic signature
22773
+ * @param method Method name (e.g., 'conveyor.is_email_registered')
22774
+ * @param params Parameters array for the method
22775
+ * @param account Account name to sign the request with
22776
+ * @param key Private key (WIF) to sign the request
22777
+ * @returns Promise that resolves with the result or rejects with an error
22778
+ */
22779
+ signedCallAsync(method, params, account, key) {
22780
+ return new Promise((resolve, reject) => {
22781
+ this.signedCall(method, params, account, key, (err, result) => {
22782
+ if (err) {
22783
+ reject(err);
22784
+ }
22785
+ else {
22786
+ resolve(result);
22787
+ }
22788
+ });
22789
+ });
22790
+ }
22753
22791
  /**
22754
22792
  * Verify a signed RPC request
22755
22793
  * @param signedRequest The signed request to verify
@@ -22812,6 +22850,24 @@ class Api extends EventEmitter {
22812
22850
  .catch(error => callback(error instanceof Error ? error : new Error(String(error))));
22813
22851
  }).catch(callback);
22814
22852
  }
22853
+ /**
22854
+ * Promise-based version of verifySignedRequest
22855
+ * Verifies a signed RPC request
22856
+ * @param signedRequest The signed request to verify
22857
+ * @returns Promise that resolves with verification result or rejects with an error
22858
+ */
22859
+ verifySignedRequestAsync(signedRequest) {
22860
+ return new Promise((resolve, reject) => {
22861
+ this.verifySignedRequest(signedRequest, (err, result) => {
22862
+ if (err) {
22863
+ reject(err);
22864
+ }
22865
+ else {
22866
+ resolve(result);
22867
+ }
22868
+ });
22869
+ });
22870
+ }
22815
22871
  setOptions(options) {
22816
22872
  Object.assign(this.options, options);
22817
22873
  this._setLogger(options);
@@ -22824,9 +22880,9 @@ class Api extends EventEmitter {
22824
22880
  getConfig().set('address_prefix', options.useTestNet ? 'TST' : 'STM');
22825
22881
  }
22826
22882
  }
22827
- setUri(url) {
22883
+ setUrl(url) {
22828
22884
  this.setOptions({
22829
- uri: url
22885
+ url: url
22830
22886
  });
22831
22887
  }
22832
22888
  streamBlockNumber(mode = 'head', callback, ts = 200) {
@@ -22986,6 +23042,24 @@ class Api extends EventEmitter {
22986
23042
  }
22987
23043
  this.broadcastTransactionSynchronous(trx, callback);
22988
23044
  }
23045
+ /**
23046
+ * Promise-based version of broadcastTransactionSynchronousWith
23047
+ * Broadcasts a transaction synchronously
23048
+ * @param options Options object containing the transaction
23049
+ * @returns Promise that resolves with the result or rejects with an error
23050
+ */
23051
+ broadcastTransactionSynchronousWithAsync(options) {
23052
+ return new Promise((resolve, reject) => {
23053
+ this.broadcastTransactionSynchronousWith(options, (err, result) => {
23054
+ if (err) {
23055
+ reject(err);
23056
+ }
23057
+ else {
23058
+ resolve(result);
23059
+ }
23060
+ });
23061
+ });
23062
+ }
22989
23063
  /**
22990
23064
  * Broadcast a transaction to the blockchain.
22991
23065
  * @param trx The transaction object
@@ -23005,6 +23079,24 @@ class Api extends EventEmitter {
23005
23079
  callback(new Error('broadcastTransaction is not implemented'));
23006
23080
  }
23007
23081
  }
23082
+ /**
23083
+ * Promise-based version of broadcastTransaction
23084
+ * Broadcasts a transaction to the blockchain
23085
+ * @param trx The transaction object
23086
+ * @returns Promise that resolves with the result or rejects with an error
23087
+ */
23088
+ broadcastTransactionAsync(trx) {
23089
+ return new Promise((resolve, reject) => {
23090
+ this.broadcastTransaction(trx, (err, result) => {
23091
+ if (err) {
23092
+ reject(err);
23093
+ }
23094
+ else {
23095
+ resolve(result);
23096
+ }
23097
+ });
23098
+ });
23099
+ }
23008
23100
  /**
23009
23101
  * Sign a transaction with the provided private key(s).
23010
23102
  * @param trx The transaction object
@@ -23053,6 +23145,25 @@ class Api extends EventEmitter {
23053
23145
  params: [confirmationCallback, trx]
23054
23146
  }, callback);
23055
23147
  }
23148
+ /**
23149
+ * Promise-based version of broadcastTransactionWithCallback
23150
+ * Note: The confirmationCallback will still be called when the transaction is confirmed
23151
+ * @param confirmationCallback Callback function for transaction confirmation
23152
+ * @param trx Transaction object to broadcast
23153
+ * @returns Promise that resolves with the result or rejects with an error
23154
+ */
23155
+ broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
23156
+ return new Promise((resolve, reject) => {
23157
+ this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
23158
+ if (err) {
23159
+ reject(err);
23160
+ }
23161
+ else {
23162
+ resolve(result);
23163
+ }
23164
+ });
23165
+ });
23166
+ }
23056
23167
  /**
23057
23168
  * Broadcast a block to the network.
23058
23169
  * @param block Block object to broadcast
@@ -23068,6 +23179,24 @@ class Api extends EventEmitter {
23068
23179
  params: [block]
23069
23180
  }, callback);
23070
23181
  }
23182
+ /**
23183
+ * Promise-based version of broadcastBlock
23184
+ * Broadcasts a block to the network
23185
+ * @param block Block object to broadcast
23186
+ * @returns Promise that resolves with the result or rejects with an error
23187
+ */
23188
+ broadcastBlockAsync(block) {
23189
+ return new Promise((resolve, reject) => {
23190
+ this.broadcastBlock(block, (err, result) => {
23191
+ if (err) {
23192
+ reject(err);
23193
+ }
23194
+ else {
23195
+ resolve(result);
23196
+ }
23197
+ });
23198
+ });
23199
+ }
23071
23200
  /**
23072
23201
  * Set the maximum block age for transaction acceptance.
23073
23202
  * @param maxBlockAge Maximum block age in seconds
@@ -23083,6 +23212,24 @@ class Api extends EventEmitter {
23083
23212
  params: [maxBlockAge]
23084
23213
  }, callback);
23085
23214
  }
23215
+ /**
23216
+ * Promise-based version of setMaxBlockAge
23217
+ * Sets the maximum block age for transaction acceptance
23218
+ * @param maxBlockAge Maximum block age in seconds
23219
+ * @returns Promise that resolves with the result or rejects with an error
23220
+ */
23221
+ setMaxBlockAgeAsync(maxBlockAge) {
23222
+ return new Promise((resolve, reject) => {
23223
+ this.setMaxBlockAge(maxBlockAge, (err, result) => {
23224
+ if (err) {
23225
+ reject(err);
23226
+ }
23227
+ else {
23228
+ resolve(result);
23229
+ }
23230
+ });
23231
+ });
23232
+ }
23086
23233
  /**
23087
23234
  * Verify transaction authority.
23088
23235
  * @param trx Transaction object to verify
@@ -23156,15 +23303,17 @@ class Api extends EventEmitter {
23156
23303
  }
23157
23304
  }
23158
23305
  // Export singleton instance for compatibility
23159
- const api$1 = new Api({ uri: getConfig().get('uri') || 'https://api.steemit.com' });
23306
+ // Use first node from config.nodes array
23307
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
23308
+ const api = new Api({ url: nodes[0] || 'https://api.steemit.com' });
23160
23309
  function setOptions(options) {
23161
- api$1.setOptions(options);
23310
+ api.setOptions(options);
23162
23311
  }
23163
23312
  // Export async variants and listeners for compatibility with tests
23164
- api$1.getDynamicGlobalPropertiesAsync;
23165
- api$1.getBlockAsync;
23166
- api$1.getFollowersAsync;
23167
- api$1.getContentAsync;
23313
+ api.getDynamicGlobalPropertiesAsync;
23314
+ api.getBlockAsync;
23315
+ api.getFollowersAsync;
23316
+ api.getContentAsync;
23168
23317
 
23169
23318
  const operations$1 = [
23170
23319
  {
@@ -25573,8 +25722,8 @@ const verify = (message, signature, publicKey) => {
25573
25722
  }
25574
25723
  };
25575
25724
 
25576
- // Create the API instance
25577
- const api = new Api();
25725
+ // Use the singleton API instance exported from api module
25726
+ // This ensures steem.api and setOptions() operate on the same instance
25578
25727
  // Create the main steem object with all modules
25579
25728
  const steem = {
25580
25729
  api,
@@ -25585,10 +25734,15 @@ const steem = {
25585
25734
  operations,
25586
25735
  serializer,
25587
25736
  utils: utils$3,
25588
- version: '1.0.8',
25737
+ version: '1.0.10',
25589
25738
  config: {
25590
25739
  set: (options) => {
25591
- setOptions(options);
25740
+ // If nodes is provided, extract the first node as url for API
25741
+ const apiOptions = { ...options };
25742
+ if (options.nodes && Array.isArray(options.nodes) && options.nodes.length > 0) {
25743
+ apiOptions.url = options.nodes[0];
25744
+ }
25745
+ setOptions(apiOptions);
25592
25746
  setOptions$1(options);
25593
25747
  },
25594
25748
  get: (key) => getConfig().get(key),
@@ -25620,5 +25774,5 @@ if (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {
25620
25774
  }
25621
25775
  }
25622
25776
 
25623
- export { doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
25777
+ export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
25624
25778
  //# sourceMappingURL=index.js.map