@babylonlabs-io/ts-sdk 0.33.3 → 0.33.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/BTCVaultRegistry.abi-DbJ5lsFJ.js +417 -0
- package/dist/BTCVaultRegistry.abi-DbJ5lsFJ.js.map +1 -0
- package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs.map +1 -0
- package/dist/PayoutManager-C9XHKZ5j.js +200 -0
- package/dist/PayoutManager-C9XHKZ5j.js.map +1 -0
- package/dist/PayoutManager-DDnNB0mj.cjs +2 -0
- package/dist/PayoutManager-DDnNB0mj.cjs.map +1 -0
- package/dist/PeginManager-BXg2S1mH.cjs +2 -0
- package/dist/PeginManager-BXg2S1mH.cjs.map +1 -0
- package/dist/{PeginManager-C-L3huRO.js → PeginManager-C5HaMAcw.js} +328 -437
- package/dist/PeginManager-C5HaMAcw.js.map +1 -0
- package/dist/ProtocolParams.abi-BmvHwQJV.cjs +2 -0
- package/dist/ProtocolParams.abi-BmvHwQJV.cjs.map +1 -0
- package/dist/ProtocolParams.abi-DXu8L0Fn.js +382 -0
- package/dist/ProtocolParams.abi-DXu8L0Fn.js.map +1 -0
- package/dist/buildAndBroadcastRefund-CIPPpchL.cjs +2 -0
- package/dist/buildAndBroadcastRefund-CIPPpchL.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-D_QlvCsw.js +777 -0
- package/dist/buildAndBroadcastRefund-D_QlvCsw.js.map +1 -0
- package/dist/challengeAssert-BzxQmdZy.js +128 -0
- package/dist/challengeAssert-BzxQmdZy.js.map +1 -0
- package/dist/challengeAssert-Yyyj-EdR.cjs +2 -0
- package/dist/challengeAssert-Yyyj-EdR.cjs.map +1 -0
- package/dist/errors-9AkghWyk.js +22 -0
- package/dist/errors-9AkghWyk.js.map +1 -0
- package/dist/errors-BP73_stm.cjs +2 -0
- package/dist/errors-BP73_stm.cjs.map +1 -0
- package/dist/errors-Bu0H-dZD.cjs +2 -0
- package/dist/errors-Bu0H-dZD.cjs.map +1 -0
- package/dist/errors-CznAK5NB.js +96 -0
- package/dist/errors-CznAK5NB.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +156 -146
- package/dist/index.js.map +1 -1
- package/dist/mempoolApi-CAIge7Nj.js +205 -0
- package/dist/mempoolApi-CAIge7Nj.js.map +1 -0
- package/dist/mempoolApi-YNkKjQCU.cjs +2 -0
- package/dist/mempoolApi-YNkKjQCU.cjs.map +1 -0
- package/dist/noPayout-BXeUw0Qq.cjs +2 -0
- package/dist/noPayout-BXeUw0Qq.cjs.map +1 -0
- package/dist/noPayout-DBX6G96_.js +141 -0
- package/dist/noPayout-DBX6G96_.js.map +1 -0
- package/dist/payout-BNFMBXS6.js +193 -0
- package/dist/payout-BNFMBXS6.js.map +1 -0
- package/dist/payout-DQ_fmJUA.cjs +2 -0
- package/dist/payout-DQ_fmJUA.cjs.map +1 -0
- package/dist/peginInput-C2QPvuhR.js +177 -0
- package/dist/peginInput-C2QPvuhR.js.map +1 -0
- package/dist/peginInput-tbw9BpZy.cjs +2 -0
- package/dist/peginInput-tbw9BpZy.cjs.map +1 -0
- package/dist/peginState-BijNNT15.cjs +2 -0
- package/dist/peginState-BijNNT15.cjs.map +1 -0
- package/dist/peginState-CBAlxgXk.js +51 -0
- package/dist/peginState-CBAlxgXk.js.map +1 -0
- package/dist/psbtInputFields-2224j2ZY.js +128 -0
- package/dist/psbtInputFields-2224j2ZY.js.map +1 -0
- package/dist/psbtInputFields-B1lrwYzH.cjs +2 -0
- package/dist/psbtInputFields-B1lrwYzH.cjs.map +1 -0
- package/dist/reservation-CHUGW0F_.js +142 -0
- package/dist/reservation-CHUGW0F_.js.map +1 -0
- package/dist/reservation-ho7mjW3X.cjs +2 -0
- package/dist/reservation-ho7mjW3X.cjs.map +1 -0
- package/dist/signing-Bnsro0hE.cjs +2 -0
- package/dist/signing-Bnsro0hE.cjs.map +1 -0
- package/dist/signing-DaLvGwQe.js +16 -0
- package/dist/signing-DaLvGwQe.js.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +31 -30
- package/dist/tbv/core/clients/index.js.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +2 -0
- package/dist/tbv/core/contracts/index.cjs.map +1 -0
- package/dist/tbv/core/contracts/index.js +14 -0
- package/dist/tbv/core/contracts/index.js.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +156 -146
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/index.cjs +2 -0
- package/dist/tbv/core/managers/index.cjs.map +1 -0
- package/dist/tbv/core/managers/index.js +7 -0
- package/dist/tbv/core/managers/index.js.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +31 -29
- package/dist/tbv/core/primitives/index.js.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +28 -27
- package/dist/tbv/core/services/index.js.map +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +21 -20
- package/dist/tbv/core/utils/index.js.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +156 -146
- package/dist/tbv/index.js.map +1 -1
- package/dist/types-ByW6nSLj.js +318 -0
- package/dist/types-ByW6nSLj.js.map +1 -0
- package/dist/types-CfCZyfid.cjs +2 -0
- package/dist/types-CfCZyfid.cjs.map +1 -0
- package/dist/vault-registry-reader-OK2V08tk.cjs +2 -0
- package/dist/vault-registry-reader-OK2V08tk.cjs.map +1 -0
- package/dist/{vault-registry-reader-CWGbw_wZ.js → vault-registry-reader-WiNVOsnD.js} +263 -840
- package/dist/vault-registry-reader-WiNVOsnD.js.map +1 -0
- package/package.json +11 -1
- package/dist/PeginManager-C-L3huRO.js.map +0 -1
- package/dist/PeginManager-DmPmzPHz.cjs +0 -2
- package/dist/PeginManager-DmPmzPHz.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-Dx09Zbla.js +0 -965
- package/dist/buildAndBroadcastRefund-Dx09Zbla.js.map +0 -1
- package/dist/buildAndBroadcastRefund-PmJMNrhO.cjs +0 -2
- package/dist/buildAndBroadcastRefund-PmJMNrhO.cjs.map +0 -1
- package/dist/challengeAssert-D3tHnLWb.js +0 -298
- package/dist/challengeAssert-D3tHnLWb.js.map +0 -1
- package/dist/challengeAssert-Dp9d1bg1.cjs +0 -2
- package/dist/challengeAssert-Dp9d1bg1.cjs.map +0 -1
- package/dist/noPayout-BnsetBKW.js +0 -327
- package/dist/noPayout-BnsetBKW.js.map +0 -1
- package/dist/noPayout-DWaCtpMU.cjs +0 -2
- package/dist/noPayout-DWaCtpMU.cjs.map +0 -1
- package/dist/psbtInputFields-6sRcZqdb.cjs +0 -2
- package/dist/psbtInputFields-6sRcZqdb.cjs.map +0 -1
- package/dist/psbtInputFields-C5QPn1YK.js +0 -264
- package/dist/psbtInputFields-C5QPn1YK.js.map +0 -1
- package/dist/signing-BZigafm0.js +0 -64
- package/dist/signing-BZigafm0.js.map +0 -1
- package/dist/signing-DHSXjhLM.cjs +0 -2
- package/dist/signing-DHSXjhLM.cjs.map +0 -1
- package/dist/types-PthVHz5q.cjs +0 -2
- package/dist/types-PthVHz5q.cjs.map +0 -1
- package/dist/types-SYvSQWnc.js +0 -732
- package/dist/types-SYvSQWnc.js.map +0 -1
- package/dist/vault-registry-reader-CKe9TbX6.cjs +0 -2
- package/dist/vault-registry-reader-CKe9TbX6.cjs.map +0 -1
- package/dist/vault-registry-reader-CWGbw_wZ.js.map +0 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "getVaultKeepersByVersion",
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: "appEntryPoint",
|
|
8
|
+
type: "address",
|
|
9
|
+
internalType: "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "versionNumber",
|
|
13
|
+
type: "uint16",
|
|
14
|
+
internalType: "uint16"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
outputs: [
|
|
18
|
+
{
|
|
19
|
+
name: "",
|
|
20
|
+
type: "tuple[]",
|
|
21
|
+
internalType: "struct BTCVaultTypes.AddressBTCKeyPair[]",
|
|
22
|
+
components: [
|
|
23
|
+
{
|
|
24
|
+
name: "ethAddress",
|
|
25
|
+
type: "address",
|
|
26
|
+
internalType: "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "btcPubKey",
|
|
30
|
+
type: "bytes32",
|
|
31
|
+
internalType: "bytes32"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
stateMutability: "view"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "function",
|
|
40
|
+
name: "getCurrentVaultKeepers",
|
|
41
|
+
inputs: [
|
|
42
|
+
{
|
|
43
|
+
name: "appEntryPoint",
|
|
44
|
+
type: "address",
|
|
45
|
+
internalType: "address"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
outputs: [
|
|
49
|
+
{
|
|
50
|
+
name: "",
|
|
51
|
+
type: "tuple[]",
|
|
52
|
+
internalType: "struct BTCVaultTypes.AddressBTCKeyPair[]",
|
|
53
|
+
components: [
|
|
54
|
+
{
|
|
55
|
+
name: "ethAddress",
|
|
56
|
+
type: "address",
|
|
57
|
+
internalType: "address"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "btcPubKey",
|
|
61
|
+
type: "bytes32",
|
|
62
|
+
internalType: "bytes32"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
stateMutability: "view"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "function",
|
|
71
|
+
name: "getCurrentVaultKeepersVersion",
|
|
72
|
+
inputs: [
|
|
73
|
+
{
|
|
74
|
+
name: "appEntryPoint",
|
|
75
|
+
type: "address",
|
|
76
|
+
internalType: "address"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
outputs: [
|
|
80
|
+
{
|
|
81
|
+
name: "",
|
|
82
|
+
type: "uint16",
|
|
83
|
+
internalType: "uint16"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
stateMutability: "view"
|
|
87
|
+
}
|
|
88
|
+
], t = [
|
|
89
|
+
{
|
|
90
|
+
type: "function",
|
|
91
|
+
name: "getTBVProtocolParams",
|
|
92
|
+
inputs: [],
|
|
93
|
+
outputs: [
|
|
94
|
+
{
|
|
95
|
+
name: "",
|
|
96
|
+
type: "tuple",
|
|
97
|
+
internalType: "struct IProtocolParams.TBVProtocolParams",
|
|
98
|
+
components: [
|
|
99
|
+
{
|
|
100
|
+
name: "minimumPegInAmount",
|
|
101
|
+
type: "uint64",
|
|
102
|
+
internalType: "uint64"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "maxPegInAmount",
|
|
106
|
+
type: "uint64",
|
|
107
|
+
internalType: "uint64"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "pegInAckTimeout",
|
|
111
|
+
type: "uint64",
|
|
112
|
+
internalType: "uint64"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "pegInActivationTimeout",
|
|
116
|
+
type: "uint64",
|
|
117
|
+
internalType: "uint64"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "maxHtlcOutputCount",
|
|
121
|
+
type: "uint8",
|
|
122
|
+
internalType: "uint8"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
stateMutability: "view"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: "function",
|
|
131
|
+
name: "getLatestOffchainParams",
|
|
132
|
+
inputs: [],
|
|
133
|
+
outputs: [
|
|
134
|
+
{
|
|
135
|
+
name: "",
|
|
136
|
+
type: "tuple",
|
|
137
|
+
internalType: "struct IProtocolParams.VersionedOffchainParams",
|
|
138
|
+
components: [
|
|
139
|
+
{
|
|
140
|
+
name: "timelockAssert",
|
|
141
|
+
type: "uint256",
|
|
142
|
+
internalType: "uint256"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "timelockChallengeAssert",
|
|
146
|
+
type: "uint256",
|
|
147
|
+
internalType: "uint256"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "securityCouncilKeys",
|
|
151
|
+
type: "bytes32[]",
|
|
152
|
+
internalType: "bytes32[]"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "councilQuorum",
|
|
156
|
+
type: "uint8",
|
|
157
|
+
internalType: "uint8"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "feeRate",
|
|
161
|
+
type: "uint64",
|
|
162
|
+
internalType: "uint64"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "babeTotalInstances",
|
|
166
|
+
type: "uint16",
|
|
167
|
+
internalType: "uint16"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "babeInstancesToFinalize",
|
|
171
|
+
type: "uint8",
|
|
172
|
+
internalType: "uint8"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "minVpCommissionBps",
|
|
176
|
+
type: "uint16",
|
|
177
|
+
internalType: "uint16"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "tRefund",
|
|
181
|
+
type: "uint32",
|
|
182
|
+
internalType: "uint32"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "tStale",
|
|
186
|
+
type: "uint32",
|
|
187
|
+
internalType: "uint32"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "minPeginFeeRate",
|
|
191
|
+
type: "uint64",
|
|
192
|
+
internalType: "uint64"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "proverProgramVersion",
|
|
196
|
+
type: "uint16",
|
|
197
|
+
internalType: "uint16"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "minPrepeginDepth",
|
|
201
|
+
type: "uint32",
|
|
202
|
+
internalType: "uint32"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
stateMutability: "view"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: "function",
|
|
211
|
+
name: "getOffchainParamsByVersion",
|
|
212
|
+
inputs: [
|
|
213
|
+
{
|
|
214
|
+
name: "versionNumber",
|
|
215
|
+
type: "uint16",
|
|
216
|
+
internalType: "uint16"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
outputs: [
|
|
220
|
+
{
|
|
221
|
+
name: "",
|
|
222
|
+
type: "tuple",
|
|
223
|
+
internalType: "struct IProtocolParams.VersionedOffchainParams",
|
|
224
|
+
components: [
|
|
225
|
+
{
|
|
226
|
+
name: "timelockAssert",
|
|
227
|
+
type: "uint256",
|
|
228
|
+
internalType: "uint256"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "timelockChallengeAssert",
|
|
232
|
+
type: "uint256",
|
|
233
|
+
internalType: "uint256"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "securityCouncilKeys",
|
|
237
|
+
type: "bytes32[]",
|
|
238
|
+
internalType: "bytes32[]"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "councilQuorum",
|
|
242
|
+
type: "uint8",
|
|
243
|
+
internalType: "uint8"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "feeRate",
|
|
247
|
+
type: "uint64",
|
|
248
|
+
internalType: "uint64"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: "babeTotalInstances",
|
|
252
|
+
type: "uint16",
|
|
253
|
+
internalType: "uint16"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "babeInstancesToFinalize",
|
|
257
|
+
type: "uint8",
|
|
258
|
+
internalType: "uint8"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "minVpCommissionBps",
|
|
262
|
+
type: "uint16",
|
|
263
|
+
internalType: "uint16"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "tRefund",
|
|
267
|
+
type: "uint32",
|
|
268
|
+
internalType: "uint32"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: "tStale",
|
|
272
|
+
type: "uint32",
|
|
273
|
+
internalType: "uint32"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: "minPeginFeeRate",
|
|
277
|
+
type: "uint64",
|
|
278
|
+
internalType: "uint64"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: "proverProgramVersion",
|
|
282
|
+
type: "uint16",
|
|
283
|
+
internalType: "uint16"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "minPrepeginDepth",
|
|
287
|
+
type: "uint32",
|
|
288
|
+
internalType: "uint32"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
stateMutability: "view"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
type: "function",
|
|
297
|
+
name: "latestOffchainParamsVersion",
|
|
298
|
+
inputs: [],
|
|
299
|
+
outputs: [
|
|
300
|
+
{
|
|
301
|
+
name: "",
|
|
302
|
+
type: "uint16",
|
|
303
|
+
internalType: "uint16"
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
stateMutability: "view"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
type: "function",
|
|
310
|
+
name: "getUniversalChallengersByVersion",
|
|
311
|
+
inputs: [
|
|
312
|
+
{
|
|
313
|
+
name: "versionNumber",
|
|
314
|
+
type: "uint16",
|
|
315
|
+
internalType: "uint16"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
outputs: [
|
|
319
|
+
{
|
|
320
|
+
name: "",
|
|
321
|
+
type: "tuple[]",
|
|
322
|
+
internalType: "struct BTCVaultTypes.AddressBTCKeyPair[]",
|
|
323
|
+
components: [
|
|
324
|
+
{
|
|
325
|
+
name: "ethAddress",
|
|
326
|
+
type: "address",
|
|
327
|
+
internalType: "address"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "btcPubKey",
|
|
331
|
+
type: "bytes32",
|
|
332
|
+
internalType: "bytes32"
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
stateMutability: "view"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
type: "function",
|
|
341
|
+
name: "getCurrentUniversalChallengers",
|
|
342
|
+
inputs: [],
|
|
343
|
+
outputs: [
|
|
344
|
+
{
|
|
345
|
+
name: "",
|
|
346
|
+
type: "tuple[]",
|
|
347
|
+
internalType: "struct BTCVaultTypes.AddressBTCKeyPair[]",
|
|
348
|
+
components: [
|
|
349
|
+
{
|
|
350
|
+
name: "ethAddress",
|
|
351
|
+
type: "address",
|
|
352
|
+
internalType: "address"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: "btcPubKey",
|
|
356
|
+
type: "bytes32",
|
|
357
|
+
internalType: "bytes32"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
stateMutability: "view"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
type: "function",
|
|
366
|
+
name: "latestUniversalChallengersVersion",
|
|
367
|
+
inputs: [],
|
|
368
|
+
outputs: [
|
|
369
|
+
{
|
|
370
|
+
name: "",
|
|
371
|
+
type: "uint16",
|
|
372
|
+
internalType: "uint16"
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
stateMutability: "view"
|
|
376
|
+
}
|
|
377
|
+
];
|
|
378
|
+
export {
|
|
379
|
+
e as A,
|
|
380
|
+
t as P
|
|
381
|
+
};
|
|
382
|
+
//# sourceMappingURL=ProtocolParams.abi-DXu8L0Fn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtocolParams.abi-DXu8L0Fn.js","sources":["../src/tbv/core/contracts/abis/ApplicationRegistry.abi.ts","../src/tbv/core/contracts/abis/ProtocolParams.abi.ts"],"sourcesContent":["/**\n * ApplicationRegistry Contract ABI\n *\n * Minimal ABI containing only the vault keeper read functions needed by the SDK.\n * Generated from vault-contracts-aave-v4 IApplicationRegistry.sol interface.\n *\n * @module contracts/abis/ApplicationRegistry\n */\n\nexport const ApplicationRegistryABI = [\n {\n type: \"function\",\n name: \"getVaultKeepersByVersion\",\n inputs: [\n {\n name: \"appEntryPoint\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"versionNumber\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"tuple[]\",\n internalType: \"struct BTCVaultTypes.AddressBTCKeyPair[]\",\n components: [\n {\n name: \"ethAddress\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"btcPubKey\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getCurrentVaultKeepers\",\n inputs: [\n {\n name: \"appEntryPoint\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"tuple[]\",\n internalType: \"struct BTCVaultTypes.AddressBTCKeyPair[]\",\n components: [\n {\n name: \"ethAddress\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"btcPubKey\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getCurrentVaultKeepersVersion\",\n inputs: [\n {\n name: \"appEntryPoint\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n] as const;\n","/**\n * ProtocolParams Contract ABI\n *\n * Minimal ABI containing only the read functions needed by the SDK.\n * Generated from vault-contracts-aave-v4 IProtocolParams.sol interface.\n *\n * @module contracts/abis/ProtocolParams\n */\n\nexport const ProtocolParamsABI = [\n {\n type: \"function\",\n name: \"getTBVProtocolParams\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"tuple\",\n internalType: \"struct IProtocolParams.TBVProtocolParams\",\n components: [\n {\n name: \"minimumPegInAmount\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxPegInAmount\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"pegInAckTimeout\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"pegInActivationTimeout\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxHtlcOutputCount\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getLatestOffchainParams\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"tuple\",\n internalType: \"struct IProtocolParams.VersionedOffchainParams\",\n components: [\n {\n name: \"timelockAssert\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"timelockChallengeAssert\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"securityCouncilKeys\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"councilQuorum\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"feeRate\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"babeTotalInstances\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"babeInstancesToFinalize\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"minVpCommissionBps\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"tRefund\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n {\n name: \"tStale\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n {\n name: \"minPeginFeeRate\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"proverProgramVersion\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"minPrepeginDepth\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getOffchainParamsByVersion\",\n inputs: [\n {\n name: \"versionNumber\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"tuple\",\n internalType: \"struct IProtocolParams.VersionedOffchainParams\",\n components: [\n {\n name: \"timelockAssert\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"timelockChallengeAssert\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"securityCouncilKeys\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"councilQuorum\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"feeRate\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"babeTotalInstances\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"babeInstancesToFinalize\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"minVpCommissionBps\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"tRefund\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n {\n name: \"tStale\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n {\n name: \"minPeginFeeRate\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"proverProgramVersion\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n {\n name: \"minPrepeginDepth\",\n type: \"uint32\",\n internalType: \"uint32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"latestOffchainParamsVersion\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getUniversalChallengersByVersion\",\n inputs: [\n {\n name: \"versionNumber\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"tuple[]\",\n internalType: \"struct BTCVaultTypes.AddressBTCKeyPair[]\",\n components: [\n {\n name: \"ethAddress\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"btcPubKey\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getCurrentUniversalChallengers\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"tuple[]\",\n internalType: \"struct BTCVaultTypes.AddressBTCKeyPair[]\",\n components: [\n {\n name: \"ethAddress\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"btcPubKey\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"latestUniversalChallengersVersion\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint16\",\n internalType: \"uint16\",\n },\n ],\n stateMutability: \"view\",\n },\n] as const;\n"],"names":["ApplicationRegistryABI","ProtocolParamsABI"],"mappings":"AASO,MAAMA,IAAyB;AAAA,EACpC;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,MACN;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,cAAc;AAAA,MAAA;AAAA,MAEhB;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEF,SAAS;AAAA,MACP;AAAA,QACE,MAA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A,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,cAAc;AAAA,QACd,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,cAAc;AAAA,UAAA;AAAA,UAEhB;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,cAAc;AAAA,UAAA;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,IAEF,iBAAiB;AAAA,EAAA;AAAA,EAEnB;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ,CAAA;AAAA,IACR,SAAS;AAAA,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEF,iBAAiB;AAAA,EAAA;AAErB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var U=Object.defineProperty;var X=(e,t,r)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var w=(e,t,r)=>X(e,typeof t!="symbol"?t+"":t,r);const z=require("./BTCVaultRegistry.abi-ZdPpION2.cjs"),c=require("./bitcoin-B3aqjuMP.cjs"),$=require("./PayoutManager-DDnNB0mj.cjs"),p=require("./types-CfCZyfid.cjs"),P=require("bitcoinjs-lib"),q=require("buffer"),k=require("./noPayout-BXeUw0Qq.cjs"),b=require("./payout-DQ_fmJUA.cjs"),E=require("./signing-Bnsro0hE.cjs");function G(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const W=G(P),Q=/^0x[0-9a-fA-F]{64}$/,Y=/^0x[0-9a-fA-F]{40}$/,j=/^0x([0-9a-fA-F]{2})*$/;function v(e,t){if(e.length!==66)throw new Error(`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`);if(!Q.test(e))throw new Error(`${t} must contain only hex characters after the 0x prefix`)}function Z(e,t){if(!Y.test(e))throw new Error(`${t} must be a 20-byte 0x-prefixed hex address (42 chars)`)}function J(e,t){if(!j.test(e))throw new Error(`${t} must be a 0x-prefixed hex string with an even number of hex chars`)}async function ee(e){const{btcVaultRegistryAddress:t,vaultId:r,hashlock:o,activationMetadata:a,writeContract:u,signal:n}=e;n==null||n.throwIfAborted(),Z(t,"btcVaultRegistryAddress"),v(r,"vaultId");const s=c.ensureHexPrefix(e.secret);if(v(s,"secret"),o!==void 0&&(v(o,"hashlock"),!$.validateSecretAgainstHashlock(s,o)))throw new Error("Invalid secret: SHA256(secret) does not match the provided hashlock");return J(a,"activationMetadata"),u({address:t,abi:z.BTCVaultRegistryABI,functionName:"activateVaultWithSecret",args:[r,s,a]})}const te=1e4;async function _(e){const{statusReader:t,peginTxid:r,targetStatuses:o,timeoutMs:a,pollIntervalMs:u=te,signal:n}=e,s=Date.now();for(;;){if(n!=null&&n.aborted)throw new Error(`Polling aborted for pegin ${r.slice(0,8)}… (target: ${[...o].join(", ")})`);if(Date.now()-s>=a)throw new Error(`Polling timeout after ${a}ms for pegin ${r.slice(0,8)}… (target: ${[...o].join(", ")})`);try{const l=(await t.getPeginStatus({pegin_txid:r},n)).status;if(o.has(l))return l;if(p.VP_TERMINAL_STATUSES.has(l)&&!o.has(l))throw new Error(`Pegin ${r.slice(0,8)}… reached terminal status "${l}" while waiting for ${[...o].join(", ")}`)}catch(i){if(!(i instanceof p.JsonRpcError&&i.code===p.RpcErrorCode.NOT_FOUND||i instanceof Error&&i.message.includes("PegIn not found")))throw i}await new Promise((i,l)=>{const d=()=>{clearTimeout(f),l(new Error(`Polling aborted for pegin ${r.slice(0,8)}… (target: ${[...o].join(", ")})`))},f=setTimeout(()=>{n==null||n.removeEventListener("abort",d),i()},u);n==null||n.addEventListener("abort",d,{once:!0})})}}const re=300*1e3,oe=new Set([p.DaemonStatus.PENDING_DEPOSITOR_WOTS_PK,...p.POST_WOTS_STATUSES]);async function ne(e){const{statusReader:t,wotsSubmitter:r,peginTxid:o,depositorPk:a,wotsPublicKeys:u,timeoutMs:n=re,signal:s}=e;s==null||s.throwIfAborted();const i=await _({statusReader:t,peginTxid:o,targetStatuses:oe,timeoutMs:n,signal:s});p.POST_WOTS_STATUSES.has(i)||(s==null||s.throwIfAborted(),await r.submitDepositorWotsKey({pegin_txid:o,depositor_pk:a,wots_public_keys:u},s))}const C=1;function ie(e,t,r){const o=c.stripHexPrefix(r).toLowerCase(),u=[e,...t].map(n=>c.stripHexPrefix(n).toLowerCase()).filter(n=>n!==o);if(u.length===0)throw new Error("Cannot derive localChallengers: removing depositor from {vaultProvider, vaultKeepers} left an empty set");return u}function ae(e,t){const r=e.ins[t];return c.uint8ArrayToHex(new Uint8Array(r.hash).slice().reverse())}function T(e,t,r,o,a){const u=e.ins[t];if(u.index!==0)throw new Error(`NoPayout (challenger ${a}) input ${t} expected to spend ${o} vout 0, got vout ${u.index}`);const n=r.getId(),s=ae(e,t);if(s!==n)throw new Error(`NoPayout (challenger ${a}) input ${t} does not reference ${o} (expected txid ${n}, got ${s})`)}async function se(e,t,r){const o=[],a=[],u=[];b.assertPayoutOutputMatchesRegistered(e.payout_tx.tx_hex,r.registeredPayoutScriptPubKey);const n=await b.buildPayoutPsbt({payoutTxHex:e.payout_tx.tx_hex,peginTxHex:r.peginTxHex,assertTxHex:e.assert_tx.tx_hex,depositorBtcPubkey:r.depositorBtcPubkey,vaultProviderBtcPubkey:r.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:r.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:r.universalChallengerBtcPubkeys,timelockPegin:r.timelockPegin,network:r.network});o.push(n.psbtHex),a.push(E.createTaprootScriptPathSignOptions(t,C));const s=ie(r.vaultProviderBtcPubkey,r.vaultKeeperBtcPubkeys,r.depositorBtcPubkey),i=c.stripHexPrefix(r.depositorBtcPubkey),l=P.Transaction.fromHex(c.stripHexPrefix(e.assert_tx.tx_hex));for(const d of e.challenger_presign_data){const f=c.stripHexPrefix(d.challenger_pubkey),g=o.length,y=await ue({challenger:d,challengerPubkey:f,claimerPubkey:i,localChallengers:s,assertTxParsed:l,ctx:r});o.push(y),a.push(E.createTaprootScriptPathSignOptions(t,C)),u.push({challengerPubkey:f,noPayoutIdx:g})}return{psbtHexes:o,signOptions:a,challengerEntries:u}}async function ue(e){const{challenger:t,challengerPubkey:r,claimerPubkey:o,localChallengers:a,assertTxParsed:u,ctx:n}=e;k.assertNoPayoutOutputMatchesChallenger(t.nopayout_tx.tx_hex,r,n.network);const s=P.Transaction.fromHex(c.stripHexPrefix(t.nopayout_tx.tx_hex)),i=P.Transaction.fromHex(c.stripHexPrefix(t.challenge_assert_x_tx.tx_hex)),l=P.Transaction.fromHex(c.stripHexPrefix(t.challenge_assert_y_tx.tx_hex));if(s.ins.length!==3)throw new Error(`NoPayout (challenger ${r}) must have exactly 3 inputs, got ${s.ins.length}`);T(s,0,u,"Assert",r),T(s,1,i,"ChallengeAssertX",r),T(s,2,l,"ChallengeAssertY",r);const d=[u.outs[0],i.outs[0],l.outs[0]].map(f=>({script_pubkey:c.uint8ArrayToHex(new Uint8Array(f.script)),value:f.value}));return k.buildNoPayoutPsbt({noPayoutTxHex:t.nopayout_tx.tx_hex,challengerPubkey:r,prevouts:d,connectorParams:{claimer:o,localChallengers:a,universalChallengers:n.universalChallengerBtcPubkeys,timelockAssert:n.timelockAssert,councilMembers:n.councilMembers,councilQuorum:n.councilQuorum}})}function le(e,t,r){const o=b.extractPayoutSignature(e[0],r),a={};for(const u of t)a[u.challengerPubkey]={nopayout_signature:b.extractPayoutSignature(e[u.noPayoutIdx],r)};return{payout_signatures:{payout_signature:o},per_challenger:a}}async function ce(e,t,r){if(typeof e.signPsbts=="function")return e.signPsbts(t,r);const o=[];for(let a=0;a<t.length;a++)o.push(await e.signPsbt(t[a],r==null?void 0:r[a]));return o}async function O(e){const{depositorGraph:t,btcWallet:r,signingContext:o}=e,a=c.stripHexPrefix(o.depositorBtcPubkey),u=await r.getPublicKeyHex(),{psbtHexes:n,signOptions:s,challengerEntries:i}=await se(t,u,o),l=await ce(r,n,s);if(l.length!==n.length)throw new Error(`Wallet returned ${l.length} signed PSBTs, expected ${n.length}`);return le(l,i,a)}const fe=1200*1e3,N=new Set([p.DaemonStatus.PENDING_ACKS,p.DaemonStatus.PENDING_ACTIVATION,p.DaemonStatus.ACTIVATED]),de=new Set([p.DaemonStatus.PENDING_DEPOSITOR_SIGNATURES,...N]);function pe(e){return e.map(t=>({claimerPubkeyXOnly:c.processPublicKeyToXOnly(t.claimer_pubkey),payoutTxHex:t.payout_tx.tx_hex,assertTxHex:t.assert_tx.tx_hex}))}function he(e){const{output:t}=W.payments.p2tr({internalPubkey:q.Buffer.from(e,"hex")});if(!t)throw new Error("Failed to derive BIP-86 P2TR scriptPubKey");return t.toString("hex")}function Pe(e,t){const r=c.stripHexPrefix(e).toLowerCase(),o=c.stripHexPrefix(t.vaultProviderBtcPubkey).toLowerCase(),a=c.stripHexPrefix(t.depositorBtcPubkey).toLowerCase();if(r===o||r===a)return t.registeredPayoutScriptPubKey;if(!t.vaultKeeperBtcPubkeys.some(s=>c.stripHexPrefix(s).toLowerCase()===r))throw new Error(`Unknown claimer pubkey ${r}: not VP, depositor, or a registered vault keeper`);return`0x${he(r)}`}function R(e,t){return{payoutTxHex:e.payoutTxHex,peginTxHex:t.peginTxHex,assertTxHex:e.assertTxHex,vaultProviderBtcPubkey:t.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:t.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:t.universalChallengerBtcPubkeys,depositorBtcPubkey:t.depositorBtcPubkey,timelockPegin:t.timelockPegin,registeredPayoutScriptPubKey:Pe(e.claimerPubkeyXOnly,t)}}async function ge(e,t,r,o){const a=new $.PayoutManager({network:t.network,btcWallet:e}),u=r.length;o==null||o(0,u);let n;if(a.supportsBatchSigning())n=(await a.signPayoutTransactionsBatch(r.map(l=>R(l,t)))).map(l=>l.payoutSignature);else{n=[];for(let i=0;i<r.length;i++){o==null||o(i,u);const l=await a.signPayoutTransaction(R(r[i],t));n.push(l.signature)}}const s={};for(let i=0;i<r.length;i++)s[r[i].claimerPubkeyXOnly]={payout_signature:n[i]};return o==null||o(u,u),s}async function ye(e){const{statusReader:t,presignClient:r,btcWallet:o,peginTxid:a,depositorPk:u,signingContext:n,timeoutMs:s=fe,signal:i,onProgress:l}=e,d=await _({statusReader:t,peginTxid:a,targetStatuses:de,timeoutMs:s,signal:i});if(N.has(d))return;i==null||i.throwIfAborted();const f=await r.requestDepositorPresignTransactions({pegin_txid:a,depositor_pk:u},i);i==null||i.throwIfAborted();const g=c.processPublicKeyToXOnly(u),y=f.txs.filter(F=>c.processPublicKeyToXOnly(F.claimer_pubkey)!==g),m=pe(y),x=await ge(o,n,m,l);i==null||i.throwIfAborted();const h=await O({depositorGraph:f.depositor_graph,btcWallet:o,signingContext:{peginTxHex:n.peginTxHex,depositorBtcPubkey:u,vaultProviderBtcPubkey:n.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:n.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:n.universalChallengerBtcPubkeys,timelockPegin:n.timelockPegin,timelockAssert:n.timelockAssert,councilMembers:n.councilMembers,councilQuorum:n.councilQuorum,network:n.network,registeredPayoutScriptPubKey:n.registeredPayoutScriptPubKey}});i==null||i.throwIfAborted();const I={...x};I[c.stripHexPrefix(u)]=h.payout_signatures,await r.submitDepositorPresignatures({pegin_txid:a,depositor_pk:u,signatures:I,depositor_claimer_presignatures:h},i)}function be(e){return/^[0-9a-fA-F]{64}$/.test(e)}function me(e){const{amountSats:t,minDeposit:r,maxDeposit:o,btcBalance:a,estimatedFeeSats:u,depositorClaimValue:n}=e;return!(t<=0n||t<r||o&&o>0n&&t>o||u==null||n==null||t+u+n>a)}function xe(e,t,r){return e<=0n?{valid:!1,error:"Deposit amount must be greater than zero"}:e<t?{valid:!1,error:`Minimum deposit is ${c.formatSatoshisToBtc(t)} BTC`}:r&&r>0n&&e>r?{valid:!1,error:`Maximum deposit is ${c.formatSatoshisToBtc(r)} BTC`}:{valid:!0}}function we(e){const{amount:t,effectiveRemaining:r}=e;return r===null?{valid:!0}:r===0n?{valid:!1,error:"Supply cap reached — deposits temporarily paused"}:t>r?{valid:!1,error:`Vault size exceeds remaining capacity (${c.formatSatoshisToBtc(r)} BTC)`}:{valid:!0}}function ve(e,t){if(!e||e.length===0)return{valid:!1,error:"At least one vault provider must be selected"};const r=t.map(a=>a.toLowerCase());return e.filter(a=>!r.includes(a.toLowerCase())).length>0?{valid:!1,error:"Invalid vault provider selected"}:{valid:!0}}function D(e,t,r){if(!e||e.length===0)return{valid:!1,error:"At least one vault amount required"};for(let o=0;o<e.length;o++){const a=e[o];if(a<=0n)return{valid:!1,error:`Vault ${o+1} amount must be positive`};if(t&&a<t)return{valid:!1,error:`Vault ${o+1} amount ${c.formatSatoshisToBtc(a)} BTC is below minimum deposit ${c.formatSatoshisToBtc(t)} BTC`};if(r&&a>r)return{valid:!1,error:`Vault ${o+1} amount ${c.formatSatoshisToBtc(a)} BTC exceeds maximum deposit ${c.formatSatoshisToBtc(r)} BTC`}}return{valid:!0}}function V(e){const t=c.stripHexPrefix(e);return be(t)?{valid:!0}:{valid:!1,error:"Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"}}function Te(e){if(!e||e.length===0)throw new Error("No vault keepers available. The system requires at least one vault keeper to create a deposit.")}function Se(e){if(!e||e.length===0)throw new Error("No universal challengers available. The system requires at least one universal challenger to create a deposit.")}function ke(e){if(e.length===0)throw new Error("No spendable UTXOs available")}function Ee(e){const{vaultAmounts:t,confirmedUTXOs:r,vaultProviderBtcPubkey:o,vaultKeeperBtcPubkeys:a,universalChallengerBtcPubkeys:u,minDeposit:n,maxDeposit:s}=e,i=D(t,n,s);if(!i.valid)throw new Error(i.error);const l=V(o);if(!l.valid)throw new Error(l.error);Te(a),Se(u),ke(r)}var A=(e=>(e.CLAIM_EVENT_RECEIVED="ClaimEventReceived",e.CLAIM_BROADCAST="ClaimBroadcast",e.ASSERT_BROADCAST="AssertBroadcast",e.CHALLENGE_ASSERT_OBSERVED="ChallengeAssertObserved",e.WRONGLY_CHALLENGED_BROADCAST="WronglyChallengedBroadcast",e.PAYOUT_BROADCAST="PayoutBroadcast",e.FAILED="Failed",e))(A||{});const _e=new Set(["PayoutBroadcast","Failed"]);function Ae(e){return Object.values(A).includes(e)}function Be(e){return!!e&&_e.has(e)}class K extends Error{constructor(r,o){super(`Refund not yet mature (BIP68 not final): ${o.message}`);w(this,"vaultId");w(this,"cause");this.name="BIP68NotMatureError",this.vaultId=r,this.cause=o}}const Ie=/^0x[0-9a-fA-F]{64}$/,Ce=/^(?:0x)?(?:[0-9a-fA-F]{2})+$/,M=/^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/,B=160;function Re(e){if(!Number.isFinite(e)||e<=0)throw new Error(`feeRateSatsVb must be a positive finite number, got ${e}`);return BigInt(Math.ceil(e*B))}const He=1,H=65535,$e=/non-BIP68-final/i;function L(e,t){if(e.length!==66)throw new Error(`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`);if(!Ie.test(e))throw new Error(`${t} must contain only hex characters after the 0x prefix`)}function S(e,t){if(!Number.isInteger(e)||e<0)throw new Error(`${t} must be a non-negative integer, got ${e}`)}function Oe(e){if(L(e.hashlock,"hashlock"),!Number.isInteger(e.htlcVout)||e.htlcVout<0||e.htlcVout>H)throw new Error(`htlcVout must be an integer 0-${H}, got ${e.htlcVout}`);if(S(e.offchainParamsVersion,"offchainParamsVersion"),S(e.appVaultKeepersVersion,"appVaultKeepersVersion"),S(e.universalChallengersVersion,"universalChallengersVersion"),typeof e.unsignedPrePeginTxHex!="string"||e.unsignedPrePeginTxHex.length===0)throw new Error("unsignedPrePeginTxHex must be a non-empty hex string");if(!Ce.test(e.unsignedPrePeginTxHex))throw new Error("unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)");if(!e.depositorBtcPubkey||!M.test(e.depositorBtcPubkey))throw new Error("depositorBtcPubkey must be 32 or 33 bytes of hex (optional 0x prefix)");if(typeof e.amount!="bigint"||e.amount<=0n)throw new Error(`amount must be a positive bigint, got ${e.amount}`)}function Ne(e){if(!e.vaultProviderPubkey||!M.test(e.vaultProviderPubkey))throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");if(e.vaultKeeperPubkeys.length===0)throw new Error("vaultKeeperPubkeys must be non-empty");if(e.universalChallengerPubkeys.length===0)throw new Error("universalChallengerPubkeys must be non-empty");if(!Number.isInteger(e.timelockRefund)||e.timelockRefund<=0)throw new Error(`timelockRefund must be a positive integer, got ${e.timelockRefund}`);if(typeof e.feeRate!="bigint"||e.feeRate<=0n)throw new Error(`protocol feeRate must be a positive bigint, got ${e.feeRate}`);if(!Number.isInteger(e.numLocalChallengers)||e.numLocalChallengers<0)throw new Error("numLocalChallengers must be a non-negative integer");if(!Number.isInteger(e.councilQuorum)||!Number.isInteger(e.councilSize)||e.councilQuorum<=0||e.councilSize<=0||e.councilQuorum>e.councilSize)throw new Error(`councilQuorum (${e.councilQuorum}) must be in [1, councilSize=${e.councilSize}]`)}function De(e){const t=P.Psbt.fromHex(e);try{t.finalizeAllInputs()}catch(r){const o=r instanceof Error?r.message:String(r);if(!o.includes("already finalized"))throw new Error(`Failed to finalize refund PSBT: ${o}`)}return t.extractTransaction().toHex()}async function Ve(e){const{vaultId:t,readVault:r,readPrePeginContext:o,feeRate:a,signPsbt:u,broadcastTx:n,signal:s}=e;s==null||s.throwIfAborted(),L(t,"vaultId");const i=await r();Oe(i),s==null||s.throwIfAborted();const l=await o(i);if(Ne(l),s==null||s.throwIfAborted(),!Number.isFinite(a)||a<=0)throw new Error(`feeRate must be a positive number, got ${a}`);const d=BigInt(Math.ceil(a*B));s==null||s.throwIfAborted();const f=c.processPublicKeyToXOnly(i.depositorBtcPubkey),{psbtHex:g}=await k.buildRefundPsbt({prePeginParams:{depositorPubkey:f,vaultProviderPubkey:c.stripHexPrefix(l.vaultProviderPubkey),vaultKeeperPubkeys:l.vaultKeeperPubkeys.map(c.stripHexPrefix),universalChallengerPubkeys:l.universalChallengerPubkeys.map(c.stripHexPrefix),hashlocks:[c.stripHexPrefix(i.hashlock)],timelockRefund:l.timelockRefund,pegInAmounts:[i.amount],feeRate:l.feeRate,numLocalChallengers:l.numLocalChallengers,councilQuorum:l.councilQuorum,councilSize:l.councilSize,network:l.network},fundedPrePeginTxHex:c.stripHexPrefix(i.unsignedPrePeginTxHex),htlcVout:i.htlcVout,refundFee:d,hashlock:c.stripHexPrefix(i.hashlock)});s==null||s.throwIfAborted();const y=E.createTaprootScriptPathSignOptions(i.depositorBtcPubkey,He),m=await u(g,y),x=De(m);s==null||s.throwIfAborted();try{return await n(x)}catch(h){throw h instanceof Error&&$e.test(h.message)?new K(t,h):h}}exports.BIP68NotMatureError=K;exports.ClaimerPegoutStatusValue=A;exports.REFUND_VSIZE=B;exports.activateVault=ee;exports.buildAndBroadcastRefund=Ve;exports.estimateRefundFeeSats=Re;exports.isDepositAmountValid=me;exports.isPegoutTerminalStatus=Be;exports.isRecognizedPegoutStatus=Ae;exports.runDepositorPresignFlow=ye;exports.signDepositorGraph=O;exports.submitWotsPublicKey=ne;exports.validateDepositAmount=xe;exports.validateMultiVaultDepositInputs=Ee;exports.validateProviderSelection=ve;exports.validateRemainingCapacity=we;exports.validateVaultAmounts=D;exports.validateVaultProviderPubkey=V;exports.waitForPeginStatus=_;
|
|
2
|
+
//# sourceMappingURL=buildAndBroadcastRefund-CIPPpchL.cjs.map
|