@gardenfi/core 0.2.0-beta.53 → 0.2.0-beta.54
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/index.cjs +8 -8
- package/dist/index.js +475 -485
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var $s = Object.defineProperty;
|
|
2
2
|
var Hs = (e, t, r) => t in e ? $s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var pt = (e, t, r) => Hs(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Ok as fe, Err as
|
|
5
|
-
import { EthereumLocalnet as zs, ArbitrumLocalnet as Gs, Orderbook as js, isMainnet as rr, isBitcoin as nr, getBlockchainType as
|
|
6
|
-
import { Url as pn, fetchEVMBlockNumber as Zr, with0x as fr, checkAllowanceAndApprove as Ws, Authorization as Cn, sleep as qs, fetchBitcoinBlockNumber as
|
|
7
|
-
import { createWalletClient as
|
|
4
|
+
import { Ok as fe, Err as M, Fetcher as mt, trim0x as nt } from "@catalogfi/utils";
|
|
5
|
+
import { EthereumLocalnet as zs, ArbitrumLocalnet as Gs, Orderbook as js, isMainnet as rr, isBitcoin as nr, getBlockchainType as Lt, BlockchainType as ke } from "@gardenfi/orderbook";
|
|
6
|
+
import { Url as pn, fetchEVMBlockNumber as Zr, with0x as fr, checkAllowanceAndApprove as Ws, Authorization as Cn, sleep as qs, fetchBitcoinBlockNumber as Ln } from "@gardenfi/utils";
|
|
7
|
+
import { createWalletClient as kn, custom as Fn, getContract as Vs, sha256 as ir } from "viem";
|
|
8
8
|
import * as Un from "varuint-bitcoin";
|
|
9
9
|
import * as xt from "tiny-secp256k1";
|
|
10
10
|
import { Urgency as On } from "@catalogfi/wallets";
|
|
@@ -21,7 +21,7 @@ function qt(e) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
const Ii = "2.21.30";
|
|
24
|
-
let
|
|
24
|
+
let kt = {
|
|
25
25
|
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: r }) => t ? `${e ?? "https://viem.sh"}${t}${r ? `#${r}` : ""}` : void 0,
|
|
26
26
|
version: `viem@${Ii}`
|
|
27
27
|
};
|
|
@@ -31,13 +31,13 @@ class X extends Error {
|
|
|
31
31
|
const n = (() => {
|
|
32
32
|
var l;
|
|
33
33
|
return r.cause instanceof X ? r.cause.details : (l = r.cause) != null && l.message ? r.cause.message : r.details;
|
|
34
|
-
})(), i = r.cause instanceof X && r.cause.docsPath || r.docsPath, a = (u =
|
|
34
|
+
})(), i = r.cause instanceof X && r.cause.docsPath || r.docsPath, a = (u = kt.getDocsUrl) == null ? void 0 : u.call(kt, { ...r, docsPath: i }), f = [
|
|
35
35
|
t || "An error occurred.",
|
|
36
36
|
"",
|
|
37
37
|
...r.metaMessages ? [...r.metaMessages, ""] : [],
|
|
38
38
|
...a ? [`Docs: ${a}`] : [],
|
|
39
39
|
...n ? [`Details: ${n}`] : [],
|
|
40
|
-
...
|
|
40
|
+
...kt.version ? [`Version: ${kt.version}`] : []
|
|
41
41
|
].join(`
|
|
42
42
|
`);
|
|
43
43
|
super(f, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -188,7 +188,7 @@ function oo(e, t = {}) {
|
|
|
188
188
|
const r = new Uint8Array(1);
|
|
189
189
|
return r[0] = Number(e), typeof t.size == "number" ? (At(r, { size: t.size }), It(r, { size: t.size })) : r;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const Ne = {
|
|
192
192
|
zero: 48,
|
|
193
193
|
nine: 57,
|
|
194
194
|
A: 65,
|
|
@@ -196,13 +196,13 @@ const Me = {
|
|
|
196
196
|
a: 97,
|
|
197
197
|
f: 102
|
|
198
198
|
};
|
|
199
|
-
function
|
|
200
|
-
if (e >=
|
|
201
|
-
return e -
|
|
202
|
-
if (e >=
|
|
203
|
-
return e - (
|
|
204
|
-
if (e >=
|
|
205
|
-
return e - (
|
|
199
|
+
function Mn(e) {
|
|
200
|
+
if (e >= Ne.zero && e <= Ne.nine)
|
|
201
|
+
return e - Ne.zero;
|
|
202
|
+
if (e >= Ne.A && e <= Ne.F)
|
|
203
|
+
return e - (Ne.A - 10);
|
|
204
|
+
if (e >= Ne.a && e <= Ne.f)
|
|
205
|
+
return e - (Ne.a - 10);
|
|
206
206
|
}
|
|
207
207
|
function st(e, t = {}) {
|
|
208
208
|
let r = e;
|
|
@@ -211,7 +211,7 @@ function st(e, t = {}) {
|
|
|
211
211
|
n.length % 2 && (n = `0${n}`);
|
|
212
212
|
const i = n.length / 2, a = new Uint8Array(i);
|
|
213
213
|
for (let f = 0, u = 0; f < i; f++) {
|
|
214
|
-
const l =
|
|
214
|
+
const l = Mn(n.charCodeAt(u++)), y = Mn(n.charCodeAt(u++));
|
|
215
215
|
if (l === void 0 || y === void 0)
|
|
216
216
|
throw new X(`Invalid byte sequence ("${n[u - 2]}${n[u - 1]}" in "${n}").`);
|
|
217
217
|
a[f] = l * 16 + y;
|
|
@@ -261,7 +261,7 @@ function bn(e, t) {
|
|
|
261
261
|
type: e
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const Li = {
|
|
265
265
|
"0x0": "legacy",
|
|
266
266
|
"0x1": "eip2930",
|
|
267
267
|
"0x2": "eip1559",
|
|
@@ -282,7 +282,7 @@ function yn(e) {
|
|
|
282
282
|
nonce: e.nonce ? hr(e.nonce) : void 0,
|
|
283
283
|
to: e.to ? e.to : null,
|
|
284
284
|
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
285
|
-
type: e.type ?
|
|
285
|
+
type: e.type ? Li[e.type] : void 0,
|
|
286
286
|
typeHex: e.type ? e.type : void 0,
|
|
287
287
|
value: e.value ? BigInt(e.value) : void 0,
|
|
288
288
|
v: e.v ? BigInt(e.v) : void 0
|
|
@@ -360,7 +360,7 @@ function bo(e) {
|
|
|
360
360
|
to: e.to ? e.to : null,
|
|
361
361
|
transactionIndex: e.transactionIndex ? hr(e.transactionIndex) : null,
|
|
362
362
|
status: e.status ? po[e.status] : null,
|
|
363
|
-
type: e.type ?
|
|
363
|
+
type: e.type ? Li[e.type] || e.type : null
|
|
364
364
|
};
|
|
365
365
|
return e.blobGasPrice && (t.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (t.blobGasUsed = BigInt(e.blobGasUsed)), t;
|
|
366
366
|
}
|
|
@@ -368,7 +368,7 @@ const yo = /* @__PURE__ */ bn("transactionReceipt", bo), gn = 2n ** 256n - 1n;
|
|
|
368
368
|
function Kt(e) {
|
|
369
369
|
return `0x${e.reduce((t, r) => t + r.replace("0x", ""), "")}`;
|
|
370
370
|
}
|
|
371
|
-
class
|
|
371
|
+
class Nn extends X {
|
|
372
372
|
constructor({ offset: t }) {
|
|
373
373
|
super(`Offset \`${t}\` cannot be negative.`, {
|
|
374
374
|
name: "NegativeOffsetError"
|
|
@@ -408,7 +408,7 @@ const wo = {
|
|
|
408
408
|
},
|
|
409
409
|
decrementPosition(e) {
|
|
410
410
|
if (e < 0)
|
|
411
|
-
throw new
|
|
411
|
+
throw new Nn({ offset: e });
|
|
412
412
|
const t = this.position - e;
|
|
413
413
|
this.assertPosition(t), this.position = t;
|
|
414
414
|
},
|
|
@@ -417,7 +417,7 @@ const wo = {
|
|
|
417
417
|
},
|
|
418
418
|
incrementPosition(e) {
|
|
419
419
|
if (e < 0)
|
|
420
|
-
throw new
|
|
420
|
+
throw new Nn({ offset: e });
|
|
421
421
|
const t = this.position + e;
|
|
422
422
|
this.assertPosition(t), this.position = t;
|
|
423
423
|
},
|
|
@@ -507,12 +507,12 @@ const wo = {
|
|
|
507
507
|
this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
|
|
508
508
|
}
|
|
509
509
|
};
|
|
510
|
-
function
|
|
510
|
+
function ki(e, { recursiveReadLimit: t = 8192 } = {}) {
|
|
511
511
|
const r = Object.create(wo);
|
|
512
512
|
return r.bytes = e, r.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), r.positionReadCount = /* @__PURE__ */ new Map(), r.recursiveReadLimit = t, r;
|
|
513
513
|
}
|
|
514
514
|
function ot(e, t = "hex") {
|
|
515
|
-
const r = Fi(e), n =
|
|
515
|
+
const r = Fi(e), n = ki(new Uint8Array(r.length));
|
|
516
516
|
return r.encode(n), t === "hex" ? Qe(n.bytes) : n.bytes;
|
|
517
517
|
}
|
|
518
518
|
function Fi(e) {
|
|
@@ -610,7 +610,7 @@ function Oi(e) {
|
|
|
610
610
|
i.push(Uint8Array.from(t.blobToKzgCommitment(a)));
|
|
611
611
|
return r === "bytes" ? i : i.map((a) => Qe(a));
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Mi(e) {
|
|
614
614
|
const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((f) => st(f)) : e.blobs, i = typeof e.commitments[0] == "string" ? e.commitments.map((f) => st(f)) : e.commitments, a = [];
|
|
615
615
|
for (let f = 0; f < n.length; f++) {
|
|
616
616
|
const u = n[f], l = i[f];
|
|
@@ -637,7 +637,7 @@ function dr(e, t = !0) {
|
|
|
637
637
|
if (t && e.finished)
|
|
638
638
|
throw new Error("Hash#digest() has already been called");
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function Ni(e, t) {
|
|
641
641
|
mn(e);
|
|
642
642
|
const r = t.outputLen;
|
|
643
643
|
if (e.length < r)
|
|
@@ -667,13 +667,13 @@ function $i(e) {
|
|
|
667
667
|
const t = (n) => e().update(wn(n)).digest(), r = e();
|
|
668
668
|
return t.outputLen = r.outputLen, t.blockLen = r.blockLen, t.create = () => e(), t;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function Lo(e, t, r, n) {
|
|
671
671
|
if (typeof e.setBigUint64 == "function")
|
|
672
672
|
return e.setBigUint64(t, r, n);
|
|
673
673
|
const i = BigInt(32), a = BigInt(4294967295), f = Number(r >> i & a), u = Number(r & a), l = n ? 4 : 0, y = n ? 0 : 4;
|
|
674
674
|
e.setUint32(t + l, f, n), e.setUint32(t + y, u, n);
|
|
675
675
|
}
|
|
676
|
-
const
|
|
676
|
+
const ko = (e, t, r) => e & t ^ ~e & r, Fo = (e, t, r) => e & t ^ e & r ^ t & r;
|
|
677
677
|
class Uo extends Di {
|
|
678
678
|
constructor(t, r, n, i) {
|
|
679
679
|
super(), this.blockLen = t, this.outputLen = r, this.padOffset = n, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = Fr(this.buffer);
|
|
@@ -696,21 +696,21 @@ class Uo extends Di {
|
|
|
696
696
|
return this.length += t.length, this.roundClean(), this;
|
|
697
697
|
}
|
|
698
698
|
digestInto(t) {
|
|
699
|
-
dr(this),
|
|
699
|
+
dr(this), Ni(t, this), this.finished = !0;
|
|
700
700
|
const { buffer: r, view: n, blockLen: i, isLE: a } = this;
|
|
701
701
|
let { pos: f } = this;
|
|
702
702
|
r[f++] = 128, this.buffer.subarray(f).fill(0), this.padOffset > i - f && (this.process(n, 0), f = 0);
|
|
703
|
-
for (let
|
|
704
|
-
r[
|
|
705
|
-
|
|
703
|
+
for (let w = f; w < i; w++)
|
|
704
|
+
r[w] = 0;
|
|
705
|
+
Lo(n, i - 8, BigInt(this.length * 8), a), this.process(n, 0);
|
|
706
706
|
const u = Fr(t), l = this.outputLen;
|
|
707
707
|
if (l % 4)
|
|
708
708
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
709
709
|
const y = l / 4, g = this.get();
|
|
710
710
|
if (y > g.length)
|
|
711
711
|
throw new Error("_sha2: outputLen bigger than state");
|
|
712
|
-
for (let
|
|
713
|
-
u.setUint32(4 *
|
|
712
|
+
for (let w = 0; w < y; w++)
|
|
713
|
+
u.setUint32(4 * w, g[w], a);
|
|
714
714
|
}
|
|
715
715
|
digest() {
|
|
716
716
|
const { buffer: t, outputLen: r } = this;
|
|
@@ -799,7 +799,7 @@ const Oo = /* @__PURE__ */ new Uint32Array([
|
|
|
799
799
|
528734635,
|
|
800
800
|
1541459225
|
|
801
801
|
]), Ye = /* @__PURE__ */ new Uint32Array(64);
|
|
802
|
-
class
|
|
802
|
+
class Mo extends Uo {
|
|
803
803
|
constructor() {
|
|
804
804
|
super(64, 32, 8, !1), this.A = Ke[0] | 0, this.B = Ke[1] | 0, this.C = Ke[2] | 0, this.D = Ke[3] | 0, this.E = Ke[4] | 0, this.F = Ke[5] | 0, this.G = Ke[6] | 0, this.H = Ke[7] | 0;
|
|
805
805
|
}
|
|
@@ -812,15 +812,15 @@ class No extends Uo {
|
|
|
812
812
|
this.A = t | 0, this.B = r | 0, this.C = n | 0, this.D = i | 0, this.E = a | 0, this.F = f | 0, this.G = u | 0, this.H = l | 0;
|
|
813
813
|
}
|
|
814
814
|
process(t, r) {
|
|
815
|
-
for (let
|
|
816
|
-
Ye[
|
|
817
|
-
for (let
|
|
818
|
-
const E = Ye[
|
|
819
|
-
Ye[
|
|
815
|
+
for (let w = 0; w < 16; w++, r += 4)
|
|
816
|
+
Ye[w] = t.getUint32(r, !1);
|
|
817
|
+
for (let w = 16; w < 64; w++) {
|
|
818
|
+
const E = Ye[w - 15], I = Ye[w - 2], v = Fe(E, 7) ^ Fe(E, 18) ^ E >>> 3, P = Fe(I, 17) ^ Fe(I, 19) ^ I >>> 10;
|
|
819
|
+
Ye[w] = P + Ye[w - 7] + v + Ye[w - 16] | 0;
|
|
820
820
|
}
|
|
821
821
|
let { A: n, B: i, C: a, D: f, E: u, F: l, G: y, H: g } = this;
|
|
822
|
-
for (let
|
|
823
|
-
const E = Fe(u, 6) ^ Fe(u, 11) ^ Fe(u, 25), I = g + E +
|
|
822
|
+
for (let w = 0; w < 64; w++) {
|
|
823
|
+
const E = Fe(u, 6) ^ Fe(u, 11) ^ Fe(u, 25), I = g + E + ko(u, l, y) + Oo[w] + Ye[w] | 0, P = (Fe(n, 2) ^ Fe(n, 13) ^ Fe(n, 22)) + Fo(n, i, a) | 0;
|
|
824
824
|
g = y, y = l, l = u, u = f + I | 0, f = a, a = i, i = n, n = I + P | 0;
|
|
825
825
|
}
|
|
826
826
|
n = n + this.A | 0, i = i + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, u = u + this.E | 0, l = l + this.F | 0, y = y + this.G | 0, g = g + this.H | 0, this.set(n, i, a, f, u, l, y, g);
|
|
@@ -832,9 +832,9 @@ class No extends Uo {
|
|
|
832
832
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
const
|
|
835
|
+
const No = /* @__PURE__ */ $i(() => new Mo());
|
|
836
836
|
function Do(e, t) {
|
|
837
|
-
return
|
|
837
|
+
return No(Vt(e, { strict: !1 }) ? Pi(e) : e);
|
|
838
838
|
}
|
|
839
839
|
function $o(e) {
|
|
840
840
|
const { commitment: t, version: r = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = Do(t);
|
|
@@ -897,7 +897,7 @@ function Wo(e) {
|
|
|
897
897
|
const i = [];
|
|
898
898
|
let a = !0, f = 0;
|
|
899
899
|
for (; a; ) {
|
|
900
|
-
const u =
|
|
900
|
+
const u = ki(new Uint8Array(zi));
|
|
901
901
|
let l = 0;
|
|
902
902
|
for (; l < _n; ) {
|
|
903
903
|
const y = r.slice(f, f + (Hi - 1));
|
|
@@ -912,7 +912,7 @@ function Wo(e) {
|
|
|
912
912
|
return t === "bytes" ? i.map((u) => u.bytes) : i.map((u) => Qe(u.bytes));
|
|
913
913
|
}
|
|
914
914
|
function qo(e) {
|
|
915
|
-
const { data: t, kzg: r, to: n } = e, i = e.blobs ?? Wo({ data: t, to: n }), a = e.commitments ?? Oi({ blobs: i, kzg: r, to: n }), f = e.proofs ??
|
|
915
|
+
const { data: t, kzg: r, to: n } = e, i = e.blobs ?? Wo({ data: t, to: n }), a = e.commitments ?? Oi({ blobs: i, kzg: r, to: n }), f = e.proofs ?? Mi({ blobs: i, commitments: a, kzg: r, to: n }), u = [];
|
|
916
916
|
for (let l = 0; l < i.length; l++)
|
|
917
917
|
u.push({
|
|
918
918
|
blob: i[l],
|
|
@@ -1031,9 +1031,9 @@ function aa(e, t = 24) {
|
|
|
1031
1031
|
for (let f = 0; f < 10; f++)
|
|
1032
1032
|
r[f] = e[f] ^ e[f + 10] ^ e[f + 20] ^ e[f + 30] ^ e[f + 40];
|
|
1033
1033
|
for (let f = 0; f < 10; f += 2) {
|
|
1034
|
-
const u = (f + 8) % 10, l = (f + 2) % 10, y = r[l], g = r[l + 1],
|
|
1034
|
+
const u = (f + 8) % 10, l = (f + 2) % 10, y = r[l], g = r[l + 1], w = Wn(y, g, 1) ^ r[u], E = qn(y, g, 1) ^ r[u + 1];
|
|
1035
1035
|
for (let I = 0; I < 50; I += 10)
|
|
1036
|
-
e[f + I] ^=
|
|
1036
|
+
e[f + I] ^= w, e[f + I + 1] ^= E;
|
|
1037
1037
|
}
|
|
1038
1038
|
let i = e[2], a = e[3];
|
|
1039
1039
|
for (let f = 0; f < 24; f++) {
|
|
@@ -1099,7 +1099,7 @@ class xn extends Di {
|
|
|
1099
1099
|
return Dn(t), this.xofInto(new Uint8Array(t));
|
|
1100
1100
|
}
|
|
1101
1101
|
digestInto(t) {
|
|
1102
|
-
if (
|
|
1102
|
+
if (Ni(t, this), this.finished)
|
|
1103
1103
|
throw new Error("digest() was already called");
|
|
1104
1104
|
return this.writeInto(t), this.destroy(), t;
|
|
1105
1105
|
}
|
|
@@ -1255,7 +1255,7 @@ function xa(e, t) {
|
|
|
1255
1255
|
return r === "eip1559" ? Ba(e, t) : r === "eip2930" ? Sa(e, t) : r === "eip4844" ? Ea(e, t) : r === "eip7702" ? va(e, t) : Ia(e, t);
|
|
1256
1256
|
}
|
|
1257
1257
|
function va(e, t) {
|
|
1258
|
-
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: y, accessList: g, data:
|
|
1258
|
+
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: y, accessList: g, data: w } = e;
|
|
1259
1259
|
ya(e);
|
|
1260
1260
|
const E = xr(g), I = Vo(r);
|
|
1261
1261
|
return Kt([
|
|
@@ -1268,7 +1268,7 @@ function va(e, t) {
|
|
|
1268
1268
|
i ? W(i) : "0x",
|
|
1269
1269
|
f ?? "0x",
|
|
1270
1270
|
u ? W(u) : "0x",
|
|
1271
|
-
|
|
1271
|
+
w ?? "0x",
|
|
1272
1272
|
E,
|
|
1273
1273
|
I,
|
|
1274
1274
|
...Yt(e, t)
|
|
@@ -1276,19 +1276,19 @@ function va(e, t) {
|
|
|
1276
1276
|
]);
|
|
1277
1277
|
}
|
|
1278
1278
|
function Ea(e, t) {
|
|
1279
|
-
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas: y, accessList: g, data:
|
|
1279
|
+
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas: y, accessList: g, data: w } = e;
|
|
1280
1280
|
ga(e);
|
|
1281
1281
|
let E = e.blobVersionedHashes, I = e.sidecars;
|
|
1282
1282
|
if (e.blobs && (typeof E > "u" || typeof I > "u")) {
|
|
1283
|
-
const
|
|
1284
|
-
blobs:
|
|
1285
|
-
kzg:
|
|
1283
|
+
const k = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((S) => Qe(S)), L = e.kzg, U = Oi({
|
|
1284
|
+
blobs: k,
|
|
1285
|
+
kzg: L
|
|
1286
1286
|
});
|
|
1287
1287
|
if (typeof E > "u" && (E = Ho({
|
|
1288
1288
|
commitments: U
|
|
1289
1289
|
})), typeof I > "u") {
|
|
1290
|
-
const S =
|
|
1291
|
-
I = qo({ blobs:
|
|
1290
|
+
const S = Mi({ blobs: k, commitments: U, kzg: L });
|
|
1291
|
+
I = qo({ blobs: k, commitments: U, proofs: S });
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
const v = xr(g), P = [
|
|
@@ -1299,16 +1299,16 @@ function Ea(e, t) {
|
|
|
1299
1299
|
n ? W(n) : "0x",
|
|
1300
1300
|
a ?? "0x",
|
|
1301
1301
|
f ? W(f) : "0x",
|
|
1302
|
-
|
|
1302
|
+
w ?? "0x",
|
|
1303
1303
|
v,
|
|
1304
1304
|
u ? W(u) : "0x",
|
|
1305
1305
|
E ?? [],
|
|
1306
1306
|
...Yt(e, t)
|
|
1307
1307
|
], T = [], C = [], F = [];
|
|
1308
1308
|
if (I)
|
|
1309
|
-
for (let
|
|
1310
|
-
const { blob:
|
|
1311
|
-
T.push(
|
|
1309
|
+
for (let k = 0; k < I.length; k++) {
|
|
1310
|
+
const { blob: L, commitment: U, proof: S } = I[k];
|
|
1311
|
+
T.push(L), C.push(U), F.push(S);
|
|
1312
1312
|
}
|
|
1313
1313
|
return Kt([
|
|
1314
1314
|
"0x03",
|
|
@@ -1319,7 +1319,7 @@ function Ea(e, t) {
|
|
|
1319
1319
|
function Ba(e, t) {
|
|
1320
1320
|
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerGas: u, maxPriorityFeePerGas: l, accessList: y, data: g } = e;
|
|
1321
1321
|
vn(e);
|
|
1322
|
-
const
|
|
1322
|
+
const w = xr(y), E = [
|
|
1323
1323
|
W(r),
|
|
1324
1324
|
i ? W(i) : "0x",
|
|
1325
1325
|
l ? W(l) : "0x",
|
|
@@ -1328,7 +1328,7 @@ function Ba(e, t) {
|
|
|
1328
1328
|
a ?? "0x",
|
|
1329
1329
|
f ? W(f) : "0x",
|
|
1330
1330
|
g ?? "0x",
|
|
1331
|
-
|
|
1331
|
+
w,
|
|
1332
1332
|
...Yt(e, t)
|
|
1333
1333
|
];
|
|
1334
1334
|
return Kt([
|
|
@@ -1339,7 +1339,7 @@ function Ba(e, t) {
|
|
|
1339
1339
|
function Sa(e, t) {
|
|
1340
1340
|
const { chainId: r, gas: n, data: i, nonce: a, to: f, value: u, accessList: l, gasPrice: y } = e;
|
|
1341
1341
|
ma(e);
|
|
1342
|
-
const g = xr(l),
|
|
1342
|
+
const g = xr(l), w = [
|
|
1343
1343
|
W(r),
|
|
1344
1344
|
a ? W(a) : "0x",
|
|
1345
1345
|
y ? W(y) : "0x",
|
|
@@ -1352,7 +1352,7 @@ function Sa(e, t) {
|
|
|
1352
1352
|
];
|
|
1353
1353
|
return Kt([
|
|
1354
1354
|
"0x01",
|
|
1355
|
-
ot(
|
|
1355
|
+
ot(w)
|
|
1356
1356
|
]);
|
|
1357
1357
|
}
|
|
1358
1358
|
function Ia(e, t) {
|
|
@@ -1376,11 +1376,11 @@ function Ia(e, t) {
|
|
|
1376
1376
|
if (t.v !== I)
|
|
1377
1377
|
throw new So({ v: t.v });
|
|
1378
1378
|
return I;
|
|
1379
|
-
})(),
|
|
1379
|
+
})(), w = lr(t.r), E = lr(t.s);
|
|
1380
1380
|
y = [
|
|
1381
1381
|
...y,
|
|
1382
1382
|
W(g),
|
|
1383
|
-
|
|
1383
|
+
w === "0x00" ? "0x" : w,
|
|
1384
1384
|
E === "0x00" ? "0x" : E
|
|
1385
1385
|
];
|
|
1386
1386
|
} else r > 0 && (y = [
|
|
@@ -1446,13 +1446,13 @@ const Aa = {
|
|
|
1446
1446
|
})
|
|
1447
1447
|
};
|
|
1448
1448
|
function Ta(e, t) {
|
|
1449
|
-
return
|
|
1449
|
+
return La(e) ? Ca(e) : xa(e, t);
|
|
1450
1450
|
}
|
|
1451
1451
|
const Pa = {
|
|
1452
1452
|
transaction: Ta
|
|
1453
1453
|
};
|
|
1454
1454
|
function Ca(e) {
|
|
1455
|
-
|
|
1455
|
+
ka(e);
|
|
1456
1456
|
const { sourceHash: t, data: r, from: n, gas: i, isSystemTx: a, mint: f, to: u, value: l } = e, y = [
|
|
1457
1457
|
t,
|
|
1458
1458
|
n,
|
|
@@ -1468,10 +1468,10 @@ function Ca(e) {
|
|
|
1468
1468
|
ot(y)
|
|
1469
1469
|
]);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function La(e) {
|
|
1472
1472
|
return e.type === "deposit" || typeof e.sourceHash < "u";
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function ka(e) {
|
|
1475
1475
|
const { from: t, to: r } = e;
|
|
1476
1476
|
if (t && !ft(t))
|
|
1477
1477
|
throw new at({ address: t });
|
|
@@ -1580,7 +1580,7 @@ const Vn = {
|
|
|
1580
1580
|
},
|
|
1581
1581
|
testnet: !0,
|
|
1582
1582
|
sourceId: Ut
|
|
1583
|
-
}),
|
|
1583
|
+
}), Ma = /* @__PURE__ */ qt({
|
|
1584
1584
|
id: 1,
|
|
1585
1585
|
name: "Ethereum",
|
|
1586
1586
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1609,7 +1609,7 @@ const Vn = {
|
|
|
1609
1609
|
blockCreated: 14353601
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
1612
|
-
}),
|
|
1612
|
+
}), Na = /* @__PURE__ */ qt({
|
|
1613
1613
|
id: 11155111,
|
|
1614
1614
|
name: "Sepolia",
|
|
1615
1615
|
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1670,14 +1670,14 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1670
1670
|
return !1;
|
|
1671
1671
|
}
|
|
1672
1672
|
}, Ga = {
|
|
1673
|
-
ethereum:
|
|
1673
|
+
ethereum: Ma,
|
|
1674
1674
|
ethereum_arbitrum: Fa,
|
|
1675
|
-
ethereum_sepolia:
|
|
1675
|
+
ethereum_sepolia: Na,
|
|
1676
1676
|
arbitrum_sepolia: Ua,
|
|
1677
1677
|
ethereum_localnet: zs,
|
|
1678
1678
|
arbitrum_localnet: Gs,
|
|
1679
1679
|
base_sepolia: Oa
|
|
1680
|
-
},
|
|
1680
|
+
}, c0 = async (e, t) => {
|
|
1681
1681
|
var n;
|
|
1682
1682
|
const r = Ga[e];
|
|
1683
1683
|
if (r)
|
|
@@ -1685,7 +1685,7 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1685
1685
|
if (r.id === ((n = t.chain) == null ? void 0 : n.id))
|
|
1686
1686
|
return fe({ message: "Already on the network", walletClient: t });
|
|
1687
1687
|
await t.switchChain({ id: r.id });
|
|
1688
|
-
const i =
|
|
1688
|
+
const i = kn({
|
|
1689
1689
|
account: t.account,
|
|
1690
1690
|
chain: r,
|
|
1691
1691
|
transport: Fn(window.ethereum)
|
|
@@ -1698,7 +1698,7 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1698
1698
|
if (ja(i))
|
|
1699
1699
|
try {
|
|
1700
1700
|
await t.addChain({ chain: r });
|
|
1701
|
-
const a =
|
|
1701
|
+
const a = kn({
|
|
1702
1702
|
account: t.account,
|
|
1703
1703
|
chain: r,
|
|
1704
1704
|
transport: Fn(window.ethereum)
|
|
@@ -1708,13 +1708,13 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1708
1708
|
walletClient: a
|
|
1709
1709
|
});
|
|
1710
1710
|
} catch {
|
|
1711
|
-
return
|
|
1711
|
+
return M("Failed to add network");
|
|
1712
1712
|
}
|
|
1713
1713
|
else
|
|
1714
|
-
return
|
|
1714
|
+
return M("Failed to switch network");
|
|
1715
1715
|
}
|
|
1716
1716
|
else
|
|
1717
|
-
return
|
|
1717
|
+
return M("Chain not supported");
|
|
1718
1718
|
}, ja = (e) => typeof e == "object" && e !== null && "code" in e && e.code === 4902, Wa = (e, t, r, n) => e + ":" + t.toLowerCase() + "::" + r + ":" + n.toLowerCase();
|
|
1719
1719
|
var ie = /* @__PURE__ */ ((e) => (e.Created = "Created", e.Matched = "Matched", e.InitiateDetected = "InitiateDetected", e.Initiated = "Initiated", e.CounterPartyInitiateDetected = "CounterPartyInitiateDetected", e.CounterPartyInitiated = "CounterPartyInitiated", e.RedeemDetected = "RedeemDetected", e.Redeemed = "Redeemed", e.CounterPartyRedeemDetected = "CounterPartyRedeemDetected", e.CounterPartyRedeemed = "CounterPartyRedeemed", e.Completed = "Completed", e.CounterPartySwapExpired = "CounterPartySwapExpired", e.Expired = "Expired", e.RefundDetected = "RefundDetected", e.Refunded = "Refunded", e.CounterPartyRefundDetected = "CounterPartyRefundDetected", e.CounterPartyRefunded = "CounterPartyRefunded", e.Cancelled = "Cancelled", e.DeadLineExceeded = "DeadLineExceeded", e))(ie || {}), te = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.InitiateDetected = "InitiateDetected", e.Initiated = "Initiated", e.RedeemDetected = "RedeemDetected", e.Redeemed = "Redeemed", e.RefundDetected = "RefundDetected", e.Refunded = "Refunded", e.Expired = "Expired", e))(te || {});
|
|
1720
1720
|
const qa = (e, t, r) => {
|
|
@@ -2173,37 +2173,37 @@ class Ya {
|
|
|
2173
2173
|
this.url = new pn("/relayer", r), this.auth = n, this.order = t;
|
|
2174
2174
|
}
|
|
2175
2175
|
async init(t, r) {
|
|
2176
|
-
if (!t.account) return
|
|
2176
|
+
if (!t.account) return M("No account found");
|
|
2177
2177
|
if (t.account.address.toLowerCase() !== this.order.source_swap.initiator.toLowerCase())
|
|
2178
|
-
return
|
|
2178
|
+
return M("Account address and order initiator mismatch");
|
|
2179
2179
|
if (!r) {
|
|
2180
2180
|
const g = await Zr(t);
|
|
2181
|
-
if (g.error) return
|
|
2181
|
+
if (g.error) return M(g.error);
|
|
2182
2182
|
r = g.val;
|
|
2183
2183
|
}
|
|
2184
2184
|
if (nn(
|
|
2185
2185
|
this.order.source_swap,
|
|
2186
2186
|
r
|
|
2187
|
-
) !== te.Idle) return
|
|
2187
|
+
) !== te.Idle) return M("Invalid swap status");
|
|
2188
2188
|
const { create_order: i, source_swap: a } = this.order;
|
|
2189
2189
|
if (!a.amount || !a.redeemer || !i.timelock || !i.secret_hash)
|
|
2190
|
-
return
|
|
2190
|
+
return M("Invalid order");
|
|
2191
2191
|
const f = fr(i.secret_hash), u = BigInt(i.timelock), l = fr(a.redeemer), y = BigInt(a.amount);
|
|
2192
2192
|
try {
|
|
2193
2193
|
const g = await this.auth.getToken();
|
|
2194
|
-
if (g.error) return
|
|
2195
|
-
const
|
|
2194
|
+
if (g.error) return M(g.error);
|
|
2195
|
+
const w = Vs({
|
|
2196
2196
|
address: fr(this.order.source_swap.asset),
|
|
2197
2197
|
abi: Ka,
|
|
2198
2198
|
client: t
|
|
2199
|
-
}), E = await
|
|
2199
|
+
}), E = await w.read.token(), I = await Ws(
|
|
2200
2200
|
Number(y),
|
|
2201
2201
|
E,
|
|
2202
2202
|
this.order.source_swap.asset,
|
|
2203
2203
|
t
|
|
2204
2204
|
);
|
|
2205
|
-
if (I.error) return
|
|
2206
|
-
const v = await
|
|
2205
|
+
if (I.error) return M(I.error);
|
|
2206
|
+
const v = await w.read.eip712Domain(), P = await t.signTypedData({
|
|
2207
2207
|
account: t.account,
|
|
2208
2208
|
domain: {
|
|
2209
2209
|
name: v[1],
|
|
@@ -2240,15 +2240,15 @@ class Ya {
|
|
|
2240
2240
|
}
|
|
2241
2241
|
}
|
|
2242
2242
|
);
|
|
2243
|
-
return T.error ?
|
|
2243
|
+
return T.error ? M(T.error) : T.result ? fe(T.result) : M("Init: No result found");
|
|
2244
2244
|
} catch (g) {
|
|
2245
|
-
return console.log("init error :", g),
|
|
2245
|
+
return console.log("init error :", g), M(String(g));
|
|
2246
2246
|
}
|
|
2247
2247
|
}
|
|
2248
2248
|
async redeem(t, r) {
|
|
2249
2249
|
try {
|
|
2250
2250
|
const n = await this.auth.getToken();
|
|
2251
|
-
if (n.error) return
|
|
2251
|
+
if (n.error) return M(n.error);
|
|
2252
2252
|
const i = await mt.post(
|
|
2253
2253
|
this.url.endpoint("redeem"),
|
|
2254
2254
|
{
|
|
@@ -2263,9 +2263,9 @@ class Ya {
|
|
|
2263
2263
|
}
|
|
2264
2264
|
}
|
|
2265
2265
|
);
|
|
2266
|
-
return i.error ?
|
|
2266
|
+
return i.error ? M(i.error) : i.result ? fe(i.result) : M("Redeem: No result found");
|
|
2267
2267
|
} catch (n) {
|
|
2268
|
-
return
|
|
2268
|
+
return M(String(n));
|
|
2269
2269
|
}
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
@@ -2375,11 +2375,11 @@ class pr {
|
|
|
2375
2375
|
for (const l of this.utxoHashes) {
|
|
2376
2376
|
const y = await a.getTransaction(l);
|
|
2377
2377
|
for (let g = 0; g < y.vout.length; g++) {
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2378
|
+
const w = y.vout[g];
|
|
2379
|
+
w.scriptpubkey_address === i && f.push({
|
|
2380
2380
|
txid: y.txid,
|
|
2381
2381
|
vout: g,
|
|
2382
|
-
value:
|
|
2382
|
+
value: w.value,
|
|
2383
2383
|
status: { confirmed: !1 }
|
|
2384
2384
|
});
|
|
2385
2385
|
}
|
|
@@ -2423,16 +2423,16 @@ class pr {
|
|
|
2423
2423
|
async instantRefund(t, r) {
|
|
2424
2424
|
bt(t.length > 0, me.noCounterpartySigs);
|
|
2425
2425
|
const { tx: n, usedUtxos: i } = await this.buildRawTx(r);
|
|
2426
|
-
for (const
|
|
2427
|
-
if (!t.find((E) => E.utxo ===
|
|
2428
|
-
throw new Error(me.counterPartySigNotFound(
|
|
2426
|
+
for (const w of i)
|
|
2427
|
+
if (!t.find((E) => E.utxo === w.txid))
|
|
2428
|
+
throw new Error(me.counterPartySigNotFound(w.txid));
|
|
2429
2429
|
const a = this.getOutputScript(), f = be.Transaction.SIGHASH_DEFAULT, u = this.leafHash(
|
|
2430
2430
|
2
|
|
2431
2431
|
/* INSTANT_REFUND */
|
|
2432
|
-
), l = i.map((
|
|
2433
|
-
for (let
|
|
2432
|
+
), l = i.map((w) => w.value), y = Mr(a, i.length);
|
|
2433
|
+
for (let w = 0; w < n.ins.length; w++) {
|
|
2434
2434
|
const E = n.hashForWitnessV1(
|
|
2435
|
-
|
|
2435
|
+
w,
|
|
2436
2436
|
y,
|
|
2437
2437
|
l,
|
|
2438
2438
|
f,
|
|
@@ -2441,15 +2441,15 @@ class pr {
|
|
|
2441
2441
|
if (!xt.verifySchnorr(
|
|
2442
2442
|
E,
|
|
2443
2443
|
Buffer.from(this.redeemerPubkey, "hex"),
|
|
2444
|
-
Buffer.from(t[
|
|
2444
|
+
Buffer.from(t[w].sig, "hex")
|
|
2445
2445
|
))
|
|
2446
2446
|
throw new Error(
|
|
2447
|
-
me.invalidCounterpartySigForUTXO(t[
|
|
2447
|
+
me.invalidCounterpartySigForUTXO(t[w].utxo)
|
|
2448
2448
|
);
|
|
2449
|
-
const I = await this.signer.signSchnorr(E), v = Buffer.from(n.ins[
|
|
2449
|
+
const I = await this.signer.signSchnorr(E), v = Buffer.from(n.ins[w].hash).reverse().toString("hex"), P = t.find((T) => T.utxo === v);
|
|
2450
2450
|
if (!P)
|
|
2451
2451
|
throw new Error(me.counterPartySigNotFound(v));
|
|
2452
|
-
n.setWitness(
|
|
2452
|
+
n.setWitness(w, [
|
|
2453
2453
|
Buffer.from(P.sig, "hex"),
|
|
2454
2454
|
I,
|
|
2455
2455
|
this.instantRefundLeaf(),
|
|
@@ -2475,16 +2475,16 @@ class pr {
|
|
|
2475
2475
|
), f = this.leafHash(
|
|
2476
2476
|
1
|
|
2477
2477
|
/* REDEEM */
|
|
2478
|
-
), u = a.map((
|
|
2479
|
-
for (let
|
|
2478
|
+
), u = a.map((w) => w.value), l = Mr(this.getOutputScript(), a.length), y = be.Transaction.SIGHASH_DEFAULT;
|
|
2479
|
+
for (let w = 0; w < i.ins.length; w++) {
|
|
2480
2480
|
const E = i.hashForWitnessV1(
|
|
2481
|
-
|
|
2481
|
+
w,
|
|
2482
2482
|
l,
|
|
2483
2483
|
u,
|
|
2484
2484
|
y,
|
|
2485
2485
|
f
|
|
2486
2486
|
), I = await this.signer.signSchnorr(E);
|
|
2487
|
-
i.setWitness(
|
|
2487
|
+
i.setWitness(w, [
|
|
2488
2488
|
I,
|
|
2489
2489
|
Buffer.from(t, "hex"),
|
|
2490
2490
|
this.redeemLeaf(),
|
|
@@ -2509,7 +2509,7 @@ class pr {
|
|
|
2509
2509
|
const u = this.leafHash(
|
|
2510
2510
|
0
|
|
2511
2511
|
/* REFUND */
|
|
2512
|
-
), l = i.map((E) => E.value), y =
|
|
2512
|
+
), l = i.map((E) => E.value), y = Mr(this.getOutputScript(), i.length), g = be.Transaction.SIGHASH_DEFAULT;
|
|
2513
2513
|
for (let E = 0; E < n.ins.length; E++) {
|
|
2514
2514
|
n.ins[E].sequence = this.expiry;
|
|
2515
2515
|
const I = n.hashForWitnessV1(
|
|
@@ -2671,7 +2671,7 @@ class pr {
|
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
|
-
function
|
|
2674
|
+
function Mr(e, t) {
|
|
2675
2675
|
const r = [];
|
|
2676
2676
|
for (let n = 0; n < t; n++)
|
|
2677
2677
|
r.push(e);
|
|
@@ -2701,16 +2701,15 @@ class rf {
|
|
|
2701
2701
|
this.url = new pn("/blocknumber/" + r, t);
|
|
2702
2702
|
}
|
|
2703
2703
|
async fetchBlockNumbers() {
|
|
2704
|
-
console.log("this.url :", this.url.toString());
|
|
2705
2704
|
try {
|
|
2706
2705
|
const t = await mt.get(this.url);
|
|
2707
2706
|
return fe(t);
|
|
2708
2707
|
} catch (t) {
|
|
2709
|
-
return
|
|
2708
|
+
return M("Failed to fetch block numbers", t);
|
|
2710
2709
|
}
|
|
2711
2710
|
}
|
|
2712
2711
|
}
|
|
2713
|
-
class
|
|
2712
|
+
class l0 {
|
|
2714
2713
|
constructor(t) {
|
|
2715
2714
|
if (this.eventListeners = /* @__PURE__ */ new Map(), this.getOrderThreshold = 20, this.pendingOrdersCount = 0, this.useRelay = !0, this.orderBook = new js({
|
|
2716
2715
|
url: t.orderbookURl,
|
|
@@ -2731,12 +2730,12 @@ class ll {
|
|
|
2731
2730
|
}
|
|
2732
2731
|
async swap(t) {
|
|
2733
2732
|
const r = await this.validateAndFillParams(t);
|
|
2734
|
-
if (r.error) return
|
|
2733
|
+
if (r.error) return M(r.error);
|
|
2735
2734
|
const { sendAddress: n, receiveAddress: i, timelock: a } = r.val, f = await this.orderBook.getOrdersCount(this.evmAddress);
|
|
2736
|
-
if (f.error) return
|
|
2735
|
+
if (f.error) return M(f.error);
|
|
2737
2736
|
const u = f.val + 1, l = this.secretManager.generateSecret(u);
|
|
2738
|
-
if (l.error) return
|
|
2739
|
-
const { strategyId: y, btcAddress: g } = t.additionalData,
|
|
2737
|
+
if (l.error) return M(l.error);
|
|
2738
|
+
const { strategyId: y, btcAddress: g } = t.additionalData, w = {
|
|
2740
2739
|
strategy_id: y,
|
|
2741
2740
|
...g && {
|
|
2742
2741
|
bitcoin_optional_recipient: g
|
|
@@ -2755,72 +2754,72 @@ class ll {
|
|
|
2755
2754
|
timelock: a,
|
|
2756
2755
|
secret_hash: nt(l.val.secretHash),
|
|
2757
2756
|
min_destination_confirmations: t.minDestinationConfirmations ?? 0,
|
|
2758
|
-
additional_data:
|
|
2757
|
+
additional_data: w
|
|
2759
2758
|
}, I = await this.quote.getAttestedQuote(E);
|
|
2760
|
-
if (I.error) return
|
|
2759
|
+
if (I.error) return M(I.error);
|
|
2761
2760
|
const v = await this.orderBook.createOrder(I.val);
|
|
2762
|
-
if (v.error) return
|
|
2761
|
+
if (v.error) return M(v.error);
|
|
2763
2762
|
const P = await this.pollOrder(v.val);
|
|
2764
|
-
return P.error ?
|
|
2763
|
+
return P.error ? M(P.error) : fe(P.val);
|
|
2765
2764
|
}
|
|
2766
2765
|
async validateAndFillParams(t) {
|
|
2767
2766
|
if (t.fromAsset.chain === t.toAsset.chain && t.fromAsset.atomicSwapAddress === t.toAsset.atomicSwapAddress)
|
|
2768
|
-
return
|
|
2767
|
+
return M("Source and destination assets cannot be the same");
|
|
2769
2768
|
if (rr(t.fromAsset.chain) && !rr(t.toAsset.chain) || !rr(t.fromAsset.chain) && rr(t.toAsset.chain))
|
|
2770
|
-
return
|
|
2769
|
+
return M(
|
|
2771
2770
|
"Both assets should be on the same network (either mainnet or testnet)"
|
|
2772
2771
|
);
|
|
2773
2772
|
if (nr(t.fromAsset.chain) || nr(t.toAsset.chain)) {
|
|
2774
2773
|
if (!this.wallets.btcWallet)
|
|
2775
|
-
return
|
|
2774
|
+
return M(
|
|
2776
2775
|
"btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor"
|
|
2777
2776
|
);
|
|
2778
2777
|
if (!t.additionalData.btcAddress)
|
|
2779
|
-
return
|
|
2778
|
+
return M(
|
|
2780
2779
|
"btcAddress in additionalData is required for bitcoin chain"
|
|
2781
2780
|
);
|
|
2782
2781
|
}
|
|
2783
2782
|
const r = await this.getAddresses(t.fromAsset.chain);
|
|
2784
|
-
if (r.error) return
|
|
2783
|
+
if (r.error) return M(r.error);
|
|
2785
2784
|
const n = await this.getAddresses(t.toAsset.chain);
|
|
2786
|
-
if (n.error) return
|
|
2785
|
+
if (n.error) return M(n.error);
|
|
2787
2786
|
const i = this.validateAmount(t.sendAmount);
|
|
2788
|
-
if (i.error) return
|
|
2787
|
+
if (i.error) return M(i.error);
|
|
2789
2788
|
const a = this.validateAmount(t.receiveAmount);
|
|
2790
|
-
if (a.error) return
|
|
2789
|
+
if (a.error) return M(a.error);
|
|
2791
2790
|
if (i < a)
|
|
2792
|
-
return
|
|
2791
|
+
return M("Send amount should be greater than receive amount");
|
|
2793
2792
|
const f = this.getTimelock(t.fromAsset.chain);
|
|
2794
2793
|
return f ? fe({
|
|
2795
2794
|
sendAddress: r.val,
|
|
2796
2795
|
receiveAddress: n.val,
|
|
2797
2796
|
timelock: t.timelock ?? f
|
|
2798
|
-
}) :
|
|
2797
|
+
}) : M("Unsupported chain for timelock");
|
|
2799
2798
|
}
|
|
2800
2799
|
async getAddresses(t) {
|
|
2801
2800
|
var n;
|
|
2802
|
-
switch (
|
|
2803
|
-
case
|
|
2804
|
-
return this.wallets.evmWallet.account ? fe(this.wallets.evmWallet.account.address) :
|
|
2805
|
-
case
|
|
2801
|
+
switch (Lt(t)) {
|
|
2802
|
+
case ke.EVM:
|
|
2803
|
+
return this.wallets.evmWallet.account ? fe(this.wallets.evmWallet.account.address) : M("EVM Wallet not found");
|
|
2804
|
+
case ke.Bitcoin: {
|
|
2806
2805
|
const i = await ((n = this.wallets.btcWallet) == null ? void 0 : n.getPublicKey());
|
|
2807
|
-
return !i || !za(i) ?
|
|
2806
|
+
return !i || !za(i) ? M("Invalid btc public key") : fe(Ot(i));
|
|
2808
2807
|
}
|
|
2809
2808
|
default:
|
|
2810
|
-
return
|
|
2809
|
+
return M("Unsupported chain");
|
|
2811
2810
|
}
|
|
2812
2811
|
}
|
|
2813
2812
|
validateAmount(t) {
|
|
2814
2813
|
if (t == null || t.includes("."))
|
|
2815
|
-
return
|
|
2814
|
+
return M("Invalid amount ", t);
|
|
2816
2815
|
const r = new Ys(t);
|
|
2817
|
-
return !r.isInteger() || r.isNaN() || r.lt(0) || r.isLessThanOrEqualTo(0) ?
|
|
2816
|
+
return !r.isInteger() || r.isNaN() || r.lt(0) || r.isLessThanOrEqualTo(0) ? M("Invalid amount ", t) : fe(r);
|
|
2818
2817
|
}
|
|
2819
2818
|
getTimelock(t) {
|
|
2820
|
-
switch (
|
|
2821
|
-
case
|
|
2819
|
+
switch (Lt(t)) {
|
|
2820
|
+
case ke.EVM:
|
|
2822
2821
|
return en.evm;
|
|
2823
|
-
case
|
|
2822
|
+
case ke.Bitcoin:
|
|
2824
2823
|
return en.btc;
|
|
2825
2824
|
default:
|
|
2826
2825
|
return;
|
|
@@ -2831,12 +2830,12 @@ class ll {
|
|
|
2831
2830
|
for (; n < this.getOrderThreshold; ) {
|
|
2832
2831
|
if (await qs(1e3), n++, r.error) {
|
|
2833
2832
|
if (!r.error.includes("result is undefined"))
|
|
2834
|
-
return
|
|
2833
|
+
return M(r.error);
|
|
2835
2834
|
} else if (r.val && r.val.create_order.create_id.toLowerCase() === t.toLowerCase())
|
|
2836
2835
|
return fe(r.val);
|
|
2837
2836
|
r = await this.orderBook.getOrder(t, !0);
|
|
2838
2837
|
}
|
|
2839
|
-
return
|
|
2838
|
+
return M(`Order not found, createOrder id: ${t}`);
|
|
2840
2839
|
}
|
|
2841
2840
|
emit(t, ...r) {
|
|
2842
2841
|
(this.eventListeners.get(t) ?? []).forEach((i) => {
|
|
@@ -2851,7 +2850,6 @@ class ll {
|
|
|
2851
2850
|
var i;
|
|
2852
2851
|
this.pendingOrdersCount = r.data.length, this.emit("onPendingOrdersChanged", r.data);
|
|
2853
2852
|
const n = await ((i = this.blockNumberFetcher) == null ? void 0 : i.fetchBlockNumbers());
|
|
2854
|
-
console.log("blockNumbers :", n);
|
|
2855
2853
|
for (let a = 0; a < r.data.length; a++) {
|
|
2856
2854
|
const f = r.data[a], u = f.source_swap.chain, l = f.destination_swap.chain, y = this.getWallet(u), g = this.getWallet(l);
|
|
2857
2855
|
if (y.error || g.error || !y.val || !g.val) {
|
|
@@ -2862,16 +2860,8 @@ class ll {
|
|
|
2862
2860
|
);
|
|
2863
2861
|
return;
|
|
2864
2862
|
}
|
|
2865
|
-
let
|
|
2866
|
-
if (
|
|
2867
|
-
"sourceChainBlockNumber :",
|
|
2868
|
-
u,
|
|
2869
|
-
m
|
|
2870
|
-
), console.log(
|
|
2871
|
-
"destinationChainBlockNumber :",
|
|
2872
|
-
l,
|
|
2873
|
-
E
|
|
2874
|
-
), !m || !E) {
|
|
2863
|
+
let w = n == null ? void 0 : n.val[u], E = n == null ? void 0 : n.val[l];
|
|
2864
|
+
if (!w || !E) {
|
|
2875
2865
|
const v = await this.fetchCurrentBlockNumbers(f, {
|
|
2876
2866
|
source: y.val,
|
|
2877
2867
|
destination: g.val
|
|
@@ -2884,11 +2874,11 @@ class ll {
|
|
|
2884
2874
|
);
|
|
2885
2875
|
return;
|
|
2886
2876
|
}
|
|
2887
|
-
|
|
2877
|
+
w = v.val.source, E = v.val.destination;
|
|
2888
2878
|
}
|
|
2889
2879
|
switch (Va(
|
|
2890
2880
|
f,
|
|
2891
|
-
|
|
2881
|
+
w,
|
|
2892
2882
|
E
|
|
2893
2883
|
)) {
|
|
2894
2884
|
case ye.Redeem: {
|
|
@@ -2899,12 +2889,12 @@ class ll {
|
|
|
2899
2889
|
this.emit("error", f, v.error);
|
|
2900
2890
|
return;
|
|
2901
2891
|
}
|
|
2902
|
-
switch (
|
|
2903
|
-
case
|
|
2892
|
+
switch (Lt(f.destination_swap.chain)) {
|
|
2893
|
+
case ke.EVM: {
|
|
2904
2894
|
await this.evmRedeem(f, v.val.secret);
|
|
2905
2895
|
break;
|
|
2906
2896
|
}
|
|
2907
|
-
case
|
|
2897
|
+
case ke.Bitcoin: {
|
|
2908
2898
|
await this.btcRedeem(
|
|
2909
2899
|
g.val,
|
|
2910
2900
|
f,
|
|
@@ -2922,8 +2912,8 @@ class ll {
|
|
|
2922
2912
|
break;
|
|
2923
2913
|
}
|
|
2924
2914
|
case ye.Refund: {
|
|
2925
|
-
switch (
|
|
2926
|
-
case
|
|
2915
|
+
switch (Lt(f.source_swap.chain)) {
|
|
2916
|
+
case ke.EVM: {
|
|
2927
2917
|
this.emit(
|
|
2928
2918
|
"error",
|
|
2929
2919
|
f,
|
|
@@ -2931,7 +2921,7 @@ class ll {
|
|
|
2931
2921
|
);
|
|
2932
2922
|
break;
|
|
2933
2923
|
}
|
|
2934
|
-
case
|
|
2924
|
+
case ke.Bitcoin: {
|
|
2935
2925
|
await this.btcRefund(
|
|
2936
2926
|
y.val,
|
|
2937
2927
|
f
|
|
@@ -3029,13 +3019,13 @@ class ll {
|
|
|
3029
3019
|
}
|
|
3030
3020
|
}
|
|
3031
3021
|
getWallet(t) {
|
|
3032
|
-
switch (
|
|
3033
|
-
case
|
|
3022
|
+
switch (Lt(t)) {
|
|
3023
|
+
case ke.EVM:
|
|
3034
3024
|
return fe(this.wallets.evmWallet);
|
|
3035
|
-
case
|
|
3025
|
+
case ke.Bitcoin:
|
|
3036
3026
|
return fe(this.wallets.btcWallet);
|
|
3037
3027
|
default:
|
|
3038
|
-
return
|
|
3028
|
+
return M("Unsupported chain for wallet");
|
|
3039
3029
|
}
|
|
3040
3030
|
}
|
|
3041
3031
|
on(t, r) {
|
|
@@ -3048,15 +3038,15 @@ class ll {
|
|
|
3048
3038
|
}
|
|
3049
3039
|
async fetchCurrentBlockNumbers(t, r) {
|
|
3050
3040
|
if (!r || !r.source || !r.destination)
|
|
3051
|
-
return
|
|
3052
|
-
const n = nr(t.source_swap.chain) ? await
|
|
3041
|
+
return M("Provide wallets to fetch the current block number");
|
|
3042
|
+
const n = nr(t.source_swap.chain) ? await Ln(
|
|
3053
3043
|
await r.source.getProvider()
|
|
3054
3044
|
) : await Zr(r.source);
|
|
3055
|
-
if (n.error) return
|
|
3056
|
-
const i = nr(t.destination_swap.chain) ? await
|
|
3045
|
+
if (n.error) return M(n.error);
|
|
3046
|
+
const i = nr(t.destination_swap.chain) ? await Ln(
|
|
3057
3047
|
await r.destination.getProvider()
|
|
3058
3048
|
) : await Zr(r.destination);
|
|
3059
|
-
return i.error ?
|
|
3049
|
+
return i.error ? M(i.error) : fe({
|
|
3060
3050
|
source: n.val,
|
|
3061
3051
|
destination: i.val
|
|
3062
3052
|
});
|
|
@@ -3199,9 +3189,9 @@ var ts = {
|
|
|
3199
3189
|
tfSubError: ff,
|
|
3200
3190
|
tfJSON: br,
|
|
3201
3191
|
getValueTypeName: Bn
|
|
3202
|
-
},
|
|
3192
|
+
}, Nr, Xn;
|
|
3203
3193
|
function uf() {
|
|
3204
|
-
if (Xn) return
|
|
3194
|
+
if (Xn) return Nr;
|
|
3205
3195
|
Xn = 1;
|
|
3206
3196
|
var e = En, t = ts;
|
|
3207
3197
|
function r(S) {
|
|
@@ -3211,28 +3201,28 @@ function uf() {
|
|
|
3211
3201
|
return typeof S == "string" && /^([0-9a-f]{2})+$/i.test(S);
|
|
3212
3202
|
}
|
|
3213
3203
|
function i(S, z) {
|
|
3214
|
-
var
|
|
3204
|
+
var N = S.toJSON();
|
|
3215
3205
|
function $(se) {
|
|
3216
3206
|
if (!S(se)) return !1;
|
|
3217
3207
|
if (se.length === z) return !0;
|
|
3218
|
-
throw t.tfCustomError(
|
|
3208
|
+
throw t.tfCustomError(N + "(Length: " + z + ")", N + "(Length: " + se.length + ")");
|
|
3219
3209
|
}
|
|
3220
3210
|
return $.toJSON = function() {
|
|
3221
|
-
return
|
|
3211
|
+
return N;
|
|
3222
3212
|
}, $;
|
|
3223
3213
|
}
|
|
3224
3214
|
var a = i.bind(null, e.Array), f = i.bind(null, r), u = i.bind(null, n), l = i.bind(null, e.String);
|
|
3225
|
-
function y(S, z,
|
|
3226
|
-
|
|
3215
|
+
function y(S, z, N) {
|
|
3216
|
+
N = N || e.Number;
|
|
3227
3217
|
function $(se, Te) {
|
|
3228
|
-
return
|
|
3218
|
+
return N(se, Te) && se > S && se < z;
|
|
3229
3219
|
}
|
|
3230
3220
|
return $.toJSON = function() {
|
|
3231
|
-
return `${
|
|
3221
|
+
return `${N.toJSON()} between [${S}, ${z}]`;
|
|
3232
3222
|
}, $;
|
|
3233
3223
|
}
|
|
3234
3224
|
var g = Math.pow(2, 53) - 1;
|
|
3235
|
-
function
|
|
3225
|
+
function w(S) {
|
|
3236
3226
|
return typeof S == "number" && isFinite(S);
|
|
3237
3227
|
}
|
|
3238
3228
|
function E(S) {
|
|
@@ -3256,14 +3246,14 @@ function uf() {
|
|
|
3256
3246
|
function F(S) {
|
|
3257
3247
|
return S >>> 0 === S;
|
|
3258
3248
|
}
|
|
3259
|
-
function
|
|
3249
|
+
function k(S) {
|
|
3260
3250
|
return typeof S == "number" && S >= 0 && S <= g && Math.floor(S) === S;
|
|
3261
3251
|
}
|
|
3262
|
-
var
|
|
3252
|
+
var L = {
|
|
3263
3253
|
ArrayN: a,
|
|
3264
3254
|
Buffer: r,
|
|
3265
3255
|
BufferN: f,
|
|
3266
|
-
Finite:
|
|
3256
|
+
Finite: w,
|
|
3267
3257
|
Hex: n,
|
|
3268
3258
|
HexN: u,
|
|
3269
3259
|
Int8: E,
|
|
@@ -3275,15 +3265,15 @@ function uf() {
|
|
|
3275
3265
|
UInt8: T,
|
|
3276
3266
|
UInt16: C,
|
|
3277
3267
|
UInt32: F,
|
|
3278
|
-
UInt53:
|
|
3268
|
+
UInt53: k
|
|
3279
3269
|
};
|
|
3280
|
-
for (var U in
|
|
3281
|
-
|
|
3270
|
+
for (var U in L)
|
|
3271
|
+
L[U].toJSON = (function(S) {
|
|
3282
3272
|
return S;
|
|
3283
3273
|
}).bind(null, U);
|
|
3284
|
-
return
|
|
3274
|
+
return Nr = L, Nr;
|
|
3285
3275
|
}
|
|
3286
|
-
var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTypeError,
|
|
3276
|
+
var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTypeError, Mt = Jt.tfSubError, cf = Jt.getValueTypeName, $e = {
|
|
3287
3277
|
arrayOf: function(t, r) {
|
|
3288
3278
|
t = Ue(t), r = r || {};
|
|
3289
3279
|
function n(i, a) {
|
|
@@ -3291,7 +3281,7 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3291
3281
|
try {
|
|
3292
3282
|
return _e(t, f, a);
|
|
3293
3283
|
} catch (l) {
|
|
3294
|
-
throw
|
|
3284
|
+
throw Mt(l, u);
|
|
3295
3285
|
}
|
|
3296
3286
|
});
|
|
3297
3287
|
}
|
|
@@ -3317,13 +3307,13 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3317
3307
|
try {
|
|
3318
3308
|
r && _e(r, f, a);
|
|
3319
3309
|
} catch (l) {
|
|
3320
|
-
throw
|
|
3310
|
+
throw Mt(l, f, "key");
|
|
3321
3311
|
}
|
|
3322
3312
|
try {
|
|
3323
3313
|
var u = i[f];
|
|
3324
3314
|
_e(t, u, a);
|
|
3325
3315
|
} catch (l) {
|
|
3326
|
-
throw
|
|
3316
|
+
throw Mt(l, f);
|
|
3327
3317
|
}
|
|
3328
3318
|
}
|
|
3329
3319
|
return !0;
|
|
@@ -3347,7 +3337,7 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3347
3337
|
_e(l, y, f);
|
|
3348
3338
|
}
|
|
3349
3339
|
} catch (g) {
|
|
3350
|
-
throw
|
|
3340
|
+
throw Mt(g, u);
|
|
3351
3341
|
}
|
|
3352
3342
|
if (f) {
|
|
3353
3343
|
for (u in a)
|
|
@@ -3405,7 +3395,7 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3405
3395
|
try {
|
|
3406
3396
|
return _e(a, n[f], i);
|
|
3407
3397
|
} catch (u) {
|
|
3408
|
-
throw
|
|
3398
|
+
throw Mt(u, f);
|
|
3409
3399
|
}
|
|
3410
3400
|
});
|
|
3411
3401
|
}
|
|
@@ -3520,10 +3510,10 @@ function wf(e) {
|
|
|
3520
3510
|
var In = {};
|
|
3521
3511
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3522
3512
|
In.read = function(e, t, r, n, i) {
|
|
3523
|
-
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1, y = l >> 1, g = -7,
|
|
3524
|
-
for (
|
|
3513
|
+
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1, y = l >> 1, g = -7, w = r ? i - 1 : 0, E = r ? -1 : 1, I = e[t + w];
|
|
3514
|
+
for (w += E, a = I & (1 << -g) - 1, I >>= -g, g += u; g > 0; a = a * 256 + e[t + w], w += E, g -= 8)
|
|
3525
3515
|
;
|
|
3526
|
-
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t +
|
|
3516
|
+
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t + w], w += E, g -= 8)
|
|
3527
3517
|
;
|
|
3528
3518
|
if (a === 0)
|
|
3529
3519
|
a = 1 - y;
|
|
@@ -3535,8 +3525,8 @@ In.read = function(e, t, r, n, i) {
|
|
|
3535
3525
|
return (I ? -1 : 1) * f * Math.pow(2, a - n);
|
|
3536
3526
|
};
|
|
3537
3527
|
In.write = function(e, t, r, n, i, a) {
|
|
3538
|
-
var f, u, l, y = a * 8 - i - 1, g = (1 << y) - 1,
|
|
3539
|
-
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, f = g) : (f = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -f)) < 1 && (f--, l *= 2), f +
|
|
3528
|
+
var f, u, l, y = a * 8 - i - 1, g = (1 << y) - 1, w = g >> 1, E = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, I = n ? 0 : a - 1, v = n ? 1 : -1, P = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
|
|
3529
|
+
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, f = g) : (f = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -f)) < 1 && (f--, l *= 2), f + w >= 1 ? t += E / l : t += E * Math.pow(2, 1 - w), t * l >= 2 && (f++, l /= 2), f + w >= g ? (u = 0, f = g) : f + w >= 1 ? (u = (t * l - 1) * Math.pow(2, i), f = f + w) : (u = t * Math.pow(2, w - 1) * Math.pow(2, i), f = 0)); i >= 8; e[r + I] = u & 255, I += v, u /= 256, i -= 8)
|
|
3540
3530
|
;
|
|
3541
3531
|
for (f = f << i | u, y += i; y > 0; e[r + I] = f & 255, I += v, f /= 256, y -= 8)
|
|
3542
3532
|
;
|
|
@@ -3590,7 +3580,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3590
3580
|
throw new TypeError(
|
|
3591
3581
|
'The "string" argument must be of type string. Received type number'
|
|
3592
3582
|
);
|
|
3593
|
-
return
|
|
3583
|
+
return w(c);
|
|
3594
3584
|
}
|
|
3595
3585
|
return l(c, s, o);
|
|
3596
3586
|
}
|
|
@@ -3636,18 +3626,18 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3636
3626
|
u.alloc = function(c, s, o) {
|
|
3637
3627
|
return g(c, s, o);
|
|
3638
3628
|
};
|
|
3639
|
-
function
|
|
3629
|
+
function w(c) {
|
|
3640
3630
|
return y(c), f(c < 0 ? 0 : C(c) | 0);
|
|
3641
3631
|
}
|
|
3642
3632
|
u.allocUnsafe = function(c) {
|
|
3643
|
-
return
|
|
3633
|
+
return w(c);
|
|
3644
3634
|
}, u.allocUnsafeSlow = function(c) {
|
|
3645
|
-
return
|
|
3635
|
+
return w(c);
|
|
3646
3636
|
};
|
|
3647
3637
|
function E(c, s) {
|
|
3648
3638
|
if ((typeof s != "string" || s === "") && (s = "utf8"), !u.isEncoding(s))
|
|
3649
3639
|
throw new TypeError("Unknown encoding: " + s);
|
|
3650
|
-
const o =
|
|
3640
|
+
const o = k(c, s) | 0;
|
|
3651
3641
|
let h = f(o);
|
|
3652
3642
|
const b = h.write(c, s);
|
|
3653
3643
|
return b !== o && (h = h.slice(0, b)), h;
|
|
@@ -3750,7 +3740,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3750
3740
|
}
|
|
3751
3741
|
return b;
|
|
3752
3742
|
};
|
|
3753
|
-
function
|
|
3743
|
+
function k(c, s) {
|
|
3754
3744
|
if (u.isBuffer(c))
|
|
3755
3745
|
return c.length;
|
|
3756
3746
|
if (ArrayBuffer.isView(c) || Se(c, ArrayBuffer))
|
|
@@ -3786,8 +3776,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3786
3776
|
s = ("" + s).toLowerCase(), b = !0;
|
|
3787
3777
|
}
|
|
3788
3778
|
}
|
|
3789
|
-
u.byteLength =
|
|
3790
|
-
function
|
|
3779
|
+
u.byteLength = k;
|
|
3780
|
+
function L(c, s, o) {
|
|
3791
3781
|
let h = !1;
|
|
3792
3782
|
if ((s === void 0 || s < 0) && (s = 0), s > this.length || ((o === void 0 || o > this.length) && (o = this.length), o <= 0) || (o >>>= 0, s >>>= 0, o <= s))
|
|
3793
3783
|
return "";
|
|
@@ -3843,7 +3833,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3843
3833
|
return this;
|
|
3844
3834
|
}, u.prototype.toString = function() {
|
|
3845
3835
|
const s = this.length;
|
|
3846
|
-
return s === 0 ? "" : arguments.length === 0 ? xe(this, 0, s) :
|
|
3836
|
+
return s === 0 ? "" : arguments.length === 0 ? xe(this, 0, s) : L.apply(this, arguments);
|
|
3847
3837
|
}, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(s) {
|
|
3848
3838
|
if (!u.isBuffer(s)) throw new TypeError("Argument must be a Buffer");
|
|
3849
3839
|
return this === s ? !0 : u.compare(this, s) === 0;
|
|
@@ -3925,7 +3915,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3925
3915
|
}, u.prototype.lastIndexOf = function(s, o, h) {
|
|
3926
3916
|
return S(this, s, o, h, !1);
|
|
3927
3917
|
};
|
|
3928
|
-
function
|
|
3918
|
+
function N(c, s, o, h) {
|
|
3929
3919
|
o = Number(o) || 0;
|
|
3930
3920
|
const b = c.length - o;
|
|
3931
3921
|
h ? (h = Number(h), h > b && (h = b)) : h = b;
|
|
@@ -3970,7 +3960,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3970
3960
|
for (; ; )
|
|
3971
3961
|
switch (b) {
|
|
3972
3962
|
case "hex":
|
|
3973
|
-
return
|
|
3963
|
+
return N(this, s, o, h);
|
|
3974
3964
|
case "utf8":
|
|
3975
3965
|
case "utf-8":
|
|
3976
3966
|
return $(this, s, o, h);
|
|
@@ -4244,25 +4234,25 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4244
4234
|
}), u.prototype.writeBigInt64BE = Ie(function(s, o = 0) {
|
|
4245
4235
|
return qe(this, s, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
4246
4236
|
});
|
|
4247
|
-
function
|
|
4237
|
+
function Me(c, s, o, h, b, x) {
|
|
4248
4238
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
4249
4239
|
if (o < 0) throw new RangeError("Index out of range");
|
|
4250
4240
|
}
|
|
4251
4241
|
function _(c, s, o, h, b) {
|
|
4252
|
-
return s = +s, o = o >>> 0, b ||
|
|
4242
|
+
return s = +s, o = o >>> 0, b || Me(c, s, o, 4), r.write(c, s, o, h, 23, 4), o + 4;
|
|
4253
4243
|
}
|
|
4254
4244
|
u.prototype.writeFloatLE = function(s, o, h) {
|
|
4255
4245
|
return _(this, s, o, !0, h);
|
|
4256
4246
|
}, u.prototype.writeFloatBE = function(s, o, h) {
|
|
4257
4247
|
return _(this, s, o, !1, h);
|
|
4258
4248
|
};
|
|
4259
|
-
function
|
|
4260
|
-
return s = +s, o = o >>> 0, b ||
|
|
4249
|
+
function m(c, s, o, h, b) {
|
|
4250
|
+
return s = +s, o = o >>> 0, b || Me(c, s, o, 8), r.write(c, s, o, h, 52, 8), o + 8;
|
|
4261
4251
|
}
|
|
4262
4252
|
u.prototype.writeDoubleLE = function(s, o, h) {
|
|
4263
|
-
return
|
|
4253
|
+
return m(this, s, o, !0, h);
|
|
4264
4254
|
}, u.prototype.writeDoubleBE = function(s, o, h) {
|
|
4265
|
-
return
|
|
4255
|
+
return m(this, s, o, !1, h);
|
|
4266
4256
|
}, u.prototype.copy = function(s, o, h, b) {
|
|
4267
4257
|
if (!u.isBuffer(s)) throw new TypeError("argument should be a Buffer");
|
|
4268
4258
|
if (h || (h = 0), !b && b !== 0 && (b = this.length), o >= s.length && (o = s.length), o || (o = 0), b > 0 && b < h && (b = h), b === h || s.length === 0 || this.length === 0) return 0;
|
|
@@ -4778,12 +4768,12 @@ function hs(e, t, r, n) {
|
|
|
4778
4768
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
|
|
4779
4769
|
}
|
|
4780
4770
|
var ds = An.exports, ps = ds.EventEmitter;
|
|
4781
|
-
const Cf = {},
|
|
4771
|
+
const Cf = {}, Lf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4782
4772
|
__proto__: null,
|
|
4783
4773
|
default: Cf
|
|
4784
|
-
}, Symbol.toStringTag, { value: "Module" })), Rn = /* @__PURE__ */ nf(
|
|
4774
|
+
}, Symbol.toStringTag, { value: "Module" })), Rn = /* @__PURE__ */ nf(Lf);
|
|
4785
4775
|
var Hr, ti;
|
|
4786
|
-
function
|
|
4776
|
+
function kf() {
|
|
4787
4777
|
if (ti) return Hr;
|
|
4788
4778
|
ti = 1;
|
|
4789
4779
|
function e(v, P) {
|
|
@@ -4837,7 +4827,7 @@ function Lf() {
|
|
|
4837
4827
|
}
|
|
4838
4828
|
return (P === "string" ? String : Number)(v);
|
|
4839
4829
|
}
|
|
4840
|
-
var l = Rt, y = l.Buffer, g = Rn,
|
|
4830
|
+
var l = Rt, y = l.Buffer, g = Rn, w = g.inspect, E = w && w.custom || "inspect";
|
|
4841
4831
|
function I(v, P, T) {
|
|
4842
4832
|
y.prototype.copy.call(v, P, T);
|
|
4843
4833
|
}
|
|
@@ -4887,8 +4877,8 @@ function Lf() {
|
|
|
4887
4877
|
key: "concat",
|
|
4888
4878
|
value: function(T) {
|
|
4889
4879
|
if (this.length === 0) return y.alloc(0);
|
|
4890
|
-
for (var C = y.allocUnsafe(T >>> 0), F = this.head,
|
|
4891
|
-
I(F.data, C,
|
|
4880
|
+
for (var C = y.allocUnsafe(T >>> 0), F = this.head, k = 0; F; )
|
|
4881
|
+
I(F.data, C, k), k += F.data.length, F = F.next;
|
|
4892
4882
|
return C;
|
|
4893
4883
|
}
|
|
4894
4884
|
// Consumes a specified amount of bytes or characters from the buffered data.
|
|
@@ -4907,37 +4897,37 @@ function Lf() {
|
|
|
4907
4897
|
}, {
|
|
4908
4898
|
key: "_getString",
|
|
4909
4899
|
value: function(T) {
|
|
4910
|
-
var C = this.head, F = 1,
|
|
4911
|
-
for (T -=
|
|
4912
|
-
var
|
|
4913
|
-
if (U ===
|
|
4914
|
-
U ===
|
|
4900
|
+
var C = this.head, F = 1, k = C.data;
|
|
4901
|
+
for (T -= k.length; C = C.next; ) {
|
|
4902
|
+
var L = C.data, U = T > L.length ? L.length : T;
|
|
4903
|
+
if (U === L.length ? k += L : k += L.slice(0, T), T -= U, T === 0) {
|
|
4904
|
+
U === L.length ? (++F, C.next ? this.head = C.next : this.head = this.tail = null) : (this.head = C, C.data = L.slice(U));
|
|
4915
4905
|
break;
|
|
4916
4906
|
}
|
|
4917
4907
|
++F;
|
|
4918
4908
|
}
|
|
4919
|
-
return this.length -= F,
|
|
4909
|
+
return this.length -= F, k;
|
|
4920
4910
|
}
|
|
4921
4911
|
// Consumes a specified amount of bytes from the buffered data.
|
|
4922
4912
|
}, {
|
|
4923
4913
|
key: "_getBuffer",
|
|
4924
4914
|
value: function(T) {
|
|
4925
|
-
var C = y.allocUnsafe(T), F = this.head,
|
|
4915
|
+
var C = y.allocUnsafe(T), F = this.head, k = 1;
|
|
4926
4916
|
for (F.data.copy(C), T -= F.data.length; F = F.next; ) {
|
|
4927
|
-
var
|
|
4928
|
-
if (
|
|
4929
|
-
U ===
|
|
4917
|
+
var L = F.data, U = T > L.length ? L.length : T;
|
|
4918
|
+
if (L.copy(C, C.length - T, 0, U), T -= U, T === 0) {
|
|
4919
|
+
U === L.length ? (++k, F.next ? this.head = F.next : this.head = this.tail = null) : (this.head = F, F.data = L.slice(U));
|
|
4930
4920
|
break;
|
|
4931
4921
|
}
|
|
4932
|
-
++
|
|
4922
|
+
++k;
|
|
4933
4923
|
}
|
|
4934
|
-
return this.length -=
|
|
4924
|
+
return this.length -= k, C;
|
|
4935
4925
|
}
|
|
4936
4926
|
// Make sure the linked list only shows the minimal necessary information.
|
|
4937
4927
|
}, {
|
|
4938
4928
|
key: E,
|
|
4939
4929
|
value: function(T, C) {
|
|
4940
|
-
return
|
|
4930
|
+
return w(this, t(t({}, C), {}, {
|
|
4941
4931
|
// Only inspect one level.
|
|
4942
4932
|
depth: 0,
|
|
4943
4933
|
// It should not recurse.
|
|
@@ -4974,7 +4964,7 @@ var bs = {
|
|
|
4974
4964
|
undestroy: Uf,
|
|
4975
4965
|
errorOrDestroy: Of
|
|
4976
4966
|
}, ct = {};
|
|
4977
|
-
function
|
|
4967
|
+
function Mf(e, t) {
|
|
4978
4968
|
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e.__proto__ = t;
|
|
4979
4969
|
}
|
|
4980
4970
|
var ys = {};
|
|
@@ -4984,7 +4974,7 @@ function Re(e, t, r) {
|
|
|
4984
4974
|
return typeof t == "string" ? t : t(a, f, u);
|
|
4985
4975
|
}
|
|
4986
4976
|
var i = /* @__PURE__ */ function(a) {
|
|
4987
|
-
|
|
4977
|
+
Mf(f, a);
|
|
4988
4978
|
function f(u, l, y) {
|
|
4989
4979
|
return a.call(this, n(u, l, y)) || this;
|
|
4990
4980
|
}
|
|
@@ -5001,7 +4991,7 @@ function ni(e, t) {
|
|
|
5001
4991
|
} else
|
|
5002
4992
|
return "of ".concat(t, " ").concat(String(e));
|
|
5003
4993
|
}
|
|
5004
|
-
function
|
|
4994
|
+
function Nf(e, t, r) {
|
|
5005
4995
|
return e.substr(0, t.length) === t;
|
|
5006
4996
|
}
|
|
5007
4997
|
function Df(e, t, r) {
|
|
@@ -5015,7 +5005,7 @@ Re("ERR_INVALID_OPT_VALUE", function(e, t) {
|
|
|
5015
5005
|
}, TypeError);
|
|
5016
5006
|
Re("ERR_INVALID_ARG_TYPE", function(e, t, r) {
|
|
5017
5007
|
var n;
|
|
5018
|
-
typeof t == "string" &&
|
|
5008
|
+
typeof t == "string" && Nf(t, "not ") ? (n = "must not be", t = t.replace(/^not /, "")) : n = "must be";
|
|
5019
5009
|
var i;
|
|
5020
5010
|
if (Df(e, " argument"))
|
|
5021
5011
|
i = "The ".concat(e, " ").concat(n, " ").concat(ni(t, "type"));
|
|
@@ -5086,15 +5076,15 @@ function zr(e) {
|
|
|
5086
5076
|
var Gr, ii;
|
|
5087
5077
|
function ms() {
|
|
5088
5078
|
if (ii) return Gr;
|
|
5089
|
-
ii = 1, Gr =
|
|
5079
|
+
ii = 1, Gr = N;
|
|
5090
5080
|
function e(_) {
|
|
5091
|
-
var
|
|
5081
|
+
var m = this;
|
|
5092
5082
|
this.next = null, this.entry = null, this.finish = function() {
|
|
5093
|
-
|
|
5083
|
+
Me(m, _);
|
|
5094
5084
|
};
|
|
5095
5085
|
}
|
|
5096
5086
|
var t;
|
|
5097
|
-
|
|
5087
|
+
N.WritableState = S;
|
|
5098
5088
|
var r = {
|
|
5099
5089
|
deprecate: jf
|
|
5100
5090
|
}, n = ps, i = Rt.Buffer, a = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5105,20 +5095,20 @@ function ms() {
|
|
|
5105
5095
|
function u(_) {
|
|
5106
5096
|
return i.isBuffer(_) || _ instanceof a;
|
|
5107
5097
|
}
|
|
5108
|
-
var l = bs, y = gs, g = y.getHighWaterMark,
|
|
5109
|
-
ge(
|
|
5098
|
+
var l = bs, y = gs, g = y.getHighWaterMark, w = ct.codes, E = w.ERR_INVALID_ARG_TYPE, I = w.ERR_METHOD_NOT_IMPLEMENTED, v = w.ERR_MULTIPLE_CALLBACK, P = w.ERR_STREAM_CANNOT_PIPE, T = w.ERR_STREAM_DESTROYED, C = w.ERR_STREAM_NULL_VALUES, F = w.ERR_STREAM_WRITE_AFTER_END, k = w.ERR_UNKNOWN_ENCODING, L = l.errorOrDestroy;
|
|
5099
|
+
ge(N, n);
|
|
5110
5100
|
function U() {
|
|
5111
5101
|
}
|
|
5112
|
-
function S(_,
|
|
5113
|
-
t = t || St(), _ = _ || {}, typeof R != "boolean" && (R =
|
|
5102
|
+
function S(_, m, R) {
|
|
5103
|
+
t = t || St(), _ = _ || {}, typeof R != "boolean" && (R = m instanceof t), this.objectMode = !!_.objectMode, R && (this.objectMode = this.objectMode || !!_.writableObjectMode), this.highWaterMark = g(this, _, "writableHighWaterMark", R), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
|
|
5114
5104
|
var D = _.decodeStrings === !1;
|
|
5115
5105
|
this.decodeStrings = !D, this.defaultEncoding = _.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(G) {
|
|
5116
|
-
et(
|
|
5106
|
+
et(m, G);
|
|
5117
5107
|
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = _.emitClose !== !1, this.autoDestroy = !!_.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new e(this);
|
|
5118
5108
|
}
|
|
5119
5109
|
S.prototype.getBuffer = function() {
|
|
5120
|
-
for (var
|
|
5121
|
-
R.push(
|
|
5110
|
+
for (var m = this.bufferedRequest, R = []; m; )
|
|
5111
|
+
R.push(m), m = m.next;
|
|
5122
5112
|
return R;
|
|
5123
5113
|
}, function() {
|
|
5124
5114
|
try {
|
|
@@ -5131,42 +5121,42 @@ function ms() {
|
|
|
5131
5121
|
}
|
|
5132
5122
|
}();
|
|
5133
5123
|
var z;
|
|
5134
|
-
typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (z = Function.prototype[Symbol.hasInstance], Object.defineProperty(
|
|
5135
|
-
value: function(
|
|
5136
|
-
return z.call(this,
|
|
5124
|
+
typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (z = Function.prototype[Symbol.hasInstance], Object.defineProperty(N, Symbol.hasInstance, {
|
|
5125
|
+
value: function(m) {
|
|
5126
|
+
return z.call(this, m) ? !0 : this !== N ? !1 : m && m._writableState instanceof S;
|
|
5137
5127
|
}
|
|
5138
|
-
})) : z = function(
|
|
5139
|
-
return
|
|
5128
|
+
})) : z = function(m) {
|
|
5129
|
+
return m instanceof this;
|
|
5140
5130
|
};
|
|
5141
|
-
function
|
|
5131
|
+
function N(_) {
|
|
5142
5132
|
t = t || St();
|
|
5143
|
-
var
|
|
5144
|
-
if (!
|
|
5145
|
-
this._writableState = new S(_, this,
|
|
5133
|
+
var m = this instanceof t;
|
|
5134
|
+
if (!m && !z.call(N, this)) return new N(_);
|
|
5135
|
+
this._writableState = new S(_, this, m), this.writable = !0, _ && (typeof _.write == "function" && (this._write = _.write), typeof _.writev == "function" && (this._writev = _.writev), typeof _.destroy == "function" && (this._destroy = _.destroy), typeof _.final == "function" && (this._final = _.final)), n.call(this);
|
|
5146
5136
|
}
|
|
5147
|
-
|
|
5148
|
-
|
|
5137
|
+
N.prototype.pipe = function() {
|
|
5138
|
+
L(this, new P());
|
|
5149
5139
|
};
|
|
5150
|
-
function $(_,
|
|
5140
|
+
function $(_, m) {
|
|
5151
5141
|
var R = new F();
|
|
5152
|
-
|
|
5142
|
+
L(_, R), process.nextTick(m, R);
|
|
5153
5143
|
}
|
|
5154
|
-
function se(_,
|
|
5144
|
+
function se(_, m, R, D) {
|
|
5155
5145
|
var G;
|
|
5156
|
-
return R === null ? G = new C() : typeof R != "string" && !
|
|
5146
|
+
return R === null ? G = new C() : typeof R != "string" && !m.objectMode && (G = new E("chunk", ["string", "Buffer"], R)), G ? (L(_, G), process.nextTick(D, G), !1) : !0;
|
|
5157
5147
|
}
|
|
5158
|
-
|
|
5148
|
+
N.prototype.write = function(_, m, R) {
|
|
5159
5149
|
var D = this._writableState, G = !1, d = !D.objectMode && u(_);
|
|
5160
|
-
return d && !i.isBuffer(_) && (_ = f(_)), typeof
|
|
5161
|
-
},
|
|
5150
|
+
return d && !i.isBuffer(_) && (_ = f(_)), typeof m == "function" && (R = m, m = null), d ? m = "buffer" : m || (m = D.defaultEncoding), typeof R != "function" && (R = U), D.ending ? $(this, R) : (d || se(this, D, _, R)) && (D.pendingcb++, G = Ge(this, D, d, _, m, R)), G;
|
|
5151
|
+
}, N.prototype.cork = function() {
|
|
5162
5152
|
this._writableState.corked++;
|
|
5163
|
-
},
|
|
5153
|
+
}, N.prototype.uncork = function() {
|
|
5164
5154
|
var _ = this._writableState;
|
|
5165
5155
|
_.corked && (_.corked--, !_.writing && !_.corked && !_.bufferProcessing && _.bufferedRequest && Ce(this, _));
|
|
5166
|
-
},
|
|
5167
|
-
if (typeof
|
|
5168
|
-
return this._writableState.defaultEncoding =
|
|
5169
|
-
}, Object.defineProperty(
|
|
5156
|
+
}, N.prototype.setDefaultEncoding = function(m) {
|
|
5157
|
+
if (typeof m == "string" && (m = m.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((m + "").toLowerCase()) > -1)) throw new k(m);
|
|
5158
|
+
return this._writableState.defaultEncoding = m, this;
|
|
5159
|
+
}, Object.defineProperty(N.prototype, "writableBuffer", {
|
|
5170
5160
|
// making it explicit this property is not enumerable
|
|
5171
5161
|
// because otherwise some prototype manipulation in
|
|
5172
5162
|
// userland will fail
|
|
@@ -5175,10 +5165,10 @@ function ms() {
|
|
|
5175
5165
|
return this._writableState && this._writableState.getBuffer();
|
|
5176
5166
|
}
|
|
5177
5167
|
});
|
|
5178
|
-
function Te(_,
|
|
5179
|
-
return !_.objectMode && _.decodeStrings !== !1 && typeof
|
|
5168
|
+
function Te(_, m, R) {
|
|
5169
|
+
return !_.objectMode && _.decodeStrings !== !1 && typeof m == "string" && (m = i.from(m, R)), m;
|
|
5180
5170
|
}
|
|
5181
|
-
Object.defineProperty(
|
|
5171
|
+
Object.defineProperty(N.prototype, "writableHighWaterMark", {
|
|
5182
5172
|
// making it explicit this property is not enumerable
|
|
5183
5173
|
// because otherwise some prototype manipulation in
|
|
5184
5174
|
// userland will fail
|
|
@@ -5187,76 +5177,76 @@ function ms() {
|
|
|
5187
5177
|
return this._writableState.highWaterMark;
|
|
5188
5178
|
}
|
|
5189
5179
|
});
|
|
5190
|
-
function Ge(_,
|
|
5180
|
+
function Ge(_, m, R, D, G, d) {
|
|
5191
5181
|
if (!R) {
|
|
5192
|
-
var p = Te(
|
|
5182
|
+
var p = Te(m, D, G);
|
|
5193
5183
|
D !== p && (R = !0, G = "buffer", D = p);
|
|
5194
5184
|
}
|
|
5195
|
-
var A =
|
|
5196
|
-
|
|
5197
|
-
var O =
|
|
5198
|
-
if (O || (
|
|
5199
|
-
var Z =
|
|
5200
|
-
|
|
5185
|
+
var A = m.objectMode ? 1 : D.length;
|
|
5186
|
+
m.length += A;
|
|
5187
|
+
var O = m.length < m.highWaterMark;
|
|
5188
|
+
if (O || (m.needDrain = !0), m.writing || m.corked) {
|
|
5189
|
+
var Z = m.lastBufferedRequest;
|
|
5190
|
+
m.lastBufferedRequest = {
|
|
5201
5191
|
chunk: D,
|
|
5202
5192
|
encoding: G,
|
|
5203
5193
|
isBuf: R,
|
|
5204
5194
|
callback: d,
|
|
5205
5195
|
next: null
|
|
5206
|
-
}, Z ? Z.next =
|
|
5196
|
+
}, Z ? Z.next = m.lastBufferedRequest : m.bufferedRequest = m.lastBufferedRequest, m.bufferedRequestCount += 1;
|
|
5207
5197
|
} else
|
|
5208
|
-
ae(_,
|
|
5198
|
+
ae(_, m, !1, A, D, G, d);
|
|
5209
5199
|
return O;
|
|
5210
5200
|
}
|
|
5211
|
-
function ae(_,
|
|
5212
|
-
|
|
5201
|
+
function ae(_, m, R, D, G, d, p) {
|
|
5202
|
+
m.writelen = D, m.writecb = p, m.writing = !0, m.sync = !0, m.destroyed ? m.onwrite(new T("write")) : R ? _._writev(G, m.onwrite) : _._write(G, d, m.onwrite), m.sync = !1;
|
|
5213
5203
|
}
|
|
5214
|
-
function xe(_,
|
|
5215
|
-
--
|
|
5204
|
+
function xe(_, m, R, D, G) {
|
|
5205
|
+
--m.pendingcb, R ? (process.nextTick(G, D), process.nextTick(Be, _, m), _._writableState.errorEmitted = !0, L(_, D)) : (G(D), _._writableState.errorEmitted = !0, L(_, D), Be(_, m));
|
|
5216
5206
|
}
|
|
5217
5207
|
function ve(_) {
|
|
5218
5208
|
_.writing = !1, _.writecb = null, _.length -= _.writelen, _.writelen = 0;
|
|
5219
5209
|
}
|
|
5220
|
-
function et(_,
|
|
5210
|
+
function et(_, m) {
|
|
5221
5211
|
var R = _._writableState, D = R.sync, G = R.writecb;
|
|
5222
5212
|
if (typeof G != "function") throw new v();
|
|
5223
|
-
if (ve(R),
|
|
5213
|
+
if (ve(R), m) xe(_, R, D, m, G);
|
|
5224
5214
|
else {
|
|
5225
5215
|
var d = We(R) || _.destroyed;
|
|
5226
5216
|
!d && !R.corked && !R.bufferProcessing && R.bufferedRequest && Ce(_, R), D ? process.nextTick(Pe, _, R, d, G) : Pe(_, R, d, G);
|
|
5227
5217
|
}
|
|
5228
5218
|
}
|
|
5229
|
-
function Pe(_,
|
|
5230
|
-
R || je(_,
|
|
5219
|
+
function Pe(_, m, R, D) {
|
|
5220
|
+
R || je(_, m), m.pendingcb--, D(), Be(_, m);
|
|
5231
5221
|
}
|
|
5232
|
-
function je(_,
|
|
5233
|
-
|
|
5222
|
+
function je(_, m) {
|
|
5223
|
+
m.length === 0 && m.needDrain && (m.needDrain = !1, _.emit("drain"));
|
|
5234
5224
|
}
|
|
5235
|
-
function Ce(_,
|
|
5236
|
-
|
|
5237
|
-
var R =
|
|
5225
|
+
function Ce(_, m) {
|
|
5226
|
+
m.bufferProcessing = !0;
|
|
5227
|
+
var R = m.bufferedRequest;
|
|
5238
5228
|
if (_._writev && R && R.next) {
|
|
5239
|
-
var D =
|
|
5229
|
+
var D = m.bufferedRequestCount, G = new Array(D), d = m.corkedRequestsFree;
|
|
5240
5230
|
d.entry = R;
|
|
5241
5231
|
for (var p = 0, A = !0; R; )
|
|
5242
5232
|
G[p] = R, R.isBuf || (A = !1), R = R.next, p += 1;
|
|
5243
|
-
G.allBuffers = A, ae(_,
|
|
5233
|
+
G.allBuffers = A, ae(_, m, !0, m.length, G, "", d.finish), m.pendingcb++, m.lastBufferedRequest = null, d.next ? (m.corkedRequestsFree = d.next, d.next = null) : m.corkedRequestsFree = new e(m), m.bufferedRequestCount = 0;
|
|
5244
5234
|
} else {
|
|
5245
5235
|
for (; R; ) {
|
|
5246
|
-
var O = R.chunk, Z = R.encoding, j = R.callback, V =
|
|
5247
|
-
if (ae(_,
|
|
5236
|
+
var O = R.chunk, Z = R.encoding, j = R.callback, V = m.objectMode ? 1 : O.length;
|
|
5237
|
+
if (ae(_, m, !1, V, O, Z, j), R = R.next, m.bufferedRequestCount--, m.writing)
|
|
5248
5238
|
break;
|
|
5249
5239
|
}
|
|
5250
|
-
R === null && (
|
|
5240
|
+
R === null && (m.lastBufferedRequest = null);
|
|
5251
5241
|
}
|
|
5252
|
-
|
|
5242
|
+
m.bufferedRequest = R, m.bufferProcessing = !1;
|
|
5253
5243
|
}
|
|
5254
|
-
|
|
5244
|
+
N.prototype._write = function(_, m, R) {
|
|
5255
5245
|
R(new I("_write()"));
|
|
5256
|
-
},
|
|
5246
|
+
}, N.prototype._writev = null, N.prototype.end = function(_, m, R) {
|
|
5257
5247
|
var D = this._writableState;
|
|
5258
|
-
return typeof _ == "function" ? (R = _, _ = null,
|
|
5259
|
-
}, Object.defineProperty(
|
|
5248
|
+
return typeof _ == "function" ? (R = _, _ = null, m = null) : typeof m == "function" && (R = m, m = null), _ != null && this.write(_, m), D.corked && (D.corked = 1, this.uncork()), D.ending || qe(this, D, R), this;
|
|
5249
|
+
}, Object.defineProperty(N.prototype, "writableLength", {
|
|
5260
5250
|
// making it explicit this property is not enumerable
|
|
5261
5251
|
// because otherwise some prototype manipulation in
|
|
5262
5252
|
// userland will fail
|
|
@@ -5268,34 +5258,34 @@ function ms() {
|
|
|
5268
5258
|
function We(_) {
|
|
5269
5259
|
return _.ending && _.length === 0 && _.bufferedRequest === null && !_.finished && !_.writing;
|
|
5270
5260
|
}
|
|
5271
|
-
function Q(_,
|
|
5261
|
+
function Q(_, m) {
|
|
5272
5262
|
_._final(function(R) {
|
|
5273
|
-
|
|
5263
|
+
m.pendingcb--, R && L(_, R), m.prefinished = !0, _.emit("prefinish"), Be(_, m);
|
|
5274
5264
|
});
|
|
5275
5265
|
}
|
|
5276
|
-
function oe(_,
|
|
5277
|
-
!
|
|
5266
|
+
function oe(_, m) {
|
|
5267
|
+
!m.prefinished && !m.finalCalled && (typeof _._final == "function" && !m.destroyed ? (m.pendingcb++, m.finalCalled = !0, process.nextTick(Q, _, m)) : (m.prefinished = !0, _.emit("prefinish")));
|
|
5278
5268
|
}
|
|
5279
|
-
function Be(_,
|
|
5280
|
-
var R = We(
|
|
5281
|
-
if (R && (oe(_,
|
|
5269
|
+
function Be(_, m) {
|
|
5270
|
+
var R = We(m);
|
|
5271
|
+
if (R && (oe(_, m), m.pendingcb === 0 && (m.finished = !0, _.emit("finish"), m.autoDestroy))) {
|
|
5282
5272
|
var D = _._readableState;
|
|
5283
5273
|
(!D || D.autoDestroy && D.endEmitted) && _.destroy();
|
|
5284
5274
|
}
|
|
5285
5275
|
return R;
|
|
5286
5276
|
}
|
|
5287
|
-
function qe(_,
|
|
5288
|
-
|
|
5277
|
+
function qe(_, m, R) {
|
|
5278
|
+
m.ending = !0, Be(_, m), R && (m.finished ? process.nextTick(R) : _.once("finish", R)), m.ended = !0, _.writable = !1;
|
|
5289
5279
|
}
|
|
5290
|
-
function
|
|
5280
|
+
function Me(_, m, R) {
|
|
5291
5281
|
var D = _.entry;
|
|
5292
5282
|
for (_.entry = null; D; ) {
|
|
5293
5283
|
var G = D.callback;
|
|
5294
|
-
|
|
5284
|
+
m.pendingcb--, G(R), D = D.next;
|
|
5295
5285
|
}
|
|
5296
|
-
|
|
5286
|
+
m.corkedRequestsFree.next = _;
|
|
5297
5287
|
}
|
|
5298
|
-
return Object.defineProperty(
|
|
5288
|
+
return Object.defineProperty(N.prototype, "destroyed", {
|
|
5299
5289
|
// making it explicit this property is not enumerable
|
|
5300
5290
|
// because otherwise some prototype manipulation in
|
|
5301
5291
|
// userland will fail
|
|
@@ -5303,11 +5293,11 @@ function ms() {
|
|
|
5303
5293
|
get: function() {
|
|
5304
5294
|
return this._writableState === void 0 ? !1 : this._writableState.destroyed;
|
|
5305
5295
|
},
|
|
5306
|
-
set: function(
|
|
5307
|
-
this._writableState && (this._writableState.destroyed =
|
|
5296
|
+
set: function(m) {
|
|
5297
|
+
this._writableState && (this._writableState.destroyed = m);
|
|
5308
5298
|
}
|
|
5309
|
-
}),
|
|
5310
|
-
|
|
5299
|
+
}), N.prototype.destroy = l.destroy, N.prototype._undestroy = l.undestroy, N.prototype._destroy = function(_, m) {
|
|
5300
|
+
m(_);
|
|
5311
5301
|
}, Gr;
|
|
5312
5302
|
}
|
|
5313
5303
|
var jr, si;
|
|
@@ -5316,7 +5306,7 @@ function St() {
|
|
|
5316
5306
|
si = 1;
|
|
5317
5307
|
var e = Object.keys || function(y) {
|
|
5318
5308
|
var g = [];
|
|
5319
|
-
for (var
|
|
5309
|
+
for (var w in y) g.push(w);
|
|
5320
5310
|
return g;
|
|
5321
5311
|
};
|
|
5322
5312
|
jr = f;
|
|
@@ -5557,7 +5547,7 @@ function ws(e, t, r) {
|
|
|
5557
5547
|
n = !1, l = !0, i || r.call(e);
|
|
5558
5548
|
}, g = function(v) {
|
|
5559
5549
|
r.call(e, v);
|
|
5560
|
-
},
|
|
5550
|
+
}, w = function() {
|
|
5561
5551
|
var v;
|
|
5562
5552
|
if (n && !l)
|
|
5563
5553
|
return (!e._readableState || !e._readableState.ended) && (v = new ai()), r.call(e, v);
|
|
@@ -5566,8 +5556,8 @@ function ws(e, t, r) {
|
|
|
5566
5556
|
}, E = function() {
|
|
5567
5557
|
e.req.on("finish", u);
|
|
5568
5558
|
};
|
|
5569
|
-
return au(e) ? (e.on("complete", u), e.on("abort",
|
|
5570
|
-
e.removeListener("complete", u), e.removeListener("abort",
|
|
5559
|
+
return au(e) ? (e.on("complete", u), e.on("abort", w), e.req ? E() : e.on("request", E)) : i && !e._writableState && (e.on("end", a), e.on("close", a)), e.on("end", y), e.on("finish", u), t.error !== !1 && e.on("error", g), e.on("close", w), function() {
|
|
5560
|
+
e.removeListener("complete", u), e.removeListener("abort", w), e.removeListener("request", E), e.req && e.req.removeListener("finish", u), e.removeListener("end", a), e.removeListener("close", a), e.removeListener("finish", u), e.removeListener("end", y), e.removeListener("error", g), e.removeListener("close", w);
|
|
5571
5561
|
};
|
|
5572
5562
|
}
|
|
5573
5563
|
var Pn = ws, qr, fi;
|
|
@@ -5575,75 +5565,75 @@ function fu() {
|
|
|
5575
5565
|
if (fi) return qr;
|
|
5576
5566
|
fi = 1;
|
|
5577
5567
|
var e;
|
|
5578
|
-
function t(
|
|
5579
|
-
return
|
|
5568
|
+
function t(k, L, U) {
|
|
5569
|
+
return L = r(L), L in k ? Object.defineProperty(k, L, { value: U, enumerable: !0, configurable: !0, writable: !0 }) : k[L] = U, k;
|
|
5580
5570
|
}
|
|
5581
|
-
function r(
|
|
5582
|
-
var
|
|
5583
|
-
return typeof
|
|
5571
|
+
function r(k) {
|
|
5572
|
+
var L = n(k, "string");
|
|
5573
|
+
return typeof L == "symbol" ? L : String(L);
|
|
5584
5574
|
}
|
|
5585
|
-
function n(
|
|
5586
|
-
if (typeof
|
|
5587
|
-
var U =
|
|
5575
|
+
function n(k, L) {
|
|
5576
|
+
if (typeof k != "object" || k === null) return k;
|
|
5577
|
+
var U = k[Symbol.toPrimitive];
|
|
5588
5578
|
if (U !== void 0) {
|
|
5589
|
-
var S = U.call(
|
|
5579
|
+
var S = U.call(k, L || "default");
|
|
5590
5580
|
if (typeof S != "object") return S;
|
|
5591
5581
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5592
5582
|
}
|
|
5593
|
-
return (
|
|
5583
|
+
return (L === "string" ? String : Number)(k);
|
|
5594
5584
|
}
|
|
5595
|
-
var i = Pn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), y = Symbol("lastPromise"), g = Symbol("handlePromise"),
|
|
5596
|
-
function E(
|
|
5585
|
+
var i = Pn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), y = Symbol("lastPromise"), g = Symbol("handlePromise"), w = Symbol("stream");
|
|
5586
|
+
function E(k, L) {
|
|
5597
5587
|
return {
|
|
5598
|
-
value:
|
|
5599
|
-
done:
|
|
5588
|
+
value: k,
|
|
5589
|
+
done: L
|
|
5600
5590
|
};
|
|
5601
5591
|
}
|
|
5602
|
-
function I(
|
|
5603
|
-
var
|
|
5604
|
-
if (
|
|
5605
|
-
var U =
|
|
5606
|
-
U !== null && (
|
|
5592
|
+
function I(k) {
|
|
5593
|
+
var L = k[a];
|
|
5594
|
+
if (L !== null) {
|
|
5595
|
+
var U = k[w].read();
|
|
5596
|
+
U !== null && (k[y] = null, k[a] = null, k[f] = null, L(E(U, !1)));
|
|
5607
5597
|
}
|
|
5608
5598
|
}
|
|
5609
|
-
function v(
|
|
5610
|
-
process.nextTick(I,
|
|
5599
|
+
function v(k) {
|
|
5600
|
+
process.nextTick(I, k);
|
|
5611
5601
|
}
|
|
5612
|
-
function P(
|
|
5602
|
+
function P(k, L) {
|
|
5613
5603
|
return function(U, S) {
|
|
5614
|
-
|
|
5615
|
-
if (
|
|
5604
|
+
k.then(function() {
|
|
5605
|
+
if (L[l]) {
|
|
5616
5606
|
U(E(void 0, !0));
|
|
5617
5607
|
return;
|
|
5618
5608
|
}
|
|
5619
|
-
|
|
5609
|
+
L[g](U, S);
|
|
5620
5610
|
}, S);
|
|
5621
5611
|
};
|
|
5622
5612
|
}
|
|
5623
5613
|
var T = Object.getPrototypeOf(function() {
|
|
5624
5614
|
}), C = Object.setPrototypeOf((e = {
|
|
5625
5615
|
get stream() {
|
|
5626
|
-
return this[
|
|
5616
|
+
return this[w];
|
|
5627
5617
|
},
|
|
5628
5618
|
next: function() {
|
|
5629
|
-
var
|
|
5619
|
+
var L = this, U = this[u];
|
|
5630
5620
|
if (U !== null)
|
|
5631
5621
|
return Promise.reject(U);
|
|
5632
5622
|
if (this[l])
|
|
5633
5623
|
return Promise.resolve(E(void 0, !0));
|
|
5634
|
-
if (this[
|
|
5624
|
+
if (this[w].destroyed)
|
|
5635
5625
|
return new Promise(function($, se) {
|
|
5636
5626
|
process.nextTick(function() {
|
|
5637
|
-
|
|
5627
|
+
L[u] ? se(L[u]) : $(E(void 0, !0));
|
|
5638
5628
|
});
|
|
5639
5629
|
});
|
|
5640
5630
|
var S = this[y], z;
|
|
5641
5631
|
if (S)
|
|
5642
5632
|
z = new Promise(P(S, this));
|
|
5643
5633
|
else {
|
|
5644
|
-
var
|
|
5645
|
-
if (
|
|
5646
|
-
return Promise.resolve(E(
|
|
5634
|
+
var N = this[w].read();
|
|
5635
|
+
if (N !== null)
|
|
5636
|
+
return Promise.resolve(E(N, !1));
|
|
5647
5637
|
z = new Promise(this[g]);
|
|
5648
5638
|
}
|
|
5649
5639
|
return this[y] = z, z;
|
|
@@ -5651,9 +5641,9 @@ function fu() {
|
|
|
5651
5641
|
}, t(e, Symbol.asyncIterator, function() {
|
|
5652
5642
|
return this;
|
|
5653
5643
|
}), t(e, "return", function() {
|
|
5654
|
-
var
|
|
5644
|
+
var L = this;
|
|
5655
5645
|
return new Promise(function(U, S) {
|
|
5656
|
-
|
|
5646
|
+
L[w].destroy(null, function(z) {
|
|
5657
5647
|
if (z) {
|
|
5658
5648
|
S(z);
|
|
5659
5649
|
return;
|
|
@@ -5661,9 +5651,9 @@ function fu() {
|
|
|
5661
5651
|
U(E(void 0, !0));
|
|
5662
5652
|
});
|
|
5663
5653
|
});
|
|
5664
|
-
}), e), T), F = function(
|
|
5665
|
-
var U, S = Object.create(C, (U = {}, t(U,
|
|
5666
|
-
value:
|
|
5654
|
+
}), e), T), F = function(L) {
|
|
5655
|
+
var U, S = Object.create(C, (U = {}, t(U, w, {
|
|
5656
|
+
value: L,
|
|
5667
5657
|
writable: !0
|
|
5668
5658
|
}), t(U, a, {
|
|
5669
5659
|
value: null,
|
|
@@ -5675,24 +5665,24 @@ function fu() {
|
|
|
5675
5665
|
value: null,
|
|
5676
5666
|
writable: !0
|
|
5677
5667
|
}), t(U, l, {
|
|
5678
|
-
value:
|
|
5668
|
+
value: L._readableState.endEmitted,
|
|
5679
5669
|
writable: !0
|
|
5680
5670
|
}), t(U, g, {
|
|
5681
|
-
value: function(
|
|
5682
|
-
var se = S[
|
|
5683
|
-
se ? (S[y] = null, S[a] = null, S[f] = null,
|
|
5671
|
+
value: function(N, $) {
|
|
5672
|
+
var se = S[w].read();
|
|
5673
|
+
se ? (S[y] = null, S[a] = null, S[f] = null, N(E(se, !1))) : (S[a] = N, S[f] = $);
|
|
5684
5674
|
},
|
|
5685
5675
|
writable: !0
|
|
5686
5676
|
}), U));
|
|
5687
|
-
return S[y] = null, i(
|
|
5677
|
+
return S[y] = null, i(L, function(z) {
|
|
5688
5678
|
if (z && z.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
5689
|
-
var
|
|
5690
|
-
|
|
5679
|
+
var N = S[f];
|
|
5680
|
+
N !== null && (S[y] = null, S[a] = null, S[f] = null, N(z)), S[u] = z;
|
|
5691
5681
|
return;
|
|
5692
5682
|
}
|
|
5693
5683
|
var $ = S[a];
|
|
5694
5684
|
$ !== null && (S[y] = null, S[a] = null, S[f] = null, $(E(void 0, !0))), S[l] = !0;
|
|
5695
|
-
}),
|
|
5685
|
+
}), L.on("readable", v.bind(null, S)), S;
|
|
5696
5686
|
};
|
|
5697
5687
|
return qr = F, qr;
|
|
5698
5688
|
}
|
|
@@ -5707,7 +5697,7 @@ function _s() {
|
|
|
5707
5697
|
if (ci) return Kr;
|
|
5708
5698
|
ci = 1, Kr = $;
|
|
5709
5699
|
var e;
|
|
5710
|
-
$.ReadableState =
|
|
5700
|
+
$.ReadableState = N, ds.EventEmitter;
|
|
5711
5701
|
var t = function(p, A) {
|
|
5712
5702
|
return p.listeners(A).length;
|
|
5713
5703
|
}, r = ps, n = Rt.Buffer, i = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5721,20 +5711,20 @@ function _s() {
|
|
|
5721
5711
|
var u = Rn, l;
|
|
5722
5712
|
u && u.debuglog ? l = u.debuglog("stream") : l = function() {
|
|
5723
5713
|
};
|
|
5724
|
-
var y =
|
|
5714
|
+
var y = kf(), g = bs, w = gs, E = w.getHighWaterMark, I = ct.codes, v = I.ERR_INVALID_ARG_TYPE, P = I.ERR_STREAM_PUSH_AFTER_EOF, T = I.ERR_METHOD_NOT_IMPLEMENTED, C = I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, F, k, L;
|
|
5725
5715
|
ge($, r);
|
|
5726
5716
|
var U = g.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
|
|
5727
5717
|
function z(d, p, A) {
|
|
5728
5718
|
if (typeof d.prependListener == "function") return d.prependListener(p, A);
|
|
5729
5719
|
!d._events || !d._events[p] ? d.on(p, A) : Array.isArray(d._events[p]) ? d._events[p].unshift(A) : d._events[p] = [A, d._events[p]];
|
|
5730
5720
|
}
|
|
5731
|
-
function
|
|
5721
|
+
function N(d, p, A) {
|
|
5732
5722
|
e = e || St(), d = d || {}, typeof A != "boolean" && (A = p instanceof e), this.objectMode = !!d.objectMode, A && (this.objectMode = this.objectMode || !!d.readableObjectMode), this.highWaterMark = E(this, d, "readableHighWaterMark", A), this.buffer = new y(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = d.emitClose !== !1, this.autoDestroy = !!d.autoDestroy, this.destroyed = !1, this.defaultEncoding = d.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, d.encoding && (F || (F = gr.StringDecoder), this.decoder = new F(d.encoding), this.encoding = d.encoding);
|
|
5733
5723
|
}
|
|
5734
5724
|
function $(d) {
|
|
5735
5725
|
if (e = e || St(), !(this instanceof $)) return new $(d);
|
|
5736
5726
|
var p = this instanceof e;
|
|
5737
|
-
this._readableState = new
|
|
5727
|
+
this._readableState = new N(d, this, p), this.readable = !0, d && (typeof d.read == "function" && (this._read = d.read), typeof d.destroy == "function" && (this._destroy = d.destroy)), r.call(this);
|
|
5738
5728
|
}
|
|
5739
5729
|
Object.defineProperty($.prototype, "destroyed", {
|
|
5740
5730
|
// making it explicit this property is not enumerable
|
|
@@ -5812,7 +5802,7 @@ function _s() {
|
|
|
5812
5802
|
var O = p.needReadable;
|
|
5813
5803
|
l("need readable", O), (p.length === 0 || p.length - d < p.highWaterMark) && (O = !0, l("length less than watermark", O)), p.ended || p.reading ? (O = !1, l("reading or ended", O)) : O && (l("do read"), p.reading = !0, p.sync = !0, p.length === 0 && (p.needReadable = !0), this._read(p.highWaterMark), p.sync = !1, p.reading || (d = ve(A, p)));
|
|
5814
5804
|
var Z;
|
|
5815
|
-
return d > 0 ? Z =
|
|
5805
|
+
return d > 0 ? Z = m(d, p) : Z = null, Z === null ? (p.needReadable = p.length <= p.highWaterMark, d = 0) : (p.length -= d, p.awaitDrain = 0), p.length === 0 && (p.ended || (p.needReadable = !0), A !== d && p.ended && R(this)), Z !== null && this.emit("data", Z), Z;
|
|
5816
5806
|
};
|
|
5817
5807
|
function et(d, p) {
|
|
5818
5808
|
if (l("onEofChunk"), !p.ended) {
|
|
@@ -5940,9 +5930,9 @@ function _s() {
|
|
|
5940
5930
|
return d.flowing || (l("resume"), d.flowing = !d.readableListening, qe(this, d)), d.paused = !1, this;
|
|
5941
5931
|
};
|
|
5942
5932
|
function qe(d, p) {
|
|
5943
|
-
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(
|
|
5933
|
+
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(Me, d, p));
|
|
5944
5934
|
}
|
|
5945
|
-
function
|
|
5935
|
+
function Me(d, p) {
|
|
5946
5936
|
l("resume", p.reading), p.reading || d.read(0), p.resumeScheduled = !1, d.emit("resume"), _(d), p.flowing && !p.reading && d.read(0);
|
|
5947
5937
|
}
|
|
5948
5938
|
$.prototype.pause = function() {
|
|
@@ -5978,7 +5968,7 @@ function _s() {
|
|
|
5978
5968
|
l("wrapped _read", V), O && (O = !1, d.resume());
|
|
5979
5969
|
}, this;
|
|
5980
5970
|
}, typeof Symbol == "function" && ($.prototype[Symbol.asyncIterator] = function() {
|
|
5981
|
-
return
|
|
5971
|
+
return k === void 0 && (k = fu()), k(this);
|
|
5982
5972
|
}), Object.defineProperty($.prototype, "readableHighWaterMark", {
|
|
5983
5973
|
// making it explicit this property is not enumerable
|
|
5984
5974
|
// because otherwise some prototype manipulation in
|
|
@@ -6006,7 +5996,7 @@ function _s() {
|
|
|
6006
5996
|
set: function(p) {
|
|
6007
5997
|
this._readableState && (this._readableState.flowing = p);
|
|
6008
5998
|
}
|
|
6009
|
-
}), $._fromList =
|
|
5999
|
+
}), $._fromList = m, Object.defineProperty($.prototype, "readableLength", {
|
|
6010
6000
|
// making it explicit this property is not enumerable
|
|
6011
6001
|
// because otherwise some prototype manipulation in
|
|
6012
6002
|
// userland will fail
|
|
@@ -6015,7 +6005,7 @@ function _s() {
|
|
|
6015
6005
|
return this._readableState.length;
|
|
6016
6006
|
}
|
|
6017
6007
|
});
|
|
6018
|
-
function
|
|
6008
|
+
function m(d, p) {
|
|
6019
6009
|
if (p.length === 0) return null;
|
|
6020
6010
|
var A;
|
|
6021
6011
|
return p.objectMode ? A = p.buffer.shift() : !d || d >= p.length ? (p.decoder ? A = p.buffer.join("") : p.buffer.length === 1 ? A = p.buffer.first() : A = p.buffer.concat(p.length), p.buffer.clear()) : A = p.buffer.consume(d, p.decoder), A;
|
|
@@ -6031,7 +6021,7 @@ function _s() {
|
|
|
6031
6021
|
}
|
|
6032
6022
|
}
|
|
6033
6023
|
typeof Symbol == "function" && ($.from = function(d, p) {
|
|
6034
|
-
return
|
|
6024
|
+
return L === void 0 && (L = uu()), L($, d, p);
|
|
6035
6025
|
});
|
|
6036
6026
|
function G(d, p) {
|
|
6037
6027
|
for (var A = 0, O = d.length; A < O; A++)
|
|
@@ -6251,7 +6241,7 @@ function de(e, t, r, n, i, a, f) {
|
|
|
6251
6241
|
function pe(e, t, r, n, i, a, f) {
|
|
6252
6242
|
return Ar(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
|
|
6253
6243
|
}
|
|
6254
|
-
var
|
|
6244
|
+
var Lu = Ir, Jr = Rt.Buffer, ku = ge, As = Ss, Fu = new Array(16), Nt = [
|
|
6255
6245
|
0,
|
|
6256
6246
|
1,
|
|
6257
6247
|
2,
|
|
@@ -6579,15 +6569,15 @@ var ku = Ir, Jr = Rt.Buffer, Lu = ge, As = Ss, Fu = new Array(16), Mt = [
|
|
|
6579
6569
|
function Rr() {
|
|
6580
6570
|
As.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
|
|
6581
6571
|
}
|
|
6582
|
-
|
|
6572
|
+
ku(Rr, As);
|
|
6583
6573
|
Rr.prototype._update = function() {
|
|
6584
6574
|
for (var e = Fu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6585
|
-
for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._a | 0, l = this._b | 0, y = this._c | 0, g = this._d | 0,
|
|
6575
|
+
for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._a | 0, l = this._b | 0, y = this._c | 0, g = this._d | 0, w = this._e | 0, E = 0; E < 80; E += 1) {
|
|
6586
6576
|
var I, v;
|
|
6587
|
-
E < 16 ? (I = pi(r, n, i, a, f, e[
|
|
6577
|
+
E < 16 ? (I = pi(r, n, i, a, f, e[Nt[E]], zt[0], $t[E]), v = mi(u, l, y, g, w, e[Dt[E]], Gt[0], Ht[E])) : E < 32 ? (I = bi(r, n, i, a, f, e[Nt[E]], zt[1], $t[E]), v = gi(u, l, y, g, w, e[Dt[E]], Gt[1], Ht[E])) : E < 48 ? (I = yi(r, n, i, a, f, e[Nt[E]], zt[2], $t[E]), v = yi(u, l, y, g, w, e[Dt[E]], Gt[2], Ht[E])) : E < 64 ? (I = gi(r, n, i, a, f, e[Nt[E]], zt[3], $t[E]), v = bi(u, l, y, g, w, e[Dt[E]], Gt[3], Ht[E])) : (I = mi(r, n, i, a, f, e[Nt[E]], zt[4], $t[E]), v = pi(u, l, y, g, w, e[Dt[E]], Gt[4], Ht[E])), r = f, f = a, a = ut(i, 10), i = n, n = I, u = w, w = g, g = ut(y, 10), y = l, l = v;
|
|
6588
6578
|
}
|
|
6589
6579
|
var P = this._b + i + g | 0;
|
|
6590
|
-
this._b = this._c + a +
|
|
6580
|
+
this._b = this._c + a + w | 0, this._c = this._d + f + u | 0, this._d = this._e + r + l | 0, this._e = this._a + n + y | 0, this._a = P;
|
|
6591
6581
|
};
|
|
6592
6582
|
Rr.prototype._digest = function() {
|
|
6593
6583
|
this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();
|
|
@@ -6642,7 +6632,7 @@ Tr.prototype.digest = function(e) {
|
|
|
6642
6632
|
Tr.prototype._update = function() {
|
|
6643
6633
|
throw new Error("_update must be implemented by subclass");
|
|
6644
6634
|
};
|
|
6645
|
-
var Tt = Tr, Ou = ge, Ps = Tt,
|
|
6635
|
+
var Tt = Tr, Ou = ge, Ps = Tt, Mu = Ee.Buffer, Nu = [
|
|
6646
6636
|
1518500249,
|
|
6647
6637
|
1859775393,
|
|
6648
6638
|
-1894007588,
|
|
@@ -6668,13 +6658,13 @@ Qt.prototype._update = function(e) {
|
|
|
6668
6658
|
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = 0; u < 16; ++u) t[u] = e.readInt32BE(u * 4);
|
|
6669
6659
|
for (; u < 80; ++u) t[u] = t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16];
|
|
6670
6660
|
for (var l = 0; l < 80; ++l) {
|
|
6671
|
-
var y = ~~(l / 20), g = $u(r) + zu(y, n, i, a) + f + t[l] +
|
|
6661
|
+
var y = ~~(l / 20), g = $u(r) + zu(y, n, i, a) + f + t[l] + Nu[y] | 0;
|
|
6672
6662
|
f = a, a = i, i = Hu(n), n = r, r = g;
|
|
6673
6663
|
}
|
|
6674
6664
|
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0;
|
|
6675
6665
|
};
|
|
6676
6666
|
Qt.prototype._hash = function() {
|
|
6677
|
-
var e =
|
|
6667
|
+
var e = Mu.allocUnsafe(20);
|
|
6678
6668
|
return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
|
|
6679
6669
|
};
|
|
6680
6670
|
var Gu = Qt, ju = ge, Cs = Tt, Wu = Ee.Buffer, qu = [
|
|
@@ -6715,7 +6705,7 @@ Zt.prototype._hash = function() {
|
|
|
6715
6705
|
var e = Wu.allocUnsafe(20);
|
|
6716
6706
|
return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
|
|
6717
6707
|
};
|
|
6718
|
-
var Qu = Zt, Zu = ge,
|
|
6708
|
+
var Qu = Zt, Zu = ge, Ls = Tt, ec = Ee.Buffer, tc = [
|
|
6719
6709
|
1116352408,
|
|
6720
6710
|
1899447441,
|
|
6721
6711
|
3049323471,
|
|
@@ -6782,9 +6772,9 @@ var Qu = Zt, Zu = ge, ks = Tt, ec = Ee.Buffer, tc = [
|
|
|
6782
6772
|
3329325298
|
|
6783
6773
|
], rc = new Array(64);
|
|
6784
6774
|
function er() {
|
|
6785
|
-
this.init(), this._w = rc,
|
|
6775
|
+
this.init(), this._w = rc, Ls.call(this, 64, 56);
|
|
6786
6776
|
}
|
|
6787
|
-
Zu(er,
|
|
6777
|
+
Zu(er, Ls);
|
|
6788
6778
|
er.prototype.init = function() {
|
|
6789
6779
|
return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
|
|
6790
6780
|
};
|
|
@@ -6809,8 +6799,8 @@ function fc(e) {
|
|
|
6809
6799
|
er.prototype._update = function(e) {
|
|
6810
6800
|
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._f | 0, l = this._g | 0, y = this._h | 0, g = 0; g < 16; ++g) t[g] = e.readInt32BE(g * 4);
|
|
6811
6801
|
for (; g < 64; ++g) t[g] = fc(t[g - 2]) + t[g - 7] + ac(t[g - 15]) + t[g - 16] | 0;
|
|
6812
|
-
for (var
|
|
6813
|
-
var E = y + oc(f) + nc(f, u, l) + tc[
|
|
6802
|
+
for (var w = 0; w < 64; ++w) {
|
|
6803
|
+
var E = y + oc(f) + nc(f, u, l) + tc[w] + t[w] | 0, I = sc(r) + ic(r, n, i) | 0;
|
|
6814
6804
|
y = l, l = u, u = f, f = a + E | 0, a = i, i = n, n = r, r = E + I | 0;
|
|
6815
6805
|
}
|
|
6816
6806
|
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0, this._f = u + this._f | 0, this._g = l + this._g | 0, this._h = y + this._h | 0;
|
|
@@ -6819,7 +6809,7 @@ er.prototype._hash = function() {
|
|
|
6819
6809
|
var e = ec.allocUnsafe(32);
|
|
6820
6810
|
return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e.writeInt32BE(this._h, 28), e;
|
|
6821
6811
|
};
|
|
6822
|
-
var
|
|
6812
|
+
var ks = er, uc = ge, cc = ks, lc = Tt, hc = Ee.Buffer, dc = new Array(64);
|
|
6823
6813
|
function Pr() {
|
|
6824
6814
|
this.init(), this._w = dc, lc.call(this, 64, 56);
|
|
6825
6815
|
}
|
|
@@ -7028,22 +7018,22 @@ function ue(e, t) {
|
|
|
7028
7018
|
return e >>> 0 < t >>> 0 ? 1 : 0;
|
|
7029
7019
|
}
|
|
7030
7020
|
tr.prototype._update = function(e) {
|
|
7031
|
-
for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0, y = this._hh | 0, g = this._al | 0,
|
|
7021
|
+
for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0, y = this._hh | 0, g = this._al | 0, w = this._bl | 0, E = this._cl | 0, I = this._dl | 0, v = this._el | 0, P = this._fl | 0, T = this._gl | 0, C = this._hl | 0, F = 0; F < 32; F += 2)
|
|
7032
7022
|
t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
|
|
7033
7023
|
for (; F < 160; F += 2) {
|
|
7034
|
-
var
|
|
7035
|
-
|
|
7036
|
-
var z = _c(
|
|
7037
|
-
ae = ae +
|
|
7024
|
+
var k = t[F - 30], L = t[F - 15 * 2 + 1], U = mc(k, L), S = wc(L, k);
|
|
7025
|
+
k = t[F - 2 * 2], L = t[F - 2 * 2 + 1];
|
|
7026
|
+
var z = _c(k, L), N = xc(L, k), $ = t[F - 7 * 2], se = t[F - 7 * 2 + 1], Te = t[F - 16 * 2], Ge = t[F - 16 * 2 + 1], ae = S + se | 0, xe = U + $ + ue(ae, S) | 0;
|
|
7027
|
+
ae = ae + N | 0, xe = xe + z + ue(ae, N) | 0, ae = ae + Ge | 0, xe = xe + Te + ue(ae, Ge) | 0, t[F] = xe, t[F + 1] = ae;
|
|
7038
7028
|
}
|
|
7039
7029
|
for (var ve = 0; ve < 160; ve += 2) {
|
|
7040
7030
|
xe = t[ve], ae = t[ve + 1];
|
|
7041
|
-
var et = xi(r, n, i), Pe = xi(g,
|
|
7042
|
-
_ = _ +
|
|
7031
|
+
var et = xi(r, n, i), Pe = xi(g, w, E), je = vi(r, g), Ce = vi(g, r), We = Ei(f, v), Q = Ei(v, f), oe = wi[ve], Be = wi[ve + 1], qe = _i(f, u, l), Me = _i(v, P, T), _ = C + Q | 0, m = y + We + ue(_, C) | 0;
|
|
7032
|
+
_ = _ + Me | 0, m = m + qe + ue(_, Me) | 0, _ = _ + Be | 0, m = m + oe + ue(_, Be) | 0, _ = _ + ae | 0, m = m + xe + ue(_, ae) | 0;
|
|
7043
7033
|
var R = Ce + Pe | 0, D = je + et + ue(R, Ce) | 0;
|
|
7044
|
-
y = l, C = T, l = u, T = P, u = f, P = v, v = I + _ | 0, f = a +
|
|
7034
|
+
y = l, C = T, l = u, T = P, u = f, P = v, v = I + _ | 0, f = a + m + ue(v, I) | 0, a = i, I = E, i = n, E = w, n = r, w = g, g = _ + R | 0, r = m + D + ue(g, _) | 0;
|
|
7045
7035
|
}
|
|
7046
|
-
this._al = this._al + g | 0, this._bl = this._bl +
|
|
7036
|
+
this._al = this._al + g | 0, this._bl = this._bl + w | 0, this._cl = this._cl + E | 0, this._dl = this._dl + I | 0, this._el = this._el + v | 0, this._fl = this._fl + P | 0, this._gl = this._gl + T | 0, this._hl = this._hl + C | 0, this._ah = this._ah + r + ue(this._al, g) | 0, this._bh = this._bh + n + ue(this._bl, w) | 0, this._ch = this._ch + i + ue(this._cl, E) | 0, this._dh = this._dh + a + ue(this._dl, I) | 0, this._eh = this._eh + f + ue(this._el, v) | 0, this._fh = this._fh + u + ue(this._fl, P) | 0, this._gh = this._gh + l + ue(this._gl, T) | 0, this._hh = this._hh + y + ue(this._hl, C) | 0;
|
|
7047
7037
|
};
|
|
7048
7038
|
tr.prototype._hash = function() {
|
|
7049
7039
|
var e = yc.allocUnsafe(64);
|
|
@@ -7076,31 +7066,31 @@ var Ac = Cr, lt = Rs.exports = function(t) {
|
|
|
7076
7066
|
lt.sha = Gu;
|
|
7077
7067
|
lt.sha1 = Qu;
|
|
7078
7068
|
lt.sha224 = pc;
|
|
7079
|
-
lt.sha256 =
|
|
7069
|
+
lt.sha256 = ks;
|
|
7080
7070
|
lt.sha384 = Ac;
|
|
7081
7071
|
lt.sha512 = Us;
|
|
7082
|
-
var Rc = Rs.exports, Os = Ee.Buffer,
|
|
7083
|
-
function
|
|
7084
|
-
|
|
7072
|
+
var Rc = Rs.exports, Os = Ee.Buffer, Ms = Rn.Transform, Tc = gr.StringDecoder, Pc = ge;
|
|
7073
|
+
function Le(e) {
|
|
7074
|
+
Ms.call(this), this.hashMode = typeof e == "string", this.hashMode ? this[e] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null;
|
|
7085
7075
|
}
|
|
7086
|
-
Pc(
|
|
7087
|
-
|
|
7076
|
+
Pc(Le, Ms);
|
|
7077
|
+
Le.prototype.update = function(e, t, r) {
|
|
7088
7078
|
typeof e == "string" && (e = Os.from(e, t));
|
|
7089
7079
|
var n = this._update(e);
|
|
7090
7080
|
return this.hashMode ? this : (r && (n = this._toString(n, r)), n);
|
|
7091
7081
|
};
|
|
7092
|
-
|
|
7082
|
+
Le.prototype.setAutoPadding = function() {
|
|
7093
7083
|
};
|
|
7094
|
-
|
|
7084
|
+
Le.prototype.getAuthTag = function() {
|
|
7095
7085
|
throw new Error("trying to get auth tag in unsupported state");
|
|
7096
7086
|
};
|
|
7097
|
-
|
|
7087
|
+
Le.prototype.setAuthTag = function() {
|
|
7098
7088
|
throw new Error("trying to set auth tag in unsupported state");
|
|
7099
7089
|
};
|
|
7100
|
-
|
|
7090
|
+
Le.prototype.setAAD = function() {
|
|
7101
7091
|
throw new Error("trying to set aad in unsupported state");
|
|
7102
7092
|
};
|
|
7103
|
-
|
|
7093
|
+
Le.prototype._transform = function(e, t, r) {
|
|
7104
7094
|
var n;
|
|
7105
7095
|
try {
|
|
7106
7096
|
this.hashMode ? this._update(e) : this.push(this._update(e));
|
|
@@ -7110,7 +7100,7 @@ ke.prototype._transform = function(e, t, r) {
|
|
|
7110
7100
|
r(n);
|
|
7111
7101
|
}
|
|
7112
7102
|
};
|
|
7113
|
-
|
|
7103
|
+
Le.prototype._flush = function(e) {
|
|
7114
7104
|
var t;
|
|
7115
7105
|
try {
|
|
7116
7106
|
this.push(this.__final());
|
|
@@ -7119,30 +7109,30 @@ ke.prototype._flush = function(e) {
|
|
|
7119
7109
|
}
|
|
7120
7110
|
e(t);
|
|
7121
7111
|
};
|
|
7122
|
-
|
|
7112
|
+
Le.prototype._finalOrDigest = function(e) {
|
|
7123
7113
|
var t = this.__final() || Os.alloc(0);
|
|
7124
7114
|
return e && (t = this._toString(t, e, !0)), t;
|
|
7125
7115
|
};
|
|
7126
|
-
|
|
7116
|
+
Le.prototype._toString = function(e, t, r) {
|
|
7127
7117
|
if (this._decoder || (this._decoder = new Tc(t), this._encoding = t), this._encoding !== t) throw new Error("can't switch encodings");
|
|
7128
7118
|
var n = this._decoder.write(e);
|
|
7129
7119
|
return r && (n += this._decoder.end()), n;
|
|
7130
7120
|
};
|
|
7131
|
-
var Cc =
|
|
7132
|
-
function
|
|
7133
|
-
|
|
7121
|
+
var Cc = Le, Lc = ge, kc = Lu, Fc = Uu, Uc = Rc, Ns = Cc;
|
|
7122
|
+
function Lr(e) {
|
|
7123
|
+
Ns.call(this, "digest"), this._hash = e;
|
|
7134
7124
|
}
|
|
7135
|
-
|
|
7136
|
-
|
|
7125
|
+
Lc(Lr, Ns);
|
|
7126
|
+
Lr.prototype._update = function(e) {
|
|
7137
7127
|
this._hash.update(e);
|
|
7138
7128
|
};
|
|
7139
|
-
|
|
7129
|
+
Lr.prototype._final = function() {
|
|
7140
7130
|
return this._hash.digest();
|
|
7141
7131
|
};
|
|
7142
7132
|
var Oc = function(t) {
|
|
7143
|
-
return t = t.toLowerCase(), t === "md5" ? new
|
|
7133
|
+
return t = t.toLowerCase(), t === "md5" ? new kc() : t === "rmd160" || t === "ripemd160" ? new Fc() : new Lr(Uc(t));
|
|
7144
7134
|
}, ar = Ee.Buffer;
|
|
7145
|
-
function
|
|
7135
|
+
function Mc(e) {
|
|
7146
7136
|
if (e.length >= 255)
|
|
7147
7137
|
throw new TypeError("Alphabet too long");
|
|
7148
7138
|
for (var t = new Uint8Array(256), r = 0; r < t.length; r++)
|
|
@@ -7161,20 +7151,20 @@ function Nc(e) {
|
|
|
7161
7151
|
return "";
|
|
7162
7152
|
for (var v = 0, P = 0, T = 0, C = I.length; T !== C && I[T] === 0; )
|
|
7163
7153
|
T++, v++;
|
|
7164
|
-
for (var F = (C - T) * y + 1 >>> 0,
|
|
7165
|
-
for (var
|
|
7166
|
-
|
|
7167
|
-
if (
|
|
7154
|
+
for (var F = (C - T) * y + 1 >>> 0, k = new Uint8Array(F); T !== C; ) {
|
|
7155
|
+
for (var L = I[T], U = 0, S = F - 1; (L !== 0 || U < P) && S !== -1; S--, U++)
|
|
7156
|
+
L += 256 * k[S] >>> 0, k[S] = L % f >>> 0, L = L / f >>> 0;
|
|
7157
|
+
if (L !== 0)
|
|
7168
7158
|
throw new Error("Non-zero carry");
|
|
7169
7159
|
P = U, T++;
|
|
7170
7160
|
}
|
|
7171
|
-
for (var z = F - P; z !== F &&
|
|
7161
|
+
for (var z = F - P; z !== F && k[z] === 0; )
|
|
7172
7162
|
z++;
|
|
7173
|
-
for (var
|
|
7174
|
-
|
|
7175
|
-
return
|
|
7163
|
+
for (var N = u.repeat(v); z < F; ++z)
|
|
7164
|
+
N += e.charAt(k[z]);
|
|
7165
|
+
return N;
|
|
7176
7166
|
}
|
|
7177
|
-
function
|
|
7167
|
+
function w(I) {
|
|
7178
7168
|
if (typeof I != "string")
|
|
7179
7169
|
throw new TypeError("Expected String");
|
|
7180
7170
|
if (I.length === 0)
|
|
@@ -7182,36 +7172,36 @@ function Nc(e) {
|
|
|
7182
7172
|
for (var v = 0, P = 0, T = 0; I[v] === u; )
|
|
7183
7173
|
P++, v++;
|
|
7184
7174
|
for (var C = (I.length - v) * l + 1 >>> 0, F = new Uint8Array(C); v < I.length; ) {
|
|
7185
|
-
var
|
|
7186
|
-
if (
|
|
7175
|
+
var k = t[I.charCodeAt(v)];
|
|
7176
|
+
if (k === 255)
|
|
7187
7177
|
return;
|
|
7188
|
-
for (var
|
|
7189
|
-
|
|
7190
|
-
if (
|
|
7178
|
+
for (var L = 0, U = C - 1; (k !== 0 || L < T) && U !== -1; U--, L++)
|
|
7179
|
+
k += f * F[U] >>> 0, F[U] = k % 256 >>> 0, k = k / 256 >>> 0;
|
|
7180
|
+
if (k !== 0)
|
|
7191
7181
|
throw new Error("Non-zero carry");
|
|
7192
|
-
T =
|
|
7182
|
+
T = L, v++;
|
|
7193
7183
|
}
|
|
7194
7184
|
for (var S = C - T; S !== C && F[S] === 0; )
|
|
7195
7185
|
S++;
|
|
7196
7186
|
var z = ar.allocUnsafe(P + (C - S));
|
|
7197
7187
|
z.fill(0, 0, P);
|
|
7198
|
-
for (var
|
|
7199
|
-
z[
|
|
7188
|
+
for (var N = P; S !== C; )
|
|
7189
|
+
z[N++] = F[S++];
|
|
7200
7190
|
return z;
|
|
7201
7191
|
}
|
|
7202
7192
|
function E(I) {
|
|
7203
|
-
var v =
|
|
7193
|
+
var v = w(I);
|
|
7204
7194
|
if (v)
|
|
7205
7195
|
return v;
|
|
7206
7196
|
throw new Error("Non-base" + f + " character");
|
|
7207
7197
|
}
|
|
7208
7198
|
return {
|
|
7209
7199
|
encode: g,
|
|
7210
|
-
decodeUnsafe:
|
|
7200
|
+
decodeUnsafe: w,
|
|
7211
7201
|
decode: E
|
|
7212
7202
|
};
|
|
7213
7203
|
}
|
|
7214
|
-
var
|
|
7204
|
+
var Nc = Mc, Dc = Nc, $c = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", Hc = Dc($c), Xr = Hc, zc = Ee.Buffer, Gc = function(e) {
|
|
7215
7205
|
function t(a) {
|
|
7216
7206
|
var f = e(a);
|
|
7217
7207
|
return Xr.encode(zc.concat([
|
|
@@ -7282,9 +7272,9 @@ var Yc = {
|
|
|
7282
7272
|
decodeRaw: Ds,
|
|
7283
7273
|
encode: Kc,
|
|
7284
7274
|
encodeRaw: ln
|
|
7285
|
-
},
|
|
7286
|
-
Object.defineProperty(
|
|
7287
|
-
|
|
7275
|
+
}, kr = {};
|
|
7276
|
+
Object.defineProperty(kr, "__esModule", { value: !0 });
|
|
7277
|
+
kr.testEcc = void 0;
|
|
7288
7278
|
const H = (e) => Buffer.from(e, "hex");
|
|
7289
7279
|
function Jc(e) {
|
|
7290
7280
|
J(
|
|
@@ -7476,7 +7466,7 @@ function Jc(e) {
|
|
|
7476
7466
|
)
|
|
7477
7467
|
);
|
|
7478
7468
|
}
|
|
7479
|
-
|
|
7469
|
+
kr.testEcc = Jc;
|
|
7480
7470
|
function J(e) {
|
|
7481
7471
|
if (!e) throw new Error("ecc library invalid");
|
|
7482
7472
|
}
|
|
@@ -7484,13 +7474,13 @@ Object.defineProperty(Et, "__esModule", { value: !0 });
|
|
|
7484
7474
|
Et.ECPairFactory = Et.networks = void 0;
|
|
7485
7475
|
const hn = Bt;
|
|
7486
7476
|
Et.networks = hn;
|
|
7487
|
-
const we = Qi, Xc = Bf, Si = Yc, Qc =
|
|
7477
|
+
const we = Qi, Xc = Bf, Si = Yc, Qc = kr, Qr = we.typeforce.maybe(
|
|
7488
7478
|
we.typeforce.compile({
|
|
7489
7479
|
compressed: we.maybe(we.Boolean),
|
|
7490
7480
|
network: we.maybe(we.Network)
|
|
7491
7481
|
})
|
|
7492
7482
|
), Zc = (e) => e.length === 32 ? e : e.slice(1, 33);
|
|
7493
|
-
function
|
|
7483
|
+
function e0(e) {
|
|
7494
7484
|
(0, Qc.testEcc)(e);
|
|
7495
7485
|
function t(u) {
|
|
7496
7486
|
return e.isPoint(u);
|
|
@@ -7506,7 +7496,7 @@ function el(e) {
|
|
|
7506
7496
|
function i(u, l) {
|
|
7507
7497
|
const y = Si.decode(u), g = y.version;
|
|
7508
7498
|
if (we.Array(l)) {
|
|
7509
|
-
if (l = l.filter((
|
|
7499
|
+
if (l = l.filter((w) => g === w.wif).pop(), !l) throw new Error("Unknown network version");
|
|
7510
7500
|
} else if (l = l || hn.bitcoin, g !== l.wif) throw new Error("Invalid network version");
|
|
7511
7501
|
return r(y.privateKey, {
|
|
7512
7502
|
compressed: y.compressed,
|
|
@@ -7554,10 +7544,10 @@ function el(e) {
|
|
|
7554
7544
|
return Buffer.from(e.sign(l, this.__D));
|
|
7555
7545
|
{
|
|
7556
7546
|
let g = e.sign(l, this.__D);
|
|
7557
|
-
const
|
|
7547
|
+
const w = Buffer.alloc(32, 0);
|
|
7558
7548
|
let E = 0;
|
|
7559
7549
|
for (; g[0] > 127; )
|
|
7560
|
-
E++,
|
|
7550
|
+
E++, w.writeUIntLE(E, 0, 6), g = e.sign(l, this.__D, w);
|
|
7561
7551
|
return Buffer.from(g);
|
|
7562
7552
|
}
|
|
7563
7553
|
}
|
|
@@ -7579,18 +7569,18 @@ function el(e) {
|
|
|
7579
7569
|
const y = Zc(this.publicKey), g = e.xOnlyPointAddTweak(y, l);
|
|
7580
7570
|
if (!g || g.xOnlyPubkey === null)
|
|
7581
7571
|
throw new Error("Cannot tweak public key!");
|
|
7582
|
-
const
|
|
7572
|
+
const w = Buffer.from([
|
|
7583
7573
|
g.parity === 0 ? 2 : 3
|
|
7584
7574
|
]);
|
|
7585
7575
|
return n(
|
|
7586
|
-
Buffer.concat([
|
|
7576
|
+
Buffer.concat([w, g.xOnlyPubkey]),
|
|
7587
7577
|
{ network: this.network, compressed: this.compressed }
|
|
7588
7578
|
);
|
|
7589
7579
|
}
|
|
7590
7580
|
tweakFromPrivateKey(l) {
|
|
7591
|
-
const g = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey,
|
|
7592
|
-
if (!
|
|
7593
|
-
return r(Buffer.from(
|
|
7581
|
+
const g = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey, w = e.privateAdd(g, l);
|
|
7582
|
+
if (!w) throw new Error("Invalid tweaked private key!");
|
|
7583
|
+
return r(Buffer.from(w), {
|
|
7594
7584
|
network: this.network,
|
|
7595
7585
|
compressed: this.compressed
|
|
7596
7586
|
});
|
|
@@ -7604,7 +7594,7 @@ function el(e) {
|
|
|
7604
7594
|
makeRandom: a
|
|
7605
7595
|
};
|
|
7606
7596
|
}
|
|
7607
|
-
Et.ECPairFactory =
|
|
7597
|
+
Et.ECPairFactory = e0;
|
|
7608
7598
|
(function(e) {
|
|
7609
7599
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.networks = e.ECPairFactory = e.default = void 0;
|
|
7610
7600
|
var t = Et;
|
|
@@ -7633,7 +7623,7 @@ class dn {
|
|
|
7633
7623
|
return new dn(nt(t));
|
|
7634
7624
|
}
|
|
7635
7625
|
static async fromWalletClient(t) {
|
|
7636
|
-
if (!t.account) return
|
|
7626
|
+
if (!t.account) return M("No account found");
|
|
7637
7627
|
try {
|
|
7638
7628
|
const r = await t.signTypedData({
|
|
7639
7629
|
account: t.account,
|
|
@@ -7661,7 +7651,7 @@ class dn {
|
|
|
7661
7651
|
});
|
|
7662
7652
|
return fe(new dn(nt(ir(r))));
|
|
7663
7653
|
} catch (r) {
|
|
7664
|
-
return
|
|
7654
|
+
return M("Failed to initialize: " + r);
|
|
7665
7655
|
}
|
|
7666
7656
|
}
|
|
7667
7657
|
getMasterPrivKey() {
|
|
@@ -7678,7 +7668,7 @@ class dn {
|
|
|
7678
7668
|
return r.fromPrivateKey(f).sign(Buffer.from(nt(a), "hex")).toString("hex");
|
|
7679
7669
|
}
|
|
7680
7670
|
}
|
|
7681
|
-
class
|
|
7671
|
+
class d0 {
|
|
7682
7672
|
constructor(t) {
|
|
7683
7673
|
this.quoteUrl = new pn("/quote", t);
|
|
7684
7674
|
}
|
|
@@ -7689,9 +7679,9 @@ class dl {
|
|
|
7689
7679
|
amount: r.toString(),
|
|
7690
7680
|
exact_out: n.toString()
|
|
7691
7681
|
}), a = await mt.get(i);
|
|
7692
|
-
return a.error ?
|
|
7682
|
+
return a.error ? M(a.error) : a.result ? fe(a.result) : M("GetQuote: Unexpected error, result is undefined");
|
|
7693
7683
|
} catch (i) {
|
|
7694
|
-
return
|
|
7684
|
+
return M("GetQuote:", String(i));
|
|
7695
7685
|
}
|
|
7696
7686
|
}
|
|
7697
7687
|
async getAttestedQuote(t) {
|
|
@@ -7702,9 +7692,9 @@ class dl {
|
|
|
7702
7692
|
"Content-Type": "application/json"
|
|
7703
7693
|
}
|
|
7704
7694
|
});
|
|
7705
|
-
return r.error ?
|
|
7695
|
+
return r.error ? M(r.error) : r.result ? fe(r.result) : M("GetAttestedQuote: Unexpected error, result is undefined");
|
|
7706
7696
|
} catch (r) {
|
|
7707
|
-
return console.log("error :", r),
|
|
7697
|
+
return console.log("error :", r), M("GetAttestedQuote:", String(r));
|
|
7708
7698
|
}
|
|
7709
7699
|
}
|
|
7710
7700
|
async getStrategies() {
|
|
@@ -7712,9 +7702,9 @@ class dl {
|
|
|
7712
7702
|
const t = await mt.get(
|
|
7713
7703
|
this.quoteUrl.endpoint("/strategies")
|
|
7714
7704
|
);
|
|
7715
|
-
if (t.error) return
|
|
7705
|
+
if (t.error) return M(t.error);
|
|
7716
7706
|
if (!t.result)
|
|
7717
|
-
return
|
|
7707
|
+
return M("GetStrategies: Unexpected error, result is undefined");
|
|
7718
7708
|
const r = {};
|
|
7719
7709
|
for (const n of Object.values(t.result)) {
|
|
7720
7710
|
const i = Wa(
|
|
@@ -7731,23 +7721,23 @@ class dl {
|
|
|
7731
7721
|
}
|
|
7732
7722
|
return fe(r);
|
|
7733
7723
|
} catch (t) {
|
|
7734
|
-
return
|
|
7724
|
+
return M("GetStrategies:", String(t));
|
|
7735
7725
|
}
|
|
7736
7726
|
}
|
|
7737
7727
|
}
|
|
7738
7728
|
export {
|
|
7739
7729
|
rf as BlockNumberFetcher,
|
|
7740
7730
|
Ya as EvmRelay,
|
|
7741
|
-
|
|
7731
|
+
l0 as Garden,
|
|
7742
7732
|
ye as OrderActions,
|
|
7743
7733
|
ie as OrderStatus,
|
|
7744
7734
|
qa as ParseOrderStatus,
|
|
7745
7735
|
nn as ParseSwapStatus,
|
|
7746
|
-
|
|
7736
|
+
d0 as Quote,
|
|
7747
7737
|
dn as SecretManager,
|
|
7748
7738
|
te as SwapStatus,
|
|
7749
7739
|
en as TimeLocks,
|
|
7750
7740
|
Wa as constructOrderPair,
|
|
7751
7741
|
Va as parseAction,
|
|
7752
|
-
|
|
7742
|
+
c0 as switchOrAddNetwork
|
|
7753
7743
|
};
|