@steemit/steem-js 1.0.9 → 1.0.11
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/README.md +1 -1
- package/dist/api/index.d.ts +72 -0
- package/dist/api/transports/http.d.ts +1 -1
- package/dist/api/types.d.ts +78 -0
- package/dist/browser.esm.js +279 -47
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs +274 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +273 -41
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +278 -46
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/dist/api/transports/ws.d.ts +0 -19
- package/dist/crypto/browser-crypto.d.ts +0 -43
- package/dist/index.browser.js +0 -56378
- package/dist/index.browser.js.map +0 -1
- package/dist/polyfills/secure-random-browser.d.ts +0 -8
- package/dist/utils/buffer-global.d.ts +0 -7
- package/dist/utils/net-polyfill.d.ts +0 -17
- package/dist/utils/polyfill-test.d.ts +0 -19
- package/dist/utils/tls-polyfill.d.ts +0 -15
- package/dist/utils/util-polyfill.d.ts +0 -17
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
|
|
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
|
|
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
|
|
3770
|
+
(function (exports) {
|
|
3771
3771
|
|
|
3772
|
-
var utils = exports
|
|
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
|
|
3837
|
+
(function (exports) {
|
|
3838
3838
|
|
|
3839
|
-
var utils = exports
|
|
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
|
|
6063
|
+
(function (exports) {
|
|
6064
6064
|
|
|
6065
|
-
var curve = exports
|
|
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
|
|
7370
|
-
var hash = exports
|
|
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
|
|
8183
|
+
(function (exports) {
|
|
8184
8184
|
|
|
8185
|
-
var curves = exports
|
|
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
|
|
9424
|
+
(function (exports) {
|
|
9425
9425
|
|
|
9426
|
-
var elliptic = exports
|
|
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
|
|
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
|
|
9496
|
+
exports.BN = BN;
|
|
9497
9497
|
}
|
|
9498
9498
|
|
|
9499
9499
|
BN.BN = BN;
|
|
@@ -14193,6 +14193,77 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
14193
14193
|
const finalS = s.gt(N_OVER_TWO) ? n.sub(s) : s;
|
|
14194
14194
|
return new ECSignature(r, finalS);
|
|
14195
14195
|
}
|
|
14196
|
+
/**
|
|
14197
|
+
* Recover a public key from a signature.
|
|
14198
|
+
*
|
|
14199
|
+
* See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
|
|
14200
|
+
* Key Recovery Operation".
|
|
14201
|
+
*
|
|
14202
|
+
* http://www.secg.org/download/aid-780/sec1-v2.pdf
|
|
14203
|
+
*/
|
|
14204
|
+
function recoverPubKey(curve, e, signature, i) {
|
|
14205
|
+
if ((i & 3) !== i) {
|
|
14206
|
+
throw new Error('Recovery param is more than two bits');
|
|
14207
|
+
}
|
|
14208
|
+
const n = new BN(curve.n.toString());
|
|
14209
|
+
const r = signature.r;
|
|
14210
|
+
const s = signature.s;
|
|
14211
|
+
if (r.isNeg() || r.isZero() || !r.lt(n))
|
|
14212
|
+
throw new Error('Invalid r value');
|
|
14213
|
+
if (s.isNeg() || s.isZero() || !s.lt(n))
|
|
14214
|
+
throw new Error('Invalid s value');
|
|
14215
|
+
// Try using elliptic's built-in recoverPubKey method
|
|
14216
|
+
// It expects: msg (Buffer), signature ({r: BN, s: BN}), j (recovery param)
|
|
14217
|
+
try {
|
|
14218
|
+
// Convert e (BN) to Buffer
|
|
14219
|
+
const msgBuffer = e.toArrayLike(Buffer, 'be', 32);
|
|
14220
|
+
// Create signature object compatible with elliptic's recoverPubKey
|
|
14221
|
+
// elliptic expects {r: BN, s: BN} format
|
|
14222
|
+
const sigObj = { r: r, s: s };
|
|
14223
|
+
// Use elliptic's built-in method
|
|
14224
|
+
const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
|
|
14225
|
+
return Q;
|
|
14226
|
+
}
|
|
14227
|
+
catch (error) {
|
|
14228
|
+
// Fallback to manual implementation if elliptic's method fails
|
|
14229
|
+
const G = curve.g;
|
|
14230
|
+
// A set LSB signifies that the y-coordinate is odd
|
|
14231
|
+
const isYOdd = !!(i & 1);
|
|
14232
|
+
// The more significant bit specifies whether we should use the
|
|
14233
|
+
// first or second candidate key.
|
|
14234
|
+
const isSecondKey = i >> 1;
|
|
14235
|
+
// 1.1 Let x = r + jn
|
|
14236
|
+
const x = isSecondKey ? r.add(n) : r;
|
|
14237
|
+
// pointFromX expects a hex string (not BN object)
|
|
14238
|
+
// Convert BN to hex string and ensure proper padding
|
|
14239
|
+
const xHex = x.toString(16);
|
|
14240
|
+
// Ensure hex string is properly padded to 64 characters (32 bytes)
|
|
14241
|
+
const xHexPadded = xHex.padStart(64, '0');
|
|
14242
|
+
// pointFromX may also accept a Buffer, but hex string is more reliable
|
|
14243
|
+
let R;
|
|
14244
|
+
try {
|
|
14245
|
+
R = curve.curve.pointFromX(xHexPadded, isYOdd);
|
|
14246
|
+
}
|
|
14247
|
+
catch (error) {
|
|
14248
|
+
// If hex string fails, try with Buffer
|
|
14249
|
+
const xBuffer = x.toArrayLike(Buffer, 'be', 32);
|
|
14250
|
+
R = curve.curve.pointFromX(xBuffer, isYOdd);
|
|
14251
|
+
}
|
|
14252
|
+
// 1.4 Check that nR is at infinity
|
|
14253
|
+
const nR = R.mul(n);
|
|
14254
|
+
if (!nR.isInfinity())
|
|
14255
|
+
throw new Error('nR is not a valid curve point');
|
|
14256
|
+
// Compute -e from e
|
|
14257
|
+
const eNeg = e.neg().mod(n);
|
|
14258
|
+
// 1.6.1 Compute Q = r^-1 (sR - eG)
|
|
14259
|
+
// Q = r^-1 (sR + -eG)
|
|
14260
|
+
const rInv = r.invm(n);
|
|
14261
|
+
const sR = R.mul(s);
|
|
14262
|
+
const eGNeg = G.mul(eNeg);
|
|
14263
|
+
const Q = sR.add(eGNeg).mul(rInv);
|
|
14264
|
+
return Q;
|
|
14265
|
+
}
|
|
14266
|
+
}
|
|
14196
14267
|
/**
|
|
14197
14268
|
* Calculate pubkey extraction parameter.
|
|
14198
14269
|
*
|
|
@@ -14207,11 +14278,15 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
14207
14278
|
function calcPubKeyRecoveryParam(curve, e, signature, Q) {
|
|
14208
14279
|
for (let i = 0; i < 4; i++) {
|
|
14209
14280
|
try {
|
|
14210
|
-
// Use
|
|
14211
|
-
const Qprime =
|
|
14281
|
+
// Use our own recoverPubKey function instead of curve.recoverPubKey
|
|
14282
|
+
const Qprime = recoverPubKey(curve, e, signature, i);
|
|
14212
14283
|
// 1.6.2 Verify Q = Q'
|
|
14213
|
-
// Compare points by checking
|
|
14214
|
-
|
|
14284
|
+
// Compare points by checking coordinates (more reliable than eq method)
|
|
14285
|
+
const Qx = Q.getX().toString(16);
|
|
14286
|
+
const Qy = Q.getY().toString(16);
|
|
14287
|
+
const QprimeX = Qprime.getX().toString(16);
|
|
14288
|
+
const QprimeY = Qprime.getY().toString(16);
|
|
14289
|
+
if (Qx === QprimeX && Qy === QprimeY) {
|
|
14215
14290
|
return i;
|
|
14216
14291
|
}
|
|
14217
14292
|
}
|
|
@@ -14245,7 +14320,13 @@ class Signature {
|
|
|
14245
14320
|
throw new Error('Invalid signature length');
|
|
14246
14321
|
}
|
|
14247
14322
|
const i = buffer.readUInt8(0);
|
|
14248
|
-
|
|
14323
|
+
// Support both formats: 27-30 (old/legacy) and 31-34 (dsteem compatible)
|
|
14324
|
+
// Check if it's in the old format (27-30) or new format (31-34)
|
|
14325
|
+
const recoveryOld = i - 27;
|
|
14326
|
+
const recoveryNew = i - 31;
|
|
14327
|
+
const isValidOld = recoveryOld >= 0 && recoveryOld <= 3 && (recoveryOld === (recoveryOld & 7));
|
|
14328
|
+
const isValidNew = recoveryNew >= 0 && recoveryNew <= 3 && (recoveryNew === (recoveryNew & 7));
|
|
14329
|
+
if (!isValidOld && !isValidNew) {
|
|
14249
14330
|
throw new Error('Invalid signature parameter');
|
|
14250
14331
|
}
|
|
14251
14332
|
const r = new BN(buffer.slice(1, 33));
|
|
@@ -14294,7 +14375,9 @@ class Signature {
|
|
|
14294
14375
|
}
|
|
14295
14376
|
}
|
|
14296
14377
|
const i = calcPubKeyRecoveryParam(secp256k1, new BN(buf_sha256), ecsignature, privKey.toPublic().Q);
|
|
14297
|
-
|
|
14378
|
+
// Use recovery byte 31-34 (instead of 27-30) to be compatible with dsteem
|
|
14379
|
+
// dsteem expects: recovery = byte - 31, so byte = recovery + 31
|
|
14380
|
+
return new Signature(ecsignature.r, ecsignature.s, i + 31);
|
|
14298
14381
|
}
|
|
14299
14382
|
static isCanonical(r, s) {
|
|
14300
14383
|
// See libraries/fc/src/crypto/elliptic_common.cpp is_fc_canonical
|
|
@@ -14425,24 +14508,24 @@ class Address {
|
|
|
14425
14508
|
* @returns Buffer with random bytes
|
|
14426
14509
|
*/
|
|
14427
14510
|
function randomBytes(size) {
|
|
14428
|
-
// Always try Web Crypto API first (works in both browser and Node.js
|
|
14511
|
+
// Always try Web Crypto API first (works in both browser and Node.js 20.19+)
|
|
14429
14512
|
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
14430
14513
|
const array = new Uint8Array(size);
|
|
14431
14514
|
crypto.getRandomValues(array);
|
|
14432
14515
|
return Buffer.from(array);
|
|
14433
14516
|
}
|
|
14434
14517
|
// Fallback to Node.js crypto only if Web Crypto API is not available
|
|
14435
|
-
// This code path should not be reached in Node.js
|
|
14518
|
+
// This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
|
|
14436
14519
|
// and is kept as a safety fallback for edge cases.
|
|
14437
14520
|
// In browser builds, Rollup will tree-shake this code away because
|
|
14438
14521
|
// the condition above will always be true in browsers.
|
|
14439
14522
|
//
|
|
14440
|
-
// Note: This SDK requires Node.js >=
|
|
14441
|
-
// Node.js
|
|
14442
|
-
// In ESM mode, require is undefined, but since Node.js
|
|
14523
|
+
// Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
|
|
14524
|
+
// Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
|
|
14525
|
+
// In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
|
|
14443
14526
|
// this code path won't be reached in ESM mode with the minimum required version.
|
|
14444
14527
|
try {
|
|
14445
|
-
// Use dynamic require as a safety fallback (for Node.js <
|
|
14528
|
+
// Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
|
|
14446
14529
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14447
14530
|
const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
|
|
14448
14531
|
if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
|
|
@@ -14453,7 +14536,7 @@ function randomBytes(size) {
|
|
|
14453
14536
|
// Ignore require errors in browser environments or ESM mode
|
|
14454
14537
|
}
|
|
14455
14538
|
// 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
|
|
14539
|
+
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
14540
|
}
|
|
14458
14541
|
|
|
14459
14542
|
/**
|
|
@@ -15406,11 +15489,11 @@ var hasRequiredRetry$1;
|
|
|
15406
15489
|
function requireRetry$1 () {
|
|
15407
15490
|
if (hasRequiredRetry$1) return retry$2;
|
|
15408
15491
|
hasRequiredRetry$1 = 1;
|
|
15409
|
-
(function (exports
|
|
15492
|
+
(function (exports) {
|
|
15410
15493
|
var RetryOperation = requireRetry_operation();
|
|
15411
15494
|
|
|
15412
|
-
exports
|
|
15413
|
-
var timeouts = exports
|
|
15495
|
+
exports.operation = function(options) {
|
|
15496
|
+
var timeouts = exports.timeouts(options);
|
|
15414
15497
|
return new RetryOperation(timeouts, {
|
|
15415
15498
|
forever: options && (options.forever || options.retries === Infinity),
|
|
15416
15499
|
unref: options && options.unref,
|
|
@@ -15418,7 +15501,7 @@ function requireRetry$1 () {
|
|
|
15418
15501
|
});
|
|
15419
15502
|
};
|
|
15420
15503
|
|
|
15421
|
-
exports
|
|
15504
|
+
exports.timeouts = function(options) {
|
|
15422
15505
|
if (options instanceof Array) {
|
|
15423
15506
|
return [].concat(options);
|
|
15424
15507
|
}
|
|
@@ -15455,7 +15538,7 @@ function requireRetry$1 () {
|
|
|
15455
15538
|
return timeouts;
|
|
15456
15539
|
};
|
|
15457
15540
|
|
|
15458
|
-
exports
|
|
15541
|
+
exports.createTimeout = function(attempt, opts) {
|
|
15459
15542
|
var random = (opts.randomize)
|
|
15460
15543
|
? (Math.random() + 1)
|
|
15461
15544
|
: 1;
|
|
@@ -15466,7 +15549,7 @@ function requireRetry$1 () {
|
|
|
15466
15549
|
return timeout;
|
|
15467
15550
|
};
|
|
15468
15551
|
|
|
15469
|
-
exports
|
|
15552
|
+
exports.wrap = function(obj, options, methods) {
|
|
15470
15553
|
if (options instanceof Array) {
|
|
15471
15554
|
methods = options;
|
|
15472
15555
|
options = null;
|
|
@@ -15486,7 +15569,7 @@ function requireRetry$1 () {
|
|
|
15486
15569
|
var original = obj[method];
|
|
15487
15570
|
|
|
15488
15571
|
obj[method] = function retryWrapper(original) {
|
|
15489
|
-
var op = exports
|
|
15572
|
+
var op = exports.operation(options);
|
|
15490
15573
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
15491
15574
|
var callback = args.pop();
|
|
15492
15575
|
|
|
@@ -15579,7 +15662,7 @@ class JsonRpcError extends Error {
|
|
|
15579
15662
|
}
|
|
15580
15663
|
/**
|
|
15581
15664
|
* Makes a JSON-RPC request using native fetch API
|
|
15582
|
-
* Universal implementation that works in both Node.js (
|
|
15665
|
+
* Universal implementation that works in both Node.js (20.19+) and browser
|
|
15583
15666
|
*
|
|
15584
15667
|
* @param url - The URL to the JSON-RPC endpoint
|
|
15585
15668
|
* @param request - The JSON-RPC request object
|
|
@@ -15926,7 +16009,7 @@ function requireLong () {
|
|
|
15926
16009
|
if (value >= TWO_PWR_64_DBL)
|
|
15927
16010
|
return MAX_UNSIGNED_VALUE;
|
|
15928
16011
|
} else {
|
|
15929
|
-
if (value <= -
|
|
16012
|
+
if (value <= -9223372036854776e3)
|
|
15930
16013
|
return MIN_VALUE;
|
|
15931
16014
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
15932
16015
|
return MAX_VALUE;
|
|
@@ -20671,7 +20754,7 @@ function fromNumber(value, unsigned) {
|
|
|
20671
20754
|
if (value < 0) return UZERO;
|
|
20672
20755
|
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
20673
20756
|
} else {
|
|
20674
|
-
if (value <= -
|
|
20757
|
+
if (value <= -9223372036854776e3) return MIN_VALUE;
|
|
20675
20758
|
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
20676
20759
|
}
|
|
20677
20760
|
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
@@ -22750,6 +22833,25 @@ class Api extends events.EventEmitter {
|
|
|
22750
22833
|
jsonRpc(this.options.url, { method, params, id }, fetchMethod)
|
|
22751
22834
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
22752
22835
|
}
|
|
22836
|
+
/**
|
|
22837
|
+
* Promise-based version of call
|
|
22838
|
+
* Makes a JSON-RPC call to the Steem blockchain
|
|
22839
|
+
* @param method Method name (e.g., 'condenser_api.get_accounts')
|
|
22840
|
+
* @param params Parameters array for the method
|
|
22841
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
22842
|
+
*/
|
|
22843
|
+
callAsync(method, params) {
|
|
22844
|
+
return new Promise((resolve, reject) => {
|
|
22845
|
+
this.call(method, params, (err, result) => {
|
|
22846
|
+
if (err) {
|
|
22847
|
+
reject(err);
|
|
22848
|
+
}
|
|
22849
|
+
else {
|
|
22850
|
+
resolve(result);
|
|
22851
|
+
}
|
|
22852
|
+
});
|
|
22853
|
+
});
|
|
22854
|
+
}
|
|
22753
22855
|
signedCall(method, params, account, key, callback) {
|
|
22754
22856
|
if (this._transportType !== 'http') {
|
|
22755
22857
|
callback(new Error('RPC methods can only be called when using http transport'));
|
|
@@ -22768,6 +22870,27 @@ class Api extends events.EventEmitter {
|
|
|
22768
22870
|
jsonRpc(this.options.url, request, fetchMethod)
|
|
22769
22871
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
22770
22872
|
}
|
|
22873
|
+
/**
|
|
22874
|
+
* Promise-based version of signedCall
|
|
22875
|
+
* Makes an authenticated JSON-RPC call with cryptographic signature
|
|
22876
|
+
* @param method Method name (e.g., 'conveyor.is_email_registered')
|
|
22877
|
+
* @param params Parameters array for the method
|
|
22878
|
+
* @param account Account name to sign the request with
|
|
22879
|
+
* @param key Private key (WIF) to sign the request
|
|
22880
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
22881
|
+
*/
|
|
22882
|
+
signedCallAsync(method, params, account, key) {
|
|
22883
|
+
return new Promise((resolve, reject) => {
|
|
22884
|
+
this.signedCall(method, params, account, key, (err, result) => {
|
|
22885
|
+
if (err) {
|
|
22886
|
+
reject(err);
|
|
22887
|
+
}
|
|
22888
|
+
else {
|
|
22889
|
+
resolve(result);
|
|
22890
|
+
}
|
|
22891
|
+
});
|
|
22892
|
+
});
|
|
22893
|
+
}
|
|
22771
22894
|
/**
|
|
22772
22895
|
* Verify a signed RPC request
|
|
22773
22896
|
* @param signedRequest The signed request to verify
|
|
@@ -22830,6 +22953,24 @@ class Api extends events.EventEmitter {
|
|
|
22830
22953
|
.catch(error => callback(error instanceof Error ? error : new Error(String(error))));
|
|
22831
22954
|
}).catch(callback);
|
|
22832
22955
|
}
|
|
22956
|
+
/**
|
|
22957
|
+
* Promise-based version of verifySignedRequest
|
|
22958
|
+
* Verifies a signed RPC request
|
|
22959
|
+
* @param signedRequest The signed request to verify
|
|
22960
|
+
* @returns Promise that resolves with verification result or rejects with an error
|
|
22961
|
+
*/
|
|
22962
|
+
verifySignedRequestAsync(signedRequest) {
|
|
22963
|
+
return new Promise((resolve, reject) => {
|
|
22964
|
+
this.verifySignedRequest(signedRequest, (err, result) => {
|
|
22965
|
+
if (err) {
|
|
22966
|
+
reject(err);
|
|
22967
|
+
}
|
|
22968
|
+
else {
|
|
22969
|
+
resolve(result);
|
|
22970
|
+
}
|
|
22971
|
+
});
|
|
22972
|
+
});
|
|
22973
|
+
}
|
|
22833
22974
|
setOptions(options) {
|
|
22834
22975
|
Object.assign(this.options, options);
|
|
22835
22976
|
this._setLogger(options);
|
|
@@ -23004,6 +23145,24 @@ class Api extends events.EventEmitter {
|
|
|
23004
23145
|
}
|
|
23005
23146
|
this.broadcastTransactionSynchronous(trx, callback);
|
|
23006
23147
|
}
|
|
23148
|
+
/**
|
|
23149
|
+
* Promise-based version of broadcastTransactionSynchronousWith
|
|
23150
|
+
* Broadcasts a transaction synchronously
|
|
23151
|
+
* @param options Options object containing the transaction
|
|
23152
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23153
|
+
*/
|
|
23154
|
+
broadcastTransactionSynchronousWithAsync(options) {
|
|
23155
|
+
return new Promise((resolve, reject) => {
|
|
23156
|
+
this.broadcastTransactionSynchronousWith(options, (err, result) => {
|
|
23157
|
+
if (err) {
|
|
23158
|
+
reject(err);
|
|
23159
|
+
}
|
|
23160
|
+
else {
|
|
23161
|
+
resolve(result);
|
|
23162
|
+
}
|
|
23163
|
+
});
|
|
23164
|
+
});
|
|
23165
|
+
}
|
|
23007
23166
|
/**
|
|
23008
23167
|
* Broadcast a transaction to the blockchain.
|
|
23009
23168
|
* @param trx The transaction object
|
|
@@ -23023,6 +23182,24 @@ class Api extends events.EventEmitter {
|
|
|
23023
23182
|
callback(new Error('broadcastTransaction is not implemented'));
|
|
23024
23183
|
}
|
|
23025
23184
|
}
|
|
23185
|
+
/**
|
|
23186
|
+
* Promise-based version of broadcastTransaction
|
|
23187
|
+
* Broadcasts a transaction to the blockchain
|
|
23188
|
+
* @param trx The transaction object
|
|
23189
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23190
|
+
*/
|
|
23191
|
+
broadcastTransactionAsync(trx) {
|
|
23192
|
+
return new Promise((resolve, reject) => {
|
|
23193
|
+
this.broadcastTransaction(trx, (err, result) => {
|
|
23194
|
+
if (err) {
|
|
23195
|
+
reject(err);
|
|
23196
|
+
}
|
|
23197
|
+
else {
|
|
23198
|
+
resolve(result);
|
|
23199
|
+
}
|
|
23200
|
+
});
|
|
23201
|
+
});
|
|
23202
|
+
}
|
|
23026
23203
|
/**
|
|
23027
23204
|
* Sign a transaction with the provided private key(s).
|
|
23028
23205
|
* @param trx The transaction object
|
|
@@ -23071,6 +23248,25 @@ class Api extends events.EventEmitter {
|
|
|
23071
23248
|
params: [confirmationCallback, trx]
|
|
23072
23249
|
}, callback);
|
|
23073
23250
|
}
|
|
23251
|
+
/**
|
|
23252
|
+
* Promise-based version of broadcastTransactionWithCallback
|
|
23253
|
+
* Note: The confirmationCallback will still be called when the transaction is confirmed
|
|
23254
|
+
* @param confirmationCallback Callback function for transaction confirmation
|
|
23255
|
+
* @param trx Transaction object to broadcast
|
|
23256
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23257
|
+
*/
|
|
23258
|
+
broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
|
|
23259
|
+
return new Promise((resolve, reject) => {
|
|
23260
|
+
this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
|
|
23261
|
+
if (err) {
|
|
23262
|
+
reject(err);
|
|
23263
|
+
}
|
|
23264
|
+
else {
|
|
23265
|
+
resolve(result);
|
|
23266
|
+
}
|
|
23267
|
+
});
|
|
23268
|
+
});
|
|
23269
|
+
}
|
|
23074
23270
|
/**
|
|
23075
23271
|
* Broadcast a block to the network.
|
|
23076
23272
|
* @param block Block object to broadcast
|
|
@@ -23086,6 +23282,24 @@ class Api extends events.EventEmitter {
|
|
|
23086
23282
|
params: [block]
|
|
23087
23283
|
}, callback);
|
|
23088
23284
|
}
|
|
23285
|
+
/**
|
|
23286
|
+
* Promise-based version of broadcastBlock
|
|
23287
|
+
* Broadcasts a block to the network
|
|
23288
|
+
* @param block Block object to broadcast
|
|
23289
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23290
|
+
*/
|
|
23291
|
+
broadcastBlockAsync(block) {
|
|
23292
|
+
return new Promise((resolve, reject) => {
|
|
23293
|
+
this.broadcastBlock(block, (err, result) => {
|
|
23294
|
+
if (err) {
|
|
23295
|
+
reject(err);
|
|
23296
|
+
}
|
|
23297
|
+
else {
|
|
23298
|
+
resolve(result);
|
|
23299
|
+
}
|
|
23300
|
+
});
|
|
23301
|
+
});
|
|
23302
|
+
}
|
|
23089
23303
|
/**
|
|
23090
23304
|
* Set the maximum block age for transaction acceptance.
|
|
23091
23305
|
* @param maxBlockAge Maximum block age in seconds
|
|
@@ -23101,6 +23315,24 @@ class Api extends events.EventEmitter {
|
|
|
23101
23315
|
params: [maxBlockAge]
|
|
23102
23316
|
}, callback);
|
|
23103
23317
|
}
|
|
23318
|
+
/**
|
|
23319
|
+
* Promise-based version of setMaxBlockAge
|
|
23320
|
+
* Sets the maximum block age for transaction acceptance
|
|
23321
|
+
* @param maxBlockAge Maximum block age in seconds
|
|
23322
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23323
|
+
*/
|
|
23324
|
+
setMaxBlockAgeAsync(maxBlockAge) {
|
|
23325
|
+
return new Promise((resolve, reject) => {
|
|
23326
|
+
this.setMaxBlockAge(maxBlockAge, (err, result) => {
|
|
23327
|
+
if (err) {
|
|
23328
|
+
reject(err);
|
|
23329
|
+
}
|
|
23330
|
+
else {
|
|
23331
|
+
resolve(result);
|
|
23332
|
+
}
|
|
23333
|
+
});
|
|
23334
|
+
});
|
|
23335
|
+
}
|
|
23104
23336
|
/**
|
|
23105
23337
|
* Verify transaction authority.
|
|
23106
23338
|
* @param trx Transaction object to verify
|
|
@@ -25605,7 +25837,7 @@ const steem = {
|
|
|
25605
25837
|
operations,
|
|
25606
25838
|
serializer,
|
|
25607
25839
|
utils: utils$3,
|
|
25608
|
-
version: '1.0.
|
|
25840
|
+
version: '1.0.11',
|
|
25609
25841
|
config: {
|
|
25610
25842
|
set: (options) => {
|
|
25611
25843
|
// If nodes is provided, extract the first node as url for API
|
|
@@ -25652,6 +25884,8 @@ exports.hmacSha256 = hmacSha256;
|
|
|
25652
25884
|
exports.ripemd160 = ripemd160;
|
|
25653
25885
|
exports.sha256 = sha256;
|
|
25654
25886
|
exports.sign = sign;
|
|
25887
|
+
exports.signRequest = sign$2;
|
|
25655
25888
|
exports.steem = steem;
|
|
25889
|
+
exports.validateRequest = validate;
|
|
25656
25890
|
exports.verify = verify;
|
|
25657
25891
|
//# sourceMappingURL=index.cjs.map
|