@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/browser.esm.js
CHANGED
|
@@ -1202,7 +1202,7 @@ var hasRequiredBuffer;
|
|
|
1202
1202
|
function requireBuffer () {
|
|
1203
1203
|
if (hasRequiredBuffer) return buffer;
|
|
1204
1204
|
hasRequiredBuffer = 1;
|
|
1205
|
-
(function (exports
|
|
1205
|
+
(function (exports) {
|
|
1206
1206
|
|
|
1207
1207
|
const base64 = requireBase64Js();
|
|
1208
1208
|
const ieee754 = requireIeee754();
|
|
@@ -1211,12 +1211,12 @@ function requireBuffer () {
|
|
|
1211
1211
|
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
1212
1212
|
: null;
|
|
1213
1213
|
|
|
1214
|
-
exports
|
|
1215
|
-
exports
|
|
1216
|
-
exports
|
|
1214
|
+
exports.Buffer = Buffer;
|
|
1215
|
+
exports.SlowBuffer = SlowBuffer;
|
|
1216
|
+
exports.INSPECT_MAX_BYTES = 50;
|
|
1217
1217
|
|
|
1218
1218
|
const K_MAX_LENGTH = 0x7fffffff;
|
|
1219
|
-
exports
|
|
1219
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
|
1220
1220
|
|
|
1221
1221
|
/**
|
|
1222
1222
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
@@ -1812,7 +1812,7 @@ function requireBuffer () {
|
|
|
1812
1812
|
|
|
1813
1813
|
Buffer.prototype.inspect = function inspect () {
|
|
1814
1814
|
let str = '';
|
|
1815
|
-
const max = exports
|
|
1815
|
+
const max = exports.INSPECT_MAX_BYTES;
|
|
1816
1816
|
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
|
|
1817
1817
|
if (this.length > max) str += ' ... ';
|
|
1818
1818
|
return '<Buffer ' + str + '>'
|
|
@@ -3331,7 +3331,7 @@ function requireBn$1 () {
|
|
|
3331
3331
|
if (hasRequiredBn$1) return bn$1.exports;
|
|
3332
3332
|
hasRequiredBn$1 = 1;
|
|
3333
3333
|
(function (module) {
|
|
3334
|
-
(function (module, exports
|
|
3334
|
+
(function (module, exports) {
|
|
3335
3335
|
|
|
3336
3336
|
// Utils
|
|
3337
3337
|
function assert (val, msg) {
|
|
@@ -3374,7 +3374,7 @@ function requireBn$1 () {
|
|
|
3374
3374
|
if (typeof module === 'object') {
|
|
3375
3375
|
module.exports = BN;
|
|
3376
3376
|
} else {
|
|
3377
|
-
exports
|
|
3377
|
+
exports.BN = BN;
|
|
3378
3378
|
}
|
|
3379
3379
|
|
|
3380
3380
|
BN.BN = BN;
|
|
@@ -6806,9 +6806,9 @@ var hasRequiredUtils$2;
|
|
|
6806
6806
|
function requireUtils$2 () {
|
|
6807
6807
|
if (hasRequiredUtils$2) return utils$1;
|
|
6808
6808
|
hasRequiredUtils$2 = 1;
|
|
6809
|
-
(function (exports
|
|
6809
|
+
(function (exports) {
|
|
6810
6810
|
|
|
6811
|
-
var utils = exports
|
|
6811
|
+
var utils = exports;
|
|
6812
6812
|
|
|
6813
6813
|
function toArray(msg, enc) {
|
|
6814
6814
|
if (Array.isArray(msg))
|
|
@@ -6873,9 +6873,9 @@ var hasRequiredUtils$1;
|
|
|
6873
6873
|
function requireUtils$1 () {
|
|
6874
6874
|
if (hasRequiredUtils$1) return utils$2;
|
|
6875
6875
|
hasRequiredUtils$1 = 1;
|
|
6876
|
-
(function (exports
|
|
6876
|
+
(function (exports) {
|
|
6877
6877
|
|
|
6878
|
-
var utils = exports
|
|
6878
|
+
var utils = exports;
|
|
6879
6879
|
var BN = requireBn$1();
|
|
6880
6880
|
var minAssert = requireMinimalisticAssert();
|
|
6881
6881
|
var minUtils = requireUtils$2();
|
|
@@ -9080,9 +9080,9 @@ var hasRequiredCurve;
|
|
|
9080
9080
|
function requireCurve () {
|
|
9081
9081
|
if (hasRequiredCurve) return curve;
|
|
9082
9082
|
hasRequiredCurve = 1;
|
|
9083
|
-
(function (exports
|
|
9083
|
+
(function (exports) {
|
|
9084
9084
|
|
|
9085
|
-
var curve = exports
|
|
9085
|
+
var curve = exports;
|
|
9086
9086
|
|
|
9087
9087
|
curve.base = requireBase();
|
|
9088
9088
|
curve.short = requireShort();
|
|
@@ -10386,8 +10386,8 @@ var hasRequiredHash;
|
|
|
10386
10386
|
function requireHash () {
|
|
10387
10387
|
if (hasRequiredHash) return hash;
|
|
10388
10388
|
hasRequiredHash = 1;
|
|
10389
|
-
(function (exports
|
|
10390
|
-
var hash = exports
|
|
10389
|
+
(function (exports) {
|
|
10390
|
+
var hash = exports;
|
|
10391
10391
|
|
|
10392
10392
|
hash.utils = requireUtils();
|
|
10393
10393
|
hash.common = requireCommon$1();
|
|
@@ -11200,9 +11200,9 @@ var hasRequiredCurves;
|
|
|
11200
11200
|
function requireCurves () {
|
|
11201
11201
|
if (hasRequiredCurves) return curves;
|
|
11202
11202
|
hasRequiredCurves = 1;
|
|
11203
|
-
(function (exports
|
|
11203
|
+
(function (exports) {
|
|
11204
11204
|
|
|
11205
|
-
var curves = exports
|
|
11205
|
+
var curves = exports;
|
|
11206
11206
|
|
|
11207
11207
|
var hash = requireHash();
|
|
11208
11208
|
var curve = requireCurve();
|
|
@@ -12441,9 +12441,9 @@ var hasRequiredElliptic;
|
|
|
12441
12441
|
function requireElliptic () {
|
|
12442
12442
|
if (hasRequiredElliptic) return elliptic;
|
|
12443
12443
|
hasRequiredElliptic = 1;
|
|
12444
|
-
(function (exports
|
|
12444
|
+
(function (exports) {
|
|
12445
12445
|
|
|
12446
|
-
var elliptic = exports
|
|
12446
|
+
var elliptic = exports;
|
|
12447
12447
|
|
|
12448
12448
|
elliptic.version = require$$0$1.version;
|
|
12449
12449
|
elliptic.utils = requireUtils$1();
|
|
@@ -12470,7 +12470,7 @@ function requireBn () {
|
|
|
12470
12470
|
if (hasRequiredBn) return bn.exports;
|
|
12471
12471
|
hasRequiredBn = 1;
|
|
12472
12472
|
(function (module) {
|
|
12473
|
-
(function (module, exports
|
|
12473
|
+
(function (module, exports) {
|
|
12474
12474
|
|
|
12475
12475
|
// Utils
|
|
12476
12476
|
function assert (val, msg) {
|
|
@@ -12513,7 +12513,7 @@ function requireBn () {
|
|
|
12513
12513
|
if (typeof module === 'object') {
|
|
12514
12514
|
module.exports = BN;
|
|
12515
12515
|
} else {
|
|
12516
|
-
exports
|
|
12516
|
+
exports.BN = BN;
|
|
12517
12517
|
}
|
|
12518
12518
|
|
|
12519
12519
|
BN.BN = BN;
|
|
@@ -17213,6 +17213,77 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
17213
17213
|
const finalS = s.gt(N_OVER_TWO) ? n.sub(s) : s;
|
|
17214
17214
|
return new ECSignature(r, finalS);
|
|
17215
17215
|
}
|
|
17216
|
+
/**
|
|
17217
|
+
* Recover a public key from a signature.
|
|
17218
|
+
*
|
|
17219
|
+
* See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
|
|
17220
|
+
* Key Recovery Operation".
|
|
17221
|
+
*
|
|
17222
|
+
* http://www.secg.org/download/aid-780/sec1-v2.pdf
|
|
17223
|
+
*/
|
|
17224
|
+
function recoverPubKey(curve, e, signature, i) {
|
|
17225
|
+
if ((i & 3) !== i) {
|
|
17226
|
+
throw new Error('Recovery param is more than two bits');
|
|
17227
|
+
}
|
|
17228
|
+
const n = new BN(curve.n.toString());
|
|
17229
|
+
const r = signature.r;
|
|
17230
|
+
const s = signature.s;
|
|
17231
|
+
if (r.isNeg() || r.isZero() || !r.lt(n))
|
|
17232
|
+
throw new Error('Invalid r value');
|
|
17233
|
+
if (s.isNeg() || s.isZero() || !s.lt(n))
|
|
17234
|
+
throw new Error('Invalid s value');
|
|
17235
|
+
// Try using elliptic's built-in recoverPubKey method
|
|
17236
|
+
// It expects: msg (Buffer), signature ({r: BN, s: BN}), j (recovery param)
|
|
17237
|
+
try {
|
|
17238
|
+
// Convert e (BN) to Buffer
|
|
17239
|
+
const msgBuffer = e.toArrayLike(bufferExports.Buffer, 'be', 32);
|
|
17240
|
+
// Create signature object compatible with elliptic's recoverPubKey
|
|
17241
|
+
// elliptic expects {r: BN, s: BN} format
|
|
17242
|
+
const sigObj = { r: r, s: s };
|
|
17243
|
+
// Use elliptic's built-in method
|
|
17244
|
+
const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
|
|
17245
|
+
return Q;
|
|
17246
|
+
}
|
|
17247
|
+
catch (error) {
|
|
17248
|
+
// Fallback to manual implementation if elliptic's method fails
|
|
17249
|
+
const G = curve.g;
|
|
17250
|
+
// A set LSB signifies that the y-coordinate is odd
|
|
17251
|
+
const isYOdd = !!(i & 1);
|
|
17252
|
+
// The more significant bit specifies whether we should use the
|
|
17253
|
+
// first or second candidate key.
|
|
17254
|
+
const isSecondKey = i >> 1;
|
|
17255
|
+
// 1.1 Let x = r + jn
|
|
17256
|
+
const x = isSecondKey ? r.add(n) : r;
|
|
17257
|
+
// pointFromX expects a hex string (not BN object)
|
|
17258
|
+
// Convert BN to hex string and ensure proper padding
|
|
17259
|
+
const xHex = x.toString(16);
|
|
17260
|
+
// Ensure hex string is properly padded to 64 characters (32 bytes)
|
|
17261
|
+
const xHexPadded = xHex.padStart(64, '0');
|
|
17262
|
+
// pointFromX may also accept a Buffer, but hex string is more reliable
|
|
17263
|
+
let R;
|
|
17264
|
+
try {
|
|
17265
|
+
R = curve.curve.pointFromX(xHexPadded, isYOdd);
|
|
17266
|
+
}
|
|
17267
|
+
catch (error) {
|
|
17268
|
+
// If hex string fails, try with Buffer
|
|
17269
|
+
const xBuffer = x.toArrayLike(bufferExports.Buffer, 'be', 32);
|
|
17270
|
+
R = curve.curve.pointFromX(xBuffer, isYOdd);
|
|
17271
|
+
}
|
|
17272
|
+
// 1.4 Check that nR is at infinity
|
|
17273
|
+
const nR = R.mul(n);
|
|
17274
|
+
if (!nR.isInfinity())
|
|
17275
|
+
throw new Error('nR is not a valid curve point');
|
|
17276
|
+
// Compute -e from e
|
|
17277
|
+
const eNeg = e.neg().mod(n);
|
|
17278
|
+
// 1.6.1 Compute Q = r^-1 (sR - eG)
|
|
17279
|
+
// Q = r^-1 (sR + -eG)
|
|
17280
|
+
const rInv = r.invm(n);
|
|
17281
|
+
const sR = R.mul(s);
|
|
17282
|
+
const eGNeg = G.mul(eNeg);
|
|
17283
|
+
const Q = sR.add(eGNeg).mul(rInv);
|
|
17284
|
+
return Q;
|
|
17285
|
+
}
|
|
17286
|
+
}
|
|
17216
17287
|
/**
|
|
17217
17288
|
* Calculate pubkey extraction parameter.
|
|
17218
17289
|
*
|
|
@@ -17227,11 +17298,15 @@ function sign$3(curve, hash, d, nonce) {
|
|
|
17227
17298
|
function calcPubKeyRecoveryParam(curve, e, signature, Q) {
|
|
17228
17299
|
for (let i = 0; i < 4; i++) {
|
|
17229
17300
|
try {
|
|
17230
|
-
// Use
|
|
17231
|
-
const Qprime =
|
|
17301
|
+
// Use our own recoverPubKey function instead of curve.recoverPubKey
|
|
17302
|
+
const Qprime = recoverPubKey(curve, e, signature, i);
|
|
17232
17303
|
// 1.6.2 Verify Q = Q'
|
|
17233
|
-
// Compare points by checking
|
|
17234
|
-
|
|
17304
|
+
// Compare points by checking coordinates (more reliable than eq method)
|
|
17305
|
+
const Qx = Q.getX().toString(16);
|
|
17306
|
+
const Qy = Q.getY().toString(16);
|
|
17307
|
+
const QprimeX = Qprime.getX().toString(16);
|
|
17308
|
+
const QprimeY = Qprime.getY().toString(16);
|
|
17309
|
+
if (Qx === QprimeX && Qy === QprimeY) {
|
|
17235
17310
|
return i;
|
|
17236
17311
|
}
|
|
17237
17312
|
}
|
|
@@ -17265,7 +17340,13 @@ class Signature {
|
|
|
17265
17340
|
throw new Error('Invalid signature length');
|
|
17266
17341
|
}
|
|
17267
17342
|
const i = buffer.readUInt8(0);
|
|
17268
|
-
|
|
17343
|
+
// Support both formats: 27-30 (old/legacy) and 31-34 (dsteem compatible)
|
|
17344
|
+
// Check if it's in the old format (27-30) or new format (31-34)
|
|
17345
|
+
const recoveryOld = i - 27;
|
|
17346
|
+
const recoveryNew = i - 31;
|
|
17347
|
+
const isValidOld = recoveryOld >= 0 && recoveryOld <= 3 && (recoveryOld === (recoveryOld & 7));
|
|
17348
|
+
const isValidNew = recoveryNew >= 0 && recoveryNew <= 3 && (recoveryNew === (recoveryNew & 7));
|
|
17349
|
+
if (!isValidOld && !isValidNew) {
|
|
17269
17350
|
throw new Error('Invalid signature parameter');
|
|
17270
17351
|
}
|
|
17271
17352
|
const r = new BN(buffer.slice(1, 33));
|
|
@@ -17314,7 +17395,9 @@ class Signature {
|
|
|
17314
17395
|
}
|
|
17315
17396
|
}
|
|
17316
17397
|
const i = calcPubKeyRecoveryParam(secp256k1, new BN(buf_sha256), ecsignature, privKey.toPublic().Q);
|
|
17317
|
-
|
|
17398
|
+
// Use recovery byte 31-34 (instead of 27-30) to be compatible with dsteem
|
|
17399
|
+
// dsteem expects: recovery = byte - 31, so byte = recovery + 31
|
|
17400
|
+
return new Signature(ecsignature.r, ecsignature.s, i + 31);
|
|
17318
17401
|
}
|
|
17319
17402
|
static isCanonical(r, s) {
|
|
17320
17403
|
// See libraries/fc/src/crypto/elliptic_common.cpp is_fc_canonical
|
|
@@ -17445,24 +17528,24 @@ class Address {
|
|
|
17445
17528
|
* @returns Buffer with random bytes
|
|
17446
17529
|
*/
|
|
17447
17530
|
function randomBytes(size) {
|
|
17448
|
-
// Always try Web Crypto API first (works in both browser and Node.js
|
|
17531
|
+
// Always try Web Crypto API first (works in both browser and Node.js 20.19+)
|
|
17449
17532
|
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
17450
17533
|
const array = new Uint8Array(size);
|
|
17451
17534
|
crypto.getRandomValues(array);
|
|
17452
17535
|
return bufferExports.Buffer.from(array);
|
|
17453
17536
|
}
|
|
17454
17537
|
// Fallback to Node.js crypto only if Web Crypto API is not available
|
|
17455
|
-
// This code path should not be reached in Node.js
|
|
17538
|
+
// This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
|
|
17456
17539
|
// and is kept as a safety fallback for edge cases.
|
|
17457
17540
|
// In browser builds, Rollup will tree-shake this code away because
|
|
17458
17541
|
// the condition above will always be true in browsers.
|
|
17459
17542
|
//
|
|
17460
|
-
// Note: This SDK requires Node.js >=
|
|
17461
|
-
// Node.js
|
|
17462
|
-
// In ESM mode, require is undefined, but since Node.js
|
|
17543
|
+
// Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
|
|
17544
|
+
// Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
|
|
17545
|
+
// In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
|
|
17463
17546
|
// this code path won't be reached in ESM mode with the minimum required version.
|
|
17464
17547
|
try {
|
|
17465
|
-
// Use dynamic require as a safety fallback (for Node.js <
|
|
17548
|
+
// Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
|
|
17466
17549
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
17467
17550
|
const nodeCrypto = null;
|
|
17468
17551
|
if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') ;
|
|
@@ -17471,7 +17554,7 @@ function randomBytes(size) {
|
|
|
17471
17554
|
// Ignore require errors in browser environments or ESM mode
|
|
17472
17555
|
}
|
|
17473
17556
|
// If neither Web Crypto API nor Node.js crypto is available, throw error
|
|
17474
|
-
throw new Error('Random bytes generation is not available. This library requires either Web Crypto API (browser/Node.js
|
|
17557
|
+
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.');
|
|
17475
17558
|
}
|
|
17476
17559
|
|
|
17477
17560
|
/**
|
|
@@ -18424,11 +18507,11 @@ var hasRequiredRetry$1;
|
|
|
18424
18507
|
function requireRetry$1 () {
|
|
18425
18508
|
if (hasRequiredRetry$1) return retry$2;
|
|
18426
18509
|
hasRequiredRetry$1 = 1;
|
|
18427
|
-
(function (exports
|
|
18510
|
+
(function (exports) {
|
|
18428
18511
|
var RetryOperation = requireRetry_operation();
|
|
18429
18512
|
|
|
18430
|
-
exports
|
|
18431
|
-
var timeouts = exports
|
|
18513
|
+
exports.operation = function(options) {
|
|
18514
|
+
var timeouts = exports.timeouts(options);
|
|
18432
18515
|
return new RetryOperation(timeouts, {
|
|
18433
18516
|
forever: options && (options.forever || options.retries === Infinity),
|
|
18434
18517
|
unref: options && options.unref,
|
|
@@ -18436,7 +18519,7 @@ function requireRetry$1 () {
|
|
|
18436
18519
|
});
|
|
18437
18520
|
};
|
|
18438
18521
|
|
|
18439
|
-
exports
|
|
18522
|
+
exports.timeouts = function(options) {
|
|
18440
18523
|
if (options instanceof Array) {
|
|
18441
18524
|
return [].concat(options);
|
|
18442
18525
|
}
|
|
@@ -18473,7 +18556,7 @@ function requireRetry$1 () {
|
|
|
18473
18556
|
return timeouts;
|
|
18474
18557
|
};
|
|
18475
18558
|
|
|
18476
|
-
exports
|
|
18559
|
+
exports.createTimeout = function(attempt, opts) {
|
|
18477
18560
|
var random = (opts.randomize)
|
|
18478
18561
|
? (Math.random() + 1)
|
|
18479
18562
|
: 1;
|
|
@@ -18484,7 +18567,7 @@ function requireRetry$1 () {
|
|
|
18484
18567
|
return timeout;
|
|
18485
18568
|
};
|
|
18486
18569
|
|
|
18487
|
-
exports
|
|
18570
|
+
exports.wrap = function(obj, options, methods) {
|
|
18488
18571
|
if (options instanceof Array) {
|
|
18489
18572
|
methods = options;
|
|
18490
18573
|
options = null;
|
|
@@ -18504,7 +18587,7 @@ function requireRetry$1 () {
|
|
|
18504
18587
|
var original = obj[method];
|
|
18505
18588
|
|
|
18506
18589
|
obj[method] = function retryWrapper(original) {
|
|
18507
|
-
var op = exports
|
|
18590
|
+
var op = exports.operation(options);
|
|
18508
18591
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
18509
18592
|
var callback = args.pop();
|
|
18510
18593
|
|
|
@@ -18597,7 +18680,7 @@ class JsonRpcError extends Error {
|
|
|
18597
18680
|
}
|
|
18598
18681
|
/**
|
|
18599
18682
|
* Makes a JSON-RPC request using native fetch API
|
|
18600
|
-
* Universal implementation that works in both Node.js (
|
|
18683
|
+
* Universal implementation that works in both Node.js (20.19+) and browser
|
|
18601
18684
|
*
|
|
18602
18685
|
* @param url - The URL to the JSON-RPC endpoint
|
|
18603
18686
|
* @param request - The JSON-RPC request object
|
|
@@ -18944,7 +19027,7 @@ function requireLong () {
|
|
|
18944
19027
|
if (value >= TWO_PWR_64_DBL)
|
|
18945
19028
|
return MAX_UNSIGNED_VALUE;
|
|
18946
19029
|
} else {
|
|
18947
|
-
if (value <= -
|
|
19030
|
+
if (value <= -9223372036854776e3)
|
|
18948
19031
|
return MIN_VALUE;
|
|
18949
19032
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
18950
19033
|
return MAX_VALUE;
|
|
@@ -23980,7 +24063,7 @@ function fromNumber(value, unsigned) {
|
|
|
23980
24063
|
if (value < 0) return UZERO;
|
|
23981
24064
|
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
23982
24065
|
} else {
|
|
23983
|
-
if (value <= -
|
|
24066
|
+
if (value <= -9223372036854776e3) return MIN_VALUE;
|
|
23984
24067
|
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
23985
24068
|
}
|
|
23986
24069
|
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
@@ -26059,6 +26142,25 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26059
26142
|
jsonRpc(this.options.url, { method, params, id }, fetchMethod)
|
|
26060
26143
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
26061
26144
|
}
|
|
26145
|
+
/**
|
|
26146
|
+
* Promise-based version of call
|
|
26147
|
+
* Makes a JSON-RPC call to the Steem blockchain
|
|
26148
|
+
* @param method Method name (e.g., 'condenser_api.get_accounts')
|
|
26149
|
+
* @param params Parameters array for the method
|
|
26150
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26151
|
+
*/
|
|
26152
|
+
callAsync(method, params) {
|
|
26153
|
+
return new Promise((resolve, reject) => {
|
|
26154
|
+
this.call(method, params, (err, result) => {
|
|
26155
|
+
if (err) {
|
|
26156
|
+
reject(err);
|
|
26157
|
+
}
|
|
26158
|
+
else {
|
|
26159
|
+
resolve(result);
|
|
26160
|
+
}
|
|
26161
|
+
});
|
|
26162
|
+
});
|
|
26163
|
+
}
|
|
26062
26164
|
signedCall(method, params, account, key, callback) {
|
|
26063
26165
|
if (this._transportType !== 'http') {
|
|
26064
26166
|
callback(new Error('RPC methods can only be called when using http transport'));
|
|
@@ -26077,6 +26179,27 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26077
26179
|
jsonRpc(this.options.url, request, fetchMethod)
|
|
26078
26180
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
26079
26181
|
}
|
|
26182
|
+
/**
|
|
26183
|
+
* Promise-based version of signedCall
|
|
26184
|
+
* Makes an authenticated JSON-RPC call with cryptographic signature
|
|
26185
|
+
* @param method Method name (e.g., 'conveyor.is_email_registered')
|
|
26186
|
+
* @param params Parameters array for the method
|
|
26187
|
+
* @param account Account name to sign the request with
|
|
26188
|
+
* @param key Private key (WIF) to sign the request
|
|
26189
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26190
|
+
*/
|
|
26191
|
+
signedCallAsync(method, params, account, key) {
|
|
26192
|
+
return new Promise((resolve, reject) => {
|
|
26193
|
+
this.signedCall(method, params, account, key, (err, result) => {
|
|
26194
|
+
if (err) {
|
|
26195
|
+
reject(err);
|
|
26196
|
+
}
|
|
26197
|
+
else {
|
|
26198
|
+
resolve(result);
|
|
26199
|
+
}
|
|
26200
|
+
});
|
|
26201
|
+
});
|
|
26202
|
+
}
|
|
26080
26203
|
/**
|
|
26081
26204
|
* Verify a signed RPC request
|
|
26082
26205
|
* @param signedRequest The signed request to verify
|
|
@@ -26139,6 +26262,24 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26139
26262
|
.catch(error => callback(error instanceof Error ? error : new Error(String(error))));
|
|
26140
26263
|
}).catch(callback);
|
|
26141
26264
|
}
|
|
26265
|
+
/**
|
|
26266
|
+
* Promise-based version of verifySignedRequest
|
|
26267
|
+
* Verifies a signed RPC request
|
|
26268
|
+
* @param signedRequest The signed request to verify
|
|
26269
|
+
* @returns Promise that resolves with verification result or rejects with an error
|
|
26270
|
+
*/
|
|
26271
|
+
verifySignedRequestAsync(signedRequest) {
|
|
26272
|
+
return new Promise((resolve, reject) => {
|
|
26273
|
+
this.verifySignedRequest(signedRequest, (err, result) => {
|
|
26274
|
+
if (err) {
|
|
26275
|
+
reject(err);
|
|
26276
|
+
}
|
|
26277
|
+
else {
|
|
26278
|
+
resolve(result);
|
|
26279
|
+
}
|
|
26280
|
+
});
|
|
26281
|
+
});
|
|
26282
|
+
}
|
|
26142
26283
|
setOptions(options) {
|
|
26143
26284
|
Object.assign(this.options, options);
|
|
26144
26285
|
this._setLogger(options);
|
|
@@ -26313,6 +26454,24 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26313
26454
|
}
|
|
26314
26455
|
this.broadcastTransactionSynchronous(trx, callback);
|
|
26315
26456
|
}
|
|
26457
|
+
/**
|
|
26458
|
+
* Promise-based version of broadcastTransactionSynchronousWith
|
|
26459
|
+
* Broadcasts a transaction synchronously
|
|
26460
|
+
* @param options Options object containing the transaction
|
|
26461
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26462
|
+
*/
|
|
26463
|
+
broadcastTransactionSynchronousWithAsync(options) {
|
|
26464
|
+
return new Promise((resolve, reject) => {
|
|
26465
|
+
this.broadcastTransactionSynchronousWith(options, (err, result) => {
|
|
26466
|
+
if (err) {
|
|
26467
|
+
reject(err);
|
|
26468
|
+
}
|
|
26469
|
+
else {
|
|
26470
|
+
resolve(result);
|
|
26471
|
+
}
|
|
26472
|
+
});
|
|
26473
|
+
});
|
|
26474
|
+
}
|
|
26316
26475
|
/**
|
|
26317
26476
|
* Broadcast a transaction to the blockchain.
|
|
26318
26477
|
* @param trx The transaction object
|
|
@@ -26332,6 +26491,24 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26332
26491
|
callback(new Error('broadcastTransaction is not implemented'));
|
|
26333
26492
|
}
|
|
26334
26493
|
}
|
|
26494
|
+
/**
|
|
26495
|
+
* Promise-based version of broadcastTransaction
|
|
26496
|
+
* Broadcasts a transaction to the blockchain
|
|
26497
|
+
* @param trx The transaction object
|
|
26498
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26499
|
+
*/
|
|
26500
|
+
broadcastTransactionAsync(trx) {
|
|
26501
|
+
return new Promise((resolve, reject) => {
|
|
26502
|
+
this.broadcastTransaction(trx, (err, result) => {
|
|
26503
|
+
if (err) {
|
|
26504
|
+
reject(err);
|
|
26505
|
+
}
|
|
26506
|
+
else {
|
|
26507
|
+
resolve(result);
|
|
26508
|
+
}
|
|
26509
|
+
});
|
|
26510
|
+
});
|
|
26511
|
+
}
|
|
26335
26512
|
/**
|
|
26336
26513
|
* Sign a transaction with the provided private key(s).
|
|
26337
26514
|
* @param trx The transaction object
|
|
@@ -26380,6 +26557,25 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26380
26557
|
params: [confirmationCallback, trx]
|
|
26381
26558
|
}, callback);
|
|
26382
26559
|
}
|
|
26560
|
+
/**
|
|
26561
|
+
* Promise-based version of broadcastTransactionWithCallback
|
|
26562
|
+
* Note: The confirmationCallback will still be called when the transaction is confirmed
|
|
26563
|
+
* @param confirmationCallback Callback function for transaction confirmation
|
|
26564
|
+
* @param trx Transaction object to broadcast
|
|
26565
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26566
|
+
*/
|
|
26567
|
+
broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
|
|
26568
|
+
return new Promise((resolve, reject) => {
|
|
26569
|
+
this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
|
|
26570
|
+
if (err) {
|
|
26571
|
+
reject(err);
|
|
26572
|
+
}
|
|
26573
|
+
else {
|
|
26574
|
+
resolve(result);
|
|
26575
|
+
}
|
|
26576
|
+
});
|
|
26577
|
+
});
|
|
26578
|
+
}
|
|
26383
26579
|
/**
|
|
26384
26580
|
* Broadcast a block to the network.
|
|
26385
26581
|
* @param block Block object to broadcast
|
|
@@ -26395,6 +26591,24 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26395
26591
|
params: [block]
|
|
26396
26592
|
}, callback);
|
|
26397
26593
|
}
|
|
26594
|
+
/**
|
|
26595
|
+
* Promise-based version of broadcastBlock
|
|
26596
|
+
* Broadcasts a block to the network
|
|
26597
|
+
* @param block Block object to broadcast
|
|
26598
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26599
|
+
*/
|
|
26600
|
+
broadcastBlockAsync(block) {
|
|
26601
|
+
return new Promise((resolve, reject) => {
|
|
26602
|
+
this.broadcastBlock(block, (err, result) => {
|
|
26603
|
+
if (err) {
|
|
26604
|
+
reject(err);
|
|
26605
|
+
}
|
|
26606
|
+
else {
|
|
26607
|
+
resolve(result);
|
|
26608
|
+
}
|
|
26609
|
+
});
|
|
26610
|
+
});
|
|
26611
|
+
}
|
|
26398
26612
|
/**
|
|
26399
26613
|
* Set the maximum block age for transaction acceptance.
|
|
26400
26614
|
* @param maxBlockAge Maximum block age in seconds
|
|
@@ -26410,6 +26624,24 @@ class Api extends eventsExports.EventEmitter {
|
|
|
26410
26624
|
params: [maxBlockAge]
|
|
26411
26625
|
}, callback);
|
|
26412
26626
|
}
|
|
26627
|
+
/**
|
|
26628
|
+
* Promise-based version of setMaxBlockAge
|
|
26629
|
+
* Sets the maximum block age for transaction acceptance
|
|
26630
|
+
* @param maxBlockAge Maximum block age in seconds
|
|
26631
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26632
|
+
*/
|
|
26633
|
+
setMaxBlockAgeAsync(maxBlockAge) {
|
|
26634
|
+
return new Promise((resolve, reject) => {
|
|
26635
|
+
this.setMaxBlockAge(maxBlockAge, (err, result) => {
|
|
26636
|
+
if (err) {
|
|
26637
|
+
reject(err);
|
|
26638
|
+
}
|
|
26639
|
+
else {
|
|
26640
|
+
resolve(result);
|
|
26641
|
+
}
|
|
26642
|
+
});
|
|
26643
|
+
});
|
|
26644
|
+
}
|
|
26413
26645
|
/**
|
|
26414
26646
|
* Verify transaction authority.
|
|
26415
26647
|
* @param trx Transaction object to verify
|
|
@@ -28913,7 +29145,7 @@ const steem = {
|
|
|
28913
29145
|
operations,
|
|
28914
29146
|
serializer,
|
|
28915
29147
|
utils: utils$3,
|
|
28916
|
-
version: '1.0.
|
|
29148
|
+
version: '1.0.11',
|
|
28917
29149
|
config: {
|
|
28918
29150
|
set: (options) => {
|
|
28919
29151
|
// If nodes is provided, extract the first node as url for API
|
|
@@ -28953,5 +29185,5 @@ if (typeof window !== 'undefined' || typeof globalThis !== 'undefined') {
|
|
|
28953
29185
|
}
|
|
28954
29186
|
}
|
|
28955
29187
|
|
|
28956
|
-
export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, steem, verify };
|
|
29188
|
+
export { Api, doubleSha256, generateKeyPair, hmacSha256, ripemd160, sha256, sign, sign$2 as signRequest, steem, validate as validateRequest, verify };
|
|
28957
29189
|
//# sourceMappingURL=browser.esm.js.map
|