@babylonlabs-io/ts-sdk 0.32.0 → 0.33.0
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/{PeginManager-DUR1BTKM.js → PeginManager-BMrWtTji.js} +136 -124
- package/dist/PeginManager-BMrWtTji.js.map +1 -0
- package/dist/PeginManager-DUMF84XK.cjs +2 -0
- package/dist/PeginManager-DUMF84XK.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-CIHhUmRv.cjs → buildAndBroadcastRefund-6pR681fI.cjs} +2 -2
- package/dist/buildAndBroadcastRefund-6pR681fI.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-DwrX_IBf.js → buildAndBroadcastRefund-Ba56IKL7.js} +38 -38
- package/dist/buildAndBroadcastRefund-Ba56IKL7.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +74 -70
- package/dist/tbv/core/clients/eth/index.d.ts +1 -1
- package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +13 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +8 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +30 -27
- package/dist/tbv/core/clients/vault-provider/api.d.ts +13 -2
- package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts +11 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts +2 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +16 -0
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts +10 -0
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +5 -2
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts +4 -0
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +11 -0
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -23
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +48 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +8 -12
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +65 -61
- package/dist/tbv/core/managers/index.d.ts +1 -1
- package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts +2 -0
- package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts +2 -2
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/{signAndSubmitPayouts.d.ts → runDepositorPresignFlow.d.ts} +3 -3
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -0
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +11 -11
- package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts +2 -0
- package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts +3 -0
- package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +65 -61
- package/dist/{types-jmEyzzhY.cjs → types-C2IUB0Jd.cjs} +2 -2
- package/dist/types-C2IUB0Jd.cjs.map +1 -0
- package/dist/{types-CnG3JsRs.js → types-D1o_3Q__.js} +20 -9
- package/dist/types-D1o_3Q__.js.map +1 -0
- package/dist/{vault-registry-reader-CG6bea1S.js → vault-registry-reader-BeIEh62N.js} +436 -292
- package/dist/vault-registry-reader-BeIEh62N.js.map +1 -0
- package/dist/vault-registry-reader-DdUgC5IF.cjs +2 -0
- package/dist/vault-registry-reader-DdUgC5IF.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/PeginManager-CTRPJo8m.cjs +0 -2
- package/dist/PeginManager-CTRPJo8m.cjs.map +0 -1
- package/dist/PeginManager-DUR1BTKM.js.map +0 -1
- package/dist/buildAndBroadcastRefund-CIHhUmRv.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-DwrX_IBf.js.map +0 -1
- package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts +0 -2
- package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts.map +0 -1
- package/dist/tbv/core/services/deposit/signAndSubmitPayouts.d.ts.map +0 -1
- package/dist/types-CnG3JsRs.js.map +0 -1
- package/dist/types-jmEyzzhY.cjs.map +0 -1
- package/dist/vault-registry-reader-BBS1_AON.cjs +0 -2
- package/dist/vault-registry-reader-BBS1_AON.cjs.map +0 -1
- package/dist/vault-registry-reader-CG6bea1S.js.map +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (e, t, n) =>
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { isAddressEqual as wt, createPublicClient as
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var oe = (e, t, n) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var m = (e, t, n) => oe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import * as Lt from "bitcoinjs-lib";
|
|
5
|
+
import { Transaction as Nt, Psbt as pt } from "bitcoinjs-lib";
|
|
6
|
+
import { Buffer as K } from "buffer";
|
|
7
|
+
import { a as Vt, b as N, c as A, d as D, e as ot, s as O, f as Wt, H as re, r as V, u as ie, g as mt, h as ae } from "./sha2-6wN58S6R.js";
|
|
8
|
+
import { isAddressEqual as wt, createPublicClient as Z, http as q, encodeFunctionData as bt, zeroAddress as ce } from "viem";
|
|
9
9
|
import { deriveVaultId as yt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
10
10
|
import { b as xt, a as le, d as ue, e as he, f as de } from "./challengeAssert-DSlCIBoT.js";
|
|
11
|
-
import { s as _, u as
|
|
11
|
+
import { s as _, u as z, h as rt, e as I, p as fe, g as Pt, i as ge } from "./bitcoin-0_T6KJON.js";
|
|
12
12
|
import { c as pe } from "./signing-BZigafm0.js";
|
|
13
13
|
import { M as Et } from "./validation-CxqROCno.js";
|
|
14
|
-
import { h as me } from "./buildAndBroadcastRefund-
|
|
15
|
-
import { b as we, f as
|
|
14
|
+
import { h as me } from "./buildAndBroadcastRefund-Ba56IKL7.js";
|
|
15
|
+
import { b as we, f as Y, i as be } from "./psbtInputFields-DPCFHgGd.js";
|
|
16
16
|
import { p as ye, f as xe } from "./fundPeginTransaction-oV-dNJOU.js";
|
|
17
|
-
import { p as Pe, f as Ee } from "./vault-registry-reader-
|
|
18
|
-
import { B as R } from "./types-
|
|
17
|
+
import { p as Pe, f as Ee } from "./vault-registry-reader-BeIEh62N.js";
|
|
18
|
+
import { B as R } from "./types-D1o_3Q__.js";
|
|
19
19
|
const W = /* @__PURE__ */ BigInt(2 ** 32 - 1), Tt = /* @__PURE__ */ BigInt(32);
|
|
20
20
|
function Te(e, t = !1) {
|
|
21
21
|
return t ? { h: Number(e & W), l: Number(e >> Tt & W) } : { h: Number(e >> Tt & W) | 0, l: Number(e & W) | 0 };
|
|
@@ -29,15 +29,15 @@ function ke(e, t = !1) {
|
|
|
29
29
|
}
|
|
30
30
|
return [s, o];
|
|
31
31
|
}
|
|
32
|
-
const _e = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Ie = (e, t, n) => t << n - 32 | e >>> 64 - n,
|
|
32
|
+
const _e = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Ie = (e, t, n) => t << n - 32 | e >>> 64 - n, Be = (e, t, n) => e << n - 32 | t >>> 64 - n, He = 106, Se = 32, kt = 34;
|
|
33
33
|
function Ae(e, t, n) {
|
|
34
|
-
const s = _(e), o =
|
|
34
|
+
const s = _(e), o = Lt.Transaction.fromHex(s);
|
|
35
35
|
if (o.outs.length <= t)
|
|
36
36
|
throw new Error(
|
|
37
37
|
`Pre-PegIn auth-anchor OP_RETURN missing: tx has ${o.outs.length} outputs, expected at least ${t + 1} (vault outputs + OP_RETURN)`
|
|
38
38
|
);
|
|
39
39
|
const r = o.outs[t], i = r.script;
|
|
40
|
-
if (i.length !== kt || i[0] !==
|
|
40
|
+
if (i.length !== kt || i[0] !== He || i[1] !== Se)
|
|
41
41
|
throw new Error(
|
|
42
42
|
`Pre-PegIn auth-anchor OP_RETURN at vout ${t} has unexpected script encoding (got ${i.length}-byte script with prefix 0x${i.slice(0, Math.min(2, i.length)).toString("hex")}; expected ${kt}-byte OP_RETURN + PUSH32 layout)`
|
|
43
43
|
);
|
|
@@ -51,7 +51,7 @@ function Ae(e, t, n) {
|
|
|
51
51
|
`Pre-PegIn auth-anchor OP_RETURN at vout ${t} has non-zero value ${r.value}; OP_RETURN outputs must be 0-value`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class Mt {
|
|
55
55
|
constructor(t, n) {
|
|
56
56
|
m(this, "oHash");
|
|
57
57
|
m(this, "iHash");
|
|
@@ -59,7 +59,7 @@ class Wt {
|
|
|
59
59
|
m(this, "outputLen");
|
|
60
60
|
m(this, "finished", !1);
|
|
61
61
|
m(this, "destroyed", !1);
|
|
62
|
-
if (
|
|
62
|
+
if (Vt(t), N(n, void 0, "key"), this.iHash = t.create(), typeof this.iHash.update != "function")
|
|
63
63
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
64
64
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
65
65
|
const s = this.blockLen, o = new Uint8Array(s);
|
|
@@ -72,10 +72,10 @@ class Wt {
|
|
|
72
72
|
this.oHash.update(o), A(o);
|
|
73
73
|
}
|
|
74
74
|
update(t) {
|
|
75
|
-
return
|
|
75
|
+
return D(this), this.iHash.update(t), this;
|
|
76
76
|
}
|
|
77
77
|
digestInto(t) {
|
|
78
|
-
|
|
78
|
+
D(this), N(t, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
|
|
79
79
|
}
|
|
80
80
|
digest() {
|
|
81
81
|
const t = new Uint8Array(this.oHash.outputLen);
|
|
@@ -93,23 +93,23 @@ class Wt {
|
|
|
93
93
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
96
|
+
const Ft = (e, t, n) => new Mt(e, t).update(n).digest();
|
|
97
|
+
Ft.create = (e, t) => new Mt(e, t);
|
|
98
|
+
const Q = /* @__PURE__ */ Uint8Array.of(0), _t = /* @__PURE__ */ Uint8Array.of();
|
|
99
99
|
function lt(e, t, n, s = 32) {
|
|
100
|
-
|
|
100
|
+
Vt(e), ot(s, "length");
|
|
101
101
|
const o = e.outputLen;
|
|
102
102
|
if (s > 255 * o)
|
|
103
103
|
throw new Error("Length must be <= 255*HashLen");
|
|
104
104
|
const r = Math.ceil(s / o);
|
|
105
105
|
n === void 0 ? n = _t : N(n, void 0, "info");
|
|
106
|
-
const i = new Uint8Array(r * o), a =
|
|
106
|
+
const i = new Uint8Array(r * o), a = Ft.create(e, t), l = a._cloneInto(), u = new Uint8Array(a.outputLen);
|
|
107
107
|
for (let c = 0; c < r; c++)
|
|
108
|
-
|
|
109
|
-
return a.destroy(), l.destroy(), A(u,
|
|
108
|
+
Q[0] = c + 1, l.update(c === 0 ? _t : u).update(n).update(Q).digestInto(u), i.set(u, o * c), a._cloneInto(l);
|
|
109
|
+
return a.destroy(), l.destroy(), A(u, Q), i.slice(0, s);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
function
|
|
111
|
+
const J = new TextEncoder().encode("babylonvault"), vt = 255, It = 65535, Bt = 2, Ce = "hashlock", Oe = "auth-anchor", Re = "wots-seed";
|
|
112
|
+
function Xt(e) {
|
|
113
113
|
if (!Number.isInteger(e) || e < 0 || e > 4294967295)
|
|
114
114
|
throw new Error(`i2osp4: value must be a u32, got ${e}`);
|
|
115
115
|
const t = new Uint8Array(4);
|
|
@@ -125,15 +125,15 @@ function ut(e, t = new Uint8Array(0)) {
|
|
|
125
125
|
throw new Error(
|
|
126
126
|
`info: ctx length must be in [0, ${It}], got ${t.length}`
|
|
127
127
|
);
|
|
128
|
-
const s =
|
|
128
|
+
const s = J.length + 1 + n.length + Bt + t.length, o = new Uint8Array(s);
|
|
129
129
|
let r = 0;
|
|
130
|
-
return o.set(
|
|
130
|
+
return o.set(J, r), r += J.length, o[r] = n.length, r += 1, o.set(n, r), r += n.length, o[r] = t.length >>> 8 & 255, o[r + 1] = t.length & 255, r += Bt, o.set(t, r), o;
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Ht = 32, $e = 32, Ue = 32, Le = 64;
|
|
133
133
|
function ht(e) {
|
|
134
|
-
if (e.length !==
|
|
134
|
+
if (e.length !== Ht)
|
|
135
135
|
throw new Error(
|
|
136
|
-
`vault-secrets: root must be exactly ${
|
|
136
|
+
`vault-secrets: root must be exactly ${Ht} bytes, got ${e.length}`
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
139
|
function Ne(e) {
|
|
@@ -148,7 +148,7 @@ function Ve(e, t) {
|
|
|
148
148
|
return ht(e), lt(
|
|
149
149
|
O,
|
|
150
150
|
e,
|
|
151
|
-
ut(Ce,
|
|
151
|
+
ut(Ce, Xt(t)),
|
|
152
152
|
Ue
|
|
153
153
|
);
|
|
154
154
|
}
|
|
@@ -156,23 +156,23 @@ function We(e, t) {
|
|
|
156
156
|
return ht(e), lt(
|
|
157
157
|
O,
|
|
158
158
|
e,
|
|
159
|
-
ut(Re,
|
|
159
|
+
ut(Re, Xt(t)),
|
|
160
160
|
Le
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
|
-
const L = 32,
|
|
163
|
+
const L = 32, tt = 32, it = 36, Kt = 32, j = 4, Me = j + L + j + Kt;
|
|
164
164
|
function at(e, t, n) {
|
|
165
165
|
e[t] = n >>> 24 & 255, e[t + 1] = n >>> 16 & 255, e[t + 2] = n >>> 8 & 255, e[t + 3] = n & 255;
|
|
166
166
|
}
|
|
167
167
|
function Fe(e) {
|
|
168
|
-
if (e.txid.length !==
|
|
168
|
+
if (e.txid.length !== tt)
|
|
169
169
|
throw new Error(
|
|
170
|
-
`outpoint.txid must be exactly ${
|
|
170
|
+
`outpoint.txid must be exactly ${tt} bytes, got ${e.txid.length}`
|
|
171
171
|
);
|
|
172
172
|
if (!Number.isInteger(e.vout) || e.vout < 0 || e.vout > 4294967295)
|
|
173
173
|
throw new Error(`outpoint.vout must be a u32, got ${e.vout}`);
|
|
174
174
|
const t = new Uint8Array(it);
|
|
175
|
-
return t.set(e.txid, 0), at(t,
|
|
175
|
+
return t.set(e.txid, 0), at(t, tt, e.vout), t;
|
|
176
176
|
}
|
|
177
177
|
function St(e, t) {
|
|
178
178
|
const n = Math.min(e.length, t.length);
|
|
@@ -204,18 +204,18 @@ function Ke(e) {
|
|
|
204
204
|
);
|
|
205
205
|
const t = Xe(e.fundingOutpoints), n = new Uint8Array(Me);
|
|
206
206
|
let s = 0;
|
|
207
|
-
return at(n, s, L), s +=
|
|
207
|
+
return at(n, s, L), s += j, n.set(e.depositorBtcPubkey, s), s += L, at(n, s, Kt), s += j, n.set(t, s), n;
|
|
208
208
|
}
|
|
209
|
-
const De = "babylon-vault",
|
|
209
|
+
const De = "babylon-vault", Dt = 32, At = Dt * 2, ze = /^[0-9a-f]+$/;
|
|
210
210
|
async function je(e, t) {
|
|
211
|
-
const n = Ke(t), s =
|
|
211
|
+
const n = Ke(t), s = z(n), o = await e.deriveContextHash(De, s);
|
|
212
212
|
if (typeof o != "string")
|
|
213
213
|
throw new Error(
|
|
214
214
|
`deriveVaultRoot: wallet must return a string, got ${typeof o}`
|
|
215
215
|
);
|
|
216
216
|
if (o.length !== At)
|
|
217
217
|
throw new Error(
|
|
218
|
-
`deriveVaultRoot: wallet must return a ${At}-character hex string (${
|
|
218
|
+
`deriveVaultRoot: wallet must return a ${At}-character hex string (${Dt} bytes), got length ${o.length}`
|
|
219
219
|
);
|
|
220
220
|
if (!ze.test(o))
|
|
221
221
|
throw new Error(
|
|
@@ -223,6 +223,17 @@ async function je(e, t) {
|
|
|
223
223
|
);
|
|
224
224
|
return rt(o);
|
|
225
225
|
}
|
|
226
|
+
function Kn(e) {
|
|
227
|
+
if (!e)
|
|
228
|
+
throw new Error("Pre-pegin transaction hex is empty");
|
|
229
|
+
const t = e.startsWith("0x") ? e.slice(2) : e, n = Nt.fromHex(t);
|
|
230
|
+
if (n.ins.length === 0)
|
|
231
|
+
throw new Error("Pre-pegin transaction has no inputs");
|
|
232
|
+
return n.ins.map((s) => ({
|
|
233
|
+
txid: Uint8Array.from(K.from(s.hash).reverse()),
|
|
234
|
+
vout: s.index
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
226
237
|
const Ge = /* @__PURE__ */ Uint8Array.from([
|
|
227
238
|
7,
|
|
228
239
|
4,
|
|
@@ -240,19 +251,19 @@ const Ge = /* @__PURE__ */ Uint8Array.from([
|
|
|
240
251
|
14,
|
|
241
252
|
11,
|
|
242
253
|
8
|
|
243
|
-
]),
|
|
244
|
-
const n = [[
|
|
254
|
+
]), zt = Uint8Array.from(new Array(16).fill(0).map((e, t) => t)), Ze = zt.map((e) => (9 * e + 5) % 16), jt = /* @__PURE__ */ (() => {
|
|
255
|
+
const n = [[zt], [Ze]];
|
|
245
256
|
for (let s = 0; s < 4; s++)
|
|
246
257
|
for (let o of n)
|
|
247
258
|
o.push(o[s].map((r) => Ge[r]));
|
|
248
259
|
return n;
|
|
249
|
-
})(),
|
|
260
|
+
})(), Gt = jt[0], Zt = jt[1], qt = /* @__PURE__ */ [
|
|
250
261
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
251
262
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
252
263
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
253
264
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
254
265
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
255
|
-
].map((e) => Uint8Array.from(e)), qe = /* @__PURE__ */
|
|
266
|
+
].map((e) => Uint8Array.from(e)), qe = /* @__PURE__ */ Gt.map((e, t) => e.map((n) => qt[t][n])), Ye = /* @__PURE__ */ Zt.map((e, t) => e.map((n) => qt[t][n])), Qe = /* @__PURE__ */ Uint32Array.from([
|
|
256
267
|
0,
|
|
257
268
|
1518500249,
|
|
258
269
|
1859775393,
|
|
@@ -269,7 +280,7 @@ function Ct(e, t, n, s) {
|
|
|
269
280
|
return e === 0 ? t ^ n ^ s : e === 1 ? t & n | ~t & s : e === 2 ? (t | ~n) ^ s : e === 3 ? t & s | n & ~s : t ^ (n | ~s);
|
|
270
281
|
}
|
|
271
282
|
const M = /* @__PURE__ */ new Uint32Array(16);
|
|
272
|
-
class tn extends
|
|
283
|
+
class tn extends re {
|
|
273
284
|
constructor() {
|
|
274
285
|
super(64, 20, 8, !0);
|
|
275
286
|
m(this, "h0", 1732584193);
|
|
@@ -290,13 +301,13 @@ class tn extends oe {
|
|
|
290
301
|
M[h] = n.getUint32(s, !0);
|
|
291
302
|
let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, l = this.h2 | 0, u = l, c = this.h3 | 0, w = c, b = this.h4 | 0, y = b;
|
|
292
303
|
for (let h = 0; h < 5; h++) {
|
|
293
|
-
const f = 4 - h, T = Qe[h],
|
|
304
|
+
const f = 4 - h, T = Qe[h], B = Je[h], d = Gt[h], P = Zt[h], g = qe[h], E = Ye[h];
|
|
294
305
|
for (let x = 0; x < 16; x++) {
|
|
295
306
|
const p = V(o + Ct(h, i, l, c) + M[d[x]] + T, g[x]) + b | 0;
|
|
296
307
|
o = b, b = c, c = V(l, 10) | 0, l = i, i = p;
|
|
297
308
|
}
|
|
298
309
|
for (let x = 0; x < 16; x++) {
|
|
299
|
-
const p = V(r + Ct(f, a, u, w) + M[P[x]] +
|
|
310
|
+
const p = V(r + Ct(f, a, u, w) + M[P[x]] + B, E[x]) + y | 0;
|
|
300
311
|
r = y, y = w, w = V(u, 10) | 0, u = a, a = p;
|
|
301
312
|
}
|
|
302
313
|
}
|
|
@@ -309,15 +320,15 @@ class tn extends oe {
|
|
|
309
320
|
this.destroyed = !0, A(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
310
321
|
}
|
|
311
322
|
}
|
|
312
|
-
const en = /* @__PURE__ */
|
|
323
|
+
const en = /* @__PURE__ */ Wt(() => new tn()), nn = BigInt(0), $ = BigInt(1), sn = BigInt(2), on = BigInt(7), rn = BigInt(256), an = BigInt(113), Yt = [], Qt = [], Jt = [];
|
|
313
324
|
for (let e = 0, t = $, n = 1, s = 0; e < 24; e++) {
|
|
314
|
-
[n, s] = [s, (2 * n + 3 * s) % 5],
|
|
325
|
+
[n, s] = [s, (2 * n + 3 * s) % 5], Yt.push(2 * (5 * s + n)), Qt.push((e + 1) * (e + 2) / 2 % 64);
|
|
315
326
|
let o = nn;
|
|
316
327
|
for (let r = 0; r < 7; r++)
|
|
317
328
|
t = (t << $ ^ (t >> on) * an) % rn, t & sn && (o ^= $ << ($ << BigInt(r)) - $);
|
|
318
|
-
|
|
329
|
+
Jt.push(o);
|
|
319
330
|
}
|
|
320
|
-
const
|
|
331
|
+
const te = ke(Jt, !0), cn = te[0], ln = te[1], Ot = (e, t, n) => n > 32 ? Ie(e, t, n) : _e(e, t, n), Rt = (e, t, n) => n > 32 ? Be(e, t, n) : ve(e, t, n);
|
|
321
332
|
function un(e, t = 24) {
|
|
322
333
|
const n = new Uint32Array(10);
|
|
323
334
|
for (let s = 24 - t; s < 24; s++) {
|
|
@@ -330,7 +341,7 @@ function un(e, t = 24) {
|
|
|
330
341
|
}
|
|
331
342
|
let o = e[2], r = e[3];
|
|
332
343
|
for (let i = 0; i < 24; i++) {
|
|
333
|
-
const a =
|
|
344
|
+
const a = Qt[i], l = Ot(o, r, a), u = Rt(o, r, a), c = Yt[i];
|
|
334
345
|
o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
|
|
335
346
|
}
|
|
336
347
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -357,18 +368,18 @@ class dt {
|
|
|
357
368
|
m(this, "outputLen");
|
|
358
369
|
m(this, "enableXOF", !1);
|
|
359
370
|
m(this, "rounds");
|
|
360
|
-
if (this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r,
|
|
371
|
+
if (this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, ot(s, "outputLen"), !(0 < t && t < 200))
|
|
361
372
|
throw new Error("only keccak-f1600 function is supported");
|
|
362
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
373
|
+
this.state = new Uint8Array(200), this.state32 = ie(this.state);
|
|
363
374
|
}
|
|
364
375
|
clone() {
|
|
365
376
|
return this._cloneInto();
|
|
366
377
|
}
|
|
367
378
|
keccak() {
|
|
368
|
-
|
|
379
|
+
mt(this.state32), un(this.state32, this.rounds), mt(this.state32), this.posOut = 0, this.pos = 0;
|
|
369
380
|
}
|
|
370
381
|
update(t) {
|
|
371
|
-
|
|
382
|
+
D(this), N(t);
|
|
372
383
|
const { blockLen: n, state: s } = this, o = t.length;
|
|
373
384
|
for (let r = 0; r < o; ) {
|
|
374
385
|
const i = Math.min(n - this.pos, o - r);
|
|
@@ -386,7 +397,7 @@ class dt {
|
|
|
386
397
|
t[s] ^= n, (n & 128) !== 0 && s === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
|
|
387
398
|
}
|
|
388
399
|
writeInto(t) {
|
|
389
|
-
|
|
400
|
+
D(this, !1), N(t), this.finish();
|
|
390
401
|
const n = this.state, { blockLen: s } = this;
|
|
391
402
|
for (let o = 0, r = t.length; o < r; ) {
|
|
392
403
|
this.posOut >= s && this.keccak();
|
|
@@ -401,10 +412,10 @@ class dt {
|
|
|
401
412
|
return this.writeInto(t);
|
|
402
413
|
}
|
|
403
414
|
xof(t) {
|
|
404
|
-
return
|
|
415
|
+
return ot(t), this.xofInto(new Uint8Array(t));
|
|
405
416
|
}
|
|
406
417
|
digestInto(t) {
|
|
407
|
-
if (
|
|
418
|
+
if (ae(t, this), this.finished)
|
|
408
419
|
throw new Error("digest() was already called");
|
|
409
420
|
return this.writeInto(t), this.destroy(), t;
|
|
410
421
|
}
|
|
@@ -419,11 +430,11 @@ class dt {
|
|
|
419
430
|
return t || (t = new dt(n, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
|
|
420
431
|
}
|
|
421
432
|
}
|
|
422
|
-
const hn = (e, t, n, s = {}) =>
|
|
433
|
+
const hn = (e, t, n, s = {}) => Wt(() => new dt(t, e, n), s), dn = /* @__PURE__ */ hn(1, 136, 32), $t = 64, v = 20, ct = 4, ee = 2, fn = 0, gn = 1, F = [64, 64], pn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
423
434
|
function ft(e) {
|
|
424
435
|
return en(O(e));
|
|
425
436
|
}
|
|
426
|
-
function
|
|
437
|
+
function ne(e) {
|
|
427
438
|
return (1 << e) - 1;
|
|
428
439
|
}
|
|
429
440
|
function mn(e) {
|
|
@@ -432,10 +443,10 @@ function mn(e) {
|
|
|
432
443
|
return Math.max(t, 2);
|
|
433
444
|
}
|
|
434
445
|
function wn(e) {
|
|
435
|
-
const t = ct, n = e *
|
|
446
|
+
const t = ct, n = e * ne(t);
|
|
436
447
|
return { d: t, n: e, checksum_radix: mn(n) };
|
|
437
448
|
}
|
|
438
|
-
function
|
|
449
|
+
function et(e, t) {
|
|
439
450
|
const n = [];
|
|
440
451
|
let s = t;
|
|
441
452
|
for (; s > 0; )
|
|
@@ -446,28 +457,28 @@ function tt(e, t) {
|
|
|
446
457
|
o[e.length + r] = n[r];
|
|
447
458
|
return ft(o);
|
|
448
459
|
}
|
|
449
|
-
function
|
|
460
|
+
function nt(e, t) {
|
|
450
461
|
let n = e;
|
|
451
462
|
for (let s = 0; s < t; s++)
|
|
452
463
|
n = ft(n);
|
|
453
464
|
return n;
|
|
454
465
|
}
|
|
455
466
|
function bn(e, t) {
|
|
456
|
-
const n =
|
|
467
|
+
const n = ne(t.d), s = t.checksum_radix - 1, o = Math.floor(t.n * n / t.checksum_radix), r = [];
|
|
457
468
|
for (let c = 0; c < t.n; c++) {
|
|
458
|
-
const w =
|
|
469
|
+
const w = et(e, c + ee), b = nt(w, n);
|
|
459
470
|
r.push(Array.from(b));
|
|
460
471
|
}
|
|
461
|
-
const i =
|
|
472
|
+
const i = et(
|
|
462
473
|
e,
|
|
463
474
|
fn
|
|
464
|
-
), a =
|
|
475
|
+
), a = nt(
|
|
465
476
|
i,
|
|
466
477
|
s
|
|
467
|
-
), l =
|
|
478
|
+
), l = et(
|
|
468
479
|
e,
|
|
469
480
|
gn
|
|
470
|
-
), u =
|
|
481
|
+
), u = nt(
|
|
471
482
|
l,
|
|
472
483
|
o
|
|
473
484
|
);
|
|
@@ -530,7 +541,7 @@ async function yn(e) {
|
|
|
530
541
|
e.fill(0);
|
|
531
542
|
}
|
|
532
543
|
}
|
|
533
|
-
function
|
|
544
|
+
function st(e, t, n) {
|
|
534
545
|
if (e.length !== v)
|
|
535
546
|
throw new Error(
|
|
536
547
|
`Block ${t} ${n}: expected ${v} bytes, got ${e.length}`
|
|
@@ -548,13 +559,13 @@ function xn(e) {
|
|
|
548
559
|
throw new Error("Public keys array must not be empty");
|
|
549
560
|
for (let r = 0; r < e.length; r++) {
|
|
550
561
|
const i = e[r];
|
|
551
|
-
|
|
562
|
+
st(i.checksum_minor_terminal, r, "checksum_minor_terminal"), st(i.checksum_major_terminal, r, "checksum_major_terminal");
|
|
552
563
|
for (let a = 0; a < i.message_terminals.length; a++)
|
|
553
|
-
|
|
564
|
+
st(i.message_terminals[a], r, `message_terminal[${a}]`);
|
|
554
565
|
}
|
|
555
566
|
let t = 0;
|
|
556
567
|
for (const r of e)
|
|
557
|
-
t +=
|
|
568
|
+
t += ee + r.message_terminals.length;
|
|
558
569
|
const n = new Uint8Array(t * v);
|
|
559
570
|
let s = 0;
|
|
560
571
|
for (const r of e) {
|
|
@@ -565,7 +576,7 @@ function xn(e) {
|
|
|
565
576
|
const o = dn(n);
|
|
566
577
|
return `0x${pn(o)}`;
|
|
567
578
|
}
|
|
568
|
-
function
|
|
579
|
+
function Dn(e) {
|
|
569
580
|
const t = (e instanceof Error ? e.message : typeof e == "string" ? e : "").toLowerCase();
|
|
570
581
|
return t.includes("wots") && t.includes("hash") && t.includes("does not match");
|
|
571
582
|
}
|
|
@@ -582,7 +593,7 @@ async function Pn(e, t) {
|
|
|
582
593
|
}
|
|
583
594
|
const l = Ve(e, i);
|
|
584
595
|
try {
|
|
585
|
-
const u =
|
|
596
|
+
const u = z(l);
|
|
586
597
|
o.push(u), r.push(me(I(u)).slice(2));
|
|
587
598
|
} finally {
|
|
588
599
|
l.fill(0);
|
|
@@ -614,7 +625,7 @@ function _n(e) {
|
|
|
614
625
|
}
|
|
615
626
|
if (!kn.test(e) || e.length % 4 !== 0)
|
|
616
627
|
throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
|
|
617
|
-
const t =
|
|
628
|
+
const t = K.from(e, "base64");
|
|
618
629
|
if (t.length === 0 || t.toString("base64") !== e)
|
|
619
630
|
throw new Error("BTC wallet returned malformed base64 BIP-322 signature");
|
|
620
631
|
return `0x${t.toString("hex")}`;
|
|
@@ -688,14 +699,14 @@ function gt(e) {
|
|
|
688
699
|
if (i)
|
|
689
700
|
return i[1];
|
|
690
701
|
}
|
|
691
|
-
function
|
|
702
|
+
function zn(e) {
|
|
692
703
|
const t = gt(e);
|
|
693
704
|
if (t) {
|
|
694
705
|
const n = t.substring(0, 10);
|
|
695
706
|
return C[t] ?? C[n];
|
|
696
707
|
}
|
|
697
708
|
}
|
|
698
|
-
function
|
|
709
|
+
function jn(e) {
|
|
699
710
|
const t = gt(e);
|
|
700
711
|
if (t === void 0) return !1;
|
|
701
712
|
const n = t.substring(0, 10);
|
|
@@ -724,7 +735,7 @@ function S(e) {
|
|
|
724
735
|
throw e instanceof Error ? (console.error("[Contract Error] Unhandled error:", e.message), e) : new Error(`Contract call failed: ${String(e)}`);
|
|
725
736
|
}
|
|
726
737
|
const In = 0, X = "00".repeat(32);
|
|
727
|
-
function
|
|
738
|
+
function Bn(e, t, n, s) {
|
|
728
739
|
const o = n == null ? void 0 : n[`${e}:${t}`];
|
|
729
740
|
return o ? Promise.resolve({
|
|
730
741
|
txid: e,
|
|
@@ -734,7 +745,7 @@ function Hn(e, t, n, s) {
|
|
|
734
745
|
}) : Ee(e, t, s);
|
|
735
746
|
}
|
|
736
747
|
const Ut = 12e4;
|
|
737
|
-
class
|
|
748
|
+
class Gn {
|
|
738
749
|
/**
|
|
739
750
|
* Creates a new PeginManager instance.
|
|
740
751
|
*
|
|
@@ -769,7 +780,7 @@ class jn {
|
|
|
769
780
|
try {
|
|
770
781
|
const f = Ne(i);
|
|
771
782
|
try {
|
|
772
|
-
a =
|
|
783
|
+
a = z(f), l = z(O(f));
|
|
773
784
|
} finally {
|
|
774
785
|
f.fill(0);
|
|
775
786
|
}
|
|
@@ -896,14 +907,14 @@ class jn {
|
|
|
896
907
|
changeAddress: a.changeAddress,
|
|
897
908
|
changeAmount: i.changeAmount,
|
|
898
909
|
network: f
|
|
899
|
-
}),
|
|
910
|
+
}), B = _(Y(T)), d = [], P = [], g = [];
|
|
900
911
|
for (let p = 0; p < o.length; p++) {
|
|
901
912
|
const k = await le({
|
|
902
913
|
prePeginParams: y,
|
|
903
914
|
timelockPegin: a.timelockPegin,
|
|
904
915
|
fundedPrePeginTxHex: T,
|
|
905
916
|
htlcVout: p
|
|
906
|
-
}),
|
|
917
|
+
}), H = await ue({
|
|
907
918
|
peginTxHex: k.txHex,
|
|
908
919
|
fundedPrePeginTxHex: T,
|
|
909
920
|
depositorPubkey: s,
|
|
@@ -914,7 +925,7 @@ class jn {
|
|
|
914
925
|
timelockRefund: a.timelockRefund,
|
|
915
926
|
network: this.config.btcNetwork
|
|
916
927
|
});
|
|
917
|
-
d.push(k), P.push(
|
|
928
|
+
d.push(k), P.push(H.psbtHex), g.push(
|
|
918
929
|
pe(n, 1)
|
|
919
930
|
);
|
|
920
931
|
}
|
|
@@ -927,11 +938,11 @@ class jn {
|
|
|
927
938
|
const k = he(
|
|
928
939
|
E[p],
|
|
929
940
|
s
|
|
930
|
-
),
|
|
941
|
+
), H = de(E[p]);
|
|
931
942
|
x.push({
|
|
932
943
|
htlcVout: p,
|
|
933
944
|
htlcValue: h.htlcValues[p],
|
|
934
|
-
peginTxHex:
|
|
945
|
+
peginTxHex: H,
|
|
935
946
|
peginTxid: d[p].txid,
|
|
936
947
|
peginInputSignature: k,
|
|
937
948
|
vaultScriptPubKey: d[p].vaultScriptPubKey
|
|
@@ -939,7 +950,7 @@ class jn {
|
|
|
939
950
|
}
|
|
940
951
|
return {
|
|
941
952
|
fundedPrePeginTxHex: T,
|
|
942
|
-
prePeginTxid:
|
|
953
|
+
prePeginTxid: B,
|
|
943
954
|
perVault: x
|
|
944
955
|
};
|
|
945
956
|
}
|
|
@@ -959,17 +970,17 @@ class jn {
|
|
|
959
970
|
* @throws Error if signing or broadcasting fails
|
|
960
971
|
*/
|
|
961
972
|
async signAndBroadcast(t) {
|
|
962
|
-
const { fundedPrePeginTxHex: n, depositorBtcPubkey: s } = t, o = n.startsWith("0x") ? n.slice(2) : n, r =
|
|
973
|
+
const { fundedPrePeginTxHex: n, depositorBtcPubkey: s } = t, o = n.startsWith("0x") ? n.slice(2) : n, r = Nt.fromHex(o);
|
|
963
974
|
if (r.ins.length === 0)
|
|
964
975
|
throw new Error("Transaction has no inputs");
|
|
965
|
-
const i = new
|
|
976
|
+
const i = new pt();
|
|
966
977
|
i.setVersion(r.version), i.setLocktime(r.locktime);
|
|
967
|
-
const a =
|
|
978
|
+
const a = K.from(
|
|
968
979
|
U(s),
|
|
969
980
|
"hex"
|
|
970
981
|
), l = this.config.mempoolApiUrl, u = r.ins.map((d) => {
|
|
971
|
-
const P =
|
|
972
|
-
return
|
|
982
|
+
const P = K.from(d.hash).reverse().toString("hex"), g = d.index;
|
|
983
|
+
return Bn(P, g, t.localPrevouts, l).then(
|
|
973
984
|
(E) => ({ input: d, utxoData: E, txid: P, vout: g })
|
|
974
985
|
);
|
|
975
986
|
}), c = await Promise.all(u), w = c.reduce(
|
|
@@ -1008,7 +1019,7 @@ class jn {
|
|
|
1008
1019
|
script: d.script,
|
|
1009
1020
|
value: d.value
|
|
1010
1021
|
});
|
|
1011
|
-
const h = await this.config.btcWallet.signPsbt(i.toHex()), f =
|
|
1022
|
+
const h = await this.config.btcWallet.signPsbt(i.toHex()), f = pt.fromHex(h);
|
|
1012
1023
|
try {
|
|
1013
1024
|
f.finalizeAllInputs();
|
|
1014
1025
|
} catch (d) {
|
|
@@ -1067,17 +1078,17 @@ class jn {
|
|
|
1067
1078
|
await this.assertPopMatchesBtcWallet(u);
|
|
1068
1079
|
const w = u.btcPopSignature, b = I(u.depositorBtcPubkey), y = I(n), h = I(s), f = await this.resolvePayoutScriptPubKey(
|
|
1069
1080
|
a
|
|
1070
|
-
), T =
|
|
1081
|
+
), T = Y(h), B = await yt(
|
|
1071
1082
|
_(T),
|
|
1072
1083
|
_(c)
|
|
1073
|
-
), d = I(
|
|
1084
|
+
), d = I(B);
|
|
1074
1085
|
if (await this.checkVaultExists(d))
|
|
1075
1086
|
throw new Error(
|
|
1076
1087
|
`Vault already exists (ID: ${d}, peginTxHash: ${T}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
|
|
1077
1088
|
);
|
|
1078
|
-
const g =
|
|
1089
|
+
const g = Z({
|
|
1079
1090
|
chain: this.config.ethChain,
|
|
1080
|
-
transport:
|
|
1091
|
+
transport: q()
|
|
1081
1092
|
});
|
|
1082
1093
|
let E;
|
|
1083
1094
|
try {
|
|
@@ -1116,8 +1127,8 @@ class jn {
|
|
|
1116
1127
|
value: E,
|
|
1117
1128
|
account: this.config.ethWallet.account.address
|
|
1118
1129
|
});
|
|
1119
|
-
} catch (
|
|
1120
|
-
S(
|
|
1130
|
+
} catch (G) {
|
|
1131
|
+
S(G);
|
|
1121
1132
|
}
|
|
1122
1133
|
let k;
|
|
1123
1134
|
try {
|
|
@@ -1129,19 +1140,19 @@ class jn {
|
|
|
1129
1140
|
chain: this.config.ethChain,
|
|
1130
1141
|
gas: p
|
|
1131
1142
|
});
|
|
1132
|
-
} catch (
|
|
1133
|
-
S(
|
|
1143
|
+
} catch (G) {
|
|
1144
|
+
S(G);
|
|
1134
1145
|
}
|
|
1135
|
-
const
|
|
1146
|
+
const H = await g.waitForTransactionReceipt({
|
|
1136
1147
|
hash: k,
|
|
1137
1148
|
timeout: Ut
|
|
1138
1149
|
});
|
|
1139
|
-
return
|
|
1150
|
+
return H.status === "reverted" && S(
|
|
1140
1151
|
new Error(
|
|
1141
1152
|
`Transaction reverted. Hash: ${k}. Check the transaction on block explorer for details.`
|
|
1142
1153
|
)
|
|
1143
1154
|
), {
|
|
1144
|
-
ethTxHash:
|
|
1155
|
+
ethTxHash: H.transactionHash,
|
|
1145
1156
|
vaultId: d,
|
|
1146
1157
|
peginTxHash: T
|
|
1147
1158
|
};
|
|
@@ -1177,7 +1188,7 @@ class jn {
|
|
|
1177
1188
|
for (const g of o) {
|
|
1178
1189
|
const E = I(
|
|
1179
1190
|
g.depositorSignedPeginTx
|
|
1180
|
-
), x =
|
|
1191
|
+
), x = Y(E), p = await yt(
|
|
1181
1192
|
_(x),
|
|
1182
1193
|
_(i)
|
|
1183
1194
|
), k = I(p);
|
|
@@ -1187,9 +1198,9 @@ class jn {
|
|
|
1187
1198
|
);
|
|
1188
1199
|
u.push({ vaultId: k, peginTxHash: x });
|
|
1189
1200
|
}
|
|
1190
|
-
const c =
|
|
1201
|
+
const c = Z({
|
|
1191
1202
|
chain: this.config.ethChain,
|
|
1192
|
-
transport:
|
|
1203
|
+
transport: q()
|
|
1193
1204
|
});
|
|
1194
1205
|
let w;
|
|
1195
1206
|
try {
|
|
@@ -1223,9 +1234,9 @@ class jn {
|
|
|
1223
1234
|
functionName: "submitPeginRequestBatch",
|
|
1224
1235
|
args: [i, n, f]
|
|
1225
1236
|
});
|
|
1226
|
-
let
|
|
1237
|
+
let B;
|
|
1227
1238
|
try {
|
|
1228
|
-
|
|
1239
|
+
B = await c.estimateGas({
|
|
1229
1240
|
to: this.config.vaultContracts.btcVaultRegistry,
|
|
1230
1241
|
data: T,
|
|
1231
1242
|
value: b,
|
|
@@ -1242,7 +1253,7 @@ class jn {
|
|
|
1242
1253
|
value: b,
|
|
1243
1254
|
account: this.config.ethWallet.account,
|
|
1244
1255
|
chain: this.config.ethChain,
|
|
1245
|
-
gas:
|
|
1256
|
+
gas: B
|
|
1246
1257
|
});
|
|
1247
1258
|
} catch (g) {
|
|
1248
1259
|
S(g);
|
|
@@ -1268,9 +1279,9 @@ class jn {
|
|
|
1268
1279
|
*/
|
|
1269
1280
|
async checkVaultExists(t) {
|
|
1270
1281
|
try {
|
|
1271
|
-
return (await
|
|
1282
|
+
return (await Z({
|
|
1272
1283
|
chain: this.config.ethChain,
|
|
1273
|
-
transport:
|
|
1284
|
+
transport: q()
|
|
1274
1285
|
}).readContract({
|
|
1275
1286
|
address: this.config.vaultContracts.btcVaultRegistry,
|
|
1276
1287
|
abi: R,
|
|
@@ -1306,7 +1317,7 @@ class jn {
|
|
|
1306
1317
|
}
|
|
1307
1318
|
const s = Pt(this.config.btcNetwork);
|
|
1308
1319
|
try {
|
|
1309
|
-
return `0x${
|
|
1320
|
+
return `0x${Lt.address.toOutputScript(n, s).toString("hex")}`;
|
|
1310
1321
|
} catch {
|
|
1311
1322
|
throw new Error(
|
|
1312
1323
|
`Invalid BTC payout address: "${n}". Please provide a valid Bitcoin address for the ${this.config.btcNetwork} network.`
|
|
@@ -1362,20 +1373,21 @@ class jn {
|
|
|
1362
1373
|
}
|
|
1363
1374
|
export {
|
|
1364
1375
|
C,
|
|
1365
|
-
|
|
1376
|
+
Gn as P,
|
|
1366
1377
|
De as V,
|
|
1367
|
-
|
|
1378
|
+
Dn as a,
|
|
1368
1379
|
Ne as b,
|
|
1369
1380
|
xn as c,
|
|
1370
1381
|
yn as d,
|
|
1371
1382
|
gt as e,
|
|
1372
1383
|
Ve as f,
|
|
1373
|
-
|
|
1384
|
+
zn as g,
|
|
1374
1385
|
S as h,
|
|
1375
|
-
|
|
1386
|
+
jn as i,
|
|
1376
1387
|
We as j,
|
|
1377
1388
|
Xe as k,
|
|
1378
1389
|
Ke as l,
|
|
1379
|
-
je as m
|
|
1390
|
+
je as m,
|
|
1391
|
+
Kn as p
|
|
1380
1392
|
};
|
|
1381
|
-
//# sourceMappingURL=PeginManager-
|
|
1393
|
+
//# sourceMappingURL=PeginManager-BMrWtTji.js.map
|