@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.
@@ -551,12 +551,10 @@ class Config {
551
551
  const DEFAULT_CONFIG = {
552
552
  address_prefix: 'STM',
553
553
  chain_id: '0000000000000000000000000000000000000000000000000000000000000000',
554
- // Default API endpoint: api.steemit.com
555
- node: 'https://api.steemit.com',
554
+ // Default API endpoints: api.steemit.com
556
555
  nodes: [
557
556
  'https://api.steemit.com'
558
- ],
559
- uri: 'https://api.steemit.com'
557
+ ]
560
558
  };
561
559
  // Singleton config instance
562
560
  const config = new Config();
@@ -1204,7 +1202,7 @@ var hasRequiredBuffer;
1204
1202
  function requireBuffer () {
1205
1203
  if (hasRequiredBuffer) return buffer;
1206
1204
  hasRequiredBuffer = 1;
1207
- (function (exports$1) {
1205
+ (function (exports) {
1208
1206
 
1209
1207
  const base64 = requireBase64Js();
1210
1208
  const ieee754 = requireIeee754();
@@ -1213,12 +1211,12 @@ function requireBuffer () {
1213
1211
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
1214
1212
  : null;
1215
1213
 
1216
- exports$1.Buffer = Buffer;
1217
- exports$1.SlowBuffer = SlowBuffer;
1218
- exports$1.INSPECT_MAX_BYTES = 50;
1214
+ exports.Buffer = Buffer;
1215
+ exports.SlowBuffer = SlowBuffer;
1216
+ exports.INSPECT_MAX_BYTES = 50;
1219
1217
 
1220
1218
  const K_MAX_LENGTH = 0x7fffffff;
1221
- exports$1.kMaxLength = K_MAX_LENGTH;
1219
+ exports.kMaxLength = K_MAX_LENGTH;
1222
1220
 
1223
1221
  /**
1224
1222
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -1814,7 +1812,7 @@ function requireBuffer () {
1814
1812
 
1815
1813
  Buffer.prototype.inspect = function inspect () {
1816
1814
  let str = '';
1817
- const max = exports$1.INSPECT_MAX_BYTES;
1815
+ const max = exports.INSPECT_MAX_BYTES;
1818
1816
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
1819
1817
  if (this.length > max) str += ' ... ';
1820
1818
  return '<Buffer ' + str + '>'
@@ -3333,7 +3331,7 @@ function requireBn$1 () {
3333
3331
  if (hasRequiredBn$1) return bn$1.exports;
3334
3332
  hasRequiredBn$1 = 1;
3335
3333
  (function (module) {
3336
- (function (module, exports$1) {
3334
+ (function (module, exports) {
3337
3335
 
3338
3336
  // Utils
3339
3337
  function assert (val, msg) {
@@ -3376,7 +3374,7 @@ function requireBn$1 () {
3376
3374
  if (typeof module === 'object') {
3377
3375
  module.exports = BN;
3378
3376
  } else {
3379
- exports$1.BN = BN;
3377
+ exports.BN = BN;
3380
3378
  }
3381
3379
 
3382
3380
  BN.BN = BN;
@@ -6808,9 +6806,9 @@ var hasRequiredUtils$2;
6808
6806
  function requireUtils$2 () {
6809
6807
  if (hasRequiredUtils$2) return utils$1;
6810
6808
  hasRequiredUtils$2 = 1;
6811
- (function (exports$1) {
6809
+ (function (exports) {
6812
6810
 
6813
- var utils = exports$1;
6811
+ var utils = exports;
6814
6812
 
6815
6813
  function toArray(msg, enc) {
6816
6814
  if (Array.isArray(msg))
@@ -6875,9 +6873,9 @@ var hasRequiredUtils$1;
6875
6873
  function requireUtils$1 () {
6876
6874
  if (hasRequiredUtils$1) return utils$2;
6877
6875
  hasRequiredUtils$1 = 1;
6878
- (function (exports$1) {
6876
+ (function (exports) {
6879
6877
 
6880
- var utils = exports$1;
6878
+ var utils = exports;
6881
6879
  var BN = requireBn$1();
6882
6880
  var minAssert = requireMinimalisticAssert();
6883
6881
  var minUtils = requireUtils$2();
@@ -9082,9 +9080,9 @@ var hasRequiredCurve;
9082
9080
  function requireCurve () {
9083
9081
  if (hasRequiredCurve) return curve;
9084
9082
  hasRequiredCurve = 1;
9085
- (function (exports$1) {
9083
+ (function (exports) {
9086
9084
 
9087
- var curve = exports$1;
9085
+ var curve = exports;
9088
9086
 
9089
9087
  curve.base = requireBase();
9090
9088
  curve.short = requireShort();
@@ -10388,8 +10386,8 @@ var hasRequiredHash;
10388
10386
  function requireHash () {
10389
10387
  if (hasRequiredHash) return hash;
10390
10388
  hasRequiredHash = 1;
10391
- (function (exports$1) {
10392
- var hash = exports$1;
10389
+ (function (exports) {
10390
+ var hash = exports;
10393
10391
 
10394
10392
  hash.utils = requireUtils();
10395
10393
  hash.common = requireCommon$1();
@@ -11202,9 +11200,9 @@ var hasRequiredCurves;
11202
11200
  function requireCurves () {
11203
11201
  if (hasRequiredCurves) return curves;
11204
11202
  hasRequiredCurves = 1;
11205
- (function (exports$1) {
11203
+ (function (exports) {
11206
11204
 
11207
- var curves = exports$1;
11205
+ var curves = exports;
11208
11206
 
11209
11207
  var hash = requireHash();
11210
11208
  var curve = requireCurve();
@@ -12443,9 +12441,9 @@ var hasRequiredElliptic;
12443
12441
  function requireElliptic () {
12444
12442
  if (hasRequiredElliptic) return elliptic;
12445
12443
  hasRequiredElliptic = 1;
12446
- (function (exports$1) {
12444
+ (function (exports) {
12447
12445
 
12448
- var elliptic = exports$1;
12446
+ var elliptic = exports;
12449
12447
 
12450
12448
  elliptic.version = require$$0$1.version;
12451
12449
  elliptic.utils = requireUtils$1();
@@ -12472,7 +12470,7 @@ function requireBn () {
12472
12470
  if (hasRequiredBn) return bn.exports;
12473
12471
  hasRequiredBn = 1;
12474
12472
  (function (module) {
12475
- (function (module, exports$1) {
12473
+ (function (module, exports) {
12476
12474
 
12477
12475
  // Utils
12478
12476
  function assert (val, msg) {
@@ -12515,7 +12513,7 @@ function requireBn () {
12515
12513
  if (typeof module === 'object') {
12516
12514
  module.exports = BN;
12517
12515
  } else {
12518
- exports$1.BN = BN;
12516
+ exports.BN = BN;
12519
12517
  }
12520
12518
 
12521
12519
  BN.BN = BN;
@@ -17447,24 +17445,24 @@ class Address {
17447
17445
  * @returns Buffer with random bytes
17448
17446
  */
17449
17447
  function randomBytes(size) {
17450
- // Always try Web Crypto API first (works in both browser and Node.js 18+)
17448
+ // Always try Web Crypto API first (works in both browser and Node.js 20.19+)
17451
17449
  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
17452
17450
  const array = new Uint8Array(size);
17453
17451
  crypto.getRandomValues(array);
17454
17452
  return bufferExports.Buffer.from(array);
17455
17453
  }
17456
17454
  // Fallback to Node.js crypto only if Web Crypto API is not available
17457
- // This code path should not be reached in Node.js 18+ (which has Web Crypto API)
17455
+ // This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
17458
17456
  // and is kept as a safety fallback for edge cases.
17459
17457
  // In browser builds, Rollup will tree-shake this code away because
17460
17458
  // the condition above will always be true in browsers.
17461
17459
  //
17462
- // Note: This SDK requires Node.js >= 18.0.0 (see package.json engines field).
17463
- // Node.js 18+ has Web Crypto API, so this fallback is rarely needed.
17464
- // In ESM mode, require is undefined, but since Node.js 18+ has Web Crypto API,
17460
+ // Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
17461
+ // Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
17462
+ // In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
17465
17463
  // this code path won't be reached in ESM mode with the minimum required version.
17466
17464
  try {
17467
- // Use dynamic require as a safety fallback (for Node.js < 18 edge cases)
17465
+ // Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
17468
17466
  // eslint-disable-next-line @typescript-eslint/no-require-imports
17469
17467
  const nodeCrypto = null;
17470
17468
  if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') ;
@@ -17473,7 +17471,7 @@ function randomBytes(size) {
17473
17471
  // Ignore require errors in browser environments or ESM mode
17474
17472
  }
17475
17473
  // If neither Web Crypto API nor Node.js crypto is available, throw error
17476
- 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.');
17474
+ 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.');
17477
17475
  }
17478
17476
 
17479
17477
  /**
@@ -18426,11 +18424,11 @@ var hasRequiredRetry$1;
18426
18424
  function requireRetry$1 () {
18427
18425
  if (hasRequiredRetry$1) return retry$2;
18428
18426
  hasRequiredRetry$1 = 1;
18429
- (function (exports$1) {
18427
+ (function (exports) {
18430
18428
  var RetryOperation = requireRetry_operation();
18431
18429
 
18432
- exports$1.operation = function(options) {
18433
- var timeouts = exports$1.timeouts(options);
18430
+ exports.operation = function(options) {
18431
+ var timeouts = exports.timeouts(options);
18434
18432
  return new RetryOperation(timeouts, {
18435
18433
  forever: options && (options.forever || options.retries === Infinity),
18436
18434
  unref: options && options.unref,
@@ -18438,7 +18436,7 @@ function requireRetry$1 () {
18438
18436
  });
18439
18437
  };
18440
18438
 
18441
- exports$1.timeouts = function(options) {
18439
+ exports.timeouts = function(options) {
18442
18440
  if (options instanceof Array) {
18443
18441
  return [].concat(options);
18444
18442
  }
@@ -18475,7 +18473,7 @@ function requireRetry$1 () {
18475
18473
  return timeouts;
18476
18474
  };
18477
18475
 
18478
- exports$1.createTimeout = function(attempt, opts) {
18476
+ exports.createTimeout = function(attempt, opts) {
18479
18477
  var random = (opts.randomize)
18480
18478
  ? (Math.random() + 1)
18481
18479
  : 1;
@@ -18486,7 +18484,7 @@ function requireRetry$1 () {
18486
18484
  return timeout;
18487
18485
  };
18488
18486
 
18489
- exports$1.wrap = function(obj, options, methods) {
18487
+ exports.wrap = function(obj, options, methods) {
18490
18488
  if (options instanceof Array) {
18491
18489
  methods = options;
18492
18490
  options = null;
@@ -18506,7 +18504,7 @@ function requireRetry$1 () {
18506
18504
  var original = obj[method];
18507
18505
 
18508
18506
  obj[method] = function retryWrapper(original) {
18509
- var op = exports$1.operation(options);
18507
+ var op = exports.operation(options);
18510
18508
  var args = Array.prototype.slice.call(arguments, 1);
18511
18509
  var callback = args.pop();
18512
18510
 
@@ -18599,15 +18597,15 @@ class JsonRpcError extends Error {
18599
18597
  }
18600
18598
  /**
18601
18599
  * Makes a JSON-RPC request using native fetch API
18602
- * Universal implementation that works in both Node.js (18+) and browser
18600
+ * Universal implementation that works in both Node.js (20.19+) and browser
18603
18601
  *
18604
- * @param uri - The URI to the JSON-RPC endpoint
18602
+ * @param url - The URL to the JSON-RPC endpoint
18605
18603
  * @param request - The JSON-RPC request object
18606
18604
  * @param fetchMethod - Optional fetch implementation (defaults to global fetch)
18607
18605
  * @param timeoutMs - Request timeout in milliseconds (default: 30000)
18608
18606
  * @returns Promise resolving to the JSON-RPC result
18609
18607
  */
18610
- const jsonRpc = async (uri, request, fetchMethod = fetch, timeoutMs = 30000) => {
18608
+ const jsonRpc = async (url, request, fetchMethod = fetch, timeoutMs = 30000) => {
18611
18609
  const payload = {
18612
18610
  jsonrpc: '2.0',
18613
18611
  ...request
@@ -18620,7 +18618,7 @@ const jsonRpc = async (uri, request, fetchMethod = fetch, timeoutMs = 30000) =>
18620
18618
  }, timeoutMs);
18621
18619
  });
18622
18620
  // Create the fetch promise
18623
- const fetchPromise = fetchMethod(uri, {
18621
+ const fetchPromise = fetchMethod(url, {
18624
18622
  method: 'POST',
18625
18623
  headers: {
18626
18624
  'Content-Type': 'application/json',
@@ -18669,9 +18667,9 @@ class HttpTransport extends BaseTransport {
18669
18667
  if (typeof callback !== 'function') {
18670
18668
  callback = () => { };
18671
18669
  }
18672
- const uri = this.options.uri;
18673
- if (!uri) {
18674
- throw new Error('HTTP transport requires a valid URI');
18670
+ const url = this.options.url;
18671
+ if (!url) {
18672
+ throw new Error('HTTP transport requires a valid URL');
18675
18673
  }
18676
18674
  const fetchMethod = this.options.fetchMethod || fetch;
18677
18675
  const id = data.id;
@@ -18682,7 +18680,7 @@ class HttpTransport extends BaseTransport {
18682
18680
  if (!isBroadcast && retryOptions) {
18683
18681
  const operation = typeof retryOptions === 'object' ? retry.operation(retryOptions) : retry.operation();
18684
18682
  operation.attempt((currentAttempt) => {
18685
- fetchMethod(uri, {
18683
+ fetchMethod(url, {
18686
18684
  method: 'POST',
18687
18685
  body: JSON.stringify({
18688
18686
  jsonrpc: '2.0',
@@ -18716,7 +18714,7 @@ class HttpTransport extends BaseTransport {
18716
18714
  });
18717
18715
  }
18718
18716
  else {
18719
- fetchMethod(uri, {
18717
+ fetchMethod(url, {
18720
18718
  method: 'POST',
18721
18719
  body: JSON.stringify({
18722
18720
  jsonrpc: '2.0',
@@ -18946,7 +18944,7 @@ function requireLong () {
18946
18944
  if (value >= TWO_PWR_64_DBL)
18947
18945
  return MAX_UNSIGNED_VALUE;
18948
18946
  } else {
18949
- if (value <= -TWO_PWR_63_DBL)
18947
+ if (value <= -9223372036854776e3)
18950
18948
  return MIN_VALUE;
18951
18949
  if (value + 1 >= TWO_PWR_63_DBL)
18952
18950
  return MAX_VALUE;
@@ -23982,7 +23980,7 @@ function fromNumber(value, unsigned) {
23982
23980
  if (value < 0) return UZERO;
23983
23981
  if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
23984
23982
  } else {
23985
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
23983
+ if (value <= -9223372036854776e3) return MIN_VALUE;
23986
23984
  if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
23987
23985
  }
23988
23986
  if (value < 0) return fromNumber(-value, unsigned).neg();
@@ -25947,7 +25945,6 @@ class Api extends eventsExports.EventEmitter {
25947
25945
  _setTransport(options) {
25948
25946
  // Use HTTP transport only
25949
25947
  if (options.url && options.url.match(/^((http|https)?:\/\/)/)) {
25950
- options.uri = options.url;
25951
25948
  options.transport = 'http';
25952
25949
  this._transportType = options.transport;
25953
25950
  this.options = options;
@@ -25973,9 +25970,10 @@ class Api extends eventsExports.EventEmitter {
25973
25970
  }
25974
25971
  }
25975
25972
  else {
25976
- // Default to HTTP for https://api.steemit.com
25977
- const defaultNode = getConfig().get('node') || 'https://api.steemit.com';
25978
- options.uri = defaultNode;
25973
+ // Default to HTTP using first node from config.nodes
25974
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
25975
+ const defaultNode = nodes[0] || 'https://api.steemit.com';
25976
+ options.url = defaultNode;
25979
25977
  options.transport = 'http';
25980
25978
  this._transportType = options.transport;
25981
25979
  this.options = options;
@@ -26058,9 +26056,28 @@ class Api extends eventsExports.EventEmitter {
26058
26056
  }
26059
26057
  const id = ++this.seqNo;
26060
26058
  const fetchMethod = this.options.fetchMethod || fetch;
26061
- jsonRpc(this.options.uri, { method, params, id }, fetchMethod)
26059
+ jsonRpc(this.options.url, { method, params, id }, fetchMethod)
26062
26060
  .then(res => { callback(null, res); }, err => { callback(err); });
26063
26061
  }
26062
+ /**
26063
+ * Promise-based version of call
26064
+ * Makes a JSON-RPC call to the Steem blockchain
26065
+ * @param method Method name (e.g., 'condenser_api.get_accounts')
26066
+ * @param params Parameters array for the method
26067
+ * @returns Promise that resolves with the result or rejects with an error
26068
+ */
26069
+ callAsync(method, params) {
26070
+ return new Promise((resolve, reject) => {
26071
+ this.call(method, params, (err, result) => {
26072
+ if (err) {
26073
+ reject(err);
26074
+ }
26075
+ else {
26076
+ resolve(result);
26077
+ }
26078
+ });
26079
+ });
26080
+ }
26064
26081
  signedCall(method, params, account, key, callback) {
26065
26082
  if (this._transportType !== 'http') {
26066
26083
  callback(new Error('RPC methods can only be called when using http transport'));
@@ -26076,9 +26093,30 @@ class Api extends eventsExports.EventEmitter {
26076
26093
  return;
26077
26094
  }
26078
26095
  const fetchMethod = this.options.fetchMethod || fetch;
26079
- jsonRpc(this.options.uri, request, fetchMethod)
26096
+ jsonRpc(this.options.url, request, fetchMethod)
26080
26097
  .then(res => { callback(null, res); }, err => { callback(err); });
26081
26098
  }
26099
+ /**
26100
+ * Promise-based version of signedCall
26101
+ * Makes an authenticated JSON-RPC call with cryptographic signature
26102
+ * @param method Method name (e.g., 'conveyor.is_email_registered')
26103
+ * @param params Parameters array for the method
26104
+ * @param account Account name to sign the request with
26105
+ * @param key Private key (WIF) to sign the request
26106
+ * @returns Promise that resolves with the result or rejects with an error
26107
+ */
26108
+ signedCallAsync(method, params, account, key) {
26109
+ return new Promise((resolve, reject) => {
26110
+ this.signedCall(method, params, account, key, (err, result) => {
26111
+ if (err) {
26112
+ reject(err);
26113
+ }
26114
+ else {
26115
+ resolve(result);
26116
+ }
26117
+ });
26118
+ });
26119
+ }
26082
26120
  /**
26083
26121
  * Verify a signed RPC request
26084
26122
  * @param signedRequest The signed request to verify
@@ -26141,6 +26179,24 @@ class Api extends eventsExports.EventEmitter {
26141
26179
  .catch(error => callback(error instanceof Error ? error : new Error(String(error))));
26142
26180
  }).catch(callback);
26143
26181
  }
26182
+ /**
26183
+ * Promise-based version of verifySignedRequest
26184
+ * Verifies a signed RPC request
26185
+ * @param signedRequest The signed request to verify
26186
+ * @returns Promise that resolves with verification result or rejects with an error
26187
+ */
26188
+ verifySignedRequestAsync(signedRequest) {
26189
+ return new Promise((resolve, reject) => {
26190
+ this.verifySignedRequest(signedRequest, (err, result) => {
26191
+ if (err) {
26192
+ reject(err);
26193
+ }
26194
+ else {
26195
+ resolve(result);
26196
+ }
26197
+ });
26198
+ });
26199
+ }
26144
26200
  setOptions(options) {
26145
26201
  Object.assign(this.options, options);
26146
26202
  this._setLogger(options);
@@ -26153,9 +26209,9 @@ class Api extends eventsExports.EventEmitter {
26153
26209
  getConfig().set('address_prefix', options.useTestNet ? 'TST' : 'STM');
26154
26210
  }
26155
26211
  }
26156
- setUri(url) {
26212
+ setUrl(url) {
26157
26213
  this.setOptions({
26158
- uri: url
26214
+ url: url
26159
26215
  });
26160
26216
  }
26161
26217
  streamBlockNumber(mode = 'head', callback, ts = 200) {
@@ -26315,6 +26371,24 @@ class Api extends eventsExports.EventEmitter {
26315
26371
  }
26316
26372
  this.broadcastTransactionSynchronous(trx, callback);
26317
26373
  }
26374
+ /**
26375
+ * Promise-based version of broadcastTransactionSynchronousWith
26376
+ * Broadcasts a transaction synchronously
26377
+ * @param options Options object containing the transaction
26378
+ * @returns Promise that resolves with the result or rejects with an error
26379
+ */
26380
+ broadcastTransactionSynchronousWithAsync(options) {
26381
+ return new Promise((resolve, reject) => {
26382
+ this.broadcastTransactionSynchronousWith(options, (err, result) => {
26383
+ if (err) {
26384
+ reject(err);
26385
+ }
26386
+ else {
26387
+ resolve(result);
26388
+ }
26389
+ });
26390
+ });
26391
+ }
26318
26392
  /**
26319
26393
  * Broadcast a transaction to the blockchain.
26320
26394
  * @param trx The transaction object
@@ -26334,6 +26408,24 @@ class Api extends eventsExports.EventEmitter {
26334
26408
  callback(new Error('broadcastTransaction is not implemented'));
26335
26409
  }
26336
26410
  }
26411
+ /**
26412
+ * Promise-based version of broadcastTransaction
26413
+ * Broadcasts a transaction to the blockchain
26414
+ * @param trx The transaction object
26415
+ * @returns Promise that resolves with the result or rejects with an error
26416
+ */
26417
+ broadcastTransactionAsync(trx) {
26418
+ return new Promise((resolve, reject) => {
26419
+ this.broadcastTransaction(trx, (err, result) => {
26420
+ if (err) {
26421
+ reject(err);
26422
+ }
26423
+ else {
26424
+ resolve(result);
26425
+ }
26426
+ });
26427
+ });
26428
+ }
26337
26429
  /**
26338
26430
  * Sign a transaction with the provided private key(s).
26339
26431
  * @param trx The transaction object
@@ -26382,6 +26474,25 @@ class Api extends eventsExports.EventEmitter {
26382
26474
  params: [confirmationCallback, trx]
26383
26475
  }, callback);
26384
26476
  }
26477
+ /**
26478
+ * Promise-based version of broadcastTransactionWithCallback
26479
+ * Note: The confirmationCallback will still be called when the transaction is confirmed
26480
+ * @param confirmationCallback Callback function for transaction confirmation
26481
+ * @param trx Transaction object to broadcast
26482
+ * @returns Promise that resolves with the result or rejects with an error
26483
+ */
26484
+ broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
26485
+ return new Promise((resolve, reject) => {
26486
+ this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
26487
+ if (err) {
26488
+ reject(err);
26489
+ }
26490
+ else {
26491
+ resolve(result);
26492
+ }
26493
+ });
26494
+ });
26495
+ }
26385
26496
  /**
26386
26497
  * Broadcast a block to the network.
26387
26498
  * @param block Block object to broadcast
@@ -26397,6 +26508,24 @@ class Api extends eventsExports.EventEmitter {
26397
26508
  params: [block]
26398
26509
  }, callback);
26399
26510
  }
26511
+ /**
26512
+ * Promise-based version of broadcastBlock
26513
+ * Broadcasts a block to the network
26514
+ * @param block Block object to broadcast
26515
+ * @returns Promise that resolves with the result or rejects with an error
26516
+ */
26517
+ broadcastBlockAsync(block) {
26518
+ return new Promise((resolve, reject) => {
26519
+ this.broadcastBlock(block, (err, result) => {
26520
+ if (err) {
26521
+ reject(err);
26522
+ }
26523
+ else {
26524
+ resolve(result);
26525
+ }
26526
+ });
26527
+ });
26528
+ }
26400
26529
  /**
26401
26530
  * Set the maximum block age for transaction acceptance.
26402
26531
  * @param maxBlockAge Maximum block age in seconds
@@ -26412,6 +26541,24 @@ class Api extends eventsExports.EventEmitter {
26412
26541
  params: [maxBlockAge]
26413
26542
  }, callback);
26414
26543
  }
26544
+ /**
26545
+ * Promise-based version of setMaxBlockAge
26546
+ * Sets the maximum block age for transaction acceptance
26547
+ * @param maxBlockAge Maximum block age in seconds
26548
+ * @returns Promise that resolves with the result or rejects with an error
26549
+ */
26550
+ setMaxBlockAgeAsync(maxBlockAge) {
26551
+ return new Promise((resolve, reject) => {
26552
+ this.setMaxBlockAge(maxBlockAge, (err, result) => {
26553
+ if (err) {
26554
+ reject(err);
26555
+ }
26556
+ else {
26557
+ resolve(result);
26558
+ }
26559
+ });
26560
+ });
26561
+ }
26415
26562
  /**
26416
26563
  * Verify transaction authority.
26417
26564
  * @param trx Transaction object to verify
@@ -26485,15 +26632,17 @@ class Api extends eventsExports.EventEmitter {
26485
26632
  }
26486
26633
  }
26487
26634
  // Export singleton instance for compatibility
26488
- const api$1 = new Api({ uri: getConfig().get('uri') || 'https://api.steemit.com' });
26635
+ // Use first node from config.nodes array
26636
+ const nodes = getConfig().get('nodes') || ['https://api.steemit.com'];
26637
+ const api = new Api({ url: nodes[0] || 'https://api.steemit.com' });
26489
26638
  function setOptions(options) {
26490
- api$1.setOptions(options);
26639
+ api.setOptions(options);
26491
26640
  }
26492
26641
  // Export async variants and listeners for compatibility with tests
26493
- api$1.getDynamicGlobalPropertiesAsync;
26494
- api$1.getBlockAsync;
26495
- api$1.getFollowersAsync;
26496
- api$1.getContentAsync;
26642
+ api.getDynamicGlobalPropertiesAsync;
26643
+ api.getBlockAsync;
26644
+ api.getFollowersAsync;
26645
+ api.getContentAsync;
26497
26646
 
26498
26647
  const operations$1 = [
26499
26648
  {
@@ -28901,8 +29050,8 @@ const verify = (message, signature, publicKey) => {
28901
29050
  }
28902
29051
  };
28903
29052
 
28904
- // Create the API instance
28905
- const api = new Api();
29053
+ // Use the singleton API instance exported from api module
29054
+ // This ensures steem.api and setOptions() operate on the same instance
28906
29055
  // Create the main steem object with all modules
28907
29056
  const steem = {
28908
29057
  api,
@@ -28913,10 +29062,15 @@ const steem = {
28913
29062
  operations,
28914
29063
  serializer,
28915
29064
  utils: utils$3,
28916
- version: '1.0.8',
29065
+ version: '1.0.10',
28917
29066
  config: {
28918
29067
  set: (options) => {
28919
- setOptions(options);
29068
+ // If nodes is provided, extract the first node as url for API
29069
+ const apiOptions = { ...options };
29070
+ if (options.nodes && Array.isArray(options.nodes) && options.nodes.length > 0) {
29071
+ apiOptions.url = options.nodes[0];
29072
+ }
29073
+ setOptions(apiOptions);
28920
29074
  setOptions$1(options);
28921
29075
  },
28922
29076
  get: (key) => getConfig().get(key),
@@ -28948,5 +29102,5 @@ if (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {
28948
29102
  }
28949
29103
  }
28950
29104
 
28951
- export { doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
29105
+ export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
28952
29106
  //# sourceMappingURL=browser.esm.js.map