@steemit/steem-js 1.0.9 → 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.cjs CHANGED
@@ -292,7 +292,7 @@ function requireBn$1 () {
292
292
  if (hasRequiredBn$1) return bn$1.exports;
293
293
  hasRequiredBn$1 = 1;
294
294
  (function (module) {
295
- (function (module, exports$1) {
295
+ (function (module, exports) {
296
296
 
297
297
  // Utils
298
298
  function assert (val, msg) {
@@ -335,7 +335,7 @@ function requireBn$1 () {
335
335
  if (typeof module === 'object') {
336
336
  module.exports = BN;
337
337
  } else {
338
- exports$1.BN = BN;
338
+ exports.BN = BN;
339
339
  }
340
340
 
341
341
  BN.BN = BN;
@@ -3767,9 +3767,9 @@ var hasRequiredUtils$2;
3767
3767
  function requireUtils$2 () {
3768
3768
  if (hasRequiredUtils$2) return utils$1;
3769
3769
  hasRequiredUtils$2 = 1;
3770
- (function (exports$1) {
3770
+ (function (exports) {
3771
3771
 
3772
- var utils = exports$1;
3772
+ var utils = exports;
3773
3773
 
3774
3774
  function toArray(msg, enc) {
3775
3775
  if (Array.isArray(msg))
@@ -3834,9 +3834,9 @@ var hasRequiredUtils$1;
3834
3834
  function requireUtils$1 () {
3835
3835
  if (hasRequiredUtils$1) return utils$2;
3836
3836
  hasRequiredUtils$1 = 1;
3837
- (function (exports$1) {
3837
+ (function (exports) {
3838
3838
 
3839
- var utils = exports$1;
3839
+ var utils = exports;
3840
3840
  var BN = requireBn$1();
3841
3841
  var minAssert = requireMinimalisticAssert();
3842
3842
  var minUtils = requireUtils$2();
@@ -6060,9 +6060,9 @@ var hasRequiredCurve;
6060
6060
  function requireCurve () {
6061
6061
  if (hasRequiredCurve) return curve;
6062
6062
  hasRequiredCurve = 1;
6063
- (function (exports$1) {
6063
+ (function (exports) {
6064
6064
 
6065
- var curve = exports$1;
6065
+ var curve = exports;
6066
6066
 
6067
6067
  curve.base = requireBase();
6068
6068
  curve.short = requireShort();
@@ -7366,8 +7366,8 @@ var hasRequiredHash;
7366
7366
  function requireHash () {
7367
7367
  if (hasRequiredHash) return hash;
7368
7368
  hasRequiredHash = 1;
7369
- (function (exports$1) {
7370
- var hash = exports$1;
7369
+ (function (exports) {
7370
+ var hash = exports;
7371
7371
 
7372
7372
  hash.utils = requireUtils();
7373
7373
  hash.common = requireCommon$1();
@@ -8180,9 +8180,9 @@ var hasRequiredCurves;
8180
8180
  function requireCurves () {
8181
8181
  if (hasRequiredCurves) return curves;
8182
8182
  hasRequiredCurves = 1;
8183
- (function (exports$1) {
8183
+ (function (exports) {
8184
8184
 
8185
- var curves = exports$1;
8185
+ var curves = exports;
8186
8186
 
8187
8187
  var hash = requireHash();
8188
8188
  var curve = requireCurve();
@@ -9421,9 +9421,9 @@ var hasRequiredElliptic;
9421
9421
  function requireElliptic () {
9422
9422
  if (hasRequiredElliptic) return elliptic;
9423
9423
  hasRequiredElliptic = 1;
9424
- (function (exports$1) {
9424
+ (function (exports) {
9425
9425
 
9426
- var elliptic = exports$1;
9426
+ var elliptic = exports;
9427
9427
 
9428
9428
  elliptic.version = require$$0$1.version;
9429
9429
  elliptic.utils = requireUtils$1();
@@ -9450,7 +9450,7 @@ function requireBn () {
9450
9450
  if (hasRequiredBn) return bn.exports;
9451
9451
  hasRequiredBn = 1;
9452
9452
  (function (module) {
9453
- (function (module, exports$1) {
9453
+ (function (module, exports) {
9454
9454
 
9455
9455
  // Utils
9456
9456
  function assert (val, msg) {
@@ -9493,7 +9493,7 @@ function requireBn () {
9493
9493
  if (typeof module === 'object') {
9494
9494
  module.exports = BN;
9495
9495
  } else {
9496
- exports$1.BN = BN;
9496
+ exports.BN = BN;
9497
9497
  }
9498
9498
 
9499
9499
  BN.BN = BN;
@@ -14425,24 +14425,24 @@ class Address {
14425
14425
  * @returns Buffer with random bytes
14426
14426
  */
14427
14427
  function randomBytes(size) {
14428
- // Always try Web Crypto API first (works in both browser and Node.js 18+)
14428
+ // Always try Web Crypto API first (works in both browser and Node.js 20.19+)
14429
14429
  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
14430
14430
  const array = new Uint8Array(size);
14431
14431
  crypto.getRandomValues(array);
14432
14432
  return Buffer.from(array);
14433
14433
  }
14434
14434
  // Fallback to Node.js crypto only if Web Crypto API is not available
14435
- // This code path should not be reached in Node.js 18+ (which has Web Crypto API)
14435
+ // This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
14436
14436
  // and is kept as a safety fallback for edge cases.
14437
14437
  // In browser builds, Rollup will tree-shake this code away because
14438
14438
  // the condition above will always be true in browsers.
14439
14439
  //
14440
- // Note: This SDK requires Node.js >= 18.0.0 (see package.json engines field).
14441
- // Node.js 18+ has Web Crypto API, so this fallback is rarely needed.
14442
- // In ESM mode, require is undefined, but since Node.js 18+ has Web Crypto API,
14440
+ // Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
14441
+ // Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
14442
+ // In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
14443
14443
  // this code path won't be reached in ESM mode with the minimum required version.
14444
14444
  try {
14445
- // Use dynamic require as a safety fallback (for Node.js < 18 edge cases)
14445
+ // Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
14446
14446
  // eslint-disable-next-line @typescript-eslint/no-require-imports
14447
14447
  const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
14448
14448
  if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
@@ -14453,7 +14453,7 @@ function randomBytes(size) {
14453
14453
  // Ignore require errors in browser environments or ESM mode
14454
14454
  }
14455
14455
  // If neither Web Crypto API nor Node.js crypto is available, throw error
14456
- 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.');
14456
+ 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.');
14457
14457
  }
14458
14458
 
14459
14459
  /**
@@ -15406,11 +15406,11 @@ var hasRequiredRetry$1;
15406
15406
  function requireRetry$1 () {
15407
15407
  if (hasRequiredRetry$1) return retry$2;
15408
15408
  hasRequiredRetry$1 = 1;
15409
- (function (exports$1) {
15409
+ (function (exports) {
15410
15410
  var RetryOperation = requireRetry_operation();
15411
15411
 
15412
- exports$1.operation = function(options) {
15413
- var timeouts = exports$1.timeouts(options);
15412
+ exports.operation = function(options) {
15413
+ var timeouts = exports.timeouts(options);
15414
15414
  return new RetryOperation(timeouts, {
15415
15415
  forever: options && (options.forever || options.retries === Infinity),
15416
15416
  unref: options && options.unref,
@@ -15418,7 +15418,7 @@ function requireRetry$1 () {
15418
15418
  });
15419
15419
  };
15420
15420
 
15421
- exports$1.timeouts = function(options) {
15421
+ exports.timeouts = function(options) {
15422
15422
  if (options instanceof Array) {
15423
15423
  return [].concat(options);
15424
15424
  }
@@ -15455,7 +15455,7 @@ function requireRetry$1 () {
15455
15455
  return timeouts;
15456
15456
  };
15457
15457
 
15458
- exports$1.createTimeout = function(attempt, opts) {
15458
+ exports.createTimeout = function(attempt, opts) {
15459
15459
  var random = (opts.randomize)
15460
15460
  ? (Math.random() + 1)
15461
15461
  : 1;
@@ -15466,7 +15466,7 @@ function requireRetry$1 () {
15466
15466
  return timeout;
15467
15467
  };
15468
15468
 
15469
- exports$1.wrap = function(obj, options, methods) {
15469
+ exports.wrap = function(obj, options, methods) {
15470
15470
  if (options instanceof Array) {
15471
15471
  methods = options;
15472
15472
  options = null;
@@ -15486,7 +15486,7 @@ function requireRetry$1 () {
15486
15486
  var original = obj[method];
15487
15487
 
15488
15488
  obj[method] = function retryWrapper(original) {
15489
- var op = exports$1.operation(options);
15489
+ var op = exports.operation(options);
15490
15490
  var args = Array.prototype.slice.call(arguments, 1);
15491
15491
  var callback = args.pop();
15492
15492
 
@@ -15579,7 +15579,7 @@ class JsonRpcError extends Error {
15579
15579
  }
15580
15580
  /**
15581
15581
  * Makes a JSON-RPC request using native fetch API
15582
- * Universal implementation that works in both Node.js (18+) and browser
15582
+ * Universal implementation that works in both Node.js (20.19+) and browser
15583
15583
  *
15584
15584
  * @param url - The URL to the JSON-RPC endpoint
15585
15585
  * @param request - The JSON-RPC request object
@@ -15926,7 +15926,7 @@ function requireLong () {
15926
15926
  if (value >= TWO_PWR_64_DBL)
15927
15927
  return MAX_UNSIGNED_VALUE;
15928
15928
  } else {
15929
- if (value <= -TWO_PWR_63_DBL)
15929
+ if (value <= -9223372036854776e3)
15930
15930
  return MIN_VALUE;
15931
15931
  if (value + 1 >= TWO_PWR_63_DBL)
15932
15932
  return MAX_VALUE;
@@ -20671,7 +20671,7 @@ function fromNumber(value, unsigned) {
20671
20671
  if (value < 0) return UZERO;
20672
20672
  if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
20673
20673
  } else {
20674
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
20674
+ if (value <= -9223372036854776e3) return MIN_VALUE;
20675
20675
  if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
20676
20676
  }
20677
20677
  if (value < 0) return fromNumber(-value, unsigned).neg();
@@ -22750,6 +22750,25 @@ class Api extends events.EventEmitter {
22750
22750
  jsonRpc(this.options.url, { method, params, id }, fetchMethod)
22751
22751
  .then(res => { callback(null, res); }, err => { callback(err); });
22752
22752
  }
22753
+ /**
22754
+ * Promise-based version of call
22755
+ * Makes a JSON-RPC call to the Steem blockchain
22756
+ * @param method Method name (e.g., 'condenser_api.get_accounts')
22757
+ * @param params Parameters array for the method
22758
+ * @returns Promise that resolves with the result or rejects with an error
22759
+ */
22760
+ callAsync(method, params) {
22761
+ return new Promise((resolve, reject) => {
22762
+ this.call(method, params, (err, result) => {
22763
+ if (err) {
22764
+ reject(err);
22765
+ }
22766
+ else {
22767
+ resolve(result);
22768
+ }
22769
+ });
22770
+ });
22771
+ }
22753
22772
  signedCall(method, params, account, key, callback) {
22754
22773
  if (this._transportType !== 'http') {
22755
22774
  callback(new Error('RPC methods can only be called when using http transport'));
@@ -22768,6 +22787,27 @@ class Api extends events.EventEmitter {
22768
22787
  jsonRpc(this.options.url, request, fetchMethod)
22769
22788
  .then(res => { callback(null, res); }, err => { callback(err); });
22770
22789
  }
22790
+ /**
22791
+ * Promise-based version of signedCall
22792
+ * Makes an authenticated JSON-RPC call with cryptographic signature
22793
+ * @param method Method name (e.g., 'conveyor.is_email_registered')
22794
+ * @param params Parameters array for the method
22795
+ * @param account Account name to sign the request with
22796
+ * @param key Private key (WIF) to sign the request
22797
+ * @returns Promise that resolves with the result or rejects with an error
22798
+ */
22799
+ signedCallAsync(method, params, account, key) {
22800
+ return new Promise((resolve, reject) => {
22801
+ this.signedCall(method, params, account, key, (err, result) => {
22802
+ if (err) {
22803
+ reject(err);
22804
+ }
22805
+ else {
22806
+ resolve(result);
22807
+ }
22808
+ });
22809
+ });
22810
+ }
22771
22811
  /**
22772
22812
  * Verify a signed RPC request
22773
22813
  * @param signedRequest The signed request to verify
@@ -22830,6 +22870,24 @@ class Api extends events.EventEmitter {
22830
22870
  .catch(error => callback(error instanceof Error ? error : new Error(String(error))));
22831
22871
  }).catch(callback);
22832
22872
  }
22873
+ /**
22874
+ * Promise-based version of verifySignedRequest
22875
+ * Verifies a signed RPC request
22876
+ * @param signedRequest The signed request to verify
22877
+ * @returns Promise that resolves with verification result or rejects with an error
22878
+ */
22879
+ verifySignedRequestAsync(signedRequest) {
22880
+ return new Promise((resolve, reject) => {
22881
+ this.verifySignedRequest(signedRequest, (err, result) => {
22882
+ if (err) {
22883
+ reject(err);
22884
+ }
22885
+ else {
22886
+ resolve(result);
22887
+ }
22888
+ });
22889
+ });
22890
+ }
22833
22891
  setOptions(options) {
22834
22892
  Object.assign(this.options, options);
22835
22893
  this._setLogger(options);
@@ -23004,6 +23062,24 @@ class Api extends events.EventEmitter {
23004
23062
  }
23005
23063
  this.broadcastTransactionSynchronous(trx, callback);
23006
23064
  }
23065
+ /**
23066
+ * Promise-based version of broadcastTransactionSynchronousWith
23067
+ * Broadcasts a transaction synchronously
23068
+ * @param options Options object containing the transaction
23069
+ * @returns Promise that resolves with the result or rejects with an error
23070
+ */
23071
+ broadcastTransactionSynchronousWithAsync(options) {
23072
+ return new Promise((resolve, reject) => {
23073
+ this.broadcastTransactionSynchronousWith(options, (err, result) => {
23074
+ if (err) {
23075
+ reject(err);
23076
+ }
23077
+ else {
23078
+ resolve(result);
23079
+ }
23080
+ });
23081
+ });
23082
+ }
23007
23083
  /**
23008
23084
  * Broadcast a transaction to the blockchain.
23009
23085
  * @param trx The transaction object
@@ -23023,6 +23099,24 @@ class Api extends events.EventEmitter {
23023
23099
  callback(new Error('broadcastTransaction is not implemented'));
23024
23100
  }
23025
23101
  }
23102
+ /**
23103
+ * Promise-based version of broadcastTransaction
23104
+ * Broadcasts a transaction to the blockchain
23105
+ * @param trx The transaction object
23106
+ * @returns Promise that resolves with the result or rejects with an error
23107
+ */
23108
+ broadcastTransactionAsync(trx) {
23109
+ return new Promise((resolve, reject) => {
23110
+ this.broadcastTransaction(trx, (err, result) => {
23111
+ if (err) {
23112
+ reject(err);
23113
+ }
23114
+ else {
23115
+ resolve(result);
23116
+ }
23117
+ });
23118
+ });
23119
+ }
23026
23120
  /**
23027
23121
  * Sign a transaction with the provided private key(s).
23028
23122
  * @param trx The transaction object
@@ -23071,6 +23165,25 @@ class Api extends events.EventEmitter {
23071
23165
  params: [confirmationCallback, trx]
23072
23166
  }, callback);
23073
23167
  }
23168
+ /**
23169
+ * Promise-based version of broadcastTransactionWithCallback
23170
+ * Note: The confirmationCallback will still be called when the transaction is confirmed
23171
+ * @param confirmationCallback Callback function for transaction confirmation
23172
+ * @param trx Transaction object to broadcast
23173
+ * @returns Promise that resolves with the result or rejects with an error
23174
+ */
23175
+ broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
23176
+ return new Promise((resolve, reject) => {
23177
+ this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
23178
+ if (err) {
23179
+ reject(err);
23180
+ }
23181
+ else {
23182
+ resolve(result);
23183
+ }
23184
+ });
23185
+ });
23186
+ }
23074
23187
  /**
23075
23188
  * Broadcast a block to the network.
23076
23189
  * @param block Block object to broadcast
@@ -23086,6 +23199,24 @@ class Api extends events.EventEmitter {
23086
23199
  params: [block]
23087
23200
  }, callback);
23088
23201
  }
23202
+ /**
23203
+ * Promise-based version of broadcastBlock
23204
+ * Broadcasts a block to the network
23205
+ * @param block Block object to broadcast
23206
+ * @returns Promise that resolves with the result or rejects with an error
23207
+ */
23208
+ broadcastBlockAsync(block) {
23209
+ return new Promise((resolve, reject) => {
23210
+ this.broadcastBlock(block, (err, result) => {
23211
+ if (err) {
23212
+ reject(err);
23213
+ }
23214
+ else {
23215
+ resolve(result);
23216
+ }
23217
+ });
23218
+ });
23219
+ }
23089
23220
  /**
23090
23221
  * Set the maximum block age for transaction acceptance.
23091
23222
  * @param maxBlockAge Maximum block age in seconds
@@ -23101,6 +23232,24 @@ class Api extends events.EventEmitter {
23101
23232
  params: [maxBlockAge]
23102
23233
  }, callback);
23103
23234
  }
23235
+ /**
23236
+ * Promise-based version of setMaxBlockAge
23237
+ * Sets the maximum block age for transaction acceptance
23238
+ * @param maxBlockAge Maximum block age in seconds
23239
+ * @returns Promise that resolves with the result or rejects with an error
23240
+ */
23241
+ setMaxBlockAgeAsync(maxBlockAge) {
23242
+ return new Promise((resolve, reject) => {
23243
+ this.setMaxBlockAge(maxBlockAge, (err, result) => {
23244
+ if (err) {
23245
+ reject(err);
23246
+ }
23247
+ else {
23248
+ resolve(result);
23249
+ }
23250
+ });
23251
+ });
23252
+ }
23104
23253
  /**
23105
23254
  * Verify transaction authority.
23106
23255
  * @param trx Transaction object to verify
@@ -25605,7 +25754,7 @@ const steem = {
25605
25754
  operations,
25606
25755
  serializer,
25607
25756
  utils: utils$3,
25608
- version: '1.0.9',
25757
+ version: '1.0.10',
25609
25758
  config: {
25610
25759
  set: (options) => {
25611
25760
  // If nodes is provided, extract the first node as url for API