bsv2 2.2.0 → 2.2.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/dist/bsv2.cjs +2 -2
- package/dist/bsv2.cjs.map +1 -1
- package/dist/bsv2.mjs +212 -206
- package/dist/bsv2.mjs.map +1 -1
- package/dist/bsv2.umd.js +2 -2
- package/dist/bsv2.umd.js.map +1 -1
- package/package.json +1 -1
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, q = O.words, K = 0, L, _, F, 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, re = 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, U = w >>> 13, W = R[9] | 0, X = W & 8191,
|
|
575
|
+
var R = m.words, A = E.words, q = O.words, K = 0, L, _, F, 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, re = 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, U = w >>> 13, W = R[9] | 0, X = W & 8191, ee = 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, F = Math.imul(V, ye);
|
|
577
577
|
var Kr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
578
578
|
K = (F + (_ >>> 13) | 0) + (Kr >>> 26) | 0, Kr &= 67108863, L = Math.imul(M, we), _ = Math.imul(M, ye), _ = _ + Math.imul(Y, we) | 0, F = Math.imul(Y, ye), L = L + Math.imul(se, le) | 0, _ = _ + Math.imul(se, je) | 0, _ = _ + Math.imul(V, le) | 0, F = F + Math.imul(V, je) | 0;
|
|
@@ -591,25 +591,25 @@ function Te() {
|
|
|
591
591
|
var Yr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
592
592
|
K = (F + (_ >>> 13) | 0) + (Yr >>> 26) | 0, Yr &= 67108863, L = Math.imul(S, we), _ = Math.imul(S, ye), _ = _ + Math.imul(U, we) | 0, F = Math.imul(U, ye), L = L + Math.imul(Pe, le) | 0, _ = _ + Math.imul(Pe, je) | 0, _ = _ + Math.imul(N, le) | 0, F = F + Math.imul(N, je) | 0, L = L + Math.imul(ve, ze) | 0, _ = _ + Math.imul(ve, Ve) | 0, _ = _ + Math.imul(me, ze) | 0, F = F + Math.imul(me, Ve) | 0, L = L + Math.imul(Se, Ge) | 0, _ = _ + Math.imul(Se, $e) | 0, _ = _ + Math.imul(de, Ge) | 0, F = F + Math.imul(de, $e) | 0, L = L + Math.imul(ce, We) | 0, _ = _ + Math.imul(ce, Ye) | 0, _ = _ + Math.imul(ge, We) | 0, F = F + Math.imul(ge, Ye) | 0, L = L + Math.imul(re, Je) | 0, _ = _ + Math.imul(re, Xe) | 0, _ = _ + Math.imul(ue, Je) | 0, F = F + Math.imul(ue, Xe) | 0, L = L + Math.imul(D, Qe) | 0, _ = _ + Math.imul(D, Ze) | 0, _ = _ + Math.imul(T, Qe) | 0, F = F + Math.imul(T, Ze) | 0, L = L + Math.imul(M, et) | 0, _ = _ + Math.imul(M, tt) | 0, _ = _ + Math.imul(Y, et) | 0, F = F + Math.imul(Y, tt) | 0, L = L + Math.imul(se, rt) | 0, _ = _ + Math.imul(se, it) | 0, _ = _ + Math.imul(V, rt) | 0, F = F + Math.imul(V, it) | 0;
|
|
593
593
|
var Jr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
594
|
-
K = (F + (_ >>> 13) | 0) + (Jr >>> 26) | 0, Jr &= 67108863, L = Math.imul(X, we), _ = Math.imul(X, ye), _ = _ + Math.imul(
|
|
594
|
+
K = (F + (_ >>> 13) | 0) + (Jr >>> 26) | 0, Jr &= 67108863, L = Math.imul(X, we), _ = Math.imul(X, ye), _ = _ + Math.imul(ee, we) | 0, F = Math.imul(ee, ye), L = L + Math.imul(S, le) | 0, _ = _ + Math.imul(S, je) | 0, _ = _ + Math.imul(U, le) | 0, F = F + Math.imul(U, je) | 0, L = L + Math.imul(Pe, ze) | 0, _ = _ + Math.imul(Pe, Ve) | 0, _ = _ + Math.imul(N, ze) | 0, F = F + Math.imul(N, Ve) | 0, L = L + Math.imul(ve, Ge) | 0, _ = _ + Math.imul(ve, $e) | 0, _ = _ + Math.imul(me, Ge) | 0, F = F + Math.imul(me, $e) | 0, L = L + Math.imul(Se, We) | 0, _ = _ + Math.imul(Se, Ye) | 0, _ = _ + Math.imul(de, We) | 0, F = F + Math.imul(de, Ye) | 0, L = L + Math.imul(ce, Je) | 0, _ = _ + Math.imul(ce, Xe) | 0, _ = _ + Math.imul(ge, Je) | 0, F = F + Math.imul(ge, Xe) | 0, L = L + Math.imul(re, Qe) | 0, _ = _ + Math.imul(re, Ze) | 0, _ = _ + Math.imul(ue, Qe) | 0, F = F + Math.imul(ue, Ze) | 0, L = L + Math.imul(D, et) | 0, _ = _ + Math.imul(D, tt) | 0, _ = _ + Math.imul(T, et) | 0, F = F + Math.imul(T, tt) | 0, L = L + Math.imul(M, rt) | 0, _ = _ + Math.imul(M, it) | 0, _ = _ + Math.imul(Y, rt) | 0, F = F + Math.imul(Y, it) | 0, L = L + Math.imul(se, nt) | 0, _ = _ + Math.imul(se, at) | 0, _ = _ + Math.imul(V, nt) | 0, F = F + Math.imul(V, at) | 0;
|
|
595
595
|
var Xr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
596
|
-
K = (F + (_ >>> 13) | 0) + (Xr >>> 26) | 0, Xr &= 67108863, L = Math.imul(X, le), _ = Math.imul(X, je), _ = _ + Math.imul(
|
|
596
|
+
K = (F + (_ >>> 13) | 0) + (Xr >>> 26) | 0, Xr &= 67108863, L = Math.imul(X, le), _ = Math.imul(X, je), _ = _ + Math.imul(ee, le) | 0, F = Math.imul(ee, je), L = L + Math.imul(S, ze) | 0, _ = _ + Math.imul(S, Ve) | 0, _ = _ + Math.imul(U, ze) | 0, F = F + Math.imul(U, Ve) | 0, L = L + Math.imul(Pe, Ge) | 0, _ = _ + Math.imul(Pe, $e) | 0, _ = _ + Math.imul(N, Ge) | 0, F = F + Math.imul(N, $e) | 0, L = L + Math.imul(ve, We) | 0, _ = _ + Math.imul(ve, Ye) | 0, _ = _ + Math.imul(me, We) | 0, F = F + Math.imul(me, Ye) | 0, L = L + Math.imul(Se, Je) | 0, _ = _ + Math.imul(Se, Xe) | 0, _ = _ + Math.imul(de, Je) | 0, F = F + Math.imul(de, Xe) | 0, L = L + Math.imul(ce, Qe) | 0, _ = _ + Math.imul(ce, Ze) | 0, _ = _ + Math.imul(ge, Qe) | 0, F = F + Math.imul(ge, Ze) | 0, L = L + Math.imul(re, et) | 0, _ = _ + Math.imul(re, tt) | 0, _ = _ + Math.imul(ue, et) | 0, F = F + Math.imul(ue, tt) | 0, L = L + Math.imul(D, rt) | 0, _ = _ + Math.imul(D, it) | 0, _ = _ + Math.imul(T, rt) | 0, F = F + Math.imul(T, it) | 0, L = L + Math.imul(M, nt) | 0, _ = _ + Math.imul(M, at) | 0, _ = _ + Math.imul(Y, nt) | 0, F = F + Math.imul(Y, at) | 0;
|
|
597
597
|
var Qr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
598
|
-
K = (F + (_ >>> 13) | 0) + (Qr >>> 26) | 0, Qr &= 67108863, L = Math.imul(X, ze), _ = Math.imul(X, Ve), _ = _ + Math.imul(
|
|
598
|
+
K = (F + (_ >>> 13) | 0) + (Qr >>> 26) | 0, Qr &= 67108863, L = Math.imul(X, ze), _ = Math.imul(X, Ve), _ = _ + Math.imul(ee, ze) | 0, F = Math.imul(ee, Ve), L = L + Math.imul(S, Ge) | 0, _ = _ + Math.imul(S, $e) | 0, _ = _ + Math.imul(U, Ge) | 0, F = F + Math.imul(U, $e) | 0, L = L + Math.imul(Pe, We) | 0, _ = _ + Math.imul(Pe, Ye) | 0, _ = _ + Math.imul(N, We) | 0, F = F + Math.imul(N, Ye) | 0, L = L + Math.imul(ve, Je) | 0, _ = _ + Math.imul(ve, Xe) | 0, _ = _ + Math.imul(me, Je) | 0, F = F + Math.imul(me, Xe) | 0, L = L + Math.imul(Se, Qe) | 0, _ = _ + Math.imul(Se, Ze) | 0, _ = _ + Math.imul(de, Qe) | 0, F = F + Math.imul(de, Ze) | 0, L = L + Math.imul(ce, et) | 0, _ = _ + Math.imul(ce, tt) | 0, _ = _ + Math.imul(ge, et) | 0, F = F + Math.imul(ge, tt) | 0, L = L + Math.imul(re, rt) | 0, _ = _ + Math.imul(re, it) | 0, _ = _ + Math.imul(ue, rt) | 0, F = F + Math.imul(ue, it) | 0, L = L + Math.imul(D, nt) | 0, _ = _ + Math.imul(D, at) | 0, _ = _ + Math.imul(T, nt) | 0, F = F + Math.imul(T, at) | 0;
|
|
599
599
|
var Zr = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
600
|
-
K = (F + (_ >>> 13) | 0) + (Zr >>> 26) | 0, Zr &= 67108863, L = Math.imul(X, Ge), _ = Math.imul(X, $e), _ = _ + Math.imul(
|
|
600
|
+
K = (F + (_ >>> 13) | 0) + (Zr >>> 26) | 0, Zr &= 67108863, L = Math.imul(X, Ge), _ = Math.imul(X, $e), _ = _ + Math.imul(ee, Ge) | 0, F = Math.imul(ee, $e), L = L + Math.imul(S, We) | 0, _ = _ + Math.imul(S, Ye) | 0, _ = _ + Math.imul(U, We) | 0, F = F + Math.imul(U, Ye) | 0, L = L + Math.imul(Pe, Je) | 0, _ = _ + Math.imul(Pe, Xe) | 0, _ = _ + Math.imul(N, Je) | 0, F = F + Math.imul(N, Xe) | 0, L = L + Math.imul(ve, Qe) | 0, _ = _ + Math.imul(ve, Ze) | 0, _ = _ + Math.imul(me, Qe) | 0, F = F + Math.imul(me, Ze) | 0, L = L + Math.imul(Se, et) | 0, _ = _ + Math.imul(Se, tt) | 0, _ = _ + Math.imul(de, et) | 0, F = F + Math.imul(de, tt) | 0, L = L + Math.imul(ce, rt) | 0, _ = _ + Math.imul(ce, it) | 0, _ = _ + Math.imul(ge, rt) | 0, F = F + Math.imul(ge, it) | 0, L = L + Math.imul(re, nt) | 0, _ = _ + Math.imul(re, at) | 0, _ = _ + Math.imul(ue, nt) | 0, F = F + Math.imul(ue, at) | 0;
|
|
601
601
|
var ei = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
602
|
-
K = (F + (_ >>> 13) | 0) + (ei >>> 26) | 0, ei &= 67108863, L = Math.imul(X, We), _ = Math.imul(X, Ye), _ = _ + Math.imul(
|
|
602
|
+
K = (F + (_ >>> 13) | 0) + (ei >>> 26) | 0, ei &= 67108863, L = Math.imul(X, We), _ = Math.imul(X, Ye), _ = _ + Math.imul(ee, We) | 0, F = Math.imul(ee, Ye), L = L + Math.imul(S, Je) | 0, _ = _ + Math.imul(S, Xe) | 0, _ = _ + Math.imul(U, Je) | 0, F = F + Math.imul(U, Xe) | 0, L = L + Math.imul(Pe, Qe) | 0, _ = _ + Math.imul(Pe, Ze) | 0, _ = _ + Math.imul(N, Qe) | 0, F = F + Math.imul(N, Ze) | 0, L = L + Math.imul(ve, et) | 0, _ = _ + Math.imul(ve, tt) | 0, _ = _ + Math.imul(me, et) | 0, F = F + Math.imul(me, tt) | 0, L = L + Math.imul(Se, rt) | 0, _ = _ + Math.imul(Se, it) | 0, _ = _ + Math.imul(de, rt) | 0, F = F + Math.imul(de, it) | 0, L = L + Math.imul(ce, nt) | 0, _ = _ + Math.imul(ce, at) | 0, _ = _ + Math.imul(ge, nt) | 0, F = F + Math.imul(ge, at) | 0;
|
|
603
603
|
var ti = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
604
|
-
K = (F + (_ >>> 13) | 0) + (ti >>> 26) | 0, ti &= 67108863, L = Math.imul(X, Je), _ = Math.imul(X, Xe), _ = _ + Math.imul(
|
|
604
|
+
K = (F + (_ >>> 13) | 0) + (ti >>> 26) | 0, ti &= 67108863, L = Math.imul(X, Je), _ = Math.imul(X, Xe), _ = _ + Math.imul(ee, Je) | 0, F = Math.imul(ee, Xe), L = L + Math.imul(S, Qe) | 0, _ = _ + Math.imul(S, Ze) | 0, _ = _ + Math.imul(U, Qe) | 0, F = F + Math.imul(U, Ze) | 0, L = L + Math.imul(Pe, et) | 0, _ = _ + Math.imul(Pe, tt) | 0, _ = _ + Math.imul(N, et) | 0, F = F + Math.imul(N, tt) | 0, L = L + Math.imul(ve, rt) | 0, _ = _ + Math.imul(ve, it) | 0, _ = _ + Math.imul(me, rt) | 0, F = F + Math.imul(me, it) | 0, L = L + Math.imul(Se, nt) | 0, _ = _ + Math.imul(Se, at) | 0, _ = _ + Math.imul(de, nt) | 0, F = F + Math.imul(de, at) | 0;
|
|
605
605
|
var ri = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
606
|
-
K = (F + (_ >>> 13) | 0) + (ri >>> 26) | 0, ri &= 67108863, L = Math.imul(X, Qe), _ = Math.imul(X, Ze), _ = _ + Math.imul(
|
|
606
|
+
K = (F + (_ >>> 13) | 0) + (ri >>> 26) | 0, ri &= 67108863, L = Math.imul(X, Qe), _ = Math.imul(X, Ze), _ = _ + Math.imul(ee, Qe) | 0, F = Math.imul(ee, Ze), L = L + Math.imul(S, et) | 0, _ = _ + Math.imul(S, tt) | 0, _ = _ + Math.imul(U, et) | 0, F = F + Math.imul(U, tt) | 0, L = L + Math.imul(Pe, rt) | 0, _ = _ + Math.imul(Pe, it) | 0, _ = _ + Math.imul(N, rt) | 0, F = F + Math.imul(N, it) | 0, L = L + Math.imul(ve, nt) | 0, _ = _ + Math.imul(ve, at) | 0, _ = _ + Math.imul(me, nt) | 0, F = F + Math.imul(me, at) | 0;
|
|
607
607
|
var ii = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
608
|
-
K = (F + (_ >>> 13) | 0) + (ii >>> 26) | 0, ii &= 67108863, L = Math.imul(X, et), _ = Math.imul(X, tt), _ = _ + Math.imul(
|
|
608
|
+
K = (F + (_ >>> 13) | 0) + (ii >>> 26) | 0, ii &= 67108863, L = Math.imul(X, et), _ = Math.imul(X, tt), _ = _ + Math.imul(ee, et) | 0, F = Math.imul(ee, tt), L = L + Math.imul(S, rt) | 0, _ = _ + Math.imul(S, it) | 0, _ = _ + Math.imul(U, rt) | 0, F = F + Math.imul(U, it) | 0, L = L + Math.imul(Pe, nt) | 0, _ = _ + Math.imul(Pe, at) | 0, _ = _ + Math.imul(N, nt) | 0, F = F + Math.imul(N, at) | 0;
|
|
609
609
|
var ni = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
610
|
-
K = (F + (_ >>> 13) | 0) + (ni >>> 26) | 0, ni &= 67108863, L = Math.imul(X, rt), _ = Math.imul(X, it), _ = _ + Math.imul(
|
|
610
|
+
K = (F + (_ >>> 13) | 0) + (ni >>> 26) | 0, ni &= 67108863, L = Math.imul(X, rt), _ = Math.imul(X, it), _ = _ + Math.imul(ee, rt) | 0, F = Math.imul(ee, it), L = L + Math.imul(S, nt) | 0, _ = _ + Math.imul(S, at) | 0, _ = _ + Math.imul(U, nt) | 0, F = F + Math.imul(U, at) | 0;
|
|
611
611
|
var ai = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
612
|
-
K = (F + (_ >>> 13) | 0) + (ai >>> 26) | 0, ai &= 67108863, L = Math.imul(X, nt), _ = Math.imul(X, at), _ = _ + Math.imul(
|
|
612
|
+
K = (F + (_ >>> 13) | 0) + (ai >>> 26) | 0, ai &= 67108863, L = Math.imul(X, nt), _ = Math.imul(X, at), _ = _ + Math.imul(ee, nt) | 0, F = Math.imul(ee, at);
|
|
613
613
|
var fi = (K + L | 0) + ((_ & 8191) << 13) | 0;
|
|
614
614
|
return K = (F + (_ >>> 13) | 0) + (fi >>> 26) | 0, fi &= 67108863, q[0] = Kr, q[1] = jr, q[2] = zr, q[3] = Vr, q[4] = Gr, q[5] = $r, q[6] = Wr, q[7] = Yr, q[8] = Jr, q[9] = Xr, q[10] = Qr, q[11] = Zr, q[12] = ei, q[13] = ti, q[14] = ri, q[15] = ii, q[16] = ni, q[17] = ai, q[18] = fi, K !== 0 && (q[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 U = w.length, W = S.length;
|
|
1674
|
-
for (let X = 0,
|
|
1674
|
+
for (let X = 0, ee = Math.min(U, W); X < ee; ++X)
|
|
1675
1675
|
if (w[X] !== S[X]) {
|
|
1676
1676
|
U = 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 (U = 0; U < w.length; ++U) {
|
|
1709
|
-
let
|
|
1710
|
-
if (Be(
|
|
1711
|
-
X +
|
|
1709
|
+
let ee = w[U];
|
|
1710
|
+
if (Be(ee, Uint8Array))
|
|
1711
|
+
X + ee.length > W.length ? (a.isBuffer(ee) || (ee = a.from(ee)), ee.copy(W, X)) : Uint8Array.prototype.set.call(
|
|
1712
1712
|
W,
|
|
1713
|
-
|
|
1713
|
+
ee,
|
|
1714
1714
|
X
|
|
1715
1715
|
);
|
|
1716
|
-
else if (a.isBuffer(
|
|
1717
|
-
|
|
1716
|
+
else if (a.isBuffer(ee))
|
|
1717
|
+
ee.copy(W, X);
|
|
1718
1718
|
else
|
|
1719
1719
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1720
|
-
X +=
|
|
1720
|
+
X += ee.length;
|
|
1721
1721
|
}
|
|
1722
1722
|
return W;
|
|
1723
1723
|
};
|
|
@@ -1836,14 +1836,14 @@ function St() {
|
|
|
1836
1836
|
if (S >= U)
|
|
1837
1837
|
return 1;
|
|
1838
1838
|
if (S >>>= 0, U >>>= 0, W >>>= 0, X >>>= 0, this === w) return 0;
|
|
1839
|
-
let
|
|
1840
|
-
const we = Math.min(
|
|
1839
|
+
let ee = X - W, Ee = U - S;
|
|
1840
|
+
const we = Math.min(ee, Ee), ye = this.slice(W, X), De = w.slice(S, U);
|
|
1841
1841
|
for (let le = 0; le < we; ++le)
|
|
1842
1842
|
if (ye[le] !== De[le]) {
|
|
1843
|
-
|
|
1843
|
+
ee = ye[le], Ee = De[le];
|
|
1844
1844
|
break;
|
|
1845
1845
|
}
|
|
1846
|
-
return
|
|
1846
|
+
return ee < Ee ? -1 : Ee < ee ? 1 : 0;
|
|
1847
1847
|
};
|
|
1848
1848
|
function C(N, w, S, U, 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, U, W) {
|
|
1863
|
-
let X = 1,
|
|
1863
|
+
let X = 1, ee = N.length, Ee = w.length;
|
|
1864
1864
|
if (U !== void 0 && (U = String(U).toLowerCase(), U === "ucs2" || U === "ucs-2" || U === "utf16le" || U === "utf-16le")) {
|
|
1865
1865
|
if (N.length < 2 || w.length < 2)
|
|
1866
1866
|
return -1;
|
|
1867
|
-
X = 2,
|
|
1867
|
+
X = 2, ee /= 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 < ee; 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 > ee && (S = ee - 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
|
U ? (U = Number(U), U > W && (U = W)) : U = W;
|
|
1903
1903
|
const X = w.length;
|
|
1904
1904
|
U > X / 2 && (U = X / 2);
|
|
1905
|
-
let
|
|
1906
|
-
for (
|
|
1907
|
-
const Ee = parseInt(w.substr(
|
|
1908
|
-
if (ve(Ee)) return
|
|
1909
|
-
N[S +
|
|
1905
|
+
let ee;
|
|
1906
|
+
for (ee = 0; ee < U; ++ee) {
|
|
1907
|
+
const Ee = parseInt(w.substr(ee * 2, 2), 16);
|
|
1908
|
+
if (ve(Ee)) return ee;
|
|
1909
|
+
N[S + ee] = Ee;
|
|
1910
1910
|
}
|
|
1911
|
-
return
|
|
1911
|
+
return ee;
|
|
1912
1912
|
}
|
|
1913
1913
|
function z(N, w, S, U) {
|
|
1914
1914
|
return de(ce(w, N.length - S), N, S, U);
|
|
@@ -1937,7 +1937,7 @@ function St() {
|
|
|
1937
1937
|
if ((U === void 0 || U > X) && (U = X), w.length > 0 && (U < 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 ee = !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, U);
|
|
1959
1959
|
default:
|
|
1960
|
-
if (
|
|
1961
|
-
W = ("" + W).toLowerCase(),
|
|
1960
|
+
if (ee) throw new TypeError("Unknown encoding: " + W);
|
|
1961
|
+
W = ("" + W).toLowerCase(), ee = !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 ee = 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 && (ee = 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 && (ee = 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) && (ee = 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 && (ee = le));
|
|
1993
1993
|
}
|
|
1994
1994
|
}
|
|
1995
|
-
|
|
1995
|
+
ee === null ? (ee = 65533, Ee = 1) : ee > 65535 && (ee -= 65536, U.push(ee >>> 10 & 1023 | 55296), ee = 56320 | ee & 1023), U.push(ee), W += Ee;
|
|
1996
1996
|
}
|
|
1997
1997
|
return O(U);
|
|
1998
1998
|
}
|
|
@@ -2050,9 +2050,9 @@ function St() {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
a.prototype.readUintLE = a.prototype.readUIntLE = function(w, S, U) {
|
|
2052
2052
|
w = w >>> 0, S = S >>> 0, U || 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, ee = 0;
|
|
2054
|
+
for (; ++ee < S && (X *= 256); )
|
|
2055
|
+
W += this[w + ee] * X;
|
|
2056
2056
|
return W;
|
|
2057
2057
|
}, a.prototype.readUintBE = a.prototype.readUIntBE = function(w, S, U) {
|
|
2058
2058
|
w = w >>> 0, S = S >>> 0, U || 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, U) {
|
|
2086
2086
|
w = w >>> 0, S = S >>> 0, U || 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, ee = 0;
|
|
2088
|
+
for (; ++ee < S && (X *= 256); )
|
|
2089
|
+
W += this[w + ee] * X;
|
|
2090
2090
|
return X *= 128, W >= X && (W -= Math.pow(2, 8 * S)), W;
|
|
2091
2091
|
}, a.prototype.readIntBE = function(w, S, U) {
|
|
2092
2092
|
w = w >>> 0, S = S >>> 0, U || L(w, S, this.length);
|
|
2093
|
-
let W = S, X = 1,
|
|
2093
|
+
let W = S, X = 1, ee = this[w + --W];
|
|
2094
2094
|
for (; W > 0 && (X *= 256); )
|
|
2095
|
-
|
|
2096
|
-
return X *= 128,
|
|
2095
|
+
ee += this[w + --W] * X;
|
|
2096
|
+
return X *= 128, ee >= X && (ee -= Math.pow(2, 8 * S)), ee;
|
|
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 * U) - 1;
|
|
2141
2141
|
_(this, w, S, U, Ee, 0);
|
|
2142
2142
|
}
|
|
2143
|
-
let X = 1,
|
|
2144
|
-
for (this[S] = w & 255; ++
|
|
2145
|
-
this[S +
|
|
2143
|
+
let X = 1, ee = 0;
|
|
2144
|
+
for (this[S] = w & 255; ++ee < U && (X *= 256); )
|
|
2145
|
+
this[S + ee] = w / X & 255;
|
|
2146
2146
|
return S + U;
|
|
2147
2147
|
}, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(w, S, U, W) {
|
|
2148
2148
|
if (w = +w, S = S >>> 0, U = U >>> 0, !W) {
|
|
2149
2149
|
const Ee = Math.pow(2, 8 * U) - 1;
|
|
2150
2150
|
_(this, w, S, U, Ee, 0);
|
|
2151
2151
|
}
|
|
2152
|
-
let X = U - 1,
|
|
2153
|
-
for (this[S + X] = w & 255; --X >= 0 && (
|
|
2154
|
-
this[S + X] = w /
|
|
2152
|
+
let X = U - 1, ee = 1;
|
|
2153
|
+
for (this[S + X] = w & 255; --X >= 0 && (ee *= 256); )
|
|
2154
|
+
this[S + X] = w / ee & 255;
|
|
2155
2155
|
return S + U;
|
|
2156
2156
|
}, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(w, S, U) {
|
|
2157
2157
|
return w = +w, S = S >>> 0, U || _(this, w, S, 1, 255, 0), this[S] = w & 255, S + 1;
|
|
@@ -2168,15 +2168,15 @@ function St() {
|
|
|
2168
2168
|
T(w, U, 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 ee = Number(w >> BigInt(32) & BigInt(4294967295));
|
|
2172
|
+
return N[S++] = ee, ee = ee >> 8, N[S++] = ee, ee = ee >> 8, N[S++] = ee, ee = ee >> 8, N[S++] = ee, S;
|
|
2173
2173
|
}
|
|
2174
2174
|
function fe(N, w, S, U, W) {
|
|
2175
2175
|
T(w, U, 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 ee = Number(w >> BigInt(32) & BigInt(4294967295));
|
|
2179
|
+
return N[S + 3] = ee, ee = ee >> 8, N[S + 2] = ee, ee = ee >> 8, N[S + 1] = ee, ee = ee >> 8, N[S] = ee, S + 8;
|
|
2180
2180
|
}
|
|
2181
2181
|
a.prototype.writeBigUInt64LE = Le(function(w, S = 0) {
|
|
2182
2182
|
return F(this, w, S, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
@@ -2187,18 +2187,18 @@ function St() {
|
|
|
2187
2187
|
const we = Math.pow(2, 8 * U - 1);
|
|
2188
2188
|
_(this, w, S, U, we - 1, -we);
|
|
2189
2189
|
}
|
|
2190
|
-
let X = 0,
|
|
2191
|
-
for (this[S] = w & 255; ++X < U && (
|
|
2192
|
-
w < 0 && Ee === 0 && this[S + X - 1] !== 0 && (Ee = 1), this[S + X] = (w /
|
|
2190
|
+
let X = 0, ee = 1, Ee = 0;
|
|
2191
|
+
for (this[S] = w & 255; ++X < U && (ee *= 256); )
|
|
2192
|
+
w < 0 && Ee === 0 && this[S + X - 1] !== 0 && (Ee = 1), this[S + X] = (w / ee >> 0) - Ee & 255;
|
|
2193
2193
|
return S + U;
|
|
2194
2194
|
}, a.prototype.writeIntBE = function(w, S, U, W) {
|
|
2195
2195
|
if (w = +w, S = S >>> 0, !W) {
|
|
2196
2196
|
const we = Math.pow(2, 8 * U - 1);
|
|
2197
2197
|
_(this, w, S, U, we - 1, -we);
|
|
2198
2198
|
}
|
|
2199
|
-
let X = U - 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 = U - 1, ee = 1, Ee = 0;
|
|
2200
|
+
for (this[S + X] = w & 255; --X >= 0 && (ee *= 256); )
|
|
2201
|
+
w < 0 && Ee === 0 && this[S + X + 1] !== 0 && (Ee = 1), this[S + X] = (w / ee >> 0) - Ee & 255;
|
|
2202
2202
|
return S + U;
|
|
2203
2203
|
}, a.prototype.writeInt8 = function(w, S, U) {
|
|
2204
2204
|
return w = +w, S = S >>> 0, U || _(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 ee = w.charCodeAt(0);
|
|
2259
|
+
(W === "utf8" && ee < 128 || W === "latin1") && (w = ee);
|
|
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 < U)
|
|
@@ -2269,11 +2269,11 @@ function St() {
|
|
|
2269
2269
|
for (X = S; X < U; ++X)
|
|
2270
2270
|
this[X] = w;
|
|
2271
2271
|
else {
|
|
2272
|
-
const
|
|
2272
|
+
const ee = a.isBuffer(w) ? w : a.from(w, W), Ee = ee.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 < U - S; ++X)
|
|
2276
|
-
this[X + S] =
|
|
2276
|
+
this[X + S] = ee[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, U, W, X) {
|
|
2337
2337
|
if (N > S || N < w) {
|
|
2338
|
-
const
|
|
2338
|
+
const ee = 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${ee} and < 2${ee} ** ${(X + 1) * 8}${ee}` : Ee = `>= -(2${ee} ** ${(X + 1) * 8 - 1}${ee}) and < 2 ** ${(X + 1) * 8 - 1}${ee}`, new M.ERR_OUT_OF_RANGE("value", Ee, N);
|
|
2341
2341
|
}
|
|
2342
2342
|
D(U, W, X);
|
|
2343
2343
|
}
|
|
@@ -2365,13 +2365,13 @@ function St() {
|
|
|
2365
2365
|
const U = N.length;
|
|
2366
2366
|
let W = null;
|
|
2367
2367
|
const X = [];
|
|
2368
|
-
for (let
|
|
2369
|
-
if (S = N.charCodeAt(
|
|
2368
|
+
for (let ee = 0; ee < U; ++ee) {
|
|
2369
|
+
if (S = N.charCodeAt(ee), 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 (ee + 1 === U) {
|
|
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, U, W;
|
|
2424
2424
|
const X = [];
|
|
2425
|
-
for (let
|
|
2426
|
-
S = N.charCodeAt(
|
|
2425
|
+
for (let ee = 0; ee < N.length && !((w -= 2) < 0); ++ee)
|
|
2426
|
+
S = N.charCodeAt(ee), U = S >> 8, W = S % 256, X.push(W), X.push(U);
|
|
2427
2427
|
return X;
|
|
2428
2428
|
}
|
|
2429
2429
|
function Se(N) {
|
|
@@ -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.2.
|
|
15813
|
+
const g1 = "2.2.1", w1 = {
|
|
15814
15814
|
version: g1
|
|
15815
15815
|
};
|
|
15816
|
-
function
|
|
15817
|
-
if (!(this instanceof
|
|
15818
|
-
return new
|
|
15816
|
+
function Z(l, e, t) {
|
|
15817
|
+
if (!(this instanceof Z))
|
|
15818
|
+
return new Z(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
|
+
Z.prototype = Object.create(ct.prototype);
|
|
15826
|
+
Z.prototype.constructor = Z;
|
|
15827
15827
|
Object.keys(ct).forEach(function(l) {
|
|
15828
|
-
|
|
15828
|
+
Z[l] || (Z[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
|
+
Z.prototype.fromHex = function(l, e) {
|
|
15837
15837
|
return this.fromBuffer(Buffer.from(l, "hex"), e);
|
|
15838
15838
|
};
|
|
15839
|
-
|
|
15839
|
+
Z.prototype.toHex = function(l) {
|
|
15840
15840
|
return this.toBuffer(l).toString("hex");
|
|
15841
15841
|
};
|
|
15842
|
-
|
|
15842
|
+
Z.prototype.toJSON = function() {
|
|
15843
15843
|
return this.toString();
|
|
15844
15844
|
};
|
|
15845
|
-
|
|
15846
|
-
return new
|
|
15845
|
+
Z.prototype.fromJSON = function(l) {
|
|
15846
|
+
return new Z(l).copy(this), this;
|
|
15847
15847
|
};
|
|
15848
|
-
|
|
15849
|
-
return new
|
|
15848
|
+
Z.prototype.fromNumber = function(l) {
|
|
15849
|
+
return new Z(l).copy(this), this;
|
|
15850
15850
|
};
|
|
15851
|
-
|
|
15851
|
+
Z.prototype.toNumber = function() {
|
|
15852
15852
|
return parseInt(this.toString(10), 10);
|
|
15853
15853
|
};
|
|
15854
|
-
|
|
15855
|
-
return new
|
|
15854
|
+
Z.prototype.fromString = function(l, e) {
|
|
15855
|
+
return new Z(l, e).copy(this), this;
|
|
15856
15856
|
};
|
|
15857
|
-
|
|
15857
|
+
Z.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 Z(t, 16);
|
|
15861
15861
|
};
|
|
15862
|
-
|
|
15863
|
-
return
|
|
15862
|
+
Z.prototype.fromBuffer = function(l, e) {
|
|
15863
|
+
return Z.fromBuffer(l, e).copy(this), this;
|
|
15864
15864
|
};
|
|
15865
|
-
|
|
15865
|
+
Z.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 @@ ee.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
|
+
Z.prototype.toFastBuffer = function(l) {
|
|
15890
15890
|
return this.toBuffer(l);
|
|
15891
15891
|
};
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15892
|
+
Z.fromFastBuffer = Z.fromBuffer;
|
|
15893
|
+
Z.prototype.fromFastBuffer = Z.prototype.fromBuffer;
|
|
15894
|
+
Z.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
|
+
Z.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
|
+
Z.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,7 +15915,7 @@ ee.prototype.fromBits = function(l, e = { strict: !1 }) {
|
|
|
15915
15915
|
}
|
|
15916
15916
|
return this.fromBuffer(t), l & 8388608 && this.ineg(), this;
|
|
15917
15917
|
};
|
|
15918
|
-
|
|
15918
|
+
Z.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)
|
|
@@ -15928,18 +15928,18 @@ ee.prototype.toBits = function() {
|
|
|
15928
15928
|
const r = n << 24 | u, s = Buffer.alloc(4);
|
|
15929
15929
|
return s.writeInt32BE(r, 0), s.readUInt32BE(0);
|
|
15930
15930
|
};
|
|
15931
|
-
|
|
15931
|
+
Z.prototype.fromScriptNumBuffer = function(l, e, t) {
|
|
15932
15932
|
if (t === void 0 && (t = 4), l.length > t)
|
|
15933
15933
|
throw new Error(`script number overflow nMaxNumSize: ${t}`);
|
|
15934
15934
|
if (e && l.length > 0 && (l[l.length - 1] & 127) === 0 && (l.length <= 1 || (l[l.length - 2] & 128) === 0))
|
|
15935
15935
|
throw new Error("non-minimally encoded script number");
|
|
15936
15936
|
return this.fromSm(l, { endian: "little" });
|
|
15937
15937
|
};
|
|
15938
|
-
|
|
15938
|
+
Z.prototype.toScriptNumBuffer = function() {
|
|
15939
15939
|
return this.toSm({ endian: "little" });
|
|
15940
15940
|
};
|
|
15941
15941
|
const lr = function(l) {
|
|
15942
|
-
return l && (l instanceof ct || l.constructor.name === "BN" || l.constructor.name === "Bn") && !(l instanceof
|
|
15942
|
+
return l && (l instanceof ct || l.constructor.name === "BN" || l.constructor.name === "Bn") && !(l instanceof Z) ? new Z(l) : l;
|
|
15943
15943
|
}, _1 = [
|
|
15944
15944
|
"add",
|
|
15945
15945
|
"sub",
|
|
@@ -15961,35 +15961,35 @@ const lr = function(l) {
|
|
|
15961
15961
|
];
|
|
15962
15962
|
_1.forEach((l) => {
|
|
15963
15963
|
const e = ct.prototype[l];
|
|
15964
|
-
|
|
15965
|
-
return (typeof t == "string" || typeof t == "number") && (t = new
|
|
15964
|
+
Z.prototype[l] = function(t, ...n) {
|
|
15965
|
+
return (typeof t == "string" || typeof t == "number") && (t = new Z(t)), lr(e.call(this, t, ...n));
|
|
15966
15966
|
};
|
|
15967
15967
|
});
|
|
15968
15968
|
const S1 = ["ushln", "ushrn", "shln", "shrn", "testn", "maskn", "setn", "clrn", "bincn"];
|
|
15969
15969
|
S1.forEach((l) => {
|
|
15970
15970
|
const e = ct.prototype[l];
|
|
15971
|
-
|
|
15971
|
+
Z.prototype[l] = function(t, ...n) {
|
|
15972
15972
|
return t && (t instanceof ct || t.constructor.name === "BN" || t.constructor.name === "Bn") && (t = t.toNumber()), lr(e.call(this, t, ...n));
|
|
15973
15973
|
};
|
|
15974
15974
|
});
|
|
15975
15975
|
const x1 = ["sqr", "neg", "abs", "not", "redSqr", "redSqrt", "redNeg"];
|
|
15976
15976
|
x1.forEach((l) => {
|
|
15977
15977
|
const e = ct.prototype[l];
|
|
15978
|
-
|
|
15978
|
+
Z.prototype[l] = function() {
|
|
15979
15979
|
return lr(e.call(this));
|
|
15980
15980
|
};
|
|
15981
15981
|
});
|
|
15982
|
-
|
|
15982
|
+
Z.prototype.toRed = function(l) {
|
|
15983
15983
|
return lr(ct.prototype.toRed.call(this, l));
|
|
15984
15984
|
};
|
|
15985
|
-
|
|
15985
|
+
Z.prototype.fromRed = function() {
|
|
15986
15986
|
return lr(ct.prototype.fromRed.call(this));
|
|
15987
15987
|
};
|
|
15988
15988
|
const E1 = ["cmp", "gt", "geq", "lt", "leq", "eq", "neq"];
|
|
15989
15989
|
E1.forEach((l) => {
|
|
15990
15990
|
const e = ct.prototype.cmp;
|
|
15991
|
-
|
|
15992
|
-
(typeof t == "string" || typeof t == "number") && (t = new
|
|
15991
|
+
Z.prototype[l] = function(t) {
|
|
15992
|
+
(typeof t == "string" || typeof t == "number") && (t = new Z(t));
|
|
15993
15993
|
const n = e.call(this, t);
|
|
15994
15994
|
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
15995
|
};
|
|
@@ -16057,12 +16057,12 @@ class ot {
|
|
|
16057
16057
|
return this.pos = this.pos + 4, e;
|
|
16058
16058
|
}
|
|
16059
16059
|
readUInt64BEBn() {
|
|
16060
|
-
const e = this.buf.slice(this.pos, this.pos + 8), t = new
|
|
16060
|
+
const e = this.buf.slice(this.pos, this.pos + 8), t = new Z().fromBuffer(e);
|
|
16061
16061
|
return this.pos = this.pos + 8, t;
|
|
16062
16062
|
}
|
|
16063
16063
|
readUInt64LEBn() {
|
|
16064
16064
|
const e = this.readReverse(8);
|
|
16065
|
-
return new
|
|
16065
|
+
return new Z().fromBuffer(e);
|
|
16066
16066
|
}
|
|
16067
16067
|
readVarIntNum() {
|
|
16068
16068
|
const e = this.readUInt8();
|
|
@@ -16098,13 +16098,13 @@ class ot {
|
|
|
16098
16098
|
const e = this.readUInt8();
|
|
16099
16099
|
switch (e) {
|
|
16100
16100
|
case 253:
|
|
16101
|
-
return new
|
|
16101
|
+
return new Z(this.readUInt16LE());
|
|
16102
16102
|
case 254:
|
|
16103
|
-
return new
|
|
16103
|
+
return new Z(this.readUInt32LE());
|
|
16104
16104
|
case 255:
|
|
16105
16105
|
return this.readUInt64LEBn();
|
|
16106
16106
|
default:
|
|
16107
|
-
return new
|
|
16107
|
+
return new Z(e);
|
|
16108
16108
|
}
|
|
16109
16109
|
}
|
|
16110
16110
|
}
|
|
@@ -17210,11 +17210,11 @@ class Ie extends Tt {
|
|
|
17210
17210
|
return t = Object.create(Ie.prototype), t.copyFrom(u);
|
|
17211
17211
|
}
|
|
17212
17212
|
getX() {
|
|
17213
|
-
const e = Tt.prototype.getX.call(this), t = Object.create(
|
|
17213
|
+
const e = Tt.prototype.getX.call(this), t = Object.create(Z.prototype);
|
|
17214
17214
|
return e.copy(t), t;
|
|
17215
17215
|
}
|
|
17216
17216
|
getY() {
|
|
17217
|
-
const e = Tt.prototype.getY.call(this), t = Object.create(
|
|
17217
|
+
const e = Tt.prototype.getY.call(this), t = Object.create(Z.prototype);
|
|
17218
17218
|
return e.copy(t), t;
|
|
17219
17219
|
}
|
|
17220
17220
|
fromX(e, t) {
|
|
@@ -17228,7 +17228,7 @@ class Ie extends Tt {
|
|
|
17228
17228
|
};
|
|
17229
17229
|
}
|
|
17230
17230
|
fromJSON(e) {
|
|
17231
|
-
const t = new
|
|
17231
|
+
const t = new Z().fromString(e.x), n = new Z().fromString(e.y), u = new Ie(t, n);
|
|
17232
17232
|
return this.copyFrom(u);
|
|
17233
17233
|
}
|
|
17234
17234
|
toString() {
|
|
@@ -17243,7 +17243,7 @@ class Ie extends Tt {
|
|
|
17243
17243
|
return Object.create(Ie.prototype).copyFrom(e);
|
|
17244
17244
|
}
|
|
17245
17245
|
static getN() {
|
|
17246
|
-
return new
|
|
17246
|
+
return new Z(Qt.curve.n.toArray());
|
|
17247
17247
|
}
|
|
17248
17248
|
// https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf
|
|
17249
17249
|
validate() {
|
|
@@ -17311,13 +17311,13 @@ class Ue extends Ce {
|
|
|
17311
17311
|
const n = e.slice(1, 33), u = e.slice(33, 65);
|
|
17312
17312
|
if (n.length !== 32 || u.length !== 32 || e.length !== 65)
|
|
17313
17313
|
throw new Error("LEngth of x and y must be 32 bytes");
|
|
17314
|
-
const r = new
|
|
17314
|
+
const r = new Z(n), s = new Z(u);
|
|
17315
17315
|
this.point = new Ie(r, s), this.compressed = !1;
|
|
17316
17316
|
} else if (e[0] === 3) {
|
|
17317
|
-
const n = e.slice(1), u = new
|
|
17317
|
+
const n = e.slice(1), u = new Z(n);
|
|
17318
17318
|
this.fromX(!0, u), this.compressed = !0;
|
|
17319
17319
|
} else if (e[0] === 2) {
|
|
17320
|
-
const n = e.slice(1), u = new
|
|
17320
|
+
const n = e.slice(1), u = new Z(n);
|
|
17321
17321
|
this.fromX(!1, u), this.compressed = !0;
|
|
17322
17322
|
} else
|
|
17323
17323
|
throw new Error("Invalid DER format pubKey");
|
|
@@ -17380,7 +17380,7 @@ class Ue extends Ce {
|
|
|
17380
17380
|
validate() {
|
|
17381
17381
|
if (this.point.isInfinity())
|
|
17382
17382
|
throw new Error("point: Point cannot be equal to Infinity");
|
|
17383
|
-
if (this.point.eq(new Ie(new
|
|
17383
|
+
if (this.point.eq(new Ie(new Z(0), new Z(0))))
|
|
17384
17384
|
throw new Error("point: Point cannot be equal to 0, 0");
|
|
17385
17385
|
return this.point.validate(), this;
|
|
17386
17386
|
}
|
|
@@ -17405,7 +17405,7 @@ class wt extends Ce {
|
|
|
17405
17405
|
fromRandom() {
|
|
17406
17406
|
let e, t, n;
|
|
17407
17407
|
do
|
|
17408
|
-
e = It.getRandomBuffer(32), t = new
|
|
17408
|
+
e = It.getRandomBuffer(32), t = new Z().fromBuffer(e), n = t.lt(Ie.getN());
|
|
17409
17409
|
while (!n);
|
|
17410
17410
|
return this.fromObject({
|
|
17411
17411
|
bn: t,
|
|
@@ -17437,7 +17437,7 @@ class wt extends Ce {
|
|
|
17437
17437
|
);
|
|
17438
17438
|
if (e[0] !== this.Constants.versionByteNum)
|
|
17439
17439
|
throw new Error("Invalid versionByteNum byte");
|
|
17440
|
-
return this.fromBn(new
|
|
17440
|
+
return this.fromBn(new Z().fromBuffer(e.slice(1, 33)));
|
|
17441
17441
|
}
|
|
17442
17442
|
toBn() {
|
|
17443
17443
|
return this.bn;
|
|
@@ -17525,7 +17525,7 @@ class he extends Ce {
|
|
|
17525
17525
|
throw new Error("r must be 32 bytes");
|
|
17526
17526
|
if (n.length !== 32 || e.length > 64)
|
|
17527
17527
|
throw new Error("s must be 32 bytes");
|
|
17528
|
-
return this.r = new
|
|
17528
|
+
return this.r = new Z().fromBuffer(t), this.s = new Z().fromBuffer(n), this;
|
|
17529
17529
|
}
|
|
17530
17530
|
static fromRS(e) {
|
|
17531
17531
|
return new this().fromRS(e);
|
|
@@ -17541,7 +17541,7 @@ class he extends Ce {
|
|
|
17541
17541
|
// The format used in a tx
|
|
17542
17542
|
fromTxFormat(e) {
|
|
17543
17543
|
if (e.length === 0)
|
|
17544
|
-
return this.r = new
|
|
17544
|
+
return this.r = new Z(1), this.s = new Z(1), this.nHashType = 1, this;
|
|
17545
17545
|
const t = e.readUInt8(e.length - 1), n = e.slice(0, e.length - 1);
|
|
17546
17546
|
return this.fromDer(n, !1), this.nHashType = t, this;
|
|
17547
17547
|
}
|
|
@@ -17568,13 +17568,13 @@ class he extends Ce {
|
|
|
17568
17568
|
const s = e[2];
|
|
17569
17569
|
if (s !== 2)
|
|
17570
17570
|
throw new Error("Integer byte for r should be 0x02");
|
|
17571
|
-
const a = e[3], o = e.slice(4, 4 + a), f = new
|
|
17571
|
+
const a = e[3], o = e.slice(4, 4 + a), f = new Z().fromBuffer(o), i = e[4] === 0;
|
|
17572
17572
|
if (a !== o.length)
|
|
17573
17573
|
throw new Error("LEngth of r incorrect");
|
|
17574
17574
|
const c = e[4 + a + 0];
|
|
17575
17575
|
if (c !== 2)
|
|
17576
17576
|
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
|
|
17577
|
+
const h = e[4 + a + 1], d = e.slice(4 + a + 2, 4 + a + 2 + h), b = new Z().fromBuffer(d), p = e[4 + a + 2 + 2] === 0;
|
|
17578
17578
|
if (h !== d.length)
|
|
17579
17579
|
throw new Error("LEngth of s incorrect");
|
|
17580
17580
|
const y = 4 + a + 2 + h;
|
|
@@ -17629,7 +17629,7 @@ class he extends Ce {
|
|
|
17629
17629
|
*/
|
|
17630
17630
|
hasLowS() {
|
|
17631
17631
|
return !(this.s.lt(1) || this.s.gt(
|
|
17632
|
-
|
|
17632
|
+
Z.fromBuffer(
|
|
17633
17633
|
Buffer.from(
|
|
17634
17634
|
"7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0",
|
|
17635
17635
|
"hex"
|
|
@@ -17827,7 +17827,7 @@ class Ae extends Ce {
|
|
|
17827
17827
|
if (isNaN(parseInt(s, 10)))
|
|
17828
17828
|
throw new Error("Could not determine type of script value");
|
|
17829
17829
|
{
|
|
17830
|
-
const a = new
|
|
17830
|
+
const a = new Z(s), f = new Ae().writeBn(a).toBuffer();
|
|
17831
17831
|
t.write(f);
|
|
17832
17832
|
}
|
|
17833
17833
|
}
|
|
@@ -18132,7 +18132,7 @@ class Ae extends Ce {
|
|
|
18132
18132
|
return new this().writeBn(e);
|
|
18133
18133
|
}
|
|
18134
18134
|
writeNumber(e) {
|
|
18135
|
-
return this.writeBn(new
|
|
18135
|
+
return this.writeBn(new Z().fromNumber(e)), this;
|
|
18136
18136
|
}
|
|
18137
18137
|
static writeNumber(e) {
|
|
18138
18138
|
return new this().writeNumber(e);
|
|
@@ -18376,7 +18376,7 @@ class kr extends Ce {
|
|
|
18376
18376
|
if (e.length > 512 / 8)
|
|
18377
18377
|
throw new Error("More than 512 bits of entropy is nonstandard");
|
|
18378
18378
|
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(
|
|
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(Z().fromBuffer(t.slice(0, 32))), this.pubKey = new Ue().fromPrivKey(this.privKey), this;
|
|
18380
18380
|
}
|
|
18381
18381
|
static fromSeed(e) {
|
|
18382
18382
|
return new this().fromSeed(e);
|
|
@@ -18397,7 +18397,7 @@ class kr extends Ce {
|
|
|
18397
18397
|
const t = e.slice(45, 78), n = this.versionBytesNum === this.Constants.privKey, u = this.versionBytesNum === this.Constants.pubKey;
|
|
18398
18398
|
if (n && t[0] === 0)
|
|
18399
18399
|
this.privKey = new this.PrivKey().fromBn(
|
|
18400
|
-
|
|
18400
|
+
Z().fromBuffer(t.slice(1, 33))
|
|
18401
18401
|
), this.pubKey = new Ue().fromPrivKey(this.privKey);
|
|
18402
18402
|
else if (u && (t[0] === 2 || t[0] === 3))
|
|
18403
18403
|
this.pubKey = new Ue().fromDer(t);
|
|
@@ -18425,7 +18425,7 @@ class kr extends Ce {
|
|
|
18425
18425
|
const t = e.slice(45, e.length), n = this.versionBytesNum === this.Constants.privKey, u = this.versionBytesNum === this.Constants.pubKey;
|
|
18426
18426
|
if (n && t[0] === 0 && e.length === 78)
|
|
18427
18427
|
this.privKey = new this.PrivKey().fromBn(
|
|
18428
|
-
|
|
18428
|
+
Z().fromBuffer(t.slice(1, 33))
|
|
18429
18429
|
), this.pubKey = new Ue().fromPrivKey(this.privKey);
|
|
18430
18430
|
else if (u && e.length === 111)
|
|
18431
18431
|
this.pubKey = new Ue().fromFastBuffer(t), this.pubKey.compressed = !0;
|
|
@@ -18474,10 +18474,10 @@ class kr extends Ce {
|
|
|
18474
18474
|
this.privKey.bn.toBuffer({ size: 32 }),
|
|
18475
18475
|
t
|
|
18476
18476
|
]) : a = Buffer.concat([this.pubKey.toBuffer({ size: 32 }), t]);
|
|
18477
|
-
const o = ae.sha512Hmac(a, this.chainCode), f =
|
|
18477
|
+
const o = ae.sha512Hmac(a, this.chainCode), f = Z().fromBuffer(o.slice(0, 32), { size: 32 }), i = o.slice(32, 64), c = f.add(this.privKey.bn).mod(Ie.getN());
|
|
18478
18478
|
r = new this.constructor(), r.chainCode = i, r.privKey = new this.PrivKey().fromBn(c), r.pubKey = new Ue().fromPrivKey(r.privKey);
|
|
18479
18479
|
} else {
|
|
18480
|
-
const a = Buffer.concat([this.pubKey.toBuffer(), t]), o = ae.sha512Hmac(a, this.chainCode), f =
|
|
18480
|
+
const a = Buffer.concat([this.pubKey.toBuffer(), t]), o = ae.sha512Hmac(a, this.chainCode), f = Z().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
18481
|
b.point = d, r = new this.constructor(), r.chainCode = i, r.pubKey = b;
|
|
18482
18482
|
}
|
|
18483
18483
|
r.childIndex = e;
|
|
@@ -24983,7 +24983,7 @@ class ht extends Ce {
|
|
|
24983
24983
|
};
|
|
24984
24984
|
}
|
|
24985
24985
|
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
|
|
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 Z().fromString(e.k) : void 0, this.endian = e.endian, this.verified = e.verified, this;
|
|
24987
24987
|
}
|
|
24988
24988
|
toBuffer() {
|
|
24989
24989
|
const e = JSON.stringify(this.toJSON());
|
|
@@ -25039,13 +25039,13 @@ class ht extends Ce {
|
|
|
25039
25039
|
}
|
|
25040
25040
|
fromString(e) {
|
|
25041
25041
|
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
|
|
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 Z(t.k, 10)), this;
|
|
25043
25043
|
}
|
|
25044
25044
|
randomK() {
|
|
25045
25045
|
const e = Ie.getN();
|
|
25046
25046
|
let t;
|
|
25047
25047
|
do
|
|
25048
|
-
t = new
|
|
25048
|
+
t = new Z().fromBuffer(It.getRandomBuffer(32));
|
|
25049
25049
|
while (!(t.lt(e) && t.gt(0)));
|
|
25050
25050
|
return this.k = t, this;
|
|
25051
25051
|
}
|
|
@@ -25076,11 +25076,11 @@ class ht extends Ce {
|
|
|
25076
25076
|
Buffer.concat([t, Buffer.from([1]), u, this.hashBuf]),
|
|
25077
25077
|
n
|
|
25078
25078
|
), t = ae.sha256Hmac(t, n), t = ae.sha256Hmac(t, n);
|
|
25079
|
-
let r = new
|
|
25079
|
+
let r = new Z().fromBuffer(t);
|
|
25080
25080
|
const s = Ie.getN();
|
|
25081
25081
|
e === void 0 && (e = 0);
|
|
25082
25082
|
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
|
|
25083
|
+
n = ae.sha256Hmac(Buffer.concat([t, Buffer.from([0])]), n), t = ae.sha256Hmac(t, n), t = ae.sha256Hmac(t, n), r = new Z().fromBuffer(t);
|
|
25084
25084
|
return this.k = r, this;
|
|
25085
25085
|
}
|
|
25086
25086
|
/**
|
|
@@ -25093,7 +25093,7 @@ class ht extends Ce {
|
|
|
25093
25093
|
const e = this.sig.recovery;
|
|
25094
25094
|
if (!(e === 0 || e === 1 || e === 2 || e === 3))
|
|
25095
25095
|
throw new Error("i must be equal to 0, 1, 2, or 3");
|
|
25096
|
-
const t = new
|
|
25096
|
+
const t = new Z().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
25097
|
let c = "";
|
|
25098
25098
|
try {
|
|
25099
25099
|
i.mul(a);
|
|
@@ -25138,7 +25138,7 @@ class ht extends Ce {
|
|
|
25138
25138
|
return "r and s not in range";
|
|
25139
25139
|
if (e && !this.sig.hasLowS())
|
|
25140
25140
|
return "s is too high and does not satisfy low s contraint - see bip 62";
|
|
25141
|
-
const u = new
|
|
25141
|
+
const u = new Z().fromBuffer(
|
|
25142
25142
|
this.hashBuf,
|
|
25143
25143
|
this.endian ? { endian: this.endian } : void 0
|
|
25144
25144
|
), 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 +25150,13 @@ class ht extends Ce {
|
|
|
25150
25150
|
throw new Error("invalid parameters");
|
|
25151
25151
|
if (!Buffer.isBuffer(e) || e.length !== 32)
|
|
25152
25152
|
throw new Error("hashBuf must be a 32 byte buffer");
|
|
25153
|
-
const u = Ie.getN(), r = Ie.getG(), s = new
|
|
25153
|
+
const u = Ie.getN(), r = Ie.getG(), s = new Z().fromBuffer(e);
|
|
25154
25154
|
let a = 0, o, f, i, c;
|
|
25155
25155
|
do
|
|
25156
25156
|
(!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
25157
|
while (i.cmp(0) <= 0 || c.cmp(0) <= 0);
|
|
25158
25158
|
return c.gt(
|
|
25159
|
-
new
|
|
25159
|
+
new Z().fromBuffer(
|
|
25160
25160
|
Buffer.from(
|
|
25161
25161
|
"7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0",
|
|
25162
25162
|
"hex"
|
|
@@ -25506,7 +25506,7 @@ class gt extends Ce {
|
|
|
25506
25506
|
}
|
|
25507
25507
|
fromJSON(e) {
|
|
25508
25508
|
return this.fromObject({
|
|
25509
|
-
valueBn: new
|
|
25509
|
+
valueBn: new Z().fromJSON(e.valueBn),
|
|
25510
25510
|
scriptVi: new Fe().fromJSON(e.scriptVi),
|
|
25511
25511
|
script: new Ae().fromJSON(e.script)
|
|
25512
25512
|
}), this;
|
|
@@ -25630,7 +25630,7 @@ class Me extends Ce {
|
|
|
25630
25630
|
])).resbuf;
|
|
25631
25631
|
}
|
|
25632
25632
|
sighashPreimage(e, t, n, u, r = Me.SCRIPT_ENABLE_SIGHASH_FORKID, s = new Nr()) {
|
|
25633
|
-
if (u === void 0 && (u = new
|
|
25633
|
+
if (u === void 0 && (u = new Z(0)), e & he.SIGHASH_FORKID && !(e & he.SIGHASH_CHRONICLE) && r & Me.SCRIPT_ENABLE_SIGHASH_FORKID) {
|
|
25634
25634
|
let f = Buffer.alloc(32, 0), i = Buffer.alloc(32, 0), c = Buffer.alloc(32, 0);
|
|
25635
25635
|
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
25636
|
const h = new ke();
|
|
@@ -25657,7 +25657,7 @@ class Me extends Ce {
|
|
|
25657
25657
|
a.txOuts.length = t + 1, a.txOutsVi = Fe.fromNumber(t + 1);
|
|
25658
25658
|
for (let f = 0; f < a.txOuts.length; f++)
|
|
25659
25659
|
f < t && (a.txOuts[f] = gt.fromProperties(
|
|
25660
|
-
new
|
|
25660
|
+
new Z().fromBuffer(Buffer.from("ffffffffffffffff", "hex")),
|
|
25661
25661
|
new Ae()
|
|
25662
25662
|
));
|
|
25663
25663
|
for (let f = 0; f < a.txIns.length; f++)
|
|
@@ -25957,7 +25957,7 @@ function jf(l) {
|
|
|
25957
25957
|
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
25958
|
}
|
|
25959
25959
|
class ie extends Ce {
|
|
25960
|
-
constructor(e, t, n, u = [], r = [], s = 0, a = 0, o = 0, f = [], i = "", c = ie.defaultFlags, h = new
|
|
25960
|
+
constructor(e, t, n, u = [], r = [], s = 0, a = 0, o = 0, f = [], i = "", c = ie.defaultFlags, h = new Z(0)) {
|
|
25961
25961
|
super({
|
|
25962
25962
|
script: e,
|
|
25963
25963
|
tx: t,
|
|
@@ -26012,17 +26012,17 @@ class ie extends Ce {
|
|
|
26012
26012
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26013
26013
|
let u, r = 0, s, a;
|
|
26014
26014
|
try {
|
|
26015
|
-
const c = this.stack[this.stack.length - 1], h = new
|
|
26015
|
+
const c = this.stack[this.stack.length - 1], h = new Z().fromScriptNumBuffer(
|
|
26016
26016
|
c,
|
|
26017
26017
|
t,
|
|
26018
26018
|
this.scriptNumMaxSize()
|
|
26019
26019
|
);
|
|
26020
26020
|
if (n || e === H.OP_LEFT_CHRONICLE || e === H.OP_RIGHT_CHRONICLE ? u = h.toNumber() : s = h.toNumber(), n) {
|
|
26021
26021
|
const d = this.stack[this.stack.length - 2];
|
|
26022
|
-
r = new
|
|
26022
|
+
r = new Z().fromScriptNumBuffer(d, t, this.scriptNumMaxSize()).toNumber();
|
|
26023
26023
|
} else if (!n) {
|
|
26024
26024
|
const d = this.stack[this.stack.length - 2];
|
|
26025
|
-
a = new
|
|
26025
|
+
a = new Z().fromScriptNumBuffer(
|
|
26026
26026
|
d,
|
|
26027
26027
|
t,
|
|
26028
26028
|
this.scriptNumMaxSize()
|
|
@@ -26041,7 +26041,13 @@ class ie extends Ce {
|
|
|
26041
26041
|
if (s < 0)
|
|
26042
26042
|
return this.errStr = "SCRIPT_ERR_INVALID_NUMBER_RANGE", !1;
|
|
26043
26043
|
const o = a.negative, f = a.abs();
|
|
26044
|
-
let i
|
|
26044
|
+
let i;
|
|
26045
|
+
if (e === H.OP_LSHIFTNUM)
|
|
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
|
+
}
|
|
26045
26051
|
return o && (i = i.ineg()), this.stack.pop(), this.stack.pop(), this.stack.push(i.toScriptNumBuffer()), !0;
|
|
26046
26052
|
}
|
|
26047
26053
|
static castToBool(e) {
|
|
@@ -26145,7 +26151,7 @@ class ie extends Ce {
|
|
|
26145
26151
|
case H.OP_15:
|
|
26146
26152
|
case H.OP_16:
|
|
26147
26153
|
{
|
|
26148
|
-
let r = n - (H.OP_1 - 1), s = new
|
|
26154
|
+
let r = n - (H.OP_1 - 1), s = new Z(r).toScriptNumBuffer();
|
|
26149
26155
|
this.stack.push(s);
|
|
26150
26156
|
}
|
|
26151
26157
|
break;
|
|
@@ -26166,7 +26172,7 @@ class ie extends Ce {
|
|
|
26166
26172
|
let r;
|
|
26167
26173
|
try {
|
|
26168
26174
|
const s = this.stack[this.stack.length - 1];
|
|
26169
|
-
r = new
|
|
26175
|
+
r = new Z().fromScriptNumBuffer(
|
|
26170
26176
|
s,
|
|
26171
26177
|
e,
|
|
26172
26178
|
5
|
|
@@ -26192,7 +26198,7 @@ class ie extends Ce {
|
|
|
26192
26198
|
let r;
|
|
26193
26199
|
try {
|
|
26194
26200
|
const s = this.stack[this.stack.length - 1];
|
|
26195
|
-
r = new
|
|
26201
|
+
r = new Z().fromScriptNumBuffer(
|
|
26196
26202
|
s,
|
|
26197
26203
|
e,
|
|
26198
26204
|
5
|
|
@@ -26268,7 +26274,7 @@ class ie extends Ce {
|
|
|
26268
26274
|
}
|
|
26269
26275
|
break;
|
|
26270
26276
|
case H.OP_RETURN:
|
|
26271
|
-
return this.isUnlockingScript && this.isChronicle() ? (this.pc = this.script.chunks.length, !0) : (this.errStr = "SCRIPT_ERR_OP_RETURN", !1);
|
|
26277
|
+
return this.isUnlockingScript && this.isChronicle() ? (this.pc = this.script.chunks.length, this.ifStack = [], !0) : (this.errStr = "SCRIPT_ERR_OP_RETURN", !1);
|
|
26272
26278
|
//
|
|
26273
26279
|
// Stack ops
|
|
26274
26280
|
//
|
|
@@ -26337,7 +26343,7 @@ class ie extends Ce {
|
|
|
26337
26343
|
break;
|
|
26338
26344
|
case H.OP_DEPTH:
|
|
26339
26345
|
{
|
|
26340
|
-
const r = new
|
|
26346
|
+
const r = new Z(this.stack.length).toScriptNumBuffer();
|
|
26341
26347
|
this.stack.push(r);
|
|
26342
26348
|
}
|
|
26343
26349
|
break;
|
|
@@ -26369,7 +26375,7 @@ class ie extends Ce {
|
|
|
26369
26375
|
let r;
|
|
26370
26376
|
try {
|
|
26371
26377
|
const a = this.stack[this.stack.length - 1];
|
|
26372
|
-
r = new
|
|
26378
|
+
r = new Z().fromScriptNumBuffer(a, e, this.scriptNumMaxSize()).toNumber();
|
|
26373
26379
|
} catch (a) {
|
|
26374
26380
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26375
26381
|
}
|
|
@@ -26408,7 +26414,7 @@ class ie extends Ce {
|
|
|
26408
26414
|
{
|
|
26409
26415
|
if (this.stack.length < 1)
|
|
26410
26416
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26411
|
-
const r = new
|
|
26417
|
+
const r = new Z(this.stack[this.stack.length - 1].length);
|
|
26412
26418
|
this.stack.push(r.toScriptNumBuffer());
|
|
26413
26419
|
}
|
|
26414
26420
|
break;
|
|
@@ -26456,10 +26462,10 @@ class ie extends Ce {
|
|
|
26456
26462
|
if (this.stack.length < 2)
|
|
26457
26463
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26458
26464
|
const r = this.stack[this.stack.length - 2];
|
|
26459
|
-
let s = new
|
|
26465
|
+
let s = new Z(r), a;
|
|
26460
26466
|
try {
|
|
26461
26467
|
const f = this.stack[this.stack.length - 1];
|
|
26462
|
-
a = new
|
|
26468
|
+
a = new Z().fromScriptNumBuffer(
|
|
26463
26469
|
f,
|
|
26464
26470
|
e,
|
|
26465
26471
|
this.scriptNumMaxSize()
|
|
@@ -26513,7 +26519,7 @@ class ie extends Ce {
|
|
|
26513
26519
|
const r = this.stack[this.stack.length - 1];
|
|
26514
26520
|
let s;
|
|
26515
26521
|
try {
|
|
26516
|
-
s = new
|
|
26522
|
+
s = new Z().fromScriptNumBuffer(r, e, this.scriptNumMaxSize());
|
|
26517
26523
|
} catch (a) {
|
|
26518
26524
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26519
26525
|
}
|
|
@@ -26528,7 +26534,7 @@ class ie extends Ce {
|
|
|
26528
26534
|
s = s.add(s);
|
|
26529
26535
|
break;
|
|
26530
26536
|
case H.OP_2DIV:
|
|
26531
|
-
s = s.div(new
|
|
26537
|
+
s = s.div(new Z(2));
|
|
26532
26538
|
break;
|
|
26533
26539
|
case H.OP_NEGATE:
|
|
26534
26540
|
s = s.neg();
|
|
@@ -26537,10 +26543,10 @@ class ie extends Ce {
|
|
|
26537
26543
|
s.lt(0) && (s = s.neg());
|
|
26538
26544
|
break;
|
|
26539
26545
|
case H.OP_NOT:
|
|
26540
|
-
s = new
|
|
26546
|
+
s = new Z(s.eq(0) ? 1 : 0);
|
|
26541
26547
|
break;
|
|
26542
26548
|
case H.OP_0NOTEQUAL:
|
|
26543
|
-
s = new
|
|
26549
|
+
s = new Z(s.neq(0) ? 1 : 0);
|
|
26544
26550
|
break;
|
|
26545
26551
|
}
|
|
26546
26552
|
this.stack.pop(), this.stack.push(s.toScriptNumBuffer());
|
|
@@ -26567,11 +26573,11 @@ class ie extends Ce {
|
|
|
26567
26573
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26568
26574
|
let r, s;
|
|
26569
26575
|
try {
|
|
26570
|
-
r = new
|
|
26576
|
+
r = new Z().fromScriptNumBuffer(
|
|
26571
26577
|
this.stack[this.stack.length - 2],
|
|
26572
26578
|
e,
|
|
26573
26579
|
this.scriptNumMaxSize()
|
|
26574
|
-
), s = new
|
|
26580
|
+
), s = new Z().fromScriptNumBuffer(
|
|
26575
26581
|
this.stack[this.stack.length - 1],
|
|
26576
26582
|
e,
|
|
26577
26583
|
this.scriptNumMaxSize()
|
|
@@ -26579,7 +26585,7 @@ class ie extends Ce {
|
|
|
26579
26585
|
} catch (o) {
|
|
26580
26586
|
return this.errStr = o.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26581
26587
|
}
|
|
26582
|
-
let a = new
|
|
26588
|
+
let a = new Z(0);
|
|
26583
26589
|
switch (n) {
|
|
26584
26590
|
case H.OP_ADD:
|
|
26585
26591
|
a = r.add(s);
|
|
@@ -26601,31 +26607,31 @@ class ie extends Ce {
|
|
|
26601
26607
|
a = r.mod(s);
|
|
26602
26608
|
break;
|
|
26603
26609
|
case H.OP_BOOLAND:
|
|
26604
|
-
a = new
|
|
26610
|
+
a = new Z(r.neq(0) && s.neq(0) ? 1 : 0);
|
|
26605
26611
|
break;
|
|
26606
26612
|
case H.OP_BOOLOR:
|
|
26607
|
-
a = new
|
|
26613
|
+
a = new Z(r.neq(0) || s.neq(0) ? 1 : 0);
|
|
26608
26614
|
break;
|
|
26609
26615
|
case H.OP_NUMEQUAL:
|
|
26610
|
-
a = new
|
|
26616
|
+
a = new Z(r.eq(s) ? 1 : 0);
|
|
26611
26617
|
break;
|
|
26612
26618
|
case H.OP_NUMEQUALVERIFY:
|
|
26613
|
-
a = new
|
|
26619
|
+
a = new Z(r.eq(s) ? 1 : 0);
|
|
26614
26620
|
break;
|
|
26615
26621
|
case H.OP_NUMNOTEQUAL:
|
|
26616
|
-
a = new
|
|
26622
|
+
a = new Z(r.neq(s) ? 1 : 0);
|
|
26617
26623
|
break;
|
|
26618
26624
|
case H.OP_LESSTHAN:
|
|
26619
|
-
a = new
|
|
26625
|
+
a = new Z(r.lt(s) ? 1 : 0);
|
|
26620
26626
|
break;
|
|
26621
26627
|
case H.OP_GREATERTHAN:
|
|
26622
|
-
a = new
|
|
26628
|
+
a = new Z(r.gt(s) ? 1 : 0);
|
|
26623
26629
|
break;
|
|
26624
26630
|
case H.OP_LESSTHANOREQUAL:
|
|
26625
|
-
a = new
|
|
26631
|
+
a = new Z(r.leq(s) ? 1 : 0);
|
|
26626
26632
|
break;
|
|
26627
26633
|
case H.OP_GREATERTHANOREQUAL:
|
|
26628
|
-
a = new
|
|
26634
|
+
a = new Z(r.geq(s) ? 1 : 0);
|
|
26629
26635
|
break;
|
|
26630
26636
|
case H.OP_MIN:
|
|
26631
26637
|
a = r.lt(s) ? r : s;
|
|
@@ -26647,15 +26653,15 @@ class ie extends Ce {
|
|
|
26647
26653
|
return this.errStr = "SCRIPT_ERR_INVALID_STACK_OPERATION", !1;
|
|
26648
26654
|
let r, s, a;
|
|
26649
26655
|
try {
|
|
26650
|
-
r = new
|
|
26656
|
+
r = new Z().fromScriptNumBuffer(
|
|
26651
26657
|
this.stack[this.stack.length - 3],
|
|
26652
26658
|
e,
|
|
26653
26659
|
this.scriptNumMaxSize()
|
|
26654
|
-
), s = new
|
|
26660
|
+
), s = new Z().fromScriptNumBuffer(
|
|
26655
26661
|
this.stack[this.stack.length - 2],
|
|
26656
26662
|
e,
|
|
26657
26663
|
this.scriptNumMaxSize()
|
|
26658
|
-
), a = new
|
|
26664
|
+
), a = new Z().fromScriptNumBuffer(
|
|
26659
26665
|
this.stack[this.stack.length - 1],
|
|
26660
26666
|
e,
|
|
26661
26667
|
this.scriptNumMaxSize()
|
|
@@ -26731,7 +26737,7 @@ class ie extends Ce {
|
|
|
26731
26737
|
let s;
|
|
26732
26738
|
try {
|
|
26733
26739
|
const h = this.stack[this.stack.length - r];
|
|
26734
|
-
s = new
|
|
26740
|
+
s = new Z().fromScriptNumBuffer(h, e).toNumber();
|
|
26735
26741
|
} catch (h) {
|
|
26736
26742
|
return this.errStr = h.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26737
26743
|
}
|
|
@@ -26745,7 +26751,7 @@ class ie extends Ce {
|
|
|
26745
26751
|
let o;
|
|
26746
26752
|
try {
|
|
26747
26753
|
const h = this.stack[this.stack.length - r];
|
|
26748
|
-
o = new
|
|
26754
|
+
o = new Z().fromScriptNumBuffer(h, e).toNumber();
|
|
26749
26755
|
} catch (h) {
|
|
26750
26756
|
return this.errStr = h.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26751
26757
|
}
|
|
@@ -26820,7 +26826,7 @@ class ie extends Ce {
|
|
|
26820
26826
|
let s;
|
|
26821
26827
|
try {
|
|
26822
26828
|
const f = this.stack[this.stack.length - 1];
|
|
26823
|
-
s = new
|
|
26829
|
+
s = new Z().fromScriptNumBuffer(f, e).toNumber();
|
|
26824
26830
|
} catch (f) {
|
|
26825
26831
|
return this.errStr = f.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26826
26832
|
}
|
|
@@ -26837,7 +26843,7 @@ class ie extends Ce {
|
|
|
26837
26843
|
let r;
|
|
26838
26844
|
try {
|
|
26839
26845
|
const f = this.stack[this.stack.length - 1];
|
|
26840
|
-
r = new
|
|
26846
|
+
r = new Z().fromScriptNumBuffer(
|
|
26841
26847
|
f,
|
|
26842
26848
|
e,
|
|
26843
26849
|
this.scriptNumMaxSize()
|
|
@@ -26865,7 +26871,7 @@ class ie extends Ce {
|
|
|
26865
26871
|
return this.errStr = "OP_BIN2NUM requires at least one item to be on the stack.", !1;
|
|
26866
26872
|
const r = this.stack[this.stack.length - 1], s = jf(r);
|
|
26867
26873
|
try {
|
|
26868
|
-
this.stack[this.stack.length - 1] = new
|
|
26874
|
+
this.stack[this.stack.length - 1] = new Z().fromScriptNumBuffer(s, e, this.scriptNumMaxSize()).toScriptNumBuffer();
|
|
26869
26875
|
} catch (a) {
|
|
26870
26876
|
return this.errStr = a.message.includes("overflow") ? "SCRIPTNUM_OVERFLOW" : "SCRIPT_ERR_UNKNOWN_ERROR", !1;
|
|
26871
26877
|
}
|
|
@@ -27216,7 +27222,7 @@ class L1 extends Ce {
|
|
|
27216
27222
|
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;
|
|
27217
27223
|
}
|
|
27218
27224
|
fromJSON(e) {
|
|
27219
|
-
return this.tx = new Me().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
|
|
27225
|
+
return this.tx = new Me().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 Z(e.changeAmountBn) : void 0, this.feeAmountBn = e.feeAmountBn ? new Z(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;
|
|
27220
27226
|
}
|
|
27221
27227
|
setFeePerKbNum(e) {
|
|
27222
27228
|
if (typeof e != "number" || e < 0)
|
|
@@ -27299,7 +27305,7 @@ class L1 extends Ce {
|
|
|
27299
27305
|
* denominated in satoshis, not bitcoins.
|
|
27300
27306
|
*/
|
|
27301
27307
|
outputToAddress(e, t) {
|
|
27302
|
-
if (!(t instanceof Et) || !(e instanceof
|
|
27308
|
+
if (!(t instanceof Et) || !(e instanceof Z))
|
|
27303
27309
|
throw new Error("addr must be an Address, and valueBn must be a Bn");
|
|
27304
27310
|
const n = new Ae().fromPubKeyHash(t.hashBuf);
|
|
27305
27311
|
return this.outputToScript(e, n), this;
|
|
@@ -27309,13 +27315,13 @@ class L1 extends Ce {
|
|
|
27309
27315
|
* denominated in satoshis, not bitcoins.
|
|
27310
27316
|
*/
|
|
27311
27317
|
outputToScript(e, t) {
|
|
27312
|
-
if (!(t instanceof Ae) || !(e instanceof
|
|
27318
|
+
if (!(t instanceof Ae) || !(e instanceof Z))
|
|
27313
27319
|
throw new Error("script must be a Script, and valueBn must be a Bn");
|
|
27314
27320
|
const n = gt.fromProperties(e, t);
|
|
27315
27321
|
return this.txOuts.push(n), this;
|
|
27316
27322
|
}
|
|
27317
27323
|
buildOutputs() {
|
|
27318
|
-
let e = new
|
|
27324
|
+
let e = new Z(0);
|
|
27319
27325
|
return this.txOuts.forEach((t) => {
|
|
27320
27326
|
if (t.valueBn.lt(this.dust) && !t.script.isNonSpendable())
|
|
27321
27327
|
throw new Error("cannot create output lesser than dust");
|
|
@@ -27323,7 +27329,7 @@ class L1 extends Ce {
|
|
|
27323
27329
|
}), e;
|
|
27324
27330
|
}
|
|
27325
27331
|
buildInputs(e, t = 0) {
|
|
27326
|
-
let n = new
|
|
27332
|
+
let n = new Z(0);
|
|
27327
27333
|
for (const u of this.txIns) {
|
|
27328
27334
|
const r = this.uTxOutMap.get(u.txHashBuf, u.txOutNum);
|
|
27329
27335
|
if (n = n.add(r.valueBn), this.tx.addTxIn(u), n.geq(e)) {
|
|
@@ -27356,9 +27362,9 @@ class L1 extends Ce {
|
|
|
27356
27362
|
});
|
|
27357
27363
|
}), n = n + 1, Math.round(n);
|
|
27358
27364
|
}
|
|
27359
|
-
estimateFee(e = new
|
|
27365
|
+
estimateFee(e = new Z(0)) {
|
|
27360
27366
|
const t = Math.ceil(this.estimateSize() / 1e3 * this.feePerKbNum);
|
|
27361
|
-
return new
|
|
27367
|
+
return new Z(t).add(e);
|
|
27362
27368
|
}
|
|
27363
27369
|
/**
|
|
27364
27370
|
* Builds the transaction and adds the appropriate fee by subtracting from
|
|
@@ -27376,7 +27382,7 @@ class L1 extends Ce {
|
|
|
27376
27382
|
throw new Error("must specify change script to use build method");
|
|
27377
27383
|
for (let n = e.useAllInputs ? this.txIns.length - 1 : 0; n < this.txIns.length; n++) {
|
|
27378
27384
|
this.tx = new Me();
|
|
27379
|
-
const u = this.buildOutputs(), r = gt.fromProperties(new
|
|
27385
|
+
const u = this.buildOutputs(), r = gt.fromProperties(new Z(0), this.changeScript);
|
|
27380
27386
|
this.tx.addTxOut(r);
|
|
27381
27387
|
let s;
|
|
27382
27388
|
try {
|
|
@@ -27390,7 +27396,7 @@ class L1 extends Ce {
|
|
|
27390
27396
|
if (this.changeAmountBn.geq(t)) {
|
|
27391
27397
|
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))
|
|
27392
27398
|
if (this.dustChangeToFees)
|
|
27393
|
-
this.tx.txOuts.pop(), this.tx.txOutsVi = Fe.fromNumber(this.tx.txOutsVi.toNumber() - 1), this.feeAmountBn = this.feeAmountBn.add(this.changeAmountBn), this.changeAmountBn = new
|
|
27399
|
+
this.tx.txOuts.pop(), this.tx.txOutsVi = Fe.fromNumber(this.tx.txOutsVi.toNumber() - 1), this.feeAmountBn = this.feeAmountBn.add(this.changeAmountBn), this.changeAmountBn = new Z(0);
|
|
27394
27400
|
else
|
|
27395
27401
|
throw new Error("unable to create change amount greater than dust");
|
|
27396
27402
|
if (this.tx.nLockTime = this.nLockTime, this.tx.versionBytesNum = this.versionBytesNum, this.tx.txOuts.length === 0)
|
|
@@ -27575,7 +27581,7 @@ class zf extends Ce {
|
|
|
27575
27581
|
return this.errStr = "transaction txOuts empty", this.errStr;
|
|
27576
27582
|
if (this.tx.toBuffer().length > ss.MAX_BLOCK_SIZE)
|
|
27577
27583
|
return this.errStr = "transaction over the maximum block size", this.errStr;
|
|
27578
|
-
let e = new
|
|
27584
|
+
let e = new Z(0);
|
|
27579
27585
|
for (let n = 0; n < this.tx.txOuts.length; n++) {
|
|
27580
27586
|
const u = this.tx.txOuts[n];
|
|
27581
27587
|
if (u.valueBn.lt(0))
|
|
@@ -27875,7 +27881,7 @@ export {
|
|
|
27875
27881
|
Kf as Bip39,
|
|
27876
27882
|
ss as Block,
|
|
27877
27883
|
Pr as BlockHeader,
|
|
27878
|
-
|
|
27884
|
+
Z as Bn,
|
|
27879
27885
|
ot as Br,
|
|
27880
27886
|
yt as Bsm,
|
|
27881
27887
|
ke as Bw,
|