@gardenfi/core 0.3.0-beta.2 → 0.3.0-beta.4
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 +12 -12
- package/dist/index.js +693 -636
- package/dist/src/lib/bitcoin/htlc.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var Ws = Object.defineProperty;
|
|
2
2
|
var qs = (e, t, r) => t in e ? Ws(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
import { Ok as ue, Err as N, Fetcher as
|
|
5
|
-
import { EthereumLocalnet as Vs, ArbitrumLocalnet as Ks, Orderbook as Ys, isMainnet as
|
|
6
|
-
import { Url as yn, with0x as
|
|
7
|
-
import { createWalletClient as Un, custom as Nn, getContract as Zs, sha256 as
|
|
3
|
+
var _t = (e, t, r) => qs(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Ok as ue, Err as N, Fetcher as ot, trim0x as st } from "@catalogfi/utils";
|
|
5
|
+
import { EthereumLocalnet as Vs, ArbitrumLocalnet as Ks, Orderbook as Ys, isMainnet as sr, isBitcoin as Ot, getTimeLock as Js, getBlockchainType as or, BlockchainType as Ve } from "@gardenfi/orderbook";
|
|
6
|
+
import { Url as yn, with0x as hr, checkAllowanceAndApprove as Xs, Authorization as Ln, sleep as Qs, fetchBitcoinBlockNumber as Fn, fetchEVMBlockNumber as On } from "@gardenfi/utils";
|
|
7
|
+
import { createWalletClient as Un, custom as Nn, getContract as Zs, sha256 as ar } from "viem";
|
|
8
8
|
import * as Mn from "varuint-bitcoin";
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
9
|
+
import * as ft from "tiny-secp256k1";
|
|
10
|
+
import * as se from "bitcoinjs-lib";
|
|
11
11
|
import { crypto as eo } from "bitcoinjs-lib";
|
|
12
12
|
import { Urgency as Dn } from "@catalogfi/wallets";
|
|
13
13
|
import to from "bignumber.js";
|
|
14
14
|
var le = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.Initiate = "Initiate", e.Redeem = "Redeem", e.Refund = "Refund", e))(le || {});
|
|
15
|
-
function
|
|
15
|
+
function pt(e) {
|
|
16
16
|
return {
|
|
17
17
|
formatters: void 0,
|
|
18
18
|
fees: void 0,
|
|
@@ -21,7 +21,7 @@ function ht(e) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
const Ri = "2.21.41";
|
|
24
|
-
let
|
|
24
|
+
let Ut = {
|
|
25
25
|
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: r }) => t ? `${e ?? "https://viem.sh"}${t}${r ? `#${r}` : ""}` : void 0,
|
|
26
26
|
version: `viem@${Ri}`
|
|
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 = Ut.getDocsUrl) == null ? void 0 : u.call(Ut, { ...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
|
+
...Ut.version ? [`Version: ${Ut.version}`] : []
|
|
41
41
|
].join(`
|
|
42
42
|
`);
|
|
43
43
|
super(f, r.cause ? { cause: r.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -89,13 +89,13 @@ class no extends X {
|
|
|
89
89
|
super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Jt(e, { strict: t = !0 } = {}) {
|
|
93
93
|
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
95
|
+
function St(e) {
|
|
96
|
+
return Jt(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function br(e, { dir: t = "left" } = {}) {
|
|
99
99
|
let r = typeof e == "string" ? e.replace("0x", "") : e, n = 0;
|
|
100
100
|
for (let i = 0; i < r.length - 1 && r[t === "left" ? i : r.length - i - 1].toString() === "0"; i++)
|
|
101
101
|
n++;
|
|
@@ -111,7 +111,7 @@ class Pi extends X {
|
|
|
111
111
|
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Tt(e, { dir: t, size: r = 32 } = {}) {
|
|
115
115
|
return typeof e == "string" ? so(e, { dir: t, size: r }) : oo(e, { dir: t, size: r });
|
|
116
116
|
}
|
|
117
117
|
function so(e, { dir: t, size: r = 32 } = {}) {
|
|
@@ -148,14 +148,14 @@ function W(e, t = {}) {
|
|
|
148
148
|
}
|
|
149
149
|
function fo(e, t = {}) {
|
|
150
150
|
const r = `0x${Number(e)}`;
|
|
151
|
-
return typeof t.size == "number" ? (
|
|
151
|
+
return typeof t.size == "number" ? (Pt(r, { size: t.size }), Tt(r, { size: t.size })) : r;
|
|
152
152
|
}
|
|
153
153
|
function Qe(e, t = {}) {
|
|
154
154
|
let r = "";
|
|
155
155
|
for (let i = 0; i < e.length; i++)
|
|
156
156
|
r += ao[e[i]];
|
|
157
157
|
const n = `0x${r}`;
|
|
158
|
-
return typeof t.size == "number" ? (
|
|
158
|
+
return typeof t.size == "number" ? (Pt(n, { size: t.size }), Tt(n, { dir: "right", size: t.size })) : n;
|
|
159
159
|
}
|
|
160
160
|
function Ci(e, t = {}) {
|
|
161
161
|
const { signed: r, size: n } = t, i = BigInt(e);
|
|
@@ -173,7 +173,7 @@ function Ci(e, t = {}) {
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
const u = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
|
|
176
|
-
return n ?
|
|
176
|
+
return n ? Tt(u, { size: n }) : u;
|
|
177
177
|
}
|
|
178
178
|
const uo = /* @__PURE__ */ new TextEncoder();
|
|
179
179
|
function co(e, t = {}) {
|
|
@@ -182,11 +182,11 @@ function co(e, t = {}) {
|
|
|
182
182
|
}
|
|
183
183
|
const lo = /* @__PURE__ */ new TextEncoder();
|
|
184
184
|
function ki(e, t = {}) {
|
|
185
|
-
return typeof e == "number" || typeof e == "bigint" ? po(e, t) : typeof e == "boolean" ? ho(e, t) :
|
|
185
|
+
return typeof e == "number" || typeof e == "bigint" ? po(e, t) : typeof e == "boolean" ? ho(e, t) : Jt(e) ? ut(e, t) : Li(e, t);
|
|
186
186
|
}
|
|
187
187
|
function ho(e, t = {}) {
|
|
188
188
|
const r = new Uint8Array(1);
|
|
189
|
-
return r[0] = Number(e), typeof t.size == "number" ? (
|
|
189
|
+
return r[0] = Number(e), typeof t.size == "number" ? (Pt(r, { size: t.size }), Tt(r, { size: t.size })) : r;
|
|
190
190
|
}
|
|
191
191
|
const Ne = {
|
|
192
192
|
zero: 48,
|
|
@@ -204,9 +204,9 @@ function $n(e) {
|
|
|
204
204
|
if (e >= Ne.a && e <= Ne.f)
|
|
205
205
|
return e - (Ne.a - 10);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function ut(e, t = {}) {
|
|
208
208
|
let r = e;
|
|
209
|
-
t.size && (
|
|
209
|
+
t.size && (Pt(r, { size: t.size }), r = Tt(r, { dir: "right", size: t.size }));
|
|
210
210
|
let n = r.slice(2);
|
|
211
211
|
n.length % 2 && (n = `0${n}`);
|
|
212
212
|
const i = n.length / 2, a = new Uint8Array(i);
|
|
@@ -220,30 +220,30 @@ function at(e, t = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
function po(e, t) {
|
|
222
222
|
const r = Ci(e, t);
|
|
223
|
-
return
|
|
223
|
+
return ut(r);
|
|
224
224
|
}
|
|
225
225
|
function Li(e, t = {}) {
|
|
226
226
|
const r = lo.encode(e);
|
|
227
|
-
return typeof t.size == "number" ? (
|
|
227
|
+
return typeof t.size == "number" ? (Pt(r, { size: t.size }), Tt(r, { dir: "right", size: t.size })) : r;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
if (
|
|
229
|
+
function Pt(e, { size: t }) {
|
|
230
|
+
if (St(e) > t)
|
|
231
231
|
throw new no({
|
|
232
|
-
givenSize:
|
|
232
|
+
givenSize: St(e),
|
|
233
233
|
maxSize: t
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function vt(e, t = {}) {
|
|
237
237
|
const { signed: r } = t;
|
|
238
|
-
t.size &&
|
|
238
|
+
t.size && Pt(e, { size: t.size });
|
|
239
239
|
const n = BigInt(e);
|
|
240
240
|
if (!r)
|
|
241
241
|
return n;
|
|
242
242
|
const i = (e.length - 2) / 2, a = (1n << BigInt(i) * 8n - 1n) - 1n;
|
|
243
243
|
return n <= a ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return Number(
|
|
245
|
+
function yr(e, t = {}) {
|
|
246
|
+
return Number(vt(e, t));
|
|
247
247
|
}
|
|
248
248
|
function gn(e, t) {
|
|
249
249
|
return ({ exclude: r, format: n }) => ({
|
|
@@ -273,13 +273,13 @@ function mn(e) {
|
|
|
273
273
|
...e,
|
|
274
274
|
blockHash: e.blockHash ? e.blockHash : null,
|
|
275
275
|
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
276
|
-
chainId: e.chainId ?
|
|
276
|
+
chainId: e.chainId ? yr(e.chainId) : void 0,
|
|
277
277
|
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
278
278
|
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
279
279
|
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
280
280
|
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
281
281
|
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
282
|
-
nonce: e.nonce ?
|
|
282
|
+
nonce: e.nonce ? yr(e.nonce) : void 0,
|
|
283
283
|
to: e.to ? e.to : null,
|
|
284
284
|
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
285
285
|
type: e.type ? Fi[e.type] : void 0,
|
|
@@ -358,14 +358,14 @@ function xo(e) {
|
|
|
358
358
|
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
|
|
359
359
|
logs: e.logs ? e.logs.map((r) => _o(r)) : null,
|
|
360
360
|
to: e.to ? e.to : null,
|
|
361
|
-
transactionIndex: e.transactionIndex ?
|
|
361
|
+
transactionIndex: e.transactionIndex ? yr(e.transactionIndex) : null,
|
|
362
362
|
status: e.status ? wo[e.status] : null,
|
|
363
363
|
type: e.type ? Fi[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
|
}
|
|
367
367
|
const vo = /* @__PURE__ */ gn("transactionReceipt", xo), _n = 2n ** 256n - 1n;
|
|
368
|
-
function
|
|
368
|
+
function Xt(e) {
|
|
369
369
|
return `0x${e.reduce((t, r) => t + r.replace("0x", ""), "")}`;
|
|
370
370
|
}
|
|
371
371
|
class Hn extends X {
|
|
@@ -511,7 +511,7 @@ function Oi(e, { recursiveReadLimit: t = 8192 } = {}) {
|
|
|
511
511
|
const r = Object.create(So);
|
|
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
|
-
function
|
|
514
|
+
function ct(e, t = "hex") {
|
|
515
515
|
const r = Ui(e), n = Oi(new Uint8Array(r.length));
|
|
516
516
|
return r.encode(n), t === "hex" ? Qe(n.bytes) : n.bytes;
|
|
517
517
|
}
|
|
@@ -530,7 +530,7 @@ function Ao(e) {
|
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
532
|
function Io(e) {
|
|
533
|
-
const t = typeof e == "string" ?
|
|
533
|
+
const t = typeof e == "string" ? ut(e) : e, r = Ni(t.length);
|
|
534
534
|
return {
|
|
535
535
|
length: t.length === 1 && t[0] < 128 ? 1 : t.length <= 55 ? 1 + t.length : 1 + r + t.length,
|
|
536
536
|
encode(i) {
|
|
@@ -605,13 +605,13 @@ class Lo extends X {
|
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
function Mi(e) {
|
|
608
|
-
const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((a) =>
|
|
608
|
+
const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((a) => ut(a)) : e.blobs, i = [];
|
|
609
609
|
for (const a of n)
|
|
610
610
|
i.push(Uint8Array.from(t.blobToKzgCommitment(a)));
|
|
611
611
|
return r === "bytes" ? i : i.map((a) => Qe(a));
|
|
612
612
|
}
|
|
613
613
|
function Di(e) {
|
|
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) =>
|
|
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) => ut(f)) : e.blobs, i = typeof e.commitments[0] == "string" ? e.commitments.map((f) => ut(f)) : e.commitments, a = [];
|
|
615
615
|
for (let f = 0; f < n.length; f++) {
|
|
616
616
|
const u = n[f], l = i[f];
|
|
617
617
|
a.push(Uint8Array.from(t.computeBlobKzgProof(u, l)));
|
|
@@ -631,7 +631,7 @@ function wn(e, ...t) {
|
|
|
631
631
|
if (t.length > 0 && !t.includes(e.length))
|
|
632
632
|
throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`);
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function gr(e, t = !0) {
|
|
635
635
|
if (e.destroyed)
|
|
636
636
|
throw new Error("Hash instance has been destroyed");
|
|
637
637
|
if (t && e.finished)
|
|
@@ -644,7 +644,7 @@ function $i(e, t) {
|
|
|
644
644
|
throw new Error(`digestInto() expects output buffer of length at least ${r}`);
|
|
645
645
|
}
|
|
646
646
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
647
|
-
const Oo = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)),
|
|
647
|
+
const Oo = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), $r = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), Le = (e, t) => e << 32 - t | e >>> t, Gn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Uo = (e) => e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
648
648
|
function jn(e) {
|
|
649
649
|
for (let t = 0; t < e.length; t++)
|
|
650
650
|
e[t] = Uo(e[t]);
|
|
@@ -676,17 +676,17 @@ function Mo(e, t, r, n) {
|
|
|
676
676
|
const Do = (e, t, r) => e & t ^ ~e & r, $o = (e, t, r) => e & t ^ e & r ^ t & r;
|
|
677
677
|
class Ho extends Hi {
|
|
678
678
|
constructor(t, r, n, i) {
|
|
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 =
|
|
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 = $r(this.buffer);
|
|
680
680
|
}
|
|
681
681
|
update(t) {
|
|
682
|
-
|
|
682
|
+
gr(this);
|
|
683
683
|
const { view: r, buffer: n, blockLen: i } = this;
|
|
684
684
|
t = xn(t);
|
|
685
685
|
const a = t.length;
|
|
686
686
|
for (let f = 0; f < a; ) {
|
|
687
687
|
const u = Math.min(i - this.pos, a - f);
|
|
688
688
|
if (u === i) {
|
|
689
|
-
const l =
|
|
689
|
+
const l = $r(t);
|
|
690
690
|
for (; i <= a - f; f += i)
|
|
691
691
|
this.process(l, f);
|
|
692
692
|
continue;
|
|
@@ -696,21 +696,21 @@ class Ho extends Hi {
|
|
|
696
696
|
return this.length += t.length, this.roundClean(), this;
|
|
697
697
|
}
|
|
698
698
|
digestInto(t) {
|
|
699
|
-
|
|
699
|
+
gr(this), $i(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[
|
|
703
|
+
for (let m = f; m < i; m++)
|
|
704
|
+
r[m] = 0;
|
|
705
705
|
Mo(n, i - 8, BigInt(this.length * 8), a), this.process(n, 0);
|
|
706
|
-
const u =
|
|
706
|
+
const u = $r(t), l = this.outputLen;
|
|
707
707
|
if (l % 4)
|
|
708
708
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
709
|
-
const b = l / 4,
|
|
710
|
-
if (b >
|
|
709
|
+
const b = l / 4, g = this.get();
|
|
710
|
+
if (b > g.length)
|
|
711
711
|
throw new Error("_sha2: outputLen bigger than state");
|
|
712
|
-
for (let
|
|
713
|
-
u.setUint32(4 *
|
|
712
|
+
for (let m = 0; m < b; m++)
|
|
713
|
+
u.setUint32(4 * m, g[m], a);
|
|
714
714
|
}
|
|
715
715
|
digest() {
|
|
716
716
|
const { buffer: t, outputLen: r } = this;
|
|
@@ -812,18 +812,18 @@ class Go extends Ho {
|
|
|
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 v = Ye[
|
|
819
|
-
Ye[
|
|
815
|
+
for (let m = 0; m < 16; m++, r += 4)
|
|
816
|
+
Ye[m] = t.getUint32(r, !1);
|
|
817
|
+
for (let m = 16; m < 64; m++) {
|
|
818
|
+
const v = Ye[m - 15], A = Ye[m - 2], B = Le(v, 7) ^ Le(v, 18) ^ v >>> 3, P = Le(A, 17) ^ Le(A, 19) ^ A >>> 10;
|
|
819
|
+
Ye[m] = P + Ye[m - 7] + B + Ye[m - 16] | 0;
|
|
820
820
|
}
|
|
821
|
-
let { A: n, B: i, C: a, D: f, E: u, F: l, G: b, H:
|
|
822
|
-
for (let
|
|
823
|
-
const v = Le(u, 6) ^ Le(u, 11) ^ Le(u, 25), A =
|
|
824
|
-
|
|
821
|
+
let { A: n, B: i, C: a, D: f, E: u, F: l, G: b, H: g } = this;
|
|
822
|
+
for (let m = 0; m < 64; m++) {
|
|
823
|
+
const v = Le(u, 6) ^ Le(u, 11) ^ Le(u, 25), A = g + v + Do(u, l, b) + zo[m] + Ye[m] | 0, P = (Le(n, 2) ^ Le(n, 13) ^ Le(n, 22)) + $o(n, i, a) | 0;
|
|
824
|
+
g = b, b = l, l = u, u = f + A | 0, f = a, a = i, i = n, n = A + P | 0;
|
|
825
825
|
}
|
|
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, b = b + this.G | 0,
|
|
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, b = b + this.G | 0, g = g + this.H | 0, this.set(n, i, a, f, u, l, b, g);
|
|
827
827
|
}
|
|
828
828
|
roundClean() {
|
|
829
829
|
Ye.fill(0);
|
|
@@ -834,7 +834,7 @@ class Go extends Ho {
|
|
|
834
834
|
}
|
|
835
835
|
const jo = /* @__PURE__ */ zi(() => new Go());
|
|
836
836
|
function Wo(e, t) {
|
|
837
|
-
return jo(
|
|
837
|
+
return jo(Jt(e, { strict: !1 }) ? ki(e) : e);
|
|
838
838
|
}
|
|
839
839
|
function qo(e) {
|
|
840
840
|
const { commitment: t, version: r = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = Wo(t);
|
|
@@ -886,7 +886,7 @@ class Jo extends X {
|
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
function Xo(e) {
|
|
889
|
-
const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), r = typeof e.data == "string" ?
|
|
889
|
+
const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), r = typeof e.data == "string" ? ut(e.data) : e.data, n = St(r);
|
|
890
890
|
if (!n)
|
|
891
891
|
throw new qi();
|
|
892
892
|
if (n > qn)
|
|
@@ -931,12 +931,12 @@ function Zo(e) {
|
|
|
931
931
|
i ? W(i) : "0x",
|
|
932
932
|
n,
|
|
933
933
|
a ? W(a) : "0x",
|
|
934
|
-
...
|
|
934
|
+
...Qt({}, f)
|
|
935
935
|
]);
|
|
936
936
|
}
|
|
937
937
|
return t;
|
|
938
938
|
}
|
|
939
|
-
class
|
|
939
|
+
class lt extends X {
|
|
940
940
|
constructor({ address: t }) {
|
|
941
941
|
super(`Address "${t}" is invalid.`, {
|
|
942
942
|
metaMessages: [
|
|
@@ -947,12 +947,12 @@ class ut extends X {
|
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
|
-
class
|
|
950
|
+
class Sr extends X {
|
|
951
951
|
constructor({ chainId: t }) {
|
|
952
952
|
super(typeof t == "number" ? `Chain ID "${t}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
class
|
|
955
|
+
class Ar extends X {
|
|
956
956
|
constructor({ cause: t, maxFeePerGas: r } = {}) {
|
|
957
957
|
super(`The fee cap (\`maxFeePerGas\`${r ? ` = ${sn(r)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
958
958
|
cause: t,
|
|
@@ -960,7 +960,7 @@ class Sr extends X {
|
|
|
960
960
|
});
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
Object.defineProperty(
|
|
963
|
+
Object.defineProperty(Ar, "nodeMessage", {
|
|
964
964
|
enumerable: !0,
|
|
965
965
|
configurable: !0,
|
|
966
966
|
writable: !0,
|
|
@@ -1004,9 +1004,9 @@ class Ki extends Map {
|
|
|
1004
1004
|
return this;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
const
|
|
1007
|
+
const fr = /* @__PURE__ */ BigInt(2 ** 32 - 1), Vn = /* @__PURE__ */ BigInt(32);
|
|
1008
1008
|
function ea(e, t = !1) {
|
|
1009
|
-
return t ? { h: Number(e &
|
|
1009
|
+
return t ? { h: Number(e & fr), l: Number(e >> Vn & fr) } : { h: Number(e >> Vn & fr) | 0, l: Number(e & fr) | 0 };
|
|
1010
1010
|
}
|
|
1011
1011
|
function ta(e, t = !1) {
|
|
1012
1012
|
let r = new Uint32Array(e.length), n = new Uint32Array(e.length);
|
|
@@ -1016,12 +1016,12 @@ function ta(e, t = !1) {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
return [r, n];
|
|
1018
1018
|
}
|
|
1019
|
-
const ra = (e, t, r) => e << r | t >>> 32 - r, na = (e, t, r) => t << r | e >>> 32 - r, ia = (e, t, r) => t << r - 32 | e >>> 64 - r, sa = (e, t, r) => e << r - 32 | t >>> 64 - r, Yi = [], Ji = [], Xi = [], oa = /* @__PURE__ */ BigInt(0),
|
|
1020
|
-
for (let e = 0, t =
|
|
1019
|
+
const ra = (e, t, r) => e << r | t >>> 32 - r, na = (e, t, r) => t << r | e >>> 32 - r, ia = (e, t, r) => t << r - 32 | e >>> 64 - r, sa = (e, t, r) => e << r - 32 | t >>> 64 - r, Yi = [], Ji = [], Xi = [], oa = /* @__PURE__ */ BigInt(0), Nt = /* @__PURE__ */ BigInt(1), aa = /* @__PURE__ */ BigInt(2), fa = /* @__PURE__ */ BigInt(7), ua = /* @__PURE__ */ BigInt(256), ca = /* @__PURE__ */ BigInt(113);
|
|
1020
|
+
for (let e = 0, t = Nt, r = 1, n = 0; e < 24; e++) {
|
|
1021
1021
|
[r, n] = [n, (2 * r + 3 * n) % 5], Yi.push(2 * (5 * n + r)), Ji.push((e + 1) * (e + 2) / 2 % 64);
|
|
1022
1022
|
let i = oa;
|
|
1023
1023
|
for (let a = 0; a < 7; a++)
|
|
1024
|
-
t = (t <<
|
|
1024
|
+
t = (t << Nt ^ (t >> fa) * ca) % ua, t & aa && (i ^= Nt << (Nt << /* @__PURE__ */ BigInt(a)) - Nt);
|
|
1025
1025
|
Xi.push(i);
|
|
1026
1026
|
}
|
|
1027
1027
|
const [la, ha] = /* @__PURE__ */ ta(Xi, !0), Kn = (e, t, r) => r > 32 ? ia(e, t, r) : ra(e, t, r), Yn = (e, t, r) => r > 32 ? sa(e, t, r) : na(e, t, r);
|
|
@@ -1031,14 +1031,14 @@ function da(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, b = r[l],
|
|
1034
|
+
const u = (f + 8) % 10, l = (f + 2) % 10, b = r[l], g = r[l + 1], m = Kn(b, g, 1) ^ r[u], v = Yn(b, g, 1) ^ r[u + 1];
|
|
1035
1035
|
for (let A = 0; A < 50; A += 10)
|
|
1036
|
-
e[f + A] ^=
|
|
1036
|
+
e[f + A] ^= m, e[f + A + 1] ^= v;
|
|
1037
1037
|
}
|
|
1038
1038
|
let i = e[2], a = e[3];
|
|
1039
1039
|
for (let f = 0; f < 24; f++) {
|
|
1040
|
-
const u = Ji[f], l = Kn(i, a, u), b = Yn(i, a, u),
|
|
1041
|
-
i = e[
|
|
1040
|
+
const u = Ji[f], l = Kn(i, a, u), b = Yn(i, a, u), g = Yi[f];
|
|
1041
|
+
i = e[g], a = e[g + 1], e[g] = l, e[g + 1] = b;
|
|
1042
1042
|
}
|
|
1043
1043
|
for (let f = 0; f < 50; f += 10) {
|
|
1044
1044
|
for (let u = 0; u < 10; u++)
|
|
@@ -1061,7 +1061,7 @@ class En extends Hi {
|
|
|
1061
1061
|
Gn || jn(this.state32), da(this.state32, this.rounds), Gn || jn(this.state32), this.posOut = 0, this.pos = 0;
|
|
1062
1062
|
}
|
|
1063
1063
|
update(t) {
|
|
1064
|
-
|
|
1064
|
+
gr(this);
|
|
1065
1065
|
const { blockLen: r, state: n } = this;
|
|
1066
1066
|
t = xn(t);
|
|
1067
1067
|
const i = t.length;
|
|
@@ -1081,7 +1081,7 @@ class En extends Hi {
|
|
|
1081
1081
|
t[n] ^= r, r & 128 && n === i - 1 && this.keccak(), t[i - 1] ^= 128, this.keccak();
|
|
1082
1082
|
}
|
|
1083
1083
|
writeInto(t) {
|
|
1084
|
-
|
|
1084
|
+
gr(this, !1), wn(t), this.finish();
|
|
1085
1085
|
const r = this.state, { blockLen: n } = this;
|
|
1086
1086
|
for (let i = 0, a = t.length; i < a; ) {
|
|
1087
1087
|
this.posOut >= n && this.keccak();
|
|
@@ -1116,39 +1116,39 @@ class En extends Hi {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
const pa = (e, t, r) => zi(() => new En(t, e, r)), ba = /* @__PURE__ */ pa(1, 136, 256 / 8);
|
|
1118
1118
|
function ya(e, t) {
|
|
1119
|
-
return ba(
|
|
1119
|
+
return ba(Jt(e, { strict: !1 }) ? ki(e) : e);
|
|
1120
1120
|
}
|
|
1121
|
-
const
|
|
1121
|
+
const Hr = /* @__PURE__ */ new Ki(8192);
|
|
1122
1122
|
function ga(e, t) {
|
|
1123
|
-
if (
|
|
1124
|
-
return
|
|
1123
|
+
if (Hr.has(`${e}.${t}`))
|
|
1124
|
+
return Hr.get(`${e}.${t}`);
|
|
1125
1125
|
const r = e.substring(2).toLowerCase(), n = ya(Li(r)), i = r.split("");
|
|
1126
1126
|
for (let f = 0; f < 40; f += 2)
|
|
1127
1127
|
n[f >> 1] >> 4 >= 8 && i[f] && (i[f] = i[f].toUpperCase()), (n[f >> 1] & 15) >= 8 && i[f + 1] && (i[f + 1] = i[f + 1].toUpperCase());
|
|
1128
1128
|
const a = `0x${i.join("")}`;
|
|
1129
|
-
return
|
|
1129
|
+
return Hr.set(`${e}.${t}`, a), a;
|
|
1130
1130
|
}
|
|
1131
|
-
const ma = /^0x[a-fA-F0-9]{40}$/,
|
|
1132
|
-
function
|
|
1131
|
+
const ma = /^0x[a-fA-F0-9]{40}$/, zr = /* @__PURE__ */ new Ki(8192);
|
|
1132
|
+
function ht(e, t) {
|
|
1133
1133
|
const { strict: r = !0 } = t ?? {}, n = `${e}.${r}`;
|
|
1134
|
-
if (
|
|
1135
|
-
return
|
|
1134
|
+
if (zr.has(n))
|
|
1135
|
+
return zr.get(n);
|
|
1136
1136
|
const i = ma.test(e) ? e.toLowerCase() === e ? !0 : r ? ga(e) === e : !0 : !1;
|
|
1137
|
-
return
|
|
1137
|
+
return zr.set(n, i), i;
|
|
1138
1138
|
}
|
|
1139
1139
|
function _a(e, t, r, { strict: n } = {}) {
|
|
1140
|
-
return
|
|
1140
|
+
return Jt(e, { strict: !1 }) ? xa(e, t, r, {
|
|
1141
1141
|
strict: n
|
|
1142
1142
|
}) : wa(e, t, r, {
|
|
1143
1143
|
strict: n
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
1146
|
function Qi(e, t, r) {
|
|
1147
|
-
if (
|
|
1147
|
+
if (St(e) !== r - t)
|
|
1148
1148
|
throw new io({
|
|
1149
1149
|
offset: r,
|
|
1150
1150
|
position: "end",
|
|
1151
|
-
size:
|
|
1151
|
+
size: St(e)
|
|
1152
1152
|
});
|
|
1153
1153
|
}
|
|
1154
1154
|
function wa(e, t, r, { strict: n } = {}) {
|
|
@@ -1164,10 +1164,10 @@ function va(e) {
|
|
|
1164
1164
|
if (t)
|
|
1165
1165
|
for (const r of t) {
|
|
1166
1166
|
const { contractAddress: n, chainId: i } = r;
|
|
1167
|
-
if (!
|
|
1168
|
-
throw new
|
|
1167
|
+
if (!ht(n))
|
|
1168
|
+
throw new lt({ address: n });
|
|
1169
1169
|
if (i < 0)
|
|
1170
|
-
throw new
|
|
1170
|
+
throw new Sr({ chainId: i });
|
|
1171
1171
|
}
|
|
1172
1172
|
Bn(e);
|
|
1173
1173
|
}
|
|
@@ -1177,7 +1177,7 @@ function Ea(e) {
|
|
|
1177
1177
|
if (t.length === 0)
|
|
1178
1178
|
throw new qi();
|
|
1179
1179
|
for (const r of t) {
|
|
1180
|
-
const n =
|
|
1180
|
+
const n = St(r), i = yr(_a(r, 0, 1));
|
|
1181
1181
|
if (n !== 32)
|
|
1182
1182
|
throw new Yo({ hash: r, size: n });
|
|
1183
1183
|
if (i !== Wi)
|
|
@@ -1192,35 +1192,35 @@ function Ea(e) {
|
|
|
1192
1192
|
function Bn(e) {
|
|
1193
1193
|
const { chainId: t, maxPriorityFeePerGas: r, maxFeePerGas: n, to: i } = e;
|
|
1194
1194
|
if (t <= 0)
|
|
1195
|
-
throw new
|
|
1196
|
-
if (i && !
|
|
1197
|
-
throw new
|
|
1195
|
+
throw new Sr({ chainId: t });
|
|
1196
|
+
if (i && !ht(i))
|
|
1197
|
+
throw new lt({ address: i });
|
|
1198
1198
|
if (n && n > _n)
|
|
1199
|
-
throw new
|
|
1199
|
+
throw new Ar({ maxFeePerGas: n });
|
|
1200
1200
|
if (r && n && r > n)
|
|
1201
1201
|
throw new Vi({ maxFeePerGas: n, maxPriorityFeePerGas: r });
|
|
1202
1202
|
}
|
|
1203
1203
|
function Ba(e) {
|
|
1204
1204
|
const { chainId: t, maxPriorityFeePerGas: r, gasPrice: n, maxFeePerGas: i, to: a } = e;
|
|
1205
1205
|
if (t <= 0)
|
|
1206
|
-
throw new
|
|
1207
|
-
if (a && !
|
|
1208
|
-
throw new
|
|
1206
|
+
throw new Sr({ chainId: t });
|
|
1207
|
+
if (a && !ht(a))
|
|
1208
|
+
throw new lt({ address: a });
|
|
1209
1209
|
if (r || i)
|
|
1210
1210
|
throw new X("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
1211
1211
|
if (n && n > _n)
|
|
1212
|
-
throw new
|
|
1212
|
+
throw new Ar({ maxFeePerGas: n });
|
|
1213
1213
|
}
|
|
1214
1214
|
function Sa(e) {
|
|
1215
1215
|
const { chainId: t, maxPriorityFeePerGas: r, gasPrice: n, maxFeePerGas: i, to: a } = e;
|
|
1216
|
-
if (a && !
|
|
1217
|
-
throw new
|
|
1216
|
+
if (a && !ht(a))
|
|
1217
|
+
throw new lt({ address: a });
|
|
1218
1218
|
if (typeof t < "u" && t <= 0)
|
|
1219
|
-
throw new
|
|
1219
|
+
throw new Sr({ chainId: t });
|
|
1220
1220
|
if (r || i)
|
|
1221
1221
|
throw new X("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
1222
1222
|
if (n && n > _n)
|
|
1223
|
-
throw new
|
|
1223
|
+
throw new Ar({ maxFeePerGas: n });
|
|
1224
1224
|
}
|
|
1225
1225
|
function Aa(e) {
|
|
1226
1226
|
if (e.type)
|
|
@@ -1235,7 +1235,7 @@ function Aa(e) {
|
|
|
1235
1235
|
return typeof e.accessList < "u" ? "eip2930" : "legacy";
|
|
1236
1236
|
throw new ko({ transaction: e });
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function Ir(e) {
|
|
1239
1239
|
if (!e || e.length === 0)
|
|
1240
1240
|
return [];
|
|
1241
1241
|
const t = [];
|
|
@@ -1244,8 +1244,8 @@ function Ar(e) {
|
|
|
1244
1244
|
for (let a = 0; a < i.length; a++)
|
|
1245
1245
|
if (i[a].length - 2 !== 64)
|
|
1246
1246
|
throw new Lo({ storageKey: i[a] });
|
|
1247
|
-
if (!
|
|
1248
|
-
throw new
|
|
1247
|
+
if (!ht(n, { strict: !1 }))
|
|
1248
|
+
throw new lt({ address: n });
|
|
1249
1249
|
t.push([n, i]);
|
|
1250
1250
|
}
|
|
1251
1251
|
return t;
|
|
@@ -1255,12 +1255,12 @@ function Ia(e, t) {
|
|
|
1255
1255
|
return r === "eip1559" ? Pa(e, t) : r === "eip2930" ? Ca(e, t) : r === "eip4844" ? Ta(e, t) : r === "eip7702" ? Ra(e, t) : ka(e, t);
|
|
1256
1256
|
}
|
|
1257
1257
|
function Ra(e, t) {
|
|
1258
|
-
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList:
|
|
1258
|
+
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList: g, data: m } = e;
|
|
1259
1259
|
va(e);
|
|
1260
|
-
const v =
|
|
1261
|
-
return
|
|
1260
|
+
const v = Ir(g), A = Zo(r);
|
|
1261
|
+
return Xt([
|
|
1262
1262
|
"0x04",
|
|
1263
|
-
|
|
1263
|
+
ct([
|
|
1264
1264
|
W(n),
|
|
1265
1265
|
a ? W(a) : "0x",
|
|
1266
1266
|
b ? W(b) : "0x",
|
|
@@ -1268,15 +1268,15 @@ function Ra(e, t) {
|
|
|
1268
1268
|
i ? W(i) : "0x",
|
|
1269
1269
|
f ?? "0x",
|
|
1270
1270
|
u ? W(u) : "0x",
|
|
1271
|
-
|
|
1271
|
+
m ?? "0x",
|
|
1272
1272
|
v,
|
|
1273
1273
|
A,
|
|
1274
|
-
...
|
|
1274
|
+
...Qt(e, t)
|
|
1275
1275
|
])
|
|
1276
1276
|
]);
|
|
1277
1277
|
}
|
|
1278
1278
|
function Ta(e, t) {
|
|
1279
|
-
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList:
|
|
1279
|
+
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList: g, data: m } = e;
|
|
1280
1280
|
Ea(e);
|
|
1281
1281
|
let v = e.blobVersionedHashes, A = e.sidecars;
|
|
1282
1282
|
if (e.blobs && (typeof v > "u" || typeof A > "u")) {
|
|
@@ -1291,7 +1291,7 @@ function Ta(e, t) {
|
|
|
1291
1291
|
A = Qo({ blobs: L, commitments: O, proofs: S });
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
|
-
const B =
|
|
1294
|
+
const B = Ir(g), P = [
|
|
1295
1295
|
W(r),
|
|
1296
1296
|
i ? W(i) : "0x",
|
|
1297
1297
|
b ? W(b) : "0x",
|
|
@@ -1299,27 +1299,27 @@ function Ta(e, t) {
|
|
|
1299
1299
|
n ? W(n) : "0x",
|
|
1300
1300
|
a ?? "0x",
|
|
1301
1301
|
f ? W(f) : "0x",
|
|
1302
|
-
|
|
1302
|
+
m ?? "0x",
|
|
1303
1303
|
B,
|
|
1304
1304
|
u ? W(u) : "0x",
|
|
1305
1305
|
v ?? [],
|
|
1306
|
-
...
|
|
1306
|
+
...Qt(e, t)
|
|
1307
1307
|
], T = [], C = [], F = [];
|
|
1308
1308
|
if (A)
|
|
1309
1309
|
for (let L = 0; L < A.length; L++) {
|
|
1310
1310
|
const { blob: k, commitment: O, proof: S } = A[L];
|
|
1311
1311
|
T.push(k), C.push(O), F.push(S);
|
|
1312
1312
|
}
|
|
1313
|
-
return
|
|
1313
|
+
return Xt([
|
|
1314
1314
|
"0x03",
|
|
1315
1315
|
// If sidecars are enabled, envelope turns into a "wrapper":
|
|
1316
|
-
|
|
1316
|
+
ct(A ? [P, T, C, F] : P)
|
|
1317
1317
|
]);
|
|
1318
1318
|
}
|
|
1319
1319
|
function Pa(e, t) {
|
|
1320
|
-
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerGas: u, maxPriorityFeePerGas: l, accessList: b, data:
|
|
1320
|
+
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerGas: u, maxPriorityFeePerGas: l, accessList: b, data: g } = e;
|
|
1321
1321
|
Bn(e);
|
|
1322
|
-
const
|
|
1322
|
+
const m = Ir(b), v = [
|
|
1323
1323
|
W(r),
|
|
1324
1324
|
i ? W(i) : "0x",
|
|
1325
1325
|
l ? W(l) : "0x",
|
|
@@ -1327,19 +1327,19 @@ function Pa(e, t) {
|
|
|
1327
1327
|
n ? W(n) : "0x",
|
|
1328
1328
|
a ?? "0x",
|
|
1329
1329
|
f ? W(f) : "0x",
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
...
|
|
1330
|
+
g ?? "0x",
|
|
1331
|
+
m,
|
|
1332
|
+
...Qt(e, t)
|
|
1333
1333
|
];
|
|
1334
|
-
return
|
|
1334
|
+
return Xt([
|
|
1335
1335
|
"0x02",
|
|
1336
|
-
|
|
1336
|
+
ct(v)
|
|
1337
1337
|
]);
|
|
1338
1338
|
}
|
|
1339
1339
|
function Ca(e, t) {
|
|
1340
1340
|
const { chainId: r, gas: n, data: i, nonce: a, to: f, value: u, accessList: l, gasPrice: b } = e;
|
|
1341
1341
|
Ba(e);
|
|
1342
|
-
const
|
|
1342
|
+
const g = Ir(l), m = [
|
|
1343
1343
|
W(r),
|
|
1344
1344
|
a ? W(a) : "0x",
|
|
1345
1345
|
b ? W(b) : "0x",
|
|
@@ -1347,12 +1347,12 @@ function Ca(e, t) {
|
|
|
1347
1347
|
f ?? "0x",
|
|
1348
1348
|
u ? W(u) : "0x",
|
|
1349
1349
|
i ?? "0x",
|
|
1350
|
-
|
|
1351
|
-
...
|
|
1350
|
+
g,
|
|
1351
|
+
...Qt(e, t)
|
|
1352
1352
|
];
|
|
1353
|
-
return
|
|
1353
|
+
return Xt([
|
|
1354
1354
|
"0x01",
|
|
1355
|
-
|
|
1355
|
+
ct(m)
|
|
1356
1356
|
]);
|
|
1357
1357
|
}
|
|
1358
1358
|
function ka(e, t) {
|
|
@@ -1367,7 +1367,7 @@ function ka(e, t) {
|
|
|
1367
1367
|
i ?? "0x"
|
|
1368
1368
|
];
|
|
1369
1369
|
if (t) {
|
|
1370
|
-
const
|
|
1370
|
+
const g = (() => {
|
|
1371
1371
|
if (t.v >= 35n)
|
|
1372
1372
|
return (t.v - 35n) / 2n > 0 ? t.v : 27n + (t.v === 35n ? 0n : 1n);
|
|
1373
1373
|
if (r > 0)
|
|
@@ -1376,11 +1376,11 @@ function ka(e, t) {
|
|
|
1376
1376
|
if (t.v !== A)
|
|
1377
1377
|
throw new Co({ v: t.v });
|
|
1378
1378
|
return A;
|
|
1379
|
-
})(),
|
|
1379
|
+
})(), m = br(t.r), v = br(t.s);
|
|
1380
1380
|
b = [
|
|
1381
1381
|
...b,
|
|
1382
|
-
W(
|
|
1383
|
-
|
|
1382
|
+
W(g),
|
|
1383
|
+
m === "0x00" ? "0x" : m,
|
|
1384
1384
|
v === "0x00" ? "0x" : v
|
|
1385
1385
|
];
|
|
1386
1386
|
} else r > 0 && (b = [
|
|
@@ -1389,9 +1389,9 @@ function ka(e, t) {
|
|
|
1389
1389
|
"0x",
|
|
1390
1390
|
"0x"
|
|
1391
1391
|
]);
|
|
1392
|
-
return
|
|
1392
|
+
return ct(b);
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function Qt(e, t) {
|
|
1395
1395
|
const r = t ?? e, { v: n, yParity: i } = r;
|
|
1396
1396
|
if (typeof r.r > "u")
|
|
1397
1397
|
return [];
|
|
@@ -1399,7 +1399,7 @@ function Jt(e, t) {
|
|
|
1399
1399
|
return [];
|
|
1400
1400
|
if (typeof n > "u" && typeof i > "u")
|
|
1401
1401
|
return [];
|
|
1402
|
-
const a =
|
|
1402
|
+
const a = br(r.r), f = br(r.s);
|
|
1403
1403
|
return [typeof i == "number" ? i ? W(1) : "0x" : n === 0n ? "0x" : n === 1n ? W(1) : n === 27n ? "0x" : W(1), a === "0x00" ? "0x" : a, f === "0x00" ? "0x" : f];
|
|
1404
1404
|
}
|
|
1405
1405
|
const La = {
|
|
@@ -1422,7 +1422,7 @@ const La = {
|
|
|
1422
1422
|
if (typeof n == "string")
|
|
1423
1423
|
return n;
|
|
1424
1424
|
const i = mn(n);
|
|
1425
|
-
return i.typeHex === "0x7e" && (i.isSystemTx = n.isSystemTx, i.mint = n.mint ?
|
|
1425
|
+
return i.typeHex === "0x7e" && (i.isSystemTx = n.isSystemTx, i.mint = n.mint ? vt(n.mint) : void 0, i.sourceHash = n.sourceHash, i.type = "deposit"), i;
|
|
1426
1426
|
}),
|
|
1427
1427
|
stateRoot: e.stateRoot
|
|
1428
1428
|
};
|
|
@@ -1431,15 +1431,15 @@ const La = {
|
|
|
1431
1431
|
transaction: /* @__PURE__ */ bo({
|
|
1432
1432
|
format(e) {
|
|
1433
1433
|
const t = {};
|
|
1434
|
-
return e.type === "0x7e" && (t.isSystemTx = e.isSystemTx, t.mint = e.mint ?
|
|
1434
|
+
return e.type === "0x7e" && (t.isSystemTx = e.isSystemTx, t.mint = e.mint ? vt(e.mint) : void 0, t.sourceHash = e.sourceHash, t.type = "deposit"), t;
|
|
1435
1435
|
}
|
|
1436
1436
|
}),
|
|
1437
1437
|
transactionReceipt: /* @__PURE__ */ vo({
|
|
1438
1438
|
format(e) {
|
|
1439
1439
|
return {
|
|
1440
|
-
l1GasPrice: e.l1GasPrice ?
|
|
1441
|
-
l1GasUsed: e.l1GasUsed ?
|
|
1442
|
-
l1Fee: e.l1Fee ?
|
|
1440
|
+
l1GasPrice: e.l1GasPrice ? vt(e.l1GasPrice) : null,
|
|
1441
|
+
l1GasUsed: e.l1GasUsed ? vt(e.l1GasUsed) : null,
|
|
1442
|
+
l1Fee: e.l1Fee ? vt(e.l1Fee) : null,
|
|
1443
1443
|
l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
|
|
1444
1444
|
};
|
|
1445
1445
|
}
|
|
@@ -1463,9 +1463,9 @@ function Na(e) {
|
|
|
1463
1463
|
a ? "0x1" : "0x",
|
|
1464
1464
|
r ?? "0x"
|
|
1465
1465
|
];
|
|
1466
|
-
return
|
|
1466
|
+
return Xt([
|
|
1467
1467
|
"0x7e",
|
|
1468
|
-
|
|
1468
|
+
ct(b)
|
|
1469
1469
|
]);
|
|
1470
1470
|
}
|
|
1471
1471
|
function Ma(e) {
|
|
@@ -1473,16 +1473,16 @@ function Ma(e) {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
function Da(e) {
|
|
1475
1475
|
const { from: t, to: r } = e;
|
|
1476
|
-
if (t && !
|
|
1477
|
-
throw new
|
|
1478
|
-
if (r && !
|
|
1479
|
-
throw new
|
|
1476
|
+
if (t && !ht(t))
|
|
1477
|
+
throw new lt({ address: t });
|
|
1478
|
+
if (r && !ht(r))
|
|
1479
|
+
throw new lt({ address: r });
|
|
1480
1480
|
}
|
|
1481
|
-
const
|
|
1481
|
+
const mr = {
|
|
1482
1482
|
contracts: La,
|
|
1483
1483
|
formatters: Fa,
|
|
1484
1484
|
serializers: Ua
|
|
1485
|
-
}, $a = /* @__PURE__ */
|
|
1485
|
+
}, $a = /* @__PURE__ */ pt({
|
|
1486
1486
|
id: 42161,
|
|
1487
1487
|
name: "Arbitrum One",
|
|
1488
1488
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1504,7 +1504,7 @@ const yr = {
|
|
|
1504
1504
|
blockCreated: 7654707
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
}), Ha = /* @__PURE__ */
|
|
1507
|
+
}), Ha = /* @__PURE__ */ pt({
|
|
1508
1508
|
id: 421614,
|
|
1509
1509
|
name: "Arbitrum Sepolia",
|
|
1510
1510
|
nativeCurrency: {
|
|
@@ -1531,8 +1531,8 @@ const yr = {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
},
|
|
1533
1533
|
testnet: !0
|
|
1534
|
-
}),
|
|
1535
|
-
...
|
|
1534
|
+
}), Mt = 1, za = /* @__PURE__ */ pt({
|
|
1535
|
+
...mr,
|
|
1536
1536
|
id: 8453,
|
|
1537
1537
|
name: "Base",
|
|
1538
1538
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1549,14 +1549,14 @@ const yr = {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
},
|
|
1551
1551
|
contracts: {
|
|
1552
|
-
...
|
|
1552
|
+
...mr.contracts,
|
|
1553
1553
|
disputeGameFactory: {
|
|
1554
|
-
[
|
|
1554
|
+
[Mt]: {
|
|
1555
1555
|
address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"
|
|
1556
1556
|
}
|
|
1557
1557
|
},
|
|
1558
1558
|
l2OutputOracle: {
|
|
1559
|
-
[
|
|
1559
|
+
[Mt]: {
|
|
1560
1560
|
address: "0x56315b90c40730925ec5485cf004d835058518A0"
|
|
1561
1561
|
}
|
|
1562
1562
|
},
|
|
@@ -1565,21 +1565,21 @@ const yr = {
|
|
|
1565
1565
|
blockCreated: 5022
|
|
1566
1566
|
},
|
|
1567
1567
|
portal: {
|
|
1568
|
-
[
|
|
1568
|
+
[Mt]: {
|
|
1569
1569
|
address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
|
|
1570
1570
|
blockCreated: 17482143
|
|
1571
1571
|
}
|
|
1572
1572
|
},
|
|
1573
1573
|
l1StandardBridge: {
|
|
1574
|
-
[
|
|
1574
|
+
[Mt]: {
|
|
1575
1575
|
address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
|
|
1576
1576
|
blockCreated: 17482143
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
1579
|
},
|
|
1580
|
-
sourceId:
|
|
1581
|
-
}),
|
|
1582
|
-
...
|
|
1580
|
+
sourceId: Mt
|
|
1581
|
+
}), Dt = 11155111, Ga = /* @__PURE__ */ pt({
|
|
1582
|
+
...mr,
|
|
1583
1583
|
id: 84532,
|
|
1584
1584
|
network: "base-sepolia",
|
|
1585
1585
|
name: "Base Sepolia",
|
|
@@ -1597,25 +1597,25 @@ const yr = {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
},
|
|
1599
1599
|
contracts: {
|
|
1600
|
-
...
|
|
1600
|
+
...mr.contracts,
|
|
1601
1601
|
disputeGameFactory: {
|
|
1602
|
-
[
|
|
1602
|
+
[Dt]: {
|
|
1603
1603
|
address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"
|
|
1604
1604
|
}
|
|
1605
1605
|
},
|
|
1606
1606
|
l2OutputOracle: {
|
|
1607
|
-
[
|
|
1607
|
+
[Dt]: {
|
|
1608
1608
|
address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"
|
|
1609
1609
|
}
|
|
1610
1610
|
},
|
|
1611
1611
|
portal: {
|
|
1612
|
-
[
|
|
1612
|
+
[Dt]: {
|
|
1613
1613
|
address: "0x49f53e41452c74589e85ca1677426ba426459e85",
|
|
1614
1614
|
blockCreated: 4446677
|
|
1615
1615
|
}
|
|
1616
1616
|
},
|
|
1617
1617
|
l1StandardBridge: {
|
|
1618
|
-
[
|
|
1618
|
+
[Dt]: {
|
|
1619
1619
|
address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
|
|
1620
1620
|
blockCreated: 4446677
|
|
1621
1621
|
}
|
|
@@ -1626,8 +1626,8 @@ const yr = {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
},
|
|
1628
1628
|
testnet: !0,
|
|
1629
|
-
sourceId:
|
|
1630
|
-
}), ja = /* @__PURE__ */
|
|
1629
|
+
sourceId: Dt
|
|
1630
|
+
}), ja = /* @__PURE__ */ pt({
|
|
1631
1631
|
id: 80084,
|
|
1632
1632
|
name: "Berachain bArtio",
|
|
1633
1633
|
nativeCurrency: {
|
|
@@ -1651,7 +1651,7 @@ const yr = {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
},
|
|
1653
1653
|
testnet: !0
|
|
1654
|
-
}), Wa = /* @__PURE__ */
|
|
1654
|
+
}), Wa = /* @__PURE__ */ pt({
|
|
1655
1655
|
id: 1,
|
|
1656
1656
|
name: "Ethereum",
|
|
1657
1657
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1680,7 +1680,7 @@ const yr = {
|
|
|
1680
1680
|
blockCreated: 14353601
|
|
1681
1681
|
}
|
|
1682
1682
|
}
|
|
1683
|
-
}), qa = /* @__PURE__ */
|
|
1683
|
+
}), qa = /* @__PURE__ */ pt({
|
|
1684
1684
|
id: 11155111,
|
|
1685
1685
|
name: "Sepolia",
|
|
1686
1686
|
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1712,7 +1712,7 @@ const yr = {
|
|
|
1712
1712
|
function on(e) {
|
|
1713
1713
|
return typeof e == "string" && (e = Buffer.from(e, "hex")), e.length === 32 ? e : e.subarray(1, 33);
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1715
|
+
function wt(e, t) {
|
|
1716
1716
|
if (!e) throw new Error(t);
|
|
1717
1717
|
}
|
|
1718
1718
|
function Va(e) {
|
|
@@ -1732,11 +1732,11 @@ function Ya(e, t) {
|
|
|
1732
1732
|
}
|
|
1733
1733
|
return [e, t];
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const it = (e) => e.length === 64 ? e : e.slice(2), Ja = (e) => {
|
|
1736
1736
|
if (!e) return !1;
|
|
1737
1737
|
try {
|
|
1738
1738
|
const t = Buffer.from(e, "hex");
|
|
1739
|
-
return
|
|
1739
|
+
return ft.isPoint(t);
|
|
1740
1740
|
} catch {
|
|
1741
1741
|
return !1;
|
|
1742
1742
|
}
|
|
@@ -1798,10 +1798,10 @@ const Mt = (e) => e.length === 64 ? e : e.slice(2), Ja = (e) => {
|
|
|
1798
1798
|
}, Za = (e) => typeof e == "object" && e !== null && "code" in e && e.code === 4902, ef = (e, t, r, n) => e + ":" + t.toLowerCase() + "::" + r + ":" + n.toLowerCase();
|
|
1799
1799
|
function El(e, t) {
|
|
1800
1800
|
if (!e) return !1;
|
|
1801
|
-
const r = t === "mainnet" ?
|
|
1802
|
-
|
|
1801
|
+
const r = t === "mainnet" ? se.networks.bitcoin : se.networks.testnet;
|
|
1802
|
+
se.initEccLib(ft);
|
|
1803
1803
|
try {
|
|
1804
|
-
return
|
|
1804
|
+
return se.address.toOutputScript(e, r), !0;
|
|
1805
1805
|
} catch {
|
|
1806
1806
|
return !1;
|
|
1807
1807
|
}
|
|
@@ -1831,7 +1831,7 @@ const Zi = (e, t, r) => {
|
|
|
1831
1831
|
const a = Number(
|
|
1832
1832
|
e.create_order.additional_data.deadline
|
|
1833
1833
|
);
|
|
1834
|
-
return i === re.Initiated ? te.CounterPartyInitiated : i === re.InitiateDetected ? te.CounterPartyInitiateDetected :
|
|
1834
|
+
return i === re.Initiated ? te.CounterPartyInitiated : i === re.InitiateDetected ? te.CounterPartyInitiateDetected : _r(a, 12) ? te.DeadLineExceeded : n === re.Initiated ? te.Initiated : _r(a, 1) ? te.DeadLineExceeded : n === re.InitiateDetected ? te.InitiateDetected : n === re.Redeemed ? te.CounterPartyRedeemed : n === re.RedeemDetected ? te.CounterPartyRedeemDetected : te.Matched;
|
|
1835
1835
|
}, Jn = (e, t) => {
|
|
1836
1836
|
if (e.redeem_tx_hash)
|
|
1837
1837
|
return Number(e.redeem_block_number) ? re.Redeemed : re.RedeemDetected;
|
|
@@ -1862,12 +1862,12 @@ const Zi = (e, t, r) => {
|
|
|
1862
1862
|
default:
|
|
1863
1863
|
return le.Idle;
|
|
1864
1864
|
}
|
|
1865
|
-
},
|
|
1865
|
+
}, _r = (e, t = 0) => {
|
|
1866
1866
|
const r = Date.now(), n = e * 1e3 + t * 36e5;
|
|
1867
1867
|
return r >= n;
|
|
1868
1868
|
}, tf = (e) => e.filter((t) => {
|
|
1869
1869
|
const { source_swap: r, create_order: n } = t, { initiate_tx_hash: i, initiate_block_number: a } = r, { deadline: f } = n.additional_data;
|
|
1870
|
-
return i && Number(a) ? !0 : i && !Number(a) ? !
|
|
1870
|
+
return i && Number(a) ? !0 : i && !Number(a) ? !_r(Number(f), 12) : i ? !0 : !_r(Number(f), 1);
|
|
1871
1871
|
}), rf = [
|
|
1872
1872
|
{
|
|
1873
1873
|
inputs: [
|
|
@@ -2272,21 +2272,21 @@ class nf {
|
|
|
2272
2272
|
const { create_order: r, source_swap: n } = this.order;
|
|
2273
2273
|
if (!n.amount || !n.redeemer || !r.timelock || !r.secret_hash)
|
|
2274
2274
|
return N("Invalid order");
|
|
2275
|
-
const i =
|
|
2275
|
+
const i = hr(r.secret_hash), a = BigInt(r.timelock), f = hr(n.redeemer), u = BigInt(n.amount);
|
|
2276
2276
|
try {
|
|
2277
2277
|
const l = await this.auth.getToken();
|
|
2278
2278
|
if (l.error) return N(l.error);
|
|
2279
2279
|
const b = Zs({
|
|
2280
|
-
address:
|
|
2280
|
+
address: hr(this.order.source_swap.asset),
|
|
2281
2281
|
abi: rf,
|
|
2282
2282
|
client: t
|
|
2283
|
-
}),
|
|
2283
|
+
}), g = await b.read.token(), m = await Xs(
|
|
2284
2284
|
Number(u),
|
|
2285
|
-
|
|
2285
|
+
g,
|
|
2286
2286
|
this.order.source_swap.asset,
|
|
2287
2287
|
t
|
|
2288
2288
|
);
|
|
2289
|
-
if (
|
|
2289
|
+
if (m.error) return N(m.error);
|
|
2290
2290
|
const v = await b.read.eip712Domain(), A = await t.signTypedData({
|
|
2291
2291
|
account: t.account,
|
|
2292
2292
|
domain: {
|
|
@@ -2310,7 +2310,7 @@ class nf {
|
|
|
2310
2310
|
amount: u,
|
|
2311
2311
|
secretHash: i
|
|
2312
2312
|
}
|
|
2313
|
-
}), B = await
|
|
2313
|
+
}), B = await ot.post(
|
|
2314
2314
|
this.url.endpoint("initiate"),
|
|
2315
2315
|
{
|
|
2316
2316
|
body: JSON.stringify({
|
|
@@ -2333,12 +2333,12 @@ class nf {
|
|
|
2333
2333
|
try {
|
|
2334
2334
|
const n = await this.auth.getToken();
|
|
2335
2335
|
if (n.error) return N(n.error);
|
|
2336
|
-
const i = await
|
|
2336
|
+
const i = await ot.post(
|
|
2337
2337
|
this.url.endpoint("redeem"),
|
|
2338
2338
|
{
|
|
2339
2339
|
body: JSON.stringify({
|
|
2340
2340
|
order_id: t,
|
|
2341
|
-
secret:
|
|
2341
|
+
secret: st(r),
|
|
2342
2342
|
perform_on: "Destination"
|
|
2343
2343
|
}),
|
|
2344
2344
|
headers: {
|
|
@@ -2367,13 +2367,13 @@ const sf = Buffer.from(
|
|
|
2367
2367
|
failedToTweakPubkey: "failed to tweak pubkey"
|
|
2368
2368
|
};
|
|
2369
2369
|
function uf() {
|
|
2370
|
-
const e = eo.sha256(Buffer.from("GardenHTLC", "utf-8")), t =
|
|
2370
|
+
const e = eo.sha256(Buffer.from("GardenHTLC", "utf-8")), t = ft.pointMultiply(
|
|
2371
2371
|
Buffer.concat([Buffer.from("04", "hex"), af]),
|
|
2372
2372
|
e
|
|
2373
2373
|
);
|
|
2374
2374
|
if (!t)
|
|
2375
2375
|
throw new Error(Xn.failedToCreateInternalPubkey);
|
|
2376
|
-
const r =
|
|
2376
|
+
const r = ft.pointAdd(ff, t);
|
|
2377
2377
|
if (!r) throw new Error(Xn.failedToCreateInternalPubkey);
|
|
2378
2378
|
return on(Buffer.from(r));
|
|
2379
2379
|
}
|
|
@@ -2390,9 +2390,9 @@ const me = {
|
|
|
2390
2390
|
htlcNotExpired: (e) => `HTLC not expired, need more ${e} blocks`,
|
|
2391
2391
|
controlBlockGenerationFailed: "failed to generate control block",
|
|
2392
2392
|
invalidLeaf: "invalid leaf"
|
|
2393
|
-
},
|
|
2394
|
-
|
|
2395
|
-
class
|
|
2393
|
+
}, ur = 192;
|
|
2394
|
+
se.initEccLib(ft);
|
|
2395
|
+
class Vt {
|
|
2396
2396
|
/**
|
|
2397
2397
|
* Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
|
|
2398
2398
|
*/
|
|
@@ -2413,15 +2413,15 @@ class mr {
|
|
|
2413
2413
|
* When the signer is the redeemer, only redeem can be done
|
|
2414
2414
|
*/
|
|
2415
2415
|
static async from(t, r, n, i, a, f, u) {
|
|
2416
|
-
n = n.startsWith("0x") ? n.slice(2) : n,
|
|
2416
|
+
n = n.startsWith("0x") ? n.slice(2) : n, wt(n.length === 64, me.secretHashLenMismatch), wt(
|
|
2417
2417
|
i.length === 64 || i.length === 66,
|
|
2418
2418
|
`initiator ${me.pubkeyLenMismatch}`
|
|
2419
|
-
),
|
|
2419
|
+
), wt(
|
|
2420
2420
|
a.length === 64 || a.length === 66,
|
|
2421
2421
|
`redeemer ${me.pubkeyLenMismatch}`
|
|
2422
|
-
),
|
|
2422
|
+
), wt(f > 0, me.zeroOrNegativeExpiry);
|
|
2423
2423
|
const l = await t.getNetwork();
|
|
2424
|
-
return new
|
|
2424
|
+
return new Vt(
|
|
2425
2425
|
t,
|
|
2426
2426
|
r,
|
|
2427
2427
|
n,
|
|
@@ -2436,7 +2436,7 @@ class mr {
|
|
|
2436
2436
|
* Generates a taproot address for receiving the funds
|
|
2437
2437
|
*/
|
|
2438
2438
|
address() {
|
|
2439
|
-
const { address: t } =
|
|
2439
|
+
const { address: t } = se.payments.p2tr({
|
|
2440
2440
|
internalPubkey: this.internalPubkey,
|
|
2441
2441
|
network: this.network,
|
|
2442
2442
|
scriptTree: this.leaves()
|
|
@@ -2451,19 +2451,19 @@ class mr {
|
|
|
2451
2451
|
return this.address();
|
|
2452
2452
|
}
|
|
2453
2453
|
async _buildRawTx(t, r) {
|
|
2454
|
-
const n = new
|
|
2454
|
+
const n = new se.Transaction();
|
|
2455
2455
|
n.version = 2;
|
|
2456
2456
|
const i = this.address(), a = await this.signer.getProvider();
|
|
2457
2457
|
let f = [];
|
|
2458
2458
|
if (this.utxoHashes && this.utxoHashes.length > 0)
|
|
2459
2459
|
for (const l of this.utxoHashes) {
|
|
2460
2460
|
const b = await a.getTransaction(l);
|
|
2461
|
-
for (let
|
|
2462
|
-
const
|
|
2463
|
-
|
|
2461
|
+
for (let g = 0; g < b.vout.length; g++) {
|
|
2462
|
+
const m = b.vout[g];
|
|
2463
|
+
m.scriptpubkey_address === i && f.push({
|
|
2464
2464
|
txid: b.txid,
|
|
2465
|
-
vout:
|
|
2466
|
-
value:
|
|
2465
|
+
vout: g,
|
|
2466
|
+
value: m.value,
|
|
2467
2467
|
status: { confirmed: !1 }
|
|
2468
2468
|
});
|
|
2469
2469
|
}
|
|
@@ -2475,7 +2475,7 @@ class mr {
|
|
|
2475
2475
|
for (let l = 0; l < f.length; l++)
|
|
2476
2476
|
n.addInput(Buffer.from(f[l].txid, "hex").reverse(), f[l].vout);
|
|
2477
2477
|
return r ?? (r = await a.suggestFee(i, u, Dn.MEDIUM)), n.addOutput(
|
|
2478
|
-
|
|
2478
|
+
se.address.toOutputScript(t, this.network),
|
|
2479
2479
|
u - r
|
|
2480
2480
|
), { tx: n, usedUtxos: f };
|
|
2481
2481
|
}
|
|
@@ -2490,7 +2490,7 @@ class mr {
|
|
|
2490
2490
|
* prevout script for the gardenHTLC address
|
|
2491
2491
|
*/
|
|
2492
2492
|
getOutputScript() {
|
|
2493
|
-
return
|
|
2493
|
+
return se.address.toOutputScript(this.address(), this.network);
|
|
2494
2494
|
}
|
|
2495
2495
|
async init(t) {
|
|
2496
2496
|
return t ?? (t = await (await this.signer.getProvider()).suggestFee(
|
|
@@ -2499,41 +2499,69 @@ class mr {
|
|
|
2499
2499
|
Dn.MEDIUM
|
|
2500
2500
|
)), await this.signer.send(this.address(), this.initiateAmount, t);
|
|
2501
2501
|
}
|
|
2502
|
+
async generateInstantRefundSACP(t, r) {
|
|
2503
|
+
const { tx: n, usedUtxos: i } = await this._buildRawTx(t, r), a = this.getOutputScript(), f = se.Transaction.SIGHASH_SINGLE | se.Transaction.SIGHASH_ANYONECANPAY, u = this.leafHash(
|
|
2504
|
+
2
|
|
2505
|
+
/* INSTANT_REFUND */
|
|
2506
|
+
), l = i.map((g) => g.value), b = cr(a, i.length);
|
|
2507
|
+
for (let g = 0; g < n.ins.length; g++) {
|
|
2508
|
+
const m = n.hashForWitnessV1(
|
|
2509
|
+
g,
|
|
2510
|
+
b,
|
|
2511
|
+
l,
|
|
2512
|
+
f,
|
|
2513
|
+
u
|
|
2514
|
+
), v = await this.signer.signSchnorr(m);
|
|
2515
|
+
n.setWitness(g, [
|
|
2516
|
+
// first is initiator's signature
|
|
2517
|
+
v,
|
|
2518
|
+
// second is redeemer's signature
|
|
2519
|
+
// this is then modified by the redeemer to include their signature
|
|
2520
|
+
v,
|
|
2521
|
+
this.instantRefundLeaf(),
|
|
2522
|
+
this.generateControlBlockFor(
|
|
2523
|
+
2
|
|
2524
|
+
/* INSTANT_REFUND */
|
|
2525
|
+
)
|
|
2526
|
+
]);
|
|
2527
|
+
}
|
|
2528
|
+
return n.toHex();
|
|
2529
|
+
}
|
|
2502
2530
|
/**
|
|
2503
2531
|
* Instantly refunds the funds to the initiator given the counterparty's signatures and pubkey
|
|
2504
2532
|
*
|
|
2505
2533
|
* Note: If there are multiple UTXOs being spend, there should be a signature for each UTXO in counterPartySigs
|
|
2506
2534
|
*/
|
|
2507
2535
|
async instantRefund(t, r) {
|
|
2508
|
-
|
|
2536
|
+
wt(t.length > 0, me.noCounterpartySigs);
|
|
2509
2537
|
const { tx: n, usedUtxos: i } = await this.buildRawTx(r);
|
|
2510
|
-
for (const
|
|
2511
|
-
if (!t.find((v) => v.utxo ===
|
|
2512
|
-
throw new Error(me.counterPartySigNotFound(
|
|
2513
|
-
const a = this.getOutputScript(), f =
|
|
2538
|
+
for (const m of i)
|
|
2539
|
+
if (!t.find((v) => v.utxo === m.txid))
|
|
2540
|
+
throw new Error(me.counterPartySigNotFound(m.txid));
|
|
2541
|
+
const a = this.getOutputScript(), f = se.Transaction.SIGHASH_DEFAULT, u = this.leafHash(
|
|
2514
2542
|
2
|
|
2515
2543
|
/* INSTANT_REFUND */
|
|
2516
|
-
), l = i.map((
|
|
2517
|
-
for (let
|
|
2544
|
+
), l = i.map((m) => m.value), b = cr(a, i.length);
|
|
2545
|
+
for (let m = 0; m < n.ins.length; m++) {
|
|
2518
2546
|
const v = n.hashForWitnessV1(
|
|
2519
|
-
|
|
2547
|
+
m,
|
|
2520
2548
|
b,
|
|
2521
2549
|
l,
|
|
2522
2550
|
f,
|
|
2523
2551
|
u
|
|
2524
2552
|
);
|
|
2525
|
-
if (!
|
|
2553
|
+
if (!ft.verifySchnorr(
|
|
2526
2554
|
v,
|
|
2527
2555
|
Buffer.from(this.redeemerPubkey, "hex"),
|
|
2528
|
-
Buffer.from(t[
|
|
2556
|
+
Buffer.from(t[m].sig, "hex")
|
|
2529
2557
|
))
|
|
2530
2558
|
throw new Error(
|
|
2531
|
-
me.invalidCounterpartySigForUTXO(t[
|
|
2559
|
+
me.invalidCounterpartySigForUTXO(t[m].utxo)
|
|
2532
2560
|
);
|
|
2533
|
-
const A = await this.signer.signSchnorr(v), B = Buffer.from(n.ins[
|
|
2561
|
+
const A = await this.signer.signSchnorr(v), B = Buffer.from(n.ins[m].hash).reverse().toString("hex"), P = t.find((T) => T.utxo === B);
|
|
2534
2562
|
if (!P)
|
|
2535
2563
|
throw new Error(me.counterPartySigNotFound(B));
|
|
2536
|
-
n.setWitness(
|
|
2564
|
+
n.setWitness(m, [
|
|
2537
2565
|
Buffer.from(P.sig, "hex"),
|
|
2538
2566
|
A,
|
|
2539
2567
|
this.instantRefundLeaf(),
|
|
@@ -2549,8 +2577,8 @@ class mr {
|
|
|
2549
2577
|
* Reveals the secret and redeems the HTLC
|
|
2550
2578
|
*/
|
|
2551
2579
|
async redeem(t, r, n) {
|
|
2552
|
-
|
|
2553
|
-
|
|
2580
|
+
wt(
|
|
2581
|
+
se.crypto.sha256(Buffer.from(t, "hex")).toString("hex") === this.secretHash,
|
|
2554
2582
|
me.secretMismatch
|
|
2555
2583
|
);
|
|
2556
2584
|
const { tx: i, usedUtxos: a } = await this._buildRawTx(
|
|
@@ -2559,16 +2587,16 @@ class mr {
|
|
|
2559
2587
|
), f = this.leafHash(
|
|
2560
2588
|
1
|
|
2561
2589
|
/* REDEEM */
|
|
2562
|
-
), u = a.map((
|
|
2563
|
-
for (let
|
|
2590
|
+
), u = a.map((m) => m.value), l = cr(this.getOutputScript(), a.length), b = se.Transaction.SIGHASH_DEFAULT;
|
|
2591
|
+
for (let m = 0; m < i.ins.length; m++) {
|
|
2564
2592
|
const v = i.hashForWitnessV1(
|
|
2565
|
-
|
|
2593
|
+
m,
|
|
2566
2594
|
l,
|
|
2567
2595
|
u,
|
|
2568
2596
|
b,
|
|
2569
2597
|
f
|
|
2570
2598
|
), A = await this.signer.signSchnorr(v);
|
|
2571
|
-
i.setWitness(
|
|
2599
|
+
i.setWitness(m, [
|
|
2572
2600
|
A,
|
|
2573
2601
|
Buffer.from(t, "hex"),
|
|
2574
2602
|
this.redeemLeaf(),
|
|
@@ -2593,14 +2621,14 @@ class mr {
|
|
|
2593
2621
|
const u = this.leafHash(
|
|
2594
2622
|
0
|
|
2595
2623
|
/* REFUND */
|
|
2596
|
-
), l = i.map((v) => v.value), b =
|
|
2624
|
+
), l = i.map((v) => v.value), b = cr(this.getOutputScript(), i.length), g = se.Transaction.SIGHASH_DEFAULT;
|
|
2597
2625
|
for (let v = 0; v < n.ins.length; v++) {
|
|
2598
2626
|
n.ins[v].sequence = this.expiry;
|
|
2599
2627
|
const A = n.hashForWitnessV1(
|
|
2600
2628
|
v,
|
|
2601
2629
|
b,
|
|
2602
2630
|
l,
|
|
2603
|
-
|
|
2631
|
+
g,
|
|
2604
2632
|
u
|
|
2605
2633
|
), B = await this.signer.signSchnorr(A);
|
|
2606
2634
|
n.setWitness(v, [
|
|
@@ -2644,13 +2672,13 @@ class mr {
|
|
|
2644
2672
|
default:
|
|
2645
2673
|
throw new Error(me.invalidLeaf);
|
|
2646
2674
|
}
|
|
2647
|
-
const n =
|
|
2675
|
+
const n = se.payments.p2tr({
|
|
2648
2676
|
internalPubkey: this.internalPubkey,
|
|
2649
2677
|
network: this.network,
|
|
2650
2678
|
scriptTree: this.leaves(),
|
|
2651
2679
|
redeem: {
|
|
2652
2680
|
output: r,
|
|
2653
|
-
redeemVersion:
|
|
2681
|
+
redeemVersion: ur
|
|
2654
2682
|
}
|
|
2655
2683
|
});
|
|
2656
2684
|
if (!n.witness)
|
|
@@ -2664,12 +2692,12 @@ class mr {
|
|
|
2664
2692
|
*/
|
|
2665
2693
|
leafHash(t) {
|
|
2666
2694
|
let r = this.redeemLeaf();
|
|
2667
|
-
return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()),
|
|
2695
|
+
return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()), se.crypto.taggedHash("TapLeaf", Va(r));
|
|
2668
2696
|
}
|
|
2669
2697
|
refundLeaf() {
|
|
2670
|
-
return
|
|
2698
|
+
return se.script.fromASM(
|
|
2671
2699
|
`
|
|
2672
|
-
${
|
|
2700
|
+
${se.script.number.encode(this.expiry).toString("hex")}
|
|
2673
2701
|
OP_CHECKSEQUENCEVERIFY
|
|
2674
2702
|
OP_DROP
|
|
2675
2703
|
${this.initiatorPubkey}
|
|
@@ -2678,7 +2706,7 @@ class mr {
|
|
|
2678
2706
|
);
|
|
2679
2707
|
}
|
|
2680
2708
|
redeemLeaf() {
|
|
2681
|
-
return
|
|
2709
|
+
return se.script.fromASM(
|
|
2682
2710
|
`
|
|
2683
2711
|
OP_SHA256
|
|
2684
2712
|
${this.secretHash}
|
|
@@ -2689,7 +2717,7 @@ class mr {
|
|
|
2689
2717
|
);
|
|
2690
2718
|
}
|
|
2691
2719
|
instantRefundLeaf() {
|
|
2692
|
-
return
|
|
2720
|
+
return se.script.fromASM(
|
|
2693
2721
|
`
|
|
2694
2722
|
${this.initiatorPubkey}
|
|
2695
2723
|
OP_CHECKSIG
|
|
@@ -2704,16 +2732,16 @@ class mr {
|
|
|
2704
2732
|
return [
|
|
2705
2733
|
// most probable leaf (redeem)
|
|
2706
2734
|
{
|
|
2707
|
-
version:
|
|
2735
|
+
version: ur,
|
|
2708
2736
|
output: this.redeemLeaf()
|
|
2709
2737
|
},
|
|
2710
2738
|
[
|
|
2711
2739
|
{
|
|
2712
|
-
version:
|
|
2740
|
+
version: ur,
|
|
2713
2741
|
output: this.refundLeaf()
|
|
2714
2742
|
},
|
|
2715
2743
|
{
|
|
2716
|
-
version:
|
|
2744
|
+
version: ur,
|
|
2717
2745
|
output: this.instantRefundLeaf()
|
|
2718
2746
|
}
|
|
2719
2747
|
]
|
|
@@ -2740,7 +2768,7 @@ class mr {
|
|
|
2740
2768
|
n
|
|
2741
2769
|
);
|
|
2742
2770
|
return [
|
|
2743
|
-
|
|
2771
|
+
se.crypto.taggedHash(
|
|
2744
2772
|
"TapBranch",
|
|
2745
2773
|
Buffer.concat(a)
|
|
2746
2774
|
)
|
|
@@ -2755,7 +2783,7 @@ class mr {
|
|
|
2755
2783
|
}
|
|
2756
2784
|
}
|
|
2757
2785
|
}
|
|
2758
|
-
function
|
|
2786
|
+
function cr(e, t) {
|
|
2759
2787
|
const r = [];
|
|
2760
2788
|
for (let n = 0; n < t; n++)
|
|
2761
2789
|
r.push(e);
|
|
@@ -2805,12 +2833,12 @@ class Sl {
|
|
|
2805
2833
|
}
|
|
2806
2834
|
const u = this.secretManager.generateSecret(f);
|
|
2807
2835
|
if (u.error) return N(u.error);
|
|
2808
|
-
const { strategyId: l, btcAddress: b } = t.additionalData,
|
|
2836
|
+
const { strategyId: l, btcAddress: b } = t.additionalData, g = {
|
|
2809
2837
|
strategy_id: l,
|
|
2810
2838
|
...b && {
|
|
2811
2839
|
bitcoin_optional_recipient: b
|
|
2812
2840
|
}
|
|
2813
|
-
},
|
|
2841
|
+
}, m = {
|
|
2814
2842
|
source_chain: t.fromAsset.chain,
|
|
2815
2843
|
destination_chain: t.toAsset.chain,
|
|
2816
2844
|
source_asset: t.fromAsset.atomicSwapAddress,
|
|
@@ -2822,10 +2850,10 @@ class Sl {
|
|
|
2822
2850
|
fee: "1",
|
|
2823
2851
|
nonce: f.toString(),
|
|
2824
2852
|
timelock: a,
|
|
2825
|
-
secret_hash:
|
|
2853
|
+
secret_hash: st(u.val.secretHash),
|
|
2826
2854
|
min_destination_confirmations: t.minDestinationConfirmations ?? 0,
|
|
2827
|
-
additional_data:
|
|
2828
|
-
}, v = await this.quote.getAttestedQuote(
|
|
2855
|
+
additional_data: g
|
|
2856
|
+
}, v = await this.quote.getAttestedQuote(m);
|
|
2829
2857
|
if (v.error) return N(v.error);
|
|
2830
2858
|
const A = await this.orderBook.createOrder(v.val);
|
|
2831
2859
|
if (A.error) return N(A.error);
|
|
@@ -2835,11 +2863,11 @@ class Sl {
|
|
|
2835
2863
|
async validateAndFillParams(t) {
|
|
2836
2864
|
if (t.fromAsset.chain === t.toAsset.chain && t.fromAsset.atomicSwapAddress === t.toAsset.atomicSwapAddress)
|
|
2837
2865
|
return N("Source and destination assets cannot be the same");
|
|
2838
|
-
if (
|
|
2866
|
+
if (sr(t.fromAsset.chain) && !sr(t.toAsset.chain) || !sr(t.fromAsset.chain) && sr(t.toAsset.chain))
|
|
2839
2867
|
return N(
|
|
2840
2868
|
"Both assets should be on the same network (either mainnet or testnet)"
|
|
2841
2869
|
);
|
|
2842
|
-
if (
|
|
2870
|
+
if (Ot(t.fromAsset.chain) || Ot(t.toAsset.chain)) {
|
|
2843
2871
|
if (!this.wallets.btcWallet)
|
|
2844
2872
|
return N(
|
|
2845
2873
|
"btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor"
|
|
@@ -2868,12 +2896,12 @@ class Sl {
|
|
|
2868
2896
|
}
|
|
2869
2897
|
async getAddresses(t) {
|
|
2870
2898
|
var n;
|
|
2871
|
-
switch (
|
|
2899
|
+
switch (or(t)) {
|
|
2872
2900
|
case Ve.EVM:
|
|
2873
2901
|
return this.wallets.evmWallet.account ? ue(this.wallets.evmWallet.account.address) : N("EVM Wallet not found");
|
|
2874
2902
|
case Ve.Bitcoin: {
|
|
2875
2903
|
const i = await ((n = this.wallets.btcWallet) == null ? void 0 : n.getPublicKey());
|
|
2876
|
-
return !i || !Ja(i) ? N("Invalid btc public key") : ue(
|
|
2904
|
+
return !i || !Ja(i) ? N("Invalid btc public key") : ue(it(i));
|
|
2877
2905
|
}
|
|
2878
2906
|
default:
|
|
2879
2907
|
return N("Unsupported chain");
|
|
@@ -2905,8 +2933,37 @@ class Sl {
|
|
|
2905
2933
|
const n = tf(r.data), i = await this.assignOrderStatus(n);
|
|
2906
2934
|
this.emit("onPendingOrdersChanged", i);
|
|
2907
2935
|
for (let a = 0; a < i.length; a++) {
|
|
2908
|
-
const f = i[a];
|
|
2909
|
-
|
|
2936
|
+
const f = i[a], u = es(f.status);
|
|
2937
|
+
if (Ot(f.source_swap.chain) && f.status === te.InitiateDetected) {
|
|
2938
|
+
const l = this.getWallet(f.source_swap.chain);
|
|
2939
|
+
if (l.error) {
|
|
2940
|
+
this.emit("error", f, l.error);
|
|
2941
|
+
continue;
|
|
2942
|
+
}
|
|
2943
|
+
const b = await Vt.from(
|
|
2944
|
+
l.val,
|
|
2945
|
+
Number(f.source_swap.amount),
|
|
2946
|
+
f.create_order.secret_hash,
|
|
2947
|
+
it(f.source_swap.initiator),
|
|
2948
|
+
it(f.source_swap.redeemer),
|
|
2949
|
+
f.destination_swap.timelock
|
|
2950
|
+
), g = f.create_order.additional_data.bitcoin_optional_recipient;
|
|
2951
|
+
if (g)
|
|
2952
|
+
try {
|
|
2953
|
+
const m = await b.generateInstantRefundSACP(
|
|
2954
|
+
g
|
|
2955
|
+
), v = this.orderbookUrl + "/orders/add-instant-refund-sacp";
|
|
2956
|
+
await ot.post(v, {
|
|
2957
|
+
body: JSON.stringify({
|
|
2958
|
+
order_id: f.create_order.create_id,
|
|
2959
|
+
instant_refund_tx_bytes: m
|
|
2960
|
+
})
|
|
2961
|
+
});
|
|
2962
|
+
} catch (m) {
|
|
2963
|
+
this.emit("error", f, "Failed to generate SACP: " + m);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
switch (u) {
|
|
2910
2967
|
case le.Redeem: {
|
|
2911
2968
|
const l = this.secretManager.generateSecret(
|
|
2912
2969
|
Number(f.create_order.nonce)
|
|
@@ -2915,7 +2972,7 @@ class Sl {
|
|
|
2915
2972
|
this.emit("error", f, l.error);
|
|
2916
2973
|
return;
|
|
2917
2974
|
}
|
|
2918
|
-
switch (
|
|
2975
|
+
switch (or(f.destination_swap.chain)) {
|
|
2919
2976
|
case Ve.EVM: {
|
|
2920
2977
|
await this.evmRedeem(f, l.val.secret);
|
|
2921
2978
|
break;
|
|
@@ -2945,7 +3002,7 @@ class Sl {
|
|
|
2945
3002
|
break;
|
|
2946
3003
|
}
|
|
2947
3004
|
case le.Refund: {
|
|
2948
|
-
switch (
|
|
3005
|
+
switch (or(f.source_swap.chain)) {
|
|
2949
3006
|
case Ve.EVM: {
|
|
2950
3007
|
this.emit(
|
|
2951
3008
|
"error",
|
|
@@ -3022,13 +3079,13 @@ class Sl {
|
|
|
3022
3079
|
else if (r.destination_swap.redeem_tx_hash && !Number(r.destination_swap.redeem_block_number))
|
|
3023
3080
|
try {
|
|
3024
3081
|
const b = await (await t.getProvider()).getTransaction(r.destination_swap.redeem_tx_hash);
|
|
3025
|
-
let
|
|
3026
|
-
for (const
|
|
3027
|
-
if (
|
|
3028
|
-
|
|
3082
|
+
let g = !1;
|
|
3083
|
+
for (const m of b.vin)
|
|
3084
|
+
if (m.txid === a) {
|
|
3085
|
+
g = !0;
|
|
3029
3086
|
break;
|
|
3030
3087
|
}
|
|
3031
|
-
if (
|
|
3088
|
+
if (g) {
|
|
3032
3089
|
this.orderExecutorCache.set(
|
|
3033
3090
|
r,
|
|
3034
3091
|
le.Redeem,
|
|
@@ -3052,23 +3109,23 @@ class Sl {
|
|
|
3052
3109
|
}
|
|
3053
3110
|
this.emit("log", r.create_order.create_id, "executing btc redeem");
|
|
3054
3111
|
try {
|
|
3055
|
-
const
|
|
3112
|
+
const g = await (await Vt.from(
|
|
3056
3113
|
t,
|
|
3057
3114
|
Number(r.destination_swap.amount),
|
|
3058
3115
|
r.create_order.secret_hash,
|
|
3059
|
-
|
|
3060
|
-
|
|
3116
|
+
it(r.destination_swap.initiator),
|
|
3117
|
+
it(r.destination_swap.redeemer),
|
|
3061
3118
|
r.destination_swap.timelock,
|
|
3062
3119
|
f ? [a] : []
|
|
3063
3120
|
)).redeem(
|
|
3064
|
-
|
|
3121
|
+
st(n),
|
|
3065
3122
|
(l = r.create_order.additional_data) == null ? void 0 : l.bitcoin_optional_recipient
|
|
3066
3123
|
);
|
|
3067
3124
|
f ? this.emit(
|
|
3068
3125
|
"log",
|
|
3069
3126
|
r.create_order.create_id,
|
|
3070
3127
|
"rbf: btc redeem success"
|
|
3071
|
-
) : this.emit("success", r, le.Redeem,
|
|
3128
|
+
) : this.emit("success", r, le.Redeem, g), this.orderExecutorCache.set(r, le.Redeem, g, a);
|
|
3072
3129
|
} catch (b) {
|
|
3073
3130
|
this.emit("error", r, "Failed btc redeem: " + b);
|
|
3074
3131
|
}
|
|
@@ -3078,12 +3135,12 @@ class Sl {
|
|
|
3078
3135
|
if (!this.orderExecutorCache.get(r, le.Refund)) {
|
|
3079
3136
|
this.emit("log", r.create_order.create_id, "executing btc refund");
|
|
3080
3137
|
try {
|
|
3081
|
-
const a = await (await
|
|
3138
|
+
const a = await (await Vt.from(
|
|
3082
3139
|
t,
|
|
3083
3140
|
Number(r.source_swap.amount),
|
|
3084
3141
|
r.create_order.secret_hash,
|
|
3085
|
-
|
|
3086
|
-
|
|
3142
|
+
it(r.source_swap.initiator),
|
|
3143
|
+
it(r.source_swap.redeemer),
|
|
3087
3144
|
r.source_swap.timelock
|
|
3088
3145
|
)).refund(
|
|
3089
3146
|
(n = r.create_order.additional_data) == null ? void 0 : n.bitcoin_optional_recipient
|
|
@@ -3095,7 +3152,7 @@ class Sl {
|
|
|
3095
3152
|
}
|
|
3096
3153
|
}
|
|
3097
3154
|
getWallet(t) {
|
|
3098
|
-
switch (
|
|
3155
|
+
switch (or(t)) {
|
|
3099
3156
|
case Ve.EVM:
|
|
3100
3157
|
return ue(this.wallets.evmWallet);
|
|
3101
3158
|
case Ve.Bitcoin:
|
|
@@ -3120,11 +3177,11 @@ class Sl {
|
|
|
3120
3177
|
async fetchCurrentBlockNumbers(t, r) {
|
|
3121
3178
|
if (!r || !r.source || !r.destination)
|
|
3122
3179
|
return N("Provide wallets to fetch the current block number");
|
|
3123
|
-
const n =
|
|
3180
|
+
const n = Ot(t.source_swap.chain) ? await Fn(
|
|
3124
3181
|
await r.source.getProvider()
|
|
3125
3182
|
) : await On(r.source);
|
|
3126
3183
|
if (n.error) return N(n.error);
|
|
3127
|
-
const i =
|
|
3184
|
+
const i = Ot(t.destination_swap.chain) ? await Fn(
|
|
3128
3185
|
await r.destination.getProvider()
|
|
3129
3186
|
) : await On(r.destination);
|
|
3130
3187
|
return i.error ? N(i.error) : ue({
|
|
@@ -3136,8 +3193,8 @@ class Sl {
|
|
|
3136
3193
|
var i;
|
|
3137
3194
|
const r = await ((i = this.blockNumberFetcher) == null ? void 0 : i.fetchBlockNumbers()), n = [];
|
|
3138
3195
|
for (let a = 0; a < t.length; a++) {
|
|
3139
|
-
const f = t[a], u = f.source_swap.chain, l = f.destination_swap.chain, b = this.getWallet(u),
|
|
3140
|
-
if (b.error ||
|
|
3196
|
+
const f = t[a], u = f.source_swap.chain, l = f.destination_swap.chain, b = this.getWallet(u), g = this.getWallet(l);
|
|
3197
|
+
if (b.error || g.error || !b.val || !g.val) {
|
|
3141
3198
|
this.emit(
|
|
3142
3199
|
"error",
|
|
3143
3200
|
f,
|
|
@@ -3145,11 +3202,11 @@ class Sl {
|
|
|
3145
3202
|
);
|
|
3146
3203
|
continue;
|
|
3147
3204
|
}
|
|
3148
|
-
let
|
|
3149
|
-
if (!
|
|
3205
|
+
let m = r == null ? void 0 : r.val[u], v = r == null ? void 0 : r.val[l];
|
|
3206
|
+
if (!m || !v) {
|
|
3150
3207
|
const B = await this.fetchCurrentBlockNumbers(f, {
|
|
3151
3208
|
source: b.val,
|
|
3152
|
-
destination:
|
|
3209
|
+
destination: g.val
|
|
3153
3210
|
});
|
|
3154
3211
|
if (B.error) {
|
|
3155
3212
|
this.emit(
|
|
@@ -3159,11 +3216,11 @@ class Sl {
|
|
|
3159
3216
|
);
|
|
3160
3217
|
continue;
|
|
3161
3218
|
}
|
|
3162
|
-
|
|
3219
|
+
m = B.val.source, v = B.val.destination;
|
|
3163
3220
|
}
|
|
3164
3221
|
const A = Zi(
|
|
3165
3222
|
f,
|
|
3166
|
-
|
|
3223
|
+
m,
|
|
3167
3224
|
v
|
|
3168
3225
|
);
|
|
3169
3226
|
n.push({
|
|
@@ -3180,7 +3237,7 @@ class Al {
|
|
|
3180
3237
|
}
|
|
3181
3238
|
async fetchBlockNumbers() {
|
|
3182
3239
|
try {
|
|
3183
|
-
const t = await
|
|
3240
|
+
const t = await ot.get(this.url);
|
|
3184
3241
|
return ue(t);
|
|
3185
3242
|
} catch (t) {
|
|
3186
3243
|
return N("Failed to fetch block numbers", t);
|
|
@@ -3210,10 +3267,10 @@ function hf(e) {
|
|
|
3210
3267
|
});
|
|
3211
3268
|
}), r;
|
|
3212
3269
|
}
|
|
3213
|
-
var ts = {},
|
|
3214
|
-
Object.defineProperty(
|
|
3215
|
-
|
|
3216
|
-
|
|
3270
|
+
var ts = {}, At = {}, It = {};
|
|
3271
|
+
Object.defineProperty(It, "__esModule", { value: !0 });
|
|
3272
|
+
It.testnet = It.bitcoin = void 0;
|
|
3273
|
+
It.bitcoin = {
|
|
3217
3274
|
messagePrefix: `Bitcoin Signed Message:
|
|
3218
3275
|
`,
|
|
3219
3276
|
bech32: "bc",
|
|
@@ -3225,7 +3282,7 @@ At.bitcoin = {
|
|
|
3225
3282
|
scriptHash: 5,
|
|
3226
3283
|
wif: 128
|
|
3227
3284
|
};
|
|
3228
|
-
|
|
3285
|
+
It.testnet = {
|
|
3229
3286
|
messagePrefix: `Bitcoin Signed Message:
|
|
3230
3287
|
`,
|
|
3231
3288
|
bech32: "tb",
|
|
@@ -3237,7 +3294,7 @@ At.testnet = {
|
|
|
3237
3294
|
scriptHash: 196,
|
|
3238
3295
|
wif: 239
|
|
3239
3296
|
};
|
|
3240
|
-
var rs = {},
|
|
3297
|
+
var rs = {}, Kt = {
|
|
3241
3298
|
Array: function(e) {
|
|
3242
3299
|
return e != null && e.constructor === Array;
|
|
3243
3300
|
},
|
|
@@ -3263,30 +3320,30 @@ var rs = {}, qt = {
|
|
|
3263
3320
|
return !0;
|
|
3264
3321
|
}
|
|
3265
3322
|
};
|
|
3266
|
-
|
|
3267
|
-
for (var Qn in
|
|
3268
|
-
|
|
3323
|
+
Kt.Null = Kt.Nil;
|
|
3324
|
+
for (var Qn in Kt)
|
|
3325
|
+
Kt[Qn].toJSON = (function(e) {
|
|
3269
3326
|
return e;
|
|
3270
3327
|
}).bind(null, Qn);
|
|
3271
|
-
var Sn =
|
|
3328
|
+
var Sn = Kt, at = Sn;
|
|
3272
3329
|
function ns(e) {
|
|
3273
3330
|
return e.name || e.toString().match(/function (.*?)\s*\(/)[1];
|
|
3274
3331
|
}
|
|
3275
3332
|
function An(e) {
|
|
3276
|
-
return
|
|
3333
|
+
return at.Nil(e) ? "" : ns(e.constructor);
|
|
3277
3334
|
}
|
|
3278
3335
|
function df(e) {
|
|
3279
|
-
return
|
|
3336
|
+
return at.Function(e) ? "" : at.String(e) ? JSON.stringify(e) : e && at.Object(e) ? "" : e;
|
|
3280
3337
|
}
|
|
3281
3338
|
function In(e, t) {
|
|
3282
3339
|
Error.captureStackTrace && Error.captureStackTrace(e, t);
|
|
3283
3340
|
}
|
|
3284
|
-
function
|
|
3285
|
-
return
|
|
3341
|
+
function wr(e) {
|
|
3342
|
+
return at.Function(e) ? e.toJSON ? e.toJSON() : ns(e) : at.Array(e) ? "Array" : e && at.Object(e) ? "Object" : e !== void 0 ? e : "";
|
|
3286
3343
|
}
|
|
3287
3344
|
function is(e, t, r) {
|
|
3288
3345
|
var n = df(t);
|
|
3289
|
-
return "Expected " +
|
|
3346
|
+
return "Expected " + wr(e) + ", got" + (r !== "" ? " " + r : "") + (n !== "" ? " " + n : "");
|
|
3290
3347
|
}
|
|
3291
3348
|
function $e(e, t, r) {
|
|
3292
3349
|
r = r || An(t), this.message = is(e, t, r), In(this, $e), this.__type = e, this.__value = t, this.__valueTypeName = r;
|
|
@@ -3295,24 +3352,24 @@ $e.prototype = Object.create(Error.prototype);
|
|
|
3295
3352
|
$e.prototype.constructor = $e;
|
|
3296
3353
|
function pf(e, t, r, n, i) {
|
|
3297
3354
|
var a = '" of type ';
|
|
3298
|
-
return t === "key" && (a = '" with key type '), is('property "' +
|
|
3355
|
+
return t === "key" && (a = '" with key type '), is('property "' + wr(r) + a + wr(e), n, i);
|
|
3299
3356
|
}
|
|
3300
|
-
function
|
|
3357
|
+
function Et(e, t, r, n, i) {
|
|
3301
3358
|
e ? (i = i || An(n), this.message = pf(e, r, t, n, i)) : this.message = 'Unexpected property "' + t + '"', In(this, $e), this.__label = r, this.__property = t, this.__type = e, this.__value = n, this.__valueTypeName = i;
|
|
3302
3359
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3360
|
+
Et.prototype = Object.create(Error.prototype);
|
|
3361
|
+
Et.prototype.constructor = $e;
|
|
3305
3362
|
function bf(e, t) {
|
|
3306
3363
|
return new $e(e, {}, t);
|
|
3307
3364
|
}
|
|
3308
3365
|
function yf(e, t, r) {
|
|
3309
|
-
return e instanceof
|
|
3366
|
+
return e instanceof Et ? (t = t + "." + e.__property, e = new Et(
|
|
3310
3367
|
e.__type,
|
|
3311
3368
|
t,
|
|
3312
3369
|
e.__label,
|
|
3313
3370
|
e.__value,
|
|
3314
3371
|
e.__valueTypeName
|
|
3315
|
-
)) : e instanceof $e && (e = new
|
|
3372
|
+
)) : e instanceof $e && (e = new Et(
|
|
3316
3373
|
e.__type,
|
|
3317
3374
|
t,
|
|
3318
3375
|
r,
|
|
@@ -3322,10 +3379,10 @@ function yf(e, t, r) {
|
|
|
3322
3379
|
}
|
|
3323
3380
|
var ss = {
|
|
3324
3381
|
TfTypeError: $e,
|
|
3325
|
-
TfPropertyTypeError:
|
|
3382
|
+
TfPropertyTypeError: Et,
|
|
3326
3383
|
tfCustomError: bf,
|
|
3327
3384
|
tfSubError: yf,
|
|
3328
|
-
tfJSON:
|
|
3385
|
+
tfJSON: wr,
|
|
3329
3386
|
getValueTypeName: An
|
|
3330
3387
|
}, Gr, Zn;
|
|
3331
3388
|
function gf() {
|
|
@@ -3340,10 +3397,10 @@ function gf() {
|
|
|
3340
3397
|
}
|
|
3341
3398
|
function i(S, z) {
|
|
3342
3399
|
var M = S.toJSON();
|
|
3343
|
-
function $(
|
|
3344
|
-
if (!S(
|
|
3345
|
-
if (
|
|
3346
|
-
throw t.tfCustomError(M + "(Length: " + z + ")", M + "(Length: " +
|
|
3400
|
+
function $(oe) {
|
|
3401
|
+
if (!S(oe)) return !1;
|
|
3402
|
+
if (oe.length === z) return !0;
|
|
3403
|
+
throw t.tfCustomError(M + "(Length: " + z + ")", M + "(Length: " + oe.length + ")");
|
|
3347
3404
|
}
|
|
3348
3405
|
return $.toJSON = function() {
|
|
3349
3406
|
return M;
|
|
@@ -3352,15 +3409,15 @@ function gf() {
|
|
|
3352
3409
|
var a = i.bind(null, e.Array), f = i.bind(null, r), u = i.bind(null, n), l = i.bind(null, e.String);
|
|
3353
3410
|
function b(S, z, M) {
|
|
3354
3411
|
M = M || e.Number;
|
|
3355
|
-
function $(
|
|
3356
|
-
return M(
|
|
3412
|
+
function $(oe, Te) {
|
|
3413
|
+
return M(oe, Te) && oe > S && oe < z;
|
|
3357
3414
|
}
|
|
3358
3415
|
return $.toJSON = function() {
|
|
3359
3416
|
return `${M.toJSON()} between [${S}, ${z}]`;
|
|
3360
3417
|
}, $;
|
|
3361
3418
|
}
|
|
3362
|
-
var
|
|
3363
|
-
function
|
|
3419
|
+
var g = Math.pow(2, 53) - 1;
|
|
3420
|
+
function m(S) {
|
|
3364
3421
|
return typeof S == "number" && isFinite(S);
|
|
3365
3422
|
}
|
|
3366
3423
|
function v(S) {
|
|
@@ -3373,7 +3430,7 @@ function gf() {
|
|
|
3373
3430
|
return (S | 0) === S;
|
|
3374
3431
|
}
|
|
3375
3432
|
function P(S) {
|
|
3376
|
-
return typeof S == "number" && S >= -
|
|
3433
|
+
return typeof S == "number" && S >= -g && S <= g && Math.floor(S) === S;
|
|
3377
3434
|
}
|
|
3378
3435
|
function T(S) {
|
|
3379
3436
|
return (S & 255) === S;
|
|
@@ -3385,13 +3442,13 @@ function gf() {
|
|
|
3385
3442
|
return S >>> 0 === S;
|
|
3386
3443
|
}
|
|
3387
3444
|
function L(S) {
|
|
3388
|
-
return typeof S == "number" && S >= 0 && S <=
|
|
3445
|
+
return typeof S == "number" && S >= 0 && S <= g && Math.floor(S) === S;
|
|
3389
3446
|
}
|
|
3390
3447
|
var k = {
|
|
3391
3448
|
ArrayN: a,
|
|
3392
3449
|
Buffer: r,
|
|
3393
3450
|
BufferN: f,
|
|
3394
|
-
Finite:
|
|
3451
|
+
Finite: m,
|
|
3395
3452
|
Hex: n,
|
|
3396
3453
|
HexN: u,
|
|
3397
3454
|
Int8: v,
|
|
@@ -3411,7 +3468,7 @@ function gf() {
|
|
|
3411
3468
|
}).bind(null, O);
|
|
3412
3469
|
return Gr = k, Gr;
|
|
3413
3470
|
}
|
|
3414
|
-
var
|
|
3471
|
+
var Zt = ss, he = Sn, Me = Zt.tfJSON, os = Zt.TfTypeError, as = Zt.TfPropertyTypeError, $t = Zt.tfSubError, mf = Zt.getValueTypeName, De = {
|
|
3415
3472
|
arrayOf: function(t, r) {
|
|
3416
3473
|
t = Fe(t), r = r || {};
|
|
3417
3474
|
function n(i, a) {
|
|
@@ -3419,7 +3476,7 @@ var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTyp
|
|
|
3419
3476
|
try {
|
|
3420
3477
|
return we(t, f, a);
|
|
3421
3478
|
} catch (l) {
|
|
3422
|
-
throw
|
|
3479
|
+
throw $t(l, u);
|
|
3423
3480
|
}
|
|
3424
3481
|
});
|
|
3425
3482
|
}
|
|
@@ -3445,13 +3502,13 @@ var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTyp
|
|
|
3445
3502
|
try {
|
|
3446
3503
|
r && we(r, f, a);
|
|
3447
3504
|
} catch (l) {
|
|
3448
|
-
throw
|
|
3505
|
+
throw $t(l, f, "key");
|
|
3449
3506
|
}
|
|
3450
3507
|
try {
|
|
3451
3508
|
var u = i[f];
|
|
3452
3509
|
we(t, u, a);
|
|
3453
3510
|
} catch (l) {
|
|
3454
|
-
throw
|
|
3511
|
+
throw $t(l, f);
|
|
3455
3512
|
}
|
|
3456
3513
|
}
|
|
3457
3514
|
return !0;
|
|
@@ -3474,8 +3531,8 @@ var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTyp
|
|
|
3474
3531
|
var l = r[u], b = a[u];
|
|
3475
3532
|
we(l, b, f);
|
|
3476
3533
|
}
|
|
3477
|
-
} catch (
|
|
3478
|
-
throw
|
|
3534
|
+
} catch (g) {
|
|
3535
|
+
throw $t(g, u);
|
|
3479
3536
|
}
|
|
3480
3537
|
if (f) {
|
|
3481
3538
|
for (u in a)
|
|
@@ -3533,7 +3590,7 @@ var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTyp
|
|
|
3533
3590
|
try {
|
|
3534
3591
|
return we(a, n[f], i);
|
|
3535
3592
|
} catch (u) {
|
|
3536
|
-
throw
|
|
3593
|
+
throw $t(u, f);
|
|
3537
3594
|
}
|
|
3538
3595
|
});
|
|
3539
3596
|
}
|
|
@@ -3597,13 +3654,13 @@ var _f = we;
|
|
|
3597
3654
|
wif: e.typeforce.UInt8
|
|
3598
3655
|
}), e.Buffer256bit = e.typeforce.BufferN(32), e.Array = e.typeforce.Array, e.Boolean = e.typeforce.Boolean, e.maybe = e.typeforce.maybe;
|
|
3599
3656
|
})(rs);
|
|
3600
|
-
var an = { exports: {} }, fn = { exports: {} },
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3657
|
+
var an = { exports: {} }, fn = { exports: {} }, Ct = {}, Rr = {};
|
|
3658
|
+
Rr.byteLength = vf;
|
|
3659
|
+
Rr.toByteArray = Bf;
|
|
3660
|
+
Rr.fromByteArray = If;
|
|
3604
3661
|
var Oe = [], Ie = [], wf = typeof Uint8Array < "u" ? Uint8Array : Array, jr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3605
|
-
for (var
|
|
3606
|
-
Oe[
|
|
3662
|
+
for (var xt = 0, xf = jr.length; xt < xf; ++xt)
|
|
3663
|
+
Oe[xt] = jr[xt], Ie[jr.charCodeAt(xt)] = xt;
|
|
3607
3664
|
Ie[45] = 62;
|
|
3608
3665
|
Ie[95] = 63;
|
|
3609
3666
|
function fs(e) {
|
|
@@ -3648,10 +3705,10 @@ function If(e) {
|
|
|
3648
3705
|
var Rn = {};
|
|
3649
3706
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3650
3707
|
Rn.read = function(e, t, r, n, i) {
|
|
3651
|
-
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1, b = l >> 1,
|
|
3652
|
-
for (
|
|
3708
|
+
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1, b = l >> 1, g = -7, m = r ? i - 1 : 0, v = r ? -1 : 1, A = e[t + m];
|
|
3709
|
+
for (m += v, a = A & (1 << -g) - 1, A >>= -g, g += u; g > 0; a = a * 256 + e[t + m], m += v, g -= 8)
|
|
3653
3710
|
;
|
|
3654
|
-
for (f = a & (1 << -
|
|
3711
|
+
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t + m], m += v, g -= 8)
|
|
3655
3712
|
;
|
|
3656
3713
|
if (a === 0)
|
|
3657
3714
|
a = 1 - b;
|
|
@@ -3663,8 +3720,8 @@ Rn.read = function(e, t, r, n, i) {
|
|
|
3663
3720
|
return (A ? -1 : 1) * f * Math.pow(2, a - n);
|
|
3664
3721
|
};
|
|
3665
3722
|
Rn.write = function(e, t, r, n, i, a) {
|
|
3666
|
-
var f, u, l, b = a * 8 - i - 1,
|
|
3667
|
-
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, f =
|
|
3723
|
+
var f, u, l, b = a * 8 - i - 1, g = (1 << b) - 1, m = g >> 1, v = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, A = n ? 0 : a - 1, B = n ? 1 : -1, P = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
|
|
3724
|
+
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 + m >= 1 ? t += v / l : t += v * Math.pow(2, 1 - m), t * l >= 2 && (f++, l /= 2), f + m >= g ? (u = 0, f = g) : f + m >= 1 ? (u = (t * l - 1) * Math.pow(2, i), f = f + m) : (u = t * Math.pow(2, m - 1) * Math.pow(2, i), f = 0)); i >= 8; e[r + A] = u & 255, A += B, u /= 256, i -= 8)
|
|
3668
3725
|
;
|
|
3669
3726
|
for (f = f << i | u, b += i; b > 0; e[r + A] = f & 255, A += B, f /= 256, b -= 8)
|
|
3670
3727
|
;
|
|
@@ -3677,7 +3734,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
3677
3734
|
* @license MIT
|
|
3678
3735
|
*/
|
|
3679
3736
|
(function(e) {
|
|
3680
|
-
const t =
|
|
3737
|
+
const t = Rr, r = Rn, n = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
3681
3738
|
e.Buffer = u, e.SlowBuffer = F, e.INSPECT_MAX_BYTES = 50;
|
|
3682
3739
|
const i = 2147483647;
|
|
3683
3740
|
e.kMaxLength = i, u.TYPED_ARRAY_SUPPORT = a(), !u.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
@@ -3718,7 +3775,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
3718
3775
|
throw new TypeError(
|
|
3719
3776
|
'The "string" argument must be of type string. Received type number'
|
|
3720
3777
|
);
|
|
3721
|
-
return
|
|
3778
|
+
return m(c);
|
|
3722
3779
|
}
|
|
3723
3780
|
return l(c, s, o);
|
|
3724
3781
|
}
|
|
@@ -3758,19 +3815,19 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
3758
3815
|
if (c < 0)
|
|
3759
3816
|
throw new RangeError('The value "' + c + '" is invalid for option "size"');
|
|
3760
3817
|
}
|
|
3761
|
-
function
|
|
3818
|
+
function g(c, s, o) {
|
|
3762
3819
|
return b(c), c <= 0 ? f(c) : s !== void 0 ? typeof o == "string" ? f(c).fill(s, o) : f(c).fill(s) : f(c);
|
|
3763
3820
|
}
|
|
3764
3821
|
u.alloc = function(c, s, o) {
|
|
3765
|
-
return
|
|
3822
|
+
return g(c, s, o);
|
|
3766
3823
|
};
|
|
3767
|
-
function
|
|
3824
|
+
function m(c) {
|
|
3768
3825
|
return b(c), f(c < 0 ? 0 : C(c) | 0);
|
|
3769
3826
|
}
|
|
3770
3827
|
u.allocUnsafe = function(c) {
|
|
3771
|
-
return
|
|
3828
|
+
return m(c);
|
|
3772
3829
|
}, u.allocUnsafeSlow = function(c) {
|
|
3773
|
-
return
|
|
3830
|
+
return m(c);
|
|
3774
3831
|
};
|
|
3775
3832
|
function v(c, s) {
|
|
3776
3833
|
if ((typeof s != "string" || s === "") && (s = "utf8"), !u.isEncoding(s))
|
|
@@ -3907,7 +3964,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
3907
3964
|
case "hex":
|
|
3908
3965
|
return o >>> 1;
|
|
3909
3966
|
case "base64":
|
|
3910
|
-
return
|
|
3967
|
+
return Lt(c).length;
|
|
3911
3968
|
default:
|
|
3912
3969
|
if (y)
|
|
3913
3970
|
return h ? -1 : V(c).length;
|
|
@@ -3932,7 +3989,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
3932
3989
|
case "binary":
|
|
3933
3990
|
return Ge(this, s, o);
|
|
3934
3991
|
case "base64":
|
|
3935
|
-
return
|
|
3992
|
+
return fe(this, s, o);
|
|
3936
3993
|
case "ucs2":
|
|
3937
3994
|
case "ucs-2":
|
|
3938
3995
|
case "utf16le":
|
|
@@ -4068,16 +4125,16 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4068
4125
|
return E;
|
|
4069
4126
|
}
|
|
4070
4127
|
function $(c, s, o, h) {
|
|
4071
|
-
return
|
|
4128
|
+
return mt(V(s, c.length - o), c, o, h);
|
|
4072
4129
|
}
|
|
4073
|
-
function
|
|
4074
|
-
return
|
|
4130
|
+
function oe(c, s, o, h) {
|
|
4131
|
+
return mt(qe(s), c, o, h);
|
|
4075
4132
|
}
|
|
4076
4133
|
function Te(c, s, o, h) {
|
|
4077
|
-
return
|
|
4134
|
+
return mt(Lt(s), c, o, h);
|
|
4078
4135
|
}
|
|
4079
4136
|
function ze(c, s, o, h) {
|
|
4080
|
-
return
|
|
4137
|
+
return mt(gt(s, c.length - o), c, o, h);
|
|
4081
4138
|
}
|
|
4082
4139
|
u.prototype.write = function(s, o, h, y) {
|
|
4083
4140
|
if (o === void 0)
|
|
@@ -4105,7 +4162,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4105
4162
|
case "ascii":
|
|
4106
4163
|
case "latin1":
|
|
4107
4164
|
case "binary":
|
|
4108
|
-
return
|
|
4165
|
+
return oe(this, s, o, h);
|
|
4109
4166
|
case "base64":
|
|
4110
4167
|
return Te(this, s, o, h);
|
|
4111
4168
|
case "ucs2":
|
|
@@ -4123,7 +4180,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4123
4180
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
4124
4181
|
};
|
|
4125
4182
|
};
|
|
4126
|
-
function
|
|
4183
|
+
function fe(c, s, o) {
|
|
4127
4184
|
return s === 0 && o === c.length ? t.fromByteArray(c) : t.fromByteArray(c.slice(s, o));
|
|
4128
4185
|
}
|
|
4129
4186
|
function ve(c, s, o) {
|
|
@@ -4185,7 +4242,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4185
4242
|
(!s || s < 0) && (s = 0), (!o || o < 0 || o > h) && (o = h);
|
|
4186
4243
|
let y = "";
|
|
4187
4244
|
for (let x = s; x < o; ++x)
|
|
4188
|
-
y +=
|
|
4245
|
+
y += Ft[c[x]];
|
|
4189
4246
|
return y;
|
|
4190
4247
|
}
|
|
4191
4248
|
function je(c, s, o) {
|
|
@@ -4287,7 +4344,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4287
4344
|
}, u.prototype.readDoubleBE = function(s, o) {
|
|
4288
4345
|
return s = s >>> 0, o || Q(s, 8, this.length), r.read(this, s, !1, 52, 8);
|
|
4289
4346
|
};
|
|
4290
|
-
function
|
|
4347
|
+
function ae(c, s, o, h, y, x) {
|
|
4291
4348
|
if (!u.isBuffer(c)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
4292
4349
|
if (s > y || s < x) throw new RangeError('"value" argument is out of bounds');
|
|
4293
4350
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
@@ -4295,7 +4352,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4295
4352
|
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, o, h, y) {
|
|
4296
4353
|
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4297
4354
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4298
|
-
|
|
4355
|
+
ae(this, s, o, h, q, 0);
|
|
4299
4356
|
}
|
|
4300
4357
|
let x = 1, E = 0;
|
|
4301
4358
|
for (this[o] = s & 255; ++E < h && (x *= 256); )
|
|
@@ -4304,22 +4361,22 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4304
4361
|
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, o, h, y) {
|
|
4305
4362
|
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4306
4363
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4307
|
-
|
|
4364
|
+
ae(this, s, o, h, q, 0);
|
|
4308
4365
|
}
|
|
4309
4366
|
let x = h - 1, E = 1;
|
|
4310
4367
|
for (this[o + x] = s & 255; --x >= 0 && (E *= 256); )
|
|
4311
4368
|
this[o + x] = s / E & 255;
|
|
4312
4369
|
return o + h;
|
|
4313
4370
|
}, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(s, o, h) {
|
|
4314
|
-
return s = +s, o = o >>> 0, h ||
|
|
4371
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 1, 255, 0), this[o] = s & 255, o + 1;
|
|
4315
4372
|
}, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(s, o, h) {
|
|
4316
|
-
return s = +s, o = o >>> 0, h ||
|
|
4373
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 2, 65535, 0), this[o] = s & 255, this[o + 1] = s >>> 8, o + 2;
|
|
4317
4374
|
}, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(s, o, h) {
|
|
4318
|
-
return s = +s, o = o >>> 0, h ||
|
|
4375
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 2, 65535, 0), this[o] = s >>> 8, this[o + 1] = s & 255, o + 2;
|
|
4319
4376
|
}, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(s, o, h) {
|
|
4320
|
-
return s = +s, o = o >>> 0, h ||
|
|
4377
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 4, 4294967295, 0), this[o + 3] = s >>> 24, this[o + 2] = s >>> 16, this[o + 1] = s >>> 8, this[o] = s & 255, o + 4;
|
|
4321
4378
|
}, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(s, o, h) {
|
|
4322
|
-
return s = +s, o = o >>> 0, h ||
|
|
4379
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 4, 4294967295, 0), this[o] = s >>> 24, this[o + 1] = s >>> 16, this[o + 2] = s >>> 8, this[o + 3] = s & 255, o + 4;
|
|
4323
4380
|
};
|
|
4324
4381
|
function Be(c, s, o, h, y) {
|
|
4325
4382
|
p(s, h, y, c, o, 7);
|
|
@@ -4342,7 +4399,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4342
4399
|
}), u.prototype.writeIntLE = function(s, o, h, y) {
|
|
4343
4400
|
if (s = +s, o = o >>> 0, !y) {
|
|
4344
4401
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4345
|
-
|
|
4402
|
+
ae(this, s, o, h, ne - 1, -ne);
|
|
4346
4403
|
}
|
|
4347
4404
|
let x = 0, E = 1, q = 0;
|
|
4348
4405
|
for (this[o] = s & 255; ++x < h && (E *= 256); )
|
|
@@ -4351,22 +4408,22 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4351
4408
|
}, u.prototype.writeIntBE = function(s, o, h, y) {
|
|
4352
4409
|
if (s = +s, o = o >>> 0, !y) {
|
|
4353
4410
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4354
|
-
|
|
4411
|
+
ae(this, s, o, h, ne - 1, -ne);
|
|
4355
4412
|
}
|
|
4356
4413
|
let x = h - 1, E = 1, q = 0;
|
|
4357
4414
|
for (this[o + x] = s & 255; --x >= 0 && (E *= 256); )
|
|
4358
4415
|
s < 0 && q === 0 && this[o + x + 1] !== 0 && (q = 1), this[o + x] = (s / E >> 0) - q & 255;
|
|
4359
4416
|
return o + h;
|
|
4360
4417
|
}, u.prototype.writeInt8 = function(s, o, h) {
|
|
4361
|
-
return s = +s, o = o >>> 0, h ||
|
|
4418
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 1, 127, -128), s < 0 && (s = 255 + s + 1), this[o] = s & 255, o + 1;
|
|
4362
4419
|
}, u.prototype.writeInt16LE = function(s, o, h) {
|
|
4363
|
-
return s = +s, o = o >>> 0, h ||
|
|
4420
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 2, 32767, -32768), this[o] = s & 255, this[o + 1] = s >>> 8, o + 2;
|
|
4364
4421
|
}, u.prototype.writeInt16BE = function(s, o, h) {
|
|
4365
|
-
return s = +s, o = o >>> 0, h ||
|
|
4422
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 2, 32767, -32768), this[o] = s >>> 8, this[o + 1] = s & 255, o + 2;
|
|
4366
4423
|
}, u.prototype.writeInt32LE = function(s, o, h) {
|
|
4367
|
-
return s = +s, o = o >>> 0, h ||
|
|
4424
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 4, 2147483647, -2147483648), this[o] = s & 255, this[o + 1] = s >>> 8, this[o + 2] = s >>> 16, this[o + 3] = s >>> 24, o + 4;
|
|
4368
4425
|
}, u.prototype.writeInt32BE = function(s, o, h) {
|
|
4369
|
-
return s = +s, o = o >>> 0, h ||
|
|
4426
|
+
return s = +s, o = o >>> 0, h || ae(this, s, o, 4, 2147483647, -2147483648), s < 0 && (s = 4294967295 + s + 1), this[o] = s >>> 24, this[o + 1] = s >>> 16, this[o + 2] = s >>> 8, this[o + 3] = s & 255, o + 4;
|
|
4370
4427
|
}, u.prototype.writeBigInt64LE = Ae(function(s, o = 0) {
|
|
4371
4428
|
return Be(this, s, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
4372
4429
|
}), u.prototype.writeBigInt64BE = Ae(function(s, o = 0) {
|
|
@@ -4576,17 +4633,17 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4576
4633
|
s.push(c.charCodeAt(o) & 255);
|
|
4577
4634
|
return s;
|
|
4578
4635
|
}
|
|
4579
|
-
function
|
|
4636
|
+
function gt(c, s) {
|
|
4580
4637
|
let o, h, y;
|
|
4581
4638
|
const x = [];
|
|
4582
4639
|
for (let E = 0; E < c.length && !((s -= 2) < 0); ++E)
|
|
4583
4640
|
o = c.charCodeAt(E), h = o >> 8, y = o % 256, x.push(y), x.push(h);
|
|
4584
4641
|
return x;
|
|
4585
4642
|
}
|
|
4586
|
-
function
|
|
4643
|
+
function Lt(c) {
|
|
4587
4644
|
return t.toByteArray(j(c));
|
|
4588
4645
|
}
|
|
4589
|
-
function
|
|
4646
|
+
function mt(c, s, o, h) {
|
|
4590
4647
|
let y;
|
|
4591
4648
|
for (y = 0; y < h && !(y + o >= s.length || y >= c.length); ++y)
|
|
4592
4649
|
s[y + o] = c[y];
|
|
@@ -4598,7 +4655,7 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4598
4655
|
function rt(c) {
|
|
4599
4656
|
return c !== c;
|
|
4600
4657
|
}
|
|
4601
|
-
const
|
|
4658
|
+
const Ft = function() {
|
|
4602
4659
|
const c = "0123456789abcdef", s = new Array(256);
|
|
4603
4660
|
for (let o = 0; o < 16; ++o) {
|
|
4604
4661
|
const h = o * 16;
|
|
@@ -4613,10 +4670,10 @@ Rn.write = function(e, t, r, n, i, a) {
|
|
|
4613
4670
|
function nt() {
|
|
4614
4671
|
throw new Error("BigInt not supported");
|
|
4615
4672
|
}
|
|
4616
|
-
})(
|
|
4673
|
+
})(Ct);
|
|
4617
4674
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
4618
4675
|
(function(e, t) {
|
|
4619
|
-
var r =
|
|
4676
|
+
var r = Ct, n = r.Buffer;
|
|
4620
4677
|
function i(f, u) {
|
|
4621
4678
|
for (var l in f)
|
|
4622
4679
|
u[l] = f[l];
|
|
@@ -4649,17 +4706,17 @@ function Tf() {
|
|
|
4649
4706
|
throw new Error(`Secure random number generation is not supported by this browser.
|
|
4650
4707
|
Use Chrome, Firefox or Internet Explorer 11`);
|
|
4651
4708
|
}
|
|
4652
|
-
var Pf = xe.Buffer,
|
|
4653
|
-
|
|
4709
|
+
var Pf = xe.Buffer, xr = Xe.crypto || Xe.msCrypto;
|
|
4710
|
+
xr && xr.getRandomValues ? an.exports = Cf : an.exports = Tf;
|
|
4654
4711
|
function Cf(e, t) {
|
|
4655
4712
|
if (e > Rf) throw new RangeError("requested too many random bytes");
|
|
4656
4713
|
var r = Pf.allocUnsafe(e);
|
|
4657
4714
|
if (e > 0)
|
|
4658
4715
|
if (e > Wr)
|
|
4659
4716
|
for (var n = 0; n < e; n += Wr)
|
|
4660
|
-
|
|
4717
|
+
xr.getRandomValues(r.slice(n, n + Wr));
|
|
4661
4718
|
else
|
|
4662
|
-
|
|
4719
|
+
xr.getRandomValues(r);
|
|
4663
4720
|
return typeof t == "function" ? process.nextTick(function() {
|
|
4664
4721
|
t(null, r);
|
|
4665
4722
|
}) : r;
|
|
@@ -4682,12 +4739,12 @@ typeof Object.create == "function" ? un.exports = function(t, r) {
|
|
|
4682
4739
|
n.prototype = r.prototype, t.prototype = new n(), t.prototype.constructor = t;
|
|
4683
4740
|
}
|
|
4684
4741
|
};
|
|
4685
|
-
var de = un.exports, cn = { exports: {} }, Tn = { exports: {} },
|
|
4742
|
+
var de = un.exports, cn = { exports: {} }, Tn = { exports: {} }, Bt = typeof Reflect == "object" ? Reflect : null, ti = Bt && typeof Bt.apply == "function" ? Bt.apply : function(t, r, n) {
|
|
4686
4743
|
return Function.prototype.apply.call(t, r, n);
|
|
4687
|
-
},
|
|
4688
|
-
|
|
4744
|
+
}, dr;
|
|
4745
|
+
Bt && typeof Bt.ownKeys == "function" ? dr = Bt.ownKeys : Object.getOwnPropertySymbols ? dr = function(t) {
|
|
4689
4746
|
return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));
|
|
4690
|
-
} :
|
|
4747
|
+
} : dr = function(t) {
|
|
4691
4748
|
return Object.getOwnPropertyNames(t);
|
|
4692
4749
|
};
|
|
4693
4750
|
function Lf(e) {
|
|
@@ -4706,7 +4763,7 @@ K.prototype._events = void 0;
|
|
|
4706
4763
|
K.prototype._eventsCount = 0;
|
|
4707
4764
|
K.prototype._maxListeners = void 0;
|
|
4708
4765
|
var ri = 10;
|
|
4709
|
-
function
|
|
4766
|
+
function Tr(e) {
|
|
4710
4767
|
if (typeof e != "function")
|
|
4711
4768
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e);
|
|
4712
4769
|
}
|
|
@@ -4755,13 +4812,13 @@ K.prototype.emit = function(t) {
|
|
|
4755
4812
|
if (typeof l == "function")
|
|
4756
4813
|
ti(l, this, r);
|
|
4757
4814
|
else
|
|
4758
|
-
for (var b = l.length,
|
|
4759
|
-
ti(
|
|
4815
|
+
for (var b = l.length, g = bs(l, b), n = 0; n < b; ++n)
|
|
4816
|
+
ti(g[n], this, r);
|
|
4760
4817
|
return !0;
|
|
4761
4818
|
};
|
|
4762
4819
|
function ls(e, t, r, n) {
|
|
4763
4820
|
var i, a, f;
|
|
4764
|
-
if (
|
|
4821
|
+
if (Tr(r), a = e._events, a === void 0 ? (a = e._events = /* @__PURE__ */ Object.create(null), e._eventsCount = 0) : (a.newListener !== void 0 && (e.emit(
|
|
4765
4822
|
"newListener",
|
|
4766
4823
|
t,
|
|
4767
4824
|
r.listener ? r.listener : r
|
|
@@ -4790,14 +4847,14 @@ function hs(e, t, r) {
|
|
|
4790
4847
|
return i.listener = r, n.wrapFn = i, i;
|
|
4791
4848
|
}
|
|
4792
4849
|
K.prototype.once = function(t, r) {
|
|
4793
|
-
return
|
|
4850
|
+
return Tr(r), this.on(t, hs(this, t, r)), this;
|
|
4794
4851
|
};
|
|
4795
4852
|
K.prototype.prependOnceListener = function(t, r) {
|
|
4796
|
-
return
|
|
4853
|
+
return Tr(r), this.prependListener(t, hs(this, t, r)), this;
|
|
4797
4854
|
};
|
|
4798
4855
|
K.prototype.removeListener = function(t, r) {
|
|
4799
4856
|
var n, i, a, f, u;
|
|
4800
|
-
if (
|
|
4857
|
+
if (Tr(r), i = this._events, i === void 0)
|
|
4801
4858
|
return this;
|
|
4802
4859
|
if (n = i[t], n === void 0)
|
|
4803
4860
|
return this;
|
|
@@ -4864,7 +4921,7 @@ function ps(e) {
|
|
|
4864
4921
|
return 0;
|
|
4865
4922
|
}
|
|
4866
4923
|
K.prototype.eventNames = function() {
|
|
4867
|
-
return this._eventsCount > 0 ?
|
|
4924
|
+
return this._eventsCount > 0 ? dr(this._events) : [];
|
|
4868
4925
|
};
|
|
4869
4926
|
function bs(e, t) {
|
|
4870
4927
|
for (var r = new Array(t), n = 0; n < t; ++n)
|
|
@@ -4965,7 +5022,7 @@ function Hf() {
|
|
|
4965
5022
|
}
|
|
4966
5023
|
return (P === "string" ? String : Number)(B);
|
|
4967
5024
|
}
|
|
4968
|
-
var l =
|
|
5025
|
+
var l = Ct, b = l.Buffer, g = Pn, m = g.inspect, v = m && m.custom || "inspect";
|
|
4969
5026
|
function A(B, P, T) {
|
|
4970
5027
|
b.prototype.copy.call(B, P, T);
|
|
4971
5028
|
}
|
|
@@ -5065,7 +5122,7 @@ function Hf() {
|
|
|
5065
5122
|
}, {
|
|
5066
5123
|
key: v,
|
|
5067
5124
|
value: function(T, C) {
|
|
5068
|
-
return
|
|
5125
|
+
return m(this, t(t({}, C), {}, {
|
|
5069
5126
|
// Only inspect one level.
|
|
5070
5127
|
depth: 0,
|
|
5071
5128
|
// It should not recurse.
|
|
@@ -5078,13 +5135,13 @@ function Hf() {
|
|
|
5078
5135
|
function zf(e, t) {
|
|
5079
5136
|
var r = this, n = this._readableState && this._readableState.destroyed, i = this._writableState && this._writableState.destroyed;
|
|
5080
5137
|
return n || i ? (t ? t(e) : e && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = !0, process.nextTick(ln, this, e)) : process.nextTick(ln, this, e)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function(a) {
|
|
5081
|
-
!t && a ? r._writableState ? r._writableState.errorEmitted ? process.nextTick(
|
|
5138
|
+
!t && a ? r._writableState ? r._writableState.errorEmitted ? process.nextTick(pr, r) : (r._writableState.errorEmitted = !0, process.nextTick(ii, r, a)) : process.nextTick(ii, r, a) : t ? (process.nextTick(pr, r), t(a)) : process.nextTick(pr, r);
|
|
5082
5139
|
}), this);
|
|
5083
5140
|
}
|
|
5084
5141
|
function ii(e, t) {
|
|
5085
|
-
ln(e, t),
|
|
5142
|
+
ln(e, t), pr(e);
|
|
5086
5143
|
}
|
|
5087
|
-
function
|
|
5144
|
+
function pr(e) {
|
|
5088
5145
|
e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose || e.emit("close");
|
|
5089
5146
|
}
|
|
5090
5147
|
function Gf() {
|
|
@@ -5101,7 +5158,7 @@ var _s = {
|
|
|
5101
5158
|
destroy: zf,
|
|
5102
5159
|
undestroy: Gf,
|
|
5103
5160
|
errorOrDestroy: jf
|
|
5104
|
-
},
|
|
5161
|
+
}, bt = {};
|
|
5105
5162
|
function Wf(e, t) {
|
|
5106
5163
|
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e.__proto__ = t;
|
|
5107
5164
|
}
|
|
@@ -5169,8 +5226,8 @@ Re("ERR_UNKNOWN_ENCODING", function(e) {
|
|
|
5169
5226
|
return "Unknown encoding: " + e;
|
|
5170
5227
|
}, TypeError);
|
|
5171
5228
|
Re("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
|
|
5172
|
-
|
|
5173
|
-
var Yf =
|
|
5229
|
+
bt.codes = ws;
|
|
5230
|
+
var Yf = bt.codes.ERR_INVALID_OPT_VALUE;
|
|
5174
5231
|
function Jf(e, t, r) {
|
|
5175
5232
|
return e.highWaterMark != null ? e.highWaterMark : t ? e[r] : null;
|
|
5176
5233
|
}
|
|
@@ -5225,7 +5282,7 @@ function vs() {
|
|
|
5225
5282
|
M.WritableState = S;
|
|
5226
5283
|
var r = {
|
|
5227
5284
|
deprecate: Qf
|
|
5228
|
-
}, n = ms, i =
|
|
5285
|
+
}, n = ms, i = Ct.Buffer, a = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
5229
5286
|
};
|
|
5230
5287
|
function f(w) {
|
|
5231
5288
|
return i.from(w);
|
|
@@ -5233,12 +5290,12 @@ function vs() {
|
|
|
5233
5290
|
function u(w) {
|
|
5234
5291
|
return i.isBuffer(w) || w instanceof a;
|
|
5235
5292
|
}
|
|
5236
|
-
var l = _s, b = xs,
|
|
5293
|
+
var l = _s, b = xs, g = b.getHighWaterMark, m = bt.codes, v = m.ERR_INVALID_ARG_TYPE, A = m.ERR_METHOD_NOT_IMPLEMENTED, B = m.ERR_MULTIPLE_CALLBACK, P = m.ERR_STREAM_CANNOT_PIPE, T = m.ERR_STREAM_DESTROYED, C = m.ERR_STREAM_NULL_VALUES, F = m.ERR_STREAM_WRITE_AFTER_END, L = m.ERR_UNKNOWN_ENCODING, k = l.errorOrDestroy;
|
|
5237
5294
|
de(M, n);
|
|
5238
5295
|
function O() {
|
|
5239
5296
|
}
|
|
5240
5297
|
function S(w, _, R) {
|
|
5241
|
-
t = t ||
|
|
5298
|
+
t = t || Rt(), w = w || {}, typeof R != "boolean" && (R = _ instanceof t), this.objectMode = !!w.objectMode, R && (this.objectMode = this.objectMode || !!w.writableObjectMode), this.highWaterMark = g(this, w, "writableHighWaterMark", R), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
|
|
5242
5299
|
var D = w.decodeStrings === !1;
|
|
5243
5300
|
this.decodeStrings = !D, this.defaultEncoding = w.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(G) {
|
|
5244
5301
|
tt(_, G);
|
|
@@ -5267,7 +5324,7 @@ function vs() {
|
|
|
5267
5324
|
return _ instanceof this;
|
|
5268
5325
|
};
|
|
5269
5326
|
function M(w) {
|
|
5270
|
-
t = t ||
|
|
5327
|
+
t = t || Rt();
|
|
5271
5328
|
var _ = this instanceof t;
|
|
5272
5329
|
if (!_ && !z.call(M, this)) return new M(w);
|
|
5273
5330
|
this._writableState = new S(w, this, _), this.writable = !0, w && (typeof w.write == "function" && (this._write = w.write), typeof w.writev == "function" && (this._writev = w.writev), typeof w.destroy == "function" && (this._destroy = w.destroy), typeof w.final == "function" && (this._final = w.final)), n.call(this);
|
|
@@ -5279,13 +5336,13 @@ function vs() {
|
|
|
5279
5336
|
var R = new F();
|
|
5280
5337
|
k(w, R), process.nextTick(_, R);
|
|
5281
5338
|
}
|
|
5282
|
-
function
|
|
5339
|
+
function oe(w, _, R, D) {
|
|
5283
5340
|
var G;
|
|
5284
5341
|
return R === null ? G = new C() : typeof R != "string" && !_.objectMode && (G = new v("chunk", ["string", "Buffer"], R)), G ? (k(w, G), process.nextTick(D, G), !1) : !0;
|
|
5285
5342
|
}
|
|
5286
5343
|
M.prototype.write = function(w, _, R) {
|
|
5287
5344
|
var D = this._writableState, G = !1, d = !D.objectMode && u(w);
|
|
5288
|
-
return d && !i.isBuffer(w) && (w = f(w)), typeof _ == "function" && (R = _, _ = null), d ? _ = "buffer" : _ || (_ = D.defaultEncoding), typeof R != "function" && (R = O), D.ending ? $(this, R) : (d ||
|
|
5345
|
+
return d && !i.isBuffer(w) && (w = f(w)), typeof _ == "function" && (R = _, _ = null), d ? _ = "buffer" : _ || (_ = D.defaultEncoding), typeof R != "function" && (R = O), D.ending ? $(this, R) : (d || oe(this, D, w, R)) && (D.pendingcb++, G = ze(this, D, d, w, _, R)), G;
|
|
5289
5346
|
}, M.prototype.cork = function() {
|
|
5290
5347
|
this._writableState.corked++;
|
|
5291
5348
|
}, M.prototype.uncork = function() {
|
|
@@ -5333,10 +5390,10 @@ function vs() {
|
|
|
5333
5390
|
next: null
|
|
5334
5391
|
}, Z ? Z.next = _.lastBufferedRequest : _.bufferedRequest = _.lastBufferedRequest, _.bufferedRequestCount += 1;
|
|
5335
5392
|
} else
|
|
5336
|
-
|
|
5393
|
+
fe(w, _, !1, I, D, G, d);
|
|
5337
5394
|
return U;
|
|
5338
5395
|
}
|
|
5339
|
-
function
|
|
5396
|
+
function fe(w, _, R, D, G, d, p) {
|
|
5340
5397
|
_.writelen = D, _.writecb = p, _.writing = !0, _.sync = !0, _.destroyed ? _.onwrite(new T("write")) : R ? w._writev(G, _.onwrite) : w._write(G, d, _.onwrite), _.sync = !1;
|
|
5341
5398
|
}
|
|
5342
5399
|
function ve(w, _, R, D, G) {
|
|
@@ -5368,11 +5425,11 @@ function vs() {
|
|
|
5368
5425
|
d.entry = R;
|
|
5369
5426
|
for (var p = 0, I = !0; R; )
|
|
5370
5427
|
G[p] = R, R.isBuf || (I = !1), R = R.next, p += 1;
|
|
5371
|
-
G.allBuffers = I,
|
|
5428
|
+
G.allBuffers = I, fe(w, _, !0, _.length, G, "", d.finish), _.pendingcb++, _.lastBufferedRequest = null, d.next ? (_.corkedRequestsFree = d.next, d.next = null) : _.corkedRequestsFree = new e(_), _.bufferedRequestCount = 0;
|
|
5372
5429
|
} else {
|
|
5373
5430
|
for (; R; ) {
|
|
5374
5431
|
var U = R.chunk, Z = R.encoding, j = R.callback, V = _.objectMode ? 1 : U.length;
|
|
5375
|
-
if (
|
|
5432
|
+
if (fe(w, _, !1, V, U, Z, j), R = R.next, _.bufferedRequestCount--, _.writing)
|
|
5376
5433
|
break;
|
|
5377
5434
|
}
|
|
5378
5435
|
R === null && (_.lastBufferedRequest = null);
|
|
@@ -5401,12 +5458,12 @@ function vs() {
|
|
|
5401
5458
|
_.pendingcb--, R && k(w, R), _.prefinished = !0, w.emit("prefinish"), Be(w, _);
|
|
5402
5459
|
});
|
|
5403
5460
|
}
|
|
5404
|
-
function
|
|
5461
|
+
function ae(w, _) {
|
|
5405
5462
|
!_.prefinished && !_.finalCalled && (typeof w._final == "function" && !_.destroyed ? (_.pendingcb++, _.finalCalled = !0, process.nextTick(Q, w, _)) : (_.prefinished = !0, w.emit("prefinish")));
|
|
5406
5463
|
}
|
|
5407
5464
|
function Be(w, _) {
|
|
5408
5465
|
var R = je(_);
|
|
5409
|
-
if (R && (
|
|
5466
|
+
if (R && (ae(w, _), _.pendingcb === 0 && (_.finished = !0, w.emit("finish"), _.autoDestroy))) {
|
|
5410
5467
|
var D = w._readableState;
|
|
5411
5468
|
(!D || D.autoDestroy && D.endEmitted) && w.destroy();
|
|
5412
5469
|
}
|
|
@@ -5439,13 +5496,13 @@ function vs() {
|
|
|
5439
5496
|
}, Kr;
|
|
5440
5497
|
}
|
|
5441
5498
|
var Yr, ai;
|
|
5442
|
-
function
|
|
5499
|
+
function Rt() {
|
|
5443
5500
|
if (ai) return Yr;
|
|
5444
5501
|
ai = 1;
|
|
5445
5502
|
var e = Object.keys || function(b) {
|
|
5446
|
-
var
|
|
5447
|
-
for (var
|
|
5448
|
-
return
|
|
5503
|
+
var g = [];
|
|
5504
|
+
for (var m in b) g.push(m);
|
|
5505
|
+
return g;
|
|
5449
5506
|
};
|
|
5450
5507
|
Yr = f;
|
|
5451
5508
|
var t = Bs(), r = vs();
|
|
@@ -5497,12 +5554,12 @@ function It() {
|
|
|
5497
5554
|
get: function() {
|
|
5498
5555
|
return this._readableState === void 0 || this._writableState === void 0 ? !1 : this._readableState.destroyed && this._writableState.destroyed;
|
|
5499
5556
|
},
|
|
5500
|
-
set: function(
|
|
5501
|
-
this._readableState === void 0 || this._writableState === void 0 || (this._readableState.destroyed =
|
|
5557
|
+
set: function(g) {
|
|
5558
|
+
this._readableState === void 0 || this._writableState === void 0 || (this._readableState.destroyed = g, this._writableState.destroyed = g);
|
|
5502
5559
|
}
|
|
5503
5560
|
}), Yr;
|
|
5504
5561
|
}
|
|
5505
|
-
var
|
|
5562
|
+
var vr = {}, Cn = xe.Buffer, fi = Cn.isEncoding || function(e) {
|
|
5506
5563
|
switch (e = "" + e, e && e.toLowerCase()) {
|
|
5507
5564
|
case "hex":
|
|
5508
5565
|
case "utf8":
|
|
@@ -5549,8 +5606,8 @@ function tu(e) {
|
|
|
5549
5606
|
if (typeof t != "string" && (Cn.isEncoding === fi || !fi(e))) throw new Error("Unknown encoding: " + e);
|
|
5550
5607
|
return t || e;
|
|
5551
5608
|
}
|
|
5552
|
-
|
|
5553
|
-
function
|
|
5609
|
+
vr.StringDecoder = er;
|
|
5610
|
+
function er(e) {
|
|
5554
5611
|
this.encoding = tu(e);
|
|
5555
5612
|
var t;
|
|
5556
5613
|
switch (this.encoding) {
|
|
@@ -5569,7 +5626,7 @@ function Qt(e) {
|
|
|
5569
5626
|
}
|
|
5570
5627
|
this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Cn.allocUnsafe(t);
|
|
5571
5628
|
}
|
|
5572
|
-
|
|
5629
|
+
er.prototype.write = function(e) {
|
|
5573
5630
|
if (e.length === 0) return "";
|
|
5574
5631
|
var t, r;
|
|
5575
5632
|
if (this.lastNeed) {
|
|
@@ -5579,9 +5636,9 @@ Qt.prototype.write = function(e) {
|
|
|
5579
5636
|
r = 0;
|
|
5580
5637
|
return r < e.length ? t ? t + this.text(e, r) : this.text(e, r) : t || "";
|
|
5581
5638
|
};
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5639
|
+
er.prototype.end = ou;
|
|
5640
|
+
er.prototype.text = su;
|
|
5641
|
+
er.prototype.fillLast = function(e) {
|
|
5585
5642
|
if (this.lastNeed <= e.length)
|
|
5586
5643
|
return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
|
5587
5644
|
e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length;
|
|
@@ -5657,7 +5714,7 @@ function lu(e) {
|
|
|
5657
5714
|
function hu(e) {
|
|
5658
5715
|
return e && e.length ? this.write(e) : "";
|
|
5659
5716
|
}
|
|
5660
|
-
var ui =
|
|
5717
|
+
var ui = bt.codes.ERR_STREAM_PREMATURE_CLOSE;
|
|
5661
5718
|
function du(e) {
|
|
5662
5719
|
var t = !1;
|
|
5663
5720
|
return function() {
|
|
@@ -5683,9 +5740,9 @@ function Es(e, t, r) {
|
|
|
5683
5740
|
i = !1, f = !0, n || r.call(e);
|
|
5684
5741
|
}, l = e._readableState && e._readableState.endEmitted, b = function() {
|
|
5685
5742
|
n = !1, l = !0, i || r.call(e);
|
|
5686
|
-
},
|
|
5743
|
+
}, g = function(B) {
|
|
5687
5744
|
r.call(e, B);
|
|
5688
|
-
},
|
|
5745
|
+
}, m = function() {
|
|
5689
5746
|
var B;
|
|
5690
5747
|
if (n && !l)
|
|
5691
5748
|
return (!e._readableState || !e._readableState.ended) && (B = new ui()), r.call(e, B);
|
|
@@ -5694,8 +5751,8 @@ function Es(e, t, r) {
|
|
|
5694
5751
|
}, v = function() {
|
|
5695
5752
|
e.req.on("finish", u);
|
|
5696
5753
|
};
|
|
5697
|
-
return bu(e) ? (e.on("complete", u), e.on("abort",
|
|
5698
|
-
e.removeListener("complete", u), e.removeListener("abort",
|
|
5754
|
+
return bu(e) ? (e.on("complete", u), e.on("abort", m), e.req ? v() : e.on("request", v)) : i && !e._writableState && (e.on("end", a), e.on("close", a)), e.on("end", b), e.on("finish", u), t.error !== !1 && e.on("error", g), e.on("close", m), function() {
|
|
5755
|
+
e.removeListener("complete", u), e.removeListener("abort", m), e.removeListener("request", v), e.req && e.req.removeListener("finish", u), e.removeListener("end", a), e.removeListener("close", a), e.removeListener("finish", u), e.removeListener("end", b), e.removeListener("error", g), e.removeListener("close", m);
|
|
5699
5756
|
};
|
|
5700
5757
|
}
|
|
5701
5758
|
var kn = Es, Xr, ci;
|
|
@@ -5720,7 +5777,7 @@ function yu() {
|
|
|
5720
5777
|
}
|
|
5721
5778
|
return (k === "string" ? String : Number)(L);
|
|
5722
5779
|
}
|
|
5723
|
-
var i = kn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"),
|
|
5780
|
+
var i = kn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"), g = Symbol("handlePromise"), m = Symbol("stream");
|
|
5724
5781
|
function v(L, k) {
|
|
5725
5782
|
return {
|
|
5726
5783
|
value: L,
|
|
@@ -5730,7 +5787,7 @@ function yu() {
|
|
|
5730
5787
|
function A(L) {
|
|
5731
5788
|
var k = L[a];
|
|
5732
5789
|
if (k !== null) {
|
|
5733
|
-
var O = L[
|
|
5790
|
+
var O = L[m].read();
|
|
5734
5791
|
O !== null && (L[b] = null, L[a] = null, L[f] = null, k(v(O, !1)));
|
|
5735
5792
|
}
|
|
5736
5793
|
}
|
|
@@ -5744,14 +5801,14 @@ function yu() {
|
|
|
5744
5801
|
O(v(void 0, !0));
|
|
5745
5802
|
return;
|
|
5746
5803
|
}
|
|
5747
|
-
k[
|
|
5804
|
+
k[g](O, S);
|
|
5748
5805
|
}, S);
|
|
5749
5806
|
};
|
|
5750
5807
|
}
|
|
5751
5808
|
var T = Object.getPrototypeOf(function() {
|
|
5752
5809
|
}), C = Object.setPrototypeOf((e = {
|
|
5753
5810
|
get stream() {
|
|
5754
|
-
return this[
|
|
5811
|
+
return this[m];
|
|
5755
5812
|
},
|
|
5756
5813
|
next: function() {
|
|
5757
5814
|
var k = this, O = this[u];
|
|
@@ -5759,20 +5816,20 @@ function yu() {
|
|
|
5759
5816
|
return Promise.reject(O);
|
|
5760
5817
|
if (this[l])
|
|
5761
5818
|
return Promise.resolve(v(void 0, !0));
|
|
5762
|
-
if (this[
|
|
5763
|
-
return new Promise(function($,
|
|
5819
|
+
if (this[m].destroyed)
|
|
5820
|
+
return new Promise(function($, oe) {
|
|
5764
5821
|
process.nextTick(function() {
|
|
5765
|
-
k[u] ?
|
|
5822
|
+
k[u] ? oe(k[u]) : $(v(void 0, !0));
|
|
5766
5823
|
});
|
|
5767
5824
|
});
|
|
5768
5825
|
var S = this[b], z;
|
|
5769
5826
|
if (S)
|
|
5770
5827
|
z = new Promise(P(S, this));
|
|
5771
5828
|
else {
|
|
5772
|
-
var M = this[
|
|
5829
|
+
var M = this[m].read();
|
|
5773
5830
|
if (M !== null)
|
|
5774
5831
|
return Promise.resolve(v(M, !1));
|
|
5775
|
-
z = new Promise(this[
|
|
5832
|
+
z = new Promise(this[g]);
|
|
5776
5833
|
}
|
|
5777
5834
|
return this[b] = z, z;
|
|
5778
5835
|
}
|
|
@@ -5781,7 +5838,7 @@ function yu() {
|
|
|
5781
5838
|
}), t(e, "return", function() {
|
|
5782
5839
|
var k = this;
|
|
5783
5840
|
return new Promise(function(O, S) {
|
|
5784
|
-
k[
|
|
5841
|
+
k[m].destroy(null, function(z) {
|
|
5785
5842
|
if (z) {
|
|
5786
5843
|
S(z);
|
|
5787
5844
|
return;
|
|
@@ -5790,7 +5847,7 @@ function yu() {
|
|
|
5790
5847
|
});
|
|
5791
5848
|
});
|
|
5792
5849
|
}), e), T), F = function(k) {
|
|
5793
|
-
var O, S = Object.create(C, (O = {}, t(O,
|
|
5850
|
+
var O, S = Object.create(C, (O = {}, t(O, m, {
|
|
5794
5851
|
value: k,
|
|
5795
5852
|
writable: !0
|
|
5796
5853
|
}), t(O, a, {
|
|
@@ -5805,10 +5862,10 @@ function yu() {
|
|
|
5805
5862
|
}), t(O, l, {
|
|
5806
5863
|
value: k._readableState.endEmitted,
|
|
5807
5864
|
writable: !0
|
|
5808
|
-
}), t(O,
|
|
5865
|
+
}), t(O, g, {
|
|
5809
5866
|
value: function(M, $) {
|
|
5810
|
-
var
|
|
5811
|
-
|
|
5867
|
+
var oe = S[m].read();
|
|
5868
|
+
oe ? (S[b] = null, S[a] = null, S[f] = null, M(v(oe, !1))) : (S[a] = M, S[f] = $);
|
|
5812
5869
|
},
|
|
5813
5870
|
writable: !0
|
|
5814
5871
|
}), O));
|
|
@@ -5838,7 +5895,7 @@ function Bs() {
|
|
|
5838
5895
|
$.ReadableState = M, gs.EventEmitter;
|
|
5839
5896
|
var t = function(p, I) {
|
|
5840
5897
|
return p.listeners(I).length;
|
|
5841
|
-
}, r = ms, n =
|
|
5898
|
+
}, r = ms, n = Ct.Buffer, i = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
5842
5899
|
};
|
|
5843
5900
|
function a(d) {
|
|
5844
5901
|
return n.from(d);
|
|
@@ -5849,18 +5906,18 @@ function Bs() {
|
|
|
5849
5906
|
var u = Pn, l;
|
|
5850
5907
|
u && u.debuglog ? l = u.debuglog("stream") : l = function() {
|
|
5851
5908
|
};
|
|
5852
|
-
var b = Hf(),
|
|
5909
|
+
var b = Hf(), g = _s, m = xs, v = m.getHighWaterMark, A = bt.codes, B = A.ERR_INVALID_ARG_TYPE, P = A.ERR_STREAM_PUSH_AFTER_EOF, T = A.ERR_METHOD_NOT_IMPLEMENTED, C = A.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, F, L, k;
|
|
5853
5910
|
de($, r);
|
|
5854
|
-
var O =
|
|
5911
|
+
var O = g.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
|
|
5855
5912
|
function z(d, p, I) {
|
|
5856
5913
|
if (typeof d.prependListener == "function") return d.prependListener(p, I);
|
|
5857
5914
|
!d._events || !d._events[p] ? d.on(p, I) : Array.isArray(d._events[p]) ? d._events[p].unshift(I) : d._events[p] = [I, d._events[p]];
|
|
5858
5915
|
}
|
|
5859
5916
|
function M(d, p, I) {
|
|
5860
|
-
e = e ||
|
|
5917
|
+
e = e || Rt(), d = d || {}, typeof I != "boolean" && (I = p instanceof e), this.objectMode = !!d.objectMode, I && (this.objectMode = this.objectMode || !!d.readableObjectMode), this.highWaterMark = v(this, d, "readableHighWaterMark", I), this.buffer = new b(), 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 = vr.StringDecoder), this.decoder = new F(d.encoding), this.encoding = d.encoding);
|
|
5861
5918
|
}
|
|
5862
5919
|
function $(d) {
|
|
5863
|
-
if (e = e ||
|
|
5920
|
+
if (e = e || Rt(), !(this instanceof $)) return new $(d);
|
|
5864
5921
|
var p = this instanceof e;
|
|
5865
5922
|
this._readableState = new M(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);
|
|
5866
5923
|
}
|
|
@@ -5875,15 +5932,15 @@ function Bs() {
|
|
|
5875
5932
|
set: function(p) {
|
|
5876
5933
|
this._readableState && (this._readableState.destroyed = p);
|
|
5877
5934
|
}
|
|
5878
|
-
}), $.prototype.destroy =
|
|
5935
|
+
}), $.prototype.destroy = g.destroy, $.prototype._undestroy = g.undestroy, $.prototype._destroy = function(d, p) {
|
|
5879
5936
|
p(d);
|
|
5880
5937
|
}, $.prototype.push = function(d, p) {
|
|
5881
5938
|
var I = this._readableState, U;
|
|
5882
|
-
return I.objectMode ? U = !0 : typeof d == "string" && (p = p || I.defaultEncoding, p !== I.encoding && (d = n.from(d, p), p = ""), U = !0),
|
|
5939
|
+
return I.objectMode ? U = !0 : typeof d == "string" && (p = p || I.defaultEncoding, p !== I.encoding && (d = n.from(d, p), p = ""), U = !0), oe(this, d, p, !1, U);
|
|
5883
5940
|
}, $.prototype.unshift = function(d) {
|
|
5884
|
-
return
|
|
5941
|
+
return oe(this, d, null, !0, !1);
|
|
5885
5942
|
};
|
|
5886
|
-
function
|
|
5943
|
+
function oe(d, p, I, U, Z) {
|
|
5887
5944
|
l("readableAddChunk", p);
|
|
5888
5945
|
var j = d._readableState;
|
|
5889
5946
|
if (p === null)
|
|
@@ -5916,16 +5973,16 @@ function Bs() {
|
|
|
5916
5973
|
$.prototype.isPaused = function() {
|
|
5917
5974
|
return this._readableState.flowing === !1;
|
|
5918
5975
|
}, $.prototype.setEncoding = function(d) {
|
|
5919
|
-
F || (F =
|
|
5976
|
+
F || (F = vr.StringDecoder);
|
|
5920
5977
|
var p = new F(d);
|
|
5921
5978
|
this._readableState.decoder = p, this._readableState.encoding = this._readableState.decoder.encoding;
|
|
5922
5979
|
for (var I = this._readableState.buffer.head, U = ""; I !== null; )
|
|
5923
5980
|
U += p.write(I.data), I = I.next;
|
|
5924
5981
|
return this._readableState.buffer.clear(), U !== "" && this._readableState.buffer.push(U), this._readableState.length = U.length, this;
|
|
5925
5982
|
};
|
|
5926
|
-
var
|
|
5983
|
+
var fe = 1073741824;
|
|
5927
5984
|
function ve(d) {
|
|
5928
|
-
return d >=
|
|
5985
|
+
return d >= fe ? d = fe : (d--, d |= d >>> 1, d |= d >>> 2, d |= d >>> 4, d |= d >>> 8, d |= d >>> 16, d++), d;
|
|
5929
5986
|
}
|
|
5930
5987
|
function Ee(d, p) {
|
|
5931
5988
|
return d <= 0 || p.length === 0 && p.ended ? 0 : p.objectMode ? 1 : d !== d ? p.flowing && p.length ? p.buffer.head.data.length : p.length : (d > p.highWaterMark && (p.highWaterMark = ve(d)), d <= p.length ? d : p.ended ? p.length : (p.needReadable = !0, 0));
|
|
@@ -5989,33 +6046,33 @@ function Bs() {
|
|
|
5989
6046
|
var Z = (!p || p.end !== !1) && d !== process.stdout && d !== process.stderr, j = Z ? qe : nt;
|
|
5990
6047
|
U.endEmitted ? process.nextTick(j) : I.once("end", j), d.on("unpipe", V);
|
|
5991
6048
|
function V(c, s) {
|
|
5992
|
-
l("onunpipe"), c === I && s && s.hasUnpiped === !1 && (s.hasUnpiped = !0,
|
|
6049
|
+
l("onunpipe"), c === I && s && s.hasUnpiped === !1 && (s.hasUnpiped = !0, mt());
|
|
5993
6050
|
}
|
|
5994
6051
|
function qe() {
|
|
5995
6052
|
l("onend"), d.end();
|
|
5996
6053
|
}
|
|
5997
|
-
var
|
|
5998
|
-
d.on("drain",
|
|
5999
|
-
var
|
|
6000
|
-
function
|
|
6001
|
-
l("cleanup"), d.removeListener("close",
|
|
6054
|
+
var gt = Q(I);
|
|
6055
|
+
d.on("drain", gt);
|
|
6056
|
+
var Lt = !1;
|
|
6057
|
+
function mt() {
|
|
6058
|
+
l("cleanup"), d.removeListener("close", Ft), d.removeListener("finish", Ae), d.removeListener("drain", gt), d.removeListener("error", rt), d.removeListener("unpipe", V), I.removeListener("end", qe), I.removeListener("end", nt), I.removeListener("data", Se), Lt = !0, U.awaitDrain && (!d._writableState || d._writableState.needDrain) && gt();
|
|
6002
6059
|
}
|
|
6003
6060
|
I.on("data", Se);
|
|
6004
6061
|
function Se(c) {
|
|
6005
6062
|
l("ondata");
|
|
6006
6063
|
var s = d.write(c);
|
|
6007
|
-
l("dest.write", s), s === !1 && ((U.pipesCount === 1 && U.pipes === d || U.pipesCount > 1 && G(U.pipes, d) !== -1) && !
|
|
6064
|
+
l("dest.write", s), s === !1 && ((U.pipesCount === 1 && U.pipes === d || U.pipesCount > 1 && G(U.pipes, d) !== -1) && !Lt && (l("false write response, pause", U.awaitDrain), U.awaitDrain++), I.pause());
|
|
6008
6065
|
}
|
|
6009
6066
|
function rt(c) {
|
|
6010
6067
|
l("onerror", c), nt(), d.removeListener("error", rt), t(d, "error") === 0 && O(d, c);
|
|
6011
6068
|
}
|
|
6012
6069
|
z(d, "error", rt);
|
|
6013
|
-
function
|
|
6070
|
+
function Ft() {
|
|
6014
6071
|
d.removeListener("finish", Ae), nt();
|
|
6015
6072
|
}
|
|
6016
|
-
d.once("close",
|
|
6073
|
+
d.once("close", Ft);
|
|
6017
6074
|
function Ae() {
|
|
6018
|
-
l("onfinish"), d.removeListener("close",
|
|
6075
|
+
l("onfinish"), d.removeListener("close", Ft), nt();
|
|
6019
6076
|
}
|
|
6020
6077
|
d.once("finish", Ae);
|
|
6021
6078
|
function nt() {
|
|
@@ -6051,12 +6108,12 @@ function Bs() {
|
|
|
6051
6108
|
return d === "data" ? (U.readableListening = this.listenerCount("readable") > 0, U.flowing !== !1 && this.resume()) : d === "readable" && !U.endEmitted && !U.readableListening && (U.readableListening = U.needReadable = !0, U.flowing = !1, U.emittedReadable = !1, l("on readable", U.length, U.reading), U.length ? Pe(this) : U.reading || process.nextTick(Be, this)), I;
|
|
6052
6109
|
}, $.prototype.addListener = $.prototype.on, $.prototype.removeListener = function(d, p) {
|
|
6053
6110
|
var I = r.prototype.removeListener.call(this, d, p);
|
|
6054
|
-
return d === "readable" && process.nextTick(
|
|
6111
|
+
return d === "readable" && process.nextTick(ae, this), I;
|
|
6055
6112
|
}, $.prototype.removeAllListeners = function(d) {
|
|
6056
6113
|
var p = r.prototype.removeAllListeners.apply(this, arguments);
|
|
6057
|
-
return (d === "readable" || d === void 0) && process.nextTick(
|
|
6114
|
+
return (d === "readable" || d === void 0) && process.nextTick(ae, this), p;
|
|
6058
6115
|
};
|
|
6059
|
-
function
|
|
6116
|
+
function ae(d) {
|
|
6060
6117
|
var p = d._readableState;
|
|
6061
6118
|
p.readableListening = d.listenerCount("readable") > 0, p.resumeScheduled && !p.paused ? p.flowing = !0 : d.listenerCount("data") > 0 && d.resume();
|
|
6062
6119
|
}
|
|
@@ -6168,8 +6225,8 @@ function Bs() {
|
|
|
6168
6225
|
}
|
|
6169
6226
|
return Zr;
|
|
6170
6227
|
}
|
|
6171
|
-
var Ss = He,
|
|
6172
|
-
de(He,
|
|
6228
|
+
var Ss = He, Pr = bt.codes, mu = Pr.ERR_METHOD_NOT_IMPLEMENTED, _u = Pr.ERR_MULTIPLE_CALLBACK, wu = Pr.ERR_TRANSFORM_ALREADY_TRANSFORMING, xu = Pr.ERR_TRANSFORM_WITH_LENGTH_0, Cr = Rt();
|
|
6229
|
+
de(He, Cr);
|
|
6173
6230
|
function vu(e, t) {
|
|
6174
6231
|
var r = this._transformState;
|
|
6175
6232
|
r.transforming = !1;
|
|
@@ -6182,7 +6239,7 @@ function vu(e, t) {
|
|
|
6182
6239
|
}
|
|
6183
6240
|
function He(e) {
|
|
6184
6241
|
if (!(this instanceof He)) return new He(e);
|
|
6185
|
-
|
|
6242
|
+
Cr.call(this, e), this._transformState = {
|
|
6186
6243
|
afterTransform: vu.bind(this),
|
|
6187
6244
|
needTransform: !1,
|
|
6188
6245
|
transforming: !1,
|
|
@@ -6198,7 +6255,7 @@ function Eu() {
|
|
|
6198
6255
|
}) : di(this, null, null);
|
|
6199
6256
|
}
|
|
6200
6257
|
He.prototype.push = function(e, t) {
|
|
6201
|
-
return this._transformState.needTransform = !1,
|
|
6258
|
+
return this._transformState.needTransform = !1, Cr.prototype.push.call(this, e, t);
|
|
6202
6259
|
};
|
|
6203
6260
|
He.prototype._transform = function(e, t, r) {
|
|
6204
6261
|
r(new mu("_transform()"));
|
|
@@ -6215,7 +6272,7 @@ He.prototype._read = function(e) {
|
|
|
6215
6272
|
t.writechunk !== null && !t.transforming ? (t.transforming = !0, this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0;
|
|
6216
6273
|
};
|
|
6217
6274
|
He.prototype._destroy = function(e, t) {
|
|
6218
|
-
|
|
6275
|
+
Cr.prototype._destroy.call(this, e, function(r) {
|
|
6219
6276
|
t(r);
|
|
6220
6277
|
});
|
|
6221
6278
|
};
|
|
@@ -6225,13 +6282,13 @@ function di(e, t, r) {
|
|
|
6225
6282
|
if (e._transformState.transforming) throw new wu();
|
|
6226
6283
|
return e.push(null);
|
|
6227
6284
|
}
|
|
6228
|
-
var Bu =
|
|
6229
|
-
de(
|
|
6230
|
-
function
|
|
6231
|
-
if (!(this instanceof
|
|
6285
|
+
var Bu = Yt, As = Ss;
|
|
6286
|
+
de(Yt, As);
|
|
6287
|
+
function Yt(e) {
|
|
6288
|
+
if (!(this instanceof Yt)) return new Yt(e);
|
|
6232
6289
|
As.call(this, e);
|
|
6233
6290
|
}
|
|
6234
|
-
|
|
6291
|
+
Yt.prototype._transform = function(e, t, r) {
|
|
6235
6292
|
r(null, e);
|
|
6236
6293
|
};
|
|
6237
6294
|
var en;
|
|
@@ -6241,7 +6298,7 @@ function Su(e) {
|
|
|
6241
6298
|
t || (t = !0, e.apply(void 0, arguments));
|
|
6242
6299
|
};
|
|
6243
6300
|
}
|
|
6244
|
-
var Is =
|
|
6301
|
+
var Is = bt.codes, Au = Is.ERR_MISSING_ARGS, Iu = Is.ERR_STREAM_DESTROYED;
|
|
6245
6302
|
function pi(e) {
|
|
6246
6303
|
if (e) throw e;
|
|
6247
6304
|
}
|
|
@@ -6286,23 +6343,23 @@ function ku() {
|
|
|
6286
6343
|
throw new Au("streams");
|
|
6287
6344
|
var i, a = t.map(function(f, u) {
|
|
6288
6345
|
var l = u < t.length - 1, b = u > 0;
|
|
6289
|
-
return Tu(f, l, b, function(
|
|
6290
|
-
i || (i =
|
|
6346
|
+
return Tu(f, l, b, function(g) {
|
|
6347
|
+
i || (i = g), g && a.forEach(bi), !l && (a.forEach(bi), n(i));
|
|
6291
6348
|
});
|
|
6292
6349
|
});
|
|
6293
6350
|
return t.reduce(Pu);
|
|
6294
6351
|
}
|
|
6295
6352
|
var Lu = ku;
|
|
6296
6353
|
(function(e, t) {
|
|
6297
|
-
t = e.exports = Bs(), t.Stream = t, t.Readable = t, t.Writable = vs(), t.Duplex =
|
|
6354
|
+
t = e.exports = Bs(), t.Stream = t, t.Readable = t, t.Writable = vs(), t.Duplex = Rt(), t.Transform = Ss, t.PassThrough = Bu, t.finished = kn, t.pipeline = Lu;
|
|
6298
6355
|
})(cn, cn.exports);
|
|
6299
|
-
var Rs = cn.exports,
|
|
6356
|
+
var Rs = cn.exports, Er = xe.Buffer, Ts = Rs.Transform, Fu = de;
|
|
6300
6357
|
function Ou(e, t) {
|
|
6301
|
-
if (!
|
|
6358
|
+
if (!Er.isBuffer(e) && typeof e != "string")
|
|
6302
6359
|
throw new TypeError(t + " must be a string or a buffer");
|
|
6303
6360
|
}
|
|
6304
6361
|
function Ze(e) {
|
|
6305
|
-
Ts.call(this), this._block =
|
|
6362
|
+
Ts.call(this), this._block = Er.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
|
|
6306
6363
|
}
|
|
6307
6364
|
Fu(Ze, Ts);
|
|
6308
6365
|
Ze.prototype._transform = function(e, t, r) {
|
|
@@ -6325,7 +6382,7 @@ Ze.prototype._flush = function(e) {
|
|
|
6325
6382
|
};
|
|
6326
6383
|
Ze.prototype.update = function(e, t) {
|
|
6327
6384
|
if (Ou(e, "Data"), this._finalized) throw new Error("Digest already called");
|
|
6328
|
-
|
|
6385
|
+
Er.isBuffer(e) || (e = Er.from(e, t));
|
|
6329
6386
|
for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
|
|
6330
6387
|
for (var i = this._blockOffset; i < this._blockSize; ) r[i++] = e[n++];
|
|
6331
6388
|
this._update(), this._blockOffset = 0;
|
|
@@ -6350,42 +6407,42 @@ Ze.prototype._digest = function() {
|
|
|
6350
6407
|
throw new Error("_digest is not implemented");
|
|
6351
6408
|
};
|
|
6352
6409
|
var Uu = Ze, Nu = de, Ps = Uu, Mu = xe.Buffer, Du = new Array(16);
|
|
6353
|
-
function
|
|
6410
|
+
function kr() {
|
|
6354
6411
|
Ps.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;
|
|
6355
6412
|
}
|
|
6356
|
-
Nu(
|
|
6357
|
-
|
|
6413
|
+
Nu(kr, Ps);
|
|
6414
|
+
kr.prototype._update = function() {
|
|
6358
6415
|
for (var e = Du, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6359
6416
|
var r = this._a, n = this._b, i = this._c, a = this._d;
|
|
6360
6417
|
r = pe(r, n, i, a, e[0], 3614090360, 7), a = pe(a, r, n, i, e[1], 3905402710, 12), i = pe(i, a, r, n, e[2], 606105819, 17), n = pe(n, i, a, r, e[3], 3250441966, 22), r = pe(r, n, i, a, e[4], 4118548399, 7), a = pe(a, r, n, i, e[5], 1200080426, 12), i = pe(i, a, r, n, e[6], 2821735955, 17), n = pe(n, i, a, r, e[7], 4249261313, 22), r = pe(r, n, i, a, e[8], 1770035416, 7), a = pe(a, r, n, i, e[9], 2336552879, 12), i = pe(i, a, r, n, e[10], 4294925233, 17), n = pe(n, i, a, r, e[11], 2304563134, 22), r = pe(r, n, i, a, e[12], 1804603682, 7), a = pe(a, r, n, i, e[13], 4254626195, 12), i = pe(i, a, r, n, e[14], 2792965006, 17), n = pe(n, i, a, r, e[15], 1236535329, 22), r = be(r, n, i, a, e[1], 4129170786, 5), a = be(a, r, n, i, e[6], 3225465664, 9), i = be(i, a, r, n, e[11], 643717713, 14), n = be(n, i, a, r, e[0], 3921069994, 20), r = be(r, n, i, a, e[5], 3593408605, 5), a = be(a, r, n, i, e[10], 38016083, 9), i = be(i, a, r, n, e[15], 3634488961, 14), n = be(n, i, a, r, e[4], 3889429448, 20), r = be(r, n, i, a, e[9], 568446438, 5), a = be(a, r, n, i, e[14], 3275163606, 9), i = be(i, a, r, n, e[3], 4107603335, 14), n = be(n, i, a, r, e[8], 1163531501, 20), r = be(r, n, i, a, e[13], 2850285829, 5), a = be(a, r, n, i, e[2], 4243563512, 9), i = be(i, a, r, n, e[7], 1735328473, 14), n = be(n, i, a, r, e[12], 2368359562, 20), r = ye(r, n, i, a, e[5], 4294588738, 4), a = ye(a, r, n, i, e[8], 2272392833, 11), i = ye(i, a, r, n, e[11], 1839030562, 16), n = ye(n, i, a, r, e[14], 4259657740, 23), r = ye(r, n, i, a, e[1], 2763975236, 4), a = ye(a, r, n, i, e[4], 1272893353, 11), i = ye(i, a, r, n, e[7], 4139469664, 16), n = ye(n, i, a, r, e[10], 3200236656, 23), r = ye(r, n, i, a, e[13], 681279174, 4), a = ye(a, r, n, i, e[0], 3936430074, 11), i = ye(i, a, r, n, e[3], 3572445317, 16), n = ye(n, i, a, r, e[6], 76029189, 23), r = ye(r, n, i, a, e[9], 3654602809, 4), a = ye(a, r, n, i, e[12], 3873151461, 11), i = ye(i, a, r, n, e[15], 530742520, 16), n = ye(n, i, a, r, e[2], 3299628645, 23), r = ge(r, n, i, a, e[0], 4096336452, 6), a = ge(a, r, n, i, e[7], 1126891415, 10), i = ge(i, a, r, n, e[14], 2878612391, 15), n = ge(n, i, a, r, e[5], 4237533241, 21), r = ge(r, n, i, a, e[12], 1700485571, 6), a = ge(a, r, n, i, e[3], 2399980690, 10), i = ge(i, a, r, n, e[10], 4293915773, 15), n = ge(n, i, a, r, e[1], 2240044497, 21), r = ge(r, n, i, a, e[8], 1873313359, 6), a = ge(a, r, n, i, e[15], 4264355552, 10), i = ge(i, a, r, n, e[6], 2734768916, 15), n = ge(n, i, a, r, e[13], 1309151649, 21), r = ge(r, n, i, a, e[4], 4149444226, 6), a = ge(a, r, n, i, e[11], 3174756917, 10), i = ge(i, a, r, n, e[2], 718787259, 15), n = ge(n, i, a, r, e[9], 3951481745, 21), this._a = this._a + r | 0, this._b = this._b + n | 0, this._c = this._c + i | 0, this._d = this._d + a | 0;
|
|
6361
6418
|
};
|
|
6362
|
-
|
|
6419
|
+
kr.prototype._digest = function() {
|
|
6363
6420
|
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();
|
|
6364
6421
|
var e = Mu.allocUnsafe(16);
|
|
6365
6422
|
return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e;
|
|
6366
6423
|
};
|
|
6367
|
-
function
|
|
6424
|
+
function Lr(e, t) {
|
|
6368
6425
|
return e << t | e >>> 32 - t;
|
|
6369
6426
|
}
|
|
6370
6427
|
function pe(e, t, r, n, i, a, f) {
|
|
6371
|
-
return
|
|
6428
|
+
return Lr(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
|
|
6372
6429
|
}
|
|
6373
6430
|
function be(e, t, r, n, i, a, f) {
|
|
6374
|
-
return
|
|
6431
|
+
return Lr(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
|
|
6375
6432
|
}
|
|
6376
6433
|
function ye(e, t, r, n, i, a, f) {
|
|
6377
|
-
return
|
|
6434
|
+
return Lr(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
|
|
6378
6435
|
}
|
|
6379
6436
|
function ge(e, t, r, n, i, a, f) {
|
|
6380
|
-
return
|
|
6437
|
+
return Lr(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
|
|
6381
6438
|
}
|
|
6382
|
-
var $u =
|
|
6439
|
+
var $u = kr, Br = xe.Buffer, Cs = Rs.Transform, Hu = de;
|
|
6383
6440
|
function zu(e, t) {
|
|
6384
|
-
if (!
|
|
6441
|
+
if (!Br.isBuffer(e) && typeof e != "string")
|
|
6385
6442
|
throw new TypeError(t + " must be a string or a buffer");
|
|
6386
6443
|
}
|
|
6387
6444
|
function et(e) {
|
|
6388
|
-
Cs.call(this), this._block =
|
|
6445
|
+
Cs.call(this), this._block = Br.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
|
|
6389
6446
|
}
|
|
6390
6447
|
Hu(et, Cs);
|
|
6391
6448
|
et.prototype._transform = function(e, t, r) {
|
|
@@ -6408,7 +6465,7 @@ et.prototype._flush = function(e) {
|
|
|
6408
6465
|
};
|
|
6409
6466
|
et.prototype.update = function(e, t) {
|
|
6410
6467
|
if (zu(e, "Data"), this._finalized) throw new Error("Digest already called");
|
|
6411
|
-
|
|
6468
|
+
Br.isBuffer(e) || (e = Br.from(e, t));
|
|
6412
6469
|
for (var r = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize; ) {
|
|
6413
6470
|
for (var i = this._blockOffset; i < this._blockSize; ) r[i++] = e[n++];
|
|
6414
6471
|
this._update(), this._blockOffset = 0;
|
|
@@ -6432,7 +6489,7 @@ et.prototype.digest = function(e) {
|
|
|
6432
6489
|
et.prototype._digest = function() {
|
|
6433
6490
|
throw new Error("_digest is not implemented");
|
|
6434
6491
|
};
|
|
6435
|
-
var Gu = et, tn =
|
|
6492
|
+
var Gu = et, tn = Ct.Buffer, ju = de, ks = Gu, Wu = new Array(16), Ht = [
|
|
6436
6493
|
0,
|
|
6437
6494
|
1,
|
|
6438
6495
|
2,
|
|
@@ -6513,7 +6570,7 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
|
|
|
6513
6570
|
6,
|
|
6514
6571
|
15,
|
|
6515
6572
|
13
|
|
6516
|
-
],
|
|
6573
|
+
], zt = [
|
|
6517
6574
|
5,
|
|
6518
6575
|
14,
|
|
6519
6576
|
7,
|
|
@@ -6594,7 +6651,7 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
|
|
|
6594
6651
|
3,
|
|
6595
6652
|
9,
|
|
6596
6653
|
11
|
|
6597
|
-
],
|
|
6654
|
+
], Gt = [
|
|
6598
6655
|
11,
|
|
6599
6656
|
14,
|
|
6600
6657
|
15,
|
|
@@ -6675,7 +6732,7 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
|
|
|
6675
6732
|
8,
|
|
6676
6733
|
5,
|
|
6677
6734
|
6
|
|
6678
|
-
],
|
|
6735
|
+
], jt = [
|
|
6679
6736
|
8,
|
|
6680
6737
|
9,
|
|
6681
6738
|
9,
|
|
@@ -6756,48 +6813,48 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
|
|
|
6756
6813
|
13,
|
|
6757
6814
|
11,
|
|
6758
6815
|
11
|
|
6759
|
-
],
|
|
6760
|
-
function
|
|
6816
|
+
], Wt = [0, 1518500249, 1859775393, 2400959708, 2840853838], qt = [1352829926, 1548603684, 1836072691, 2053994217, 0];
|
|
6817
|
+
function Fr() {
|
|
6761
6818
|
ks.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
|
|
6762
6819
|
}
|
|
6763
|
-
ju(
|
|
6764
|
-
|
|
6820
|
+
ju(Fr, ks);
|
|
6821
|
+
Fr.prototype._update = function() {
|
|
6765
6822
|
for (var e = Wu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6766
|
-
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, b = this._c | 0,
|
|
6823
|
+
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, b = this._c | 0, g = this._d | 0, m = this._e | 0, v = 0; v < 80; v += 1) {
|
|
6767
6824
|
var A, B;
|
|
6768
|
-
v < 16 ? (A = yi(r, n, i, a, f, e[
|
|
6825
|
+
v < 16 ? (A = yi(r, n, i, a, f, e[Ht[v]], Wt[0], Gt[v]), B = wi(u, l, b, g, m, e[zt[v]], qt[0], jt[v])) : v < 32 ? (A = gi(r, n, i, a, f, e[Ht[v]], Wt[1], Gt[v]), B = _i(u, l, b, g, m, e[zt[v]], qt[1], jt[v])) : v < 48 ? (A = mi(r, n, i, a, f, e[Ht[v]], Wt[2], Gt[v]), B = mi(u, l, b, g, m, e[zt[v]], qt[2], jt[v])) : v < 64 ? (A = _i(r, n, i, a, f, e[Ht[v]], Wt[3], Gt[v]), B = gi(u, l, b, g, m, e[zt[v]], qt[3], jt[v])) : (A = wi(r, n, i, a, f, e[Ht[v]], Wt[4], Gt[v]), B = yi(u, l, b, g, m, e[zt[v]], qt[4], jt[v])), r = f, f = a, a = dt(i, 10), i = n, n = A, u = m, m = g, g = dt(b, 10), b = l, l = B;
|
|
6769
6826
|
}
|
|
6770
|
-
var P = this._b + i +
|
|
6771
|
-
this._b = this._c + a +
|
|
6827
|
+
var P = this._b + i + g | 0;
|
|
6828
|
+
this._b = this._c + a + m | 0, this._c = this._d + f + u | 0, this._d = this._e + r + l | 0, this._e = this._a + n + b | 0, this._a = P;
|
|
6772
6829
|
};
|
|
6773
|
-
|
|
6830
|
+
Fr.prototype._digest = function() {
|
|
6774
6831
|
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();
|
|
6775
6832
|
var e = tn.alloc ? tn.alloc(20) : new tn(20);
|
|
6776
6833
|
return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e.writeInt32LE(this._e, 16), e;
|
|
6777
6834
|
};
|
|
6778
|
-
function
|
|
6835
|
+
function dt(e, t) {
|
|
6779
6836
|
return e << t | e >>> 32 - t;
|
|
6780
6837
|
}
|
|
6781
6838
|
function yi(e, t, r, n, i, a, f, u) {
|
|
6782
|
-
return
|
|
6839
|
+
return dt(e + (t ^ r ^ n) + a + f | 0, u) + i | 0;
|
|
6783
6840
|
}
|
|
6784
6841
|
function gi(e, t, r, n, i, a, f, u) {
|
|
6785
|
-
return
|
|
6842
|
+
return dt(e + (t & r | ~t & n) + a + f | 0, u) + i | 0;
|
|
6786
6843
|
}
|
|
6787
6844
|
function mi(e, t, r, n, i, a, f, u) {
|
|
6788
|
-
return
|
|
6845
|
+
return dt(e + ((t | ~r) ^ n) + a + f | 0, u) + i | 0;
|
|
6789
6846
|
}
|
|
6790
6847
|
function _i(e, t, r, n, i, a, f, u) {
|
|
6791
|
-
return
|
|
6848
|
+
return dt(e + (t & n | r & ~n) + a + f | 0, u) + i | 0;
|
|
6792
6849
|
}
|
|
6793
6850
|
function wi(e, t, r, n, i, a, f, u) {
|
|
6794
|
-
return
|
|
6851
|
+
return dt(e + (t ^ (r | ~n)) + a + f | 0, u) + i | 0;
|
|
6795
6852
|
}
|
|
6796
|
-
var qu =
|
|
6797
|
-
function
|
|
6853
|
+
var qu = Fr, Ls = { exports: {} }, Fs = xe.Buffer;
|
|
6854
|
+
function Or(e, t) {
|
|
6798
6855
|
this._block = Fs.alloc(e), this._finalSize = t, this._blockSize = e, this._len = 0;
|
|
6799
6856
|
}
|
|
6800
|
-
|
|
6857
|
+
Or.prototype.update = function(e, t) {
|
|
6801
6858
|
typeof e == "string" && (t = t || "utf8", e = Fs.from(e, t));
|
|
6802
6859
|
for (var r = this._block, n = this._blockSize, i = e.length, a = this._len, f = 0; f < i; ) {
|
|
6803
6860
|
for (var u = a % n, l = Math.min(i - f, n - u), b = 0; b < l; b++)
|
|
@@ -6806,7 +6863,7 @@ Fr.prototype.update = function(e, t) {
|
|
|
6806
6863
|
}
|
|
6807
6864
|
return this._len += i, this;
|
|
6808
6865
|
};
|
|
6809
|
-
|
|
6866
|
+
Or.prototype.digest = function(e) {
|
|
6810
6867
|
var t = this._len % this._blockSize;
|
|
6811
6868
|
this._block[t] = 128, this._block.fill(0, t + 1), t >= this._finalSize && (this._update(this._block), this._block.fill(0));
|
|
6812
6869
|
var r = this._len * 8;
|
|
@@ -6820,20 +6877,20 @@ Fr.prototype.digest = function(e) {
|
|
|
6820
6877
|
var a = this._hash();
|
|
6821
6878
|
return e ? a.toString(e) : a;
|
|
6822
6879
|
};
|
|
6823
|
-
|
|
6880
|
+
Or.prototype._update = function() {
|
|
6824
6881
|
throw new Error("_update must be implemented by subclass");
|
|
6825
6882
|
};
|
|
6826
|
-
var
|
|
6883
|
+
var kt = Or, Vu = de, Os = kt, Ku = xe.Buffer, Yu = [
|
|
6827
6884
|
1518500249,
|
|
6828
6885
|
1859775393,
|
|
6829
6886
|
-1894007588,
|
|
6830
6887
|
-899497514
|
|
6831
6888
|
], Ju = new Array(80);
|
|
6832
|
-
function
|
|
6889
|
+
function tr() {
|
|
6833
6890
|
this.init(), this._w = Ju, Os.call(this, 64, 56);
|
|
6834
6891
|
}
|
|
6835
|
-
Vu(
|
|
6836
|
-
|
|
6892
|
+
Vu(tr, Os);
|
|
6893
|
+
tr.prototype.init = function() {
|
|
6837
6894
|
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
6838
6895
|
};
|
|
6839
6896
|
function Xu(e) {
|
|
@@ -6845,30 +6902,30 @@ function Qu(e) {
|
|
|
6845
6902
|
function Zu(e, t, r, n) {
|
|
6846
6903
|
return e === 0 ? t & r | ~t & n : e === 2 ? t & r | t & n | r & n : t ^ r ^ n;
|
|
6847
6904
|
}
|
|
6848
|
-
|
|
6905
|
+
tr.prototype._update = function(e) {
|
|
6849
6906
|
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);
|
|
6850
6907
|
for (; u < 80; ++u) t[u] = t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16];
|
|
6851
6908
|
for (var l = 0; l < 80; ++l) {
|
|
6852
|
-
var b = ~~(l / 20),
|
|
6853
|
-
f = a, a = i, i = Qu(n), n = r, r =
|
|
6909
|
+
var b = ~~(l / 20), g = Xu(r) + Zu(b, n, i, a) + f + t[l] + Yu[b] | 0;
|
|
6910
|
+
f = a, a = i, i = Qu(n), n = r, r = g;
|
|
6854
6911
|
}
|
|
6855
6912
|
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;
|
|
6856
6913
|
};
|
|
6857
|
-
|
|
6914
|
+
tr.prototype._hash = function() {
|
|
6858
6915
|
var e = Ku.allocUnsafe(20);
|
|
6859
6916
|
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;
|
|
6860
6917
|
};
|
|
6861
|
-
var ec =
|
|
6918
|
+
var ec = tr, tc = de, Us = kt, rc = xe.Buffer, nc = [
|
|
6862
6919
|
1518500249,
|
|
6863
6920
|
1859775393,
|
|
6864
6921
|
-1894007588,
|
|
6865
6922
|
-899497514
|
|
6866
6923
|
], ic = new Array(80);
|
|
6867
|
-
function
|
|
6924
|
+
function rr() {
|
|
6868
6925
|
this.init(), this._w = ic, Us.call(this, 64, 56);
|
|
6869
6926
|
}
|
|
6870
|
-
tc(
|
|
6871
|
-
|
|
6927
|
+
tc(rr, Us);
|
|
6928
|
+
rr.prototype.init = function() {
|
|
6872
6929
|
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
6873
6930
|
};
|
|
6874
6931
|
function sc(e) {
|
|
@@ -6883,20 +6940,20 @@ function ac(e) {
|
|
|
6883
6940
|
function fc(e, t, r, n) {
|
|
6884
6941
|
return e === 0 ? t & r | ~t & n : e === 2 ? t & r | t & n | r & n : t ^ r ^ n;
|
|
6885
6942
|
}
|
|
6886
|
-
|
|
6943
|
+
rr.prototype._update = function(e) {
|
|
6887
6944
|
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);
|
|
6888
6945
|
for (; u < 80; ++u) t[u] = sc(t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16]);
|
|
6889
6946
|
for (var l = 0; l < 80; ++l) {
|
|
6890
|
-
var b = ~~(l / 20),
|
|
6891
|
-
f = a, a = i, i = ac(n), n = r, r =
|
|
6947
|
+
var b = ~~(l / 20), g = oc(r) + fc(b, n, i, a) + f + t[l] + nc[b] | 0;
|
|
6948
|
+
f = a, a = i, i = ac(n), n = r, r = g;
|
|
6892
6949
|
}
|
|
6893
6950
|
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;
|
|
6894
6951
|
};
|
|
6895
|
-
|
|
6952
|
+
rr.prototype._hash = function() {
|
|
6896
6953
|
var e = rc.allocUnsafe(20);
|
|
6897
6954
|
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;
|
|
6898
6955
|
};
|
|
6899
|
-
var uc =
|
|
6956
|
+
var uc = rr, cc = de, Ns = kt, lc = xe.Buffer, hc = [
|
|
6900
6957
|
1116352408,
|
|
6901
6958
|
1899447441,
|
|
6902
6959
|
3049323471,
|
|
@@ -6962,11 +7019,11 @@ var uc = er, cc = de, Ns = Ct, lc = xe.Buffer, hc = [
|
|
|
6962
7019
|
3204031479,
|
|
6963
7020
|
3329325298
|
|
6964
7021
|
], dc = new Array(64);
|
|
6965
|
-
function
|
|
7022
|
+
function nr() {
|
|
6966
7023
|
this.init(), this._w = dc, Ns.call(this, 64, 56);
|
|
6967
7024
|
}
|
|
6968
|
-
cc(
|
|
6969
|
-
|
|
7025
|
+
cc(nr, Ns);
|
|
7026
|
+
nr.prototype.init = function() {
|
|
6970
7027
|
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;
|
|
6971
7028
|
};
|
|
6972
7029
|
function pc(e, t, r) {
|
|
@@ -6987,32 +7044,32 @@ function mc(e) {
|
|
|
6987
7044
|
function _c(e) {
|
|
6988
7045
|
return (e >>> 17 | e << 15) ^ (e >>> 19 | e << 13) ^ e >>> 10;
|
|
6989
7046
|
}
|
|
6990
|
-
|
|
6991
|
-
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, b = this._h | 0,
|
|
6992
|
-
for (;
|
|
6993
|
-
for (var
|
|
6994
|
-
var v = b + gc(f) + pc(f, u, l) + hc[
|
|
7047
|
+
nr.prototype._update = function(e) {
|
|
7048
|
+
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, b = this._h | 0, g = 0; g < 16; ++g) t[g] = e.readInt32BE(g * 4);
|
|
7049
|
+
for (; g < 64; ++g) t[g] = _c(t[g - 2]) + t[g - 7] + mc(t[g - 15]) + t[g - 16] | 0;
|
|
7050
|
+
for (var m = 0; m < 64; ++m) {
|
|
7051
|
+
var v = b + gc(f) + pc(f, u, l) + hc[m] + t[m] | 0, A = yc(r) + bc(r, n, i) | 0;
|
|
6995
7052
|
b = l, l = u, u = f, f = a + v | 0, a = i, i = n, n = r, r = v + A | 0;
|
|
6996
7053
|
}
|
|
6997
7054
|
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 = b + this._h | 0;
|
|
6998
7055
|
};
|
|
6999
|
-
|
|
7056
|
+
nr.prototype._hash = function() {
|
|
7000
7057
|
var e = lc.allocUnsafe(32);
|
|
7001
7058
|
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;
|
|
7002
7059
|
};
|
|
7003
|
-
var Ms =
|
|
7004
|
-
function
|
|
7060
|
+
var Ms = nr, wc = de, xc = Ms, vc = kt, Ec = xe.Buffer, Bc = new Array(64);
|
|
7061
|
+
function Ur() {
|
|
7005
7062
|
this.init(), this._w = Bc, vc.call(this, 64, 56);
|
|
7006
7063
|
}
|
|
7007
|
-
wc(
|
|
7008
|
-
|
|
7064
|
+
wc(Ur, xc);
|
|
7065
|
+
Ur.prototype.init = function() {
|
|
7009
7066
|
return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this;
|
|
7010
7067
|
};
|
|
7011
|
-
|
|
7068
|
+
Ur.prototype._hash = function() {
|
|
7012
7069
|
var e = Ec.allocUnsafe(28);
|
|
7013
7070
|
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;
|
|
7014
7071
|
};
|
|
7015
|
-
var Sc =
|
|
7072
|
+
var Sc = Ur, Ac = de, Ds = kt, Ic = xe.Buffer, xi = [
|
|
7016
7073
|
1116352408,
|
|
7017
7074
|
3609767458,
|
|
7018
7075
|
1899447441,
|
|
@@ -7174,11 +7231,11 @@ var Sc = Or, Ac = de, Ds = Ct, Ic = xe.Buffer, xi = [
|
|
|
7174
7231
|
1816402316,
|
|
7175
7232
|
1246189591
|
|
7176
7233
|
], Rc = new Array(160);
|
|
7177
|
-
function
|
|
7234
|
+
function ir() {
|
|
7178
7235
|
this.init(), this._w = Rc, Ds.call(this, 128, 112);
|
|
7179
7236
|
}
|
|
7180
|
-
Ac(
|
|
7181
|
-
|
|
7237
|
+
Ac(ir, Ds);
|
|
7238
|
+
ir.prototype.init = function() {
|
|
7182
7239
|
return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this;
|
|
7183
7240
|
};
|
|
7184
7241
|
function vi(e, t, r) {
|
|
@@ -7208,59 +7265,59 @@ function kc(e, t) {
|
|
|
7208
7265
|
function ce(e, t) {
|
|
7209
7266
|
return e >>> 0 < t >>> 0 ? 1 : 0;
|
|
7210
7267
|
}
|
|
7211
|
-
|
|
7212
|
-
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, b = this._hh | 0,
|
|
7268
|
+
ir.prototype._update = function(e) {
|
|
7269
|
+
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, b = this._hh | 0, g = this._al | 0, m = this._bl | 0, v = this._cl | 0, A = this._dl | 0, B = this._el | 0, P = this._fl | 0, T = this._gl | 0, C = this._hl | 0, F = 0; F < 32; F += 2)
|
|
7213
7270
|
t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
|
|
7214
7271
|
for (; F < 160; F += 2) {
|
|
7215
7272
|
var L = t[F - 30], k = t[F - 15 * 2 + 1], O = Tc(L, k), S = Pc(k, L);
|
|
7216
7273
|
L = t[F - 2 * 2], k = t[F - 2 * 2 + 1];
|
|
7217
|
-
var z = Cc(L, k), M = kc(k, L), $ = t[F - 7 * 2],
|
|
7218
|
-
|
|
7274
|
+
var z = Cc(L, k), M = kc(k, L), $ = t[F - 7 * 2], oe = t[F - 7 * 2 + 1], Te = t[F - 16 * 2], ze = t[F - 16 * 2 + 1], fe = S + oe | 0, ve = O + $ + ce(fe, S) | 0;
|
|
7275
|
+
fe = fe + M | 0, ve = ve + z + ce(fe, M) | 0, fe = fe + ze | 0, ve = ve + Te + ce(fe, ze) | 0, t[F] = ve, t[F + 1] = fe;
|
|
7219
7276
|
}
|
|
7220
7277
|
for (var Ee = 0; Ee < 160; Ee += 2) {
|
|
7221
|
-
ve = t[Ee],
|
|
7222
|
-
var tt = Ei(r, n, i), Pe = Ei(
|
|
7223
|
-
w = w + Ue | 0, _ = _ + We + ce(w, Ue) | 0, w = w + Be | 0, _ = _ +
|
|
7278
|
+
ve = t[Ee], fe = t[Ee + 1];
|
|
7279
|
+
var tt = Ei(r, n, i), Pe = Ei(g, m, v), Ge = Bi(r, g), Ce = Bi(g, r), je = Si(f, B), Q = Si(B, f), ae = xi[Ee], Be = xi[Ee + 1], We = vi(f, u, l), Ue = vi(B, P, T), w = C + Q | 0, _ = b + je + ce(w, C) | 0;
|
|
7280
|
+
w = w + Ue | 0, _ = _ + We + ce(w, Ue) | 0, w = w + Be | 0, _ = _ + ae + ce(w, Be) | 0, w = w + fe | 0, _ = _ + ve + ce(w, fe) | 0;
|
|
7224
7281
|
var R = Ce + Pe | 0, D = Ge + tt + ce(R, Ce) | 0;
|
|
7225
|
-
b = l, C = T, l = u, T = P, u = f, P = B, B = A + w | 0, f = a + _ + ce(B, A) | 0, a = i, A = v, i = n, v =
|
|
7282
|
+
b = l, C = T, l = u, T = P, u = f, P = B, B = A + w | 0, f = a + _ + ce(B, A) | 0, a = i, A = v, i = n, v = m, n = r, m = g, g = w + R | 0, r = _ + D + ce(g, w) | 0;
|
|
7226
7283
|
}
|
|
7227
|
-
this._al = this._al +
|
|
7284
|
+
this._al = this._al + g | 0, this._bl = this._bl + m | 0, this._cl = this._cl + v | 0, this._dl = this._dl + A | 0, this._el = this._el + B | 0, this._fl = this._fl + P | 0, this._gl = this._gl + T | 0, this._hl = this._hl + C | 0, this._ah = this._ah + r + ce(this._al, g) | 0, this._bh = this._bh + n + ce(this._bl, m) | 0, this._ch = this._ch + i + ce(this._cl, v) | 0, this._dh = this._dh + a + ce(this._dl, A) | 0, this._eh = this._eh + f + ce(this._el, B) | 0, this._fh = this._fh + u + ce(this._fl, P) | 0, this._gh = this._gh + l + ce(this._gl, T) | 0, this._hh = this._hh + b + ce(this._hl, C) | 0;
|
|
7228
7285
|
};
|
|
7229
|
-
|
|
7286
|
+
ir.prototype._hash = function() {
|
|
7230
7287
|
var e = Ic.allocUnsafe(64);
|
|
7231
7288
|
function t(r, n, i) {
|
|
7232
7289
|
e.writeInt32BE(r, i), e.writeInt32BE(n, i + 4);
|
|
7233
7290
|
}
|
|
7234
7291
|
return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this._hh, this._hl, 56), e;
|
|
7235
7292
|
};
|
|
7236
|
-
var $s =
|
|
7237
|
-
function
|
|
7293
|
+
var $s = ir, Lc = de, Fc = $s, Oc = kt, Uc = xe.Buffer, Nc = new Array(160);
|
|
7294
|
+
function Nr() {
|
|
7238
7295
|
this.init(), this._w = Nc, Oc.call(this, 128, 112);
|
|
7239
7296
|
}
|
|
7240
|
-
Lc(
|
|
7241
|
-
|
|
7297
|
+
Lc(Nr, Fc);
|
|
7298
|
+
Nr.prototype.init = function() {
|
|
7242
7299
|
return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this;
|
|
7243
7300
|
};
|
|
7244
|
-
|
|
7301
|
+
Nr.prototype._hash = function() {
|
|
7245
7302
|
var e = Uc.allocUnsafe(48);
|
|
7246
7303
|
function t(r, n, i) {
|
|
7247
7304
|
e.writeInt32BE(r, i), e.writeInt32BE(n, i + 4);
|
|
7248
7305
|
}
|
|
7249
7306
|
return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), e;
|
|
7250
7307
|
};
|
|
7251
|
-
var Mc =
|
|
7308
|
+
var Mc = Nr, yt = Ls.exports = function(t) {
|
|
7252
7309
|
t = t.toLowerCase();
|
|
7253
|
-
var r =
|
|
7310
|
+
var r = yt[t];
|
|
7254
7311
|
if (!r) throw new Error(t + " is not supported (we accept pull requests)");
|
|
7255
7312
|
return new r();
|
|
7256
7313
|
};
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
var Dc = Ls.exports, Hs = xe.Buffer, zs = Pn.Transform, $c =
|
|
7314
|
+
yt.sha = ec;
|
|
7315
|
+
yt.sha1 = uc;
|
|
7316
|
+
yt.sha224 = Sc;
|
|
7317
|
+
yt.sha256 = Ms;
|
|
7318
|
+
yt.sha384 = Mc;
|
|
7319
|
+
yt.sha512 = $s;
|
|
7320
|
+
var Dc = Ls.exports, Hs = xe.Buffer, zs = Pn.Transform, $c = vr.StringDecoder, Hc = de;
|
|
7264
7321
|
function ke(e) {
|
|
7265
7322
|
zs.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;
|
|
7266
7323
|
}
|
|
@@ -7310,19 +7367,19 @@ ke.prototype._toString = function(e, t, r) {
|
|
|
7310
7367
|
return r && (n += this._decoder.end()), n;
|
|
7311
7368
|
};
|
|
7312
7369
|
var zc = ke, Gc = de, jc = $u, Wc = qu, qc = Dc, Gs = zc;
|
|
7313
|
-
function
|
|
7370
|
+
function Mr(e) {
|
|
7314
7371
|
Gs.call(this, "digest"), this._hash = e;
|
|
7315
7372
|
}
|
|
7316
|
-
Gc(
|
|
7317
|
-
|
|
7373
|
+
Gc(Mr, Gs);
|
|
7374
|
+
Mr.prototype._update = function(e) {
|
|
7318
7375
|
this._hash.update(e);
|
|
7319
7376
|
};
|
|
7320
|
-
|
|
7377
|
+
Mr.prototype._final = function() {
|
|
7321
7378
|
return this._hash.digest();
|
|
7322
7379
|
};
|
|
7323
7380
|
var Vc = function(t) {
|
|
7324
|
-
return t = t.toLowerCase(), t === "md5" ? new jc() : t === "rmd160" || t === "ripemd160" ? new Wc() : new
|
|
7325
|
-
},
|
|
7381
|
+
return t = t.toLowerCase(), t === "md5" ? new jc() : t === "rmd160" || t === "ripemd160" ? new Wc() : new Mr(qc(t));
|
|
7382
|
+
}, lr = xe.Buffer;
|
|
7326
7383
|
function Kc(e) {
|
|
7327
7384
|
if (e.length >= 255)
|
|
7328
7385
|
throw new TypeError("Alphabet too long");
|
|
@@ -7335,8 +7392,8 @@ function Kc(e) {
|
|
|
7335
7392
|
t[a] = n;
|
|
7336
7393
|
}
|
|
7337
7394
|
var f = e.length, u = e.charAt(0), l = Math.log(f) / Math.log(256), b = Math.log(256) / Math.log(f);
|
|
7338
|
-
function
|
|
7339
|
-
if ((Array.isArray(A) || A instanceof Uint8Array) && (A =
|
|
7395
|
+
function g(A) {
|
|
7396
|
+
if ((Array.isArray(A) || A instanceof Uint8Array) && (A = lr.from(A)), !lr.isBuffer(A))
|
|
7340
7397
|
throw new TypeError("Expected Buffer");
|
|
7341
7398
|
if (A.length === 0)
|
|
7342
7399
|
return "";
|
|
@@ -7355,11 +7412,11 @@ function Kc(e) {
|
|
|
7355
7412
|
M += e.charAt(L[z]);
|
|
7356
7413
|
return M;
|
|
7357
7414
|
}
|
|
7358
|
-
function
|
|
7415
|
+
function m(A) {
|
|
7359
7416
|
if (typeof A != "string")
|
|
7360
7417
|
throw new TypeError("Expected String");
|
|
7361
7418
|
if (A.length === 0)
|
|
7362
|
-
return
|
|
7419
|
+
return lr.alloc(0);
|
|
7363
7420
|
for (var B = 0, P = 0, T = 0; A[B] === u; )
|
|
7364
7421
|
P++, B++;
|
|
7365
7422
|
for (var C = (A.length - B) * l + 1 >>> 0, F = new Uint8Array(C); B < A.length; ) {
|
|
@@ -7374,21 +7431,21 @@ function Kc(e) {
|
|
|
7374
7431
|
}
|
|
7375
7432
|
for (var S = C - T; S !== C && F[S] === 0; )
|
|
7376
7433
|
S++;
|
|
7377
|
-
var z =
|
|
7434
|
+
var z = lr.allocUnsafe(P + (C - S));
|
|
7378
7435
|
z.fill(0, 0, P);
|
|
7379
7436
|
for (var M = P; S !== C; )
|
|
7380
7437
|
z[M++] = F[S++];
|
|
7381
7438
|
return z;
|
|
7382
7439
|
}
|
|
7383
7440
|
function v(A) {
|
|
7384
|
-
var B =
|
|
7441
|
+
var B = m(A);
|
|
7385
7442
|
if (B)
|
|
7386
7443
|
return B;
|
|
7387
7444
|
throw new Error("Non-base" + f + " character");
|
|
7388
7445
|
}
|
|
7389
7446
|
return {
|
|
7390
|
-
encode:
|
|
7391
|
-
decodeUnsafe:
|
|
7447
|
+
encode: g,
|
|
7448
|
+
decodeUnsafe: m,
|
|
7392
7449
|
decode: v
|
|
7393
7450
|
};
|
|
7394
7451
|
}
|
|
@@ -7463,9 +7520,9 @@ var ol = {
|
|
|
7463
7520
|
decodeRaw: js,
|
|
7464
7521
|
encode: sl,
|
|
7465
7522
|
encodeRaw: dn
|
|
7466
|
-
},
|
|
7467
|
-
Object.defineProperty(
|
|
7468
|
-
|
|
7523
|
+
}, Dr = {};
|
|
7524
|
+
Object.defineProperty(Dr, "__esModule", { value: !0 });
|
|
7525
|
+
Dr.testEcc = void 0;
|
|
7469
7526
|
const H = (e) => Buffer.from(e, "hex");
|
|
7470
7527
|
function al(e) {
|
|
7471
7528
|
J(
|
|
@@ -7657,15 +7714,15 @@ function al(e) {
|
|
|
7657
7714
|
)
|
|
7658
7715
|
);
|
|
7659
7716
|
}
|
|
7660
|
-
|
|
7717
|
+
Dr.testEcc = al;
|
|
7661
7718
|
function J(e) {
|
|
7662
7719
|
if (!e) throw new Error("ecc library invalid");
|
|
7663
7720
|
}
|
|
7664
|
-
Object.defineProperty(
|
|
7665
|
-
|
|
7666
|
-
const pn =
|
|
7667
|
-
|
|
7668
|
-
const _e = rs, fl = kf, Ii = ol, ul =
|
|
7721
|
+
Object.defineProperty(At, "__esModule", { value: !0 });
|
|
7722
|
+
At.ECPairFactory = At.networks = void 0;
|
|
7723
|
+
const pn = It;
|
|
7724
|
+
At.networks = pn;
|
|
7725
|
+
const _e = rs, fl = kf, Ii = ol, ul = Dr, nn = _e.typeforce.maybe(
|
|
7669
7726
|
_e.typeforce.compile({
|
|
7670
7727
|
compressed: _e.maybe(_e.Boolean),
|
|
7671
7728
|
network: _e.maybe(_e.Network)
|
|
@@ -7685,10 +7742,10 @@ function ll(e) {
|
|
|
7685
7742
|
return _e.typeforce(e.isPoint, u), _e.typeforce(nn, l), new f(void 0, u, l);
|
|
7686
7743
|
}
|
|
7687
7744
|
function i(u, l) {
|
|
7688
|
-
const b = Ii.decode(u),
|
|
7745
|
+
const b = Ii.decode(u), g = b.version;
|
|
7689
7746
|
if (_e.Array(l)) {
|
|
7690
|
-
if (l = l.filter((
|
|
7691
|
-
} else if (l = l || pn.bitcoin,
|
|
7747
|
+
if (l = l.filter((m) => g === m.wif).pop(), !l) throw new Error("Unknown network version");
|
|
7748
|
+
} else if (l = l || pn.bitcoin, g !== l.wif) throw new Error("Invalid network version");
|
|
7692
7749
|
return r(b.privateKey, {
|
|
7693
7750
|
compressed: b.compressed,
|
|
7694
7751
|
network: l
|
|
@@ -7704,13 +7761,13 @@ function ll(e) {
|
|
|
7704
7761
|
return r(b, u);
|
|
7705
7762
|
}
|
|
7706
7763
|
class f {
|
|
7707
|
-
constructor(l, b,
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
this.__D = l, this.__Q = b, this.lowR = !1,
|
|
7764
|
+
constructor(l, b, g) {
|
|
7765
|
+
_t(this, "__D");
|
|
7766
|
+
_t(this, "__Q");
|
|
7767
|
+
_t(this, "compressed");
|
|
7768
|
+
_t(this, "network");
|
|
7769
|
+
_t(this, "lowR");
|
|
7770
|
+
this.__D = l, this.__Q = b, this.lowR = !1, g === void 0 && (g = {}), this.compressed = g.compressed === void 0 ? !0 : g.compressed, this.network = g.network || pn.bitcoin, b !== void 0 && (this.__Q = Buffer.from(e.pointCompress(b, this.compressed)));
|
|
7714
7771
|
}
|
|
7715
7772
|
get privateKey() {
|
|
7716
7773
|
return this.__D;
|
|
@@ -7734,12 +7791,12 @@ function ll(e) {
|
|
|
7734
7791
|
if (b === void 0 && (b = this.lowR), b === !1)
|
|
7735
7792
|
return Buffer.from(e.sign(l, this.__D));
|
|
7736
7793
|
{
|
|
7737
|
-
let
|
|
7738
|
-
const
|
|
7794
|
+
let g = e.sign(l, this.__D);
|
|
7795
|
+
const m = Buffer.alloc(32, 0);
|
|
7739
7796
|
let v = 0;
|
|
7740
|
-
for (;
|
|
7741
|
-
v++,
|
|
7742
|
-
return Buffer.from(
|
|
7797
|
+
for (; g[0] > 127; )
|
|
7798
|
+
v++, m.writeUIntLE(v, 0, 6), g = e.sign(l, this.__D, m);
|
|
7799
|
+
return Buffer.from(g);
|
|
7743
7800
|
}
|
|
7744
7801
|
}
|
|
7745
7802
|
signSchnorr(l) {
|
|
@@ -7757,21 +7814,21 @@ function ll(e) {
|
|
|
7757
7814
|
return e.verifySchnorr(l, this.publicKey.subarray(1, 33), b);
|
|
7758
7815
|
}
|
|
7759
7816
|
tweakFromPublicKey(l) {
|
|
7760
|
-
const b = cl(this.publicKey),
|
|
7761
|
-
if (!
|
|
7817
|
+
const b = cl(this.publicKey), g = e.xOnlyPointAddTweak(b, l);
|
|
7818
|
+
if (!g || g.xOnlyPubkey === null)
|
|
7762
7819
|
throw new Error("Cannot tweak public key!");
|
|
7763
|
-
const
|
|
7764
|
-
|
|
7820
|
+
const m = Buffer.from([
|
|
7821
|
+
g.parity === 0 ? 2 : 3
|
|
7765
7822
|
]);
|
|
7766
7823
|
return n(
|
|
7767
|
-
Buffer.concat([
|
|
7824
|
+
Buffer.concat([m, g.xOnlyPubkey]),
|
|
7768
7825
|
{ network: this.network, compressed: this.compressed }
|
|
7769
7826
|
);
|
|
7770
7827
|
}
|
|
7771
7828
|
tweakFromPrivateKey(l) {
|
|
7772
|
-
const
|
|
7773
|
-
if (!
|
|
7774
|
-
return r(Buffer.from(
|
|
7829
|
+
const g = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey, m = e.privateAdd(g, l);
|
|
7830
|
+
if (!m) throw new Error("Invalid tweaked private key!");
|
|
7831
|
+
return r(Buffer.from(m), {
|
|
7775
7832
|
network: this.network,
|
|
7776
7833
|
compressed: this.compressed
|
|
7777
7834
|
});
|
|
@@ -7785,10 +7842,10 @@ function ll(e) {
|
|
|
7785
7842
|
makeRandom: a
|
|
7786
7843
|
};
|
|
7787
7844
|
}
|
|
7788
|
-
|
|
7845
|
+
At.ECPairFactory = ll;
|
|
7789
7846
|
(function(e) {
|
|
7790
7847
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.networks = e.ECPairFactory = e.default = void 0;
|
|
7791
|
-
var t =
|
|
7848
|
+
var t = At;
|
|
7792
7849
|
Object.defineProperty(e, "default", {
|
|
7793
7850
|
enumerable: !0,
|
|
7794
7851
|
get: function() {
|
|
@@ -7812,7 +7869,7 @@ class bn {
|
|
|
7812
7869
|
this.privKey = t;
|
|
7813
7870
|
}
|
|
7814
7871
|
static fromPrivKey(t) {
|
|
7815
|
-
return new bn(
|
|
7872
|
+
return new bn(st(t));
|
|
7816
7873
|
}
|
|
7817
7874
|
static async fromWalletClient(t) {
|
|
7818
7875
|
if (!t.account) return N("No account found");
|
|
@@ -7841,7 +7898,7 @@ class bn {
|
|
|
7841
7898
|
Nonce: 1n
|
|
7842
7899
|
}
|
|
7843
7900
|
});
|
|
7844
|
-
return ue(new bn(
|
|
7901
|
+
return ue(new bn(st(ar(r))));
|
|
7845
7902
|
} catch (r) {
|
|
7846
7903
|
return N("Failed to initialize: " + r);
|
|
7847
7904
|
}
|
|
@@ -7850,14 +7907,14 @@ class bn {
|
|
|
7850
7907
|
return this.privKey;
|
|
7851
7908
|
}
|
|
7852
7909
|
generateSecret(t) {
|
|
7853
|
-
const r = this.signMessage(t), n =
|
|
7910
|
+
const r = this.signMessage(t), n = ar(hr(r)), i = ar(n);
|
|
7854
7911
|
return ue({ secret: n, secretHash: i });
|
|
7855
7912
|
}
|
|
7856
7913
|
signMessage(t) {
|
|
7857
|
-
const r = hl(
|
|
7914
|
+
const r = hl(ft), n = "Garden.fi" + t.toString(), i = Buffer.from(n, "utf8"), a = ar(i), f = Buffer.from(st(this.privKey), "hex");
|
|
7858
7915
|
if (f.length !== 32)
|
|
7859
7916
|
throw new Error("Invalid private key length. Expected 32 bytes.");
|
|
7860
|
-
return r.fromPrivateKey(f).sign(Buffer.from(
|
|
7917
|
+
return r.fromPrivateKey(f).sign(Buffer.from(st(a), "hex")).toString("hex");
|
|
7861
7918
|
}
|
|
7862
7919
|
}
|
|
7863
7920
|
class Rl {
|
|
@@ -7870,7 +7927,7 @@ class Rl {
|
|
|
7870
7927
|
order_pair: t,
|
|
7871
7928
|
amount: r.toString(),
|
|
7872
7929
|
exact_out: n.toString()
|
|
7873
|
-
}), a = await
|
|
7930
|
+
}), a = await ot.get(i);
|
|
7874
7931
|
return a.error ? N(a.error) : a.result ? ue(a.result) : N("GetQuote: Unexpected error, result is undefined");
|
|
7875
7932
|
} catch (i) {
|
|
7876
7933
|
return N("GetQuote:", String(i));
|
|
@@ -7878,7 +7935,7 @@ class Rl {
|
|
|
7878
7935
|
}
|
|
7879
7936
|
async getAttestedQuote(t) {
|
|
7880
7937
|
try {
|
|
7881
|
-
const r = await
|
|
7938
|
+
const r = await ot.post(this.quoteUrl.endpoint("/attested").toString(), {
|
|
7882
7939
|
body: JSON.stringify(t),
|
|
7883
7940
|
headers: {
|
|
7884
7941
|
"Content-Type": "application/json"
|
|
@@ -7891,7 +7948,7 @@ class Rl {
|
|
|
7891
7948
|
}
|
|
7892
7949
|
async getStrategies() {
|
|
7893
7950
|
try {
|
|
7894
|
-
const t = await
|
|
7951
|
+
const t = await ot.get(
|
|
7895
7952
|
this.quoteUrl.endpoint("/strategies")
|
|
7896
7953
|
);
|
|
7897
7954
|
if (t.error) return N(t.error);
|
|
@@ -7932,7 +7989,7 @@ export {
|
|
|
7932
7989
|
ef as constructOrderPair,
|
|
7933
7990
|
Qa as evmToViemChainMap,
|
|
7934
7991
|
tf as filterDeadlineExpiredOrders,
|
|
7935
|
-
|
|
7992
|
+
_r as isExpired,
|
|
7936
7993
|
Bl as parseAction,
|
|
7937
7994
|
es as parseActionFromStatus,
|
|
7938
7995
|
vl as switchOrAddNetwork,
|