@vultisig/core-chain 1.1.0 → 1.2.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/amount/toChainAmount.d.ts +6 -1
  3. package/dist/amount/toChainAmount.d.ts.map +1 -1
  4. package/dist/amount/toChainAmount.js +88 -0
  5. package/dist/amount/toChainAmount.js.map +1 -1
  6. package/dist/chains/cosmos/qbtc/claim/BtcAddressType.d.ts +7 -0
  7. package/dist/chains/cosmos/qbtc/claim/BtcAddressType.d.ts.map +1 -0
  8. package/dist/chains/cosmos/qbtc/claim/BtcAddressType.js +9 -0
  9. package/dist/chains/cosmos/qbtc/claim/BtcAddressType.js.map +1 -0
  10. package/dist/chains/cosmos/qbtc/claim/ClaimableUtxo.d.ts +8 -0
  11. package/dist/chains/cosmos/qbtc/claim/ClaimableUtxo.d.ts.map +1 -0
  12. package/dist/chains/cosmos/qbtc/claim/ClaimableUtxo.js +2 -0
  13. package/dist/chains/cosmos/qbtc/claim/ClaimableUtxo.js.map +1 -0
  14. package/dist/chains/cosmos/qbtc/claim/broadcastClaimTx.d.ts +25 -0
  15. package/dist/chains/cosmos/qbtc/claim/broadcastClaimTx.d.ts.map +1 -0
  16. package/dist/chains/cosmos/qbtc/claim/broadcastClaimTx.js +43 -0
  17. package/dist/chains/cosmos/qbtc/claim/broadcastClaimTx.js.map +1 -0
  18. package/dist/chains/cosmos/qbtc/claim/buildClaimTx.d.ts +26 -0
  19. package/dist/chains/cosmos/qbtc/claim/buildClaimTx.d.ts.map +1 -0
  20. package/dist/chains/cosmos/qbtc/claim/buildClaimTx.js +57 -0
  21. package/dist/chains/cosmos/qbtc/claim/buildClaimTx.js.map +1 -0
  22. package/dist/chains/cosmos/qbtc/claim/computeClaimHashes.d.ts +49 -0
  23. package/dist/chains/cosmos/qbtc/claim/computeClaimHashes.d.ts.map +1 -0
  24. package/dist/chains/cosmos/qbtc/claim/computeClaimHashes.js +85 -0
  25. package/dist/chains/cosmos/qbtc/claim/computeClaimHashes.js.map +1 -0
  26. package/dist/chains/cosmos/qbtc/claim/detectBtcAddressType.d.ts +14 -0
  27. package/dist/chains/cosmos/qbtc/claim/detectBtcAddressType.d.ts.map +1 -0
  28. package/dist/chains/cosmos/qbtc/claim/detectBtcAddressType.js +31 -0
  29. package/dist/chains/cosmos/qbtc/claim/detectBtcAddressType.js.map +1 -0
  30. package/dist/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.d.ts +3 -0
  31. package/dist/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.d.ts.map +1 -0
  32. package/dist/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.js +13 -0
  33. package/dist/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.js.map +1 -0
  34. package/dist/chains/cosmos/qbtc/claim/getClaimableUtxos.d.ts +14 -0
  35. package/dist/chains/cosmos/qbtc/claim/getClaimableUtxos.d.ts.map +1 -0
  36. package/dist/chains/cosmos/qbtc/claim/getClaimableUtxos.js +22 -0
  37. package/dist/chains/cosmos/qbtc/claim/getClaimableUtxos.js.map +1 -0
  38. package/dist/chains/cosmos/qbtc/claim/proofService.d.ts +50 -0
  39. package/dist/chains/cosmos/qbtc/claim/proofService.d.ts.map +1 -0
  40. package/dist/chains/cosmos/qbtc/claim/proofService.js +71 -0
  41. package/dist/chains/cosmos/qbtc/claim/proofService.js.map +1 -0
  42. package/dist/chains/cosmos/thor/lp/halts.d.ts +56 -0
  43. package/dist/chains/cosmos/thor/lp/halts.d.ts.map +1 -0
  44. package/dist/chains/cosmos/thor/lp/halts.js +95 -0
  45. package/dist/chains/cosmos/thor/lp/halts.js.map +1 -0
  46. package/dist/chains/cosmos/thor/lp/index.d.ts +34 -11
  47. package/dist/chains/cosmos/thor/lp/index.d.ts.map +1 -1
  48. package/dist/chains/cosmos/thor/lp/index.js +9 -15
  49. package/dist/chains/cosmos/thor/lp/index.js.map +1 -1
  50. package/dist/chains/cosmos/thor/lp/lockup.d.ts +47 -0
  51. package/dist/chains/cosmos/thor/lp/lockup.d.ts.map +1 -0
  52. package/dist/chains/cosmos/thor/lp/lockup.js +56 -0
  53. package/dist/chains/cosmos/thor/lp/lockup.js.map +1 -0
  54. package/dist/chains/cosmos/thor/lp/lpChainMap.d.ts +25 -0
  55. package/dist/chains/cosmos/thor/lp/lpChainMap.d.ts.map +1 -0
  56. package/dist/chains/cosmos/thor/lp/lpChainMap.js +30 -0
  57. package/dist/chains/cosmos/thor/lp/lpChainMap.js.map +1 -0
  58. package/dist/chains/cosmos/thor/lp/math.d.ts +129 -0
  59. package/dist/chains/cosmos/thor/lp/math.d.ts.map +1 -0
  60. package/dist/chains/cosmos/thor/lp/math.js +227 -0
  61. package/dist/chains/cosmos/thor/lp/math.js.map +1 -0
  62. package/dist/chains/cosmos/thor/lp/memberPool.d.ts +4 -0
  63. package/dist/chains/cosmos/thor/lp/memberPool.d.ts.map +1 -0
  64. package/dist/chains/cosmos/thor/lp/memberPool.js +24 -0
  65. package/dist/chains/cosmos/thor/lp/memberPool.js.map +1 -0
  66. package/dist/chains/cosmos/thor/lp/memo.d.ts +38 -17
  67. package/dist/chains/cosmos/thor/lp/memo.d.ts.map +1 -1
  68. package/dist/chains/cosmos/thor/lp/memo.js +40 -16
  69. package/dist/chains/cosmos/thor/lp/memo.js.map +1 -1
  70. package/dist/chains/cosmos/thor/lp/pairing.d.ts +30 -0
  71. package/dist/chains/cosmos/thor/lp/pairing.d.ts.map +1 -0
  72. package/dist/chains/cosmos/thor/lp/pairing.js +44 -0
  73. package/dist/chains/cosmos/thor/lp/pairing.js.map +1 -0
  74. package/dist/chains/cosmos/thor/lp/payload.d.ts +30 -10
  75. package/dist/chains/cosmos/thor/lp/payload.d.ts.map +1 -1
  76. package/dist/chains/cosmos/thor/lp/payload.js +30 -18
  77. package/dist/chains/cosmos/thor/lp/payload.js.map +1 -1
  78. package/dist/chains/cosmos/thor/lp/position.d.ts +15 -22
  79. package/dist/chains/cosmos/thor/lp/position.d.ts.map +1 -1
  80. package/dist/chains/cosmos/thor/lp/position.js +82 -35
  81. package/dist/chains/cosmos/thor/lp/position.js.map +1 -1
  82. package/dist/chains/cosmos/thor/lp/positions.d.ts +15 -0
  83. package/dist/chains/cosmos/thor/lp/positions.d.ts.map +1 -0
  84. package/dist/chains/cosmos/thor/lp/positions.js +47 -0
  85. package/dist/chains/cosmos/thor/lp/positions.js.map +1 -0
  86. package/dist/chains/cosmos/thor/lp/types.d.ts +45 -0
  87. package/dist/chains/cosmos/thor/lp/types.d.ts.map +1 -0
  88. package/dist/chains/cosmos/thor/lp/types.js +2 -0
  89. package/dist/chains/cosmos/thor/lp/types.js.map +1 -0
  90. package/dist/chains/cosmos/thor/lp/validation.d.ts +32 -7
  91. package/dist/chains/cosmos/thor/lp/validation.d.ts.map +1 -1
  92. package/dist/chains/cosmos/thor/lp/validation.js +76 -11
  93. package/dist/chains/cosmos/thor/lp/validation.js.map +1 -1
  94. package/dist/chains/utxo/tx/buildSignBitcoinFromPsbt.d.ts +21 -0
  95. package/dist/chains/utxo/tx/buildSignBitcoinFromPsbt.d.ts.map +1 -0
  96. package/dist/chains/utxo/tx/buildSignBitcoinFromPsbt.js +182 -0
  97. package/dist/chains/utxo/tx/buildSignBitcoinFromPsbt.js.map +1 -0
  98. package/package.json +90 -5
  99. package/dist/chains/cosmos/thor/lp/affiliate.d.ts +0 -16
  100. package/dist/chains/cosmos/thor/lp/affiliate.d.ts.map +0 -1
  101. package/dist/chains/cosmos/thor/lp/affiliate.js +0 -16
  102. package/dist/chains/cosmos/thor/lp/affiliate.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @vultisig/core-chain
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#235](https://github.com/vultisig/vultisig-sdk/pull/235) [`aea1c28`](https://github.com/vultisig/vultisig-sdk/commit/aea1c28051345ddef9c952108b203caa8b7fa032) Thanks [@rcoderdev](https://github.com/rcoderdev)! - ### Swap amounts (backward compatible)
8
+ - `SwapQuoteParams.amount` and `SwapTxParams.amount` now accept **`string | number`**. Call sites that already pass a **number** require no code changes.
9
+ - Human-readable swap amounts can be passed as **decimal strings** end-to-end (compound `vault.swap()`, `getSwapQuote`, `prepareSwapTx`, CLI agent), avoiding precision loss from `Number()` / `parseFloat()` on extreme magnitudes or fractional digits.
10
+ - `toChainAmount` accepts **`string | number`**; whitespace-only / empty strings throw instead of being treated as zero.
11
+
12
+ ### Send preparation (stricter validation)
13
+ - `prepareSendTx` and `estimateSendFee` reject **zero or negative** `amount` in base units. This aligns with real transfers; payloads with `toAmount: "0"` are no longer built for native/token sends.
14
+ - **Zero-value EVM contract calls** are unchanged: use `prepareContractCallTx` (or `vault.contractCall()`), which still builds via the internal path that allows `value: 0n`.
15
+
16
+ ### Other
17
+ - Swap approval sizing uses `toChainAmount` instead of float scaling for required allowance.
18
+ - `@vultisig/rujira` (source): `VultisigSignature.format` includes **`MLDSA`** to match SDK `Signature` — type-only widening, no runtime change; Rujira will pick up a **patch** version via normal dependency releases when published next.
19
+ - CLI: direct **`viem`** dependency; Solana local swap human amount via `formatUnits`; agent SSE `Transaction` typing includes optional `swap_tx` / `send_tx` / `tx`.
20
+
21
+ **Semver:** **Minor** for `@vultisig/core-chain`, `@vultisig/core-mpc`, and `@vultisig/sdk` (additive types + intentional validation tightening). **`@vultisig/cli` is linked to the SDK** in Changesets config, so it receives the same minor bump. This is **not** a SemVer **major** for integration purposes: swap inputs are only widened; `prepareSendTx({ amount: 0n })` was never a valid broadcast path.
22
+
23
+ **Release tooling note:** `yarn changeset status` may still propose a **major** version for `@vultisig/rujira` when the SDK minors, even though the only Rujira change is adding `'MLDSA'` to a string-literal union (fully backward compatible). Review the Version Packages PR and **downgrade Rujira to patch** if your policy is to reserve majors for real breaking API changes.
24
+
25
+ **`@vultisig/sdk` is 0.x:** per [SemVer](https://semver.org/#spec-item-4), minor releases on `0.y.z` may include behavior changes; consumers pinning `^0.14.0` should still accept `0.15.0` but should read changelog for validation tightening.
26
+
27
+ ### Patch Changes
28
+
29
+ - [#174](https://github.com/vultisig/vultisig-sdk/pull/174) [`c630597`](https://github.com/vultisig/vultisig-sdk/commit/c6305970d1685194f1c6c11d5e8d141e8aa6c9a1) Thanks [@Ehsan-saradar](https://github.com/Ehsan-saradar)! - fix: harden PSBT signing (SignBitcoin) - follow-up on PR [#174](https://github.com/vultisig/vultisig-sdk/issues/174)
30
+ - parameterize network in buildSignBitcoinFromPsbt (was hardcoded to mainnet)
31
+ - harden detectScriptType: full P2PKH template check, add P2WSH detection
32
+ - fail early for unsupported script types with descriptive BIP-referenced errors
33
+ - add fee snipe mitigation (cross-validate witnessUtxo vs nonWitnessUtxo)
34
+ - rename computeBip143Sighashes -> computePreSigningHashes for extensibility
35
+ - use @noble/hashes/sha256 instead of Node.js crypto (cross-platform)
36
+ - use unsigned int64 for Bitcoin amounts (writeBigUInt64LE)
37
+ - fix varint encoding for output script lengths in sighash computation
38
+ - refactor compileSignBitcoinTx to use bitcoinjs-lib Transaction class
39
+ - fix libType regression in commVault.ts for key-import vaults
40
+ - fix variable shadowing in compileTx.ts
41
+ - skip Blockaid simulation for PSBT flows (incompatible with WalletCore compiler)
42
+ - augment change detection with BIP32 derivation on outputs
43
+ - add 10 unit tests cross-validating sighash against bitcoinjs-lib v7
44
+
3
45
  ## 1.1.0
4
46
 
5
47
  ### Minor Changes
@@ -1,2 +1,7 @@
1
- export declare const toChainAmount: (amount: number, decimals: number) => bigint;
1
+ /** Thrown when a human amount string cannot be converted to chain base units. */
2
+ export declare class ChainAmountParseError extends Error {
3
+ readonly name = "ChainAmountParseError";
4
+ constructor(message: string);
5
+ }
6
+ export declare const toChainAmount: (amount: string | number, decimals: number) => bigint;
2
7
  //# sourceMappingURL=toChainAmount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toChainAmount.d.ts","sourceRoot":"","sources":["../../../../../packages/core/chain/amount/toChainAmount.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,WAI7D,CAAA"}
1
+ {"version":3,"file":"toChainAmount.d.ts","sourceRoot":"","sources":["../../../../../packages/core/chain/amount/toChainAmount.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAkB,IAAI,2BAA0B;gBAEpC,OAAO,EAAE,MAAM;CAG5B;AAgFD,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,GAAG,MAAM,EAAE,UAAU,MAAM,WAetE,CAAA"}
@@ -1,5 +1,93 @@
1
1
  import { parseUnits } from 'viem';
2
+ /** Thrown when a human amount string cannot be converted to chain base units. */
3
+ export class ChainAmountParseError extends Error {
4
+ name = 'ChainAmountParseError';
5
+ constructor(message) {
6
+ super(message);
7
+ }
8
+ }
9
+ const SCIENTIFIC_DECIMAL = /^([+-]?)(?:(\d+)\.?(\d*)|\.(\d+))[eE]([+-]?\d+)$/i;
10
+ /** Limits `10n ** |scale|` work and expanded string size for untrusted input. */
11
+ const MAX_SCALE_ABS = 10000n;
12
+ const padFractionDigits = (frac, totalLen) => {
13
+ const need = totalLen - BigInt(frac.length);
14
+ if (need <= 0n) {
15
+ return frac;
16
+ }
17
+ if (need <= BigInt(Number.MAX_SAFE_INTEGER)) {
18
+ return `${'0'.repeat(Number(need))}${frac}`;
19
+ }
20
+ let out = frac;
21
+ while (BigInt(out.length) < totalLen) {
22
+ out = `0${out}`;
23
+ }
24
+ return out;
25
+ };
26
+ /**
27
+ * Turns a decimal string in scientific notation into a plain decimal string
28
+ * without floating-point conversion, so mantissa digits beyond ~15 s.d. are kept.
29
+ */
30
+ const expandScientificNotationToDecimalString = (s) => {
31
+ const m = SCIENTIFIC_DECIMAL.exec(s.trim());
32
+ if (!m) {
33
+ throw new ChainAmountParseError(`Invalid amount: "${s}"`);
34
+ }
35
+ const signNeg = m[1] === '-';
36
+ let digitStr;
37
+ let fracLen;
38
+ if (m[4] !== undefined) {
39
+ digitStr = m[4];
40
+ fracLen = digitStr.length;
41
+ }
42
+ else {
43
+ digitStr = `${m[2] ?? ''}${m[3] ?? ''}`;
44
+ fracLen = (m[3] ?? '').length;
45
+ }
46
+ if (!/^\d+$/.test(digitStr)) {
47
+ throw new ChainAmountParseError(`Invalid amount: "${s}"`);
48
+ }
49
+ const expStr = m[5] ?? '';
50
+ if (expStr === '' || expStr === '+' || expStr === '-') {
51
+ throw new ChainAmountParseError(`Invalid amount: "${s}"`);
52
+ }
53
+ const allDigits = BigInt(digitStr);
54
+ const exp = BigInt(expStr);
55
+ const scale = exp - BigInt(fracLen);
56
+ const scaleAbs = scale < 0n ? -scale : scale;
57
+ if (scaleAbs > MAX_SCALE_ABS) {
58
+ throw new ChainAmountParseError(`Amount exponent out of supported range: "${s}"`);
59
+ }
60
+ let absResult;
61
+ if (scale >= 0n) {
62
+ const mult = 10n ** scale;
63
+ absResult = (allDigits * mult).toString();
64
+ }
65
+ else {
66
+ const k = -scale;
67
+ const divisor = 10n ** k;
68
+ const intPart = allDigits / divisor;
69
+ const rem = allDigits % divisor;
70
+ const frac = padFractionDigits(rem.toString(), k);
71
+ absResult =
72
+ intPart === 0n ? `0.${frac}` : `${intPart.toString()}.${frac}`;
73
+ }
74
+ if (signNeg && allDigits !== 0n) {
75
+ return `-${absResult}`;
76
+ }
77
+ return absResult;
78
+ };
2
79
  export const toChainAmount = (amount, decimals) => {
80
+ if (typeof amount === 'string') {
81
+ const trimmed = amount.trim();
82
+ if (!trimmed) {
83
+ throw new ChainAmountParseError('Amount cannot be empty');
84
+ }
85
+ if (/[eE]/.test(trimmed)) {
86
+ const expanded = expandScientificNotationToDecimalString(trimmed);
87
+ return parseUnits(expanded, decimals);
88
+ }
89
+ return parseUnits(trimmed, decimals);
90
+ }
3
91
  const str = amount.toString();
4
92
  const value = /[eE]/.test(str) ? amount.toFixed(decimals) : str;
5
93
  return parseUnits(value, decimals);
@@ -1 +1 @@
1
- {"version":3,"file":"toChainAmount.js","sourceRoot":"","sources":["../../../../../packages/core/chain/amount/toChainAmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE;IAChE,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/D,OAAO,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACpC,CAAC,CAAA"}
1
+ {"version":3,"file":"toChainAmount.js","sourceRoot":"","sources":["../../../../../packages/core/chain/amount/toChainAmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEjC,iFAAiF;AACjF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5B,IAAI,GAAG,uBAAuB,CAAA;IAEhD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;CACF;AAED,MAAM,kBAAkB,GAAG,mDAAmD,CAAA;AAE9E,iFAAiF;AACjF,MAAM,aAAa,GAAG,MAAO,CAAA;AAE7B,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAU,EAAE;IACnE,MAAM,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;QACf,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC5C,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,MAA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AAI,OAAO,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;QAChC,OAAO,IAAI,SAAS,EAAE,CAAA;IACxB,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAuB,EAAE,QAAgB,EAAE,EAAE;IACzE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,qBAAqB,CAAC,wBAAwB,CAAC,CAAA;QAC3D,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,uCAAuC,CAAC,OAAO,CAAC,CAAA;YACjE,OAAO,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;QACD,OAAO,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IACtC,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/D,OAAO,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACpC,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ /** ZK circuit used for the claim proof. */
2
+ export type QbtcClaimCircuit = 'ecdsa' | 'schnorr';
3
+ /** Supported Bitcoin address types for QBTC claiming. */
4
+ export type BtcAddressType = 'p2pkh' | 'p2wpkh' | 'p2sh-p2wpkh' | 'p2wsh' | 'p2tr';
5
+ /** Maps a Bitcoin address type to its corresponding ZK circuit. */
6
+ export declare const btcAddressTypeCircuit: Record<BtcAddressType, QbtcClaimCircuit>;
7
+ //# sourceMappingURL=BtcAddressType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BtcAddressType.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/BtcAddressType.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAA;AAElD,yDAAyD;AACzD,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,QAAQ,GACR,aAAa,GACb,OAAO,GACP,MAAM,CAAA;AAEV,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAM1E,CAAA"}
@@ -0,0 +1,9 @@
1
+ /** Maps a Bitcoin address type to its corresponding ZK circuit. */
2
+ export const btcAddressTypeCircuit = {
3
+ p2pkh: 'ecdsa',
4
+ p2wpkh: 'ecdsa',
5
+ 'p2sh-p2wpkh': 'ecdsa',
6
+ p2wsh: 'ecdsa',
7
+ p2tr: 'schnorr',
8
+ };
9
+ //# sourceMappingURL=BtcAddressType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BtcAddressType.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/BtcAddressType.ts"],"names":[],"mappings":"AAWA,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAA6C;IAC7E,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;IACf,aAAa,EAAE,OAAO;IACtB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,SAAS;CAChB,CAAA"}
@@ -0,0 +1,8 @@
1
+ /** A Bitcoin UTXO that can potentially be claimed on the QBTC chain. */
2
+ export type ClaimableUtxo = {
3
+ txid: string;
4
+ vout: number;
5
+ /** BTC amount in satoshis. */
6
+ amount: number;
7
+ };
8
+ //# sourceMappingURL=ClaimableUtxo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClaimableUtxo.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/ClaimableUtxo.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ClaimableUtxo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClaimableUtxo.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/ClaimableUtxo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ type ClaimTxResponse = {
2
+ /** Total satoshis claimed. */
3
+ totalAmountClaimed: bigint;
4
+ /** Number of UTXOs successfully claimed. */
5
+ utxosClaimed: number;
6
+ /** Number of UTXOs skipped (already claimed or address mismatch). */
7
+ utxosSkipped: number;
8
+ /** Transaction hash. */
9
+ txHash: string;
10
+ };
11
+ type BroadcastClaimTxInput = {
12
+ /** Base64-encoded TxRaw protobuf bytes. */
13
+ txBytesBase64: string;
14
+ /** Transaction hash (SHA256 of TxRaw), hex-encoded. */
15
+ txHash: string;
16
+ };
17
+ /**
18
+ * Broadcasts a signed MsgClaimWithProof transaction to the QBTC chain
19
+ * via the REST API (following the restOnlyChains pattern).
20
+ *
21
+ * The claim transaction is gas-free — the chain does not charge gas.
22
+ */
23
+ export declare const broadcastClaimTx: ({ txBytesBase64, txHash, }: BroadcastClaimTxInput) => Promise<ClaimTxResponse>;
24
+ export {};
25
+ //# sourceMappingURL=broadcastClaimTx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcastClaimTx.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/broadcastClaimTx.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,8BAA8B;IAC9B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAA;IACpB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC3B,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAWD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAU,4BAGpC,qBAAqB,KAAG,OAAO,CAAC,eAAe,CAwCjD,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { qbtcRestUrl } from '@vultisig/core-chain/chains/cosmos/qbtc/tendermintRpcUrl';
2
+ /**
3
+ * Broadcasts a signed MsgClaimWithProof transaction to the QBTC chain
4
+ * via the REST API (following the restOnlyChains pattern).
5
+ *
6
+ * The claim transaction is gas-free — the chain does not charge gas.
7
+ */
8
+ export const broadcastClaimTx = async ({ txBytesBase64, txHash, }) => {
9
+ const response = await fetch(`${qbtcRestUrl}/cosmos/tx/v1beta1/txs`, {
10
+ method: 'POST',
11
+ headers: { 'Content-Type': 'application/json' },
12
+ body: JSON.stringify({
13
+ tx_bytes: txBytesBase64,
14
+ mode: 'BROADCAST_MODE_SYNC',
15
+ }),
16
+ });
17
+ const idempotentResult = {
18
+ totalAmountClaimed: 0n,
19
+ utxosClaimed: 0,
20
+ utxosSkipped: 0,
21
+ txHash,
22
+ };
23
+ if (!response.ok) {
24
+ const text = await response.text();
25
+ if (text.includes('tx already exists in cache')) {
26
+ return idempotentResult;
27
+ }
28
+ throw new Error(`QBTC claim broadcast failed (${response.status}): ${text}`);
29
+ }
30
+ const data = await response.json();
31
+ if (typeof data.tx_response?.code !== 'number') {
32
+ throw new Error('QBTC claim broadcast failed: missing tx_response.code');
33
+ }
34
+ if (data.tx_response.code !== 0) {
35
+ const log = data.tx_response.raw_log || data.tx_response.log;
36
+ if (log?.includes('tx already exists in cache')) {
37
+ return idempotentResult;
38
+ }
39
+ throw new Error(`QBTC claim tx error: ${log}`);
40
+ }
41
+ return idempotentResult;
42
+ };
43
+ //# sourceMappingURL=broadcastClaimTx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcastClaimTx.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/broadcastClaimTx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAA;AA6BtF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,aAAa,EACb,MAAM,GACgB,EAA4B,EAAE;IACpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,WAAW,wBAAwB,EAAE;QACnE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,qBAAqB;SAC5B,CAAC;KACH,CAAC,CAAA;IAEF,MAAM,gBAAgB,GAAoB;QACxC,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,MAAM;KACP,CAAA;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;YAChD,OAAO,gBAAgB,CAAA;QACzB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAA;IAC9E,CAAC;IAED,MAAM,IAAI,GAAsB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAErD,IAAI,OAAO,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;IAED,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAA;QAC5D,IAAI,GAAG,EAAE,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;YAChD,OAAO,gBAAgB,CAAA;QACzB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAA;IAChD,CAAC;IAED,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ type UtxoRef = {
2
+ txid: string;
3
+ vout: number;
4
+ };
5
+ type BuildMsgClaimWithProofInput = {
6
+ /** QBTC bech32 address of the claimer. */
7
+ claimer: string;
8
+ /** UTXOs to include in the claim (1-50, no duplicates). */
9
+ utxos: UtxoRef[];
10
+ /** Hex-encoded PLONK ZK proof. */
11
+ proof: string;
12
+ /** 64-char hex MessageHash. */
13
+ messageHash: string;
14
+ /** 40-char hex AddressHash (Hash160). */
15
+ addressHash: string;
16
+ /** 64-char hex QBTCAddressHash. */
17
+ qbtcAddressHash: string;
18
+ };
19
+ /** Validates the claim input against the chain's constraints (Section 5). */
20
+ export declare const validateClaimInput: (input: BuildMsgClaimWithProofInput) => void;
21
+ /** Wraps MsgClaimWithProof in a Cosmos Any message. */
22
+ export declare const buildClaimWithProofAny: (input: BuildMsgClaimWithProofInput) => Uint8Array;
23
+ /** Builds the TxBody containing a single MsgClaimWithProof. */
24
+ export declare const buildClaimTxBody: (input: BuildMsgClaimWithProofInput) => Uint8Array;
25
+ export {};
26
+ //# sourceMappingURL=buildClaimTx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildClaimTx.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/buildClaimTx.ts"],"names":[],"mappings":"AASA,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,2BAA2B,GAAG;IACjC,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAYD,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,GAAI,OAAO,2BAA2B,SA+BpE,CAAA;AAsBD,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,GACjC,OAAO,2BAA2B,KACjC,UAOF,CAAA;AAED,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,GAC3B,OAAO,2BAA2B,KACjC,UAGF,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { concatBytes, protoBytes, protoString, protoVarint, } from '@vultisig/core-chain/chains/cosmos/qbtc/protoEncoding';
2
+ const msgClaimWithProofTypeURL = '/qbtc.qbtc.v1.MsgClaimWithProof';
3
+ const isHex = (value) => /^[0-9a-f]+$/i.test(value);
4
+ const assertHex = (value, name, expectedLength) => {
5
+ if (value.length !== expectedLength || !isHex(value)) {
6
+ throw new Error(`${name} must be ${expectedLength} hex chars, got ${value.length}`);
7
+ }
8
+ };
9
+ /** Validates the claim input against the chain's constraints (Section 5). */
10
+ export const validateClaimInput = (input) => {
11
+ const { utxos, proof, messageHash, addressHash, qbtcAddressHash } = input;
12
+ if (utxos.length === 0 || utxos.length > 50) {
13
+ throw new Error(`UTXOs count must be 1-50, got ${utxos.length}`);
14
+ }
15
+ const seen = new Set();
16
+ for (const { txid, vout } of utxos) {
17
+ if (txid.length !== 64 || !isHex(txid)) {
18
+ throw new Error(`Invalid txid: expected 64 hex chars, got ${txid.length}`);
19
+ }
20
+ if (!Number.isInteger(vout) || vout < 0) {
21
+ throw new Error(`Invalid vout: expected non-negative integer, got ${vout}`);
22
+ }
23
+ const key = `${txid}:${vout}`;
24
+ if (seen.has(key)) {
25
+ throw new Error(`Duplicate UTXO reference: ${key}`);
26
+ }
27
+ seen.add(key);
28
+ }
29
+ if (!isHex(proof) || proof.length < 200) {
30
+ throw new Error('Proof too small or not valid hex (min 100 bytes / 200 hex chars)');
31
+ }
32
+ if (proof.length > 100_000) {
33
+ throw new Error('Proof too large (max 50 KB / 100000 hex chars)');
34
+ }
35
+ assertHex(messageHash, 'message_hash', 64);
36
+ assertHex(addressHash, 'address_hash', 40);
37
+ assertHex(qbtcAddressHash, 'qbtc_address_hash', 64);
38
+ };
39
+ /** Encodes a single UTXORef as protobuf. */
40
+ const encodeUtxoRef = ({ txid, vout }) => concatBytes(protoString(1, txid), protoVarint(2, BigInt(vout)));
41
+ /** Encodes MsgClaimWithProof as protobuf bytes. */
42
+ const buildMsgClaimWithProof = (input) => {
43
+ const utxoBytes = input.utxos.map(utxo => protoBytes(2, encodeUtxoRef(utxo)));
44
+ return concatBytes(protoString(1, input.claimer), ...utxoBytes, protoString(3, input.proof), protoString(4, input.messageHash), protoString(5, input.addressHash), protoString(6, input.qbtcAddressHash));
45
+ };
46
+ /** Wraps MsgClaimWithProof in a Cosmos Any message. */
47
+ export const buildClaimWithProofAny = (input) => {
48
+ validateClaimInput(input);
49
+ const msg = buildMsgClaimWithProof(input);
50
+ return concatBytes(protoString(1, msgClaimWithProofTypeURL), protoBytes(2, msg));
51
+ };
52
+ /** Builds the TxBody containing a single MsgClaimWithProof. */
53
+ export const buildClaimTxBody = (input) => {
54
+ const anyMsg = buildClaimWithProofAny(input);
55
+ return protoBytes(1, anyMsg);
56
+ };
57
+ //# sourceMappingURL=buildClaimTx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildClaimTx.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/buildClaimTx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,GACZ,MAAM,uDAAuD,CAAA;AAE9D,MAAM,wBAAwB,GAAG,iCAAiC,CAAA;AAsBlE,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAE3D,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,cAAsB,EAAE,EAAE;IACxE,IAAI,KAAK,CAAC,MAAM,KAAK,cAAc,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,YAAY,cAAc,mBAAmB,KAAK,CAAC,MAAM,EAAE,CACnE,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAkC,EAAE,EAAE;IACvE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,KAAK,CAAA;IAEzE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IAClE,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,IAAI,CAAC,KAA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AAmD;AACnD,MAAM,sBAAsB,GAAG,CAC7B,KAAkC,EACtB,EAAE;IACd,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAE7E,OAAO,WAAW,CAChB,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAC7B,GAAG,SAAS,EACZ,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAC3B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,EACjC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,EACjC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CACtC,CAAA;AACH,CAAC,CAAA;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAkC,EACtB,EAAE;IACd,kBAAkB,CAAC,KAAK,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;IACzC,OAAO,WAAW,CAChB,WAAW,CAAC,CAAC,EAAE,wBAAwB,CAAC,EACxC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CACnB,CAAA;AACH,CAAC,CAAA;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAkC,EACtB,EAAE;IACd,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;IAC5C,OAAO,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AAC9B,CAAC,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { QbtcClaimCircuit } from './BtcAddressType.js';
2
+ /**
3
+ * Computes the address hash for QBTC claiming.
4
+ * - ECDSA types: Hash160(compressedPubkey) — 20 bytes
5
+ * - Taproot (Schnorr): x-only pubkey (last 32 bytes of 33-byte compressed key)
6
+ */
7
+ export declare const computeAddressHash: ({ compressedPubkey, circuit, }: {
8
+ compressedPubkey: Uint8Array;
9
+ circuit: QbtcClaimCircuit;
10
+ }) => Uint8Array;
11
+ /** Computes SHA256 of the QBTC bech32 address string. */
12
+ export declare const computeQbtcAddressHash: (qbtcAddress: string) => Uint8Array;
13
+ /** Computes the first 8 bytes of SHA256 of the chain ID. */
14
+ export declare const computeChainIdHash: (chainId: string) => Uint8Array;
15
+ type ComputeClaimMessageHashInput = {
16
+ addressHash: Uint8Array;
17
+ qbtcAddressHash: Uint8Array;
18
+ chainIdHash: Uint8Array;
19
+ circuit: QbtcClaimCircuit;
20
+ };
21
+ /**
22
+ * Computes the final MessageHash for the QBTC claim.
23
+ *
24
+ * ```
25
+ * MessageHash = SHA256(prefix + addressHash + qbtcAddressHash + chainIdHash + "qbtc-claim-v1")
26
+ * ```
27
+ *
28
+ * Where prefix is `"ecdsa:"` or `"schnorr:"` depending on the BTC address type.
29
+ */
30
+ export declare const computeClaimMessageHash: ({ addressHash, qbtcAddressHash, chainIdHash, circuit, }: ComputeClaimMessageHashInput) => Uint8Array;
31
+ type ComputeAllClaimHashesInput = {
32
+ btcAddress: string;
33
+ compressedPubkey: Uint8Array;
34
+ qbtcAddress: string;
35
+ chainId: string;
36
+ };
37
+ type ClaimHashes = {
38
+ messageHash: Uint8Array;
39
+ addressHash: Uint8Array;
40
+ qbtcAddressHash: Uint8Array;
41
+ circuit: QbtcClaimCircuit;
42
+ };
43
+ /**
44
+ * Convenience function that computes all hashes needed for a QBTC claim
45
+ * in a single call.
46
+ */
47
+ export declare const computeAllClaimHashes: ({ btcAddress, compressedPubkey, qbtcAddress, chainId, }: ComputeAllClaimHashesInput) => ClaimHashes;
48
+ export {};
49
+ //# sourceMappingURL=computeClaimHashes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeClaimHashes.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/computeClaimHashes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAQ1E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,gCAGhC;IACD,gBAAgB,EAAE,UAAU,CAAA;IAC5B,OAAO,EAAE,gBAAgB,CAAA;CAC1B,KAAG,UAcH,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,KAAG,UACd,CAAA;AAE/C,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,UACE,CAAA;AAEvD,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,UAAU,CAAA;IACvB,eAAe,EAAE,UAAU,CAAA;IAC3B,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAAI,yDAKrC,4BAA4B,KAAG,UAsCjC,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,UAAU,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,UAAU,CAAA;IACvB,eAAe,EAAE,UAAU,CAAA;IAC3B,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,yDAKnC,0BAA0B,KAAG,WAgB/B,CAAA"}
@@ -0,0 +1,85 @@
1
+ import { ripemd160 } from '@noble/hashes/legacy.js';
2
+ import { sha256 } from '@noble/hashes/sha2.js';
3
+ import { btcAddressTypeCircuit } from './BtcAddressType.js';
4
+ import { detectBtcAddressType } from './detectBtcAddressType.js';
5
+ const claimSuffix = 'qbtc-claim-v1';
6
+ /** Hash160 = RIPEMD160(SHA256(data)), the standard Bitcoin hash. */
7
+ const hash160 = (data) => ripemd160(sha256(data));
8
+ /**
9
+ * Computes the address hash for QBTC claiming.
10
+ * - ECDSA types: Hash160(compressedPubkey) — 20 bytes
11
+ * - Taproot (Schnorr): x-only pubkey (last 32 bytes of 33-byte compressed key)
12
+ */
13
+ export const computeAddressHash = ({ compressedPubkey, circuit, }) => {
14
+ if (compressedPubkey.length !== 33 ||
15
+ (compressedPubkey[0] !== 0x02 && compressedPubkey[0] !== 0x03)) {
16
+ throw new Error('compressedPubkey must be a 33-byte compressed secp256k1 key');
17
+ }
18
+ if (circuit === 'schnorr') {
19
+ return compressedPubkey.slice(1, 33);
20
+ }
21
+ return hash160(compressedPubkey);
22
+ };
23
+ /** Computes SHA256 of the QBTC bech32 address string. */
24
+ export const computeQbtcAddressHash = (qbtcAddress) => sha256(new TextEncoder().encode(qbtcAddress));
25
+ /** Computes the first 8 bytes of SHA256 of the chain ID. */
26
+ export const computeChainIdHash = (chainId) => sha256(new TextEncoder().encode(chainId)).slice(0, 8);
27
+ /**
28
+ * Computes the final MessageHash for the QBTC claim.
29
+ *
30
+ * ```
31
+ * MessageHash = SHA256(prefix + addressHash + qbtcAddressHash + chainIdHash + "qbtc-claim-v1")
32
+ * ```
33
+ *
34
+ * Where prefix is `"ecdsa:"` or `"schnorr:"` depending on the BTC address type.
35
+ */
36
+ export const computeClaimMessageHash = ({ addressHash, qbtcAddressHash, chainIdHash, circuit, }) => {
37
+ const expectedAddressHashLength = circuit === 'schnorr' ? 32 : 20;
38
+ if (addressHash.length !== expectedAddressHashLength) {
39
+ throw new Error(`addressHash must be ${expectedAddressHashLength} bytes for ${circuit}`);
40
+ }
41
+ if (qbtcAddressHash.length !== 32) {
42
+ throw new Error('qbtcAddressHash must be 32 bytes');
43
+ }
44
+ if (chainIdHash.length !== 8) {
45
+ throw new Error('chainIdHash must be 8 bytes');
46
+ }
47
+ const encoder = new TextEncoder();
48
+ const prefix = encoder.encode(`${circuit}:`);
49
+ const suffix = encoder.encode(claimSuffix);
50
+ const message = new Uint8Array(prefix.length +
51
+ addressHash.length +
52
+ qbtcAddressHash.length +
53
+ chainIdHash.length +
54
+ suffix.length);
55
+ let offset = 0;
56
+ message.set(prefix, offset);
57
+ offset += prefix.length;
58
+ message.set(addressHash, offset);
59
+ offset += addressHash.length;
60
+ message.set(qbtcAddressHash, offset);
61
+ offset += qbtcAddressHash.length;
62
+ message.set(chainIdHash, offset);
63
+ offset += chainIdHash.length;
64
+ message.set(suffix, offset);
65
+ return sha256(message);
66
+ };
67
+ /**
68
+ * Convenience function that computes all hashes needed for a QBTC claim
69
+ * in a single call.
70
+ */
71
+ export const computeAllClaimHashes = ({ btcAddress, compressedPubkey, qbtcAddress, chainId, }) => {
72
+ const addressType = detectBtcAddressType(btcAddress);
73
+ const circuit = btcAddressTypeCircuit[addressType];
74
+ const addressHash = computeAddressHash({ compressedPubkey, circuit });
75
+ const qbtcAddressHash = computeQbtcAddressHash(qbtcAddress);
76
+ const chainIdHash = computeChainIdHash(chainId);
77
+ const messageHash = computeClaimMessageHash({
78
+ addressHash,
79
+ qbtcAddressHash,
80
+ chainIdHash,
81
+ circuit,
82
+ });
83
+ return { messageHash, addressHash, qbtcAddressHash, circuit };
84
+ };
85
+ //# sourceMappingURL=computeClaimHashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeClaimHashes.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/computeClaimHashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAE,qBAAqB,EAAoB,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,WAAW,GAAG,eAAe,CAAA;AAEnC,oEA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,OAAO,CAAC,CAAA;AACxB,CAAC,CAAA;AAgBD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,OAAO,GACoB,EAAe,EAAE;IAC5C,MAAM,WAAW,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA;IACpD,MAAM,OAAO,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAA;IAElD,MAAM,WAAW,GAAG,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAA;IACrE,MAAM,eAAe,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAC3D,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAE/C,MAAM,WAAW,GAAG,uBAAuB,CAAC;QAC1C,WAAW;QACX,eAAe;QACf,WAAW;QACX,OAAO;KACR,CAAC,CAAA;IAEF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,CAAA;AAC/D,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { BtcAddressType } from './BtcAddressType.js';
2
+ /**
3
+ * Detects the Bitcoin address type from the address string format.
4
+ *
5
+ * | Format | Type |
6
+ * |---------------------|-------------|
7
+ * | `1...` | P2PKH |
8
+ * | `3...` | P2SH-P2WPKH |
9
+ * | `bc1q...` (42 chars)| P2WPKH |
10
+ * | `bc1q...` (62 chars)| P2WSH |
11
+ * | `bc1p...` (62 chars)| P2TR |
12
+ */
13
+ export declare const detectBtcAddressType: (address: string) => BtcAddressType;
14
+ //# sourceMappingURL=detectBtcAddressType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectBtcAddressType.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/detectBtcAddressType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,cAgBtD,CAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Detects the Bitcoin address type from the address string format.
3
+ *
4
+ * | Format | Type |
5
+ * |---------------------|-------------|
6
+ * | `1...` | P2PKH |
7
+ * | `3...` | P2SH-P2WPKH |
8
+ * | `bc1q...` (42 chars)| P2WPKH |
9
+ * | `bc1q...` (62 chars)| P2WSH |
10
+ * | `bc1p...` (62 chars)| P2TR |
11
+ */
12
+ export const detectBtcAddressType = (address) => {
13
+ if (address.startsWith('1'))
14
+ return 'p2pkh';
15
+ if (address.startsWith('3'))
16
+ return 'p2sh-p2wpkh';
17
+ if (address.startsWith('bc1p')) {
18
+ if (address.length === 62)
19
+ return 'p2tr';
20
+ throw new Error(`Unsupported Bitcoin address format: ${address}`);
21
+ }
22
+ if (address.startsWith('bc1q')) {
23
+ if (address.length === 42)
24
+ return 'p2wpkh';
25
+ if (address.length === 62)
26
+ return 'p2wsh';
27
+ throw new Error(`Unsupported Bitcoin address format: ${address}`);
28
+ }
29
+ throw new Error(`Unsupported Bitcoin address format: ${address}`);
30
+ };
31
+ //# sourceMappingURL=detectBtcAddressType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectBtcAddressType.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/detectBtcAddressType.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAkB,EAAE;IACtE,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAA;IAC3C,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,aAAa,CAAA;IAEjD,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,MAAM,CAAA;QACxC,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAA;IACnE,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,QAAQ,CAAA;QAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,OAAO,CAAA;QACzC,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAA;IACnE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAA;AACnE,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** Checks whether the ClaimWithProof feature is disabled on the QBTC chain. */
2
+ export declare const getClaimWithProofDisabled: () => Promise<boolean>;
3
+ //# sourceMappingURL=getClaimWithProofDisabled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClaimWithProofDisabled.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.ts"],"names":[],"mappings":"AAUA,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,OAAO,CAajE,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { qbtcRestUrl } from '@vultisig/core-chain/chains/cosmos/qbtc/tendermintRpcUrl';
2
+ import { queryUrl } from '@vultisig/lib-utils/query/queryUrl';
3
+ /** Checks whether the ClaimWithProof feature is disabled on the QBTC chain. */
4
+ export const getClaimWithProofDisabled = async () => {
5
+ const url = `${qbtcRestUrl}/qbtc/v1/params/ClaimWithProofDisabled`;
6
+ const { param } = await queryUrl(url);
7
+ const parsedValue = Number(param.value);
8
+ if (!Number.isFinite(parsedValue)) {
9
+ throw new Error(`Invalid ClaimWithProofDisabled value: ${String(param.value)}`);
10
+ }
11
+ return parsedValue > 0;
12
+ };
13
+ //# sourceMappingURL=getClaimWithProofDisabled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClaimWithProofDisabled.js","sourceRoot":"","sources":["../../../../../../../../packages/core/chain/chains/cosmos/qbtc/claim/getClaimWithProofDisabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAA;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAS7D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,IAAsB,EAAE;IACpE,MAAM,GAAG,GAAG,GAAG,WAAW,wCAAwC,CAAA;IAElE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAqB,GAAG,CAAC,CAAA;IACzD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAEvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,yCAAyC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAC/D,CAAA;IACH,CAAC;IAED,OAAO,WAAW,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA"}