@babylonlabs-io/ts-sdk 0.32.0 → 0.33.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/PeginManager-D2pBM0E-.cjs +2 -0
- package/dist/PeginManager-D2pBM0E-.cjs.map +1 -0
- package/dist/{PeginManager-DUR1BTKM.js → PeginManager-LeGYbRN2.js} +137 -125
- package/dist/PeginManager-LeGYbRN2.js.map +1 -0
- package/dist/{buildAndBroadcastRefund-CIHhUmRv.cjs → buildAndBroadcastRefund-BXjYAqdb.cjs} +2 -2
- package/dist/buildAndBroadcastRefund-BXjYAqdb.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-DwrX_IBf.js → buildAndBroadcastRefund-CK8MbGQh.js} +39 -39
- package/dist/buildAndBroadcastRefund-CK8MbGQh.js.map +1 -0
- package/dist/challengeAssert-06GLZtV8.cjs +2 -0
- package/dist/challengeAssert-06GLZtV8.cjs.map +1 -0
- package/dist/{challengeAssert-DSlCIBoT.js → challengeAssert-KGVKQh0J.js} +64 -70
- package/dist/challengeAssert-KGVKQh0J.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +75 -71
- package/dist/{noPayout-DohtepqZ.js → noPayout-BmMd4NNH.js} +44 -50
- package/dist/{noPayout-DohtepqZ.js.map → noPayout-BmMd4NNH.js.map} +1 -1
- package/dist/noPayout-Bp2TYA_X.cjs +2 -0
- package/dist/{noPayout-CDhbGn_B.cjs.map → noPayout-Bp2TYA_X.cjs.map} +1 -1
- package/dist/tbv/core/clients/eth/index.d.ts +1 -1
- package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +13 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +8 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +30 -27
- package/dist/tbv/core/clients/vault-provider/api.d.ts +13 -2
- package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts +11 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts +2 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +16 -0
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts +10 -0
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +5 -2
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts +4 -0
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +11 -0
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -23
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +48 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +8 -12
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +66 -62
- package/dist/tbv/core/managers/index.d.ts +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +2 -2
- package/dist/tbv/core/primitives/psbt/__tests__/peginInput.test.d.ts +3 -3
- package/dist/tbv/core/primitives/psbt/payout.d.ts +3 -2
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts +11 -5
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts +2 -0
- package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts +2 -2
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/{signAndSubmitPayouts.d.ts → runDepositorPresignFlow.d.ts} +3 -3
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -0
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +11 -11
- package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts +2 -0
- package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts +3 -0
- package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +66 -62
- package/dist/{types-jmEyzzhY.cjs → types-C2IUB0Jd.cjs} +2 -2
- package/dist/types-C2IUB0Jd.cjs.map +1 -0
- package/dist/{types-CnG3JsRs.js → types-D1o_3Q__.js} +20 -9
- package/dist/types-D1o_3Q__.js.map +1 -0
- package/dist/{vault-registry-reader-CG6bea1S.js → vault-registry-reader-BeIEh62N.js} +436 -292
- package/dist/vault-registry-reader-BeIEh62N.js.map +1 -0
- package/dist/vault-registry-reader-DdUgC5IF.cjs +2 -0
- package/dist/vault-registry-reader-DdUgC5IF.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/PeginManager-CTRPJo8m.cjs +0 -2
- package/dist/PeginManager-CTRPJo8m.cjs.map +0 -1
- package/dist/PeginManager-DUR1BTKM.js.map +0 -1
- package/dist/buildAndBroadcastRefund-CIHhUmRv.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-DwrX_IBf.js.map +0 -1
- package/dist/challengeAssert-DSlCIBoT.js.map +0 -1
- package/dist/challengeAssert-DuhkzZG-.cjs +0 -2
- package/dist/challengeAssert-DuhkzZG-.cjs.map +0 -1
- package/dist/noPayout-CDhbGn_B.cjs +0 -2
- package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts +0 -2
- package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts.map +0 -1
- package/dist/tbv/core/services/deposit/signAndSubmitPayouts.d.ts.map +0 -1
- package/dist/types-CnG3JsRs.js.map +0 -1
- package/dist/types-jmEyzzhY.cjs.map +0 -1
- package/dist/vault-registry-reader-BBS1_AON.cjs +0 -2
- package/dist/vault-registry-reader-BBS1_AON.cjs.map +0 -1
- package/dist/vault-registry-reader-CG6bea1S.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { h as e, g as t, d as r, a as o, b as i, c as n, e as l, f as u } from "./challengeAssert-
|
|
2
|
-
import { computeMinClaimValue as P, deriveVaultId as
|
|
3
|
-
import { a as
|
|
4
|
-
import { d as m, a as x, e as b, f as I, g as f, h as
|
|
5
|
-
import { C as
|
|
6
|
-
import { B as W, H as X, K, M as
|
|
7
|
-
import { B as J, C as Z, P as j, R as
|
|
1
|
+
import { h as e, g as t, d as r, a as o, b as i, c as n, e as l, f as u } from "./challengeAssert-KGVKQh0J.js";
|
|
2
|
+
import { computeMinClaimValue as P, deriveVaultId as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
+
import { a as T, d as S, c as E, b as A, f as R, e as g } from "./noPayout-BmMd4NNH.js";
|
|
4
|
+
import { d as m, a as x, e as b, f as I, g as f, h as C, i as v, b as U, p as O, s as V, t as F, u as h, v as y } from "./bitcoin-0_T6KJON.js";
|
|
5
|
+
import { C as D, P as B, a as M, c as H, g as L } from "./signing-BZigafm0.js";
|
|
6
|
+
import { B as W, H as X, K as w, M as K, T as G } from "./validation-CxqROCno.js";
|
|
7
|
+
import { B as J, C as Z, P as j, R as q, a as z, m as Q, h as $, n as aa, i as sa, l as ea, k as ta, r as ra, b as oa, s as ia, v as na, g as la, d as ua, c as da, j as Pa, e as pa, f as ca, w as Ta } from "./buildAndBroadcastRefund-CK8MbGQh.js";
|
|
8
8
|
import { BitcoinNetworks as Ea } from "./shared/index.js";
|
|
9
|
-
import { B as Ra, D as
|
|
10
|
-
import { B as
|
|
11
|
-
import { C as Za, P as ja, V as
|
|
12
|
-
import { A as
|
|
13
|
-
import { B as
|
|
9
|
+
import { B as Ra, D as ga, F as _a, L as ma, M as xa, P as ba, b as Ia, a as fa, S as Ca, T as va, W as Ua, f as Oa, c as Va, p as Fa, r as ha } from "./fundPeginTransaction-oV-dNJOU.js";
|
|
10
|
+
import { B as Na, U as Da, a as Ba, f as Ma, c as Ha, e as La, g as ka, i as Wa, h as Xa, s as wa, b as Ka, d as Ga, v as Ya } from "./psbtInputFields-DPCFHgGd.js";
|
|
11
|
+
import { C as Za, P as ja, V as qa, k as za, l as Qa, c as $a, m as as, d as ss, b as es, f as ts, j as rs, e as os, g as is, h as ns, i as ls, a as us, p as ds } from "./PeginManager-LeGYbRN2.js";
|
|
12
|
+
import { A as ps, M as cs, P as Ts, S as Ss, V as Es, n as As, o as Rs, q as gs, s as _s, h as ms, j as xs, l as bs, g as Is, a as fs, b as Cs, c as vs, d as Us, e as Os, f as Vs, m as Fs, p as hs, r as ys, v as Ns, i as Ds, k as Bs } from "./vault-registry-reader-BeIEh62N.js";
|
|
13
|
+
import { B as Hs, D as Ls, b as ks, J as Ws, a as Xs, d as ws, P as Ks, R as Gs, c as Ys, V as Js } from "./types-D1o_3Q__.js";
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
ps as ApplicationRegistryABI,
|
|
16
16
|
J as BIP68NotMatureError,
|
|
17
17
|
W as BITCOIN_ADDRESS_RE,
|
|
18
|
-
|
|
18
|
+
Hs as BTCVaultRegistryABI,
|
|
19
19
|
Ra as BTC_DUST_SAT,
|
|
20
20
|
Ea as BitcoinNetworks,
|
|
21
|
-
|
|
21
|
+
Na as BitcoinScriptType,
|
|
22
22
|
Za as CONTRACT_ERRORS,
|
|
23
23
|
Z as ClaimerPegoutStatusValue,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
D as ContractStatus,
|
|
25
|
+
ga as DUST_THRESHOLD,
|
|
26
|
+
Ls as DaemonStatus,
|
|
27
|
+
_a as FEE_SAFETY_MARGIN,
|
|
28
28
|
X as HEX_RE,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
ks as JSON_RPC_ERROR_CODES,
|
|
30
|
+
Ws as JsonRpcClient,
|
|
31
|
+
Xs as JsonRpcError,
|
|
32
|
+
w as KNOWN_SCRIPT_PREFIXES,
|
|
33
33
|
ma as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
34
34
|
xa as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
35
|
-
|
|
35
|
+
K as MAX_REASONABLE_FEE_SATS,
|
|
36
36
|
cs as MEMPOOL_API_URLS,
|
|
37
37
|
ba as P2TR_INPUT_SIZE,
|
|
38
38
|
Ia as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
39
39
|
fa as PEGIN_FIXED_OUTPUTS,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
ws as POST_WOTS_STATUSES,
|
|
41
|
+
Ks as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
42
42
|
j as PayoutManager,
|
|
43
|
-
|
|
43
|
+
B as PeginAction,
|
|
44
44
|
ja as PeginManager,
|
|
45
45
|
Ts as ProtocolParamsABI,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
q as REFUND_VSIZE,
|
|
47
|
+
Gs as RpcErrorCode,
|
|
48
|
+
Ca as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
49
|
+
Ss as ServerIdentityError,
|
|
50
50
|
G as TXID_RE,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
va as TX_BUFFER_SIZE_OVERHEAD,
|
|
52
|
+
Da as UtxoNotAvailableError,
|
|
53
|
+
qa as VAULT_APP_NAME,
|
|
54
|
+
Ys as VP_TERMINAL_STATUSES,
|
|
55
|
+
Js as VP_TRANSIENT_STATUSES,
|
|
56
|
+
Es as VaultProviderRpcClient,
|
|
57
|
+
As as ViemProtocolParamsReader,
|
|
58
|
+
Rs as ViemUniversalChallengerReader,
|
|
59
|
+
gs as ViemVaultKeeperReader,
|
|
60
60
|
_s as ViemVaultRegistryReader,
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
ms as VpResponseValidationError,
|
|
62
|
+
xs as VpTokenRegistry,
|
|
63
63
|
Ua as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
z as activateVault,
|
|
65
|
+
T as assertPayoutOutputMatchesRegistered,
|
|
66
|
+
Ba as assertUtxosAvailable,
|
|
67
67
|
Q as buildAndBroadcastRefund,
|
|
68
68
|
e as buildChallengeAssertPsbt,
|
|
69
69
|
t as buildDepositorPayoutPsbt,
|
|
70
|
-
|
|
70
|
+
za as buildFundingOutpointsCommitment,
|
|
71
71
|
S as buildNoPayoutPsbt,
|
|
72
72
|
E as buildPayoutPsbt,
|
|
73
73
|
r as buildPeginInputPsbt,
|
|
@@ -82,11 +82,12 @@ export {
|
|
|
82
82
|
P as computeMinClaimValue,
|
|
83
83
|
n as computeNumLocalChallengers,
|
|
84
84
|
$a as computeWotsBlockPublicKeysHash,
|
|
85
|
+
bs as createAuthenticatedVpClient,
|
|
85
86
|
R as createPayoutScript,
|
|
86
87
|
H as createTaprootScriptPathSignOptions,
|
|
87
88
|
m as deriveNativeSegwitAddress,
|
|
88
89
|
x as deriveTaprootAddress,
|
|
89
|
-
|
|
90
|
+
p as deriveVaultId,
|
|
90
91
|
as as deriveVaultRoot,
|
|
91
92
|
ss as deriveWotsBlocksFromSeed,
|
|
92
93
|
b as ensureHexPrefix,
|
|
@@ -96,59 +97,62 @@ export {
|
|
|
96
97
|
rs as expandWotsSeed,
|
|
97
98
|
os as extractErrorData,
|
|
98
99
|
La as extractInputsFromTransaction,
|
|
99
|
-
|
|
100
|
+
g as extractPayoutSignature,
|
|
100
101
|
l as extractPeginInputSignature,
|
|
101
102
|
u as finalizePeginInputPsbt,
|
|
102
103
|
I as formatSatoshisToBtc,
|
|
103
104
|
Oa as fundPeginTransaction,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
Is as getAddressTxs,
|
|
106
|
+
fs as getAddressUtxos,
|
|
106
107
|
is as getContractErrorMessage,
|
|
107
108
|
ka as getDustThreshold,
|
|
108
|
-
|
|
109
|
+
Cs as getMempoolApiUrl,
|
|
109
110
|
f as getNetwork,
|
|
110
|
-
|
|
111
|
+
vs as getNetworkFees,
|
|
111
112
|
L as getPeginProtocolState,
|
|
112
113
|
Wa as getPsbtInputFields,
|
|
113
114
|
Xa as getScriptType,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
Us as getTxHex,
|
|
116
|
+
Os as getTxInfo,
|
|
117
|
+
Vs as getUtxoInfo,
|
|
117
118
|
ns as handleContractError,
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
C as hexToUint8Array,
|
|
120
|
+
v as isAddressFromPublicKey,
|
|
120
121
|
sa as isDepositAmountValid,
|
|
121
122
|
ls as isKnownContractError,
|
|
122
123
|
ea as isPegoutTerminalStatus,
|
|
123
124
|
ta as isRecognizedPegoutStatus,
|
|
124
125
|
U as isValidHex,
|
|
125
126
|
us as isWotsMismatchError,
|
|
127
|
+
ds as parseFundingOutpointsFromTx,
|
|
126
128
|
Va as parseUnfundedWasmTransaction,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
Fa as peginOutputCount,
|
|
130
|
+
Fs as primeVpTokenRegistry,
|
|
129
131
|
O as processPublicKeyToXOnly,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
wa as
|
|
132
|
+
hs as pushTx,
|
|
133
|
+
ha as rateBasedTxBufferFee,
|
|
134
|
+
ys as resolveProtocolAddresses,
|
|
135
|
+
ra as runDepositorPresignFlow,
|
|
136
|
+
wa as selectUtxosForDeposit,
|
|
137
|
+
Ka as selectUtxosForPegin,
|
|
135
138
|
Ga as shouldAddChangeOutput,
|
|
136
139
|
oa as signDepositorGraph,
|
|
137
140
|
V as stripHexPrefix,
|
|
138
141
|
ia as submitWotsPublicKey,
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
F as toXOnly,
|
|
143
|
+
h as uint8ArrayToHex,
|
|
141
144
|
na as validateDepositAmount,
|
|
142
145
|
la as validateMultiVaultDepositInputs,
|
|
143
146
|
ua as validateProviderSelection,
|
|
144
147
|
da as validateRemainingCapacity,
|
|
145
|
-
|
|
148
|
+
Ns as validateRequestDepositorClaimerArtifactsResponse,
|
|
146
149
|
Pa as validateSecretAgainstHashlock,
|
|
147
150
|
Ya as validateUtxosAvailable,
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
pa as validateVaultAmounts,
|
|
152
|
+
ca as validateVaultProviderPubkey,
|
|
150
153
|
y as validateWalletPubkey,
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
Ds as verifyServerIdentity,
|
|
155
|
+
Bs as vpTokenRegistry,
|
|
156
|
+
Ta as waitForPeginStatus
|
|
153
157
|
};
|
|
154
158
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { initWasm as I, WasmPrePeginTx as C, getPrePeginHtlcConnectorInfo as A, tapInternalPubkey as T, createPayoutConnector as K, getAssertNoPayoutScriptInfo as O } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
2
2
|
import { Buffer as l } from "buffer";
|
|
3
|
-
import { Transaction as
|
|
4
|
-
import { u as
|
|
5
|
-
async function
|
|
3
|
+
import { Transaction as P, Psbt as S, payments as R } from "bitcoinjs-lib";
|
|
4
|
+
import { u as m, T as E, h as g, b as U, s as w, p as q, g as N } from "./bitcoin-0_T6KJON.js";
|
|
5
|
+
async function z(t) {
|
|
6
6
|
await I();
|
|
7
7
|
const { prePeginParams: o, fundedPrePeginTxHex: e, htlcVout: r, refundFee: u, hashlock: i } = t, s = new C(
|
|
8
8
|
o.depositorPubkey,
|
|
@@ -29,28 +29,28 @@ async function G(t) {
|
|
|
29
29
|
hashlock: i,
|
|
30
30
|
timelockRefund: o.timelockRefund,
|
|
31
31
|
network: o.network
|
|
32
|
-
}), p = e.startsWith("0x") ? e.slice(2) : e, c =
|
|
32
|
+
}), p = e.startsWith("0x") ? e.slice(2) : e, c = P.fromHex(p), f = c.outs[r];
|
|
33
33
|
if (!f)
|
|
34
34
|
throw new Error(
|
|
35
35
|
`HTLC output at vout ${r} not found in funded Pre-PegIn tx (tx has ${c.outs.length} outputs)`
|
|
36
36
|
);
|
|
37
|
-
const d =
|
|
37
|
+
const d = P.fromHex(a);
|
|
38
38
|
if (d.ins.length !== 1)
|
|
39
39
|
throw new Error(
|
|
40
40
|
`Refund transaction must have exactly 1 input, got ${d.ins.length}`
|
|
41
41
|
);
|
|
42
|
-
const x = d.ins[0], v = c.getId(),
|
|
42
|
+
const x = d.ins[0], v = c.getId(), b = m(
|
|
43
43
|
new Uint8Array(x.hash).slice().reverse()
|
|
44
44
|
);
|
|
45
|
-
if (
|
|
45
|
+
if (b !== v)
|
|
46
46
|
throw new Error(
|
|
47
|
-
`Refund input does not reference the Pre-PegIn transaction. Expected ${v}, got ${
|
|
47
|
+
`Refund input does not reference the Pre-PegIn transaction. Expected ${v}, got ${b}`
|
|
48
48
|
);
|
|
49
49
|
if (x.index !== r)
|
|
50
50
|
throw new Error(
|
|
51
51
|
`Refund input index ${x.index} does not match expected htlcVout ${r}`
|
|
52
52
|
);
|
|
53
|
-
const y = new
|
|
53
|
+
const y = new S();
|
|
54
54
|
y.setVersion(d.version), y.setLocktime(d.locktime), y.addInput({
|
|
55
55
|
hash: x.hash,
|
|
56
56
|
index: x.index,
|
|
@@ -61,10 +61,10 @@ async function G(t) {
|
|
|
61
61
|
},
|
|
62
62
|
tapLeafScript: [
|
|
63
63
|
{
|
|
64
|
-
leafVersion:
|
|
65
|
-
script: l.from(
|
|
64
|
+
leafVersion: E,
|
|
65
|
+
script: l.from(g(h.refundScript)),
|
|
66
66
|
controlBlock: l.from(
|
|
67
|
-
|
|
67
|
+
g(h.refundControlBlock)
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
],
|
|
@@ -80,7 +80,7 @@ async function G(t) {
|
|
|
80
80
|
n == null || n.free(), s.free();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
async function
|
|
83
|
+
async function L(t) {
|
|
84
84
|
const o = await K(
|
|
85
85
|
{
|
|
86
86
|
depositor: t.depositor,
|
|
@@ -99,33 +99,33 @@ async function N(t) {
|
|
|
99
99
|
payoutControlBlock: o.payoutControlBlock
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
async function
|
|
104
|
-
const o = w(t.payoutTxHex), e = w(t.peginTxHex), r = w(t.assertTxHex), u = await
|
|
102
|
+
const H = 3;
|
|
103
|
+
async function G(t) {
|
|
104
|
+
const o = w(t.payoutTxHex), e = w(t.peginTxHex), r = w(t.assertTxHex), u = await L({
|
|
105
105
|
depositor: t.depositorBtcPubkey,
|
|
106
106
|
vaultProvider: t.vaultProviderBtcPubkey,
|
|
107
107
|
vaultKeepers: t.vaultKeeperBtcPubkeys,
|
|
108
108
|
universalChallengers: t.universalChallengerBtcPubkeys,
|
|
109
109
|
timelockPegin: t.timelockPegin,
|
|
110
110
|
network: t.network
|
|
111
|
-
}), i =
|
|
111
|
+
}), i = g(u.payoutScript), s = g(u.payoutControlBlock), n = P.fromHex(o), a = P.fromHex(e), h = P.fromHex(r), p = new S();
|
|
112
112
|
if (p.setVersion(n.version), p.setLocktime(n.locktime), n.ins.length !== 2)
|
|
113
113
|
throw new Error(
|
|
114
114
|
`Payout transaction must have exactly 2 inputs, got ${n.ins.length}`
|
|
115
115
|
);
|
|
116
|
-
const c = n.ins[0], f = n.ins[1], d =
|
|
116
|
+
const c = n.ins[0], f = n.ins[1], d = m(
|
|
117
117
|
new Uint8Array(c.hash).slice().reverse()
|
|
118
118
|
), x = a.getId();
|
|
119
119
|
if (d !== x)
|
|
120
120
|
throw new Error(
|
|
121
121
|
`Input 0 does not reference pegin transaction. Expected ${x}, got ${d}`
|
|
122
122
|
);
|
|
123
|
-
const v =
|
|
123
|
+
const v = m(
|
|
124
124
|
new Uint8Array(f.hash).slice().reverse()
|
|
125
|
-
),
|
|
126
|
-
if (v !==
|
|
125
|
+
), b = h.getId();
|
|
126
|
+
if (v !== b)
|
|
127
127
|
throw new Error(
|
|
128
|
-
`Input 1 does not reference assert transaction. Expected ${
|
|
128
|
+
`Input 1 does not reference assert transaction. Expected ${b}, got ${v}`
|
|
129
129
|
);
|
|
130
130
|
const y = a.outs[c.index];
|
|
131
131
|
if (!y)
|
|
@@ -147,7 +147,7 @@ async function z(t) {
|
|
|
147
147
|
},
|
|
148
148
|
tapLeafScript: [
|
|
149
149
|
{
|
|
150
|
-
leafVersion:
|
|
150
|
+
leafVersion: E,
|
|
151
151
|
script: l.from(i),
|
|
152
152
|
controlBlock: l.from(s)
|
|
153
153
|
}
|
|
@@ -174,12 +174,12 @@ async function z(t) {
|
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
function D(t, o) {
|
|
177
|
-
if (!
|
|
177
|
+
if (!U(o))
|
|
178
178
|
throw new Error("Invalid registeredPayoutScriptPubKey: not valid hex");
|
|
179
179
|
const e = l.from(
|
|
180
180
|
w(o),
|
|
181
181
|
"hex"
|
|
182
|
-
), r =
|
|
182
|
+
), r = P.fromHex(w(t));
|
|
183
183
|
if (r.outs.length === 0)
|
|
184
184
|
throw new Error("Payout transaction has no outputs");
|
|
185
185
|
if (!r.outs.reduce(
|
|
@@ -190,14 +190,14 @@ function D(t, o) {
|
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
192
|
function Q(t, o, e = 0) {
|
|
193
|
-
const r =
|
|
193
|
+
const r = S.fromHex(t);
|
|
194
194
|
if (e >= r.data.inputs.length)
|
|
195
195
|
throw new Error(
|
|
196
196
|
`Input index ${e} out of range (${r.data.inputs.length} inputs)`
|
|
197
197
|
);
|
|
198
198
|
const u = r.data.inputs[e];
|
|
199
199
|
if (u.tapScriptSig && u.tapScriptSig.length > 0) {
|
|
200
|
-
const i =
|
|
200
|
+
const i = g(o);
|
|
201
201
|
for (const s of u.tapScriptSig)
|
|
202
202
|
if (s.pubkey.equals(l.from(i)))
|
|
203
203
|
return B(s.signature, e);
|
|
@@ -207,9 +207,9 @@ function Q(t, o, e = 0) {
|
|
|
207
207
|
}
|
|
208
208
|
if (u.finalScriptWitness && u.finalScriptWitness.length > 0) {
|
|
209
209
|
const i = V(u.finalScriptWitness);
|
|
210
|
-
if (i.length !==
|
|
210
|
+
if (i.length !== H)
|
|
211
211
|
throw new Error(
|
|
212
|
-
`Unexpected finalized witness stack size at input ${e}: expected ${
|
|
212
|
+
`Unexpected finalized witness stack size at input ${e}: expected ${H} items (signature, script, controlBlock), got ${i.length}`
|
|
213
213
|
);
|
|
214
214
|
return B(i[0], e);
|
|
215
215
|
}
|
|
@@ -219,16 +219,10 @@ function Q(t, o, e = 0) {
|
|
|
219
219
|
}
|
|
220
220
|
function B(t, o) {
|
|
221
221
|
if (t.length === 64)
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
throw new Error(
|
|
227
|
-
`Unexpected sighash type 0x${e.toString(16).padStart(2, "0")} at input ${o}. Expected SIGHASH_ALL (0x01).`
|
|
228
|
-
);
|
|
229
|
-
return b(new Uint8Array(t.subarray(0, 64)));
|
|
230
|
-
}
|
|
231
|
-
throw new Error(
|
|
222
|
+
return m(new Uint8Array(t));
|
|
223
|
+
throw t.length === 65 ? new Error(
|
|
224
|
+
`Unexpected sighash byte 0x${t[64].toString(16).padStart(2, "0")} at input ${o}. Expected implicit SIGHASH_DEFAULT as a 64-byte signature.`
|
|
225
|
+
) : new Error(
|
|
232
226
|
`Unexpected signature length at input ${o}: ${t.length}`
|
|
233
227
|
);
|
|
234
228
|
}
|
|
@@ -269,10 +263,10 @@ function V(t) {
|
|
|
269
263
|
return o;
|
|
270
264
|
}
|
|
271
265
|
async function X(t) {
|
|
272
|
-
const o = w(t.noPayoutTxHex), e =
|
|
266
|
+
const o = w(t.noPayoutTxHex), e = P.fromHex(o), { noPayoutScript: r, noPayoutControlBlock: u } = await O(
|
|
273
267
|
t.connectorParams,
|
|
274
268
|
t.challengerPubkey
|
|
275
|
-
), i =
|
|
269
|
+
), i = g(r), s = g(u), n = new S();
|
|
276
270
|
n.setVersion(e.version), n.setLocktime(e.locktime);
|
|
277
271
|
for (let a = 0; a < e.ins.length; a++) {
|
|
278
272
|
const h = e.ins[a], p = t.prevouts[a];
|
|
@@ -283,13 +277,13 @@ async function X(t) {
|
|
|
283
277
|
index: h.index,
|
|
284
278
|
sequence: h.sequence,
|
|
285
279
|
witnessUtxo: {
|
|
286
|
-
script: l.from(
|
|
280
|
+
script: l.from(g(w(p.script_pubkey))),
|
|
287
281
|
value: p.value
|
|
288
282
|
}
|
|
289
283
|
};
|
|
290
284
|
a === 0 && (c.tapLeafScript = [
|
|
291
285
|
{
|
|
292
|
-
leafVersion:
|
|
286
|
+
leafVersion: E,
|
|
293
287
|
script: l.from(i),
|
|
294
288
|
controlBlock: l.from(s)
|
|
295
289
|
}
|
|
@@ -303,14 +297,14 @@ async function X(t) {
|
|
|
303
297
|
return n.toHex();
|
|
304
298
|
}
|
|
305
299
|
function Z(t, o, e) {
|
|
306
|
-
const r =
|
|
300
|
+
const r = P.fromHex(w(t));
|
|
307
301
|
if (r.outs.length !== 1)
|
|
308
302
|
throw new Error(
|
|
309
303
|
`NoPayout transaction must have exactly 1 output, got ${r.outs.length}`
|
|
310
304
|
);
|
|
311
|
-
const u =
|
|
305
|
+
const u = g(q(o)), { output: i } = R.p2tr({
|
|
312
306
|
internalPubkey: l.from(u),
|
|
313
|
-
network:
|
|
307
|
+
network: N(e)
|
|
314
308
|
});
|
|
315
309
|
if (!i)
|
|
316
310
|
throw new Error(
|
|
@@ -323,11 +317,11 @@ function Z(t, o, e) {
|
|
|
323
317
|
}
|
|
324
318
|
export {
|
|
325
319
|
D as a,
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
z as b,
|
|
321
|
+
G as c,
|
|
328
322
|
X as d,
|
|
329
323
|
Q as e,
|
|
330
|
-
|
|
324
|
+
L as f,
|
|
331
325
|
Z as g
|
|
332
326
|
};
|
|
333
|
-
//# sourceMappingURL=noPayout-
|
|
327
|
+
//# sourceMappingURL=noPayout-BmMd4NNH.js.map
|