@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.js CHANGED
@@ -272,7 +272,7 @@ function requireBn$1 () {
272
272
  if (hasRequiredBn$1) return bn$1.exports;
273
273
  hasRequiredBn$1 = 1;
274
274
  (function (module) {
275
- (function (module, exports$1) {
275
+ (function (module, exports) {
276
276
 
277
277
  // Utils
278
278
  function assert (val, msg) {
@@ -315,7 +315,7 @@ function requireBn$1 () {
315
315
  if (typeof module === 'object') {
316
316
  module.exports = BN;
317
317
  } else {
318
- exports$1.BN = BN;
318
+ exports.BN = BN;
319
319
  }
320
320
 
321
321
  BN.BN = BN;
@@ -3747,9 +3747,9 @@ var hasRequiredUtils$2;
3747
3747
  function requireUtils$2 () {
3748
3748
  if (hasRequiredUtils$2) return utils$1;
3749
3749
  hasRequiredUtils$2 = 1;
3750
- (function (exports$1) {
3750
+ (function (exports) {
3751
3751
 
3752
- var utils = exports$1;
3752
+ var utils = exports;
3753
3753
 
3754
3754
  function toArray(msg, enc) {
3755
3755
  if (Array.isArray(msg))
@@ -3814,9 +3814,9 @@ var hasRequiredUtils$1;
3814
3814
  function requireUtils$1 () {
3815
3815
  if (hasRequiredUtils$1) return utils$2;
3816
3816
  hasRequiredUtils$1 = 1;
3817
- (function (exports$1) {
3817
+ (function (exports) {
3818
3818
 
3819
- var utils = exports$1;
3819
+ var utils = exports;
3820
3820
  var BN = requireBn$1();
3821
3821
  var minAssert = requireMinimalisticAssert();
3822
3822
  var minUtils = requireUtils$2();
@@ -6040,9 +6040,9 @@ var hasRequiredCurve;
6040
6040
  function requireCurve () {
6041
6041
  if (hasRequiredCurve) return curve;
6042
6042
  hasRequiredCurve = 1;
6043
- (function (exports$1) {
6043
+ (function (exports) {
6044
6044
 
6045
- var curve = exports$1;
6045
+ var curve = exports;
6046
6046
 
6047
6047
  curve.base = requireBase();
6048
6048
  curve.short = requireShort();
@@ -7346,8 +7346,8 @@ var hasRequiredHash;
7346
7346
  function requireHash () {
7347
7347
  if (hasRequiredHash) return hash;
7348
7348
  hasRequiredHash = 1;
7349
- (function (exports$1) {
7350
- var hash = exports$1;
7349
+ (function (exports) {
7350
+ var hash = exports;
7351
7351
 
7352
7352
  hash.utils = requireUtils();
7353
7353
  hash.common = requireCommon$1();
@@ -8160,9 +8160,9 @@ var hasRequiredCurves;
8160
8160
  function requireCurves () {
8161
8161
  if (hasRequiredCurves) return curves;
8162
8162
  hasRequiredCurves = 1;
8163
- (function (exports$1) {
8163
+ (function (exports) {
8164
8164
 
8165
- var curves = exports$1;
8165
+ var curves = exports;
8166
8166
 
8167
8167
  var hash = requireHash();
8168
8168
  var curve = requireCurve();
@@ -9401,9 +9401,9 @@ var hasRequiredElliptic;
9401
9401
  function requireElliptic () {
9402
9402
  if (hasRequiredElliptic) return elliptic;
9403
9403
  hasRequiredElliptic = 1;
9404
- (function (exports$1) {
9404
+ (function (exports) {
9405
9405
 
9406
- var elliptic = exports$1;
9406
+ var elliptic = exports;
9407
9407
 
9408
9408
  elliptic.version = require$$0$1.version;
9409
9409
  elliptic.utils = requireUtils$1();
@@ -9430,7 +9430,7 @@ function requireBn () {
9430
9430
  if (hasRequiredBn) return bn.exports;
9431
9431
  hasRequiredBn = 1;
9432
9432
  (function (module) {
9433
- (function (module, exports$1) {
9433
+ (function (module, exports) {
9434
9434
 
9435
9435
  // Utils
9436
9436
  function assert (val, msg) {
@@ -9473,7 +9473,7 @@ function requireBn () {
9473
9473
  if (typeof module === 'object') {
9474
9474
  module.exports = BN;
9475
9475
  } else {
9476
- exports$1.BN = BN;
9476
+ exports.BN = BN;
9477
9477
  }
9478
9478
 
9479
9479
  BN.BN = BN;
@@ -14405,24 +14405,24 @@ class Address {
14405
14405
  * @returns Buffer with random bytes
14406
14406
  */
14407
14407
  function randomBytes(size) {
14408
- // 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+)
14409
14409
  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
14410
14410
  const array = new Uint8Array(size);
14411
14411
  crypto.getRandomValues(array);
14412
14412
  return Buffer.from(array);
14413
14413
  }
14414
14414
  // Fallback to Node.js crypto only if Web Crypto API is not available
14415
- // 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)
14416
14416
  // and is kept as a safety fallback for edge cases.
14417
14417
  // In browser builds, Rollup will tree-shake this code away because
14418
14418
  // the condition above will always be true in browsers.
14419
14419
  //
14420
- // Note: This SDK requires Node.js >= 18.0.0 (see package.json engines field).
14421
- // Node.js 18+ has Web Crypto API, so this fallback is rarely needed.
14422
- // 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,
14423
14423
  // this code path won't be reached in ESM mode with the minimum required version.
14424
14424
  try {
14425
- // 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)
14426
14426
  // eslint-disable-next-line @typescript-eslint/no-require-imports
14427
14427
  const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
14428
14428
  if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
@@ -14433,7 +14433,7 @@ function randomBytes(size) {
14433
14433
  // Ignore require errors in browser environments or ESM mode
14434
14434
  }
14435
14435
  // If neither Web Crypto API nor Node.js crypto is available, throw error
14436
- 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.');
14437
14437
  }
14438
14438
 
14439
14439
  /**
@@ -15386,11 +15386,11 @@ var hasRequiredRetry$1;
15386
15386
  function requireRetry$1 () {
15387
15387
  if (hasRequiredRetry$1) return retry$2;
15388
15388
  hasRequiredRetry$1 = 1;
15389
- (function (exports$1) {
15389
+ (function (exports) {
15390
15390
  var RetryOperation = requireRetry_operation();
15391
15391
 
15392
- exports$1.operation = function(options) {
15393
- var timeouts = exports$1.timeouts(options);
15392
+ exports.operation = function(options) {
15393
+ var timeouts = exports.timeouts(options);
15394
15394
  return new RetryOperation(timeouts, {
15395
15395
  forever: options && (options.forever || options.retries === Infinity),
15396
15396
  unref: options && options.unref,
@@ -15398,7 +15398,7 @@ function requireRetry$1 () {
15398
15398
  });
15399
15399
  };
15400
15400
 
15401
- exports$1.timeouts = function(options) {
15401
+ exports.timeouts = function(options) {
15402
15402
  if (options instanceof Array) {
15403
15403
  return [].concat(options);
15404
15404
  }
@@ -15435,7 +15435,7 @@ function requireRetry$1 () {
15435
15435
  return timeouts;
15436
15436
  };
15437
15437
 
15438
- exports$1.createTimeout = function(attempt, opts) {
15438
+ exports.createTimeout = function(attempt, opts) {
15439
15439
  var random = (opts.randomize)
15440
15440
  ? (Math.random() + 1)
15441
15441
  : 1;
@@ -15446,7 +15446,7 @@ function requireRetry$1 () {
15446
15446
  return timeout;
15447
15447
  };
15448
15448
 
15449
- exports$1.wrap = function(obj, options, methods) {
15449
+ exports.wrap = function(obj, options, methods) {
15450
15450
  if (options instanceof Array) {
15451
15451
  methods = options;
15452
15452
  options = null;
@@ -15466,7 +15466,7 @@ function requireRetry$1 () {
15466
15466
  var original = obj[method];
15467
15467
 
15468
15468
  obj[method] = function retryWrapper(original) {
15469
- var op = exports$1.operation(options);
15469
+ var op = exports.operation(options);
15470
15470
  var args = Array.prototype.slice.call(arguments, 1);
15471
15471
  var callback = args.pop();
15472
15472
 
@@ -15559,7 +15559,7 @@ class JsonRpcError extends Error {
15559
15559
  }
15560
15560
  /**
15561
15561
  * Makes a JSON-RPC request using native fetch API
15562
- * Universal implementation that works in both Node.js (18+) and browser
15562
+ * Universal implementation that works in both Node.js (20.19+) and browser
15563
15563
  *
15564
15564
  * @param url - The URL to the JSON-RPC endpoint
15565
15565
  * @param request - The JSON-RPC request object
@@ -15906,7 +15906,7 @@ function requireLong () {
15906
15906
  if (value >= TWO_PWR_64_DBL)
15907
15907
  return MAX_UNSIGNED_VALUE;
15908
15908
  } else {
15909
- if (value <= -TWO_PWR_63_DBL)
15909
+ if (value <= -9223372036854776e3)
15910
15910
  return MIN_VALUE;
15911
15911
  if (value + 1 >= TWO_PWR_63_DBL)
15912
15912
  return MAX_VALUE;
@@ -20651,7 +20651,7 @@ function fromNumber(value, unsigned) {
20651
20651
  if (value < 0) return UZERO;
20652
20652
  if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
20653
20653
  } else {
20654
- if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
20654
+ if (value <= -9223372036854776e3) return MIN_VALUE;
20655
20655
  if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
20656
20656
  }
20657
20657
  if (value < 0) return fromNumber(-value, unsigned).neg();
@@ -22730,6 +22730,25 @@ class Api extends EventEmitter {
22730
22730
  jsonRpc(this.options.url, { method, params, id }, fetchMethod)
22731
22731
  .then(res => { callback(null, res); }, err => { callback(err); });
22732
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
+ }
22733
22752
  signedCall(method, params, account, key, callback) {
22734
22753
  if (this._transportType !== 'http') {
22735
22754
  callback(new Error('RPC methods can only be called when using http transport'));
@@ -22748,6 +22767,27 @@ class Api extends EventEmitter {
22748
22767
  jsonRpc(this.options.url, request, fetchMethod)
22749
22768
  .then(res => { callback(null, res); }, err => { callback(err); });
22750
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
+ }
22751
22791
  /**
22752
22792
  * Verify a signed RPC request
22753
22793
  * @param signedRequest The signed request to verify
@@ -22810,6 +22850,24 @@ class Api extends EventEmitter {
22810
22850
  .catch(error => callback(error instanceof Error ? error : new Error(String(error))));
22811
22851
  }).catch(callback);
22812
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
+ }
22813
22871
  setOptions(options) {
22814
22872
  Object.assign(this.options, options);
22815
22873
  this._setLogger(options);
@@ -22984,6 +23042,24 @@ class Api extends EventEmitter {
22984
23042
  }
22985
23043
  this.broadcastTransactionSynchronous(trx, callback);
22986
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
+ }
22987
23063
  /**
22988
23064
  * Broadcast a transaction to the blockchain.
22989
23065
  * @param trx The transaction object
@@ -23003,6 +23079,24 @@ class Api extends EventEmitter {
23003
23079
  callback(new Error('broadcastTransaction is not implemented'));
23004
23080
  }
23005
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
+ }
23006
23100
  /**
23007
23101
  * Sign a transaction with the provided private key(s).
23008
23102
  * @param trx The transaction object
@@ -23051,6 +23145,25 @@ class Api extends EventEmitter {
23051
23145
  params: [confirmationCallback, trx]
23052
23146
  }, callback);
23053
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
+ }
23054
23167
  /**
23055
23168
  * Broadcast a block to the network.
23056
23169
  * @param block Block object to broadcast
@@ -23066,6 +23179,24 @@ class Api extends EventEmitter {
23066
23179
  params: [block]
23067
23180
  }, callback);
23068
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
+ }
23069
23200
  /**
23070
23201
  * Set the maximum block age for transaction acceptance.
23071
23202
  * @param maxBlockAge Maximum block age in seconds
@@ -23081,6 +23212,24 @@ class Api extends EventEmitter {
23081
23212
  params: [maxBlockAge]
23082
23213
  }, callback);
23083
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
+ }
23084
23233
  /**
23085
23234
  * Verify transaction authority.
23086
23235
  * @param trx Transaction object to verify
@@ -25585,7 +25734,7 @@ const steem = {
25585
25734
  operations,
25586
25735
  serializer,
25587
25736
  utils: utils$3,
25588
- version: '1.0.9',
25737
+ version: '1.0.10',
25589
25738
  config: {
25590
25739
  set: (options) => {
25591
25740
  // If nodes is provided, extract the first node as url for API