@babylonlabs-io/ts-sdk 0.21.0 → 0.23.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/{buildAndBroadcastRefund-DWEQvj9T.cjs → buildAndBroadcastRefund-BDGGbGeK.cjs} +2 -2
- package/dist/buildAndBroadcastRefund-BDGGbGeK.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-DnTQkCgG.js → buildAndBroadcastRefund-D7NCbgtv.js} +79 -77
- package/dist/buildAndBroadcastRefund-D7NCbgtv.js.map +1 -0
- package/dist/errors-BcpQEG62.cjs +2 -0
- package/dist/errors-BcpQEG62.cjs.map +1 -0
- package/dist/errors-D3a9XcIX.js +1275 -0
- package/dist/errors-D3a9XcIX.js.map +1 -0
- package/dist/{index-DNSV--0P.cjs → index-BAECy2oz.cjs} +2 -2
- package/dist/{index-DNSV--0P.cjs.map → index-BAECy2oz.cjs.map} +1 -1
- package/dist/{index-BORWfdUU.js → index-DLtpqdlu.js} +3 -2
- package/dist/{index-BORWfdUU.js.map → index-DLtpqdlu.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +36 -35
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +16 -15
- package/dist/tbv/core/clients/vault-provider/index.d.ts +1 -1
- package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +34 -33
- package/dist/tbv/core/managers/PayoutManager.d.ts +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +57 -51
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.d.ts +7 -6
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +5 -1
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +34 -33
- package/dist/testing/MockBitcoinWallet.d.ts +2 -2
- package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +14 -14
- package/dist/testing/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-DnTQkCgG.js.map +0 -1
- package/dist/errors-Cbyg_QQf.cjs +0 -2
- package/dist/errors-Cbyg_QQf.cjs.map +0 -1
- package/dist/errors-DvIudLXV.js +0 -1232
- package/dist/errors-DvIudLXV.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { i as e, g as t, h as o, d as r, a as i, b as l, c as n, e as u, f as P } from "./challengeAssert-D1lpvuMv.js";
|
|
2
2
|
import { computeMinClaimValue as c, deriveVaultId as T } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { a as S, b as E, c as
|
|
4
|
-
import { d as _, a as m, e as x, f as b, g as
|
|
5
|
-
import { C as V, P as
|
|
3
|
+
import { a as S, b as E, c as A, e as g } from "./payout-DzGsAnhf.js";
|
|
4
|
+
import { d as _, a as m, e as x, f as b, g as f, h as I, i as v, b as C, p as U, s as y, t as O, u as h, v as B } from "./bitcoin-nOOgeRyl.js";
|
|
5
|
+
import { C as V, P as D, a as F, c as M, g as H } from "./signing-DeWVBl7m.js";
|
|
6
6
|
import { B as k, H as W, K, M as X, T as w } from "./validation-CxqROCno.js";
|
|
7
|
-
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as oa, g as ra, d as ia, c as la, j as na, e as ua, f as Pa, w as da } from "./buildAndBroadcastRefund-
|
|
7
|
+
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as oa, g as ra, d as ia, c as la, j as na, e as ua, f as Pa, w as da } from "./buildAndBroadcastRefund-D7NCbgtv.js";
|
|
8
8
|
import { BitcoinNetworks as Ta } from "./shared/index.js";
|
|
9
|
-
import { B as Sa, D as Ea, F as
|
|
10
|
-
import { B as Oa, U as ha, a as Ba, f as Na, c as Va, e as
|
|
11
|
-
import { C as wa, P as Ga, b as Ya, c as Ja, a as ja, d as Za, f as za, e as qa, g as Qa, h as $a, i as as, j as ss, k as es, m as ts } from "./errors-
|
|
12
|
-
import { A as rs, M as is, P as ls, V as ns, i as us, j as Ps, k as ds, l as cs, h as Ts, g as ps, a as Ss, b as Es, c as
|
|
13
|
-
import { B as Is, D as
|
|
9
|
+
import { B as Sa, D as Ea, F as Aa, L as ga, M as Ra, P as _a, a as ma, S as xa, T as ba, W as fa, f as Ia, b as va, p as Ca, r as Ua } from "./fundPeginTransaction-BLYXxLBv.js";
|
|
10
|
+
import { B as Oa, U as ha, a as Ba, f as Na, c as Va, e as Da, g as Fa, i as Ma, h as Ha, s as La, b as ka, d as Wa, v as Ka } from "./psbtInputFields-r1ss6WLU.js";
|
|
11
|
+
import { C as wa, P as Ga, b as Ya, c as Ja, a as ja, d as Za, f as za, e as qa, g as Qa, h as $a, i as as, j as ss, k as es, m as ts } from "./errors-D3a9XcIX.js";
|
|
12
|
+
import { A as rs, M as is, P as ls, V as ns, i as us, j as Ps, k as ds, l as cs, h as Ts, g as ps, a as Ss, b as Es, c as As, d as gs, e as Rs, f as _s, p as ms, r as xs, v as bs } from "./index-DLtpqdlu.js";
|
|
13
|
+
import { B as Is, D as vs, b as Cs, J as Us, a as ys, d as Os, P as hs, R as Bs, c as Ns, V as Vs } from "./types-DWjaqVfP.js";
|
|
14
14
|
export {
|
|
15
15
|
rs as ApplicationRegistryABI,
|
|
16
16
|
Y as BIP68NotMatureError,
|
|
@@ -23,39 +23,39 @@ export {
|
|
|
23
23
|
J as ClaimerPegoutStatusValue,
|
|
24
24
|
V as ContractStatus,
|
|
25
25
|
Ea as DUST_THRESHOLD,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
vs as DaemonStatus,
|
|
27
|
+
Aa as FEE_SAFETY_MARGIN,
|
|
28
28
|
W as HEX_RE,
|
|
29
29
|
Cs as JSON_RPC_ERROR_CODES,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
Us as JsonRpcClient,
|
|
31
|
+
ys as JsonRpcError,
|
|
32
32
|
K as KNOWN_SCRIPT_PREFIXES,
|
|
33
|
-
|
|
33
|
+
ga as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
34
34
|
Ra as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
35
35
|
X as MAX_REASONABLE_FEE_SATS,
|
|
36
36
|
is as MEMPOOL_API_URLS,
|
|
37
37
|
_a as P2TR_INPUT_SIZE,
|
|
38
38
|
ma as PEGIN_FIXED_OUTPUTS,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
Os as POST_WOTS_STATUSES,
|
|
40
|
+
hs as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
41
41
|
j as PayoutManager,
|
|
42
|
-
|
|
42
|
+
D as PeginAction,
|
|
43
43
|
Ga as PeginManager,
|
|
44
44
|
ls as ProtocolParamsABI,
|
|
45
|
-
|
|
45
|
+
Bs as RpcErrorCode,
|
|
46
46
|
xa as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
47
47
|
w as TXID_RE,
|
|
48
48
|
ba as TX_BUFFER_SIZE_OVERHEAD,
|
|
49
49
|
ha as UtxoNotAvailableError,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Ns as VP_TERMINAL_STATUSES,
|
|
51
|
+
Vs as VP_TRANSIENT_STATUSES,
|
|
52
52
|
ns as VaultProviderRpcClient,
|
|
53
53
|
us as ViemProtocolParamsReader,
|
|
54
54
|
Ps as ViemUniversalChallengerReader,
|
|
55
55
|
ds as ViemVaultKeeperReader,
|
|
56
56
|
cs as ViemVaultRegistryReader,
|
|
57
57
|
Ts as VpResponseValidationError,
|
|
58
|
-
|
|
58
|
+
fa as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
59
59
|
Z as activateVault,
|
|
60
60
|
Ba as assertUtxosAvailable,
|
|
61
61
|
z as buildAndBroadcastRefund,
|
|
@@ -68,14 +68,14 @@ export {
|
|
|
68
68
|
l as buildPrePeginPsbt,
|
|
69
69
|
E as buildRefundPsbt,
|
|
70
70
|
Na as calculateBtcTxHash,
|
|
71
|
-
|
|
71
|
+
F as canPerformAction,
|
|
72
72
|
Va as collectReservedUtxoRefs,
|
|
73
73
|
q as computeHashlock,
|
|
74
74
|
c as computeMinClaimValue,
|
|
75
75
|
n as computeNumLocalChallengers,
|
|
76
76
|
Ya as computeWotsBlockPublicKeysHash,
|
|
77
77
|
Ja as computeWotsPkHash,
|
|
78
|
-
|
|
78
|
+
A as createPayoutScript,
|
|
79
79
|
M as createTaprootScriptPathSignOptions,
|
|
80
80
|
_ as deriveNativeSegwitAddress,
|
|
81
81
|
m as deriveTaprootAddress,
|
|
@@ -85,38 +85,38 @@ export {
|
|
|
85
85
|
za as deriveWotsPkHash,
|
|
86
86
|
x as ensureHexPrefix,
|
|
87
87
|
qa as extractErrorData,
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
Da as extractInputsFromTransaction,
|
|
89
|
+
g as extractPayoutSignature,
|
|
90
90
|
u as extractPeginInputSignature,
|
|
91
91
|
P as finalizePeginInputPsbt,
|
|
92
92
|
b as formatSatoshisToBtc,
|
|
93
|
-
|
|
93
|
+
Ia as fundPeginTransaction,
|
|
94
94
|
ps as getAddressTxs,
|
|
95
95
|
Ss as getAddressUtxos,
|
|
96
96
|
Qa as getContractErrorMessage,
|
|
97
|
-
|
|
97
|
+
Fa as getDustThreshold,
|
|
98
98
|
Es as getMempoolApiUrl,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
f as getNetwork,
|
|
100
|
+
As as getNetworkFees,
|
|
101
101
|
H as getPeginProtocolState,
|
|
102
102
|
Ma as getPsbtInputFields,
|
|
103
103
|
Ha as getScriptType,
|
|
104
|
-
|
|
104
|
+
gs as getTxHex,
|
|
105
105
|
Rs as getTxInfo,
|
|
106
106
|
_s as getUtxoInfo,
|
|
107
107
|
$a as handleContractError,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
I as hexToUint8Array,
|
|
109
|
+
v as isAddressFromPublicKey,
|
|
110
110
|
Q as isDepositAmountValid,
|
|
111
111
|
as as isKnownContractError,
|
|
112
112
|
$ as isPegoutTerminalStatus,
|
|
113
113
|
aa as isRecognizedPegoutStatus,
|
|
114
|
-
|
|
114
|
+
C as isValidHex,
|
|
115
115
|
ss as isWotsMismatchError,
|
|
116
116
|
es as keypairToPublicKey,
|
|
117
117
|
ts as mnemonicToWotsSeed,
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
va as parseUnfundedWasmTransaction,
|
|
119
|
+
Ca as peginOutputCount,
|
|
120
120
|
sa as pollAndSignPayouts,
|
|
121
121
|
U as processPublicKeyToXOnly,
|
|
122
122
|
ms as pushTx,
|
|
@@ -134,6 +134,7 @@ export {
|
|
|
134
134
|
ra as validateMultiVaultDepositInputs,
|
|
135
135
|
ia as validateProviderSelection,
|
|
136
136
|
la as validateRemainingCapacity,
|
|
137
|
+
bs as validateRequestDepositorClaimerArtifactsResponse,
|
|
137
138
|
na as validateSecretAgainstHashlock,
|
|
138
139
|
Ka as validateUtxosAvailable,
|
|
139
140
|
ua as validateVaultAmounts,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../index-BAECy2oz.cjs"),r=require("../../../types-B-p4dhEH.cjs");exports.MEMPOOL_API_URLS=e.MEMPOOL_API_URLS;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=e.ViemVaultRegistryReader;exports.VpResponseValidationError=e.VpResponseValidationError;exports.getAddressTxs=e.getAddressTxs;exports.getAddressUtxos=e.getAddressUtxos;exports.getMempoolApiUrl=e.getMempoolApiUrl;exports.getNetworkFees=e.getNetworkFees;exports.getTxHex=e.getTxHex;exports.getTxInfo=e.getTxInfo;exports.getUtxoInfo=e.getUtxoInfo;exports.pushTx=e.pushTx;exports.resolveProtocolAddresses=e.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.DaemonStatus=r.DaemonStatus;exports.JSON_RPC_ERROR_CODES=r.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=r.JsonRpcClient;exports.JsonRpcError=r.JsonRpcError;exports.POST_WOTS_STATUSES=r.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=r.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=r.RpcErrorCode;exports.VP_TERMINAL_STATUSES=r.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=r.VP_TRANSIENT_STATUSES;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { M as a, V as r, i as o, j as t, k as R, l as S, h as T, g as
|
|
2
|
-
import { D as
|
|
1
|
+
import { M as a, V as r, i as o, j as t, k as R, l as S, h as T, g as i, a as l, b as d, c as p, d as E, e as _, f as A, p as P, r as V, v as n } from "../../../index-DLtpqdlu.js";
|
|
2
|
+
import { D as m, b as c, J as x, a as O, d as U, P as C, R as I, c as f, V as u } from "../../../types-DWjaqVfP.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
m as DaemonStatus,
|
|
5
|
+
c as JSON_RPC_ERROR_CODES,
|
|
6
6
|
x as JsonRpcClient,
|
|
7
7
|
O as JsonRpcError,
|
|
8
8
|
a as MEMPOOL_API_URLS,
|
|
9
9
|
U as POST_WOTS_STATUSES,
|
|
10
|
-
|
|
10
|
+
C as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
11
11
|
I as RpcErrorCode,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
f as VP_TERMINAL_STATUSES,
|
|
13
|
+
u as VP_TRANSIENT_STATUSES,
|
|
14
14
|
r as VaultProviderRpcClient,
|
|
15
15
|
o as ViemProtocolParamsReader,
|
|
16
16
|
t as ViemUniversalChallengerReader,
|
|
17
17
|
R as ViemVaultKeeperReader,
|
|
18
18
|
S as ViemVaultRegistryReader,
|
|
19
19
|
T as VpResponseValidationError,
|
|
20
|
-
|
|
20
|
+
i as getAddressTxs,
|
|
21
21
|
l as getAddressUtxos,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
d as getMempoolApiUrl,
|
|
23
|
+
p as getNetworkFees,
|
|
24
|
+
E as getTxHex,
|
|
25
|
+
_ as getTxInfo,
|
|
26
|
+
A as getUtxoInfo,
|
|
27
|
+
P as pushTx,
|
|
28
|
+
V as resolveProtocolAddresses,
|
|
29
|
+
n as validateRequestDepositorClaimerArtifactsResponse
|
|
29
30
|
};
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@ export { VaultProviderRpcClient } from './api';
|
|
|
2
2
|
export type { VaultProviderRpcClientOptions } from './api';
|
|
3
3
|
export { JsonRpcClient, JsonRpcError, JSON_RPC_ERROR_CODES } from './json-rpc-client';
|
|
4
4
|
export type { JsonRpcClientConfig } from './json-rpc-client';
|
|
5
|
-
export { VpResponseValidationError } from './validators';
|
|
5
|
+
export { VpResponseValidationError, validateRequestDepositorClaimerArtifactsResponse, } from './validators';
|
|
6
6
|
export * from './types';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAC/C,YAAY,EAAE,6BAA6B,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACtF,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAC/C,YAAY,EAAE,6BAA6B,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACtF,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,gDAAgD,GACjD,MAAM,cAAc,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/contracts/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/contracts/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqDlD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAmCnE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAU1E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CA+CzD"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../challengeAssert-nYlgeAI8.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),P=require("../../payout-RFIh7GLN.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../challengeAssert-nYlgeAI8.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),P=require("../../payout-RFIh7GLN.cjs"),o=require("../../bitcoin-CNnPFU6Y.cjs"),l=require("../../signing-cl-lowxV.cjs"),u=require("../../validation-u8W7Lp2x.cjs"),e=require("../../buildAndBroadcastRefund-BDGGbGeK.cjs"),r=require("../../fundPeginTransaction-DxNOeyNI.cjs"),i=require("../../psbtInputFields-05ZrwRzf.cjs"),a=require("../../errors-BcpQEG62.cjs"),t=require("../../index-BAECy2oz.cjs"),s=require("../../types-B-p4dhEH.cjs");exports.buildChallengeAssertPsbt=n.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=n.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=n.buildNoPayoutPsbt;exports.buildPeginInputPsbt=n.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.extractPeginInputSignature=n.extractPeginInputSignature;exports.finalizePeginInputPsbt=n.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});exports.buildPayoutPsbt=P.buildPayoutPsbt;exports.buildRefundPsbt=P.buildRefundPsbt;exports.createPayoutScript=P.createPayoutScript;exports.extractPayoutSignature=P.extractPayoutSignature;exports.deriveNativeSegwitAddress=o.deriveNativeSegwitAddress;exports.deriveTaprootAddress=o.deriveTaprootAddress;exports.ensureHexPrefix=o.ensureHexPrefix;exports.formatSatoshisToBtc=o.formatSatoshisToBtc;exports.getNetwork=o.getNetwork;exports.hexToUint8Array=o.hexToUint8Array;exports.isAddressFromPublicKey=o.isAddressFromPublicKey;exports.isValidHex=o.isValidHex;exports.processPublicKeyToXOnly=o.processPublicKeyToXOnly;exports.stripHexPrefix=o.stripHexPrefix;exports.toXOnly=o.toXOnly;exports.uint8ArrayToHex=o.uint8ArrayToHex;exports.validateWalletPubkey=o.validateWalletPubkey;exports.ContractStatus=l.ContractStatus;exports.PeginAction=l.PeginAction;exports.canPerformAction=l.canPerformAction;exports.createTaprootScriptPathSignOptions=l.createTaprootScriptPathSignOptions;exports.getPeginProtocolState=l.getPeginProtocolState;exports.BITCOIN_ADDRESS_RE=u.BITCOIN_ADDRESS_RE;exports.HEX_RE=u.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=u.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=u.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=u.TXID_RE;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.PayoutManager=e.PayoutManager;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.computeHashlock=e.computeHashlock;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.pollAndSignPayouts=e.pollAndSignPayouts;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateSecretAgainstHashlock=e.validateSecretAgainstHashlock;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.waitForPeginStatus=e.waitForPeginStatus;exports.BTC_DUST_SAT=r.BTC_DUST_SAT;exports.DUST_THRESHOLD=r.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=r.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=r.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=r.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=r.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=r.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=r.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=r.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=r.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=r.fundPeginTransaction;exports.parseUnfundedWasmTransaction=r.parseUnfundedWasmTransaction;exports.peginOutputCount=r.peginOutputCount;exports.rateBasedTxBufferFee=r.rateBasedTxBufferFee;exports.BitcoinScriptType=i.BitcoinScriptType;exports.UtxoNotAvailableError=i.UtxoNotAvailableError;exports.assertUtxosAvailable=i.assertUtxosAvailable;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.collectReservedUtxoRefs=i.collectReservedUtxoRefs;exports.extractInputsFromTransaction=i.extractInputsFromTransaction;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForDeposit=i.selectUtxosForDeposit;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.validateUtxosAvailable=i.validateUtxosAvailable;exports.CONTRACT_ERRORS=a.CONTRACT_ERRORS;exports.PeginManager=a.PeginManager;exports.computeWotsBlockPublicKeysHash=a.computeWotsBlockPublicKeysHash;exports.computeWotsPkHash=a.computeWotsPkHash;exports.deriveWotsBlockPublicKeys=a.deriveWotsBlockPublicKeys;exports.deriveWotsKeypair=a.deriveWotsKeypair;exports.deriveWotsPkHash=a.deriveWotsPkHash;exports.extractErrorData=a.extractErrorData;exports.getContractErrorMessage=a.getContractErrorMessage;exports.handleContractError=a.handleContractError;exports.isKnownContractError=a.isKnownContractError;exports.isWotsMismatchError=a.isWotsMismatchError;exports.keypairToPublicKey=a.keypairToPublicKey;exports.mnemonicToWotsSeed=a.mnemonicToWotsSeed;exports.ApplicationRegistryABI=t.ApplicationRegistryABI;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.ProtocolParamsABI=t.ProtocolParamsABI;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.pushTx=t.pushTx;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.BTCVaultRegistryABI=s.BTCVaultRegistryABI;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_TERMINAL_STATUSES=s.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { i as e, g as t, h as o, d as r, a as i, b as l, c as n, e as u, f as P } from "../../challengeAssert-D1lpvuMv.js";
|
|
2
2
|
import { computeMinClaimValue as c, deriveVaultId as T } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { a as S, b as E, c as
|
|
4
|
-
import { d as _, a as m, e as b, f as x, g as I, h as f, i as
|
|
5
|
-
import { C as
|
|
3
|
+
import { a as S, b as E, c as A, e as g } from "../../payout-DzGsAnhf.js";
|
|
4
|
+
import { d as _, a as m, e as b, f as x, g as I, h as f, i as v, b as C, p as U, s as y, t as O, u as h, v as V } from "../../bitcoin-nOOgeRyl.js";
|
|
5
|
+
import { C as D, P as F, a as N, c as M, g as H } from "../../signing-DeWVBl7m.js";
|
|
6
6
|
import { B as W, H as k, K, M as X, T as w } from "../../validation-CxqROCno.js";
|
|
7
|
-
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as oa, g as ra, d as ia, c as la, j as na, e as ua, f as Pa, w as da } from "../../buildAndBroadcastRefund-
|
|
8
|
-
import { B as Ta, D as pa, F as Sa, L as Ea, M as
|
|
9
|
-
import { B as Ua, U as ya, a as Oa, f as ha, c as Va, e as Ba, g as
|
|
10
|
-
import { C as Ka, P as Xa, b as wa, c as Ga, a as Ya, d as Ja, f as ja, e as Za, g as za, h as qa, i as Qa, j as $a, k as as, m as ss } from "../../errors-
|
|
11
|
-
import { A as ts, M as os, P as rs, V as is, i as ls, j as ns, k as us, l as Ps, h as ds, g as cs, a as Ts, b as ps, c as Ss, d as Es, e as
|
|
12
|
-
import { B as
|
|
7
|
+
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as oa, g as ra, d as ia, c as la, j as na, e as ua, f as Pa, w as da } from "../../buildAndBroadcastRefund-D7NCbgtv.js";
|
|
8
|
+
import { B as Ta, D as pa, F as Sa, L as Ea, M as Aa, P as ga, a as Ra, S as _a, T as ma, W as ba, f as xa, b as Ia, p as fa, r as va } from "../../fundPeginTransaction-BLYXxLBv.js";
|
|
9
|
+
import { B as Ua, U as ya, a as Oa, f as ha, c as Va, e as Ba, g as Da, i as Fa, h as Na, s as Ma, b as Ha, d as La, v as Wa } from "../../psbtInputFields-r1ss6WLU.js";
|
|
10
|
+
import { C as Ka, P as Xa, b as wa, c as Ga, a as Ya, d as Ja, f as ja, e as Za, g as za, h as qa, i as Qa, j as $a, k as as, m as ss } from "../../errors-D3a9XcIX.js";
|
|
11
|
+
import { A as ts, M as os, P as rs, V as is, i as ls, j as ns, k as us, l as Ps, h as ds, g as cs, a as Ts, b as ps, c as Ss, d as Es, e as As, f as gs, p as Rs, r as _s, v as ms } from "../../index-DLtpqdlu.js";
|
|
12
|
+
import { B as xs, D as Is, b as fs, J as vs, a as Cs, d as Us, P as ys, R as Os, c as hs, V as Vs } from "../../types-DWjaqVfP.js";
|
|
13
13
|
export {
|
|
14
14
|
ts as ApplicationRegistryABI,
|
|
15
15
|
Y as BIP68NotMatureError,
|
|
16
16
|
W as BITCOIN_ADDRESS_RE,
|
|
17
|
-
|
|
17
|
+
xs as BTCVaultRegistryABI,
|
|
18
18
|
Ta as BTC_DUST_SAT,
|
|
19
19
|
Ua as BitcoinScriptType,
|
|
20
20
|
Ka as CONTRACT_ERRORS,
|
|
21
21
|
J as ClaimerPegoutStatusValue,
|
|
22
|
-
|
|
22
|
+
D as ContractStatus,
|
|
23
23
|
pa as DUST_THRESHOLD,
|
|
24
|
-
|
|
24
|
+
Is as DaemonStatus,
|
|
25
25
|
Sa as FEE_SAFETY_MARGIN,
|
|
26
26
|
k as HEX_RE,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
fs as JSON_RPC_ERROR_CODES,
|
|
28
|
+
vs as JsonRpcClient,
|
|
29
29
|
Cs as JsonRpcError,
|
|
30
30
|
K as KNOWN_SCRIPT_PREFIXES,
|
|
31
31
|
Ea as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
32
|
-
|
|
32
|
+
Aa as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
33
33
|
X as MAX_REASONABLE_FEE_SATS,
|
|
34
34
|
os as MEMPOOL_API_URLS,
|
|
35
|
-
|
|
35
|
+
ga as P2TR_INPUT_SIZE,
|
|
36
36
|
Ra as PEGIN_FIXED_OUTPUTS,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Us as POST_WOTS_STATUSES,
|
|
38
|
+
ys as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
39
39
|
j as PayoutManager,
|
|
40
|
-
|
|
40
|
+
F as PeginAction,
|
|
41
41
|
Xa as PeginManager,
|
|
42
42
|
rs as ProtocolParamsABI,
|
|
43
|
-
|
|
43
|
+
Os as RpcErrorCode,
|
|
44
44
|
_a as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
45
45
|
w as TXID_RE,
|
|
46
46
|
ma as TX_BUFFER_SIZE_OVERHEAD,
|
|
47
47
|
ya as UtxoNotAvailableError,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
hs as VP_TERMINAL_STATUSES,
|
|
49
|
+
Vs as VP_TRANSIENT_STATUSES,
|
|
50
50
|
is as VaultProviderRpcClient,
|
|
51
51
|
ls as ViemProtocolParamsReader,
|
|
52
52
|
ns as ViemUniversalChallengerReader,
|
|
@@ -66,14 +66,14 @@ export {
|
|
|
66
66
|
l as buildPrePeginPsbt,
|
|
67
67
|
E as buildRefundPsbt,
|
|
68
68
|
ha as calculateBtcTxHash,
|
|
69
|
-
|
|
69
|
+
N as canPerformAction,
|
|
70
70
|
Va as collectReservedUtxoRefs,
|
|
71
71
|
q as computeHashlock,
|
|
72
72
|
c as computeMinClaimValue,
|
|
73
73
|
n as computeNumLocalChallengers,
|
|
74
74
|
wa as computeWotsBlockPublicKeysHash,
|
|
75
75
|
Ga as computeWotsPkHash,
|
|
76
|
-
|
|
76
|
+
A as createPayoutScript,
|
|
77
77
|
M as createTaprootScriptPathSignOptions,
|
|
78
78
|
_ as deriveNativeSegwitAddress,
|
|
79
79
|
m as deriveTaprootAddress,
|
|
@@ -84,7 +84,7 @@ export {
|
|
|
84
84
|
b as ensureHexPrefix,
|
|
85
85
|
Za as extractErrorData,
|
|
86
86
|
Ba as extractInputsFromTransaction,
|
|
87
|
-
|
|
87
|
+
g as extractPayoutSignature,
|
|
88
88
|
u as extractPeginInputSignature,
|
|
89
89
|
P as finalizePeginInputPsbt,
|
|
90
90
|
x as formatSatoshisToBtc,
|
|
@@ -92,24 +92,24 @@ export {
|
|
|
92
92
|
cs as getAddressTxs,
|
|
93
93
|
Ts as getAddressUtxos,
|
|
94
94
|
za as getContractErrorMessage,
|
|
95
|
-
|
|
95
|
+
Da as getDustThreshold,
|
|
96
96
|
ps as getMempoolApiUrl,
|
|
97
97
|
I as getNetwork,
|
|
98
98
|
Ss as getNetworkFees,
|
|
99
99
|
H as getPeginProtocolState,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
Fa as getPsbtInputFields,
|
|
101
|
+
Na as getScriptType,
|
|
102
102
|
Es as getTxHex,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
As as getTxInfo,
|
|
104
|
+
gs as getUtxoInfo,
|
|
105
105
|
qa as handleContractError,
|
|
106
106
|
f as hexToUint8Array,
|
|
107
|
-
|
|
107
|
+
v as isAddressFromPublicKey,
|
|
108
108
|
Q as isDepositAmountValid,
|
|
109
109
|
Qa as isKnownContractError,
|
|
110
110
|
$ as isPegoutTerminalStatus,
|
|
111
111
|
aa as isRecognizedPegoutStatus,
|
|
112
|
-
|
|
112
|
+
C as isValidHex,
|
|
113
113
|
$a as isWotsMismatchError,
|
|
114
114
|
as as keypairToPublicKey,
|
|
115
115
|
ss as mnemonicToWotsSeed,
|
|
@@ -118,7 +118,7 @@ export {
|
|
|
118
118
|
sa as pollAndSignPayouts,
|
|
119
119
|
U as processPublicKeyToXOnly,
|
|
120
120
|
Rs as pushTx,
|
|
121
|
-
|
|
121
|
+
va as rateBasedTxBufferFee,
|
|
122
122
|
_s as resolveProtocolAddresses,
|
|
123
123
|
Ma as selectUtxosForDeposit,
|
|
124
124
|
Ha as selectUtxosForPegin,
|
|
@@ -132,6 +132,7 @@ export {
|
|
|
132
132
|
ra as validateMultiVaultDepositInputs,
|
|
133
133
|
ia as validateProviderSelection,
|
|
134
134
|
la as validateRemainingCapacity,
|
|
135
|
+
ms as validateRequestDepositorClaimerArtifactsResponse,
|
|
135
136
|
na as validateSecretAgainstHashlock,
|
|
136
137
|
Wa as validateUtxosAvailable,
|
|
137
138
|
ua as validateVaultAmounts,
|
|
@@ -86,7 +86,7 @@ export interface PayoutSignatureResult {
|
|
|
86
86
|
* High-level manager for payout transaction signing.
|
|
87
87
|
*
|
|
88
88
|
* @remarks
|
|
89
|
-
* After registering your peg-in on Ethereum (Step
|
|
89
|
+
* After registering your peg-in on Ethereum (Step 3), the vault provider prepares
|
|
90
90
|
* claim/payout transaction pairs. You must sign each payout transaction using this
|
|
91
91
|
* manager and submit the signatures to the vault provider's RPC API.
|
|
92
92
|
*
|
|
@@ -125,12 +125,14 @@ export interface PerVaultPeginData {
|
|
|
125
125
|
vaultScriptPubKey: string;
|
|
126
126
|
}
|
|
127
127
|
export interface PreparePeginResult {
|
|
128
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Funded, pre-witness Pre-PegIn tx hex. Pass this for register calls'
|
|
130
|
+
* `unsignedPrePeginTx` — despite the contract-side name, the registry
|
|
131
|
+
* stores the funded form so indexers can rebuild refund PSBTs.
|
|
132
|
+
*/
|
|
129
133
|
fundedPrePeginTxHex: string;
|
|
130
134
|
/** Funded Pre-PegIn transaction ID */
|
|
131
135
|
prePeginTxid: string;
|
|
132
|
-
/** Unfunded Pre-PegIn transaction hex (for contract DA submission) */
|
|
133
|
-
unsignedPrePeginTxHex: string;
|
|
134
136
|
/** Per-vault PegIn data — one entry per hashlock/amount */
|
|
135
137
|
perVault: PerVaultPeginData[];
|
|
136
138
|
/** UTXOs selected to fund the Pre-PegIn transaction */
|
|
@@ -165,17 +167,28 @@ export interface SignAndBroadcastParams {
|
|
|
165
167
|
value: number;
|
|
166
168
|
}>;
|
|
167
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* BIP-322 BTC Proof-of-Possession binding a depositor's BTC key to their
|
|
172
|
+
* Ethereum account. Produced by {@link PeginManager.signProofOfPossession}
|
|
173
|
+
* and reusable across every register call in the same session — the
|
|
174
|
+
* embedded identities are re-checked at register time.
|
|
175
|
+
*/
|
|
176
|
+
export interface PopSignature {
|
|
177
|
+
/** BIP-322 signature over the PoP message (0x-prefixed hex). */
|
|
178
|
+
btcPopSignature: Hex;
|
|
179
|
+
/** Ethereum address the PoP was signed for. */
|
|
180
|
+
depositorEthAddress: Address;
|
|
181
|
+
/** BTC x-only public key (64-char hex, no 0x prefix). */
|
|
182
|
+
depositorBtcPubkey: string;
|
|
183
|
+
}
|
|
168
184
|
/**
|
|
169
185
|
* Parameters for registering a peg-in on Ethereum.
|
|
170
186
|
*/
|
|
171
187
|
export interface RegisterPeginParams {
|
|
172
188
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
|
|
176
|
-
depositorBtcPubkey: string;
|
|
177
|
-
/**
|
|
178
|
-
* Unsigned Pre-PegIn transaction hex (submitted to contract for data availability).
|
|
189
|
+
* Funded, pre-witness Pre-PegIn tx hex — pass
|
|
190
|
+
* {@link PreparePeginResult.fundedPrePeginTxHex}. The contract-side
|
|
191
|
+
* parameter is named `unsignedPrePeginTx` but it stores the funded form.
|
|
179
192
|
*/
|
|
180
193
|
unsignedPrePeginTx: string;
|
|
181
194
|
/**
|
|
@@ -190,10 +203,6 @@ export interface RegisterPeginParams {
|
|
|
190
203
|
* SHA256 hashlock for HTLC activation (bytes32 hex with 0x prefix).
|
|
191
204
|
*/
|
|
192
205
|
hashlock: Hex;
|
|
193
|
-
/**
|
|
194
|
-
* Optional callback invoked after PoP signing completes but before ETH transaction.
|
|
195
|
-
*/
|
|
196
|
-
onPopSigned?: () => void | Promise<void>;
|
|
197
206
|
/**
|
|
198
207
|
* Depositor's BTC payout address (e.g. bc1p..., bc1q...).
|
|
199
208
|
* Converted to scriptPubKey internally via bitcoinjs-lib.
|
|
@@ -204,12 +213,8 @@ export interface RegisterPeginParams {
|
|
|
204
213
|
depositorPayoutBtcAddress?: string;
|
|
205
214
|
/** Keccak256 hash of the depositor's WOTS public key (bytes32) */
|
|
206
215
|
depositorWotsPkHash: Hex;
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
* When provided, the BTC wallet signing step is skipped and this signature is used directly.
|
|
210
|
-
* Useful for multi-vault deposits where PoP only needs to be signed once.
|
|
211
|
-
*/
|
|
212
|
-
preSignedBtcPopSignature?: Hex;
|
|
216
|
+
/** Proof of possession from {@link PeginManager.signProofOfPossession}. */
|
|
217
|
+
popSignature: PopSignature;
|
|
213
218
|
/**
|
|
214
219
|
* Zero-based index of the HTLC output in the Pre-PegIn transaction that
|
|
215
220
|
* this PegIn spends. In a batch Pre-PegIn with N HTLC outputs, each vault
|
|
@@ -235,26 +240,18 @@ export interface RegisterPeginResult {
|
|
|
235
240
|
* Used for VP RPC operations which key on the BTC transaction ID.
|
|
236
241
|
*/
|
|
237
242
|
peginTxHash: Hex;
|
|
238
|
-
/**
|
|
239
|
-
* The BTC PoP signature used for this registration (hex with 0x prefix).
|
|
240
|
-
* Returned so callers can reuse it for subsequent pegins without re-signing.
|
|
241
|
-
*/
|
|
242
|
-
btcPopSignature: Hex;
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
245
|
* Single request in a batch pegin registration.
|
|
246
|
-
* All requests in a batch share the same vault provider
|
|
246
|
+
* All requests in a batch share the same vault provider, depositor BTC
|
|
247
|
+
* pubkey, and Pre-PegIn transaction.
|
|
247
248
|
*/
|
|
248
249
|
export interface BatchPeginRequestItem {
|
|
249
|
-
/** Depositor's BTC public key (x-only, 64-char hex or with 0x prefix) */
|
|
250
|
-
depositorBtcPubkey: string;
|
|
251
|
-
/** Unsigned Pre-PegIn tx hex (same for all vaults in batch) */
|
|
252
|
-
unsignedPrePeginTx: string;
|
|
253
250
|
/** Signed PegIn tx hex for this vault */
|
|
254
251
|
depositorSignedPeginTx: string;
|
|
255
252
|
/** SHA256 hashlock for HTLC activation (bytes32 hex) */
|
|
256
253
|
hashlock: Hex;
|
|
257
|
-
/** Zero-based HTLC output index in the Pre-PegIn tx */
|
|
254
|
+
/** Zero-based HTLC output index in the Pre-PegIn tx (unique per request) */
|
|
258
255
|
htlcVout: number;
|
|
259
256
|
/** Depositor's BTC payout address (required — funds are sent here on payout) */
|
|
260
257
|
depositorPayoutBtcAddress: string;
|
|
@@ -267,12 +264,15 @@ export interface BatchPeginRequestItem {
|
|
|
267
264
|
export interface RegisterPeginBatchParams {
|
|
268
265
|
/** Vault provider address (shared across all vaults in batch) */
|
|
269
266
|
vaultProvider: Address;
|
|
267
|
+
/**
|
|
268
|
+
* Funded, pre-witness Pre-PegIn tx hex — shared across every request in
|
|
269
|
+
* the batch. See {@link RegisterPeginParams.unsignedPrePeginTx}.
|
|
270
|
+
*/
|
|
271
|
+
unsignedPrePeginTx: string;
|
|
270
272
|
/** Individual pegin requests (one per vault) */
|
|
271
273
|
requests: BatchPeginRequestItem[];
|
|
272
|
-
/**
|
|
273
|
-
|
|
274
|
-
/** Called after PoP is signed (before ETH tx) */
|
|
275
|
-
onPopSigned?: () => void | Promise<void>;
|
|
274
|
+
/** Proof of possession from {@link PeginManager.signProofOfPossession}. */
|
|
275
|
+
popSignature: PopSignature;
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Per-vault result from a batch pegin registration.
|
|
@@ -291,8 +291,6 @@ export interface RegisterPeginBatchResult {
|
|
|
291
291
|
ethTxHash: Hex;
|
|
292
292
|
/** Per-vault results (same order as input requests) */
|
|
293
293
|
vaults: BatchPeginResultItem[];
|
|
294
|
-
/** The BTC PoP signature used (for reference) */
|
|
295
|
-
btcPopSignature: Hex;
|
|
296
294
|
}
|
|
297
295
|
export declare class PeginManager {
|
|
298
296
|
private readonly config;
|
|
@@ -351,18 +349,25 @@ export declare class PeginManager {
|
|
|
351
349
|
* Registers a peg-in on Ethereum by calling the BTCVaultRegistry contract.
|
|
352
350
|
*
|
|
353
351
|
* This method:
|
|
354
|
-
* 1.
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
352
|
+
* 1. Re-verifies the PopSignature against the currently connected ETH
|
|
353
|
+
* and BTC wallets — refuses to proceed if either has changed
|
|
354
|
+
* 2. Derives vault ID and checks if it already exists (pre-flight)
|
|
355
|
+
* 3. Encodes the contract call using viem
|
|
356
|
+
* 4. Estimates gas (catches contract errors early with proper revert
|
|
357
|
+
* reasons)
|
|
358
|
+
* 5. Sends transaction with pre-estimated gas via
|
|
359
|
+
* ethWallet.sendTransaction()
|
|
360
|
+
*
|
|
361
|
+
* The PopSignature must be obtained via
|
|
362
|
+
* {@link signProofOfPossession} before this call.
|
|
360
363
|
*
|
|
361
|
-
* @param params - Registration parameters including
|
|
364
|
+
* @param params - Registration parameters including the PopSignature
|
|
365
|
+
* and the prepared Pre-PegIn / PegIn transactions
|
|
362
366
|
* @returns Result containing Ethereum transaction hash and vault ID
|
|
363
|
-
* @throws Error if
|
|
364
|
-
* @throws Error if vault already exists
|
|
365
|
-
* @throws Error if contract simulation fails (e.g., invalid signature,
|
|
367
|
+
* @throws Error if the PopSignature does not match the connected wallets
|
|
368
|
+
* @throws Error if the vault already exists
|
|
369
|
+
* @throws Error if contract simulation fails (e.g., invalid signature,
|
|
370
|
+
* unauthorized)
|
|
366
371
|
*/
|
|
367
372
|
registerPeginOnChain(params: RegisterPeginParams): Promise<RegisterPeginResult>;
|
|
368
373
|
/**
|
|
@@ -392,12 +397,13 @@ export declare class PeginManager {
|
|
|
392
397
|
*/
|
|
393
398
|
private resolvePayoutScriptPubKey;
|
|
394
399
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
400
|
+
* Sign a BIP-322 BTC Proof-of-Possession binding the connected BTC
|
|
401
|
+
* wallet to the connected ETH account for this chain and vault
|
|
402
|
+
* registry. The returned {@link PopSignature} can be reused across
|
|
403
|
+
* every register call in the same session.
|
|
399
404
|
*/
|
|
400
|
-
|
|
405
|
+
signProofOfPossession(): Promise<PopSignature>;
|
|
406
|
+
private assertPopMatchesBtcWallet;
|
|
401
407
|
/**
|
|
402
408
|
* Gets the configured Bitcoin network.
|
|
403
409
|
*
|