bsv2 2.2.3 → 2.3.1
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 +30 -1
- package/dist/bsv2.cjs +3 -3
- package/dist/bsv2.cjs.map +1 -1
- package/dist/bsv2.mjs +365 -338
- package/dist/bsv2.mjs.map +1 -1
- package/dist/bsv2.umd.js +3 -3
- package/dist/bsv2.umd.js.map +1 -1
- package/package.json +16 -15
package/dist/bsv2.mjs
CHANGED
|
@@ -572,7 +572,7 @@ function Te() {
|
|
|
572
572
|
return L !== 0 ? E.words[_] = L | 0 : E.length--, E._strip();
|
|
573
573
|
}
|
|
574
574
|
var g = function(m, E, O) {
|
|
575
|
-
var R = m.words, A = E.words, F = O.words, K = 0, L, _, U, fe = R[0] | 0, se = fe & 8191, V = fe >>> 13, P = R[1] | 0, M = P & 8191, Y = P >>> 13, Q = R[2] | 0, D = Q & 8191, T = Q >>> 13, J = R[3] | 0, ie = J & 8191, ue = J >>> 13, oe = R[4] | 0, ce = oe & 8191, ge = oe >>> 13, Ke = R[5] | 0, Se = Ke & 8191, de = Ke >>> 13, Be = R[6] | 0, ve = Be & 8191, me = Be >>> 13, Le = R[7] | 0, Pe = Le & 8191, N = Le >>> 13, w = R[8] | 0, S = w & 8191, H = w >>> 13, W = R[9] | 0, X = W & 8191,
|
|
575
|
+
var R = m.words, A = E.words, F = O.words, K = 0, L, _, U, fe = R[0] | 0, se = fe & 8191, V = fe >>> 13, P = R[1] | 0, M = P & 8191, Y = P >>> 13, Q = R[2] | 0, D = Q & 8191, T = Q >>> 13, J = R[3] | 0, ie = J & 8191, ue = J >>> 13, oe = R[4] | 0, ce = oe & 8191, ge = oe >>> 13, Ke = R[5] | 0, Se = Ke & 8191, de = Ke >>> 13, Be = R[6] | 0, ve = Be & 8191, me = Be >>> 13, Le = R[7] | 0, Pe = Le & 8191, N = Le >>> 13, w = R[8] | 0, S = w & 8191, H = w >>> 13, W = R[9] | 0, X = W & 8191, Z = W >>> 13, Ee = A[0] | 0, we = Ee & 8191, ye = Ee >>> 13, De = A[1] | 0, le = De & 8191, je = De >>> 13, os = A[2] | 0, ze = os & 8191, Ve = os >>> 13, cs = A[3] | 0, Ge = cs & 8191, $e = cs >>> 13, us = A[4] | 0, We = us & 8191, Ye = us >>> 13, hs = A[5] | 0, Je = hs & 8191, Xe = hs >>> 13, ds = A[6] | 0, Qe = ds & 8191, Ze = ds >>> 13, ls = A[7] | 0, et = ls & 8191, tt = ls >>> 13, bs = A[8] | 0, rt = bs & 8191, it = bs >>> 13, ps = A[9] | 0, nt = ps & 8191, at = ps >>> 13;
|
|
576
576
|
O.negative = m.negative ^ E.negative, O.length = 19, L = Math.imul(se, we), _ = Math.imul(se, ye), _ = _ + Math.imul(V, we) | 0, U = Math.imul(V, ye);
|
|
577
577
|
var Kr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
578
578
|
K = (U + (_ >>> 13) | 0) + (Kr >>> 26) | 0, Kr &= 67108863, L = Math.imul(M, we), _ = Math.imul(M, ye), _ = _ + Math.imul(Y, we) | 0, U = Math.imul(Y, ye), L = L + Math.imul(se, le) | 0, _ = _ + Math.imul(se, je) | 0, _ = _ + Math.imul(V, le) | 0, U = U + Math.imul(V, je) | 0;
|
|
@@ -591,25 +591,25 @@ function Te() {
|
|
|
591
591
|
var Yr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
592
592
|
K = (U + (_ >>> 13) | 0) + (Yr >>> 26) | 0, Yr &= 67108863, L = Math.imul(S, we), _ = Math.imul(S, ye), _ = _ + Math.imul(H, we) | 0, U = Math.imul(H, ye), L = L + Math.imul(Pe, le) | 0, _ = _ + Math.imul(Pe, je) | 0, _ = _ + Math.imul(N, le) | 0, U = U + Math.imul(N, je) | 0, L = L + Math.imul(ve, ze) | 0, _ = _ + Math.imul(ve, Ve) | 0, _ = _ + Math.imul(me, ze) | 0, U = U + Math.imul(me, Ve) | 0, L = L + Math.imul(Se, Ge) | 0, _ = _ + Math.imul(Se, $e) | 0, _ = _ + Math.imul(de, Ge) | 0, U = U + Math.imul(de, $e) | 0, L = L + Math.imul(ce, We) | 0, _ = _ + Math.imul(ce, Ye) | 0, _ = _ + Math.imul(ge, We) | 0, U = U + Math.imul(ge, Ye) | 0, L = L + Math.imul(ie, Je) | 0, _ = _ + Math.imul(ie, Xe) | 0, _ = _ + Math.imul(ue, Je) | 0, U = U + Math.imul(ue, Xe) | 0, L = L + Math.imul(D, Qe) | 0, _ = _ + Math.imul(D, Ze) | 0, _ = _ + Math.imul(T, Qe) | 0, U = U + Math.imul(T, Ze) | 0, L = L + Math.imul(M, et) | 0, _ = _ + Math.imul(M, tt) | 0, _ = _ + Math.imul(Y, et) | 0, U = U + Math.imul(Y, tt) | 0, L = L + Math.imul(se, rt) | 0, _ = _ + Math.imul(se, it) | 0, _ = _ + Math.imul(V, rt) | 0, U = U + Math.imul(V, it) | 0;
|
|
593
593
|
var Jr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
594
|
-
K = (U + (_ >>> 13) | 0) + (Jr >>> 26) | 0, Jr &= 67108863, L = Math.imul(X, we), _ = Math.imul(X, ye), _ = _ + Math.imul(
|
|
594
|
+
K = (U + (_ >>> 13) | 0) + (Jr >>> 26) | 0, Jr &= 67108863, L = Math.imul(X, we), _ = Math.imul(X, ye), _ = _ + Math.imul(Z, we) | 0, U = Math.imul(Z, ye), L = L + Math.imul(S, le) | 0, _ = _ + Math.imul(S, je) | 0, _ = _ + Math.imul(H, le) | 0, U = U + Math.imul(H, je) | 0, L = L + Math.imul(Pe, ze) | 0, _ = _ + Math.imul(Pe, Ve) | 0, _ = _ + Math.imul(N, ze) | 0, U = U + Math.imul(N, Ve) | 0, L = L + Math.imul(ve, Ge) | 0, _ = _ + Math.imul(ve, $e) | 0, _ = _ + Math.imul(me, Ge) | 0, U = U + Math.imul(me, $e) | 0, L = L + Math.imul(Se, We) | 0, _ = _ + Math.imul(Se, Ye) | 0, _ = _ + Math.imul(de, We) | 0, U = U + Math.imul(de, Ye) | 0, L = L + Math.imul(ce, Je) | 0, _ = _ + Math.imul(ce, Xe) | 0, _ = _ + Math.imul(ge, Je) | 0, U = U + Math.imul(ge, Xe) | 0, L = L + Math.imul(ie, Qe) | 0, _ = _ + Math.imul(ie, Ze) | 0, _ = _ + Math.imul(ue, Qe) | 0, U = U + Math.imul(ue, Ze) | 0, L = L + Math.imul(D, et) | 0, _ = _ + Math.imul(D, tt) | 0, _ = _ + Math.imul(T, et) | 0, U = U + Math.imul(T, tt) | 0, L = L + Math.imul(M, rt) | 0, _ = _ + Math.imul(M, it) | 0, _ = _ + Math.imul(Y, rt) | 0, U = U + Math.imul(Y, it) | 0, L = L + Math.imul(se, nt) | 0, _ = _ + Math.imul(se, at) | 0, _ = _ + Math.imul(V, nt) | 0, U = U + Math.imul(V, at) | 0;
|
|
595
595
|
var Xr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
596
|
-
K = (U + (_ >>> 13) | 0) + (Xr >>> 26) | 0, Xr &= 67108863, L = Math.imul(X, le), _ = Math.imul(X, je), _ = _ + Math.imul(
|
|
596
|
+
K = (U + (_ >>> 13) | 0) + (Xr >>> 26) | 0, Xr &= 67108863, L = Math.imul(X, le), _ = Math.imul(X, je), _ = _ + Math.imul(Z, le) | 0, U = Math.imul(Z, je), L = L + Math.imul(S, ze) | 0, _ = _ + Math.imul(S, Ve) | 0, _ = _ + Math.imul(H, ze) | 0, U = U + Math.imul(H, Ve) | 0, L = L + Math.imul(Pe, Ge) | 0, _ = _ + Math.imul(Pe, $e) | 0, _ = _ + Math.imul(N, Ge) | 0, U = U + Math.imul(N, $e) | 0, L = L + Math.imul(ve, We) | 0, _ = _ + Math.imul(ve, Ye) | 0, _ = _ + Math.imul(me, We) | 0, U = U + Math.imul(me, Ye) | 0, L = L + Math.imul(Se, Je) | 0, _ = _ + Math.imul(Se, Xe) | 0, _ = _ + Math.imul(de, Je) | 0, U = U + Math.imul(de, Xe) | 0, L = L + Math.imul(ce, Qe) | 0, _ = _ + Math.imul(ce, Ze) | 0, _ = _ + Math.imul(ge, Qe) | 0, U = U + Math.imul(ge, Ze) | 0, L = L + Math.imul(ie, et) | 0, _ = _ + Math.imul(ie, tt) | 0, _ = _ + Math.imul(ue, et) | 0, U = U + Math.imul(ue, tt) | 0, L = L + Math.imul(D, rt) | 0, _ = _ + Math.imul(D, it) | 0, _ = _ + Math.imul(T, rt) | 0, U = U + Math.imul(T, it) | 0, L = L + Math.imul(M, nt) | 0, _ = _ + Math.imul(M, at) | 0, _ = _ + Math.imul(Y, nt) | 0, U = U + Math.imul(Y, at) | 0;
|
|
597
597
|
var Qr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
598
|
-
K = (U + (_ >>> 13) | 0) + (Qr >>> 26) | 0, Qr &= 67108863, L = Math.imul(X, ze), _ = Math.imul(X, Ve), _ = _ + Math.imul(
|
|
598
|
+
K = (U + (_ >>> 13) | 0) + (Qr >>> 26) | 0, Qr &= 67108863, L = Math.imul(X, ze), _ = Math.imul(X, Ve), _ = _ + Math.imul(Z, ze) | 0, U = Math.imul(Z, Ve), L = L + Math.imul(S, Ge) | 0, _ = _ + Math.imul(S, $e) | 0, _ = _ + Math.imul(H, Ge) | 0, U = U + Math.imul(H, $e) | 0, L = L + Math.imul(Pe, We) | 0, _ = _ + Math.imul(Pe, Ye) | 0, _ = _ + Math.imul(N, We) | 0, U = U + Math.imul(N, Ye) | 0, L = L + Math.imul(ve, Je) | 0, _ = _ + Math.imul(ve, Xe) | 0, _ = _ + Math.imul(me, Je) | 0, U = U + Math.imul(me, Xe) | 0, L = L + Math.imul(Se, Qe) | 0, _ = _ + Math.imul(Se, Ze) | 0, _ = _ + Math.imul(de, Qe) | 0, U = U + Math.imul(de, Ze) | 0, L = L + Math.imul(ce, et) | 0, _ = _ + Math.imul(ce, tt) | 0, _ = _ + Math.imul(ge, et) | 0, U = U + Math.imul(ge, tt) | 0, L = L + Math.imul(ie, rt) | 0, _ = _ + Math.imul(ie, it) | 0, _ = _ + Math.imul(ue, rt) | 0, U = U + Math.imul(ue, it) | 0, L = L + Math.imul(D, nt) | 0, _ = _ + Math.imul(D, at) | 0, _ = _ + Math.imul(T, nt) | 0, U = U + Math.imul(T, at) | 0;
|
|
599
599
|
var Zr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
600
|
-
K = (U + (_ >>> 13) | 0) + (Zr >>> 26) | 0, Zr &= 67108863, L = Math.imul(X, Ge), _ = Math.imul(X, $e), _ = _ + Math.imul(
|
|
600
|
+
K = (U + (_ >>> 13) | 0) + (Zr >>> 26) | 0, Zr &= 67108863, L = Math.imul(X, Ge), _ = Math.imul(X, $e), _ = _ + Math.imul(Z, Ge) | 0, U = Math.imul(Z, $e), L = L + Math.imul(S, We) | 0, _ = _ + Math.imul(S, Ye) | 0, _ = _ + Math.imul(H, We) | 0, U = U + Math.imul(H, Ye) | 0, L = L + Math.imul(Pe, Je) | 0, _ = _ + Math.imul(Pe, Xe) | 0, _ = _ + Math.imul(N, Je) | 0, U = U + Math.imul(N, Xe) | 0, L = L + Math.imul(ve, Qe) | 0, _ = _ + Math.imul(ve, Ze) | 0, _ = _ + Math.imul(me, Qe) | 0, U = U + Math.imul(me, Ze) | 0, L = L + Math.imul(Se, et) | 0, _ = _ + Math.imul(Se, tt) | 0, _ = _ + Math.imul(de, et) | 0, U = U + Math.imul(de, tt) | 0, L = L + Math.imul(ce, rt) | 0, _ = _ + Math.imul(ce, it) | 0, _ = _ + Math.imul(ge, rt) | 0, U = U + Math.imul(ge, it) | 0, L = L + Math.imul(ie, nt) | 0, _ = _ + Math.imul(ie, at) | 0, _ = _ + Math.imul(ue, nt) | 0, U = U + Math.imul(ue, at) | 0;
|
|
601
601
|
var ei = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
602
|
-
K = (U + (_ >>> 13) | 0) + (ei >>> 26) | 0, ei &= 67108863, L = Math.imul(X, We), _ = Math.imul(X, Ye), _ = _ + Math.imul(
|
|
602
|
+
K = (U + (_ >>> 13) | 0) + (ei >>> 26) | 0, ei &= 67108863, L = Math.imul(X, We), _ = Math.imul(X, Ye), _ = _ + Math.imul(Z, We) | 0, U = Math.imul(Z, Ye), L = L + Math.imul(S, Je) | 0, _ = _ + Math.imul(S, Xe) | 0, _ = _ + Math.imul(H, Je) | 0, U = U + Math.imul(H, Xe) | 0, L = L + Math.imul(Pe, Qe) | 0, _ = _ + Math.imul(Pe, Ze) | 0, _ = _ + Math.imul(N, Qe) | 0, U = U + Math.imul(N, Ze) | 0, L = L + Math.imul(ve, et) | 0, _ = _ + Math.imul(ve, tt) | 0, _ = _ + Math.imul(me, et) | 0, U = U + Math.imul(me, tt) | 0, L = L + Math.imul(Se, rt) | 0, _ = _ + Math.imul(Se, it) | 0, _ = _ + Math.imul(de, rt) | 0, U = U + Math.imul(de, it) | 0, L = L + Math.imul(ce, nt) | 0, _ = _ + Math.imul(ce, at) | 0, _ = _ + Math.imul(ge, nt) | 0, U = U + Math.imul(ge, at) | 0;
|
|
603
603
|
var ti = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
604
|
-
K = (U + (_ >>> 13) | 0) + (ti >>> 26) | 0, ti &= 67108863, L = Math.imul(X, Je), _ = Math.imul(X, Xe), _ = _ + Math.imul(
|
|
604
|
+
K = (U + (_ >>> 13) | 0) + (ti >>> 26) | 0, ti &= 67108863, L = Math.imul(X, Je), _ = Math.imul(X, Xe), _ = _ + Math.imul(Z, Je) | 0, U = Math.imul(Z, Xe), L = L + Math.imul(S, Qe) | 0, _ = _ + Math.imul(S, Ze) | 0, _ = _ + Math.imul(H, Qe) | 0, U = U + Math.imul(H, Ze) | 0, L = L + Math.imul(Pe, et) | 0, _ = _ + Math.imul(Pe, tt) | 0, _ = _ + Math.imul(N, et) | 0, U = U + Math.imul(N, tt) | 0, L = L + Math.imul(ve, rt) | 0, _ = _ + Math.imul(ve, it) | 0, _ = _ + Math.imul(me, rt) | 0, U = U + Math.imul(me, it) | 0, L = L + Math.imul(Se, nt) | 0, _ = _ + Math.imul(Se, at) | 0, _ = _ + Math.imul(de, nt) | 0, U = U + Math.imul(de, at) | 0;
|
|
605
605
|
var ri = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
606
|
-
K = (U + (_ >>> 13) | 0) + (ri >>> 26) | 0, ri &= 67108863, L = Math.imul(X, Qe), _ = Math.imul(X, Ze), _ = _ + Math.imul(
|
|
606
|
+
K = (U + (_ >>> 13) | 0) + (ri >>> 26) | 0, ri &= 67108863, L = Math.imul(X, Qe), _ = Math.imul(X, Ze), _ = _ + Math.imul(Z, Qe) | 0, U = Math.imul(Z, Ze), L = L + Math.imul(S, et) | 0, _ = _ + Math.imul(S, tt) | 0, _ = _ + Math.imul(H, et) | 0, U = U + Math.imul(H, tt) | 0, L = L + Math.imul(Pe, rt) | 0, _ = _ + Math.imul(Pe, it) | 0, _ = _ + Math.imul(N, rt) | 0, U = U + Math.imul(N, it) | 0, L = L + Math.imul(ve, nt) | 0, _ = _ + Math.imul(ve, at) | 0, _ = _ + Math.imul(me, nt) | 0, U = U + Math.imul(me, at) | 0;
|
|
607
607
|
var ii = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
608
|
-
K = (U + (_ >>> 13) | 0) + (ii >>> 26) | 0, ii &= 67108863, L = Math.imul(X, et), _ = Math.imul(X, tt), _ = _ + Math.imul(
|
|
608
|
+
K = (U + (_ >>> 13) | 0) + (ii >>> 26) | 0, ii &= 67108863, L = Math.imul(X, et), _ = Math.imul(X, tt), _ = _ + Math.imul(Z, et) | 0, U = Math.imul(Z, tt), L = L + Math.imul(S, rt) | 0, _ = _ + Math.imul(S, it) | 0, _ = _ + Math.imul(H, rt) | 0, U = U + Math.imul(H, it) | 0, L = L + Math.imul(Pe, nt) | 0, _ = _ + Math.imul(Pe, at) | 0, _ = _ + Math.imul(N, nt) | 0, U = U + Math.imul(N, at) | 0;
|
|
609
609
|
var ni = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
610
|
-
K = (U + (_ >>> 13) | 0) + (ni >>> 26) | 0, ni &= 67108863, L = Math.imul(X, rt), _ = Math.imul(X, it), _ = _ + Math.imul(
|
|
610
|
+
K = (U + (_ >>> 13) | 0) + (ni >>> 26) | 0, ni &= 67108863, L = Math.imul(X, rt), _ = Math.imul(X, it), _ = _ + Math.imul(Z, rt) | 0, U = Math.imul(Z, it), L = L + Math.imul(S, nt) | 0, _ = _ + Math.imul(S, at) | 0, _ = _ + Math.imul(H, nt) | 0, U = U + Math.imul(H, at) | 0;
|
|
611
611
|
var ai = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
612
|
-
K = (U + (_ >>> 13) | 0) + (ai >>> 26) | 0, ai &= 67108863, L = Math.imul(X, nt), _ = Math.imul(X, at), _ = _ + Math.imul(
|
|
612
|
+
K = (U + (_ >>> 13) | 0) + (ai >>> 26) | 0, ai &= 67108863, L = Math.imul(X, nt), _ = Math.imul(X, at), _ = _ + Math.imul(Z, nt) | 0, U = Math.imul(Z, at);
|
|
613
613
|
var fi = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
614
614
|
return K = (U + (_ >>> 13) | 0) + (fi >>> 26) | 0, fi &= 67108863, F[0] = Kr, F[1] = jr, F[2] = zr, F[3] = Vr, F[4] = Gr, F[5] = $r, F[6] = Wr, F[7] = Yr, F[8] = Jr, F[9] = Xr, F[10] = Qr, F[11] = Zr, F[12] = ei, F[13] = ti, F[14] = ri, F[15] = ii, F[16] = ni, F[17] = ai, F[18] = fi, K !== 0 && (F[19] = K, O.length++), O;
|
|
615
615
|
};
|
|
@@ -1671,7 +1671,7 @@ function St() {
|
|
|
1671
1671
|
);
|
|
1672
1672
|
if (w === S) return 0;
|
|
1673
1673
|
let H = w.length, W = S.length;
|
|
1674
|
-
for (let X = 0,
|
|
1674
|
+
for (let X = 0, Z = Math.min(H, W); X < Z; ++X)
|
|
1675
1675
|
if (w[X] !== S[X]) {
|
|
1676
1676
|
H = w[X], W = S[X];
|
|
1677
1677
|
break;
|
|
@@ -1706,18 +1706,18 @@ function St() {
|
|
|
1706
1706
|
const W = a.allocUnsafe(S);
|
|
1707
1707
|
let X = 0;
|
|
1708
1708
|
for (H = 0; H < w.length; ++H) {
|
|
1709
|
-
let
|
|
1710
|
-
if (Be(
|
|
1711
|
-
X +
|
|
1709
|
+
let Z = w[H];
|
|
1710
|
+
if (Be(Z, Uint8Array))
|
|
1711
|
+
X + Z.length > W.length ? (a.isBuffer(Z) || (Z = a.from(Z)), Z.copy(W, X)) : Uint8Array.prototype.set.call(
|
|
1712
1712
|
W,
|
|
1713
|
-
|
|
1713
|
+
Z,
|
|
1714
1714
|
X
|
|
1715
1715
|
);
|
|
1716
|
-
else if (a.isBuffer(
|
|
1717
|
-
|
|
1716
|
+
else if (a.isBuffer(Z))
|
|
1717
|
+
Z.copy(W, X);
|
|
1718
1718
|
else
|
|
1719
1719
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1720
|
-
X +=
|
|
1720
|
+
X += Z.length;
|
|
1721
1721
|
}
|
|
1722
1722
|
return W;
|
|
1723
1723
|
};
|
|
@@ -1836,14 +1836,14 @@ function St() {
|
|
|
1836
1836
|
if (S >= H)
|
|
1837
1837
|
return 1;
|
|
1838
1838
|
if (S >>>= 0, H >>>= 0, W >>>= 0, X >>>= 0, this === w) return 0;
|
|
1839
|
-
let
|
|
1840
|
-
const we = Math.min(
|
|
1839
|
+
let Z = X - W, Ee = H - S;
|
|
1840
|
+
const we = Math.min(Z, Ee), ye = this.slice(W, X), De = w.slice(S, H);
|
|
1841
1841
|
for (let le = 0; le < we; ++le)
|
|
1842
1842
|
if (ye[le] !== De[le]) {
|
|
1843
|
-
|
|
1843
|
+
Z = ye[le], Ee = De[le];
|
|
1844
1844
|
break;
|
|
1845
1845
|
}
|
|
1846
|
-
return
|
|
1846
|
+
return Z < Ee ? -1 : Ee < Z ? 1 : 0;
|
|
1847
1847
|
};
|
|
1848
1848
|
function C(N, w, S, H, W) {
|
|
1849
1849
|
if (N.length === 0) return -1;
|
|
@@ -1860,11 +1860,11 @@ function St() {
|
|
|
1860
1860
|
throw new TypeError("val must be string, number or Buffer");
|
|
1861
1861
|
}
|
|
1862
1862
|
function j(N, w, S, H, W) {
|
|
1863
|
-
let X = 1,
|
|
1863
|
+
let X = 1, Z = N.length, Ee = w.length;
|
|
1864
1864
|
if (H !== void 0 && (H = String(H).toLowerCase(), H === "ucs2" || H === "ucs-2" || H === "utf16le" || H === "utf-16le")) {
|
|
1865
1865
|
if (N.length < 2 || w.length < 2)
|
|
1866
1866
|
return -1;
|
|
1867
|
-
X = 2,
|
|
1867
|
+
X = 2, Z /= 2, Ee /= 2, S /= 2;
|
|
1868
1868
|
}
|
|
1869
1869
|
function we(De, le) {
|
|
1870
1870
|
return X === 1 ? De[le] : De.readUInt16BE(le * X);
|
|
@@ -1872,13 +1872,13 @@ function St() {
|
|
|
1872
1872
|
let ye;
|
|
1873
1873
|
if (W) {
|
|
1874
1874
|
let De = -1;
|
|
1875
|
-
for (ye = S; ye <
|
|
1875
|
+
for (ye = S; ye < Z; ye++)
|
|
1876
1876
|
if (we(N, ye) === we(w, De === -1 ? 0 : ye - De)) {
|
|
1877
1877
|
if (De === -1 && (De = ye), ye - De + 1 === Ee) return De * X;
|
|
1878
1878
|
} else
|
|
1879
1879
|
De !== -1 && (ye -= ye - De), De = -1;
|
|
1880
1880
|
} else
|
|
1881
|
-
for (S + Ee >
|
|
1881
|
+
for (S + Ee > Z && (S = Z - Ee), ye = S; ye >= 0; ye--) {
|
|
1882
1882
|
let De = !0;
|
|
1883
1883
|
for (let le = 0; le < Ee; le++)
|
|
1884
1884
|
if (we(N, ye + le) !== we(w, le)) {
|
|
@@ -1902,13 +1902,13 @@ function St() {
|
|
|
1902
1902
|
H ? (H = Number(H), H > W && (H = W)) : H = W;
|
|
1903
1903
|
const X = w.length;
|
|
1904
1904
|
H > X / 2 && (H = X / 2);
|
|
1905
|
-
let
|
|
1906
|
-
for (
|
|
1907
|
-
const Ee = parseInt(w.substr(
|
|
1908
|
-
if (ve(Ee)) return
|
|
1909
|
-
N[S +
|
|
1905
|
+
let Z;
|
|
1906
|
+
for (Z = 0; Z < H; ++Z) {
|
|
1907
|
+
const Ee = parseInt(w.substr(Z * 2, 2), 16);
|
|
1908
|
+
if (ve(Ee)) return Z;
|
|
1909
|
+
N[S + Z] = Ee;
|
|
1910
1910
|
}
|
|
1911
|
-
return
|
|
1911
|
+
return Z;
|
|
1912
1912
|
}
|
|
1913
1913
|
function z(N, w, S, H) {
|
|
1914
1914
|
return de(ce(w, N.length - S), N, S, H);
|
|
@@ -1937,7 +1937,7 @@ function St() {
|
|
|
1937
1937
|
if ((H === void 0 || H > X) && (H = X), w.length > 0 && (H < 0 || S < 0) || S > this.length)
|
|
1938
1938
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1939
1939
|
W || (W = "utf8");
|
|
1940
|
-
let
|
|
1940
|
+
let Z = !1;
|
|
1941
1941
|
for (; ; )
|
|
1942
1942
|
switch (W) {
|
|
1943
1943
|
case "hex":
|
|
@@ -1957,8 +1957,8 @@ function St() {
|
|
|
1957
1957
|
case "utf-16le":
|
|
1958
1958
|
return $(this, w, S, H);
|
|
1959
1959
|
default:
|
|
1960
|
-
if (
|
|
1961
|
-
W = ("" + W).toLowerCase(),
|
|
1960
|
+
if (Z) throw new TypeError("Unknown encoding: " + W);
|
|
1961
|
+
W = ("" + W).toLowerCase(), Z = !0;
|
|
1962
1962
|
}
|
|
1963
1963
|
}, a.prototype.toJSON = function() {
|
|
1964
1964
|
return {
|
|
@@ -1975,24 +1975,24 @@ function St() {
|
|
|
1975
1975
|
let W = w;
|
|
1976
1976
|
for (; W < S; ) {
|
|
1977
1977
|
const X = N[W];
|
|
1978
|
-
let
|
|
1978
|
+
let Z = null, Ee = X > 239 ? 4 : X > 223 ? 3 : X > 191 ? 2 : 1;
|
|
1979
1979
|
if (W + Ee <= S) {
|
|
1980
1980
|
let we, ye, De, le;
|
|
1981
1981
|
switch (Ee) {
|
|
1982
1982
|
case 1:
|
|
1983
|
-
X < 128 && (
|
|
1983
|
+
X < 128 && (Z = X);
|
|
1984
1984
|
break;
|
|
1985
1985
|
case 2:
|
|
1986
|
-
we = N[W + 1], (we & 192) === 128 && (le = (X & 31) << 6 | we & 63, le > 127 && (
|
|
1986
|
+
we = N[W + 1], (we & 192) === 128 && (le = (X & 31) << 6 | we & 63, le > 127 && (Z = le));
|
|
1987
1987
|
break;
|
|
1988
1988
|
case 3:
|
|
1989
|
-
we = N[W + 1], ye = N[W + 2], (we & 192) === 128 && (ye & 192) === 128 && (le = (X & 15) << 12 | (we & 63) << 6 | ye & 63, le > 2047 && (le < 55296 || le > 57343) && (
|
|
1989
|
+
we = N[W + 1], ye = N[W + 2], (we & 192) === 128 && (ye & 192) === 128 && (le = (X & 15) << 12 | (we & 63) << 6 | ye & 63, le > 2047 && (le < 55296 || le > 57343) && (Z = le));
|
|
1990
1990
|
break;
|
|
1991
1991
|
case 4:
|
|
1992
|
-
we = N[W + 1], ye = N[W + 2], De = N[W + 3], (we & 192) === 128 && (ye & 192) === 128 && (De & 192) === 128 && (le = (X & 15) << 18 | (we & 63) << 12 | (ye & 63) << 6 | De & 63, le > 65535 && le < 1114112 && (
|
|
1992
|
+
we = N[W + 1], ye = N[W + 2], De = N[W + 3], (we & 192) === 128 && (ye & 192) === 128 && (De & 192) === 128 && (le = (X & 15) << 18 | (we & 63) << 12 | (ye & 63) << 6 | De & 63, le > 65535 && le < 1114112 && (Z = le));
|
|
1993
1993
|
}
|
|
1994
1994
|
}
|
|
1995
|
-
|
|
1995
|
+
Z === null ? (Z = 65533, Ee = 1) : Z > 65535 && (Z -= 65536, H.push(Z >>> 10 & 1023 | 55296), Z = 56320 | Z & 1023), H.push(Z), W += Ee;
|
|
1996
1996
|
}
|
|
1997
1997
|
return O(H);
|
|
1998
1998
|
}
|
|
@@ -2050,9 +2050,9 @@ function St() {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
a.prototype.readUintLE = a.prototype.readUIntLE = function(w, S, H) {
|
|
2052
2052
|
w = w >>> 0, S = S >>> 0, H || L(w, S, this.length);
|
|
2053
|
-
let W = this[w], X = 1,
|
|
2054
|
-
for (; ++
|
|
2055
|
-
W += this[w +
|
|
2053
|
+
let W = this[w], X = 1, Z = 0;
|
|
2054
|
+
for (; ++Z < S && (X *= 256); )
|
|
2055
|
+
W += this[w + Z] * X;
|
|
2056
2056
|
return W;
|
|
2057
2057
|
}, a.prototype.readUintBE = a.prototype.readUIntBE = function(w, S, H) {
|
|
2058
2058
|
w = w >>> 0, S = S >>> 0, H || L(w, S, this.length);
|
|
@@ -2084,16 +2084,16 @@ function St() {
|
|
|
2084
2084
|
return (BigInt(W) << BigInt(32)) + BigInt(X);
|
|
2085
2085
|
}), a.prototype.readIntLE = function(w, S, H) {
|
|
2086
2086
|
w = w >>> 0, S = S >>> 0, H || L(w, S, this.length);
|
|
2087
|
-
let W = this[w], X = 1,
|
|
2088
|
-
for (; ++
|
|
2089
|
-
W += this[w +
|
|
2087
|
+
let W = this[w], X = 1, Z = 0;
|
|
2088
|
+
for (; ++Z < S && (X *= 256); )
|
|
2089
|
+
W += this[w + Z] * X;
|
|
2090
2090
|
return X *= 128, W >= X && (W -= Math.pow(2, 8 * S)), W;
|
|
2091
2091
|
}, a.prototype.readIntBE = function(w, S, H) {
|
|
2092
2092
|
w = w >>> 0, S = S >>> 0, H || L(w, S, this.length);
|
|
2093
|
-
let W = S, X = 1,
|
|
2093
|
+
let W = S, X = 1, Z = this[w + --W];
|
|
2094
2094
|
for (; W > 0 && (X *= 256); )
|
|
2095
|
-
|
|
2096
|
-
return X *= 128,
|
|
2095
|
+
Z += this[w + --W] * X;
|
|
2096
|
+
return X *= 128, Z >= X && (Z -= Math.pow(2, 8 * S)), Z;
|
|
2097
2097
|
}, a.prototype.readInt8 = function(w, S) {
|
|
2098
2098
|
return w = w >>> 0, S || L(w, 1, this.length), this[w] & 128 ? (255 - this[w] + 1) * -1 : this[w];
|
|
2099
2099
|
}, a.prototype.readInt16LE = function(w, S) {
|
|
@@ -2140,18 +2140,18 @@ function St() {
|
|
|
2140
2140
|
const Ee = Math.pow(2, 8 * H) - 1;
|
|
2141
2141
|
_(this, w, S, H, Ee, 0);
|
|
2142
2142
|
}
|
|
2143
|
-
let X = 1,
|
|
2144
|
-
for (this[S] = w & 255; ++
|
|
2145
|
-
this[S +
|
|
2143
|
+
let X = 1, Z = 0;
|
|
2144
|
+
for (this[S] = w & 255; ++Z < H && (X *= 256); )
|
|
2145
|
+
this[S + Z] = w / X & 255;
|
|
2146
2146
|
return S + H;
|
|
2147
2147
|
}, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(w, S, H, W) {
|
|
2148
2148
|
if (w = +w, S = S >>> 0, H = H >>> 0, !W) {
|
|
2149
2149
|
const Ee = Math.pow(2, 8 * H) - 1;
|
|
2150
2150
|
_(this, w, S, H, Ee, 0);
|
|
2151
2151
|
}
|
|
2152
|
-
let X = H - 1,
|
|
2153
|
-
for (this[S + X] = w & 255; --X >= 0 && (
|
|
2154
|
-
this[S + X] = w /
|
|
2152
|
+
let X = H - 1, Z = 1;
|
|
2153
|
+
for (this[S + X] = w & 255; --X >= 0 && (Z *= 256); )
|
|
2154
|
+
this[S + X] = w / Z & 255;
|
|
2155
2155
|
return S + H;
|
|
2156
2156
|
}, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(w, S, H) {
|
|
2157
2157
|
return w = +w, S = S >>> 0, H || _(this, w, S, 1, 255, 0), this[S] = w & 255, S + 1;
|
|
@@ -2168,15 +2168,15 @@ function St() {
|
|
|
2168
2168
|
T(w, H, W, N, S, 7);
|
|
2169
2169
|
let X = Number(w & BigInt(4294967295));
|
|
2170
2170
|
N[S++] = X, X = X >> 8, N[S++] = X, X = X >> 8, N[S++] = X, X = X >> 8, N[S++] = X;
|
|
2171
|
-
let
|
|
2172
|
-
return N[S++] =
|
|
2171
|
+
let Z = Number(w >> BigInt(32) & BigInt(4294967295));
|
|
2172
|
+
return N[S++] = Z, Z = Z >> 8, N[S++] = Z, Z = Z >> 8, N[S++] = Z, Z = Z >> 8, N[S++] = Z, S;
|
|
2173
2173
|
}
|
|
2174
2174
|
function fe(N, w, S, H, W) {
|
|
2175
2175
|
T(w, H, W, N, S, 7);
|
|
2176
2176
|
let X = Number(w & BigInt(4294967295));
|
|
2177
2177
|
N[S + 7] = X, X = X >> 8, N[S + 6] = X, X = X >> 8, N[S + 5] = X, X = X >> 8, N[S + 4] = X;
|
|
2178
|
-
let
|
|
2179
|
-
return N[S + 3] =
|
|
2178
|
+
let Z = Number(w >> BigInt(32) & BigInt(4294967295));
|
|
2179
|
+
return N[S + 3] = Z, Z = Z >> 8, N[S + 2] = Z, Z = Z >> 8, N[S + 1] = Z, Z = Z >> 8, N[S] = Z, S + 8;
|
|
2180
2180
|
}
|
|
2181
2181
|
a.prototype.writeBigUInt64LE = Le(function(w, S = 0) {
|
|
2182
2182
|
return U(this, w, S, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
@@ -2187,18 +2187,18 @@ function St() {
|
|
|
2187
2187
|
const we = Math.pow(2, 8 * H - 1);
|
|
2188
2188
|
_(this, w, S, H, we - 1, -we);
|
|
2189
2189
|
}
|
|
2190
|
-
let X = 0,
|
|
2191
|
-
for (this[S] = w & 255; ++X < H && (
|
|
2192
|
-
w < 0 && Ee === 0 && this[S + X - 1] !== 0 && (Ee = 1), this[S + X] = (w /
|
|
2190
|
+
let X = 0, Z = 1, Ee = 0;
|
|
2191
|
+
for (this[S] = w & 255; ++X < H && (Z *= 256); )
|
|
2192
|
+
w < 0 && Ee === 0 && this[S + X - 1] !== 0 && (Ee = 1), this[S + X] = (w / Z >> 0) - Ee & 255;
|
|
2193
2193
|
return S + H;
|
|
2194
2194
|
}, a.prototype.writeIntBE = function(w, S, H, W) {
|
|
2195
2195
|
if (w = +w, S = S >>> 0, !W) {
|
|
2196
2196
|
const we = Math.pow(2, 8 * H - 1);
|
|
2197
2197
|
_(this, w, S, H, we - 1, -we);
|
|
2198
2198
|
}
|
|
2199
|
-
let X = H - 1,
|
|
2200
|
-
for (this[S + X] = w & 255; --X >= 0 && (
|
|
2201
|
-
w < 0 && Ee === 0 && this[S + X + 1] !== 0 && (Ee = 1), this[S + X] = (w /
|
|
2199
|
+
let X = H - 1, Z = 1, Ee = 0;
|
|
2200
|
+
for (this[S + X] = w & 255; --X >= 0 && (Z *= 256); )
|
|
2201
|
+
w < 0 && Ee === 0 && this[S + X + 1] !== 0 && (Ee = 1), this[S + X] = (w / Z >> 0) - Ee & 255;
|
|
2202
2202
|
return S + H;
|
|
2203
2203
|
}, a.prototype.writeInt8 = function(w, S, H) {
|
|
2204
2204
|
return w = +w, S = S >>> 0, H || _(this, w, S, 1, 127, -128), w < 0 && (w = 255 + w + 1), this[S] = w & 255, S + 1;
|
|
@@ -2255,8 +2255,8 @@ function St() {
|
|
|
2255
2255
|
if (typeof W == "string" && !a.isEncoding(W))
|
|
2256
2256
|
throw new TypeError("Unknown encoding: " + W);
|
|
2257
2257
|
if (w.length === 1) {
|
|
2258
|
-
const
|
|
2259
|
-
(W === "utf8" &&
|
|
2258
|
+
const Z = w.charCodeAt(0);
|
|
2259
|
+
(W === "utf8" && Z < 128 || W === "latin1") && (w = Z);
|
|
2260
2260
|
}
|
|
2261
2261
|
} else typeof w == "number" ? w = w & 255 : typeof w == "boolean" && (w = Number(w));
|
|
2262
2262
|
if (S < 0 || this.length < S || this.length < H)
|
|
@@ -2269,11 +2269,11 @@ function St() {
|
|
|
2269
2269
|
for (X = S; X < H; ++X)
|
|
2270
2270
|
this[X] = w;
|
|
2271
2271
|
else {
|
|
2272
|
-
const
|
|
2272
|
+
const Z = a.isBuffer(w) ? w : a.from(w, W), Ee = Z.length;
|
|
2273
2273
|
if (Ee === 0)
|
|
2274
2274
|
throw new TypeError('The value "' + w + '" is invalid for argument "value"');
|
|
2275
2275
|
for (X = 0; X < H - S; ++X)
|
|
2276
|
-
this[X + S] =
|
|
2276
|
+
this[X + S] = Z[X % Ee];
|
|
2277
2277
|
}
|
|
2278
2278
|
return this;
|
|
2279
2279
|
};
|
|
@@ -2335,9 +2335,9 @@ function St() {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
function T(N, w, S, H, W, X) {
|
|
2337
2337
|
if (N > S || N < w) {
|
|
2338
|
-
const
|
|
2338
|
+
const Z = typeof w == "bigint" ? "n" : "";
|
|
2339
2339
|
let Ee;
|
|
2340
|
-
throw w === 0 || w === BigInt(0) ? Ee = `>= 0${
|
|
2340
|
+
throw w === 0 || w === BigInt(0) ? Ee = `>= 0${Z} and < 2${Z} ** ${(X + 1) * 8}${Z}` : Ee = `>= -(2${Z} ** ${(X + 1) * 8 - 1}${Z}) and < 2 ** ${(X + 1) * 8 - 1}${Z}`, new M.ERR_OUT_OF_RANGE("value", Ee, N);
|
|
2341
2341
|
}
|
|
2342
2342
|
D(H, W, X);
|
|
2343
2343
|
}
|
|
@@ -2365,13 +2365,13 @@ function St() {
|
|
|
2365
2365
|
const H = N.length;
|
|
2366
2366
|
let W = null;
|
|
2367
2367
|
const X = [];
|
|
2368
|
-
for (let
|
|
2369
|
-
if (S = N.charCodeAt(
|
|
2368
|
+
for (let Z = 0; Z < H; ++Z) {
|
|
2369
|
+
if (S = N.charCodeAt(Z), S > 55295 && S < 57344) {
|
|
2370
2370
|
if (!W) {
|
|
2371
2371
|
if (S > 56319) {
|
|
2372
2372
|
(w -= 3) > -1 && X.push(239, 191, 189);
|
|
2373
2373
|
continue;
|
|
2374
|
-
} else if (
|
|
2374
|
+
} else if (Z + 1 === H) {
|
|
2375
2375
|
(w -= 3) > -1 && X.push(239, 191, 189);
|
|
2376
2376
|
continue;
|
|
2377
2377
|
}
|
|
@@ -2422,8 +2422,8 @@ function St() {
|
|
|
2422
2422
|
function Ke(N, w) {
|
|
2423
2423
|
let S, H, W;
|
|
2424
2424
|
const X = [];
|
|
2425
|
-
for (let
|
|
2426
|
-
S = N.charCodeAt(
|
|
2425
|
+
for (let Z = 0; Z < N.length && !((w -= 2) < 0); ++Z)
|
|
2426
|
+
S = N.charCodeAt(Z), H = S >> 8, W = S % 256, X.push(W), X.push(H);
|
|
2427
2427
|
return X;
|
|
2428
2428
|
}
|
|
2429
2429
|
function Se(N) {
|
|
@@ -9992,12 +9992,12 @@ function ud() {
|
|
|
9992
9992
|
e.base = qr(), e.short = Rl(), e.mont = Il(), e.edwards = Al();
|
|
9993
9993
|
})(Na)), Na;
|
|
9994
9994
|
}
|
|
9995
|
-
var Da = {}, Fa = {},
|
|
9995
|
+
var Da = {}, Fa = {}, Me = {}, lu;
|
|
9996
9996
|
function Bt() {
|
|
9997
|
-
if (lu) return
|
|
9997
|
+
if (lu) return Me;
|
|
9998
9998
|
lu = 1;
|
|
9999
9999
|
var l = lt(), e = pe();
|
|
10000
|
-
|
|
10000
|
+
Me.inherits = e;
|
|
10001
10001
|
function t($, k) {
|
|
10002
10002
|
return ($.charCodeAt(k) & 64512) !== 55296 || k < 0 || k + 1 >= $.length ? !1 : ($.charCodeAt(k + 1) & 64512) === 56320;
|
|
10003
10003
|
}
|
|
@@ -10021,18 +10021,18 @@ function Bt() {
|
|
|
10021
10021
|
m[O] = $[O] | 0;
|
|
10022
10022
|
return m;
|
|
10023
10023
|
}
|
|
10024
|
-
|
|
10024
|
+
Me.toArray = n;
|
|
10025
10025
|
function u($) {
|
|
10026
10026
|
for (var k = "", m = 0; m < $.length; m++)
|
|
10027
10027
|
k += a($[m].toString(16));
|
|
10028
10028
|
return k;
|
|
10029
10029
|
}
|
|
10030
|
-
|
|
10030
|
+
Me.toHex = u;
|
|
10031
10031
|
function r($) {
|
|
10032
10032
|
var k = $ >>> 24 | $ >>> 8 & 65280 | $ << 8 & 16711680 | ($ & 255) << 24;
|
|
10033
10033
|
return k >>> 0;
|
|
10034
10034
|
}
|
|
10035
|
-
|
|
10035
|
+
Me.htonl = r;
|
|
10036
10036
|
function s($, k) {
|
|
10037
10037
|
for (var m = "", E = 0; E < $.length; E++) {
|
|
10038
10038
|
var O = $[E];
|
|
@@ -10040,15 +10040,15 @@ function Bt() {
|
|
|
10040
10040
|
}
|
|
10041
10041
|
return m;
|
|
10042
10042
|
}
|
|
10043
|
-
|
|
10043
|
+
Me.toHex32 = s;
|
|
10044
10044
|
function a($) {
|
|
10045
10045
|
return $.length === 1 ? "0" + $ : $;
|
|
10046
10046
|
}
|
|
10047
|
-
|
|
10047
|
+
Me.zero2 = a;
|
|
10048
10048
|
function o($) {
|
|
10049
10049
|
return $.length === 7 ? "0" + $ : $.length === 6 ? "00" + $ : $.length === 5 ? "000" + $ : $.length === 4 ? "0000" + $ : $.length === 3 ? "00000" + $ : $.length === 2 ? "000000" + $ : $.length === 1 ? "0000000" + $ : $;
|
|
10050
10050
|
}
|
|
10051
|
-
|
|
10051
|
+
Me.zero8 = o;
|
|
10052
10052
|
function f($, k, m, E) {
|
|
10053
10053
|
var O = m - k;
|
|
10054
10054
|
l(O % 4 === 0);
|
|
@@ -10058,7 +10058,7 @@ function Bt() {
|
|
|
10058
10058
|
}
|
|
10059
10059
|
return R;
|
|
10060
10060
|
}
|
|
10061
|
-
|
|
10061
|
+
Me.join32 = f;
|
|
10062
10062
|
function i($, k) {
|
|
10063
10063
|
for (var m = new Array($.length * 4), E = 0, O = 0; E < $.length; E++, O += 4) {
|
|
10064
10064
|
var R = $[E];
|
|
@@ -10066,89 +10066,89 @@ function Bt() {
|
|
|
10066
10066
|
}
|
|
10067
10067
|
return m;
|
|
10068
10068
|
}
|
|
10069
|
-
|
|
10069
|
+
Me.split32 = i;
|
|
10070
10070
|
function c($, k) {
|
|
10071
10071
|
return $ >>> k | $ << 32 - k;
|
|
10072
10072
|
}
|
|
10073
|
-
|
|
10073
|
+
Me.rotr32 = c;
|
|
10074
10074
|
function h($, k) {
|
|
10075
10075
|
return $ << k | $ >>> 32 - k;
|
|
10076
10076
|
}
|
|
10077
|
-
|
|
10077
|
+
Me.rotl32 = h;
|
|
10078
10078
|
function d($, k) {
|
|
10079
10079
|
return $ + k >>> 0;
|
|
10080
10080
|
}
|
|
10081
|
-
|
|
10081
|
+
Me.sum32 = d;
|
|
10082
10082
|
function b($, k, m) {
|
|
10083
10083
|
return $ + k + m >>> 0;
|
|
10084
10084
|
}
|
|
10085
|
-
|
|
10085
|
+
Me.sum32_3 = b;
|
|
10086
10086
|
function p($, k, m, E) {
|
|
10087
10087
|
return $ + k + m + E >>> 0;
|
|
10088
10088
|
}
|
|
10089
|
-
|
|
10089
|
+
Me.sum32_4 = p;
|
|
10090
10090
|
function y($, k, m, E, O) {
|
|
10091
10091
|
return $ + k + m + E + O >>> 0;
|
|
10092
10092
|
}
|
|
10093
|
-
|
|
10093
|
+
Me.sum32_5 = y;
|
|
10094
10094
|
function v($, k, m, E) {
|
|
10095
10095
|
var O = $[k], R = $[k + 1], A = E + R >>> 0, F = (A < E ? 1 : 0) + m + O;
|
|
10096
10096
|
$[k] = F >>> 0, $[k + 1] = A;
|
|
10097
10097
|
}
|
|
10098
|
-
|
|
10098
|
+
Me.sum64 = v;
|
|
10099
10099
|
function g($, k, m, E) {
|
|
10100
10100
|
var O = k + E >>> 0, R = (O < k ? 1 : 0) + $ + m;
|
|
10101
10101
|
return R >>> 0;
|
|
10102
10102
|
}
|
|
10103
|
-
|
|
10103
|
+
Me.sum64_hi = g;
|
|
10104
10104
|
function x($, k, m, E) {
|
|
10105
10105
|
var O = k + E;
|
|
10106
10106
|
return O >>> 0;
|
|
10107
10107
|
}
|
|
10108
|
-
|
|
10108
|
+
Me.sum64_lo = x;
|
|
10109
10109
|
function B($, k, m, E, O, R, A, F) {
|
|
10110
10110
|
var K = 0, L = k;
|
|
10111
10111
|
L = L + E >>> 0, K += L < k ? 1 : 0, L = L + R >>> 0, K += L < R ? 1 : 0, L = L + F >>> 0, K += L < F ? 1 : 0;
|
|
10112
10112
|
var _ = $ + m + O + A + K;
|
|
10113
10113
|
return _ >>> 0;
|
|
10114
10114
|
}
|
|
10115
|
-
|
|
10115
|
+
Me.sum64_4_hi = B;
|
|
10116
10116
|
function I($, k, m, E, O, R, A, F) {
|
|
10117
10117
|
var K = k + E + R + F;
|
|
10118
10118
|
return K >>> 0;
|
|
10119
10119
|
}
|
|
10120
|
-
|
|
10120
|
+
Me.sum64_4_lo = I;
|
|
10121
10121
|
function C($, k, m, E, O, R, A, F, K, L) {
|
|
10122
10122
|
var _ = 0, U = k;
|
|
10123
10123
|
U = U + E >>> 0, _ += U < k ? 1 : 0, U = U + R >>> 0, _ += U < R ? 1 : 0, U = U + F >>> 0, _ += U < F ? 1 : 0, U = U + L >>> 0, _ += U < L ? 1 : 0;
|
|
10124
10124
|
var fe = $ + m + O + A + K + _;
|
|
10125
10125
|
return fe >>> 0;
|
|
10126
10126
|
}
|
|
10127
|
-
|
|
10127
|
+
Me.sum64_5_hi = C;
|
|
10128
10128
|
function j($, k, m, E, O, R, A, F, K, L) {
|
|
10129
10129
|
var _ = k + E + R + F + L;
|
|
10130
10130
|
return _ >>> 0;
|
|
10131
10131
|
}
|
|
10132
|
-
|
|
10132
|
+
Me.sum64_5_lo = j;
|
|
10133
10133
|
function G($, k, m) {
|
|
10134
10134
|
var E = k << 32 - m | $ >>> m;
|
|
10135
10135
|
return E >>> 0;
|
|
10136
10136
|
}
|
|
10137
|
-
|
|
10137
|
+
Me.rotr64_hi = G;
|
|
10138
10138
|
function z($, k, m) {
|
|
10139
10139
|
var E = $ << 32 - m | k >>> m;
|
|
10140
10140
|
return E >>> 0;
|
|
10141
10141
|
}
|
|
10142
|
-
|
|
10142
|
+
Me.rotr64_lo = z;
|
|
10143
10143
|
function te($, k, m) {
|
|
10144
10144
|
return $ >>> m;
|
|
10145
10145
|
}
|
|
10146
|
-
|
|
10146
|
+
Me.shr64_hi = te;
|
|
10147
10147
|
function ne($, k, m) {
|
|
10148
10148
|
var E = $ << 32 - m | k >>> m;
|
|
10149
10149
|
return E >>> 0;
|
|
10150
10150
|
}
|
|
10151
|
-
return
|
|
10151
|
+
return Me.shr64_lo = ne, Me;
|
|
10152
10152
|
}
|
|
10153
10153
|
var qa = {}, bu;
|
|
10154
10154
|
function or() {
|
|
@@ -15810,22 +15810,22 @@ const dr = /* @__PURE__ */ jt(v1);
|
|
|
15810
15810
|
var m1 = es();
|
|
15811
15811
|
const Rd = /* @__PURE__ */ jt(m1);
|
|
15812
15812
|
var y1 = St();
|
|
15813
|
-
const g1 = "2.
|
|
15813
|
+
const g1 = "2.3.1", w1 = {
|
|
15814
15814
|
version: g1
|
|
15815
15815
|
};
|
|
15816
|
-
function
|
|
15817
|
-
if (!(this instanceof
|
|
15818
|
-
return new
|
|
15816
|
+
function ee(l, e, t) {
|
|
15817
|
+
if (!(this instanceof ee))
|
|
15818
|
+
return new ee(l, e, t);
|
|
15819
15819
|
if (l && (l instanceof ct || l.constructor.name === "BN" || l.constructor.name === "Bn")) {
|
|
15820
15820
|
ct.call(this, 0), l.copy(this), this.negative = l.negative, this.length = l.length, this.red = l.red;
|
|
15821
15821
|
return;
|
|
15822
15822
|
}
|
|
15823
15823
|
ct.call(this, l, e, t);
|
|
15824
15824
|
}
|
|
15825
|
-
|
|
15826
|
-
|
|
15825
|
+
ee.prototype = Object.create(ct.prototype);
|
|
15826
|
+
ee.prototype.constructor = ee;
|
|
15827
15827
|
Object.keys(ct).forEach(function(l) {
|
|
15828
|
-
|
|
15828
|
+
ee[l] || (ee[l] = ct[l]);
|
|
15829
15829
|
});
|
|
15830
15830
|
function Hr(l) {
|
|
15831
15831
|
const e = Buffer.alloc(l.length);
|
|
@@ -15833,36 +15833,36 @@ function Hr(l) {
|
|
|
15833
15833
|
e[t] = l[l.length - 1 - t];
|
|
15834
15834
|
return e;
|
|
15835
15835
|
}
|
|
15836
|
-
|
|
15836
|
+
ee.prototype.fromHex = function(l, e) {
|
|
15837
15837
|
return this.fromBuffer(Buffer.from(l, "hex"), e);
|
|
15838
15838
|
};
|
|
15839
|
-
|
|
15839
|
+
ee.prototype.toHex = function(l) {
|
|
15840
15840
|
return this.toBuffer(l).toString("hex");
|
|
15841
15841
|
};
|
|
15842
|
-
|
|
15842
|
+
ee.prototype.toJSON = function() {
|
|
15843
15843
|
return this.toString();
|
|
15844
15844
|
};
|
|
15845
|
-
|
|
15846
|
-
return new
|
|
15845
|
+
ee.prototype.fromJSON = function(l) {
|
|
15846
|
+
return new ee(l).copy(this), this;
|
|
15847
15847
|
};
|
|
15848
|
-
|
|
15849
|
-
return new
|
|
15848
|
+
ee.prototype.fromNumber = function(l) {
|
|
15849
|
+
return new ee(l).copy(this), this;
|
|
15850
15850
|
};
|
|
15851
|
-
|
|
15851
|
+
ee.prototype.toNumber = function() {
|
|
15852
15852
|
return parseInt(this.toString(10), 10);
|
|
15853
15853
|
};
|
|
15854
|
-
|
|
15855
|
-
return new
|
|
15854
|
+
ee.prototype.fromString = function(l, e) {
|
|
15855
|
+
return new ee(l, e).copy(this), this;
|
|
15856
15856
|
};
|
|
15857
|
-
|
|
15857
|
+
ee.fromBuffer = function(l, e = { endian: "big" }) {
|
|
15858
15858
|
e.endian === "little" && (l = Hr(l));
|
|
15859
15859
|
const t = l.toString("hex");
|
|
15860
|
-
return new
|
|
15860
|
+
return new ee(t, 16);
|
|
15861
15861
|
};
|
|
15862
|
-
|
|
15863
|
-
return
|
|
15862
|
+
ee.prototype.fromBuffer = function(l, e) {
|
|
15863
|
+
return ee.fromBuffer(l, e).copy(this), this;
|
|
15864
15864
|
};
|
|
15865
|
-
|
|
15865
|
+
ee.prototype.toBuffer = function(l = { size: void 0, endian: "big" }) {
|
|
15866
15866
|
let e;
|
|
15867
15867
|
if (l.size) {
|
|
15868
15868
|
const n = this.toString(16, 2), u = n.length / 2;
|
|
@@ -15886,23 +15886,23 @@ Z.prototype.toBuffer = function(l = { size: void 0, endian: "big" }) {
|
|
|
15886
15886
|
const t = Buffer.from([0]);
|
|
15887
15887
|
return Buffer.compare(e, t) === 0 ? Buffer.from([]) : e;
|
|
15888
15888
|
};
|
|
15889
|
-
|
|
15889
|
+
ee.prototype.toFastBuffer = function(l) {
|
|
15890
15890
|
return this.toBuffer(l);
|
|
15891
15891
|
};
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15892
|
+
ee.fromFastBuffer = ee.fromBuffer;
|
|
15893
|
+
ee.prototype.fromFastBuffer = ee.prototype.fromBuffer;
|
|
15894
|
+
ee.prototype.fromSm = function(l, e = { endian: "big" }) {
|
|
15895
15895
|
if (l.length === 0)
|
|
15896
15896
|
return this.fromBuffer(Buffer.from([0])), this.negative = 0, this;
|
|
15897
15897
|
let t = Buffer.from(l);
|
|
15898
15898
|
return e.endian === "little" && (t = Hr(t)), t[0] & 128 ? (t[0] = t[0] & 127, this.fromBuffer(t), this.ineg()) : (this.fromBuffer(t), this.negative = 0), this;
|
|
15899
15899
|
};
|
|
15900
|
-
|
|
15900
|
+
ee.prototype.toSm = function(l = { endian: "big" }) {
|
|
15901
15901
|
const e = l.endian;
|
|
15902
15902
|
let t;
|
|
15903
15903
|
return this.negative ? (t = this.abs().toBuffer(), t.length > 0 && t[0] & 128 ? t = Buffer.concat([Buffer.from([128]), t]) : t.length > 0 ? t[0] = t[0] | 128 : t = Buffer.from([128])) : (t = this.toBuffer(), t.length > 0 && t[0] & 128 && (t = Buffer.concat([Buffer.from([0]), t]))), t.length === 1 && t[0] === 0 && (t = Buffer.from([])), e === "little" && (t = Hr(t)), t;
|
|
15904
15904
|
};
|
|
15905
|
-
|
|
15905
|
+
ee.prototype.fromBits = function(l, e = { strict: !1 }) {
|
|
15906
15906
|
let t = Buffer.alloc(4);
|
|
15907
15907
|
if (t.writeUInt32BE(l, 0), l = t.readInt32BE(0), e.strict && l & 8388608)
|
|
15908
15908
|
throw new Error("negative bit set");
|
|
@@ -15915,31 +15915,32 @@ Z.prototype.fromBits = function(l, e = { strict: !1 }) {
|
|
|
15915
15915
|
}
|
|
15916
15916
|
return this.fromBuffer(t), l & 8388608 && this.ineg(), this;
|
|
15917
15917
|
};
|
|
15918
|
-
|
|
15918
|
+
ee.prototype.toBits = function() {
|
|
15919
15919
|
const l = this.negative, t = this.abs().toBuffer();
|
|
15920
15920
|
let n = t.length, u;
|
|
15921
15921
|
if (n > 3)
|
|
15922
15922
|
u = Buffer.concat([Buffer.from([0]), t.slice(0, 3)]).readUInt32BE(0);
|
|
15923
15923
|
else if (n <= 3) {
|
|
15924
|
-
|
|
15925
|
-
|
|
15924
|
+
u = 0;
|
|
15925
|
+
for (let a = 0; a < n; a++)
|
|
15926
|
+
u |= t[a] << 8 * (2 - a);
|
|
15926
15927
|
}
|
|
15927
15928
|
u & 8388608 && (u >>= 8, n++), l && (u |= 8388608);
|
|
15928
15929
|
const r = n << 24 | u, s = Buffer.alloc(4);
|
|
15929
15930
|
return s.writeInt32BE(r, 0), s.readUInt32BE(0);
|
|
15930
15931
|
};
|
|
15931
|
-
|
|
15932
|
+
ee.prototype.fromScriptNumBuffer = function(l, e, t) {
|
|
15932
15933
|
if (t === void 0 && (t = 4), l.length > t)
|
|
15933
15934
|
throw new Error(`script number overflow nMaxNumSize: ${t}`);
|
|
15934
15935
|
if (e && l.length > 0 && (l[l.length - 1] & 127) === 0 && (l.length <= 1 || (l[l.length - 2] & 128) === 0))
|
|
15935
15936
|
throw new Error("non-minimally encoded script number");
|
|
15936
15937
|
return this.fromSm(l, { endian: "little" });
|
|
15937
15938
|
};
|
|
15938
|
-
|
|
15939
|
+
ee.prototype.toScriptNumBuffer = function() {
|
|
15939
15940
|
return this.toSm({ endian: "little" });
|
|
15940
15941
|
};
|
|
15941
15942
|
const lr = function(l) {
|
|
15942
|
-
return l && (l instanceof ct || l.constructor.name === "BN" || l.constructor.name === "Bn") && !(l instanceof
|
|
15943
|
+
return l && (l instanceof ct || l.constructor.name === "BN" || l.constructor.name === "Bn") && !(l instanceof ee) ? new ee(l) : l;
|
|
15943
15944
|
}, _1 = [
|
|
15944
15945
|
"add",
|
|
15945
15946
|
"sub",
|
|
@@ -15961,35 +15962,35 @@ const lr = function(l) {
|
|
|
15961
15962
|
];
|
|
15962
15963
|
_1.forEach((l) => {
|
|
15963
15964
|
const e = ct.prototype[l];
|
|
15964
|
-
|
|
15965
|
-
return (typeof t == "string" || typeof t == "number") && (t = new
|
|
15965
|
+
ee.prototype[l] = function(t, ...n) {
|
|
15966
|
+
return (typeof t == "string" || typeof t == "number") && (t = new ee(t)), lr(e.call(this, t, ...n));
|
|
15966
15967
|
};
|
|
15967
15968
|
});
|
|
15968
15969
|
const S1 = ["ushln", "ushrn", "shln", "shrn", "testn", "maskn", "setn", "clrn", "bincn"];
|
|
15969
15970
|
S1.forEach((l) => {
|
|
15970
15971
|
const e = ct.prototype[l];
|
|
15971
|
-
|
|
15972
|
+
ee.prototype[l] = function(t, ...n) {
|
|
15972
15973
|
return t && (t instanceof ct || t.constructor.name === "BN" || t.constructor.name === "Bn") && (t = t.toNumber()), lr(e.call(this, t, ...n));
|
|
15973
15974
|
};
|
|
15974
15975
|
});
|
|
15975
15976
|
const x1 = ["sqr", "neg", "abs", "not", "redSqr", "redSqrt", "redNeg"];
|
|
15976
15977
|
x1.forEach((l) => {
|
|
15977
15978
|
const e = ct.prototype[l];
|
|
15978
|
-
|
|
15979
|
+
ee.prototype[l] = function() {
|
|
15979
15980
|
return lr(e.call(this));
|
|
15980
15981
|
};
|
|
15981
15982
|
});
|
|
15982
|
-
|
|
15983
|
+
ee.prototype.toRed = function(l) {
|
|
15983
15984
|
return lr(ct.prototype.toRed.call(this, l));
|
|
15984
15985
|
};
|
|
15985
|
-
|
|
15986
|
+
ee.prototype.fromRed = function() {
|
|
15986
15987
|
return lr(ct.prototype.fromRed.call(this));
|
|
15987
15988
|
};
|
|
15988
15989
|
const E1 = ["cmp", "gt", "geq", "lt", "leq", "eq", "neq"];
|
|
15989
15990
|
E1.forEach((l) => {
|
|
15990
15991
|
const e = ct.prototype.cmp;
|
|
15991
|
-
|
|
15992
|
-
(typeof t == "string" || typeof t == "number") && (t = new
|
|
15992
|
+
ee.prototype[l] = function(t) {
|
|
15993
|
+
(typeof t == "string" || typeof t == "number") && (t = new ee(t));
|
|
15993
15994
|
const n = e.call(this, t);
|
|
15994
15995
|
return l === "eq" ? n === 0 : l === "neq" ? n !== 0 : l === "gt" ? n > 0 : l === "geq" ? n >= 0 : l === "lt" ? n < 0 : l === "leq" ? n <= 0 : n;
|
|
15995
15996
|
};
|
|
@@ -16057,12 +16058,12 @@ class ot {
|
|
|
16057
16058
|
return this.pos = this.pos + 4, e;
|
|
16058
16059
|
}
|
|
16059
16060
|
readUInt64BEBn() {
|
|
16060
|
-
const e = this.buf.slice(this.pos, this.pos + 8), t = new
|
|
16061
|
+
const e = this.buf.slice(this.pos, this.pos + 8), t = new ee().fromBuffer(e);
|
|
16061
16062
|
return this.pos = this.pos + 8, t;
|
|
16062
16063
|
}
|
|
16063
16064
|
readUInt64LEBn() {
|
|
16064
16065
|
const e = this.readReverse(8);
|
|
16065
|
-
return new
|
|
16066
|
+
return new ee().fromBuffer(e);
|
|
16066
16067
|
}
|
|
16067
16068
|
readVarIntNum() {
|
|
16068
16069
|
const e = this.readUInt8();
|
|
@@ -16098,17 +16099,17 @@ class ot {
|
|
|
16098
16099
|
const e = this.readUInt8();
|
|
16099
16100
|
switch (e) {
|
|
16100
16101
|
case 253:
|
|
16101
|
-
return new
|
|
16102
|
+
return new ee(this.readUInt16LE());
|
|
16102
16103
|
case 254:
|
|
16103
|
-
return new
|
|
16104
|
+
return new ee(this.readUInt32LE());
|
|
16104
16105
|
case 255:
|
|
16105
16106
|
return this.readUInt64LEBn();
|
|
16106
16107
|
default:
|
|
16107
|
-
return new
|
|
16108
|
+
return new ee(e);
|
|
16108
16109
|
}
|
|
16109
16110
|
}
|
|
16110
16111
|
}
|
|
16111
|
-
class
|
|
16112
|
+
class Ne {
|
|
16112
16113
|
constructor(e) {
|
|
16113
16114
|
this.fromObject({ bufs: e });
|
|
16114
16115
|
}
|
|
@@ -16184,11 +16185,11 @@ class ke {
|
|
|
16184
16185
|
return this.writeReverse(t), this;
|
|
16185
16186
|
}
|
|
16186
16187
|
writeVarIntNum(e) {
|
|
16187
|
-
const t =
|
|
16188
|
+
const t = Ne.varIntBufNum(e);
|
|
16188
16189
|
return this.write(t), this;
|
|
16189
16190
|
}
|
|
16190
16191
|
writeVarIntBn(e) {
|
|
16191
|
-
const t =
|
|
16192
|
+
const t = Ne.varIntBufBn(e);
|
|
16192
16193
|
return this.write(t), this;
|
|
16193
16194
|
}
|
|
16194
16195
|
static varIntBufNum(e) {
|
|
@@ -16205,7 +16206,7 @@ class ke {
|
|
|
16205
16206
|
else if (n < 4294967296)
|
|
16206
16207
|
t = Buffer.alloc(5), t.writeUInt8(254, 0), t.writeUInt32LE(n, 1);
|
|
16207
16208
|
else {
|
|
16208
|
-
const u = new
|
|
16209
|
+
const u = new Ne();
|
|
16209
16210
|
u.writeUInt8(255), u.writeUInt64LEBn(e), t = u.toBuffer();
|
|
16210
16211
|
}
|
|
16211
16212
|
return t;
|
|
@@ -16269,7 +16270,7 @@ class Ce {
|
|
|
16269
16270
|
*/
|
|
16270
16271
|
*expect(e, t) {
|
|
16271
16272
|
let n = t;
|
|
16272
|
-
const u = new
|
|
16273
|
+
const u = new Ne();
|
|
16273
16274
|
let r = 0;
|
|
16274
16275
|
for (t && (u.write(t), r += t.length); r < e; )
|
|
16275
16276
|
n = yield e - r, n && (u.write(n), r += n.length);
|
|
@@ -16512,7 +16513,7 @@ class Sh extends Ce {
|
|
|
16512
16513
|
return this.resbuf = Buffer.from(JSON.stringify(e.message)), this.isError = !0, this.id = t, this;
|
|
16513
16514
|
}
|
|
16514
16515
|
toBw(e) {
|
|
16515
|
-
return e || (e = new
|
|
16516
|
+
return e || (e = new Ne()), e.writeVarIntNum(this.resbuf.length), e.write(this.resbuf), e.writeUInt8(Number(this.isError)), e.writeVarIntNum(this.id), e;
|
|
16516
16517
|
}
|
|
16517
16518
|
fromBr(e) {
|
|
16518
16519
|
const t = e.readVarIntNum();
|
|
@@ -17210,11 +17211,11 @@ class Ie extends Tt {
|
|
|
17210
17211
|
return t = Object.create(Ie.prototype), t.copyFrom(u);
|
|
17211
17212
|
}
|
|
17212
17213
|
getX() {
|
|
17213
|
-
const e = Tt.prototype.getX.call(this), t = Object.create(
|
|
17214
|
+
const e = Tt.prototype.getX.call(this), t = Object.create(ee.prototype);
|
|
17214
17215
|
return e.copy(t), t;
|
|
17215
17216
|
}
|
|
17216
17217
|
getY() {
|
|
17217
|
-
const e = Tt.prototype.getY.call(this), t = Object.create(
|
|
17218
|
+
const e = Tt.prototype.getY.call(this), t = Object.create(ee.prototype);
|
|
17218
17219
|
return e.copy(t), t;
|
|
17219
17220
|
}
|
|
17220
17221
|
fromX(e, t) {
|
|
@@ -17228,7 +17229,7 @@ class Ie extends Tt {
|
|
|
17228
17229
|
};
|
|
17229
17230
|
}
|
|
17230
17231
|
fromJSON(e) {
|
|
17231
|
-
const t = new
|
|
17232
|
+
const t = new ee().fromString(e.x), n = new ee().fromString(e.y), u = new Ie(t, n);
|
|
17232
17233
|
return this.copyFrom(u);
|
|
17233
17234
|
}
|
|
17234
17235
|
toString() {
|
|
@@ -17243,7 +17244,7 @@ class Ie extends Tt {
|
|
|
17243
17244
|
return Object.create(Ie.prototype).copyFrom(e);
|
|
17244
17245
|
}
|
|
17245
17246
|
static getN() {
|
|
17246
|
-
return new
|
|
17247
|
+
return new ee(Qt.curve.n.toArray());
|
|
17247
17248
|
}
|
|
17248
17249
|
// https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf
|
|
17249
17250
|
validate() {
|
|
@@ -17311,13 +17312,13 @@ class Ue extends Ce {
|
|
|
17311
17312
|
const n = e.slice(1, 33), u = e.slice(33, 65);
|
|
17312
17313
|
if (n.length !== 32 || u.length !== 32 || e.length !== 65)
|
|
17313
17314
|
throw new Error("LEngth of x and y must be 32 bytes");
|
|
17314
|
-
const r = new
|
|
17315
|
+
const r = new ee(n), s = new ee(u);
|
|
17315
17316
|
this.point = new Ie(r, s), this.compressed = !1;
|
|
17316
17317
|
} else if (e[0] === 3) {
|
|
17317
|
-
const n = e.slice(1), u = new
|
|
17318
|
+
const n = e.slice(1), u = new ee(n);
|
|
17318
17319
|
this.fromX(!0, u), this.compressed = !0;
|
|
17319
17320
|
} else if (e[0] === 2) {
|
|
17320
|
-
const n = e.slice(1), u = new
|
|
17321
|
+
const n = e.slice(1), u = new ee(n);
|
|
17321
17322
|
this.fromX(!1, u), this.compressed = !0;
|
|
17322
17323
|
} else
|
|
17323
17324
|
throw new Error("Invalid DER format pubKey");
|
|
@@ -17344,7 +17345,7 @@ class Ue extends Ce {
|
|
|
17344
17345
|
toFastBuffer() {
|
|
17345
17346
|
if (!this.point)
|
|
17346
17347
|
return Buffer.alloc(0);
|
|
17347
|
-
const e = new
|
|
17348
|
+
const e = new Ne(), t = this.compressed === void 0 ? !0 : !!this.compressed;
|
|
17348
17349
|
return e.writeUInt8(Number(t)), e.write(this.toDer(!1)), e.toBuffer();
|
|
17349
17350
|
}
|
|
17350
17351
|
toDer(e) {
|
|
@@ -17380,7 +17381,7 @@ class Ue extends Ce {
|
|
|
17380
17381
|
validate() {
|
|
17381
17382
|
if (this.point.isInfinity())
|
|
17382
17383
|
throw new Error("point: Point cannot be equal to Infinity");
|
|
17383
|
-
if (this.point.eq(new Ie(new
|
|
17384
|
+
if (this.point.eq(new Ie(new ee(0), new ee(0))))
|
|
17384
17385
|
throw new Error("point: Point cannot be equal to 0, 0");
|
|
17385
17386
|
return this.point.validate(), this;
|
|
17386
17387
|
}
|
|
@@ -17405,7 +17406,7 @@ class wt extends Ce {
|
|
|
17405
17406
|
fromRandom() {
|
|
17406
17407
|
let e, t, n;
|
|
17407
17408
|
do
|
|
17408
|
-
e = It.getRandomBuffer(32), t = new
|
|
17409
|
+
e = It.getRandomBuffer(32), t = new ee().fromBuffer(e), n = t.lt(Ie.getN());
|
|
17409
17410
|
while (!n);
|
|
17410
17411
|
return this.fromObject({
|
|
17411
17412
|
bn: t,
|
|
@@ -17437,7 +17438,7 @@ class wt extends Ce {
|
|
|
17437
17438
|
);
|
|
17438
17439
|
if (e[0] !== this.Constants.versionByteNum)
|
|
17439
17440
|
throw new Error("Invalid versionByteNum byte");
|
|
17440
|
-
return this.fromBn(new
|
|
17441
|
+
return this.fromBn(new ee().fromBuffer(e.slice(1, 33)));
|
|
17441
17442
|
}
|
|
17442
17443
|
toBn() {
|
|
17443
17444
|
return this.bn;
|
|
@@ -17525,7 +17526,7 @@ class he extends Ce {
|
|
|
17525
17526
|
throw new Error("r must be 32 bytes");
|
|
17526
17527
|
if (n.length !== 32 || e.length > 64)
|
|
17527
17528
|
throw new Error("s must be 32 bytes");
|
|
17528
|
-
return this.r = new
|
|
17529
|
+
return this.r = new ee().fromBuffer(t), this.s = new ee().fromBuffer(n), this;
|
|
17529
17530
|
}
|
|
17530
17531
|
static fromRS(e) {
|
|
17531
17532
|
return new this().fromRS(e);
|
|
@@ -17541,7 +17542,7 @@ class he extends Ce {
|
|
|
17541
17542
|
// The format used in a tx
|
|
17542
17543
|
fromTxFormat(e) {
|
|
17543
17544
|
if (e.length === 0)
|
|
17544
|
-
return this.r = new
|
|
17545
|
+
return this.r = new ee(1), this.s = new ee(1), this.nHashType = 1, this;
|
|
17545
17546
|
const t = e.readUInt8(e.length - 1), n = e.slice(0, e.length - 1);
|
|
17546
17547
|
return this.fromDer(n, !1), this.nHashType = t, this;
|
|
17547
17548
|
}
|
|
@@ -17568,13 +17569,13 @@ class he extends Ce {
|
|
|
17568
17569
|
const s = e[2];
|
|
17569
17570
|
if (s !== 2)
|
|
17570
17571
|
throw new Error("Integer byte for r should be 0x02");
|
|
17571
|
-
const a = e[3], o = e.slice(4, 4 + a), f = new
|
|
17572
|
+
const a = e[3], o = e.slice(4, 4 + a), f = new ee().fromBuffer(o), i = e[4] === 0;
|
|
17572
17573
|
if (a !== o.length)
|
|
17573
17574
|
throw new Error("LEngth of r incorrect");
|
|
17574
17575
|
const c = e[4 + a + 0];
|
|
17575
17576
|
if (c !== 2)
|
|
17576
17577
|
throw new Error("Integer byte for s should be 0x02");
|
|
17577
|
-
const h = e[4 + a + 1], d = e.slice(4 + a + 2, 4 + a + 2 + h), b = new
|
|
17578
|
+
const h = e[4 + a + 1], d = e.slice(4 + a + 2, 4 + a + 2 + h), b = new ee().fromBuffer(d), p = e[4 + a + 2 + 2] === 0;
|
|
17578
17579
|
if (h !== d.length)
|
|
17579
17580
|
throw new Error("LEngth of s incorrect");
|
|
17580
17581
|
const y = 4 + a + 2 + h;
|
|
@@ -17629,7 +17630,7 @@ class he extends Ce {
|
|
|
17629
17630
|
*/
|
|
17630
17631
|
hasLowS() {
|
|
17631
17632
|
return !(this.s.lt(1) || this.s.gt(
|
|
17632
|
-
|
|
17633
|
+
ee.fromBuffer(
|
|
17633
17634
|
Buffer.from(
|
|
17634
17635
|
"7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0",
|
|
17635
17636
|
"hex"
|
|
@@ -17747,7 +17748,7 @@ class Ae extends Ce {
|
|
|
17747
17748
|
return this;
|
|
17748
17749
|
}
|
|
17749
17750
|
toBuffer() {
|
|
17750
|
-
const e = new
|
|
17751
|
+
const e = new Ne();
|
|
17751
17752
|
for (let t = 0; t < this.chunks.length; t++) {
|
|
17752
17753
|
const n = this.chunks[t], u = n.opCodeNum;
|
|
17753
17754
|
e.writeUInt8(u), n.buf && (u < q.OP_PUSHDATA1 ? e.write(n.buf) : u === q.OP_PUSHDATA1 ? (e.writeUInt8(n.len), e.write(n.buf)) : u === q.OP_PUSHDATA2 ? (e.writeUInt16LE(n.len), e.write(n.buf)) : u === q.OP_PUSHDATA4 && (e.writeUInt32LE(n.len), e.write(n.buf)));
|
|
@@ -17806,7 +17807,7 @@ class Ae extends Ce {
|
|
|
17806
17807
|
* Input the script from the script string format used in bitcoind data tests
|
|
17807
17808
|
*/
|
|
17808
17809
|
fromBitcoindString(e) {
|
|
17809
|
-
const t = new
|
|
17810
|
+
const t = new Ne(), n = e.split(" ");
|
|
17810
17811
|
let u;
|
|
17811
17812
|
for (u = 0; u < n.length; u++) {
|
|
17812
17813
|
const s = n[u];
|
|
@@ -17827,7 +17828,7 @@ class Ae extends Ce {
|
|
|
17827
17828
|
if (isNaN(parseInt(s, 10)))
|
|
17828
17829
|
throw new Error("Could not determine type of script value");
|
|
17829
17830
|
{
|
|
17830
|
-
const a = new
|
|
17831
|
+
const a = new ee(s), f = new Ae().writeBn(a).toBuffer();
|
|
17831
17832
|
t.write(f);
|
|
17832
17833
|
}
|
|
17833
17834
|
}
|
|
@@ -17967,7 +17968,7 @@ class Ae extends Ce {
|
|
|
17967
17968
|
static sortPubKeys(e) {
|
|
17968
17969
|
return e.slice().sort((t, n) => {
|
|
17969
17970
|
const u = t.toBuffer(), r = n.toBuffer(), s = Math.max(u.length, r.length);
|
|
17970
|
-
for (let a = 0; a
|
|
17971
|
+
for (let a = 0; a < s; a++) {
|
|
17971
17972
|
if (u[a] === void 0)
|
|
17972
17973
|
return -1;
|
|
17973
17974
|
if (r[a] === void 0)
|
|
@@ -17977,6 +17978,7 @@ class Ae extends Ce {
|
|
|
17977
17978
|
if (u[a] > r[a])
|
|
17978
17979
|
return 1;
|
|
17979
17980
|
}
|
|
17981
|
+
return 0;
|
|
17980
17982
|
});
|
|
17981
17983
|
}
|
|
17982
17984
|
/**
|
|
@@ -18008,11 +18010,11 @@ class Ae extends Ce {
|
|
|
18008
18010
|
return !0;
|
|
18009
18011
|
}
|
|
18010
18012
|
isNonSpendable() {
|
|
18011
|
-
const e = this.chunks[0].opCodeNum === q.OP_FALSE, t = this.chunks[1] && this.chunks[1].opCodeNum === q.OP_RETURN;
|
|
18013
|
+
const e = this.chunks[0] && this.chunks[0].opCodeNum === q.OP_FALSE, t = this.chunks[1] && this.chunks[1].opCodeNum === q.OP_RETURN;
|
|
18012
18014
|
return !!e && !!t;
|
|
18013
18015
|
}
|
|
18014
18016
|
isOpReturn() {
|
|
18015
|
-
return this.chunks[0].opCodeNum === q.OP_RETURN && this.chunks.filter((e) => Buffer.isBuffer(e.buf)).length === this.chunks.slice(1).length;
|
|
18017
|
+
return !!(this.chunks[0] && this.chunks[0].opCodeNum === q.OP_RETURN && this.chunks.filter((e) => Buffer.isBuffer(e.buf)).length === this.chunks.slice(1).length);
|
|
18016
18018
|
}
|
|
18017
18019
|
isSafeDataOut() {
|
|
18018
18020
|
if (this.chunks.length < 2 || this.chunks[0].opCodeNum !== q.OP_FALSE)
|
|
@@ -18029,7 +18031,7 @@ class Ae extends Ce {
|
|
|
18029
18031
|
* for some partially signed (and invalid) transactions.
|
|
18030
18032
|
*/
|
|
18031
18033
|
isPubKeyHashIn() {
|
|
18032
|
-
return !!(this.chunks.length === 2 && (this.chunks[0].buf || this.chunks[0].opCodeNum === q.OP_0) && (this.chunks[1].buf || this.chunks[
|
|
18034
|
+
return !!(this.chunks.length === 2 && (this.chunks[0].buf || this.chunks[0].opCodeNum === q.OP_0) && (this.chunks[1].buf || this.chunks[1].opCodeNum === q.OP_0));
|
|
18033
18035
|
}
|
|
18034
18036
|
isScriptHashOut() {
|
|
18035
18037
|
const e = this.toBuffer();
|
|
@@ -18041,14 +18043,19 @@ class Ae extends Ce {
|
|
|
18041
18043
|
isScriptHashIn() {
|
|
18042
18044
|
if (!this.isPushOnly())
|
|
18043
18045
|
return !1;
|
|
18046
|
+
const e = this.chunks[this.chunks.length - 1];
|
|
18047
|
+
if (!e || !e.buf)
|
|
18048
|
+
return !1;
|
|
18044
18049
|
try {
|
|
18045
|
-
new Ae().fromBuffer(
|
|
18050
|
+
new Ae().fromBuffer(e.buf);
|
|
18046
18051
|
} catch {
|
|
18047
18052
|
return !1;
|
|
18048
18053
|
}
|
|
18049
18054
|
return !0;
|
|
18050
18055
|
}
|
|
18051
18056
|
isMultiSigOut() {
|
|
18057
|
+
if (this.chunks.length < 3)
|
|
18058
|
+
return !1;
|
|
18052
18059
|
const e = this.chunks[0].opCodeNum - q.OP_1 + 1;
|
|
18053
18060
|
if (!(e >= 1 && e <= 16) || !this.chunks.slice(1, this.chunks.length - 2).every((u) => {
|
|
18054
18061
|
try {
|
|
@@ -18060,10 +18067,10 @@ class Ae extends Ce {
|
|
|
18060
18067
|
}))
|
|
18061
18068
|
return !1;
|
|
18062
18069
|
const n = this.chunks[this.chunks.length - 2].opCodeNum - q.OP_1 + 1;
|
|
18063
|
-
return !(!(n >= e && n <= 16) || this.chunks[1 + n + 1].opCodeNum !== q.OP_CHECKMULTISIG);
|
|
18070
|
+
return !(!(n >= e && n <= 16) || !this.chunks[1 + n + 1] || this.chunks[1 + n + 1].opCodeNum !== q.OP_CHECKMULTISIG);
|
|
18064
18071
|
}
|
|
18065
18072
|
isMultiSigIn() {
|
|
18066
|
-
if (this.chunks[0].opCodeNum !== q.OP_0)
|
|
18073
|
+
if (!this.chunks[0] || this.chunks[0].opCodeNum !== q.OP_0)
|
|
18067
18074
|
return !1;
|
|
18068
18075
|
const e = this.chunks.slice(1);
|
|
18069
18076
|
return e.length < 1 ? !1 : e.every(
|
|
@@ -18080,9 +18087,12 @@ class Ae extends Ce {
|
|
|
18080
18087
|
*/
|
|
18081
18088
|
findAndDelete(e) {
|
|
18082
18089
|
const t = e.toBuffer();
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18090
|
+
if (t.length === 0)
|
|
18091
|
+
return this;
|
|
18092
|
+
let n = 0;
|
|
18093
|
+
for (; n < this.chunks.length; ) {
|
|
18094
|
+
const u = new Ae([this.chunks[n]]);
|
|
18095
|
+
Ft(t, u.toBuffer()) ? this.chunks.splice(n, 1) : n++;
|
|
18086
18096
|
}
|
|
18087
18097
|
return this;
|
|
18088
18098
|
}
|
|
@@ -18132,7 +18142,7 @@ class Ae extends Ce {
|
|
|
18132
18142
|
return new this().writeBn(e);
|
|
18133
18143
|
}
|
|
18134
18144
|
writeNumber(e) {
|
|
18135
|
-
return this.writeBn(new
|
|
18145
|
+
return this.writeBn(new ee().fromNumber(e)), this;
|
|
18136
18146
|
}
|
|
18137
18147
|
static writeNumber(e) {
|
|
18138
18148
|
return new this().writeNumber(e);
|
|
@@ -18143,6 +18153,7 @@ class Ae extends Ce {
|
|
|
18143
18153
|
// note: this does not necessarily write buffers in the minimal way
|
|
18144
18154
|
// to write numbers in the minimal way, see writeBn
|
|
18145
18155
|
writeBuffer(e) {
|
|
18156
|
+
e = Buffer.from(e);
|
|
18146
18157
|
let t;
|
|
18147
18158
|
const n = e.length;
|
|
18148
18159
|
if (e.length > 0 && e.length < q.OP_PUSHDATA1)
|
|
@@ -18376,7 +18387,7 @@ class kr extends Ce {
|
|
|
18376
18387
|
if (e.length > 512 / 8)
|
|
18377
18388
|
throw new Error("More than 512 bits of entropy is nonstandard");
|
|
18378
18389
|
const t = ae.sha512Hmac(e, Buffer.from("Bitcoin seed"));
|
|
18379
|
-
return this.depth = 0, this.parentFingerPrint = Buffer.from([0, 0, 0, 0]), this.childIndex = 0, this.chainCode = t.slice(32, 64), this.versionBytesNum = this.Constants.privKey, this.privKey = new this.PrivKey().fromBn(
|
|
18390
|
+
return this.depth = 0, this.parentFingerPrint = Buffer.from([0, 0, 0, 0]), this.childIndex = 0, this.chainCode = t.slice(32, 64), this.versionBytesNum = this.Constants.privKey, this.privKey = new this.PrivKey().fromBn(ee().fromBuffer(t.slice(0, 32))), this.pubKey = new Ue().fromPrivKey(this.privKey), this;
|
|
18380
18391
|
}
|
|
18381
18392
|
static fromSeed(e) {
|
|
18382
18393
|
return new this().fromSeed(e);
|
|
@@ -18397,7 +18408,7 @@ class kr extends Ce {
|
|
|
18397
18408
|
const t = e.slice(45, 78), n = this.versionBytesNum === this.Constants.privKey, u = this.versionBytesNum === this.Constants.pubKey;
|
|
18398
18409
|
if (n && t[0] === 0)
|
|
18399
18410
|
this.privKey = new this.PrivKey().fromBn(
|
|
18400
|
-
|
|
18411
|
+
ee().fromBuffer(t.slice(1, 33))
|
|
18401
18412
|
), this.pubKey = new Ue().fromPrivKey(this.privKey);
|
|
18402
18413
|
else if (u && (t[0] === 2 || t[0] === 3))
|
|
18403
18414
|
this.pubKey = new Ue().fromDer(t);
|
|
@@ -18425,7 +18436,7 @@ class kr extends Ce {
|
|
|
18425
18436
|
const t = e.slice(45, e.length), n = this.versionBytesNum === this.Constants.privKey, u = this.versionBytesNum === this.Constants.pubKey;
|
|
18426
18437
|
if (n && t[0] === 0 && e.length === 78)
|
|
18427
18438
|
this.privKey = new this.PrivKey().fromBn(
|
|
18428
|
-
|
|
18439
|
+
ee().fromBuffer(t.slice(1, 33))
|
|
18429
18440
|
), this.pubKey = new Ue().fromPrivKey(this.privKey);
|
|
18430
18441
|
else if (u && e.length === 111)
|
|
18431
18442
|
this.pubKey = new Ue().fromFastBuffer(t), this.pubKey.compressed = !0;
|
|
@@ -18474,10 +18485,10 @@ class kr extends Ce {
|
|
|
18474
18485
|
this.privKey.bn.toBuffer({ size: 32 }),
|
|
18475
18486
|
t
|
|
18476
18487
|
]) : a = Buffer.concat([this.pubKey.toBuffer({ size: 32 }), t]);
|
|
18477
|
-
const o = ae.sha512Hmac(a, this.chainCode), f =
|
|
18488
|
+
const o = ae.sha512Hmac(a, this.chainCode), f = ee().fromBuffer(o.slice(0, 32), { size: 32 }), i = o.slice(32, 64), c = f.add(this.privKey.bn).mod(Ie.getN());
|
|
18478
18489
|
r = new this.constructor(), r.chainCode = i, r.privKey = new this.PrivKey().fromBn(c), r.pubKey = new Ue().fromPrivKey(r.privKey);
|
|
18479
18490
|
} else {
|
|
18480
|
-
const a = Buffer.concat([this.pubKey.toBuffer(), t]), o = ae.sha512Hmac(a, this.chainCode), f =
|
|
18491
|
+
const a = Buffer.concat([this.pubKey.toBuffer(), t]), o = ae.sha512Hmac(a, this.chainCode), f = ee().fromBuffer(o.slice(0, 32)), i = o.slice(32, 64), c = Ie.getG().mul(f), h = this.pubKey.point, d = c.add(h), b = new Ue();
|
|
18481
18492
|
b.point = d, r = new this.constructor(), r.chainCode = i, r.pubKey = b;
|
|
18482
18493
|
}
|
|
18483
18494
|
r.childIndex = e;
|
|
@@ -18491,13 +18502,13 @@ class kr extends Ce {
|
|
|
18491
18502
|
toBuffer() {
|
|
18492
18503
|
const e = this.versionBytesNum === this.Constants.privKey, t = this.versionBytesNum === this.Constants.pubKey;
|
|
18493
18504
|
if (e)
|
|
18494
|
-
return new
|
|
18505
|
+
return new Ne().writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).writeUInt8(0).write(this.privKey.bn.toBuffer({ size: 32 })).toBuffer();
|
|
18495
18506
|
if (t) {
|
|
18496
18507
|
if (this.pubKey.compressed === !1)
|
|
18497
18508
|
throw new Error(
|
|
18498
18509
|
"cannot convert bip32 to buffer if pubKey is not compressed"
|
|
18499
18510
|
);
|
|
18500
|
-
return new
|
|
18511
|
+
return new Ne().writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).write(this.pubKey.toBuffer()).toBuffer();
|
|
18501
18512
|
} else
|
|
18502
18513
|
throw new Error("bip32: invalid versionBytesNum byte");
|
|
18503
18514
|
}
|
|
@@ -18514,9 +18525,9 @@ class kr extends Ce {
|
|
|
18514
18525
|
return Buffer.alloc(0);
|
|
18515
18526
|
const e = this.versionBytesNum === this.Constants.privKey, t = this.versionBytesNum === this.Constants.pubKey;
|
|
18516
18527
|
if (e)
|
|
18517
|
-
return new
|
|
18528
|
+
return new Ne().writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).writeUInt8(0).write(this.privKey.bn.toBuffer({ size: 32 })).toBuffer();
|
|
18518
18529
|
if (t)
|
|
18519
|
-
return new
|
|
18530
|
+
return new Ne().writeUInt32BE(this.versionBytesNum).writeUInt8(this.depth).write(this.parentFingerPrint).writeUInt32BE(this.childIndex).write(this.chainCode).write(this.pubKey.toFastBuffer()).toBuffer();
|
|
18520
18531
|
throw new Error("bip32: invalid versionBytesNum byte");
|
|
18521
18532
|
}
|
|
18522
18533
|
toString() {
|
|
@@ -24741,7 +24752,7 @@ class Kf extends Ce {
|
|
|
24741
24752
|
}
|
|
24742
24753
|
}
|
|
24743
24754
|
toBw(e) {
|
|
24744
|
-
if (e || (e = new
|
|
24755
|
+
if (e || (e = new Ne()), this.mnemonic) {
|
|
24745
24756
|
const t = Buffer.from(this.mnemonic);
|
|
24746
24757
|
e.writeVarIntNum(t.length), e.write(t);
|
|
24747
24758
|
} else
|
|
@@ -24762,6 +24773,8 @@ class Kf extends Ce {
|
|
|
24762
24773
|
throw new Error("bits must be multiple of 32");
|
|
24763
24774
|
if (e < 128)
|
|
24764
24775
|
throw new Error("bits must be at least 128");
|
|
24776
|
+
if (e > 256)
|
|
24777
|
+
throw new Error("bits must be at most 256");
|
|
24765
24778
|
const t = It.getRandomBuffer(e / 8);
|
|
24766
24779
|
return this.entropy2Mnemonic(t), this.mnemonic2Seed(), this;
|
|
24767
24780
|
}
|
|
@@ -24769,7 +24782,8 @@ class Kf extends Ce {
|
|
|
24769
24782
|
return new this().fromRandom(e);
|
|
24770
24783
|
}
|
|
24771
24784
|
async asyncFromRandom(e) {
|
|
24772
|
-
e || (e = 128)
|
|
24785
|
+
if (e || (e = 128), e % 32 !== 0 || e < 128 || e > 256)
|
|
24786
|
+
throw new Error("bits must be a multiple of 32 between 128 and 256");
|
|
24773
24787
|
const t = It.getRandomBuffer(e / 8);
|
|
24774
24788
|
let n = await be.asyncObjectMethod(
|
|
24775
24789
|
this,
|
|
@@ -24856,10 +24870,11 @@ class Kf extends Ce {
|
|
|
24856
24870
|
n = n + ("00000000000" + c.toString(2)).slice(-11);
|
|
24857
24871
|
}
|
|
24858
24872
|
if (n.length % 11 !== 0)
|
|
24859
|
-
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24873
|
+
return !1;
|
|
24874
|
+
const u = n.length / 33;
|
|
24875
|
+
if (!Number.isInteger(u))
|
|
24876
|
+
return !1;
|
|
24877
|
+
const r = n.slice(-u), s = n.slice(0, n.length - u), a = Buffer.alloc(s.length / 8);
|
|
24863
24878
|
for (let i = 0; i < s.length / 8; i++)
|
|
24864
24879
|
a.writeUInt8(parseInt(n.slice(i * 8, (i + 1) * 8), 2), i);
|
|
24865
24880
|
let f = ae.sha256(a)[0].toString(2);
|
|
@@ -24911,7 +24926,7 @@ class st extends Ce {
|
|
|
24911
24926
|
return n > 0 && (this.pubKey = new Ue().fromFastBuffer(e.read(n))), this;
|
|
24912
24927
|
}
|
|
24913
24928
|
toBw(e) {
|
|
24914
|
-
if (e || (e = new
|
|
24929
|
+
if (e || (e = new Ne()), this.privKey) {
|
|
24915
24930
|
const t = this.privKey.toFastBuffer();
|
|
24916
24931
|
e.writeUInt8(t.length), e.write(t);
|
|
24917
24932
|
} else
|
|
@@ -24983,7 +24998,7 @@ class ht extends Ce {
|
|
|
24983
24998
|
};
|
|
24984
24999
|
}
|
|
24985
25000
|
fromJSON(e) {
|
|
24986
|
-
return this.sig = e.sig ? new he().fromString(e.sig) : void 0, this.keyPair = e.keyPair ? new st().fromBuffer(Buffer.from(e.keyPair, "hex")) : void 0, this.hashBuf = e.hashBuf ? Buffer.from(e.hashBuf, "hex") : void 0, this.k = e.k ? new
|
|
25001
|
+
return this.sig = e.sig ? new he().fromString(e.sig) : void 0, this.keyPair = e.keyPair ? new st().fromBuffer(Buffer.from(e.keyPair, "hex")) : void 0, this.hashBuf = e.hashBuf ? Buffer.from(e.hashBuf, "hex") : void 0, this.k = e.k ? new ee().fromString(e.k) : void 0, this.endian = e.endian, this.verified = e.verified, this;
|
|
24987
25002
|
}
|
|
24988
25003
|
toBuffer() {
|
|
24989
25004
|
const e = JSON.stringify(this.toJSON());
|
|
@@ -25039,13 +25054,13 @@ class ht extends Ce {
|
|
|
25039
25054
|
}
|
|
25040
25055
|
fromString(e) {
|
|
25041
25056
|
const t = JSON.parse(e);
|
|
25042
|
-
return t.hashBuf && (this.hashBuf = Buffer.from(t.hashBuf, "hex")), t.keyPair && (this.keyPair = new st().fromString(t.keyPair)), t.sig && (this.sig = new he().fromString(t.sig)), t.k && (this.k = new
|
|
25057
|
+
return t.hashBuf && (this.hashBuf = Buffer.from(t.hashBuf, "hex")), t.keyPair && (this.keyPair = new st().fromString(t.keyPair)), t.sig && (this.sig = new he().fromString(t.sig)), t.k && (this.k = new ee(t.k, 10)), this;
|
|
25043
25058
|
}
|
|
25044
25059
|
randomK() {
|
|
25045
25060
|
const e = Ie.getN();
|
|
25046
25061
|
let t;
|
|
25047
25062
|
do
|
|
25048
|
-
t = new
|
|
25063
|
+
t = new ee().fromBuffer(It.getRandomBuffer(32));
|
|
25049
25064
|
while (!(t.lt(e) && t.gt(0)));
|
|
25050
25065
|
return this.k = t, this;
|
|
25051
25066
|
}
|
|
@@ -25076,11 +25091,11 @@ class ht extends Ce {
|
|
|
25076
25091
|
Buffer.concat([t, Buffer.from([1]), u, this.hashBuf]),
|
|
25077
25092
|
n
|
|
25078
25093
|
), t = ae.sha256Hmac(t, n), t = ae.sha256Hmac(t, n);
|
|
25079
|
-
let r = new
|
|
25094
|
+
let r = new ee().fromBuffer(t);
|
|
25080
25095
|
const s = Ie.getN();
|
|
25081
25096
|
e === void 0 && (e = 0);
|
|
25082
25097
|
for (let a = 0; a < e || !(r.lt(s) && r.gt(0)); a++)
|
|
25083
|
-
n = ae.sha256Hmac(Buffer.concat([t, Buffer.from([0])]), n), t = ae.sha256Hmac(t, n), t = ae.sha256Hmac(t, n), r = new
|
|
25098
|
+
n = ae.sha256Hmac(Buffer.concat([t, Buffer.from([0])]), n), t = ae.sha256Hmac(t, n), t = ae.sha256Hmac(t, n), r = new ee().fromBuffer(t);
|
|
25084
25099
|
return this.k = r, this;
|
|
25085
25100
|
}
|
|
25086
25101
|
/**
|
|
@@ -25093,7 +25108,7 @@ class ht extends Ce {
|
|
|
25093
25108
|
const e = this.sig.recovery;
|
|
25094
25109
|
if (!(e === 0 || e === 1 || e === 2 || e === 3))
|
|
25095
25110
|
throw new Error("i must be equal to 0, 1, 2, or 3");
|
|
25096
|
-
const t = new
|
|
25111
|
+
const t = new ee().fromBuffer(this.hashBuf), n = this.sig.r, u = this.sig.s, r = e & 1, s = e >> 1, a = Ie.getN(), o = Ie.getG(), f = s ? n.add(a) : n, i = Ie.fromX(r, f);
|
|
25097
25112
|
let c = "";
|
|
25098
25113
|
try {
|
|
25099
25114
|
i.mul(a);
|
|
@@ -25138,7 +25153,7 @@ class ht extends Ce {
|
|
|
25138
25153
|
return "r and s not in range";
|
|
25139
25154
|
if (e && !this.sig.hasLowS())
|
|
25140
25155
|
return "s is too high and does not satisfy low s contraint - see bip 62";
|
|
25141
|
-
const u = new
|
|
25156
|
+
const u = new ee().fromBuffer(
|
|
25142
25157
|
this.hashBuf,
|
|
25143
25158
|
this.endian ? { endian: this.endian } : void 0
|
|
25144
25159
|
), r = Ie.getN(), s = n.invm(r), a = s.mul(u).mod(r), o = s.mul(t).mod(r), f = Ie.getG().mulAdd(a, this.keyPair.pubKey.point, o);
|
|
@@ -25150,13 +25165,13 @@ class ht extends Ce {
|
|
|
25150
25165
|
throw new Error("invalid parameters");
|
|
25151
25166
|
if (!Buffer.isBuffer(e) || e.length !== 32)
|
|
25152
25167
|
throw new Error("hashBuf must be a 32 byte buffer");
|
|
25153
|
-
const u = Ie.getN(), r = Ie.getG(), s = new
|
|
25168
|
+
const u = Ie.getN(), r = Ie.getG(), s = new ee().fromBuffer(e);
|
|
25154
25169
|
let a = 0, o, f, i, c;
|
|
25155
25170
|
do
|
|
25156
25171
|
(!this.k || a > 0) && this.deterministicK(a), a++, o = this.k, f = r.mul(o), i = f.getX().mod(u), c = o.invm(u).mul(s.add(n.mul(i))).mod(u);
|
|
25157
25172
|
while (i.cmp(0) <= 0 || c.cmp(0) <= 0);
|
|
25158
25173
|
return c.gt(
|
|
25159
|
-
new
|
|
25174
|
+
new ee().fromBuffer(
|
|
25160
25175
|
Buffer.from(
|
|
25161
25176
|
"7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0",
|
|
25162
25177
|
"hex"
|
|
@@ -25228,7 +25243,7 @@ class yt extends Ce {
|
|
|
25228
25243
|
static magicHash(e) {
|
|
25229
25244
|
if (!Buffer.isBuffer(e))
|
|
25230
25245
|
throw new Error("messageBuf must be a buffer");
|
|
25231
|
-
const t = new
|
|
25246
|
+
const t = new Ne();
|
|
25232
25247
|
t.writeVarIntNum(yt.magicBytes.length), t.write(yt.magicBytes), t.writeVarIntNum(e.length), t.write(e);
|
|
25233
25248
|
const n = t.toBuffer();
|
|
25234
25249
|
return ae.sha256Sha256(n);
|
|
@@ -25309,7 +25324,7 @@ class Pr extends Ce {
|
|
|
25309
25324
|
return this.versionBytesNum = e.readUInt32LE(), this.prevBlockHashBuf = e.read(32), this.merkleRootBuf = e.read(32), this.time = e.readUInt32LE(), this.bits = e.readUInt32LE(), this.nonce = e.readUInt32LE(), this;
|
|
25310
25325
|
}
|
|
25311
25326
|
toBw(e) {
|
|
25312
|
-
return e || (e = new
|
|
25327
|
+
return e || (e = new Ne()), e.writeUInt32LE(this.versionBytesNum), e.write(this.prevBlockHashBuf), e.write(this.merkleRootBuf), e.writeUInt32LE(this.time), e.writeUInt32LE(this.bits), e.writeUInt32LE(this.nonce), e;
|
|
25313
25328
|
}
|
|
25314
25329
|
}
|
|
25315
25330
|
class Ct extends Ce {
|
|
@@ -25403,13 +25418,13 @@ class qe extends Ce {
|
|
|
25403
25418
|
return this.buf = e.readVarIntBuf(), this;
|
|
25404
25419
|
}
|
|
25405
25420
|
fromBn(e) {
|
|
25406
|
-
return this.buf = new
|
|
25421
|
+
return this.buf = new Ne().writeVarIntBn(e).toBuffer(), this;
|
|
25407
25422
|
}
|
|
25408
25423
|
static fromBn(e) {
|
|
25409
25424
|
return new this().fromBn(e);
|
|
25410
25425
|
}
|
|
25411
25426
|
fromNumber(e) {
|
|
25412
|
-
return this.buf = new
|
|
25427
|
+
return this.buf = new Ne().writeVarIntNum(e).toBuffer(), this;
|
|
25413
25428
|
}
|
|
25414
25429
|
static fromNumber(e) {
|
|
25415
25430
|
return new this().fromNumber(e);
|
|
@@ -25459,7 +25474,7 @@ class He extends Ce {
|
|
|
25459
25474
|
return this.txHashBuf = e.read(32), this.txOutNum = e.readUInt32LE(), this.scriptVi = qe.fromBuffer(e.readVarIntBuf()), this.script = Ae.fromBuffer(e.read(this.scriptVi.toNumber())), this.nSequence = e.readUInt32LE(), this;
|
|
25460
25475
|
}
|
|
25461
25476
|
toBw(e) {
|
|
25462
|
-
return e || (e = new
|
|
25477
|
+
return e || (e = new Ne()), e.write(this.txHashBuf), e.writeUInt32LE(this.txOutNum), e.write(this.scriptVi.buf), e.write(this.script.toBuffer()), e.writeUInt32LE(this.nSequence), e;
|
|
25463
25478
|
}
|
|
25464
25479
|
/**
|
|
25465
25480
|
* Generate txIn with blank signatures from a txOut and its
|
|
@@ -25506,7 +25521,7 @@ class gt extends Ce {
|
|
|
25506
25521
|
}
|
|
25507
25522
|
fromJSON(e) {
|
|
25508
25523
|
return this.fromObject({
|
|
25509
|
-
valueBn: new
|
|
25524
|
+
valueBn: new ee().fromJSON(e.valueBn),
|
|
25510
25525
|
scriptVi: new qe().fromJSON(e.scriptVi),
|
|
25511
25526
|
script: new Ae().fromJSON(e.script)
|
|
25512
25527
|
}), this;
|
|
@@ -25522,10 +25537,10 @@ class gt extends Ce {
|
|
|
25522
25537
|
return this.valueBn = e.readUInt64LEBn(), this.scriptVi = qe.fromNumber(e.readVarIntNum()), this.script = new Ae().fromBuffer(e.read(this.scriptVi.toNumber())), this;
|
|
25523
25538
|
}
|
|
25524
25539
|
toBw(e) {
|
|
25525
|
-
return e || (e = new
|
|
25540
|
+
return e || (e = new Ne()), e.writeUInt64LEBn(this.valueBn), e.write(this.scriptVi.buf), e.write(this.script.toBuffer()), e;
|
|
25526
25541
|
}
|
|
25527
25542
|
}
|
|
25528
|
-
class
|
|
25543
|
+
class ke extends Ce {
|
|
25529
25544
|
constructor(e = 1, t = qe.fromNumber(0), n = [], u = qe.fromNumber(0), r = [], s = 0) {
|
|
25530
25545
|
super({ versionBytesNum: e, txInsVi: t, txIns: n, txOutsVi: u, txOuts: r, nLockTime: s });
|
|
25531
25546
|
}
|
|
@@ -25577,7 +25592,7 @@ class Me extends Ce {
|
|
|
25577
25592
|
return this.nLockTime = e.readUInt32LE(), this;
|
|
25578
25593
|
}
|
|
25579
25594
|
toBw(e) {
|
|
25580
|
-
e || (e = new
|
|
25595
|
+
e || (e = new Ne()), e.writeUInt32LE(this.versionBytesNum), e.write(this.txInsVi.buf);
|
|
25581
25596
|
for (let t = 0; t < this.txIns.length; t++)
|
|
25582
25597
|
this.txIns[t].toBw(e);
|
|
25583
25598
|
e.write(this.txOutsVi.buf);
|
|
@@ -25587,7 +25602,7 @@ class Me extends Ce {
|
|
|
25587
25602
|
}
|
|
25588
25603
|
// https://github.com/Bitcoin-UAHF/spec/blob/master/replay-protected-sighash.md
|
|
25589
25604
|
hashPrevouts() {
|
|
25590
|
-
const e = new
|
|
25605
|
+
const e = new Ne();
|
|
25591
25606
|
for (const t in this.txIns) {
|
|
25592
25607
|
const n = this.txIns[t];
|
|
25593
25608
|
e.write(n.txHashBuf), e.writeUInt32LE(n.txOutNum);
|
|
@@ -25595,7 +25610,7 @@ class Me extends Ce {
|
|
|
25595
25610
|
return ae.sha256Sha256(e.toBuffer());
|
|
25596
25611
|
}
|
|
25597
25612
|
hashSequence() {
|
|
25598
|
-
const e = new
|
|
25613
|
+
const e = new Ne();
|
|
25599
25614
|
for (const t in this.txIns) {
|
|
25600
25615
|
const n = this.txIns[t];
|
|
25601
25616
|
e.writeUInt32LE(n.nSequence);
|
|
@@ -25603,7 +25618,7 @@ class Me extends Ce {
|
|
|
25603
25618
|
return ae.sha256Sha256(e.toBuffer());
|
|
25604
25619
|
}
|
|
25605
25620
|
hashOutputs() {
|
|
25606
|
-
const e = new
|
|
25621
|
+
const e = new Ne();
|
|
25607
25622
|
for (const t in this.txOuts) {
|
|
25608
25623
|
const n = this.txOuts[t];
|
|
25609
25624
|
e.write(n.toBuffer());
|
|
@@ -25615,11 +25630,11 @@ class Me extends Ce {
|
|
|
25615
25630
|
* p2sh transaction, subScript is usually the redeemScript. If you're not
|
|
25616
25631
|
* normal because you're using OP_CODESEPARATORs, you know what to do.
|
|
25617
25632
|
*/
|
|
25618
|
-
sighash(e, t, n, u, r =
|
|
25633
|
+
sighash(e, t, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID, s = new Nr()) {
|
|
25619
25634
|
const a = this.sighashPreimage(e, t, n, u, r, s);
|
|
25620
25635
|
return a.compare(Buffer.from("0000000000000000000000000000000000000000000000000000000000000001", "hex")) === 0 ? a : new ot(ae.sha256Sha256(a)).readReverse();
|
|
25621
25636
|
}
|
|
25622
|
-
async asyncSighash(e, t, n, u, r =
|
|
25637
|
+
async asyncSighash(e, t, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID, s = {}) {
|
|
25623
25638
|
return (await be.asyncObjectMethod(this, "sighash", [
|
|
25624
25639
|
e,
|
|
25625
25640
|
t,
|
|
@@ -25629,11 +25644,16 @@ class Me extends Ce {
|
|
|
25629
25644
|
s
|
|
25630
25645
|
])).resbuf;
|
|
25631
25646
|
}
|
|
25632
|
-
sighashPreimage(e, t, n, u, r =
|
|
25633
|
-
if (u === void 0 && (u = new
|
|
25647
|
+
sighashPreimage(e, t, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID, s = new Nr()) {
|
|
25648
|
+
if (u === void 0 && (u = new ee(0)), t >= this.txIns.length)
|
|
25649
|
+
return Buffer.from(
|
|
25650
|
+
"0000000000000000000000000000000000000000000000000000000000000001",
|
|
25651
|
+
"hex"
|
|
25652
|
+
);
|
|
25653
|
+
if (e & he.SIGHASH_FORKID && !(e & he.SIGHASH_CHRONICLE) && r & ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
25634
25654
|
let f = Buffer.alloc(32, 0), i = Buffer.alloc(32, 0), c = Buffer.alloc(32, 0);
|
|
25635
25655
|
e & he.SIGHASH_ANYONECANPAY || (f = s.prevoutsHashBuf ? s.prevoutsHashBuf : s.prevoutsHashBuf = this.hashPrevouts()), !(e & he.SIGHASH_ANYONECANPAY) && (e & 31) !== he.SIGHASH_SINGLE && (e & 31) !== he.SIGHASH_NONE && (i = s.sequenceHashBuf ? s.sequenceHashBuf : s.sequenceHashBuf = this.hashSequence()), (e & 31) !== he.SIGHASH_SINGLE && (e & 31) !== he.SIGHASH_NONE ? c = s.outputsHashBuf ? s.outputsHashBuf : s.outputsHashBuf = this.hashOutputs() : (e & 31) === he.SIGHASH_SINGLE && t < this.txOuts.length && (c = ae.sha256Sha256(this.txOuts[t].toBuffer()));
|
|
25636
|
-
const h = new
|
|
25656
|
+
const h = new Ne();
|
|
25637
25657
|
return h.writeUInt32LE(this.versionBytesNum), h.write(f), h.write(i), h.write(this.txIns[t].txHashBuf), h.writeUInt32LE(this.txIns[t].txOutNum), h.writeVarIntNum(n.toBuffer().length), h.write(n.toBuffer()), h.writeUInt64LEBn(u), h.writeUInt32LE(this.txIns[t].nSequence), h.write(c), h.writeUInt32LE(this.nLockTime), h.writeUInt32LE(e >>> 0), h.toBuffer();
|
|
25638
25658
|
}
|
|
25639
25659
|
const a = this.cloneByBuffer();
|
|
@@ -25657,15 +25677,15 @@ class Me extends Ce {
|
|
|
25657
25677
|
a.txOuts.length = t + 1, a.txOutsVi = qe.fromNumber(t + 1);
|
|
25658
25678
|
for (let f = 0; f < a.txOuts.length; f++)
|
|
25659
25679
|
f < t && (a.txOuts[f] = gt.fromProperties(
|
|
25660
|
-
new
|
|
25680
|
+
new ee().fromBuffer(Buffer.from("ffffffffffffffff", "hex")),
|
|
25661
25681
|
new Ae()
|
|
25662
25682
|
));
|
|
25663
25683
|
for (let f = 0; f < a.txIns.length; f++)
|
|
25664
25684
|
f !== t && (a.txIns[f].nSequence = 0);
|
|
25665
25685
|
}
|
|
25666
|
-
return e & he.SIGHASH_ANYONECANPAY && (a.txIns[0] = a.txIns[t], a.txIns.length = 1, a.txInsVi = qe.fromNumber(1)), new
|
|
25686
|
+
return e & he.SIGHASH_ANYONECANPAY && (a.txIns[0] = a.txIns[t], a.txIns.length = 1, a.txInsVi = qe.fromNumber(1)), new Ne().write(a.toBuffer()).writeUInt32LE(e >>> 0).toBuffer();
|
|
25667
25687
|
}
|
|
25668
|
-
async asyncSighashPreimage(e, t, n, u, r =
|
|
25688
|
+
async asyncSighashPreimage(e, t, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID, s = {}) {
|
|
25669
25689
|
return (await be.asyncObjectMethod(this, "sighashPreimage", [
|
|
25670
25690
|
e,
|
|
25671
25691
|
t,
|
|
@@ -25676,13 +25696,13 @@ class Me extends Ce {
|
|
|
25676
25696
|
])).resbuf;
|
|
25677
25697
|
}
|
|
25678
25698
|
// This function returns a signature but does not update any inputs
|
|
25679
|
-
sign(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r, s =
|
|
25699
|
+
sign(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r, s = ke.SCRIPT_ENABLE_SIGHASH_FORKID, a = {}) {
|
|
25680
25700
|
const o = this.sighash(t, n, u, r, s, a);
|
|
25681
25701
|
return this.preImageBuf = o, ht.sign(o, e, "little").fromObject({
|
|
25682
25702
|
nHashType: t
|
|
25683
25703
|
});
|
|
25684
25704
|
}
|
|
25685
|
-
async asyncSign(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r, s =
|
|
25705
|
+
async asyncSign(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r, s = ke.SCRIPT_ENABLE_SIGHASH_FORKID, a = {}) {
|
|
25686
25706
|
const o = await be.asyncObjectMethod(this, "sign", [
|
|
25687
25707
|
e,
|
|
25688
25708
|
t,
|
|
@@ -25695,11 +25715,11 @@ class Me extends Ce {
|
|
|
25695
25715
|
return new he().fromFastBuffer(o.resbuf);
|
|
25696
25716
|
}
|
|
25697
25717
|
// This function takes a signature as input and does not parse any inputs
|
|
25698
|
-
verify(e, t, n, u, r = !1, s, a =
|
|
25718
|
+
verify(e, t, n, u, r = !1, s, a = ke.SCRIPT_ENABLE_SIGHASH_FORKID, o = {}) {
|
|
25699
25719
|
const f = this.sighash(e.nHashType, n, u, s, a, o);
|
|
25700
25720
|
return ht.verify(f, e, t, "little", r);
|
|
25701
25721
|
}
|
|
25702
|
-
async asyncVerify(e, t, n, u, r = !1, s, a =
|
|
25722
|
+
async asyncVerify(e, t, n, u, r = !1, s, a = ke.SCRIPT_ENABLE_SIGHASH_FORKID, o = {}) {
|
|
25703
25723
|
const f = await be.asyncObjectMethod(this, "verify", [
|
|
25704
25724
|
e,
|
|
25705
25725
|
t,
|
|
@@ -25746,8 +25766,8 @@ class Me extends Ce {
|
|
|
25746
25766
|
return this.txIns.sort((e, t) => new ot(e.txHashBuf).readReverse().compare(new ot(t.txHashBuf).readReverse()) || e.txOutNum - t.txOutNum), this.txOuts.sort((e, t) => e.valueBn.sub(t.valueBn).toNumber() || e.script.toBuffer().compare(t.script.toBuffer())), this;
|
|
25747
25767
|
}
|
|
25748
25768
|
}
|
|
25749
|
-
|
|
25750
|
-
|
|
25769
|
+
ke.MAX_MONEY = 21e6 * 1e8;
|
|
25770
|
+
ke.SCRIPT_ENABLE_SIGHASH_FORKID = 65536;
|
|
25751
25771
|
class ss extends Ce {
|
|
25752
25772
|
constructor(e, t, n) {
|
|
25753
25773
|
super({ blockHeader: e, txsVi: t, txs: n });
|
|
@@ -25755,7 +25775,7 @@ class ss extends Ce {
|
|
|
25755
25775
|
fromJSON(e) {
|
|
25756
25776
|
const t = [];
|
|
25757
25777
|
return e.txs.forEach(function(n) {
|
|
25758
|
-
t.push(new
|
|
25778
|
+
t.push(new ke().fromJSON(n));
|
|
25759
25779
|
}), this.fromObject({
|
|
25760
25780
|
blockHeader: new Pr().fromJSON(e.blockHeader),
|
|
25761
25781
|
txsVi: new qe().fromJSON(e.txsVi),
|
|
@@ -25777,11 +25797,11 @@ class ss extends Ce {
|
|
|
25777
25797
|
const t = this.txsVi.toNumber();
|
|
25778
25798
|
this.txs = [];
|
|
25779
25799
|
for (let n = 0; n < t; n++)
|
|
25780
|
-
this.txs.push(new
|
|
25800
|
+
this.txs.push(new ke().fromBr(e));
|
|
25781
25801
|
return this;
|
|
25782
25802
|
}
|
|
25783
25803
|
toBw(e) {
|
|
25784
|
-
e || (e = new
|
|
25804
|
+
e || (e = new Ne()), e.write(this.blockHeader.toBuffer()), e.write(this.txsVi.buf);
|
|
25785
25805
|
const t = this.txsVi.toNumber();
|
|
25786
25806
|
for (let n = 0; n < t; n++)
|
|
25787
25807
|
this.txs[n].toBw(e);
|
|
@@ -25821,7 +25841,7 @@ class ss extends Ce {
|
|
|
25821
25841
|
txsNum: r,
|
|
25822
25842
|
*[Symbol.iterator]() {
|
|
25823
25843
|
for (let s = 0; s < r; s++)
|
|
25824
|
-
yield new
|
|
25844
|
+
yield new ke().fromBr(t);
|
|
25825
25845
|
}
|
|
25826
25846
|
};
|
|
25827
25847
|
}
|
|
@@ -25925,7 +25945,7 @@ class C1 {
|
|
|
25925
25945
|
}
|
|
25926
25946
|
/** Create a simple coinbase transaction */
|
|
25927
25947
|
static createCoinbaseTx() {
|
|
25928
|
-
return new
|
|
25948
|
+
return new ke();
|
|
25929
25949
|
}
|
|
25930
25950
|
/** Validate complete block */
|
|
25931
25951
|
static validateBlock(e, t) {
|
|
@@ -25957,7 +25977,7 @@ function jf(l) {
|
|
|
25957
25977
|
return l.length === 0 || (l[l.length - 1] & 127) !== 0 ? l : l.length === 1 ? [] : (l[l.length - 2] & 128) === 0 ? jf(l.slice(0, l.length - 1)) : l;
|
|
25958
25978
|
}
|
|
25959
25979
|
class re extends Ce {
|
|
25960
|
-
constructor(e, t, n, u = [], r = [], s = 0, a = 0, o = 0, f = [], i = "", c = re.defaultFlags, h = new
|
|
25980
|
+
constructor(e, t, n, u = [], r = [], s = 0, a = 0, o = 0, f = [], i = "", c = re.defaultFlags, h = new ee(0)) {
|
|
25961
25981
|
super({
|
|
25962
25982
|
script: e,
|
|
25963
25983
|
tx: t,
|
|
@@ -25974,7 +25994,7 @@ class re extends Ce {
|
|
|
25974
25994
|
});
|
|
25975
25995
|
}
|
|
25976
25996
|
initialize() {
|
|
25977
|
-
return this.script = new Ae(), this.stack = [], this.altStack = [], this.pc = 0, this.pBeginCodeHash = 0, this.nOpCount = 0, this.ifStack = [], this.errStr = "", this.flags = re.defaultFlags, this.setLimits(), this;
|
|
25997
|
+
return this.script = new Ae(), this.stack = [], this.altStack = [], this.pc = 0, this.pBeginCodeHash = 0, this.nOpCount = 0, this.ifStack = [], this.elseStack = [], this.errStr = "", this.flags = re.defaultFlags, this.setLimits(), this;
|
|
25978
25998
|
}
|
|
25979
25999
|
setLimits() {
|
|
25980
26000
|
return this.scriptLimit = this.isPreGenesis() ? re.PREGENESIS_SCRIPT_LIMIT : 1e7, this.stackLimit = this.isPreGenesis() ? re.PREGENESIS_STACK_LIMIT : 1e7, this;
|
|
@@ -26012,17 +26032,17 @@ class re extends Ce {
|
|
|
26012
26032
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26013
26033
|
let u, r = 0, s, a;
|
|
26014
26034
|
try {
|
|
26015
|
-
const c = this.stack[this.stack.length - 1], h = new
|
|
26035
|
+
const c = this.stack[this.stack.length - 1], h = new ee().fromScriptNumBuffer(
|
|
26016
26036
|
c,
|
|
26017
26037
|
t,
|
|
26018
26038
|
this.scriptNumMaxSize()
|
|
26019
26039
|
);
|
|
26020
26040
|
if (n || e === q.OP_LEFT_CHRONICLE || e === q.OP_RIGHT_CHRONICLE ? u = h.toNumber() : s = h.toNumber(), n) {
|
|
26021
26041
|
const d = this.stack[this.stack.length - 2];
|
|
26022
|
-
r = new
|
|
26042
|
+
r = new ee().fromScriptNumBuffer(d, t, this.scriptNumMaxSize()).toNumber();
|
|
26023
26043
|
} else if (!n) {
|
|
26024
26044
|
const d = this.stack[this.stack.length - 2];
|
|
26025
|
-
a = new
|
|
26045
|
+
a = new ee().fromScriptNumBuffer(
|
|
26026
26046
|
d,
|
|
26027
26047
|
t,
|
|
26028
26048
|
this.scriptNumMaxSize()
|
|
@@ -26042,13 +26062,7 @@ class re extends Ce {
|
|
|
26042
26062
|
return this.errStr = "SCRIPT_ERR_INVALID_NUMBER_RANGE", !1;
|
|
26043
26063
|
const o = a.negative, f = a.abs();
|
|
26044
26064
|
let i;
|
|
26045
|
-
|
|
26046
|
-
i = f.ushln(s);
|
|
26047
|
-
else {
|
|
26048
|
-
const c = new Z(1).ushln(s);
|
|
26049
|
-
i = f.add(c.sub(1)).div(c);
|
|
26050
|
-
}
|
|
26051
|
-
return o && (i = i.ineg()), this.stack.pop(), this.stack.pop(), this.stack.push(i.toScriptNumBuffer()), !0;
|
|
26065
|
+
return e === q.OP_LSHIFTNUM ? i = f.ushln(s) : i = f.ushrn(s), o && (i = i.ineg()), i.toBuffer().length > this.scriptNumMaxSize() ? (this.errStr = "SCRIPTNUM_OVERFLOW", !1) : (this.stack.pop(), this.stack.pop(), this.stack.push(i.toScriptNumBuffer()), !0);
|
|
26052
26066
|
}
|
|
26053
26067
|
static castToBool(e) {
|
|
26054
26068
|
for (let t = 0; t < e.length; t++)
|
|
@@ -26064,10 +26078,9 @@ class re extends Ce {
|
|
|
26064
26078
|
return !0;
|
|
26065
26079
|
if ((this.flags & (re.SCRIPT_VERIFY_DERSIG | re.SCRIPT_VERIFY_LOW_S | re.SCRIPT_VERIFY_STRICTENC)) !== 0 && !he.IsTxDer(e))
|
|
26066
26080
|
return this.errStr = "SCRIPT_ERR_SIG_DER", !1;
|
|
26067
|
-
if ((this.flags & re.SCRIPT_VERIFY_LOW_S) !== 0 && !this.isChronicle())
|
|
26068
|
-
|
|
26069
|
-
|
|
26070
|
-
} else if ((this.flags & re.SCRIPT_VERIFY_STRICTENC) !== 0) {
|
|
26081
|
+
if ((this.flags & re.SCRIPT_VERIFY_LOW_S) !== 0 && !this.isChronicle() && !new he().fromTxFormat(e).hasLowS())
|
|
26082
|
+
return this.errStr = "SCRIPT_ERR_SIG_HIGH_S", !1;
|
|
26083
|
+
if ((this.flags & re.SCRIPT_VERIFY_STRICTENC) !== 0) {
|
|
26071
26084
|
const t = new he().fromTxFormat(e);
|
|
26072
26085
|
if (!t.hasDefinedHashType())
|
|
26073
26086
|
return this.errStr = "SCRIPT_ERR_SIG_HASHTYPE", !1;
|
|
@@ -26075,7 +26088,7 @@ class re extends Ce {
|
|
|
26075
26088
|
return this.errStr = "SCRIPT_ERR_ILLEGAL_FORKID", !1;
|
|
26076
26089
|
if (t.isChronicle() && !this.isChronicle())
|
|
26077
26090
|
return this.errStr = "SCRIPT_ERR_ILLEGAL_CHRONICLE", !1;
|
|
26078
|
-
if (this.flags & re.SCRIPT_ENABLE_SIGHASH_FORKID && !(t.nHashType & he.SIGHASH_FORKID)
|
|
26091
|
+
if (this.flags & re.SCRIPT_ENABLE_SIGHASH_FORKID && !(t.nHashType & he.SIGHASH_FORKID))
|
|
26079
26092
|
return this.errStr = "SCRIPT_ERR_MUST_USE_FORKID", !1;
|
|
26080
26093
|
}
|
|
26081
26094
|
return !0;
|
|
@@ -26151,7 +26164,7 @@ class re extends Ce {
|
|
|
26151
26164
|
case q.OP_15:
|
|
26152
26165
|
case q.OP_16:
|
|
26153
26166
|
{
|
|
26154
|
-
let r = n - (q.OP_1 - 1), s = new
|
|
26167
|
+
let r = n - (q.OP_1 - 1), s = new ee(r).toScriptNumBuffer();
|
|
26155
26168
|
this.stack.push(s);
|
|
26156
26169
|
}
|
|
26157
26170
|
break;
|
|
@@ -26172,7 +26185,7 @@ class re extends Ce {
|
|
|
26172
26185
|
let r;
|
|
26173
26186
|
try {
|
|
26174
26187
|
const s = this.stack[this.stack.length - 1];
|
|
26175
|
-
r = new
|
|
26188
|
+
r = new ee().fromScriptNumBuffer(
|
|
26176
26189
|
s,
|
|
26177
26190
|
e,
|
|
26178
26191
|
5
|
|
@@ -26198,7 +26211,7 @@ class re extends Ce {
|
|
|
26198
26211
|
let r;
|
|
26199
26212
|
try {
|
|
26200
26213
|
const s = this.stack[this.stack.length - 1];
|
|
26201
|
-
r = new
|
|
26214
|
+
r = new ee().fromScriptNumBuffer(
|
|
26202
26215
|
s,
|
|
26203
26216
|
e,
|
|
26204
26217
|
5
|
|
@@ -26233,7 +26246,7 @@ class re extends Ce {
|
|
|
26233
26246
|
case q.OP_VERIF:
|
|
26234
26247
|
case q.OP_VERNOTIF:
|
|
26235
26248
|
{
|
|
26236
|
-
if ((n === q.OP_VERIF || n === q.OP_VERNOTIF) && !this.isChronicle())
|
|
26249
|
+
if ((n === q.OP_VERIF || n === q.OP_VERNOTIF) && u && !this.isChronicle())
|
|
26237
26250
|
return this.errStr = "SCRIPT_ERR_BAD_OPCODE", !1;
|
|
26238
26251
|
let r = !1;
|
|
26239
26252
|
if (u) {
|
|
@@ -26244,18 +26257,20 @@ class re extends Ce {
|
|
|
26244
26257
|
return this.errStr = "SCRIPT_ERR_MINIMALIF", !1;
|
|
26245
26258
|
n === q.OP_VERIF || n === q.OP_VERNOTIF ? r = s.length === 4 && s.equals(this.versionBuf()) : r = re.castToBool(s), (n === q.OP_NOTIF || n === q.OP_VERNOTIF) && (r = !r);
|
|
26246
26259
|
}
|
|
26247
|
-
this.ifStack.push(r);
|
|
26260
|
+
this.ifStack.push(r), this.elseStack.push(!1);
|
|
26248
26261
|
}
|
|
26249
26262
|
break;
|
|
26250
26263
|
case q.OP_ELSE:
|
|
26251
26264
|
if (this.ifStack.length === 0)
|
|
26252
26265
|
return this.errStr = "SCRIPT_ERR_UNBALANCED_CONDITIONAL", !1;
|
|
26253
|
-
this.
|
|
26266
|
+
if (this.elseStack[this.elseStack.length - 1] && this.isChronicle())
|
|
26267
|
+
return this.errStr = "SCRIPT_ERR_UNBALANCED_CONDITIONAL", !1;
|
|
26268
|
+
this.elseStack[this.elseStack.length - 1] = !0, this.ifStack[this.ifStack.length - 1] = !this.ifStack[this.ifStack.length - 1];
|
|
26254
26269
|
break;
|
|
26255
26270
|
case q.OP_ENDIF:
|
|
26256
26271
|
if (this.ifStack.length === 0)
|
|
26257
26272
|
return this.errStr = "SCRIPT_ERR_UNBALANCED_CONDITIONAL", !1;
|
|
26258
|
-
this.ifStack.pop();
|
|
26273
|
+
this.ifStack.pop(), this.elseStack.pop();
|
|
26259
26274
|
break;
|
|
26260
26275
|
case q.OP_VER:
|
|
26261
26276
|
{
|
|
@@ -26345,7 +26360,7 @@ class re extends Ce {
|
|
|
26345
26360
|
break;
|
|
26346
26361
|
case q.OP_DEPTH:
|
|
26347
26362
|
{
|
|
26348
|
-
const r = new
|
|
26363
|
+
const r = new ee(this.stack.length).toScriptNumBuffer();
|
|
26349
26364
|
this.stack.push(r);
|
|
26350
26365
|
}
|
|
26351
26366
|
break;
|
|
@@ -26377,7 +26392,7 @@ class re extends Ce {
|
|
|
26377
26392
|
let r;
|
|
26378
26393
|
try {
|
|
26379
26394
|
const a = this.stack[this.stack.length - 1];
|
|
26380
|
-
r = new
|
|
26395
|
+
r = new ee().fromScriptNumBuffer(a, e, this.scriptNumMaxSize()).toNumber();
|
|
26381
26396
|
} catch (a) {
|
|
26382
26397
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26383
26398
|
}
|
|
@@ -26416,7 +26431,7 @@ class re extends Ce {
|
|
|
26416
26431
|
{
|
|
26417
26432
|
if (this.stack.length < 1)
|
|
26418
26433
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26419
|
-
const r = new
|
|
26434
|
+
const r = new ee(this.stack[this.stack.length - 1].length);
|
|
26420
26435
|
this.stack.push(r.toScriptNumBuffer());
|
|
26421
26436
|
}
|
|
26422
26437
|
break;
|
|
@@ -26464,10 +26479,10 @@ class re extends Ce {
|
|
|
26464
26479
|
if (this.stack.length < 2)
|
|
26465
26480
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26466
26481
|
const r = this.stack[this.stack.length - 2];
|
|
26467
|
-
let s = new
|
|
26482
|
+
let s = new ee(r), a;
|
|
26468
26483
|
try {
|
|
26469
26484
|
const f = this.stack[this.stack.length - 1];
|
|
26470
|
-
a = new
|
|
26485
|
+
a = new ee().fromScriptNumBuffer(
|
|
26471
26486
|
f,
|
|
26472
26487
|
e,
|
|
26473
26488
|
this.scriptNumMaxSize()
|
|
@@ -26477,7 +26492,11 @@ class re extends Ce {
|
|
|
26477
26492
|
}
|
|
26478
26493
|
if (a < 0)
|
|
26479
26494
|
return this.errStr = "SCRIPT_ERR_INVALID_NUMBER_RANGE", !1;
|
|
26480
|
-
|
|
26495
|
+
if (this.stack.pop(), this.stack.pop(), a >= r.length * 8) {
|
|
26496
|
+
this.stack.push(Buffer.alloc(r.length));
|
|
26497
|
+
break;
|
|
26498
|
+
}
|
|
26499
|
+
switch (n) {
|
|
26481
26500
|
case q.OP_LSHIFT:
|
|
26482
26501
|
s = s.shln(a);
|
|
26483
26502
|
break;
|
|
@@ -26521,7 +26540,7 @@ class re extends Ce {
|
|
|
26521
26540
|
const r = this.stack[this.stack.length - 1];
|
|
26522
26541
|
let s;
|
|
26523
26542
|
try {
|
|
26524
|
-
s = new
|
|
26543
|
+
s = new ee().fromScriptNumBuffer(r, e, this.scriptNumMaxSize());
|
|
26525
26544
|
} catch (a) {
|
|
26526
26545
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26527
26546
|
}
|
|
@@ -26536,7 +26555,7 @@ class re extends Ce {
|
|
|
26536
26555
|
s = s.add(s);
|
|
26537
26556
|
break;
|
|
26538
26557
|
case q.OP_2DIV:
|
|
26539
|
-
s = s.div(new
|
|
26558
|
+
s = s.div(new ee(2));
|
|
26540
26559
|
break;
|
|
26541
26560
|
case q.OP_NEGATE:
|
|
26542
26561
|
s = s.neg();
|
|
@@ -26545,10 +26564,10 @@ class re extends Ce {
|
|
|
26545
26564
|
s.lt(0) && (s = s.neg());
|
|
26546
26565
|
break;
|
|
26547
26566
|
case q.OP_NOT:
|
|
26548
|
-
s = new
|
|
26567
|
+
s = new ee(s.eq(0) ? 1 : 0);
|
|
26549
26568
|
break;
|
|
26550
26569
|
case q.OP_0NOTEQUAL:
|
|
26551
|
-
s = new
|
|
26570
|
+
s = new ee(s.neq(0) ? 1 : 0);
|
|
26552
26571
|
break;
|
|
26553
26572
|
}
|
|
26554
26573
|
this.stack.pop(), this.stack.push(s.toScriptNumBuffer());
|
|
@@ -26575,11 +26594,11 @@ class re extends Ce {
|
|
|
26575
26594
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26576
26595
|
let r, s;
|
|
26577
26596
|
try {
|
|
26578
|
-
r = new
|
|
26597
|
+
r = new ee().fromScriptNumBuffer(
|
|
26579
26598
|
this.stack[this.stack.length - 2],
|
|
26580
26599
|
e,
|
|
26581
26600
|
this.scriptNumMaxSize()
|
|
26582
|
-
), s = new
|
|
26601
|
+
), s = new ee().fromScriptNumBuffer(
|
|
26583
26602
|
this.stack[this.stack.length - 1],
|
|
26584
26603
|
e,
|
|
26585
26604
|
this.scriptNumMaxSize()
|
|
@@ -26587,7 +26606,7 @@ class re extends Ce {
|
|
|
26587
26606
|
} catch (o) {
|
|
26588
26607
|
return this.errStr = o.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26589
26608
|
}
|
|
26590
|
-
let a = new
|
|
26609
|
+
let a = new ee(0);
|
|
26591
26610
|
switch (n) {
|
|
26592
26611
|
case q.OP_ADD:
|
|
26593
26612
|
a = r.add(s);
|
|
@@ -26609,31 +26628,31 @@ class re extends Ce {
|
|
|
26609
26628
|
a = r.mod(s);
|
|
26610
26629
|
break;
|
|
26611
26630
|
case q.OP_BOOLAND:
|
|
26612
|
-
a = new
|
|
26631
|
+
a = new ee(r.neq(0) && s.neq(0) ? 1 : 0);
|
|
26613
26632
|
break;
|
|
26614
26633
|
case q.OP_BOOLOR:
|
|
26615
|
-
a = new
|
|
26634
|
+
a = new ee(r.neq(0) || s.neq(0) ? 1 : 0);
|
|
26616
26635
|
break;
|
|
26617
26636
|
case q.OP_NUMEQUAL:
|
|
26618
|
-
a = new
|
|
26637
|
+
a = new ee(r.eq(s) ? 1 : 0);
|
|
26619
26638
|
break;
|
|
26620
26639
|
case q.OP_NUMEQUALVERIFY:
|
|
26621
|
-
a = new
|
|
26640
|
+
a = new ee(r.eq(s) ? 1 : 0);
|
|
26622
26641
|
break;
|
|
26623
26642
|
case q.OP_NUMNOTEQUAL:
|
|
26624
|
-
a = new
|
|
26643
|
+
a = new ee(r.neq(s) ? 1 : 0);
|
|
26625
26644
|
break;
|
|
26626
26645
|
case q.OP_LESSTHAN:
|
|
26627
|
-
a = new
|
|
26646
|
+
a = new ee(r.lt(s) ? 1 : 0);
|
|
26628
26647
|
break;
|
|
26629
26648
|
case q.OP_GREATERTHAN:
|
|
26630
|
-
a = new
|
|
26649
|
+
a = new ee(r.gt(s) ? 1 : 0);
|
|
26631
26650
|
break;
|
|
26632
26651
|
case q.OP_LESSTHANOREQUAL:
|
|
26633
|
-
a = new
|
|
26652
|
+
a = new ee(r.leq(s) ? 1 : 0);
|
|
26634
26653
|
break;
|
|
26635
26654
|
case q.OP_GREATERTHANOREQUAL:
|
|
26636
|
-
a = new
|
|
26655
|
+
a = new ee(r.geq(s) ? 1 : 0);
|
|
26637
26656
|
break;
|
|
26638
26657
|
case q.OP_MIN:
|
|
26639
26658
|
a = r.lt(s) ? r : s;
|
|
@@ -26655,15 +26674,15 @@ class re extends Ce {
|
|
|
26655
26674
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26656
26675
|
let r, s, a;
|
|
26657
26676
|
try {
|
|
26658
|
-
r = new
|
|
26677
|
+
r = new ee().fromScriptNumBuffer(
|
|
26659
26678
|
this.stack[this.stack.length - 3],
|
|
26660
26679
|
e,
|
|
26661
26680
|
this.scriptNumMaxSize()
|
|
26662
|
-
), s = new
|
|
26681
|
+
), s = new ee().fromScriptNumBuffer(
|
|
26663
26682
|
this.stack[this.stack.length - 2],
|
|
26664
26683
|
e,
|
|
26665
26684
|
this.scriptNumMaxSize()
|
|
26666
|
-
), a = new
|
|
26685
|
+
), a = new ee().fromScriptNumBuffer(
|
|
26667
26686
|
this.stack[this.stack.length - 1],
|
|
26668
26687
|
e,
|
|
26669
26688
|
this.scriptNumMaxSize()
|
|
@@ -26741,7 +26760,7 @@ class re extends Ce {
|
|
|
26741
26760
|
let s;
|
|
26742
26761
|
try {
|
|
26743
26762
|
const d = this.stack[this.stack.length - r];
|
|
26744
|
-
s = new
|
|
26763
|
+
s = new ee().fromScriptNumBuffer(d, e).toNumber();
|
|
26745
26764
|
} catch (d) {
|
|
26746
26765
|
return this.errStr = d.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26747
26766
|
}
|
|
@@ -26755,7 +26774,7 @@ class re extends Ce {
|
|
|
26755
26774
|
let o;
|
|
26756
26775
|
try {
|
|
26757
26776
|
const d = this.stack[this.stack.length - r];
|
|
26758
|
-
o = new
|
|
26777
|
+
o = new ee().fromScriptNumBuffer(d, e).toNumber();
|
|
26759
26778
|
} catch (d) {
|
|
26760
26779
|
return this.errStr = d.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26761
26780
|
}
|
|
@@ -26773,11 +26792,10 @@ class re extends Ce {
|
|
|
26773
26792
|
} else
|
|
26774
26793
|
i.findAndDelete(new Ae().writeBuffer(b));
|
|
26775
26794
|
}
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
const b = this.stack[this.stack.length - a];
|
|
26795
|
+
const c = o;
|
|
26796
|
+
let h = !0;
|
|
26797
|
+
for (; h && o > 0; ) {
|
|
26798
|
+
const d = this.stack[this.stack.length - f], b = this.stack[this.stack.length - a];
|
|
26781
26799
|
if (!this.checkSigEncoding(d) || !this.checkPubKeyEncoding(b))
|
|
26782
26800
|
return !1;
|
|
26783
26801
|
let p;
|
|
@@ -26795,10 +26813,13 @@ class re extends Ce {
|
|
|
26795
26813
|
} catch {
|
|
26796
26814
|
p = !1;
|
|
26797
26815
|
}
|
|
26798
|
-
p && (f++, o--), a++, s--, o > s && (
|
|
26816
|
+
p && (f++, o--), a++, s--, o > s && (h = !1);
|
|
26817
|
+
}
|
|
26818
|
+
if (!h && (this.flags & re.SCRIPT_VERIFY_NULLFAIL) !== 0 && !this.isChronicle()) {
|
|
26819
|
+
for (let d = 0; d < c; d++)
|
|
26820
|
+
if (this.stack[this.stack.length - f - d].length > 0)
|
|
26821
|
+
return this.errStr = "SCRIPT_ERR_SIG_NULLFAIL", !1;
|
|
26799
26822
|
}
|
|
26800
|
-
if (!c && s === 0 && (this.flags & re.SCRIPT_VERIFY_NULLFAIL) !== 0 && !this.isChronicle() && h.length > 0)
|
|
26801
|
-
return this.errStr = "SCRIPT_ERR_SIG_NULLFAIL", !1;
|
|
26802
26823
|
for (; r-- > 1; )
|
|
26803
26824
|
this.stack.pop();
|
|
26804
26825
|
if (this.stack.length < 1)
|
|
@@ -26808,8 +26829,8 @@ class re extends Ce {
|
|
|
26808
26829
|
this.flags & re.SCRIPT_VERIFY_NULLDUMMY && !this.isChronicle() && this.stack[this.stack.length - 1].length
|
|
26809
26830
|
)
|
|
26810
26831
|
return this.errStr = "SCRIPT_ERR_SIG_NULLDUMMY", !1;
|
|
26811
|
-
if (this.stack.pop(), this.stack.push(
|
|
26812
|
-
if (
|
|
26832
|
+
if (this.stack.pop(), this.stack.push(h ? re.true : re.false), n === q.OP_CHECKMULTISIGVERIFY)
|
|
26833
|
+
if (h)
|
|
26813
26834
|
this.stack.pop();
|
|
26814
26835
|
else
|
|
26815
26836
|
return this.errStr = "SCRIPT_ERR_CHECKMULTISIGVERIFY", !1;
|
|
@@ -26834,7 +26855,7 @@ class re extends Ce {
|
|
|
26834
26855
|
let s;
|
|
26835
26856
|
try {
|
|
26836
26857
|
const f = this.stack[this.stack.length - 1];
|
|
26837
|
-
s = new
|
|
26858
|
+
s = new ee().fromScriptNumBuffer(f, e).toNumber();
|
|
26838
26859
|
} catch (f) {
|
|
26839
26860
|
return this.errStr = f.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26840
26861
|
}
|
|
@@ -26851,7 +26872,7 @@ class re extends Ce {
|
|
|
26851
26872
|
let r;
|
|
26852
26873
|
try {
|
|
26853
26874
|
const f = this.stack[this.stack.length - 1];
|
|
26854
|
-
r = new
|
|
26875
|
+
r = new ee().fromScriptNumBuffer(
|
|
26855
26876
|
f,
|
|
26856
26877
|
e,
|
|
26857
26878
|
this.scriptNumMaxSize()
|
|
@@ -26879,7 +26900,7 @@ class re extends Ce {
|
|
|
26879
26900
|
return this.errStr = "OP_BIN2NUM requires at least one item to be on the stack.", !1;
|
|
26880
26901
|
const r = this.stack[this.stack.length - 1], s = jf(r);
|
|
26881
26902
|
try {
|
|
26882
|
-
this.stack[this.stack.length - 1] = new
|
|
26903
|
+
this.stack[this.stack.length - 1] = new ee().fromScriptNumBuffer(s, e, this.scriptNumMaxSize()).toScriptNumBuffer();
|
|
26883
26904
|
} catch (a) {
|
|
26884
26905
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26885
26906
|
}
|
|
@@ -26891,7 +26912,7 @@ class re extends Ce {
|
|
|
26891
26912
|
return !0;
|
|
26892
26913
|
}
|
|
26893
26914
|
fromJSON(e) {
|
|
26894
|
-
return this.fromJSONNoTx(e), this.tx = e.tx ? new
|
|
26915
|
+
return this.fromJSONNoTx(e), this.tx = e.tx ? new ke().fromJSON(e.tx) : void 0, this;
|
|
26895
26916
|
}
|
|
26896
26917
|
/**
|
|
26897
26918
|
* Convert JSON containing everything but the tx to an interp object.
|
|
@@ -26913,6 +26934,7 @@ class re extends Ce {
|
|
|
26913
26934
|
pBeginCodeHash: e.pBeginCodeHash,
|
|
26914
26935
|
nOpCount: e.nOpCount,
|
|
26915
26936
|
ifStack: e.ifStack,
|
|
26937
|
+
elseStack: [],
|
|
26916
26938
|
errStr: e.errStr,
|
|
26917
26939
|
flags: e.flags
|
|
26918
26940
|
}), this;
|
|
@@ -26923,7 +26945,7 @@ class re extends Ce {
|
|
|
26923
26945
|
let u = e.readVarIntNum();
|
|
26924
26946
|
if (u > 0) {
|
|
26925
26947
|
let r = e.read(u);
|
|
26926
|
-
this.tx = new
|
|
26948
|
+
this.tx = new ke().fromFastBuffer(r);
|
|
26927
26949
|
}
|
|
26928
26950
|
return this;
|
|
26929
26951
|
}
|
|
@@ -26958,7 +26980,7 @@ class re extends Ce {
|
|
|
26958
26980
|
};
|
|
26959
26981
|
}
|
|
26960
26982
|
toBw(e) {
|
|
26961
|
-
e || (e = new
|
|
26983
|
+
e || (e = new Ne());
|
|
26962
26984
|
let t = Buffer.from(JSON.stringify(this.toJSONNoTx()));
|
|
26963
26985
|
if (e.writeVarIntNum(t.length), e.write(t), this.tx) {
|
|
26964
26986
|
let n = this.tx.toFastBuffer();
|
|
@@ -26969,7 +26991,7 @@ class re extends Ce {
|
|
|
26969
26991
|
}
|
|
26970
26992
|
static getFlags(e) {
|
|
26971
26993
|
let t = 0;
|
|
26972
|
-
return e.indexOf("NONE") !== -1 && (t = t | re.SCRIPT_VERIFY_NONE), e.indexOf("P2SH") !== -1 && (t = t | re.SCRIPT_VERIFY_P2SH), e.indexOf("STRICTENC") !== -1 && (t = t | re.SCRIPT_VERIFY_STRICTENC), e.indexOf("DERSIG") !== -1 && (t = t | re.SCRIPT_VERIFY_DERSIG), e.indexOf("LOW_S") !== -1 && (t = t | re.SCRIPT_VERIFY_LOW_S), e.indexOf("NULLDUMMY") !== -1 && (t = t | re.SCRIPT_VERIFY_NULLDUMMY), e.indexOf("SIGPUSHONLY") !== -1 && (t = t | re.SCRIPT_VERIFY_SIGPUSHONLY), e.indexOf("MINIMALDATA") !== -1 && (t = t | re.SCRIPT_VERIFY_MINIMALDATA), e.indexOf("DISCOURAGE_UPGRADABLE_NOPS") !== -1 && (t = t | re.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS), e.indexOf("CLEANSTACK") !== -1 && (t = t | re.SCRIPT_VERIFY_CLEANSTACK), e.indexOf("CHECKLOCKTIMEVERIFY") !== -1 && (t = t | re.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY), e.indexOf("CHECKSEQUENCEVERIFY") !== -1 && (t = t | re.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY), e.indexOf("SIGHASH_FORKID") !== -1 && (t = t | re.SCRIPT_ENABLE_SIGHASH_FORKID), e.indexOf("MINIMALIF") !== -1 && (t = t | re.SCRIPT_VERIFY_MINIMALIF), e.indexOf("NULLFAIL") !== -1 && (t = t | re.SCRIPT_VERIFY_NULLFAIL), e.indexOf("CHRONICLE") !== -1 && (t = t | re.SCRIPT_VERIFY_CHRONICLE), t;
|
|
26994
|
+
return e.indexOf("NONE") !== -1 && (t = t | re.SCRIPT_VERIFY_NONE), e.indexOf("P2SH") !== -1 && (t = t | re.SCRIPT_VERIFY_P2SH), e.indexOf("STRICTENC") !== -1 && (t = t | re.SCRIPT_VERIFY_STRICTENC), e.indexOf("DERSIG") !== -1 && (t = t | re.SCRIPT_VERIFY_DERSIG), e.indexOf("LOW_S") !== -1 && (t = t | re.SCRIPT_VERIFY_LOW_S), e.indexOf("NULLDUMMY") !== -1 && (t = t | re.SCRIPT_VERIFY_NULLDUMMY), e.indexOf("SIGPUSHONLY") !== -1 && (t = t | re.SCRIPT_VERIFY_SIGPUSHONLY), e.indexOf("MINIMALDATA") !== -1 && (t = t | re.SCRIPT_VERIFY_MINIMALDATA), e.indexOf("DISCOURAGE_UPGRADABLE_NOPS") !== -1 && (t = t | re.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS), e.indexOf("CLEANSTACK") !== -1 && (t = t | re.SCRIPT_VERIFY_CLEANSTACK), e.indexOf("CHECKLOCKTIMEVERIFY") !== -1 && (t = t | re.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY), e.indexOf("CHECKSEQUENCEVERIFY") !== -1 && (t = t | re.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY), e.indexOf("SIGHASH_FORKID") !== -1 && (t = t | re.SCRIPT_ENABLE_SIGHASH_FORKID), e.indexOf("MINIMALIF") !== -1 && (t = t | re.SCRIPT_VERIFY_MINIMALIF), e.indexOf("NULLFAIL") !== -1 && (t = t | re.SCRIPT_VERIFY_NULLFAIL), e.indexOf("CHRONICLE") !== -1 && (t = t | re.SCRIPT_VERIFY_CHRONICLE), e.indexOf("PREGENESIS_LIMITS") !== -1 && (t = t | re.SCRIPT_VERIFY_PREGENESIS_LIMITS), t;
|
|
26973
26995
|
}
|
|
26974
26996
|
*eval() {
|
|
26975
26997
|
if (this.isPreGenesis())
|
|
@@ -26979,7 +27001,12 @@ class re extends Ce {
|
|
|
26979
27001
|
try {
|
|
26980
27002
|
for (; this.pc < this.script.chunks.length; ) {
|
|
26981
27003
|
const e = yield* this.step();
|
|
26982
|
-
|
|
27004
|
+
if (e)
|
|
27005
|
+
yield e;
|
|
27006
|
+
else {
|
|
27007
|
+
yield !1;
|
|
27008
|
+
return;
|
|
27009
|
+
}
|
|
26983
27010
|
}
|
|
26984
27011
|
this.stack.length + this.altStack.length > this.stackLimit && (this.errStr = "SCRIPT_ERR_STACK_SIZE", yield !1);
|
|
26985
27012
|
} catch (e) {
|
|
@@ -27006,7 +27033,7 @@ class re extends Ce {
|
|
|
27006
27033
|
}
|
|
27007
27034
|
*results(e, t, n, u, r, s) {
|
|
27008
27035
|
let a;
|
|
27009
|
-
this.fromObject({
|
|
27036
|
+
this.initialize(), this.fromObject({
|
|
27010
27037
|
script: e,
|
|
27011
27038
|
tx: n,
|
|
27012
27039
|
nIn: u,
|
|
@@ -27208,7 +27235,7 @@ class Eh extends Ce {
|
|
|
27208
27235
|
}
|
|
27209
27236
|
const Lf = Oe.Default.TxBuilder;
|
|
27210
27237
|
class L1 extends Ce {
|
|
27211
|
-
constructor(e = new
|
|
27238
|
+
constructor(e = new ke(), t = [], n = [], u = new Eh(), r = new xh(), s, a, o, f = Lf.feePerKbNum, i = 0, c = 1, h = 1, d = Lf.dust, b = !1, p = new Nr()) {
|
|
27212
27239
|
super({
|
|
27213
27240
|
tx: e,
|
|
27214
27241
|
txIns: t,
|
|
@@ -27232,7 +27259,7 @@ class L1 extends Ce {
|
|
|
27232
27259
|
return e.tx = this.tx.toHex(), e.txIns = this.txIns.map((t) => t.toHex()), e.txOuts = this.txOuts.map((t) => t.toHex()), e.uTxOutMap = this.uTxOutMap.toJSON(), e.sigOperations = this.sigOperations.toJSON(), e.changeScript = this.changeScript ? this.changeScript.toHex() : void 0, e.changeAmountBn = this.changeAmountBn ? this.changeAmountBn.toNumber() : void 0, e.feeAmountBn = this.feeAmountBn ? this.feeAmountBn.toNumber() : void 0, e.feePerKbNum = this.feePerKbNum, e.sigsPerInput = this.sigsPerInput, e.dust = this.dust, e.dustChangeToFees = this.dustChangeToFees, e.hashCache = this.hashCache.toJSON(), e;
|
|
27233
27260
|
}
|
|
27234
27261
|
fromJSON(e) {
|
|
27235
|
-
return this.tx = new
|
|
27262
|
+
return this.tx = new ke().fromHex(e.tx), this.txIns = e.txIns.map((t) => He.fromHex(t)), this.txOuts = e.txOuts.map((t) => gt.fromHex(t)), this.uTxOutMap = new Eh().fromJSON(e.uTxOutMap), this.sigOperations = new xh().fromJSON(e.sigOperations), this.changeScript = e.changeScript ? new Ae().fromHex(e.changeScript) : void 0, this.changeAmountBn = e.changeAmountBn ? new ee(e.changeAmountBn) : void 0, this.feeAmountBn = e.feeAmountBn ? new ee(e.feeAmountBn) : void 0, this.feePerKbNum = e.feePerKbNum || this.feePerKbNum, this.sigsPerInput = e.sigsPerInput || this.sigsPerInput, this.dust = e.dust || this.dust, this.dustChangeToFees = e.dustChangeToFees || this.dustChangeToFees, this.hashCache = Nr.fromJSON(e.hashCache), this;
|
|
27236
27263
|
}
|
|
27237
27264
|
setFeePerKbNum(e) {
|
|
27238
27265
|
if (typeof e != "number" || e < 0)
|
|
@@ -27315,7 +27342,7 @@ class L1 extends Ce {
|
|
|
27315
27342
|
* denominated in satoshis, not bitcoins.
|
|
27316
27343
|
*/
|
|
27317
27344
|
outputToAddress(e, t) {
|
|
27318
|
-
if (!(t instanceof Et) || !(e instanceof
|
|
27345
|
+
if (!(t instanceof Et) || !(e instanceof ee))
|
|
27319
27346
|
throw new Error("addr must be an Address, and valueBn must be a Bn");
|
|
27320
27347
|
const n = new Ae().fromPubKeyHash(t.hashBuf);
|
|
27321
27348
|
return this.outputToScript(e, n), this;
|
|
@@ -27325,13 +27352,13 @@ class L1 extends Ce {
|
|
|
27325
27352
|
* denominated in satoshis, not bitcoins.
|
|
27326
27353
|
*/
|
|
27327
27354
|
outputToScript(e, t) {
|
|
27328
|
-
if (!(t instanceof Ae) || !(e instanceof
|
|
27355
|
+
if (!(t instanceof Ae) || !(e instanceof ee))
|
|
27329
27356
|
throw new Error("script must be a Script, and valueBn must be a Bn");
|
|
27330
27357
|
const n = gt.fromProperties(e, t);
|
|
27331
27358
|
return this.txOuts.push(n), this;
|
|
27332
27359
|
}
|
|
27333
27360
|
buildOutputs() {
|
|
27334
|
-
let e = new
|
|
27361
|
+
let e = new ee(0);
|
|
27335
27362
|
return this.txOuts.forEach((t) => {
|
|
27336
27363
|
if (t.valueBn.lt(this.dust) && !t.script.isNonSpendable())
|
|
27337
27364
|
throw new Error("cannot create output lesser than dust");
|
|
@@ -27339,7 +27366,7 @@ class L1 extends Ce {
|
|
|
27339
27366
|
}), e;
|
|
27340
27367
|
}
|
|
27341
27368
|
buildInputs(e, t = 0) {
|
|
27342
|
-
let n = new
|
|
27369
|
+
let n = new ee(0);
|
|
27343
27370
|
for (const u of this.txIns) {
|
|
27344
27371
|
const r = this.uTxOutMap.get(u.txHashBuf, u.txOutNum);
|
|
27345
27372
|
if (n = n.add(r.valueBn), this.tx.addTxIn(u), n.geq(e)) {
|
|
@@ -27372,9 +27399,9 @@ class L1 extends Ce {
|
|
|
27372
27399
|
});
|
|
27373
27400
|
}), n = n + 1, Math.round(n);
|
|
27374
27401
|
}
|
|
27375
|
-
estimateFee(e = new
|
|
27402
|
+
estimateFee(e = new ee(0)) {
|
|
27376
27403
|
const t = Math.ceil(this.estimateSize() / 1e3 * this.feePerKbNum);
|
|
27377
|
-
return new
|
|
27404
|
+
return new ee(t).add(e);
|
|
27378
27405
|
}
|
|
27379
27406
|
/**
|
|
27380
27407
|
* Builds the transaction and adds the appropriate fee by subtracting from
|
|
@@ -27391,8 +27418,8 @@ class L1 extends Ce {
|
|
|
27391
27418
|
if (!this.changeScript)
|
|
27392
27419
|
throw new Error("must specify change script to use build method");
|
|
27393
27420
|
for (let n = e.useAllInputs ? this.txIns.length - 1 : 0; n < this.txIns.length; n++) {
|
|
27394
|
-
this.tx = new
|
|
27395
|
-
const u = this.buildOutputs(), r = gt.fromProperties(new
|
|
27421
|
+
this.tx = new ke();
|
|
27422
|
+
const u = this.buildOutputs(), r = gt.fromProperties(new ee(0), this.changeScript);
|
|
27396
27423
|
this.tx.addTxOut(r);
|
|
27397
27424
|
let s;
|
|
27398
27425
|
try {
|
|
@@ -27406,7 +27433,7 @@ class L1 extends Ce {
|
|
|
27406
27433
|
if (this.changeAmountBn.geq(t)) {
|
|
27407
27434
|
if (this.feeAmountBn = t, this.changeAmountBn = this.changeAmountBn.sub(this.feeAmountBn), this.tx.txOuts[this.tx.txOuts.length - 1].valueBn = this.changeAmountBn, this.changeAmountBn.lt(this.dust))
|
|
27408
27435
|
if (this.dustChangeToFees)
|
|
27409
|
-
this.tx.txOuts.pop(), this.tx.txOutsVi = qe.fromNumber(this.tx.txOutsVi.toNumber() - 1), this.feeAmountBn = this.feeAmountBn.add(this.changeAmountBn), this.changeAmountBn = new
|
|
27436
|
+
this.tx.txOuts.pop(), this.tx.txOutsVi = qe.fromNumber(this.tx.txOutsVi.toNumber() - 1), this.feeAmountBn = this.feeAmountBn.add(this.changeAmountBn), this.changeAmountBn = new ee(0);
|
|
27410
27437
|
else
|
|
27411
27438
|
throw new Error("unable to create change amount greater than dust");
|
|
27412
27439
|
if (this.tx.nLockTime = this.nLockTime, this.tx.versionBytesNum = this.versionBytesNum, this.tx.txOuts.length === 0)
|
|
@@ -27453,9 +27480,9 @@ class L1 extends Ce {
|
|
|
27453
27480
|
* you're not normal because you're using OP_CODESEPARATORs, you know what
|
|
27454
27481
|
* to do.
|
|
27455
27482
|
*/
|
|
27456
|
-
getSig(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r =
|
|
27483
|
+
getSig(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27457
27484
|
let s;
|
|
27458
|
-
if (t & he.SIGHASH_FORKID && r &
|
|
27485
|
+
if (t & he.SIGHASH_FORKID && r & ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27459
27486
|
const a = this.tx.txIns[n].txHashBuf, o = this.tx.txIns[n].txOutNum, f = this.uTxOutMap.get(a, o);
|
|
27460
27487
|
if (!f)
|
|
27461
27488
|
throw new Error("for SIGHASH_FORKID must provide UTXOs");
|
|
@@ -27467,9 +27494,9 @@ class L1 extends Ce {
|
|
|
27467
27494
|
* Asynchronously sign an input in a worker, but do not fill the signature
|
|
27468
27495
|
* into the transaction. Return the signature.
|
|
27469
27496
|
*/
|
|
27470
|
-
asyncGetSig(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r =
|
|
27497
|
+
asyncGetSig(e, t = he.SIGHASH_ALL | he.SIGHASH_FORKID, n, u, r = ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27471
27498
|
let s;
|
|
27472
|
-
if (t & he.SIGHASH_FORKID && r &
|
|
27499
|
+
if (t & he.SIGHASH_FORKID && r & ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27473
27500
|
const a = this.tx.txIns[n].txHashBuf, o = this.tx.txIns[n].txOutNum, f = this.uTxOutMap.get(a, o);
|
|
27474
27501
|
if (!f)
|
|
27475
27502
|
throw new Error("for SIGHASH_FORKID must provide UTXOs");
|
|
@@ -27490,7 +27517,7 @@ class L1 extends Ce {
|
|
|
27490
27517
|
* This method only works for some standard transaction types. For
|
|
27491
27518
|
* non-standard transaction types, use getSig.
|
|
27492
27519
|
*/
|
|
27493
|
-
signTxIn(e, t, n, u, r = he.SIGHASH_ALL | he.SIGHASH_FORKID, s =
|
|
27520
|
+
signTxIn(e, t, n, u, r = he.SIGHASH_ALL | he.SIGHASH_FORKID, s = ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27494
27521
|
const a = this.tx.txIns[e], o = a.script;
|
|
27495
27522
|
if (u === void 0 && o.isPubKeyHashIn() && (u = 0), u === void 0)
|
|
27496
27523
|
throw new Error("cannot sign unknown script type for input " + e);
|
|
@@ -27504,7 +27531,7 @@ class L1 extends Ce {
|
|
|
27504
27531
|
* signature into the transaction. This method only works for some standard
|
|
27505
27532
|
* transaction types. For non-standard transaction types, use asyncGetSig.
|
|
27506
27533
|
*/
|
|
27507
|
-
async asyncSignTxIn(e, t, n, u, r = he.SIGHASH_ALL | he.SIGHASH_FORKID, s =
|
|
27534
|
+
async asyncSignTxIn(e, t, n, u, r = he.SIGHASH_ALL | he.SIGHASH_FORKID, s = ke.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
27508
27535
|
const a = this.tx.txIns[e], o = a.script;
|
|
27509
27536
|
if (u === void 0 && o.isPubKeyHashIn() && (u = 0), u === void 0)
|
|
27510
27537
|
throw new Error("cannot sign unknown script type for input " + e);
|
|
@@ -27591,14 +27618,14 @@ class zf extends Ce {
|
|
|
27591
27618
|
return this.errStr = "transaction txOuts empty", this.errStr;
|
|
27592
27619
|
if (this.tx.toBuffer().length > ss.MAX_BLOCK_SIZE)
|
|
27593
27620
|
return this.errStr = "transaction over the maximum block size", this.errStr;
|
|
27594
|
-
let e = new
|
|
27621
|
+
let e = new ee(0);
|
|
27595
27622
|
for (let n = 0; n < this.tx.txOuts.length; n++) {
|
|
27596
27623
|
const u = this.tx.txOuts[n];
|
|
27597
27624
|
if (u.valueBn.lt(0))
|
|
27598
27625
|
return this.errStr = "transaction txOut " + n + " negative", this.errStr;
|
|
27599
|
-
if (u.valueBn.gt(
|
|
27626
|
+
if (u.valueBn.gt(ke.MAX_MONEY))
|
|
27600
27627
|
return this.errStr = "transaction txOut " + n + " greater than MAX_MONEY", this.errStr;
|
|
27601
|
-
if (e = e.add(u.valueBn), e.gt(
|
|
27628
|
+
if (e = e.add(u.valueBn), e.gt(ke.MAX_MONEY))
|
|
27602
27629
|
return this.errStr = "transaction txOut " + n + " total output greater than MAX_MONEY", this.errStr;
|
|
27603
27630
|
}
|
|
27604
27631
|
const t = {};
|
|
@@ -27891,10 +27918,10 @@ export {
|
|
|
27891
27918
|
Kf as Bip39,
|
|
27892
27919
|
ss as Block,
|
|
27893
27920
|
Pr as BlockHeader,
|
|
27894
|
-
|
|
27921
|
+
ee as Bn,
|
|
27895
27922
|
ot as Br,
|
|
27896
27923
|
yt as Bsm,
|
|
27897
|
-
|
|
27924
|
+
Ne as Bw,
|
|
27898
27925
|
Fe as Cbc,
|
|
27899
27926
|
Oe as Constants,
|
|
27900
27927
|
ht as Ecdsa,
|
|
@@ -27913,7 +27940,7 @@ export {
|
|
|
27913
27940
|
he as Sig,
|
|
27914
27941
|
xh as SigOperations,
|
|
27915
27942
|
Ce as Struct,
|
|
27916
|
-
|
|
27943
|
+
ke as Tx,
|
|
27917
27944
|
L1 as TxBuilder,
|
|
27918
27945
|
He as TxIn,
|
|
27919
27946
|
gt as TxOut,
|