@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.umd.js
CHANGED
|
@@ -1188,7 +1188,7 @@
|
|
|
1188
1188
|
* @license MIT
|
|
1189
1189
|
*/
|
|
1190
1190
|
|
|
1191
|
-
(function (exports
|
|
1191
|
+
(function (exports) {
|
|
1192
1192
|
|
|
1193
1193
|
const base64 = base64Js;
|
|
1194
1194
|
const ieee754$1 = ieee754;
|
|
@@ -1197,12 +1197,12 @@
|
|
|
1197
1197
|
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
1198
1198
|
: null;
|
|
1199
1199
|
|
|
1200
|
-
exports
|
|
1201
|
-
exports
|
|
1202
|
-
exports
|
|
1200
|
+
exports.Buffer = Buffer;
|
|
1201
|
+
exports.SlowBuffer = SlowBuffer;
|
|
1202
|
+
exports.INSPECT_MAX_BYTES = 50;
|
|
1203
1203
|
|
|
1204
1204
|
const K_MAX_LENGTH = 0x7fffffff;
|
|
1205
|
-
exports
|
|
1205
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
|
1206
1206
|
|
|
1207
1207
|
/**
|
|
1208
1208
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
@@ -1798,7 +1798,7 @@
|
|
|
1798
1798
|
|
|
1799
1799
|
Buffer.prototype.inspect = function inspect () {
|
|
1800
1800
|
let str = '';
|
|
1801
|
-
const max = exports
|
|
1801
|
+
const max = exports.INSPECT_MAX_BYTES;
|
|
1802
1802
|
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
|
|
1803
1803
|
if (this.length > max) str += ' ... ';
|
|
1804
1804
|
return '<Buffer ' + str + '>'
|
|
@@ -3308,7 +3308,7 @@
|
|
|
3308
3308
|
bn$1.exports;
|
|
3309
3309
|
|
|
3310
3310
|
(function (module) {
|
|
3311
|
-
(function (module, exports
|
|
3311
|
+
(function (module, exports) {
|
|
3312
3312
|
|
|
3313
3313
|
// Utils
|
|
3314
3314
|
function assert (val, msg) {
|
|
@@ -3351,7 +3351,7 @@
|
|
|
3351
3351
|
if (typeof module === 'object') {
|
|
3352
3352
|
module.exports = BN;
|
|
3353
3353
|
} else {
|
|
3354
|
-
exports
|
|
3354
|
+
exports.BN = BN;
|
|
3355
3355
|
}
|
|
3356
3356
|
|
|
3357
3357
|
BN.BN = BN;
|
|
@@ -6770,9 +6770,9 @@
|
|
|
6770
6770
|
|
|
6771
6771
|
var utils$l = {};
|
|
6772
6772
|
|
|
6773
|
-
(function (exports
|
|
6773
|
+
(function (exports) {
|
|
6774
6774
|
|
|
6775
|
-
var utils = exports
|
|
6775
|
+
var utils = exports;
|
|
6776
6776
|
|
|
6777
6777
|
function toArray(msg, enc) {
|
|
6778
6778
|
if (Array.isArray(msg))
|
|
@@ -6830,9 +6830,9 @@
|
|
|
6830
6830
|
};
|
|
6831
6831
|
} (utils$l));
|
|
6832
6832
|
|
|
6833
|
-
(function (exports
|
|
6833
|
+
(function (exports) {
|
|
6834
6834
|
|
|
6835
|
-
var utils = exports
|
|
6835
|
+
var utils = exports;
|
|
6836
6836
|
var BN = bnExports$1;
|
|
6837
6837
|
var minAssert = minimalisticAssert;
|
|
6838
6838
|
var minUtils = utils$l;
|
|
@@ -8984,9 +8984,9 @@
|
|
|
8984
8984
|
Point.prototype.toP = Point.prototype.normalize;
|
|
8985
8985
|
Point.prototype.mixedAdd = Point.prototype.add;
|
|
8986
8986
|
|
|
8987
|
-
(function (exports
|
|
8987
|
+
(function (exports) {
|
|
8988
8988
|
|
|
8989
|
-
var curve = exports
|
|
8989
|
+
var curve = exports;
|
|
8990
8990
|
|
|
8991
8991
|
curve.base = base$1;
|
|
8992
8992
|
curve.short = short;
|
|
@@ -10189,8 +10189,8 @@
|
|
|
10189
10189
|
return this.outer.digest(enc);
|
|
10190
10190
|
};
|
|
10191
10191
|
|
|
10192
|
-
(function (exports
|
|
10193
|
-
var hash = exports
|
|
10192
|
+
(function (exports) {
|
|
10193
|
+
var hash = exports;
|
|
10194
10194
|
|
|
10195
10195
|
hash.utils = utils$g;
|
|
10196
10196
|
hash.common = common$5;
|
|
@@ -10996,9 +10996,9 @@
|
|
|
10996
10996
|
return secp256k1$3;
|
|
10997
10997
|
}
|
|
10998
10998
|
|
|
10999
|
-
(function (exports
|
|
10999
|
+
(function (exports) {
|
|
11000
11000
|
|
|
11001
|
-
var curves = exports
|
|
11001
|
+
var curves = exports;
|
|
11002
11002
|
|
|
11003
11003
|
var hash = hash$2;
|
|
11004
11004
|
var curve$1 = curve;
|
|
@@ -12167,9 +12167,9 @@
|
|
|
12167
12167
|
return val instanceof this.pointClass;
|
|
12168
12168
|
};
|
|
12169
12169
|
|
|
12170
|
-
(function (exports
|
|
12170
|
+
(function (exports) {
|
|
12171
12171
|
|
|
12172
|
-
var elliptic = exports
|
|
12172
|
+
var elliptic = exports;
|
|
12173
12173
|
|
|
12174
12174
|
elliptic.version = require$$0$1.version;
|
|
12175
12175
|
elliptic.utils = utils$m;
|
|
@@ -12187,7 +12187,7 @@
|
|
|
12187
12187
|
bn.exports;
|
|
12188
12188
|
|
|
12189
12189
|
(function (module) {
|
|
12190
|
-
(function (module, exports
|
|
12190
|
+
(function (module, exports) {
|
|
12191
12191
|
|
|
12192
12192
|
// Utils
|
|
12193
12193
|
function assert (val, msg) {
|
|
@@ -12230,7 +12230,7 @@
|
|
|
12230
12230
|
if (typeof module === 'object') {
|
|
12231
12231
|
module.exports = BN;
|
|
12232
12232
|
} else {
|
|
12233
|
-
exports
|
|
12233
|
+
exports.BN = BN;
|
|
12234
12234
|
}
|
|
12235
12235
|
|
|
12236
12236
|
BN.BN = BN;
|
|
@@ -16928,6 +16928,77 @@
|
|
|
16928
16928
|
const finalS = s.gt(N_OVER_TWO) ? n.sub(s) : s;
|
|
16929
16929
|
return new ECSignature(r, finalS);
|
|
16930
16930
|
}
|
|
16931
|
+
/**
|
|
16932
|
+
* Recover a public key from a signature.
|
|
16933
|
+
*
|
|
16934
|
+
* See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
|
|
16935
|
+
* Key Recovery Operation".
|
|
16936
|
+
*
|
|
16937
|
+
* http://www.secg.org/download/aid-780/sec1-v2.pdf
|
|
16938
|
+
*/
|
|
16939
|
+
function recoverPubKey(curve, e, signature, i) {
|
|
16940
|
+
if ((i & 3) !== i) {
|
|
16941
|
+
throw new Error('Recovery param is more than two bits');
|
|
16942
|
+
}
|
|
16943
|
+
const n = new BN(curve.n.toString());
|
|
16944
|
+
const r = signature.r;
|
|
16945
|
+
const s = signature.s;
|
|
16946
|
+
if (r.isNeg() || r.isZero() || !r.lt(n))
|
|
16947
|
+
throw new Error('Invalid r value');
|
|
16948
|
+
if (s.isNeg() || s.isZero() || !s.lt(n))
|
|
16949
|
+
throw new Error('Invalid s value');
|
|
16950
|
+
// Try using elliptic's built-in recoverPubKey method
|
|
16951
|
+
// It expects: msg (Buffer), signature ({r: BN, s: BN}), j (recovery param)
|
|
16952
|
+
try {
|
|
16953
|
+
// Convert e (BN) to Buffer
|
|
16954
|
+
const msgBuffer = e.toArrayLike(buffer.Buffer, 'be', 32);
|
|
16955
|
+
// Create signature object compatible with elliptic's recoverPubKey
|
|
16956
|
+
// elliptic expects {r: BN, s: BN} format
|
|
16957
|
+
const sigObj = { r: r, s: s };
|
|
16958
|
+
// Use elliptic's built-in method
|
|
16959
|
+
const Q = curve.recoverPubKey(msgBuffer, sigObj, i);
|
|
16960
|
+
return Q;
|
|
16961
|
+
}
|
|
16962
|
+
catch (error) {
|
|
16963
|
+
// Fallback to manual implementation if elliptic's method fails
|
|
16964
|
+
const G = curve.g;
|
|
16965
|
+
// A set LSB signifies that the y-coordinate is odd
|
|
16966
|
+
const isYOdd = !!(i & 1);
|
|
16967
|
+
// The more significant bit specifies whether we should use the
|
|
16968
|
+
// first or second candidate key.
|
|
16969
|
+
const isSecondKey = i >> 1;
|
|
16970
|
+
// 1.1 Let x = r + jn
|
|
16971
|
+
const x = isSecondKey ? r.add(n) : r;
|
|
16972
|
+
// pointFromX expects a hex string (not BN object)
|
|
16973
|
+
// Convert BN to hex string and ensure proper padding
|
|
16974
|
+
const xHex = x.toString(16);
|
|
16975
|
+
// Ensure hex string is properly padded to 64 characters (32 bytes)
|
|
16976
|
+
const xHexPadded = xHex.padStart(64, '0');
|
|
16977
|
+
// pointFromX may also accept a Buffer, but hex string is more reliable
|
|
16978
|
+
let R;
|
|
16979
|
+
try {
|
|
16980
|
+
R = curve.curve.pointFromX(xHexPadded, isYOdd);
|
|
16981
|
+
}
|
|
16982
|
+
catch (error) {
|
|
16983
|
+
// If hex string fails, try with Buffer
|
|
16984
|
+
const xBuffer = x.toArrayLike(buffer.Buffer, 'be', 32);
|
|
16985
|
+
R = curve.curve.pointFromX(xBuffer, isYOdd);
|
|
16986
|
+
}
|
|
16987
|
+
// 1.4 Check that nR is at infinity
|
|
16988
|
+
const nR = R.mul(n);
|
|
16989
|
+
if (!nR.isInfinity())
|
|
16990
|
+
throw new Error('nR is not a valid curve point');
|
|
16991
|
+
// Compute -e from e
|
|
16992
|
+
const eNeg = e.neg().mod(n);
|
|
16993
|
+
// 1.6.1 Compute Q = r^-1 (sR - eG)
|
|
16994
|
+
// Q = r^-1 (sR + -eG)
|
|
16995
|
+
const rInv = r.invm(n);
|
|
16996
|
+
const sR = R.mul(s);
|
|
16997
|
+
const eGNeg = G.mul(eNeg);
|
|
16998
|
+
const Q = sR.add(eGNeg).mul(rInv);
|
|
16999
|
+
return Q;
|
|
17000
|
+
}
|
|
17001
|
+
}
|
|
16931
17002
|
/**
|
|
16932
17003
|
* Calculate pubkey extraction parameter.
|
|
16933
17004
|
*
|
|
@@ -16942,11 +17013,15 @@
|
|
|
16942
17013
|
function calcPubKeyRecoveryParam(curve, e, signature, Q) {
|
|
16943
17014
|
for (let i = 0; i < 4; i++) {
|
|
16944
17015
|
try {
|
|
16945
|
-
// Use
|
|
16946
|
-
const Qprime =
|
|
17016
|
+
// Use our own recoverPubKey function instead of curve.recoverPubKey
|
|
17017
|
+
const Qprime = recoverPubKey(curve, e, signature, i);
|
|
16947
17018
|
// 1.6.2 Verify Q = Q'
|
|
16948
|
-
// Compare points by checking
|
|
16949
|
-
|
|
17019
|
+
// Compare points by checking coordinates (more reliable than eq method)
|
|
17020
|
+
const Qx = Q.getX().toString(16);
|
|
17021
|
+
const Qy = Q.getY().toString(16);
|
|
17022
|
+
const QprimeX = Qprime.getX().toString(16);
|
|
17023
|
+
const QprimeY = Qprime.getY().toString(16);
|
|
17024
|
+
if (Qx === QprimeX && Qy === QprimeY) {
|
|
16950
17025
|
return i;
|
|
16951
17026
|
}
|
|
16952
17027
|
}
|
|
@@ -16980,7 +17055,13 @@
|
|
|
16980
17055
|
throw new Error('Invalid signature length');
|
|
16981
17056
|
}
|
|
16982
17057
|
const i = buffer.readUInt8(0);
|
|
16983
|
-
|
|
17058
|
+
// Support both formats: 27-30 (old/legacy) and 31-34 (dsteem compatible)
|
|
17059
|
+
// Check if it's in the old format (27-30) or new format (31-34)
|
|
17060
|
+
const recoveryOld = i - 27;
|
|
17061
|
+
const recoveryNew = i - 31;
|
|
17062
|
+
const isValidOld = recoveryOld >= 0 && recoveryOld <= 3 && (recoveryOld === (recoveryOld & 7));
|
|
17063
|
+
const isValidNew = recoveryNew >= 0 && recoveryNew <= 3 && (recoveryNew === (recoveryNew & 7));
|
|
17064
|
+
if (!isValidOld && !isValidNew) {
|
|
16984
17065
|
throw new Error('Invalid signature parameter');
|
|
16985
17066
|
}
|
|
16986
17067
|
const r = new BN(buffer.slice(1, 33));
|
|
@@ -17029,7 +17110,9 @@
|
|
|
17029
17110
|
}
|
|
17030
17111
|
}
|
|
17031
17112
|
const i = calcPubKeyRecoveryParam(secp256k1, new BN(buf_sha256), ecsignature, privKey.toPublic().Q);
|
|
17032
|
-
|
|
17113
|
+
// Use recovery byte 31-34 (instead of 27-30) to be compatible with dsteem
|
|
17114
|
+
// dsteem expects: recovery = byte - 31, so byte = recovery + 31
|
|
17115
|
+
return new Signature(ecsignature.r, ecsignature.s, i + 31);
|
|
17033
17116
|
}
|
|
17034
17117
|
static isCanonical(r, s) {
|
|
17035
17118
|
// See libraries/fc/src/crypto/elliptic_common.cpp is_fc_canonical
|
|
@@ -17160,24 +17243,24 @@
|
|
|
17160
17243
|
* @returns Buffer with random bytes
|
|
17161
17244
|
*/
|
|
17162
17245
|
function randomBytes(size) {
|
|
17163
|
-
// Always try Web Crypto API first (works in both browser and Node.js
|
|
17246
|
+
// Always try Web Crypto API first (works in both browser and Node.js 20.19+)
|
|
17164
17247
|
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
17165
17248
|
const array = new Uint8Array(size);
|
|
17166
17249
|
crypto.getRandomValues(array);
|
|
17167
17250
|
return buffer.Buffer.from(array);
|
|
17168
17251
|
}
|
|
17169
17252
|
// Fallback to Node.js crypto only if Web Crypto API is not available
|
|
17170
|
-
// This code path should not be reached in Node.js
|
|
17253
|
+
// This code path should not be reached in Node.js 20.19+ (which has Web Crypto API)
|
|
17171
17254
|
// and is kept as a safety fallback for edge cases.
|
|
17172
17255
|
// In browser builds, Rollup will tree-shake this code away because
|
|
17173
17256
|
// the condition above will always be true in browsers.
|
|
17174
17257
|
//
|
|
17175
|
-
// Note: This SDK requires Node.js >=
|
|
17176
|
-
// Node.js
|
|
17177
|
-
// In ESM mode, require is undefined, but since Node.js
|
|
17258
|
+
// Note: This SDK requires Node.js >= 20.19.0 (see package.json engines field).
|
|
17259
|
+
// Node.js 20.19+ has Web Crypto API, so this fallback is rarely needed.
|
|
17260
|
+
// In ESM mode, require is undefined, but since Node.js 20.19+ has Web Crypto API,
|
|
17178
17261
|
// this code path won't be reached in ESM mode with the minimum required version.
|
|
17179
17262
|
try {
|
|
17180
|
-
// Use dynamic require as a safety fallback (for Node.js <
|
|
17263
|
+
// Use dynamic require as a safety fallback (for Node.js < 20.19 edge cases)
|
|
17181
17264
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
17182
17265
|
const nodeCrypto = typeof require !== 'undefined' ? require('crypto') : null;
|
|
17183
17266
|
if (nodeCrypto && typeof nodeCrypto.randomBytes === 'function') {
|
|
@@ -17188,7 +17271,7 @@
|
|
|
17188
17271
|
// Ignore require errors in browser environments or ESM mode
|
|
17189
17272
|
}
|
|
17190
17273
|
// If neither Web Crypto API nor Node.js crypto is available, throw error
|
|
17191
|
-
throw new Error('Random bytes generation is not available. This library requires either Web Crypto API (browser/Node.js
|
|
17274
|
+
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.');
|
|
17192
17275
|
}
|
|
17193
17276
|
|
|
17194
17277
|
/**
|
|
@@ -18128,11 +18211,11 @@
|
|
|
18128
18211
|
return mainError;
|
|
18129
18212
|
};
|
|
18130
18213
|
|
|
18131
|
-
(function (exports
|
|
18214
|
+
(function (exports) {
|
|
18132
18215
|
var RetryOperation = retry_operation;
|
|
18133
18216
|
|
|
18134
|
-
exports
|
|
18135
|
-
var timeouts = exports
|
|
18217
|
+
exports.operation = function(options) {
|
|
18218
|
+
var timeouts = exports.timeouts(options);
|
|
18136
18219
|
return new RetryOperation(timeouts, {
|
|
18137
18220
|
forever: options && (options.forever || options.retries === Infinity),
|
|
18138
18221
|
unref: options && options.unref,
|
|
@@ -18140,7 +18223,7 @@
|
|
|
18140
18223
|
});
|
|
18141
18224
|
};
|
|
18142
18225
|
|
|
18143
|
-
exports
|
|
18226
|
+
exports.timeouts = function(options) {
|
|
18144
18227
|
if (options instanceof Array) {
|
|
18145
18228
|
return [].concat(options);
|
|
18146
18229
|
}
|
|
@@ -18177,7 +18260,7 @@
|
|
|
18177
18260
|
return timeouts;
|
|
18178
18261
|
};
|
|
18179
18262
|
|
|
18180
|
-
exports
|
|
18263
|
+
exports.createTimeout = function(attempt, opts) {
|
|
18181
18264
|
var random = (opts.randomize)
|
|
18182
18265
|
? (Math.random() + 1)
|
|
18183
18266
|
: 1;
|
|
@@ -18188,7 +18271,7 @@
|
|
|
18188
18271
|
return timeout;
|
|
18189
18272
|
};
|
|
18190
18273
|
|
|
18191
|
-
exports
|
|
18274
|
+
exports.wrap = function(obj, options, methods) {
|
|
18192
18275
|
if (options instanceof Array) {
|
|
18193
18276
|
methods = options;
|
|
18194
18277
|
options = null;
|
|
@@ -18208,7 +18291,7 @@
|
|
|
18208
18291
|
var original = obj[method];
|
|
18209
18292
|
|
|
18210
18293
|
obj[method] = function retryWrapper(original) {
|
|
18211
|
-
var op = exports
|
|
18294
|
+
var op = exports.operation(options);
|
|
18212
18295
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
18213
18296
|
var callback = args.pop();
|
|
18214
18297
|
|
|
@@ -18290,7 +18373,7 @@
|
|
|
18290
18373
|
}
|
|
18291
18374
|
/**
|
|
18292
18375
|
* Makes a JSON-RPC request using native fetch API
|
|
18293
|
-
* Universal implementation that works in both Node.js (
|
|
18376
|
+
* Universal implementation that works in both Node.js (20.19+) and browser
|
|
18294
18377
|
*
|
|
18295
18378
|
* @param url - The URL to the JSON-RPC endpoint
|
|
18296
18379
|
* @param request - The JSON-RPC request object
|
|
@@ -18637,7 +18720,7 @@
|
|
|
18637
18720
|
if (value >= TWO_PWR_64_DBL)
|
|
18638
18721
|
return MAX_UNSIGNED_VALUE;
|
|
18639
18722
|
} else {
|
|
18640
|
-
if (value <= -
|
|
18723
|
+
if (value <= -9223372036854776e3)
|
|
18641
18724
|
return MIN_VALUE;
|
|
18642
18725
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
18643
18726
|
return MAX_VALUE;
|
|
@@ -23666,7 +23749,7 @@
|
|
|
23666
23749
|
if (value < 0) return UZERO;
|
|
23667
23750
|
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
23668
23751
|
} else {
|
|
23669
|
-
if (value <= -
|
|
23752
|
+
if (value <= -9223372036854776e3) return MIN_VALUE;
|
|
23670
23753
|
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
23671
23754
|
}
|
|
23672
23755
|
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
@@ -25745,6 +25828,25 @@
|
|
|
25745
25828
|
jsonRpc(this.options.url, { method, params, id }, fetchMethod)
|
|
25746
25829
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
25747
25830
|
}
|
|
25831
|
+
/**
|
|
25832
|
+
* Promise-based version of call
|
|
25833
|
+
* Makes a JSON-RPC call to the Steem blockchain
|
|
25834
|
+
* @param method Method name (e.g., 'condenser_api.get_accounts')
|
|
25835
|
+
* @param params Parameters array for the method
|
|
25836
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
25837
|
+
*/
|
|
25838
|
+
callAsync(method, params) {
|
|
25839
|
+
return new Promise((resolve, reject) => {
|
|
25840
|
+
this.call(method, params, (err, result) => {
|
|
25841
|
+
if (err) {
|
|
25842
|
+
reject(err);
|
|
25843
|
+
}
|
|
25844
|
+
else {
|
|
25845
|
+
resolve(result);
|
|
25846
|
+
}
|
|
25847
|
+
});
|
|
25848
|
+
});
|
|
25849
|
+
}
|
|
25748
25850
|
signedCall(method, params, account, key, callback) {
|
|
25749
25851
|
if (this._transportType !== 'http') {
|
|
25750
25852
|
callback(new Error('RPC methods can only be called when using http transport'));
|
|
@@ -25763,6 +25865,27 @@
|
|
|
25763
25865
|
jsonRpc(this.options.url, request, fetchMethod)
|
|
25764
25866
|
.then(res => { callback(null, res); }, err => { callback(err); });
|
|
25765
25867
|
}
|
|
25868
|
+
/**
|
|
25869
|
+
* Promise-based version of signedCall
|
|
25870
|
+
* Makes an authenticated JSON-RPC call with cryptographic signature
|
|
25871
|
+
* @param method Method name (e.g., 'conveyor.is_email_registered')
|
|
25872
|
+
* @param params Parameters array for the method
|
|
25873
|
+
* @param account Account name to sign the request with
|
|
25874
|
+
* @param key Private key (WIF) to sign the request
|
|
25875
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
25876
|
+
*/
|
|
25877
|
+
signedCallAsync(method, params, account, key) {
|
|
25878
|
+
return new Promise((resolve, reject) => {
|
|
25879
|
+
this.signedCall(method, params, account, key, (err, result) => {
|
|
25880
|
+
if (err) {
|
|
25881
|
+
reject(err);
|
|
25882
|
+
}
|
|
25883
|
+
else {
|
|
25884
|
+
resolve(result);
|
|
25885
|
+
}
|
|
25886
|
+
});
|
|
25887
|
+
});
|
|
25888
|
+
}
|
|
25766
25889
|
/**
|
|
25767
25890
|
* Verify a signed RPC request
|
|
25768
25891
|
* @param signedRequest The signed request to verify
|
|
@@ -25825,6 +25948,24 @@
|
|
|
25825
25948
|
.catch(error => callback(error instanceof Error ? error : new Error(String(error))));
|
|
25826
25949
|
}).catch(callback);
|
|
25827
25950
|
}
|
|
25951
|
+
/**
|
|
25952
|
+
* Promise-based version of verifySignedRequest
|
|
25953
|
+
* Verifies a signed RPC request
|
|
25954
|
+
* @param signedRequest The signed request to verify
|
|
25955
|
+
* @returns Promise that resolves with verification result or rejects with an error
|
|
25956
|
+
*/
|
|
25957
|
+
verifySignedRequestAsync(signedRequest) {
|
|
25958
|
+
return new Promise((resolve, reject) => {
|
|
25959
|
+
this.verifySignedRequest(signedRequest, (err, result) => {
|
|
25960
|
+
if (err) {
|
|
25961
|
+
reject(err);
|
|
25962
|
+
}
|
|
25963
|
+
else {
|
|
25964
|
+
resolve(result);
|
|
25965
|
+
}
|
|
25966
|
+
});
|
|
25967
|
+
});
|
|
25968
|
+
}
|
|
25828
25969
|
setOptions(options) {
|
|
25829
25970
|
Object.assign(this.options, options);
|
|
25830
25971
|
this._setLogger(options);
|
|
@@ -25999,6 +26140,24 @@
|
|
|
25999
26140
|
}
|
|
26000
26141
|
this.broadcastTransactionSynchronous(trx, callback);
|
|
26001
26142
|
}
|
|
26143
|
+
/**
|
|
26144
|
+
* Promise-based version of broadcastTransactionSynchronousWith
|
|
26145
|
+
* Broadcasts a transaction synchronously
|
|
26146
|
+
* @param options Options object containing the transaction
|
|
26147
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26148
|
+
*/
|
|
26149
|
+
broadcastTransactionSynchronousWithAsync(options) {
|
|
26150
|
+
return new Promise((resolve, reject) => {
|
|
26151
|
+
this.broadcastTransactionSynchronousWith(options, (err, result) => {
|
|
26152
|
+
if (err) {
|
|
26153
|
+
reject(err);
|
|
26154
|
+
}
|
|
26155
|
+
else {
|
|
26156
|
+
resolve(result);
|
|
26157
|
+
}
|
|
26158
|
+
});
|
|
26159
|
+
});
|
|
26160
|
+
}
|
|
26002
26161
|
/**
|
|
26003
26162
|
* Broadcast a transaction to the blockchain.
|
|
26004
26163
|
* @param trx The transaction object
|
|
@@ -26018,6 +26177,24 @@
|
|
|
26018
26177
|
callback(new Error('broadcastTransaction is not implemented'));
|
|
26019
26178
|
}
|
|
26020
26179
|
}
|
|
26180
|
+
/**
|
|
26181
|
+
* Promise-based version of broadcastTransaction
|
|
26182
|
+
* Broadcasts a transaction to the blockchain
|
|
26183
|
+
* @param trx The transaction object
|
|
26184
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26185
|
+
*/
|
|
26186
|
+
broadcastTransactionAsync(trx) {
|
|
26187
|
+
return new Promise((resolve, reject) => {
|
|
26188
|
+
this.broadcastTransaction(trx, (err, result) => {
|
|
26189
|
+
if (err) {
|
|
26190
|
+
reject(err);
|
|
26191
|
+
}
|
|
26192
|
+
else {
|
|
26193
|
+
resolve(result);
|
|
26194
|
+
}
|
|
26195
|
+
});
|
|
26196
|
+
});
|
|
26197
|
+
}
|
|
26021
26198
|
/**
|
|
26022
26199
|
* Sign a transaction with the provided private key(s).
|
|
26023
26200
|
* @param trx The transaction object
|
|
@@ -26066,6 +26243,25 @@
|
|
|
26066
26243
|
params: [confirmationCallback, trx]
|
|
26067
26244
|
}, callback);
|
|
26068
26245
|
}
|
|
26246
|
+
/**
|
|
26247
|
+
* Promise-based version of broadcastTransactionWithCallback
|
|
26248
|
+
* Note: The confirmationCallback will still be called when the transaction is confirmed
|
|
26249
|
+
* @param confirmationCallback Callback function for transaction confirmation
|
|
26250
|
+
* @param trx Transaction object to broadcast
|
|
26251
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26252
|
+
*/
|
|
26253
|
+
broadcastTransactionWithCallbackAsync(confirmationCallback, trx) {
|
|
26254
|
+
return new Promise((resolve, reject) => {
|
|
26255
|
+
this.broadcastTransactionWithCallback(confirmationCallback, trx, (err, result) => {
|
|
26256
|
+
if (err) {
|
|
26257
|
+
reject(err);
|
|
26258
|
+
}
|
|
26259
|
+
else {
|
|
26260
|
+
resolve(result);
|
|
26261
|
+
}
|
|
26262
|
+
});
|
|
26263
|
+
});
|
|
26264
|
+
}
|
|
26069
26265
|
/**
|
|
26070
26266
|
* Broadcast a block to the network.
|
|
26071
26267
|
* @param block Block object to broadcast
|
|
@@ -26081,6 +26277,24 @@
|
|
|
26081
26277
|
params: [block]
|
|
26082
26278
|
}, callback);
|
|
26083
26279
|
}
|
|
26280
|
+
/**
|
|
26281
|
+
* Promise-based version of broadcastBlock
|
|
26282
|
+
* Broadcasts a block to the network
|
|
26283
|
+
* @param block Block object to broadcast
|
|
26284
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26285
|
+
*/
|
|
26286
|
+
broadcastBlockAsync(block) {
|
|
26287
|
+
return new Promise((resolve, reject) => {
|
|
26288
|
+
this.broadcastBlock(block, (err, result) => {
|
|
26289
|
+
if (err) {
|
|
26290
|
+
reject(err);
|
|
26291
|
+
}
|
|
26292
|
+
else {
|
|
26293
|
+
resolve(result);
|
|
26294
|
+
}
|
|
26295
|
+
});
|
|
26296
|
+
});
|
|
26297
|
+
}
|
|
26084
26298
|
/**
|
|
26085
26299
|
* Set the maximum block age for transaction acceptance.
|
|
26086
26300
|
* @param maxBlockAge Maximum block age in seconds
|
|
@@ -26096,6 +26310,24 @@
|
|
|
26096
26310
|
params: [maxBlockAge]
|
|
26097
26311
|
}, callback);
|
|
26098
26312
|
}
|
|
26313
|
+
/**
|
|
26314
|
+
* Promise-based version of setMaxBlockAge
|
|
26315
|
+
* Sets the maximum block age for transaction acceptance
|
|
26316
|
+
* @param maxBlockAge Maximum block age in seconds
|
|
26317
|
+
* @returns Promise that resolves with the result or rejects with an error
|
|
26318
|
+
*/
|
|
26319
|
+
setMaxBlockAgeAsync(maxBlockAge) {
|
|
26320
|
+
return new Promise((resolve, reject) => {
|
|
26321
|
+
this.setMaxBlockAge(maxBlockAge, (err, result) => {
|
|
26322
|
+
if (err) {
|
|
26323
|
+
reject(err);
|
|
26324
|
+
}
|
|
26325
|
+
else {
|
|
26326
|
+
resolve(result);
|
|
26327
|
+
}
|
|
26328
|
+
});
|
|
26329
|
+
});
|
|
26330
|
+
}
|
|
26099
26331
|
/**
|
|
26100
26332
|
* Verify transaction authority.
|
|
26101
26333
|
* @param trx Transaction object to verify
|
|
@@ -28612,7 +28844,7 @@
|
|
|
28612
28844
|
serializer,
|
|
28613
28845
|
utils: utils$n,
|
|
28614
28846
|
...crypto$1,
|
|
28615
|
-
version: '1.0.
|
|
28847
|
+
version: '1.0.11',
|
|
28616
28848
|
config: {
|
|
28617
28849
|
set: (options) => {
|
|
28618
28850
|
// If nodes is provided, extract the first node as url for API
|