@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.umd.js CHANGED
@@ -2,18 +2,18 @@
2
2
  // Provide minimal polyfills for browser
3
3
  var g = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
 
5
- // Process polyfill
5
+ // Process polyfill
6
6
  if (typeof g.process === 'undefined') {
7
7
  g.process = {
8
- browser: true,
9
- env: {},
10
- version: '',
11
- versions: {},
12
- nextTick: function(fn) { setTimeout(fn, 0); },
13
- exit: function() {},
14
- cwd: function() { return '/'; },
15
- platform: 'browser'
16
- };
8
+ browser: true,
9
+ env: {},
10
+ version: '',
11
+ versions: {},
12
+ nextTick: function(fn) { setTimeout(fn, 0); },
13
+ exit: function() {},
14
+ cwd: function() { return '/'; },
15
+ platform: 'browser'
16
+ };
17
17
  if (typeof globalThis !== 'undefined') {
18
18
  globalThis.process = g.process;
19
19
  }
@@ -564,12 +564,10 @@
564
564
  const DEFAULT_CONFIG = {
565
565
  address_prefix: 'STM',
566
566
  chain_id: '0000000000000000000000000000000000000000000000000000000000000000',
567
- // Default API endpoint: api.steemit.com
568
- node: 'https://api.steemit.com',
567
+ // Default API endpoints: api.steemit.com
569
568
  nodes: [
570
569
  'https://api.steemit.com'
571
- ],
572
- uri: 'https://api.steemit.com'
570
+ ]
573
571
  };
574
572
  // Singleton config instance
575
573
  const config = new Config();
@@ -1190,7 +1188,7 @@
1190
1188
  * @license MIT
1191
1189
  */
1192
1190
 
1193
- (function (exports$1) {
1191
+ (function (exports) {
1194
1192
 
1195
1193
  const base64 = base64Js;
1196
1194
  const ieee754$1 = ieee754;
@@ -1199,12 +1197,12 @@
1199
1197
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
1200
1198
  : null;
1201
1199
 
1202
- exports$1.Buffer = Buffer;
1203
- exports$1.SlowBuffer = SlowBuffer;
1204
- exports$1.INSPECT_MAX_BYTES = 50;
1200
+ exports.Buffer = Buffer;
1201
+ exports.SlowBuffer = SlowBuffer;
1202
+ exports.INSPECT_MAX_BYTES = 50;
1205
1203
 
1206
1204
  const K_MAX_LENGTH = 0x7fffffff;
1207
- exports$1.kMaxLength = K_MAX_LENGTH;
1205
+ exports.kMaxLength = K_MAX_LENGTH;
1208
1206
 
1209
1207
  /**
1210
1208
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -1800,7 +1798,7 @@
1800
1798
 
1801
1799
  Buffer.prototype.inspect = function inspect () {
1802
1800
  let str = '';
1803
- const max = exports$1.INSPECT_MAX_BYTES;
1801
+ const max = exports.INSPECT_MAX_BYTES;
1804
1802
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
1805
1803
  if (this.length > max) str += ' ... ';
1806
1804
  return '<Buffer ' + str + '>'
@@ -3310,7 +3308,7 @@
3310
3308
  bn$1.exports;
3311
3309
 
3312
3310
  (function (module) {
3313
- (function (module, exports$1) {
3311
+ (function (module, exports) {
3314
3312
 
3315
3313
  // Utils
3316
3314
  function assert (val, msg) {
@@ -3353,7 +3351,7 @@
3353
3351
  if (typeof module === 'object') {
3354
3352
  module.exports = BN;
3355
3353
  } else {
3356
- exports$1.BN = BN;
3354
+ exports.BN = BN;
3357
3355
  }
3358
3356
 
3359
3357
  BN.BN = BN;
@@ -6772,9 +6770,9 @@
6772
6770
 
6773
6771
  var utils$l = {};
6774
6772
 
6775
- (function (exports$1) {
6773
+ (function (exports) {
6776
6774
 
6777
- var utils = exports$1;
6775
+ var utils = exports;
6778
6776
 
6779
6777
  function toArray(msg, enc) {
6780
6778
  if (Array.isArray(msg))
@@ -6832,9 +6830,9 @@
6832
6830
  };
6833
6831
  } (utils$l));
6834
6832
 
6835
- (function (exports$1) {
6833
+ (function (exports) {
6836
6834
 
6837
- var utils = exports$1;
6835
+ var utils = exports;
6838
6836
  var BN = bnExports$1;
6839
6837
  var minAssert = minimalisticAssert;
6840
6838
  var minUtils = utils$l;
@@ -8986,9 +8984,9 @@
8986
8984
  Point.prototype.toP = Point.prototype.normalize;
8987
8985
  Point.prototype.mixedAdd = Point.prototype.add;
8988
8986
 
8989
- (function (exports$1) {
8987
+ (function (exports) {
8990
8988
 
8991
- var curve = exports$1;
8989
+ var curve = exports;
8992
8990
 
8993
8991
  curve.base = base$1;
8994
8992
  curve.short = short;
@@ -10191,8 +10189,8 @@
10191
10189
  return this.outer.digest(enc);
10192
10190
  };
10193
10191
 
10194
- (function (exports$1) {
10195
- var hash = exports$1;
10192
+ (function (exports) {
10193
+ var hash = exports;
10196
10194
 
10197
10195
  hash.utils = utils$g;
10198
10196
  hash.common = common$5;
@@ -10998,9 +10996,9 @@
10998
10996
  return secp256k1$3;
10999
10997
  }
11000
10998
 
11001
- (function (exports$1) {
10999
+ (function (exports) {
11002
11000
 
11003
- var curves = exports$1;
11001
+ var curves = exports;
11004
11002
 
11005
11003
  var hash = hash$2;
11006
11004
  var curve$1 = curve;
@@ -12169,9 +12167,9 @@
12169
12167
  return val instanceof this.pointClass;
12170
12168
  };
12171
12169
 
12172
- (function (exports$1) {
12170
+ (function (exports) {
12173
12171
 
12174
- var elliptic = exports$1;
12172
+ var elliptic = exports;
12175
12173
 
12176
12174
  elliptic.version = require$$0$1.version;
12177
12175
  elliptic.utils = utils$m;
@@ -12189,7 +12187,7 @@
12189
12187
  bn.exports;
12190
12188
 
12191
12189
  (function (module) {
12192
- (function (module, exports$1) {
12190
+ (function (module, exports) {
12193
12191
 
12194
12192
  // Utils
12195
12193
  function assert (val, msg) {
@@ -12232,7 +12230,7 @@
12232
12230
  if (typeof module === 'object') {
12233
12231
  module.exports = BN;
12234
12232
  } else {
12235
- exports$1.BN = BN;
12233
+ exports.BN = BN;
12236
12234
  }
12237
12235
 
12238
12236
  BN.BN = BN;
@@ -17162,24 +17160,24 @@
17162
17160
  * @returns Buffer with random bytes
17163
17161
  */
17164
17162
  function randomBytes(size) {
17165
- // Always try Web Crypto API first (works in both browser and Node.js 18+)
17163
+ // Always try Web Crypto API first (works in both browser and Node.js 20.19+)
17166
17164
  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
17167
17165
  const array = new Uint8Array(size);
17168
17166
  crypto.getRandomValues(array);
17169
17167
  return buffer.Buffer.from(array);
17170
17168
  }
17171
17169
  // Fallback to Node.js crypto only if Web Crypto API is not available
17172
- // This code path should not be reached in Node.js 18+ (which has Web Crypto API)
17170
+ // This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
17173
17171
  // and is kept as a safety fallback for edge cases.
17174
17172
  // In browser builds, Rollup will tree-shake this code away because
17175
17173
  // the condition above will always be true in browsers.
17176
17174
  //
17177
- // Note: This SDK requires Node.js >= 18.0.0 (see package.json engines field).
17178
- // Node.js 18+ has Web Crypto API, so this fallback is rarely needed.
17179
- // In ESM mode, require is undefined, but since Node.js 18+ has Web Crypto API,
17175
+ // Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
17176
+ // Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
17177
+ // In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
17180
17178
  // this code path won't be reached in ESM mode with the minimum required version.
17181
17179
  try {
17182
- // Use dynamic require as a safety fallback (for Node.js < 18 edge cases)
17180
+ // Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
17183
17181
  // eslint-disable-next-line @typescript-eslint/no-require-imports
17184
17182
  const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
17185
17183
  if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
@@ -17190,7 +17188,7 @@
17190
17188
  // Ignore require errors in browser environments or ESM mode
17191
17189
  }
17192
17190
  // If neither Web Crypto API nor Node.js crypto is available, throw error
17193
- 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.');
17191
+ 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.');
17194
17192
  }
17195
17193
 
17196
17194
  /**
@@ -18130,11 +18128,11 @@
18130
18128
  return mainError;
18131
18129
  };
18132
18130
 
18133
- (function (exports$1) {
18131
+ (function (exports) {
18134
18132
  var RetryOperation = retry_operation;
18135
18133
 
18136
- exports$1.operation = function(options) {
18137
- var timeouts = exports$1.timeouts(options);
18134
+ exports.operation = function(options) {
18135
+ var timeouts = exports.timeouts(options);
18138
18136
  return new RetryOperation(timeouts, {
18139
18137
  forever: options && (options.forever || options.retries === Infinity),
18140
18138
  unref: options && options.unref,
@@ -18142,7 +18140,7 @@
18142
18140
  });
18143
18141
  };
18144
18142
 
18145
- exports$1.timeouts = function(options) {
18143
+ exports.timeouts = function(options) {
18146
18144
  if (options instanceof Array) {
18147
18145
  return [].concat(options);
18148
18146
  }
@@ -18179,7 +18177,7 @@
18179
18177
  return timeouts;
18180
18178
  };
18181
18179
 
18182
- exports$1.createTimeout = function(attempt, opts) {
18180
+ exports.createTimeout = function(attempt, opts) {
18183
18181
  var random = (opts.randomize)
18184
18182
  ? (Math.random() + 1)
18185
18183
  : 1;
@@ -18190,7 +18188,7 @@
18190
18188
  return timeout;
18191
18189
  };
18192
18190
 
18193
- exports$1.wrap = function(obj, options, methods) {
18191
+ exports.wrap = function(obj, options, methods) {
18194
18192
  if (options instanceof Array) {
18195
18193
  methods = options;
18196
18194
  options = null;
@@ -18210,7 +18208,7 @@
18210
18208
  var original = obj[method];
18211
18209
 
18212
18210
  obj[method] = function retryWrapper(original) {
18213
- var op = exports$1.operation(options);
18211
+ var op = exports.operation(options);
18214
18212
  var args = Array.prototype.slice.call(arguments, 1);
18215
18213
  var callback = args.pop();
18216
18214
 
@@ -18292,15 +18290,15 @@
18292
18290
  }
18293
18291
  /**
18294
18292
  * Makes a JSON-RPC request using native fetch API
18295
- * Universal implementation that works in both Node.js (18+) and browser
18293
+ * Universal implementation that works in both Node.js (20.19+) and browser
18296
18294
  *
18297
- * @param uri - The URI to the JSON-RPC endpoint
18295
+ * @param url - The URL to the JSON-RPC endpoint
18298
18296
  * @param request - The JSON-RPC request object
18299
18297
  * @param fetchMethod - Optional fetch implementation (defaults to global fetch)
18300
18298
  * @param timeoutMs - Request timeout in milliseconds (default: 30000)
18301
18299
  * @returns Promise resolving to the JSON-RPC result
18302
18300
  */
18303
- const jsonRpc = async (uri, request, fetchMethod = fetch, timeoutMs = 30000) => {
18301
+ const jsonRpc = async (url, request, fetchMethod = fetch, timeoutMs = 30000) => {
18304
18302
  const payload = {
18305
18303
  jsonrpc: '2.0',
18306
18304
  ...request
@@ -18313,7 +18311,7 @@
18313
18311
  }, timeoutMs);
18314
18312
  });
18315
18313
  // Create the fetch promise
18316
- const fetchPromise = fetchMethod(uri, {
18314
+ const fetchPromise = fetchMethod(url, {
18317
18315
  method: 'POST',
18318
18316
  headers: {
18319
18317
  'Content-Type': 'application/json',
@@ -18362,9 +18360,9 @@
18362
18360
  if (typeof callback !== 'function') {
18363
18361
  callback = () => { };
18364
18362
  }
18365
- const uri = this.options.uri;
18366
- if (!uri) {
18367
- throw new Error('HTTP transport requires a valid URI');
18363
+ const url = this.options.url;
18364
+ if (!url) {
18365
+ throw new Error('HTTP transport requires a valid URL');
18368
18366
  }
18369
18367
  const fetchMethod = this.options.fetchMethod || fetch;
18370
18368
  const id = data.id;
@@ -18375,7 +18373,7 @@
18375
18373
  if (!isBroadcast && retryOptions) {
18376
18374
  const operation = typeof retryOptions === 'object' ? retry$1.operation(retryOptions) : retry$1.operation();
18377
18375
  operation.attempt((currentAttempt) => {
18378
- fetchMethod(uri, {
18376
+ fetchMethod(url, {
18379
18377
  method: 'POST',
18380
18378
  body: JSON.stringify({
18381
18379
  jsonrpc: '2.0',
@@ -18409,7 +18407,7 @@
18409
18407
  });
18410
18408
  }
18411
18409
  else {
18412
- fetchMethod(uri, {
18410
+ fetchMethod(url, {
18413
18411
  method: 'POST',
18414
18412
  body: JSON.stringify({
18415
18413
  jsonrpc: '2.0',
@@ -18639,7 +18637,7 @@
18639
18637
  if (value >= TWO_PWR_64_DBL)
18640
18638
  return MAX_UNSIGNED_VALUE;
18641
18639
  } else {
18642
- if (value <= -TWO_PWR_63_DBL)
18640
+ if (value <= -9223372036854776e3)
18643
18641
  return MIN_VALUE;
18644
18642
  if (value + 1 >= TWO_PWR_63_DBL)
18645
18643
  return MAX_VALUE;
@@ -23668,7 +23666,7 @@
23668
23666
  if (value < 0) return UZERO;
23669
23667
  if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
23670
23668
  } else {
23671
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
23669
+ if (value <= -9223372036854776e3) return MIN_VALUE;
23672
23670
  if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
23673
23671
  }
23674
23672
  if (value < 0) return fromNumber(-value, unsigned).neg();
@@ -25633,7 +25631,6 @@
25633
25631
  _setTransport(options) {
25634
25632
  // Use HTTP transport only
25635
25633
  if (options.url && options.url.match(/^((http|https)?:\/\/)/)) {
25636
- options.uri = options.url;
25637
25634
  options.transport = 'http';
25638
25635
  this._transportType = options.transport;
25639
25636
  this.options = options;
@@ -25659,9 +25656,10 @@
25659
25656
  }
25660
25657
  }
25661
25658
  else {
25662
- // Default to HTTP for https://api.steemit.com
25663
- const defaultNode = getConfig().get('node') || 'https://api.steemit.com';
25664
- options.uri = defaultNode;
25659
+ // Default to HTTP using first node from config.nodes
25660
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
25661
+ const defaultNode = nodes[0] || 'https://api.steemit.com';
25662
+ options.url = defaultNode;
25665
25663
  options.transport = 'http';
25666
25664
  this._transportType = options.transport;
25667
25665
  this.options = options;
@@ -25744,9 +25742,28 @@
25744
25742
  }
25745
25743
  const id = ++this.seqNo;
25746
25744
  const fetchMethod = this.options.fetchMethod || fetch;
25747
- jsonRpc(this.options.uri, { method, params, id }, fetchMethod)
25745
+ jsonRpc(this.options.url, { method, params, id }, fetchMethod)
25748
25746
  .then(res => { callback(null, res); }, err => { callback(err); });
25749
25747
  }
25748
+ /**
25749
+ * Promise-based version of call
25750
+ * Makes a JSON-RPC call to the Steem blockchain
25751
+ * @param method Method name (e.g., 'condenser_api.get_accounts')
25752
+ * @param params Parameters array for the method
25753
+ * @returns Promise that resolves with the result or rejects with an error
25754
+ */
25755
+ callAsync(method, params) {
25756
+ return new Promise((resolve, reject) => {
25757
+ this.call(method, params, (err, result) => {
25758
+ if (err) {
25759
+ reject(err);
25760
+ }
25761
+ else {
25762
+ resolve(result);
25763
+ }
25764
+ });
25765
+ });
25766
+ }
25750
25767
  signedCall(method, params, account, key, callback) {
25751
25768
  if (this._transportType !== 'http') {
25752
25769
  callback(new Error('RPC methods can only be called when using http transport'));
@@ -25762,9 +25779,30 @@
25762
25779
  return;
25763
25780
  }
25764
25781
  const fetchMethod = this.options.fetchMethod || fetch;
25765
- jsonRpc(this.options.uri, request, fetchMethod)
25782
+ jsonRpc(this.options.url, request, fetchMethod)
25766
25783
  .then(res => { callback(null, res); }, err => { callback(err); });
25767
25784
  }
25785
+ /**
25786
+ * Promise-based version of signedCall
25787
+ * Makes an authenticated JSON-RPC call with cryptographic signature
25788
+ * @param method Method name (e.g., 'conveyor.is_email_registered')
25789
+ * @param params Parameters array for the method
25790
+ * @param account Account name to sign the request with
25791
+ * @param key Private key (WIF) to sign the request
25792
+ * @returns Promise that resolves with the result or rejects with an error
25793
+ */
25794
+ signedCallAsync(method, params, account, key) {
25795
+ return new Promise((resolve, reject) => {
25796
+ this.signedCall(method, params, account, key, (err, result) => {
25797
+ if (err) {
25798
+ reject(err);
25799
+ }
25800
+ else {
25801
+ resolve(result);
25802
+ }
25803
+ });
25804
+ });
25805
+ }
25768
25806
  /**
25769
25807
  * Verify a signed RPC request
25770
25808
  * @param signedRequest The signed request to verify
@@ -25827,6 +25865,24 @@
25827
25865
  .catch(error => callback(error instanceof Error ? error : new Error(String(error))));
25828
25866
  }).catch(callback);
25829
25867
  }
25868
+ /**
25869
+ * Promise-based version of verifySignedRequest
25870
+ * Verifies a signed RPC request
25871
+ * @param signedRequest The signed request to verify
25872
+ * @returns Promise that resolves with verification result or rejects with an error
25873
+ */
25874
+ verifySignedRequestAsync(signedRequest) {
25875
+ return new Promise((resolve, reject) => {
25876
+ this.verifySignedRequest(signedRequest, (err, result) => {
25877
+ if (err) {
25878
+ reject(err);
25879
+ }
25880
+ else {
25881
+ resolve(result);
25882
+ }
25883
+ });
25884
+ });
25885
+ }
25830
25886
  setOptions(options) {
25831
25887
  Object.assign(this.options, options);
25832
25888
  this._setLogger(options);
@@ -25839,9 +25895,9 @@
25839
25895
  getConfig().set('address_prefix', options.useTestNet ? 'TST' : 'STM');
25840
25896
  }
25841
25897
  }
25842
- setUri(url) {
25898
+ setUrl(url) {
25843
25899
  this.setOptions({
25844
- uri: url
25900
+ url: url
25845
25901
  });
25846
25902
  }
25847
25903
  streamBlockNumber(mode = 'head', callback, ts = 200) {
@@ -26001,6 +26057,24 @@
26001
26057
  }
26002
26058
  this.broadcastTransactionSynchronous(trx, callback);
26003
26059
  }
26060
+ /**
26061
+ * Promise-based version of broadcastTransactionSynchronousWith
26062
+ * Broadcasts a transaction synchronously
26063
+ * @param options Options object containing the transaction
26064
+ * @returns Promise that resolves with the result or rejects with an error
26065
+ */
26066
+ broadcastTransactionSynchronousWithAsync(options) {
26067
+ return new Promise((resolve, reject) => {
26068
+ this.broadcastTransactionSynchronousWith(options, (err, result) => {
26069
+ if (err) {
26070
+ reject(err);
26071
+ }
26072
+ else {
26073
+ resolve(result);
26074
+ }
26075
+ });
26076
+ });
26077
+ }
26004
26078
  /**
26005
26079
  * Broadcast a transaction to the blockchain.
26006
26080
  * @param trx The transaction object
@@ -26020,6 +26094,24 @@
26020
26094
  callback(new Error('broadcastTransaction is not implemented'));
26021
26095
  }
26022
26096
  }
26097
+ /**
26098
+ * Promise-based version of broadcastTransaction
26099
+ * Broadcasts a transaction to the blockchain
26100
+ * @param trx The transaction object
26101
+ * @returns Promise that resolves with the result or rejects with an error
26102
+ */
26103
+ broadcastTransactionAsync(trx) {
26104
+ return new Promise((resolve, reject) => {
26105
+ this.broadcastTransaction(trx, (err, result) => {
26106
+ if (err) {
26107
+ reject(err);
26108
+ }
26109
+ else {
26110
+ resolve(result);
26111
+ }
26112
+ });
26113
+ });
26114
+ }
26023
26115
  /**
26024
26116
  * Sign a transaction with the provided private key(s).
26025
26117
  * @param trx The transaction object
@@ -26068,6 +26160,25 @@
26068
26160
  params: [confirmationCallback, trx]
26069
26161
  }, callback);
26070
26162
  }
26163
+ /**
26164
+ * Promise-based version of broadcastTransactionWithCallback
26165
+ * Note: The confirmationCallback will still be called when the transaction is confirmed
26166
+ * @param confirmationCallback Callback function for transaction confirmation
26167
+ * @param trx Transaction object to broadcast
26168
+ * @returns Promise that resolves with the result or rejects with an error
26169
+ */
26170
+ broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
26171
+ return new Promise((resolve, reject) => {
26172
+ this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
26173
+ if (err) {
26174
+ reject(err);
26175
+ }
26176
+ else {
26177
+ resolve(result);
26178
+ }
26179
+ });
26180
+ });
26181
+ }
26071
26182
  /**
26072
26183
  * Broadcast a block to the network.
26073
26184
  * @param block Block object to broadcast
@@ -26083,6 +26194,24 @@
26083
26194
  params: [block]
26084
26195
  }, callback);
26085
26196
  }
26197
+ /**
26198
+ * Promise-based version of broadcastBlock
26199
+ * Broadcasts a block to the network
26200
+ * @param block Block object to broadcast
26201
+ * @returns Promise that resolves with the result or rejects with an error
26202
+ */
26203
+ broadcastBlockAsync(block) {
26204
+ return new Promise((resolve, reject) => {
26205
+ this.broadcastBlock(block, (err, result) => {
26206
+ if (err) {
26207
+ reject(err);
26208
+ }
26209
+ else {
26210
+ resolve(result);
26211
+ }
26212
+ });
26213
+ });
26214
+ }
26086
26215
  /**
26087
26216
  * Set the maximum block age for transaction acceptance.
26088
26217
  * @param maxBlockAge Maximum block age in seconds
@@ -26098,6 +26227,24 @@
26098
26227
  params: [maxBlockAge]
26099
26228
  }, callback);
26100
26229
  }
26230
+ /**
26231
+ * Promise-based version of setMaxBlockAge
26232
+ * Sets the maximum block age for transaction acceptance
26233
+ * @param maxBlockAge Maximum block age in seconds
26234
+ * @returns Promise that resolves with the result or rejects with an error
26235
+ */
26236
+ setMaxBlockAgeAsync(maxBlockAge) {
26237
+ return new Promise((resolve, reject) => {
26238
+ this.setMaxBlockAge(maxBlockAge, (err, result) => {
26239
+ if (err) {
26240
+ reject(err);
26241
+ }
26242
+ else {
26243
+ resolve(result);
26244
+ }
26245
+ });
26246
+ });
26247
+ }
26101
26248
  /**
26102
26249
  * Verify transaction authority.
26103
26250
  * @param trx Transaction object to verify
@@ -26171,15 +26318,17 @@
26171
26318
  }
26172
26319
  }
26173
26320
  // Export singleton instance for compatibility
26174
- const api$1 = new Api({ uri: getConfig().get('uri') || 'https://api.steemit.com' });
26321
+ // Use first node from config.nodes array
26322
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
26323
+ const api = new Api({ url: nodes[0] || 'https://api.steemit.com' });
26175
26324
  function setOptions(options) {
26176
- api$1.setOptions(options);
26325
+ api.setOptions(options);
26177
26326
  }
26178
26327
  // Export async variants and listeners for compatibility with tests
26179
- api$1.getDynamicGlobalPropertiesAsync;
26180
- api$1.getBlockAsync;
26181
- api$1.getFollowersAsync;
26182
- api$1.getContentAsync;
26328
+ api.getDynamicGlobalPropertiesAsync;
26329
+ api.getBlockAsync;
26330
+ api.getFollowersAsync;
26331
+ api.getContentAsync;
26183
26332
 
26184
26333
  const operations$1 = [
26185
26334
  {
@@ -28598,11 +28747,12 @@
28598
28747
  verify: verify
28599
28748
  });
28600
28749
 
28601
- // Create the API instance
28602
- const api = new Api();
28750
+ // Use the singleton API instance exported from api module
28751
+ // This ensures steem.api and setOptions() operate on the same instance
28603
28752
  // Create the main steem object with all modules - this will be the default export for UMD
28604
28753
  const steem = {
28605
28754
  api,
28755
+ Api, // Export Api class for creating multiple instances
28606
28756
  auth,
28607
28757
  broadcast: broadcast$1,
28608
28758
  formatter,
@@ -28611,10 +28761,15 @@
28611
28761
  serializer,
28612
28762
  utils: utils$n,
28613
28763
  ...crypto$1,
28614
- version: '1.0.8',
28764
+ version: '1.0.10',
28615
28765
  config: {
28616
28766
  set: (options) => {
28617
- setOptions(options);
28767
+ // If nodes is provided, extract the first node as url for API
28768
+ const apiOptions = { ...options };
28769
+ if (options.nodes && Array.isArray(options.nodes) && options.nodes.length > 0) {
28770
+ apiOptions.url = options.nodes[0];
28771
+ }
28772
+ setOptions(apiOptions);
28618
28773
  setOptions$1(options);
28619
28774
  },
28620
28775
  get: (key) => getConfig().get(key),