@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.d.ts
CHANGED
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
|
|
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
|
|
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
|
|
3750
|
+
(function (exports) {
|
|
3751
3751
|
|
|
3752
|
-
var utils = exports
|
|
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
|
|
3817
|
+
(function (exports) {
|
|
3818
3818
|
|
|
3819
|
-
var utils = exports
|
|
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
|
|
6043
|
+
(function (exports) {
|
|
6044
6044
|
|
|
6045
|
-
var curve = exports
|
|
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
|
|
7350
|
-
var hash = exports
|
|
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
|
|
8163
|
+
(function (exports) {
|
|
8164
8164
|
|
|
8165
|
-
var curves = exports
|
|
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
|
|
9404
|
+
(function (exports) {
|
|
9405
9405
|
|
|
9406
|
-
var elliptic = exports
|
|
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
|
|
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
|
|
9476
|
+
exports.BN = BN;
|
|
9477
9477
|
}
|
|
9478
9478
|
|
|
9479
9479
|
BN.BN = BN;
|
|
@@ -14173,6 +14173,77 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
14173
14173
|
const finalS = s.gt(N_OVER_TWO) ? n.sub(s) : s;
|
|
14174
14174
|
return new ECSignature(r, finalS);
|
|
14175
14175
|
}
|
|
14176
|
+
/**
|
|
14177
|
+
* Recover a public key from a signature.
|
|
14178
|
+
*
|
|
14179
|
+
* See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
|
|
14180
|
+
* Key Recovery Operation".
|
|
14181
|
+
*
|
|
14182
|
+
* http://www.secg.org/download/aid-780/sec1-v2.pdf
|
|
14183
|
+
*/
|
|
14184
|
+
function recoverPubKey(curve, e, signature, i) {
|
|
14185
|
+
if ((i & 3) !== i) {
|
|
14186
|
+
throw new Error('Recovery param is more than two bits');
|
|
14187
|
+
}
|
|
14188
|
+
const n = new BN(curve.n.toString());
|
|
14189
|
+
const r = signature.r;
|
|
14190
|
+
const s = signature.s;
|
|
14191
|
+
if (r.isNeg() || r.isZero() || !r.lt(n))
|
|
14192
|
+
throw new Error('Invalid r value');
|
|
14193
|
+
if (s.isNeg() || s.isZero() || !s.lt(n))
|
|
14194
|
+
throw new Error('Invalid s value');
|
|
14195
|
+
// Try using elliptic's built-in recoverPubKey method
|
|
14196
|
+
// It expects: msg (Buffer), signature ({r: BN, s: BN}), j (recovery param)
|
|
14197
|
+
try {
|
|
14198
|
+
// Convert e (BN) to Buffer
|
|
14199
|
+
const msgBuffer = e.toArrayLike(Buffer, 'be', 32);
|
|
14200
|
+
// Create signature object compatible with elliptic's recoverPubKey
|
|
14201
|
+
// elliptic expects {r: BN, s: BN} format
|
|
14202
|
+
const sigObj = { r: r, s: s };
|
|
14203
|
+
// Use elliptic's built-in method
|
|
14204
|
+
const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
|
|
14205
|
+
return Q;
|
|
14206
|
+
}
|
|
14207
|
+
catch (error) {
|
|
14208
|
+
// Fallback to manual implementation if elliptic's method fails
|
|
14209
|
+
const G = curve.g;
|
|
14210
|
+
// A set LSB signifies that the y-coordinate is odd
|
|
14211
|
+
const isYOdd = !!(i & 1);
|
|
14212
|
+
// The more significant bit specifies whether we should use the
|
|
14213
|
+
// first or second candidate key.
|
|
14214
|
+
const isSecondKey = i >> 1;
|
|
14215
|
+
// 1.1 Let x = r + jn
|
|
14216
|
+
const x = isSecondKey ? r.add(n) : r;
|
|
14217
|
+
// pointFromX expects a hex string (not BN object)
|
|
14218
|
+
// Convert BN to hex string and ensure proper padding
|
|
14219
|
+
const xHex = x.toString(16);
|
|
14220
|
+
// Ensure hex string is properly padded to 64 characters (32 bytes)
|
|
14221
|
+
const xHexPadded = xHex.padStart(64, '0');
|
|
14222
|
+
// pointFromX may also accept a Buffer, but hex string is more reliable
|
|
14223
|
+
let R;
|
|
14224
|
+
try {
|
|
14225
|
+
R = curve.curve.pointFromX(xHexPadded, isYOdd);
|
|
14226
|
+
}
|
|
14227
|
+
catch (error) {
|
|
14228
|
+
// If hex string fails, try with Buffer
|
|
14229
|
+
const xBuffer = x.toArrayLike(Buffer, 'be', 32);
|
|
14230
|
+
R = curve.curve.pointFromX(xBuffer, isYOdd);
|
|
14231
|
+
}
|
|
14232
|
+
// 1.4 Check that nR is at infinity
|
|
14233
|
+
const nR = R.mul(n);
|
|
14234
|
+
if (!nR.isInfinity())
|
|
14235
|
+
throw new Error('nR is not a valid curve point');
|
|
14236
|
+
// Compute -e from e
|
|
14237
|
+
const eNeg = e.neg().mod(n);
|
|
14238
|
+
// 1.6.1 Compute Q = r^-1 (sR - eG)
|
|
14239
|
+
// Q = r^-1 (sR + -eG)
|
|
14240
|
+
const rInv = r.invm(n);
|
|
14241
|
+
const sR = R.mul(s);
|
|
14242
|
+
const eGNeg = G.mul(eNeg);
|
|
14243
|
+
const Q = sR.add(eGNeg).mul(rInv);
|
|
14244
|
+
return Q;
|
|
14245
|
+
}
|
|
14246
|
+
}
|
|
14176
14247
|
/**
|
|
14177
14248
|
* Calculate pubkey extraction parameter.
|
|
14178
14249
|
*
|
|
@@ -14187,11 +14258,15 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
14187
14258
|
function calcPubKeyRecoveryParam(curve, e, signature, Q) {
|
|
14188
14259
|
for (let i = 0; i < 4; i++) {
|
|
14189
14260
|
try {
|
|
14190
|
-
// Use
|
|
14191
|
-
const Qprime =
|
|
14261
|
+
// Use our own recoverPubKey function instead of curve.recoverPubKey
|
|
14262
|
+
const Qprime = recoverPubKey(curve, e, signature, i);
|
|
14192
14263
|
// 1.6.2 Verify Q = Q'
|
|
14193
|
-
// Compare points by checking
|
|
14194
|
-
|
|
14264
|
+
// Compare points by checking coordinates (more reliable than eq method)
|
|
14265
|
+
const Qx = Q.getX().toString(16);
|
|
14266
|
+
const Qy = Q.getY().toString(16);
|
|
14267
|
+
const QprimeX = Qprime.getX().toString(16);
|
|
14268
|
+
const QprimeY = Qprime.getY().toString(16);
|
|
14269
|
+
if (Qx === QprimeX && Qy === QprimeY) {
|
|
14195
14270
|
return i;
|
|
14196
14271
|
}
|
|
14197
14272
|
}
|
|
@@ -14225,7 +14300,13 @@ class Signature {
|
|
|
14225
14300
|
throw new Error('Invalid signature length');
|
|
14226
14301
|
}
|
|
14227
14302
|
const i = buffer.readUInt8(0);
|
|
14228
|
-
|
|
14303
|
+
// Support both formats: 27-30 (old/legacy) and 31-34 (dsteem compatible)
|
|
14304
|
+
// Check if it's in the old format (27-30) or new format (31-34)
|
|
14305
|
+
const recoveryOld = i - 27;
|
|
14306
|
+
const recoveryNew = i - 31;
|
|
14307
|
+
const isValidOld = recoveryOld >= 0 && recoveryOld <= 3 && (recoveryOld === (recoveryOld & 7));
|
|
14308
|
+
const isValidNew = recoveryNew >= 0 && recoveryNew <= 3 && (recoveryNew === (recoveryNew & 7));
|
|
14309
|
+
if (!isValidOld && !isValidNew) {
|
|
14229
14310
|
throw new Error('Invalid signature parameter');
|
|
14230
14311
|
}
|
|
14231
14312
|
const r = new BN(buffer.slice(1, 33));
|
|
@@ -14274,7 +14355,9 @@ class Signature {
|
|
|
14274
14355
|
}
|
|
14275
14356
|
}
|
|
14276
14357
|
const i = calcPubKeyRecoveryParam(secp256k1, new BN(buf_sha256), ecsignature, privKey.toPublic().Q);
|
|
14277
|
-
|
|
14358
|
+
// Use recovery byte 31-34 (instead of 27-30) to be compatible with dsteem
|
|
14359
|
+
// dsteem expects: recovery = byte - 31, so byte = recovery + 31
|
|
14360
|
+
return new Signature(ecsignature.r, ecsignature.s, i + 31);
|
|
14278
14361
|
}
|
|
14279
14362
|
static isCanonical(r, s) {
|
|
14280
14363
|
// See libraries/fc/src/crypto/elliptic_common.cpp is_fc_canonical
|
|
@@ -14405,24 +14488,24 @@ class Address {
|
|
|
14405
14488
|
* @returns Buffer with random bytes
|
|
14406
14489
|
*/
|
|
14407
14490
|
function randomBytes(size) {
|
|
14408
|
-
// Always try Web Crypto API first (works in both browser and Node.js
|
|
14491
|
+
// Always try Web Crypto API first (works in both browser and Node.js 20.19+)
|
|
14409
14492
|
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
14410
14493
|
const array = new Uint8Array(size);
|
|
14411
14494
|
crypto.getRandomValues(array);
|
|
14412
14495
|
return Buffer.from(array);
|
|
14413
14496
|
}
|
|
14414
14497
|
// Fallback to Node.js crypto only if Web Crypto API is not available
|
|
14415
|
-
// This code path should not be reached in Node.js
|
|
14498
|
+
// This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
|
|
14416
14499
|
// and is kept as a safety fallback for edge cases.
|
|
14417
14500
|
// In browser builds, Rollup will tree-shake this code away because
|
|
14418
14501
|
// the condition above will always be true in browsers.
|
|
14419
14502
|
//
|
|
14420
|
-
// Note: This SDK requires Node.js >=
|
|
14421
|
-
// Node.js
|
|
14422
|
-
// In ESM mode, require is undefined, but since Node.js
|
|
14503
|
+
// Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
|
|
14504
|
+
// Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
|
|
14505
|
+
// In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
|
|
14423
14506
|
// this code path won't be reached in ESM mode with the minimum required version.
|
|
14424
14507
|
try {
|
|
14425
|
-
// Use dynamic require as a safety fallback (for Node.js <
|
|
14508
|
+
// Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
|
|
14426
14509
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14427
14510
|
const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
|
|
14428
14511
|
if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
|
|
@@ -14433,7 +14516,7 @@ function randomBytes(size) {
|
|
|
14433
14516
|
// Ignore require errors in browser environments or ESM mode
|
|
14434
14517
|
}
|
|
14435
14518
|
// 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
|
|
14519
|
+
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
14520
|
}
|
|
14438
14521
|
|
|
14439
14522
|
/**
|
|
@@ -15386,11 +15469,11 @@ var hasRequiredRetry$1;
|
|
|
15386
15469
|
function requireRetry$1 () {
|
|
15387
15470
|
if (hasRequiredRetry$1) return retry$2;
|
|
15388
15471
|
hasRequiredRetry$1 = 1;
|
|
15389
|
-
(function (exports
|
|
15472
|
+
(function (exports) {
|
|
15390
15473
|
var RetryOperation = requireRetry_operation();
|
|
15391
15474
|
|
|
15392
|
-
exports
|
|
15393
|
-
var timeouts = exports
|
|
15475
|
+
exports.operation = function(options) {
|
|
15476
|
+
var timeouts = exports.timeouts(options);
|
|
15394
15477
|
return new RetryOperation(timeouts, {
|
|
15395
15478
|
forever: options && (options.forever || options.retries === Infinity),
|
|
15396
15479
|
unref: options && options.unref,
|
|
@@ -15398,7 +15481,7 @@ function requireRetry$1 () {
|
|
|
15398
15481
|
});
|
|
15399
15482
|
};
|
|
15400
15483
|
|
|
15401
|
-
exports
|
|
15484
|
+
exports.timeouts = function(options) {
|
|
15402
15485
|
if (options instanceof Array) {
|
|
15403
15486
|
return [].concat(options);
|
|
15404
15487
|
}
|
|
@@ -15435,7 +15518,7 @@ function requireRetry$1 () {
|
|
|
15435
15518
|
return timeouts;
|
|
15436
15519
|
};
|
|
15437
15520
|
|
|
15438
|
-
exports
|
|
15521
|
+
exports.createTimeout = function(attempt, opts) {
|
|
15439
15522
|
var random = (opts.randomize)
|
|
15440
15523
|
? (Math.random() + 1)
|
|
15441
15524
|
: 1;
|
|
@@ -15446,7 +15529,7 @@ function requireRetry$1 () {
|
|
|
15446
15529
|
return timeout;
|
|
15447
15530
|
};
|
|
15448
15531
|
|
|
15449
|
-
exports
|
|
15532
|
+
exports.wrap = function(obj, options, methods) {
|
|
15450
15533
|
if (options instanceof Array) {
|
|
15451
15534
|
methods = options;
|
|
15452
15535
|
options = null;
|
|
@@ -15466,7 +15549,7 @@ function requireRetry$1 () {
|
|
|
15466
15549
|
var original = obj[method];
|
|
15467
15550
|
|
|
15468
15551
|
obj[method] = function retryWrapper(original) {
|
|
15469
|
-
var op = exports
|
|
15552
|
+
var op = exports.operation(options);
|
|
15470
15553
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
15471
15554
|
var callback = args.pop();
|
|
15472
15555
|
|
|
@@ -15559,7 +15642,7 @@ class JsonRpcError extends Error {
|
|
|
15559
15642
|
}
|
|
15560
15643
|
/**
|
|
15561
15644
|
* Makes a JSON-RPC request using native fetch API
|
|
15562
|
-
* Universal implementation that works in both Node.js (
|
|
15645
|
+
* Universal implementation that works in both Node.js (20.19+) and browser
|
|
15563
15646
|
*
|
|
15564
15647
|
* @param url - The URL to the JSON-RPC endpoint
|
|
15565
15648
|
* @param request - The JSON-RPC request object
|
|
@@ -15906,7 +15989,7 @@ function requireLong () {
|
|
|
15906
15989
|
if (value >= TWO_PWR_64_DBL)
|
|
15907
15990
|
return MAX_UNSIGNED_VALUE;
|
|
15908
15991
|
} else {
|
|
15909
|
-
if (value <= -
|
|
15992
|
+
if (value <= -9223372036854776e3)
|
|
15910
15993
|
return MIN_VALUE;
|
|
15911
15994
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
15912
15995
|
return MAX_VALUE;
|
|
@@ -20651,7 +20734,7 @@ function fromNumber(value, unsigned) {
|
|
|
20651
20734
|
if (value < 0) return UZERO;
|
|
20652
20735
|
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
20653
20736
|
} else {
|
|
20654
|
-
if (value <= -
|
|
20737
|
+
if (value <= -9223372036854776e3) return MIN_VALUE;
|
|
20655
20738
|
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
20656
20739
|
}
|
|
20657
20740
|
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
@@ -22730,6 +22813,25 @@ class Api extends EventEmitter {
|
|
|
22730
22813
|
jsonRpc(this.options.url, { method, params, id }, fetchMethod)
|
|
22731
22814
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
22732
22815
|
}
|
|
22816
|
+
/**
|
|
22817
|
+
* Promise-based version of call
|
|
22818
|
+
* Makes a JSON-RPC call to the Steem blockchain
|
|
22819
|
+
* @param method Method name (e.g., 'condenser_api.get_accounts')
|
|
22820
|
+
* @param params Parameters array for the method
|
|
22821
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
22822
|
+
*/
|
|
22823
|
+
callAsync(method, params) {
|
|
22824
|
+
return new Promise((resolve, reject) => {
|
|
22825
|
+
this.call(method, params, (err, result) => {
|
|
22826
|
+
if (err) {
|
|
22827
|
+
reject(err);
|
|
22828
|
+
}
|
|
22829
|
+
else {
|
|
22830
|
+
resolve(result);
|
|
22831
|
+
}
|
|
22832
|
+
});
|
|
22833
|
+
});
|
|
22834
|
+
}
|
|
22733
22835
|
signedCall(method, params, account, key, callback) {
|
|
22734
22836
|
if (this._transportType !== 'http') {
|
|
22735
22837
|
callback(new Error('RPC methods can only be called when using http transport'));
|
|
@@ -22748,6 +22850,27 @@ class Api extends EventEmitter {
|
|
|
22748
22850
|
jsonRpc(this.options.url, request, fetchMethod)
|
|
22749
22851
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
22750
22852
|
}
|
|
22853
|
+
/**
|
|
22854
|
+
* Promise-based version of signedCall
|
|
22855
|
+
* Makes an authenticated JSON-RPC call with cryptographic signature
|
|
22856
|
+
* @param method Method name (e.g., 'conveyor.is_email_registered')
|
|
22857
|
+
* @param params Parameters array for the method
|
|
22858
|
+
* @param account Account name to sign the request with
|
|
22859
|
+
* @param key Private key (WIF) to sign the request
|
|
22860
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
22861
|
+
*/
|
|
22862
|
+
signedCallAsync(method, params, account, key) {
|
|
22863
|
+
return new Promise((resolve, reject) => {
|
|
22864
|
+
this.signedCall(method, params, account, key, (err, result) => {
|
|
22865
|
+
if (err) {
|
|
22866
|
+
reject(err);
|
|
22867
|
+
}
|
|
22868
|
+
else {
|
|
22869
|
+
resolve(result);
|
|
22870
|
+
}
|
|
22871
|
+
});
|
|
22872
|
+
});
|
|
22873
|
+
}
|
|
22751
22874
|
/**
|
|
22752
22875
|
* Verify a signed RPC request
|
|
22753
22876
|
* @param signedRequest The signed request to verify
|
|
@@ -22810,6 +22933,24 @@ class Api extends EventEmitter {
|
|
|
22810
22933
|
.catch(error => callback(error instanceof Error ? error : new Error(String(error))));
|
|
22811
22934
|
}).catch(callback);
|
|
22812
22935
|
}
|
|
22936
|
+
/**
|
|
22937
|
+
* Promise-based version of verifySignedRequest
|
|
22938
|
+
* Verifies a signed RPC request
|
|
22939
|
+
* @param signedRequest The signed request to verify
|
|
22940
|
+
* @returns Promise that resolves with verification result or rejects with an error
|
|
22941
|
+
*/
|
|
22942
|
+
verifySignedRequestAsync(signedRequest) {
|
|
22943
|
+
return new Promise((resolve, reject) => {
|
|
22944
|
+
this.verifySignedRequest(signedRequest, (err, result) => {
|
|
22945
|
+
if (err) {
|
|
22946
|
+
reject(err);
|
|
22947
|
+
}
|
|
22948
|
+
else {
|
|
22949
|
+
resolve(result);
|
|
22950
|
+
}
|
|
22951
|
+
});
|
|
22952
|
+
});
|
|
22953
|
+
}
|
|
22813
22954
|
setOptions(options) {
|
|
22814
22955
|
Object.assign(this.options, options);
|
|
22815
22956
|
this._setLogger(options);
|
|
@@ -22984,6 +23125,24 @@ class Api extends EventEmitter {
|
|
|
22984
23125
|
}
|
|
22985
23126
|
this.broadcastTransactionSynchronous(trx, callback);
|
|
22986
23127
|
}
|
|
23128
|
+
/**
|
|
23129
|
+
* Promise-based version of broadcastTransactionSynchronousWith
|
|
23130
|
+
* Broadcasts a transaction synchronously
|
|
23131
|
+
* @param options Options object containing the transaction
|
|
23132
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23133
|
+
*/
|
|
23134
|
+
broadcastTransactionSynchronousWithAsync(options) {
|
|
23135
|
+
return new Promise((resolve, reject) => {
|
|
23136
|
+
this.broadcastTransactionSynchronousWith(options, (err, result) => {
|
|
23137
|
+
if (err) {
|
|
23138
|
+
reject(err);
|
|
23139
|
+
}
|
|
23140
|
+
else {
|
|
23141
|
+
resolve(result);
|
|
23142
|
+
}
|
|
23143
|
+
});
|
|
23144
|
+
});
|
|
23145
|
+
}
|
|
22987
23146
|
/**
|
|
22988
23147
|
* Broadcast a transaction to the blockchain.
|
|
22989
23148
|
* @param trx The transaction object
|
|
@@ -23003,6 +23162,24 @@ class Api extends EventEmitter {
|
|
|
23003
23162
|
callback(new Error('broadcastTransaction is not implemented'));
|
|
23004
23163
|
}
|
|
23005
23164
|
}
|
|
23165
|
+
/**
|
|
23166
|
+
* Promise-based version of broadcastTransaction
|
|
23167
|
+
* Broadcasts a transaction to the blockchain
|
|
23168
|
+
* @param trx The transaction object
|
|
23169
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23170
|
+
*/
|
|
23171
|
+
broadcastTransactionAsync(trx) {
|
|
23172
|
+
return new Promise((resolve, reject) => {
|
|
23173
|
+
this.broadcastTransaction(trx, (err, result) => {
|
|
23174
|
+
if (err) {
|
|
23175
|
+
reject(err);
|
|
23176
|
+
}
|
|
23177
|
+
else {
|
|
23178
|
+
resolve(result);
|
|
23179
|
+
}
|
|
23180
|
+
});
|
|
23181
|
+
});
|
|
23182
|
+
}
|
|
23006
23183
|
/**
|
|
23007
23184
|
* Sign a transaction with the provided private key(s).
|
|
23008
23185
|
* @param trx The transaction object
|
|
@@ -23051,6 +23228,25 @@ class Api extends EventEmitter {
|
|
|
23051
23228
|
params: [confirmationCallback, trx]
|
|
23052
23229
|
}, callback);
|
|
23053
23230
|
}
|
|
23231
|
+
/**
|
|
23232
|
+
* Promise-based version of broadcastTransactionWithCallback
|
|
23233
|
+
* Note: The confirmationCallback will still be called when the transaction is confirmed
|
|
23234
|
+
* @param confirmationCallback Callback function for transaction confirmation
|
|
23235
|
+
* @param trx Transaction object to broadcast
|
|
23236
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23237
|
+
*/
|
|
23238
|
+
broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
|
|
23239
|
+
return new Promise((resolve, reject) => {
|
|
23240
|
+
this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
|
|
23241
|
+
if (err) {
|
|
23242
|
+
reject(err);
|
|
23243
|
+
}
|
|
23244
|
+
else {
|
|
23245
|
+
resolve(result);
|
|
23246
|
+
}
|
|
23247
|
+
});
|
|
23248
|
+
});
|
|
23249
|
+
}
|
|
23054
23250
|
/**
|
|
23055
23251
|
* Broadcast a block to the network.
|
|
23056
23252
|
* @param block Block object to broadcast
|
|
@@ -23066,6 +23262,24 @@ class Api extends EventEmitter {
|
|
|
23066
23262
|
params: [block]
|
|
23067
23263
|
}, callback);
|
|
23068
23264
|
}
|
|
23265
|
+
/**
|
|
23266
|
+
* Promise-based version of broadcastBlock
|
|
23267
|
+
* Broadcasts a block to the network
|
|
23268
|
+
* @param block Block object to broadcast
|
|
23269
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23270
|
+
*/
|
|
23271
|
+
broadcastBlockAsync(block) {
|
|
23272
|
+
return new Promise((resolve, reject) => {
|
|
23273
|
+
this.broadcastBlock(block, (err, result) => {
|
|
23274
|
+
if (err) {
|
|
23275
|
+
reject(err);
|
|
23276
|
+
}
|
|
23277
|
+
else {
|
|
23278
|
+
resolve(result);
|
|
23279
|
+
}
|
|
23280
|
+
});
|
|
23281
|
+
});
|
|
23282
|
+
}
|
|
23069
23283
|
/**
|
|
23070
23284
|
* Set the maximum block age for transaction acceptance.
|
|
23071
23285
|
* @param maxBlockAge Maximum block age in seconds
|
|
@@ -23081,6 +23295,24 @@ class Api extends EventEmitter {
|
|
|
23081
23295
|
params: [maxBlockAge]
|
|
23082
23296
|
}, callback);
|
|
23083
23297
|
}
|
|
23298
|
+
/**
|
|
23299
|
+
* Promise-based version of setMaxBlockAge
|
|
23300
|
+
* Sets the maximum block age for transaction acceptance
|
|
23301
|
+
* @param maxBlockAge Maximum block age in seconds
|
|
23302
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
23303
|
+
*/
|
|
23304
|
+
setMaxBlockAgeAsync(maxBlockAge) {
|
|
23305
|
+
return new Promise((resolve, reject) => {
|
|
23306
|
+
this.setMaxBlockAge(maxBlockAge, (err, result) => {
|
|
23307
|
+
if (err) {
|
|
23308
|
+
reject(err);
|
|
23309
|
+
}
|
|
23310
|
+
else {
|
|
23311
|
+
resolve(result);
|
|
23312
|
+
}
|
|
23313
|
+
});
|
|
23314
|
+
});
|
|
23315
|
+
}
|
|
23084
23316
|
/**
|
|
23085
23317
|
* Verify transaction authority.
|
|
23086
23318
|
* @param trx Transaction object to verify
|
|
@@ -25585,7 +25817,7 @@ const steem = {
|
|
|
25585
25817
|
operations,
|
|
25586
25818
|
serializer,
|
|
25587
25819
|
utils: utils$3,
|
|
25588
|
-
version: '1.0.
|
|
25820
|
+
version: '1.0.11',
|
|
25589
25821
|
config: {
|
|
25590
25822
|
set: (options) => {
|
|
25591
25823
|
// If nodes is provided, extract the first node as url for API
|
|
@@ -25625,5 +25857,5 @@ if (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {
|
|
|
25625
25857
|
}
|
|
25626
25858
|
}
|
|
25627
25859
|
|
|
25628
|
-
export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
|
|
25860
|
+
export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, sign$2 as signRequest, steem, validate as validateRequest, verify };
|
|
25629
25861
|
//# sourceMappingURL=index.js.map
|