@babylonlabs-io/ts-sdk 0.78.0 → 0.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BTCVaultRegistry.abi-BT3eo60h.js → BTCVaultRegistry.abi-B0x9_Bza.js} +43 -1
- package/dist/BTCVaultRegistry.abi-B0x9_Bza.js.map +1 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs.map +1 -0
- package/dist/{BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js → BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js} +57 -20
- package/dist/BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs +2 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs.map +1 -0
- package/dist/{PeginManager-Cz0Ytdwo.js → PeginManager-BXlh3ar0.js} +289 -348
- package/dist/PeginManager-BXlh3ar0.js.map +1 -0
- package/dist/PeginManager-BuVSknB0.cjs +2 -0
- package/dist/PeginManager-BuVSknB0.cjs.map +1 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs +2 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs.map +1 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js +526 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js.map +1 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-DD50pVB1.js → buildAndBroadcastReclaim-O6z9kvc4.js} +502 -468
- package/dist/buildAndBroadcastReclaim-O6z9kvc4.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +227 -222
- package/dist/pegin-registration-client-CZgcU2_0.cjs +2 -0
- package/dist/pegin-registration-client-CZgcU2_0.cjs.map +1 -0
- package/dist/{pegin-registration-client-7Vbtdypu.js → pegin-registration-client-pcczkzMg.js} +184 -143
- package/dist/pegin-registration-client-pcczkzMg.js.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.js +2 -2
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts +17 -0
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts +2 -0
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +28 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +12 -0
- 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 +2 -2
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts +24 -0
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts +14 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +38 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts +41 -4
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.cjs.map +1 -1
- package/dist/tbv/core/contracts/index.d.ts +1 -1
- package/dist/tbv/core/contracts/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.js +15 -492
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +222 -217
- package/dist/tbv/core/managers/PeginManager.d.ts +13 -25
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.d.ts +2 -2
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.js +4 -5
- package/dist/tbv/core/pegin-fingerprint/index.d.ts +1 -1
- package/dist/tbv/core/pegin-fingerprint/index.d.ts.map +1 -1
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts +10 -0
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts +50 -3
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +56 -54
- package/dist/tbv/core/services/participants/__tests__/fixtures/rotation.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +222 -217
- package/dist/tbv/integrations/aave/clients/index.d.ts +1 -1
- package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/clients/spoke.d.ts +13 -0
- package/dist/tbv/integrations/aave/clients/spoke.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.d.ts +1 -1
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.js +137 -125
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/dist/{toRefundInputs-D708M8MA.js → toRefundInputs-9inv4Ai4.js} +96 -92
- package/dist/toRefundInputs-9inv4Ai4.js.map +1 -0
- package/dist/toRefundInputs-DitGWAnz.cjs +2 -0
- package/dist/toRefundInputs-DitGWAnz.cjs.map +1 -0
- package/dist/{types-BwqkOoJ6.js → types-B9YhlXe8.js} +109 -83
- package/dist/types-B9YhlXe8.js.map +1 -0
- package/dist/types-C1tpDycc.cjs +2 -0
- package/dist/types-C1tpDycc.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/BTCVaultRegistry.abi-BJnjzEWD.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-BJnjzEWD.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-BT3eo60h.js.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs +0 -2
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js.map +0 -1
- package/dist/PeginManager-Cz0Ytdwo.js.map +0 -1
- package/dist/PeginManager-DE2lTWMl.cjs +0 -2
- package/dist/PeginManager-DE2lTWMl.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-CB5VPETy.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-CB5VPETy.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-DD50pVB1.js.map +0 -1
- package/dist/pegin-registration-client-7Vbtdypu.js.map +0 -1
- package/dist/pegin-registration-client-CSe1vOum.cjs +0 -2
- package/dist/pegin-registration-client-CSe1vOum.cjs.map +0 -1
- package/dist/toRefundInputs-BH3wkNC4.cjs +0 -2
- package/dist/toRefundInputs-BH3wkNC4.cjs.map +0 -1
- package/dist/toRefundInputs-D708M8MA.js.map +0 -1
- package/dist/types-BN0jOH8K.cjs +0 -2
- package/dist/types-BN0jOH8K.cjs.map +0 -1
- package/dist/types-BwqkOoJ6.js.map +0 -1
package/dist/{pegin-registration-client-7Vbtdypu.js → pegin-registration-client-pcczkzMg.js}
RENAMED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var y = (t, e, o) =>
|
|
4
|
-
import { isAddress as
|
|
5
|
-
import { B as g } from "./BTCVaultRegistry.abi-
|
|
6
|
-
import { B as
|
|
1
|
+
var pt = Object.defineProperty;
|
|
2
|
+
var gt = (t, e, o) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var y = (t, e, o) => gt(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import { isAddress as ft, keccak256 as mt, encodeAbiParameters as Pt, getAbiItem as H, encodeFunctionData as K, isAddressEqual as bt, zeroAddress as yt } from "viem";
|
|
5
|
+
import { B as g } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
6
|
+
import { B as F, h as v } from "./BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
|
|
7
7
|
import { M as O, b as M } from "./constants-D5vORbQE.js";
|
|
8
|
-
import { waitForTransactionReceiptSmartAware as
|
|
9
|
-
import { a as
|
|
10
|
-
import { s as
|
|
11
|
-
import { c as
|
|
12
|
-
const k = 25,
|
|
13
|
-
function
|
|
8
|
+
import { waitForTransactionReceiptSmartAware as wt } from "./tbv/core/utils/eth/index.js";
|
|
9
|
+
import { a as x } from "./onChainBtcPubkey-C-6UWpD8.js";
|
|
10
|
+
import { s as J, b as E, a as Et } from "./secp256k1-D-H9jmd7.js";
|
|
11
|
+
import { c as xt, H as Ct, r as C, a as U, h as Z, b as N, s as S } from "./sha2-CLpQd0Rd.js";
|
|
12
|
+
const k = 25, It = 9999;
|
|
13
|
+
function q(t) {
|
|
14
14
|
if (!Number.isInteger(t) || t < 0 || t >= O)
|
|
15
15
|
throw new Error(
|
|
16
16
|
`Quoted commissionBps must be an integer in [0, ${O}), got ${t}`
|
|
17
17
|
);
|
|
18
18
|
return Math.min(
|
|
19
19
|
t + k,
|
|
20
|
-
|
|
20
|
+
It
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const Bt = /* @__PURE__ */ Uint8Array.from([
|
|
24
24
|
7,
|
|
25
25
|
4,
|
|
26
26
|
13,
|
|
@@ -37,36 +37,36 @@ const It = /* @__PURE__ */ Uint8Array.from([
|
|
|
37
37
|
14,
|
|
38
38
|
11,
|
|
39
39
|
8
|
|
40
|
-
]),
|
|
41
|
-
const o = [[
|
|
40
|
+
]), tt = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), $t = tt.map((t) => (9 * t + 5) % 16), et = /* @__PURE__ */ (() => {
|
|
41
|
+
const o = [[tt], [$t]];
|
|
42
42
|
for (let n = 0; n < 4; n++)
|
|
43
43
|
for (let i of o)
|
|
44
|
-
i.push(i[n].map((a) =>
|
|
44
|
+
i.push(i[n].map((a) => Bt[a]));
|
|
45
45
|
return o;
|
|
46
|
-
})(),
|
|
46
|
+
})(), ot = et[0], nt = et[1], it = /* @__PURE__ */ [
|
|
47
47
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
48
48
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
49
49
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
50
50
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
51
51
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
52
|
-
].map((t) => Uint8Array.from(t)),
|
|
52
|
+
].map((t) => Uint8Array.from(t)), vt = /* @__PURE__ */ ot.map((t, e) => t.map((o) => it[e][o])), Tt = /* @__PURE__ */ nt.map((t, e) => t.map((o) => it[e][o])), At = /* @__PURE__ */ Uint32Array.from([
|
|
53
53
|
0,
|
|
54
54
|
1518500249,
|
|
55
55
|
1859775393,
|
|
56
56
|
2400959708,
|
|
57
57
|
2840853838
|
|
58
|
-
]),
|
|
58
|
+
]), Vt = /* @__PURE__ */ Uint32Array.from([
|
|
59
59
|
1352829926,
|
|
60
60
|
1548603684,
|
|
61
61
|
1836072691,
|
|
62
62
|
2053994217,
|
|
63
63
|
0
|
|
64
64
|
]);
|
|
65
|
-
function
|
|
65
|
+
function W(t, e, o, n) {
|
|
66
66
|
return t === 0 ? e ^ o ^ n : t === 1 ? e & o | ~e & n : t === 2 ? (e | ~o) ^ n : t === 3 ? e & n | o & ~n : e ^ (o | ~n);
|
|
67
67
|
}
|
|
68
68
|
const I = /* @__PURE__ */ new Uint32Array(16);
|
|
69
|
-
class
|
|
69
|
+
class St extends Ct {
|
|
70
70
|
constructor() {
|
|
71
71
|
super(64, 20, 8, !0);
|
|
72
72
|
y(this, "h0", 1732584193);
|
|
@@ -87,69 +87,69 @@ class Vt extends Ct {
|
|
|
87
87
|
I[r] = o.getUint32(n, !0);
|
|
88
88
|
let i = this.h0 | 0, a = i, c = this.h1 | 0, h = c, d = this.h2 | 0, p = d, f = this.h3 | 0, P = f, s = this.h4 | 0, l = s;
|
|
89
89
|
for (let r = 0; r < 5; r++) {
|
|
90
|
-
const u = 4 - r, b =
|
|
90
|
+
const u = 4 - r, b = At[r], ct = Vt[r], ut = ot[r], ht = nt[r], lt = vt[r], dt = Tt[r];
|
|
91
91
|
for (let m = 0; m < 16; m++) {
|
|
92
|
-
const $ =
|
|
93
|
-
i = s, s = f, f =
|
|
92
|
+
const $ = C(i + W(r, c, d, f) + I[ut[m]] + b, lt[m]) + s | 0;
|
|
93
|
+
i = s, s = f, f = C(d, 10) | 0, d = c, c = $;
|
|
94
94
|
}
|
|
95
95
|
for (let m = 0; m < 16; m++) {
|
|
96
|
-
const $ =
|
|
97
|
-
a = l, l = P, P =
|
|
96
|
+
const $ = C(a + W(u, h, p, P) + I[ht[m]] + ct, dt[m]) + l | 0;
|
|
97
|
+
a = l, l = P, P = C(p, 10) | 0, p = h, h = $;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
this.set(this.h1 + d + P | 0, this.h2 + f + l | 0, this.h3 + s + a | 0, this.h4 + i + h | 0, this.h0 + c + p | 0);
|
|
101
101
|
}
|
|
102
102
|
roundClean() {
|
|
103
|
-
|
|
103
|
+
U(I);
|
|
104
104
|
}
|
|
105
105
|
destroy() {
|
|
106
|
-
this.destroyed = !0,
|
|
106
|
+
this.destroyed = !0, U(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
const
|
|
110
|
-
function
|
|
109
|
+
const kt = /* @__PURE__ */ xt(() => new St()), Rt = "5120", R = "0014", _t = 20, D = 33, Nt = 65, Ht = 2, Kt = 3, Ft = 4;
|
|
110
|
+
function st(t, e) {
|
|
111
111
|
const o = t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t;
|
|
112
112
|
if (!/^(?:[0-9a-fA-F]{2})+$/.test(o))
|
|
113
113
|
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
114
114
|
return `0x${o.toLowerCase()}`;
|
|
115
115
|
}
|
|
116
116
|
function Ot(t) {
|
|
117
|
-
const e =
|
|
117
|
+
const e = Z(t), o = E.utils.lift_x(BigInt(`0x${t}`)), n = E.utils.bytesToNumberBE(
|
|
118
118
|
E.utils.taggedHash("TapTweak", e)
|
|
119
119
|
);
|
|
120
|
-
if (n >=
|
|
120
|
+
if (n >= J.CURVE.n)
|
|
121
121
|
throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");
|
|
122
122
|
const i = n === 0n ? o : o.add(E.Point.BASE.multiply(n));
|
|
123
|
-
return `0x${
|
|
123
|
+
return `0x${Rt}${N(
|
|
124
124
|
E.utils.pointToBytes(i)
|
|
125
125
|
)}`;
|
|
126
126
|
}
|
|
127
127
|
function Mt(t) {
|
|
128
|
-
const e =
|
|
128
|
+
const e = st(t, "depositorBtcPubkeyRaw"), o = Z(e.slice(2));
|
|
129
129
|
if (o.length === 32)
|
|
130
130
|
return {
|
|
131
|
-
xOnlyPubkey:
|
|
131
|
+
xOnlyPubkey: x(e, "Payout BTC pubkey")
|
|
132
132
|
};
|
|
133
|
-
const n = o.length ===
|
|
133
|
+
const n = o.length === D && (o[0] === Ht || o[0] === Kt), i = o.length === Nt && o[0] === Ft;
|
|
134
134
|
if (!n && !i)
|
|
135
135
|
throw new Error(
|
|
136
136
|
"depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed"
|
|
137
137
|
);
|
|
138
138
|
try {
|
|
139
|
-
|
|
139
|
+
J.Point.fromBytes(o);
|
|
140
140
|
} catch {
|
|
141
141
|
throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey");
|
|
142
142
|
}
|
|
143
143
|
return {
|
|
144
|
-
xOnlyPubkey:
|
|
144
|
+
xOnlyPubkey: N(o.subarray(1, D)),
|
|
145
145
|
compressedPubkey: n ? o : void 0
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return `0x${R}${
|
|
148
|
+
function Ut(t) {
|
|
149
|
+
return `0x${R}${N(kt(S(t)))}`;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const n =
|
|
151
|
+
function qt(t, e, o) {
|
|
152
|
+
const n = st(
|
|
153
153
|
t,
|
|
154
154
|
"depositorPayoutScriptPubKey"
|
|
155
155
|
);
|
|
@@ -157,7 +157,7 @@ function Ut(t, e, o) {
|
|
|
157
157
|
throw new Error(
|
|
158
158
|
`depositorPayoutScriptPubKey exceeds ${M} bytes`
|
|
159
159
|
);
|
|
160
|
-
const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, a =
|
|
160
|
+
const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, a = x(
|
|
161
161
|
`0x${i}`,
|
|
162
162
|
"Proof of possession BTC pubkey"
|
|
163
163
|
), c = Mt(o);
|
|
@@ -167,17 +167,17 @@ function Ut(t, e, o) {
|
|
|
167
167
|
);
|
|
168
168
|
if (n === Ot(a))
|
|
169
169
|
return n;
|
|
170
|
-
if (n.startsWith(`0x${R}`) && n.length === 2 + R.length +
|
|
170
|
+
if (n.startsWith(`0x${R}`) && n.length === 2 + R.length + _t * 2) {
|
|
171
171
|
if (!c.compressedPubkey)
|
|
172
172
|
throw new Error("A P2WPKH payout requires a compressed BTC pubkey");
|
|
173
|
-
if (n ===
|
|
173
|
+
if (n === Ut(c.compressedPubkey))
|
|
174
174
|
return n;
|
|
175
175
|
}
|
|
176
176
|
throw new Error(
|
|
177
177
|
"depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey"
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function Wt(t, e) {
|
|
181
181
|
const o = t.startsWith("0x") ? t.slice(2) : t;
|
|
182
182
|
if (o.length === 0 || o.length % 2 !== 0)
|
|
183
183
|
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
@@ -188,12 +188,12 @@ function qt(t, e) {
|
|
|
188
188
|
n[i] = Number.parseInt(o.slice(i * 2, i * 2 + 2), 16);
|
|
189
189
|
return n;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Dt(t) {
|
|
192
192
|
return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join(
|
|
193
193
|
""
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function Lt(t) {
|
|
197
197
|
const e = new Uint8Array(
|
|
198
198
|
t.reduce((n, i) => n + i.length, 0)
|
|
199
199
|
);
|
|
@@ -202,7 +202,7 @@ function Dt(t) {
|
|
|
202
202
|
e.set(n, o), o += n.length;
|
|
203
203
|
return e;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Xt(t) {
|
|
206
206
|
let e = 0;
|
|
207
207
|
const o = (s, l) => {
|
|
208
208
|
if (!Number.isSafeInteger(s) || s < 0)
|
|
@@ -269,7 +269,7 @@ function Lt(t) {
|
|
|
269
269
|
throw new Error(
|
|
270
270
|
`Bitcoin transaction has ${t.length - e} trailing byte(s)`
|
|
271
271
|
);
|
|
272
|
-
return
|
|
272
|
+
return Lt([
|
|
273
273
|
a,
|
|
274
274
|
h.encoded,
|
|
275
275
|
...d,
|
|
@@ -278,46 +278,46 @@ function Lt(t) {
|
|
|
278
278
|
P
|
|
279
279
|
]);
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
const e =
|
|
283
|
-
|
|
281
|
+
function zt(t) {
|
|
282
|
+
const e = Xt(
|
|
283
|
+
Wt(t, "transactionHex")
|
|
284
284
|
), o = S(S(e));
|
|
285
|
-
return o.reverse(), `0x${
|
|
285
|
+
return o.reverse(), `0x${Dt(o)}`;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Gt(t, e) {
|
|
288
288
|
const o = t.startsWith("0x") ? t : `0x${t}`;
|
|
289
289
|
if (!/^0x[0-9a-fA-F]{64}$/.test(o))
|
|
290
290
|
throw new Error("peginTxHash must be a 32-byte hex value");
|
|
291
291
|
const n = e.startsWith("0x") ? e : `0x${e}`;
|
|
292
|
-
if (!
|
|
292
|
+
if (!ft(n, { strict: !0 }))
|
|
293
293
|
throw new Error(`Invalid depositor Ethereum address: ${e}`);
|
|
294
|
-
return
|
|
295
|
-
|
|
294
|
+
return mt(
|
|
295
|
+
Pt(
|
|
296
296
|
[{ type: "bytes32" }, { type: "address" }],
|
|
297
297
|
[o, n]
|
|
298
298
|
)
|
|
299
299
|
).slice(2);
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
function
|
|
301
|
+
const T = 65535, L = 1e4, B = 4294967295, X = 255;
|
|
302
|
+
function Qt(t) {
|
|
303
303
|
if (!Number.isInteger(t) || t < 0 || t > B)
|
|
304
304
|
throw new Error(
|
|
305
305
|
`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
|
|
306
306
|
);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function Yt(t) {
|
|
309
309
|
const e = [];
|
|
310
310
|
if (t.timelockAssert <= 0n && e.push(
|
|
311
311
|
`timelockAssert must be positive, got ${t.timelockAssert}`
|
|
312
|
-
), t.timelockAssert > BigInt(
|
|
313
|
-
`timelockAssert ${t.timelockAssert} exceeds uint16 max (${
|
|
312
|
+
), t.timelockAssert > BigInt(T) && e.push(
|
|
313
|
+
`timelockAssert ${t.timelockAssert} exceeds uint16 max (${T})`
|
|
314
314
|
), t.timelockChallengeAssert <= 0n && e.push(
|
|
315
315
|
`timelockChallengeAssert must be positive, got ${t.timelockChallengeAssert}`
|
|
316
316
|
), t.tRefund <= 0 && e.push(`tRefund must be positive, got ${t.tRefund}`), t.tStale <= 0 && e.push(`tStale must be positive, got ${t.tStale}`), t.securityCouncilKeys.length === 0 && e.push("securityCouncilKeys must not be empty"), t.councilQuorum <= 0 && e.push(`councilQuorum must be positive, got ${t.councilQuorum}`), t.councilQuorum > t.securityCouncilKeys.length && e.push(
|
|
317
317
|
`councilQuorum (${t.councilQuorum}) exceeds securityCouncilKeys count (${t.securityCouncilKeys.length})`
|
|
318
318
|
), t.feeRate <= 0n && e.push(`feeRate must be positive, got ${t.feeRate}`), t.minPeginFeeRate <= 0n && e.push(
|
|
319
319
|
`minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`
|
|
320
|
-
), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion >
|
|
320
|
+
), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion > T) && e.push(
|
|
321
321
|
`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`
|
|
322
322
|
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > B) && e.push(
|
|
323
323
|
`minPrepeginDepth must be a uint32 in [1, ${B}], got ${t.minPrepeginDepth}`
|
|
@@ -327,14 +327,14 @@ function Qt(t) {
|
|
|
327
327
|
`babeInstancesToFinalize must be positive, got ${t.babeInstancesToFinalize}`
|
|
328
328
|
), t.babeInstancesToFinalize > t.babeTotalInstances && e.push(
|
|
329
329
|
`babeInstancesToFinalize (${t.babeInstancesToFinalize}) exceeds babeTotalInstances (${t.babeTotalInstances})`
|
|
330
|
-
), (t.minVpCommissionBps < 0 || t.minVpCommissionBps >
|
|
331
|
-
`minVpCommissionBps must be in [0, ${
|
|
330
|
+
), (t.minVpCommissionBps < 0 || t.minVpCommissionBps > L) && e.push(
|
|
331
|
+
`minVpCommissionBps must be in [0, ${L}], got ${t.minVpCommissionBps}`
|
|
332
332
|
), e.length > 0)
|
|
333
333
|
throw new Error(
|
|
334
334
|
`Invalid offchain protocol parameters: ${e.join("; ")}`
|
|
335
335
|
);
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function jt(t) {
|
|
338
338
|
const e = [];
|
|
339
339
|
if (t.minimumPegInAmount <= 0n && e.push(
|
|
340
340
|
`minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
|
|
@@ -344,38 +344,38 @@ function Yt(t) {
|
|
|
344
344
|
`pegInAckTimeout must be positive, got ${t.pegInAckTimeout}`
|
|
345
345
|
), t.pegInActivationTimeout <= 0n && e.push(
|
|
346
346
|
`pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`
|
|
347
|
-
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount >
|
|
348
|
-
`maxHtlcOutputCount must be an integer in [1, ${
|
|
347
|
+
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > X) && e.push(
|
|
348
|
+
`maxHtlcOutputCount must be an integer in [1, ${X}], got ${t.maxHtlcOutputCount}`
|
|
349
349
|
), (typeof t.expiredPegInGraceBlocks != "bigint" || t.expiredPegInGraceBlocks <= 0n) && e.push(
|
|
350
350
|
`expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`
|
|
351
351
|
), e.length > 0)
|
|
352
352
|
throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
if (
|
|
354
|
+
function fe(t) {
|
|
355
|
+
if (jt(t), Yt(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > B)
|
|
356
356
|
throw new Error(
|
|
357
357
|
`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
|
|
358
358
|
);
|
|
359
|
-
|
|
359
|
+
Et(
|
|
360
360
|
t.activeVaultCoreVersion,
|
|
361
361
|
"ProtocolParams.activeVaultCoreVersion()"
|
|
362
362
|
);
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
class
|
|
364
|
+
const rt = "RegistrationLogsUnavailableError";
|
|
365
|
+
class at extends Error {
|
|
366
366
|
constructor(o) {
|
|
367
367
|
super(
|
|
368
368
|
`The Ethereum node returned no registration logs for block ${o}, which holds a vault registration; the node may not have indexed that block yet. Try again.`
|
|
369
369
|
);
|
|
370
370
|
y(this, "blockNumber");
|
|
371
|
-
this.name =
|
|
371
|
+
this.name = rt, this.blockNumber = o;
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
function
|
|
375
|
-
return t instanceof
|
|
374
|
+
function me(t) {
|
|
375
|
+
return t instanceof at ? !0 : typeof t != "object" || t === null ? !1 : t.name === rt;
|
|
376
376
|
}
|
|
377
|
-
const
|
|
378
|
-
function
|
|
377
|
+
const z = 9999;
|
|
378
|
+
function G(t) {
|
|
379
379
|
return {
|
|
380
380
|
depositor: t.depositor,
|
|
381
381
|
depositorBtcPubKey: t.depositorBtcPubKey,
|
|
@@ -388,7 +388,7 @@ function z(t) {
|
|
|
388
388
|
}
|
|
389
389
|
function A(t) {
|
|
390
390
|
const e = Number(t.offchainParamsVersion);
|
|
391
|
-
return
|
|
391
|
+
return Qt(e), {
|
|
392
392
|
depositorSignedPeginTx: t.depositorSignedPeginTx,
|
|
393
393
|
universalChallengersVersion: t.universalChallengersVersion,
|
|
394
394
|
appVaultKeepersVersion: t.appVaultKeepersVersion,
|
|
@@ -403,18 +403,18 @@ function A(t) {
|
|
|
403
403
|
vaultCoreVersion: t.vaultCoreVersion
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
const Jt = 1n << 64n, Q = 0n, Zt = [
|
|
407
|
+
H({ abi: g, name: "PegInSubmitted" }),
|
|
408
|
+
H({ abi: g, name: "PegInSubmittedV2" })
|
|
409
409
|
];
|
|
410
410
|
function V(t, e, o) {
|
|
411
|
-
if (t < 0n || t >=
|
|
411
|
+
if (t < 0n || t >= Jt)
|
|
412
412
|
throw new Error(
|
|
413
413
|
`getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, outside the uint64 range — the registry may predate RFC-006`
|
|
414
414
|
);
|
|
415
415
|
return t;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Y(t, e) {
|
|
418
418
|
return {
|
|
419
419
|
vpKeyEpoch: V(t.vpKeyEpoch, "vpKeyEpoch", e),
|
|
420
420
|
appKeeperKeyEpoch: V(
|
|
@@ -425,7 +425,7 @@ function Q(t, e) {
|
|
|
425
425
|
ucKeyEpoch: V(t.ucKeyEpoch, "ucKeyEpoch", e)
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
|
-
class
|
|
428
|
+
class te {
|
|
429
429
|
constructor(e, o) {
|
|
430
430
|
this.publicClient = e, this.contractAddress = o;
|
|
431
431
|
}
|
|
@@ -457,14 +457,34 @@ class Zt {
|
|
|
457
457
|
address: this.contractAddress,
|
|
458
458
|
abi: g,
|
|
459
459
|
functionName: "getOperationBtcKeyAtEpoch",
|
|
460
|
-
args: [e,
|
|
460
|
+
args: [e, Q],
|
|
461
461
|
blockNumber: o
|
|
462
462
|
});
|
|
463
|
-
return
|
|
463
|
+
return x(
|
|
464
464
|
n,
|
|
465
|
-
`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${
|
|
465
|
+
`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${Q})`
|
|
466
466
|
);
|
|
467
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Read the application entry point a vault provider is registered for.
|
|
470
|
+
*
|
|
471
|
+
* This is the registry's own `vaultProviders[vp].applicationEntryPoint`, and
|
|
472
|
+
* it is the value the peg-in submit path resolves internally — it selects
|
|
473
|
+
* which application's vault-keeper roster, roster version and keeper key
|
|
474
|
+
* epoch a deposit is bonded to. The dApp separately carries an entry point
|
|
475
|
+
* from its own configuration; the two agree today, but they are different
|
|
476
|
+
* sources of truth, so the build path reads this one and asserts the
|
|
477
|
+
* configured value matches it rather than trusting either alone.
|
|
478
|
+
*/
|
|
479
|
+
async getVaultProviderApplication(e, o) {
|
|
480
|
+
return await this.publicClient.readContract({
|
|
481
|
+
address: this.contractAddress,
|
|
482
|
+
abi: g,
|
|
483
|
+
functionName: "getVaultProviderApplication",
|
|
484
|
+
args: [e],
|
|
485
|
+
blockNumber: o
|
|
486
|
+
});
|
|
487
|
+
}
|
|
468
488
|
/**
|
|
469
489
|
* Read a vault provider's *current* RFC-006 operation BTC key.
|
|
470
490
|
*
|
|
@@ -483,7 +503,7 @@ class Zt {
|
|
|
483
503
|
functionName: "getCurrentOperationBtcKey",
|
|
484
504
|
args: [e]
|
|
485
505
|
});
|
|
486
|
-
return
|
|
506
|
+
return x(
|
|
487
507
|
o,
|
|
488
508
|
`getCurrentOperationBtcKey (vp=${e})`
|
|
489
509
|
);
|
|
@@ -507,23 +527,23 @@ class Zt {
|
|
|
507
527
|
async getVaultKeyEpochs(e) {
|
|
508
528
|
const o = await this.publicClient.readContract({
|
|
509
529
|
address: this.contractAddress,
|
|
510
|
-
abi:
|
|
530
|
+
abi: F,
|
|
511
531
|
functionName: "getBtcVaultProtocolInfo",
|
|
512
532
|
args: [e]
|
|
513
533
|
});
|
|
514
|
-
return
|
|
534
|
+
return Y(o, e);
|
|
515
535
|
}
|
|
516
536
|
async getVaultKeyEpochsBatch(e) {
|
|
517
537
|
return e.length === 0 ? [] : (await this.publicClient.multicall({
|
|
518
538
|
contracts: e.map((n) => ({
|
|
519
539
|
address: this.contractAddress,
|
|
520
|
-
abi:
|
|
540
|
+
abi: F,
|
|
521
541
|
functionName: "getBtcVaultProtocolInfo",
|
|
522
542
|
args: [n]
|
|
523
543
|
})),
|
|
524
544
|
allowFailure: !1
|
|
525
545
|
})).map(
|
|
526
|
-
(n, i) =>
|
|
546
|
+
(n, i) => Y(n, e[i])
|
|
527
547
|
);
|
|
528
548
|
}
|
|
529
549
|
async getVaultBasicInfo(e) {
|
|
@@ -533,7 +553,7 @@ class Zt {
|
|
|
533
553
|
functionName: "getBtcVaultBasicInfo",
|
|
534
554
|
args: [e]
|
|
535
555
|
});
|
|
536
|
-
return
|
|
556
|
+
return G(o);
|
|
537
557
|
}
|
|
538
558
|
async getVaultProtocolInfo(e) {
|
|
539
559
|
const o = await this.publicClient.readContract({
|
|
@@ -588,9 +608,9 @@ class Zt {
|
|
|
588
608
|
functionName: "getVaultProviderCommission",
|
|
589
609
|
args: [e]
|
|
590
610
|
});
|
|
591
|
-
if (!Number.isInteger(o) || o < 0 || o >
|
|
611
|
+
if (!Number.isInteger(o) || o < 0 || o > z)
|
|
592
612
|
throw new Error(
|
|
593
|
-
`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${
|
|
613
|
+
`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${z}]`
|
|
594
614
|
);
|
|
595
615
|
return o;
|
|
596
616
|
}
|
|
@@ -611,7 +631,7 @@ class Zt {
|
|
|
611
631
|
}
|
|
612
632
|
],
|
|
613
633
|
allowFailure: !1
|
|
614
|
-
}), i =
|
|
634
|
+
}), i = G(o), a = A(n);
|
|
615
635
|
if (!a.depositorSignedPeginTx || a.depositorSignedPeginTx === "0x")
|
|
616
636
|
throw new Error(
|
|
617
637
|
`Vault ${e} not found on-chain or has no pegin transaction`
|
|
@@ -640,13 +660,13 @@ class Zt {
|
|
|
640
660
|
if (e.length === 0) return [];
|
|
641
661
|
const n = await this.publicClient.getLogs({
|
|
642
662
|
address: this.contractAddress,
|
|
643
|
-
events:
|
|
663
|
+
events: Zt,
|
|
644
664
|
fromBlock: o,
|
|
645
665
|
toBlock: o,
|
|
646
666
|
strict: !0
|
|
647
667
|
});
|
|
648
668
|
if (n.length === 0)
|
|
649
|
-
throw new
|
|
669
|
+
throw new at(o);
|
|
650
670
|
return e.map((i) => {
|
|
651
671
|
const a = i.toLowerCase();
|
|
652
672
|
let c = !1;
|
|
@@ -664,22 +684,29 @@ class Zt {
|
|
|
664
684
|
});
|
|
665
685
|
}
|
|
666
686
|
}
|
|
667
|
-
const
|
|
687
|
+
const ee = 0, oe = 255, ne = 12e4;
|
|
668
688
|
function w(t, e) {
|
|
669
689
|
const o = t.startsWith("0x") ? t : t.startsWith("0X") ? `0x${t.slice(2)}` : `0x${t}`;
|
|
670
690
|
if (!/^0x(?:[0-9a-fA-F]{2})+$/.test(o))
|
|
671
691
|
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
672
692
|
return o;
|
|
673
693
|
}
|
|
674
|
-
function
|
|
694
|
+
function _(t, e) {
|
|
675
695
|
if (!/^0x[0-9a-fA-F]{64}$/.test(t))
|
|
676
696
|
throw new Error(`${e} must be a 32-byte hex value`);
|
|
677
697
|
}
|
|
678
|
-
|
|
679
|
-
|
|
698
|
+
const ie = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
699
|
+
function j(t) {
|
|
700
|
+
if (_(t, "expectedFingerprint"), t.toLowerCase() === ie)
|
|
701
|
+
throw new Error(
|
|
702
|
+
"expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert"
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
function se(t) {
|
|
706
|
+
if (!Number.isInteger(t) || t < 0 || t > oe)
|
|
680
707
|
throw new Error(`htlcVout must be a uint8, got ${t}`);
|
|
681
708
|
}
|
|
682
|
-
class
|
|
709
|
+
class Pe {
|
|
683
710
|
constructor(e) {
|
|
684
711
|
this.config = e;
|
|
685
712
|
}
|
|
@@ -688,7 +715,7 @@ class fe {
|
|
|
688
715
|
...e,
|
|
689
716
|
popSignature: { ...e.popSignature }
|
|
690
717
|
};
|
|
691
|
-
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps);
|
|
718
|
+
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), j(o.expectedFingerprint);
|
|
692
719
|
const n = this.assertPopMatchesEthAccount(o.popSignature), i = this.normalizeBtcPubkey(o.popSignature), a = w(
|
|
693
720
|
o.popSignature.btcPopSignature,
|
|
694
721
|
"btcPopSignature"
|
|
@@ -704,7 +731,7 @@ class fe {
|
|
|
704
731
|
const h = await this.readPeginFee(o.vaultProvider), d = await this.resolveMaxAcceptableCommissionBps(
|
|
705
732
|
o.vaultProvider,
|
|
706
733
|
o.quotedCommissionBps
|
|
707
|
-
), p =
|
|
734
|
+
), p = K({
|
|
708
735
|
abi: g,
|
|
709
736
|
functionName: "submitPeginRequest",
|
|
710
737
|
args: [
|
|
@@ -718,7 +745,10 @@ class fe {
|
|
|
718
745
|
o.hashlock,
|
|
719
746
|
o.htlcVout,
|
|
720
747
|
c.payoutScript,
|
|
721
|
-
o.depositorWotsPkHash
|
|
748
|
+
o.depositorWotsPkHash,
|
|
749
|
+
// Appended last on the singular overload; the batch takes it at
|
|
750
|
+
// position 4 instead. Order is the selector, so do not "tidy" either.
|
|
751
|
+
o.expectedFingerprint
|
|
722
752
|
]
|
|
723
753
|
});
|
|
724
754
|
return {
|
|
@@ -740,7 +770,7 @@ class fe {
|
|
|
740
770
|
};
|
|
741
771
|
if (o.requests.length === 0)
|
|
742
772
|
throw new Error("Batch pegin requires at least one request");
|
|
743
|
-
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps);
|
|
773
|
+
this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps), j(o.expectedFingerprint);
|
|
744
774
|
const n = this.assertPopMatchesEthAccount(o.popSignature), i = w(
|
|
745
775
|
o.unsignedPrePeginTx,
|
|
746
776
|
"unsignedPrePeginTx"
|
|
@@ -771,7 +801,7 @@ class fe {
|
|
|
771
801
|
depositorSignedPeginTx: u.depositorSignedPeginTx,
|
|
772
802
|
hashlock: r.hashlock,
|
|
773
803
|
htlcVout: r.htlcVout,
|
|
774
|
-
referralCode:
|
|
804
|
+
referralCode: ee,
|
|
775
805
|
depositorPayoutBtcAddress: u.payoutScript,
|
|
776
806
|
depositorWotsPkHash: r.depositorWotsPkHash
|
|
777
807
|
});
|
|
@@ -781,10 +811,18 @@ class fe {
|
|
|
781
811
|
const f = await this.readPeginFee(o.vaultProvider), P = await this.resolveMaxAcceptableCommissionBps(
|
|
782
812
|
o.vaultProvider,
|
|
783
813
|
o.quotedCommissionBps
|
|
784
|
-
), s =
|
|
814
|
+
), s = K({
|
|
785
815
|
abi: g,
|
|
786
816
|
functionName: "submitPeginRequestBatch",
|
|
787
|
-
|
|
817
|
+
// `expectedFingerprint` sits BEFORE `requests`, not appended. Reordering
|
|
818
|
+
// these five changes the selector and the call stops existing.
|
|
819
|
+
args: [
|
|
820
|
+
n,
|
|
821
|
+
o.vaultProvider,
|
|
822
|
+
P,
|
|
823
|
+
o.expectedFingerprint,
|
|
824
|
+
d
|
|
825
|
+
]
|
|
788
826
|
});
|
|
789
827
|
return { ethTxHash: await this.sendAndWait(
|
|
790
828
|
s,
|
|
@@ -805,37 +843,41 @@ class fe {
|
|
|
805
843
|
assertEthAccount(e) {
|
|
806
844
|
const o = this.config.ethWallet.account;
|
|
807
845
|
if (!o) throw new Error("Ethereum wallet account not found");
|
|
808
|
-
if (!
|
|
846
|
+
if (!bt(e, o.address))
|
|
809
847
|
throw new Error(
|
|
810
848
|
`Proof of possession was signed for ${e} but the Ethereum wallet is currently connected to ${o.address}. Reconnect the original account or sign a new proof of possession.`
|
|
811
849
|
);
|
|
812
850
|
return o.address;
|
|
813
851
|
}
|
|
814
852
|
normalizeBtcPubkey(e) {
|
|
815
|
-
return `0x${
|
|
853
|
+
return `0x${x(
|
|
816
854
|
w(e.depositorBtcPubkey, "Proof of possession BTC pubkey"),
|
|
817
855
|
"Proof of possession BTC pubkey"
|
|
818
856
|
)}`;
|
|
819
857
|
}
|
|
858
|
+
// `expectedFingerprint` is omitted rather than accepted and ignored: nothing
|
|
859
|
+
// here normalizes it, and requiring it would force the batch loop to thread a
|
|
860
|
+
// value through a per-request helper that has no use for it. It is validated
|
|
861
|
+
// once per call, at the top of each public method.
|
|
820
862
|
normalizeRequest(e, o, n) {
|
|
821
|
-
|
|
863
|
+
_(e.hashlock, "hashlock"), _(e.depositorWotsPkHash, "depositorWotsPkHash"), se(e.htlcVout);
|
|
822
864
|
const i = w(
|
|
823
865
|
e.unsignedPrePeginTx,
|
|
824
866
|
"unsignedPrePeginTx"
|
|
825
867
|
), a = w(
|
|
826
868
|
e.depositorSignedPeginTx,
|
|
827
869
|
"depositorSignedPeginTx"
|
|
828
|
-
), c =
|
|
870
|
+
), c = zt(a);
|
|
829
871
|
return {
|
|
830
872
|
unsignedPrePeginTx: i,
|
|
831
873
|
depositorSignedPeginTx: a,
|
|
832
|
-
payoutScript:
|
|
874
|
+
payoutScript: qt(
|
|
833
875
|
e.depositorPayoutScriptPubKey,
|
|
834
876
|
n,
|
|
835
877
|
e.depositorBtcPubkeyRaw
|
|
836
878
|
),
|
|
837
879
|
peginTxHash: c,
|
|
838
|
-
vaultId: w(
|
|
880
|
+
vaultId: w(Gt(c, o), "vaultId")
|
|
839
881
|
};
|
|
840
882
|
}
|
|
841
883
|
async assertVaultDoesNotExist(e, o) {
|
|
@@ -844,7 +886,7 @@ class fe {
|
|
|
844
886
|
abi: g,
|
|
845
887
|
functionName: "getBtcVaultBasicInfo",
|
|
846
888
|
args: [e]
|
|
847
|
-
})).depositor !==
|
|
889
|
+
})).depositor !== yt)
|
|
848
890
|
throw new Error(
|
|
849
891
|
`Vault already exists (ID: ${e}, peginTxHash: ${o}). 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.`
|
|
850
892
|
);
|
|
@@ -867,7 +909,7 @@ class fe {
|
|
|
867
909
|
async resolveMaxAcceptableCommissionBps(e, o) {
|
|
868
910
|
let n;
|
|
869
911
|
try {
|
|
870
|
-
n = await new
|
|
912
|
+
n = await new te(
|
|
871
913
|
this.config.publicClient,
|
|
872
914
|
this.config.btcVaultRegistry
|
|
873
915
|
).getVaultProviderCommission(e);
|
|
@@ -882,9 +924,9 @@ class fe {
|
|
|
882
924
|
throw new Error(
|
|
883
925
|
`Vault provider commission changed since quote: quoted ${o} bps, chain currently reports ${n} bps (allowed drift ${k} bps). Please refresh and try again.`
|
|
884
926
|
);
|
|
885
|
-
return
|
|
927
|
+
return q(o);
|
|
886
928
|
}
|
|
887
|
-
return
|
|
929
|
+
return q(n);
|
|
888
930
|
}
|
|
889
931
|
async sendAndWait(e, o, n, i) {
|
|
890
932
|
let a = this.assertEthAccount(i), c;
|
|
@@ -896,7 +938,7 @@ class fe {
|
|
|
896
938
|
account: a
|
|
897
939
|
});
|
|
898
940
|
} catch (p) {
|
|
899
|
-
|
|
941
|
+
v(p);
|
|
900
942
|
}
|
|
901
943
|
a = this.assertEthAccount(i);
|
|
902
944
|
let h;
|
|
@@ -910,15 +952,15 @@ class fe {
|
|
|
910
952
|
chain: this.config.ethChain
|
|
911
953
|
});
|
|
912
954
|
} catch (p) {
|
|
913
|
-
|
|
955
|
+
v(p);
|
|
914
956
|
}
|
|
915
|
-
const d = await
|
|
957
|
+
const d = await wt({
|
|
916
958
|
publicClient: this.config.publicClient,
|
|
917
959
|
walletAddress: i,
|
|
918
960
|
hash: h,
|
|
919
|
-
timeout: this.config.receiptTimeoutMs ??
|
|
961
|
+
timeout: this.config.receiptTimeoutMs ?? ne
|
|
920
962
|
});
|
|
921
|
-
return d.status === "reverted" &&
|
|
963
|
+
return d.status === "reverted" && v(
|
|
922
964
|
new Error(
|
|
923
965
|
`${n ? "Batch transaction" : "Transaction"} reverted. Hash: ${d.transactionHash}. Check a block explorer for details.`
|
|
924
966
|
)
|
|
@@ -927,19 +969,18 @@ class fe {
|
|
|
927
969
|
}
|
|
928
970
|
export {
|
|
929
971
|
k as C,
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
fe as
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
Qt as v
|
|
972
|
+
It as M,
|
|
973
|
+
at as R,
|
|
974
|
+
Pe as V,
|
|
975
|
+
fe as a,
|
|
976
|
+
jt as b,
|
|
977
|
+
te as c,
|
|
978
|
+
Gt as d,
|
|
979
|
+
q as e,
|
|
980
|
+
zt as f,
|
|
981
|
+
Qt as g,
|
|
982
|
+
me as i,
|
|
983
|
+
kt as r,
|
|
984
|
+
Yt as v
|
|
944
985
|
};
|
|
945
|
-
//# sourceMappingURL=pegin-registration-client-
|
|
986
|
+
//# sourceMappingURL=pegin-registration-client-pcczkzMg.js.map
|