@gvnrdao/dh-lit-actions 0.0.81 → 0.0.112

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 (74) hide show
  1. package/package.json +7 -2
  2. package/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.d.ts +1 -9
  3. package/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.d.ts.map +1 -1
  4. package/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js +139 -151
  5. package/pkg-dist/pkg-src/constants/chunks/lit-actions-registry.js.map +1 -1
  6. package/pkg-dist/pkg-src/constants/chunks/package-registry.d.ts.map +1 -1
  7. package/pkg-dist/pkg-src/constants/chunks/package-registry.js +0 -2
  8. package/pkg-dist/pkg-src/constants/chunks/package-registry.js.map +1 -1
  9. package/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.d.ts +12 -0
  10. package/pkg-dist/pkg-src/interfaces/chunks/diamond-hands-lit-actions.i.d.ts.map +1 -1
  11. package/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.d.ts +0 -2
  12. package/pkg-dist/pkg-src/interfaces/chunks/lit-action-registry.i.d.ts.map +1 -1
  13. package/pkg-dist/pkg-src/utils/chunks/cid-utils.d.ts.map +1 -1
  14. package/pkg-dist/pkg-src/utils/chunks/cid-utils.js +5 -0
  15. package/pkg-dist/pkg-src/utils/chunks/cid-utils.js.map +1 -1
  16. package/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.d.ts.map +1 -1
  17. package/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js +18 -4
  18. package/pkg-dist/pkg-src/utils/chunks/lit-action-helpers.js.map +1 -1
  19. package/pkg-dist/pkg-src/utils/chunks/pkp-setup.d.ts.map +1 -1
  20. package/pkg-dist/pkg-src/utils/chunks/pkp-setup.js +6 -2
  21. package/pkg-dist/pkg-src/utils/chunks/pkp-setup.js.map +1 -1
  22. package/pkg-dist/src/constants/chunks/bitcoin-network-config.js +4 -4
  23. package/pkg-dist/src/constants/chunks/bitcoin-network-config.js.map +1 -1
  24. package/pkg-dist/src/constants/chunks/quantum-time.d.ts +7 -7
  25. package/pkg-dist/src/constants/chunks/quantum-time.js +7 -7
  26. package/pkg-dist/src/interfaces/chunks/bitcoin-data-provider.i.d.ts +6 -0
  27. package/pkg-dist/src/interfaces/chunks/bitcoin-data-provider.i.d.ts.map +1 -1
  28. package/pkg-dist/src/interfaces/chunks/owner-authorization.d.ts +18 -0
  29. package/pkg-dist/src/interfaces/chunks/owner-authorization.d.ts.map +1 -1
  30. package/pkg-dist/src/interfaces/chunks/vault-balance-module.i.d.ts +2 -1
  31. package/pkg-dist/src/interfaces/chunks/vault-balance-module.i.d.ts.map +1 -1
  32. package/pkg-dist/src/interfaces/chunks/vault-balance.i.d.ts +2 -0
  33. package/pkg-dist/src/interfaces/chunks/vault-balance.i.d.ts.map +1 -1
  34. package/pkg-dist/src/interfaces/chunks/vault-snapshot.i.d.ts +2 -0
  35. package/pkg-dist/src/interfaces/chunks/vault-snapshot.i.d.ts.map +1 -1
  36. package/pkg-dist/src/modules/authorization.module.d.ts +86 -0
  37. package/pkg-dist/src/modules/authorization.module.d.ts.map +1 -1
  38. package/pkg-dist/src/modules/authorization.module.js +175 -0
  39. package/pkg-dist/src/modules/authorization.module.js.map +1 -1
  40. package/pkg-dist/src/modules/bitcoin/address.d.ts +40 -0
  41. package/pkg-dist/src/modules/bitcoin/address.d.ts.map +1 -0
  42. package/pkg-dist/src/modules/bitcoin/address.js +323 -0
  43. package/pkg-dist/src/modules/bitcoin/address.js.map +1 -0
  44. package/pkg-dist/src/modules/bitcoin/provider.d.ts +55 -0
  45. package/pkg-dist/src/modules/bitcoin/provider.d.ts.map +1 -0
  46. package/pkg-dist/src/modules/bitcoin/provider.js +67 -0
  47. package/pkg-dist/src/modules/bitcoin/provider.js.map +1 -0
  48. package/pkg-dist/src/modules/bitcoin/signature.d.ts +24 -0
  49. package/pkg-dist/src/modules/bitcoin/signature.d.ts.map +1 -0
  50. package/pkg-dist/src/modules/bitcoin/signature.js +64 -0
  51. package/pkg-dist/src/modules/bitcoin/signature.js.map +1 -0
  52. package/pkg-dist/src/modules/bitcoin/transaction.d.ts +63 -0
  53. package/pkg-dist/src/modules/bitcoin/transaction.d.ts.map +1 -0
  54. package/pkg-dist/src/modules/bitcoin/transaction.js +187 -0
  55. package/pkg-dist/src/modules/bitcoin/transaction.js.map +1 -0
  56. package/pkg-dist/src/modules/bitcoin-data-provider.module.d.ts +19 -0
  57. package/pkg-dist/src/modules/bitcoin-data-provider.module.d.ts.map +1 -1
  58. package/pkg-dist/src/modules/bitcoin-data-provider.module.js +162 -18
  59. package/pkg-dist/src/modules/bitcoin-data-provider.module.js.map +1 -1
  60. package/pkg-dist/src/modules/price-oracle.module.d.ts.map +1 -1
  61. package/pkg-dist/src/modules/price-oracle.module.js +65 -67
  62. package/pkg-dist/src/modules/price-oracle.module.js.map +1 -1
  63. package/pkg-dist/src/modules/quantum-time.module.d.ts +1 -1
  64. package/pkg-dist/src/modules/quantum-time.module.d.ts.map +1 -1
  65. package/pkg-dist/src/modules/quantum-time.module.js +9 -6
  66. package/pkg-dist/src/modules/quantum-time.module.js.map +1 -1
  67. package/pkg-dist/src/modules/vault-balance.module.d.ts +3 -1
  68. package/pkg-dist/src/modules/vault-balance.module.d.ts.map +1 -1
  69. package/pkg-dist/src/modules/vault-balance.module.js +59 -2
  70. package/pkg-dist/src/modules/vault-balance.module.js.map +1 -1
  71. package/pkg-dist/src/modules/vault-snapshot.d.ts +11 -1
  72. package/pkg-dist/src/modules/vault-snapshot.d.ts.map +1 -1
  73. package/pkg-dist/src/modules/vault-snapshot.js +123 -33
  74. package/pkg-dist/src/modules/vault-snapshot.js.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/modules/bitcoin/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM;IAI/B;;;;;;OAMG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,GAAE,MAAU,GAC3B,OAAO,CAAC,IAAI,EAAE,CAAC;IAQlB;;;;;;OAMG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlE;;;;;;OAMG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnE;;;;;OAKG;IACG,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM3D"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Bitcoin Provider Module
4
+ *
5
+ * Provides Bitcoin blockchain data access through RPC provider.
6
+ * Supports UTXO queries, scriptPubKey retrieval, and transaction queries.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BitcoinProvider = void 0;
10
+ /**
11
+ * Bitcoin RPC provider client
12
+ */
13
+ class BitcoinProvider {
14
+ constructor(providerUrl) {
15
+ this.providerUrl = providerUrl;
16
+ }
17
+ /**
18
+ * Get UTXOs for Bitcoin address
19
+ *
20
+ * @param address - Bitcoin address
21
+ * @param minConfirmations - Minimum confirmations required
22
+ * @returns Array of UTXOs
23
+ */
24
+ async getUtxos(address, minConfirmations = 1) {
25
+ // Query UTXOs from provider
26
+ // Implementation depends on provider API (Bitcoin Core RPC, Esplora, etc.)
27
+ // Placeholder - actual implementation would call provider API
28
+ throw new Error("getUtxos not implemented - provider-specific");
29
+ }
30
+ /**
31
+ * Get scriptPubKey for transaction output
32
+ *
33
+ * @param txid - Transaction ID
34
+ * @param vout - Output index
35
+ * @returns ScriptPubKey hex string
36
+ */
37
+ async getScriptPubKey(txid, vout) {
38
+ // Query transaction and extract scriptPubKey from specified output
39
+ // Placeholder - actual implementation would call provider API
40
+ throw new Error("getScriptPubKey not implemented - provider-specific");
41
+ }
42
+ /**
43
+ * Check if UTXO exists and is unspent
44
+ *
45
+ * @param txid - Transaction ID
46
+ * @param vout - Output index
47
+ * @returns true if UTXO exists and is unspent
48
+ */
49
+ async checkUtxoExists(txid, vout) {
50
+ // Query UTXO status from provider
51
+ // Placeholder - actual implementation would call provider API
52
+ throw new Error("checkUtxoExists not implemented - provider-specific");
53
+ }
54
+ /**
55
+ * Broadcast Bitcoin transaction
56
+ *
57
+ * @param txHex - Signed transaction hex
58
+ * @returns Transaction ID
59
+ */
60
+ async broadcastTransaction(txHex) {
61
+ // Send raw transaction to Bitcoin network
62
+ // Placeholder - actual implementation would call provider API
63
+ throw new Error("broadcastTransaction not implemented - provider-specific");
64
+ }
65
+ }
66
+ exports.BitcoinProvider = BitcoinProvider;
67
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/modules/bitcoin/provider.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAaH;;GAEG;AACH,MAAa,eAAe;IAG1B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CACZ,OAAe,EACf,mBAA2B,CAAC;QAE5B,4BAA4B;QAC5B,2EAA2E;QAE3E,8DAA8D;QAC9D,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,IAAY;QAC9C,mEAAmE;QAEnE,8DAA8D;QAC9D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,IAAY;QAC9C,kCAAkC;QAElC,8DAA8D;QAC9D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,oBAAoB,CAAC,KAAa;QACtC,0CAA0C;QAE1C,8DAA8D;QAC9D,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;CACF;AAjED,0CAiEC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Bitcoin Signature Module
3
+ *
4
+ * Handles conversion of Ethereum-format signatures to Bitcoin DER format.
5
+ * Implements BIP 62 s-value normalization and DER encoding.
6
+ *
7
+ * CRITICAL: Handles both prefixed (0x...) and non-prefixed hex strings correctly.
8
+ * LIT Protocol returns signatures without 0x prefix.
9
+ */
10
+ /**
11
+ * Convert Ethereum signature to Bitcoin DER format
12
+ *
13
+ * CRITICAL FIX: Conditional prefix removal
14
+ * - LIT Protocol returns {r: '59f9d5b0...', s: '6b5a9233...'} (NO 0x prefix)
15
+ * - Must check for prefix before slicing to avoid removing first data byte
16
+ *
17
+ * @param sig - Ethereum signature {r: string, s: string}
18
+ * @returns DER-encoded signature (hex string)
19
+ */
20
+ export declare function ethereumSignatureToBtcSignature(sig: {
21
+ r: string;
22
+ s: string;
23
+ }): string;
24
+ //# sourceMappingURL=signature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/modules/bitcoin/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAAC,GAAG,EAAE;IACnD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,GAAG,MAAM,CA+CT"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * Bitcoin Signature Module
4
+ *
5
+ * Handles conversion of Ethereum-format signatures to Bitcoin DER format.
6
+ * Implements BIP 62 s-value normalization and DER encoding.
7
+ *
8
+ * CRITICAL: Handles both prefixed (0x...) and non-prefixed hex strings correctly.
9
+ * LIT Protocol returns signatures without 0x prefix.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ethereumSignatureToBtcSignature = ethereumSignatureToBtcSignature;
13
+ /**
14
+ * Convert Ethereum signature to Bitcoin DER format
15
+ *
16
+ * CRITICAL FIX: Conditional prefix removal
17
+ * - LIT Protocol returns {r: '59f9d5b0...', s: '6b5a9233...'} (NO 0x prefix)
18
+ * - Must check for prefix before slicing to avoid removing first data byte
19
+ *
20
+ * @param sig - Ethereum signature {r: string, s: string}
21
+ * @returns DER-encoded signature (hex string)
22
+ */
23
+ function ethereumSignatureToBtcSignature(sig) {
24
+ // CRITICAL FIX: Conditional prefix removal
25
+ // Check for 0x prefix before slicing to avoid removing first data byte
26
+ const rHex = sig.r.startsWith("0x") ? sig.r.slice(2) : sig.r;
27
+ const sHex = sig.s.startsWith("0x") ? sig.s.slice(2) : sig.s;
28
+ let r = Buffer.from(rHex, "hex");
29
+ let s = Buffer.from(sHex, "hex");
30
+ // BIP 62: s-value normalization (low-s requirement)
31
+ // Bitcoin requires s <= n/2 where n is the curve order
32
+ // If s > n/2, replace with n - s
33
+ // @ts-ignore - EC available in LIT runtime (elliptic library)
34
+ const EC = require("elliptic").ec;
35
+ const secp256k1 = new EC("secp256k1");
36
+ const n = secp256k1.curve.n;
37
+ let sBN = BigInt("0x" + s.toString("hex"));
38
+ const halfN = n.divn(2);
39
+ if (sBN > BigInt(halfN.toString())) {
40
+ // s is too large, normalize it
41
+ sBN = BigInt(n.toString()) - sBN;
42
+ s = Buffer.from(sBN.toString(16).padStart(64, "0"), "hex");
43
+ }
44
+ // Ensure positive representation (DER requires leading 0x00 if high bit set)
45
+ // If first byte >= 0x80, prepend 0x00 to indicate positive number
46
+ if (r[0] >= 0x80) {
47
+ r = Buffer.concat([Buffer.from([0x00]), r]);
48
+ }
49
+ if (s[0] >= 0x80) {
50
+ s = Buffer.concat([Buffer.from([0x00]), s]);
51
+ }
52
+ // Remove leading zero bytes (unless needed for sign bit)
53
+ while (r.length > 1 && r[0] === 0x00 && r[1] < 0x80) {
54
+ r = r.slice(1);
55
+ }
56
+ while (s.length > 1 && s[0] === 0x00 && s[1] < 0x80) {
57
+ s = s.slice(1);
58
+ }
59
+ // DER encode using bip66
60
+ // @ts-ignore - bip66 available in LIT runtime
61
+ const bip66 = require("bip66");
62
+ return Buffer.from(bip66.encode(r, s)).toString("hex");
63
+ }
64
+ //# sourceMappingURL=signature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature.js","sourceRoot":"","sources":["../../../../src/modules/bitcoin/signature.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAYH,0EAkDC;AA5DD;;;;;;;;;GASG;AACH,SAAgB,+BAA+B,CAAC,GAG/C;IACC,2CAA2C;IAC3C,uEAAuE;IACvE,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7D,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,K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M,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QACpD,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QACpD,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,yBAAyB;IACzB,8CAA8C;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Bitcoin Transaction Module
3
+ *
4
+ * Provides Bitcoin transaction building and signature hash computation.
5
+ * Implements Bitcoin protocol transaction structure and SIGHASH_ALL signing.
6
+ */
7
+ /**
8
+ * UTXO input for transaction building
9
+ */
10
+ export interface UTXOInput {
11
+ txid: string;
12
+ vout: number;
13
+ value: number;
14
+ scriptPubKey: string;
15
+ }
16
+ /**
17
+ * Transaction building parameters
18
+ */
19
+ export interface TransactionParams {
20
+ utxo: UTXOInput;
21
+ destination: string;
22
+ amount: number;
23
+ changeAddress: string;
24
+ changeAmount: number;
25
+ network: string;
26
+ pkpPublicKey: string;
27
+ }
28
+ /**
29
+ * Transaction building result
30
+ */
31
+ export interface TransactionResult {
32
+ txHex: string;
33
+ sigHash: string;
34
+ }
35
+ /**
36
+ * Build Bitcoin transaction and compute signature hash
37
+ *
38
+ * Creates a SegWit (P2WPKH) Bitcoin transaction following BIP 143:
39
+ * - Version: 4 bytes (little endian) - version 2
40
+ * - Input count: varint
41
+ * - Inputs: txid (reversed) + vout + scriptSig (empty for witness) + sequence
42
+ * - Output count: varint
43
+ * - Outputs: value + scriptPubKey
44
+ * - Locktime: 4 bytes
45
+ *
46
+ * For BIP 143 SIGHASH_ALL signature hash (P2WPKH):
47
+ * The sighash preimage includes:
48
+ * 1. nVersion (4 bytes)
49
+ * 2. hashPrevouts (32 bytes) - double SHA256 of all input outpoints
50
+ * 3. hashSequence (32 bytes) - double SHA256 of all input sequences
51
+ * 4. outpoint (36 bytes) - txid + vout of input being signed
52
+ * 5. scriptCode (variable) - for P2WPKH: OP_DUP OP_HASH160 <20-byte-hash> OP_EQUALVERIFY OP_CHECKSIG
53
+ * 6. value (8 bytes) - value of output being spent
54
+ * 7. nSequence (4 bytes) - sequence of input being signed
55
+ * 8. hashOutputs (32 bytes) - double SHA256 of all outputs
56
+ * 9. nLocktime (4 bytes)
57
+ * 10. nHashType (4 bytes) - SIGHASH_ALL = 0x01000000
58
+ *
59
+ * @param params - Transaction parameters
60
+ * @returns Transaction hex and signature hash
61
+ */
62
+ export declare function buildBitcoinTransaction(params: TransactionParams): TransactionResult;
63
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/modules/bitcoin/transaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CAyInB"}
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ /**
3
+ * Bitcoin Transaction Module
4
+ *
5
+ * Provides Bitcoin transaction building and signature hash computation.
6
+ * Implements Bitcoin protocol transaction structure and SIGHASH_ALL signing.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.buildBitcoinTransaction = buildBitcoinTransaction;
10
+ const address_1 = require("./address");
11
+ /**
12
+ * Build Bitcoin transaction and compute signature hash
13
+ *
14
+ * Creates a SegWit (P2WPKH) Bitcoin transaction following BIP 143:
15
+ * - Version: 4 bytes (little endian) - version 2
16
+ * - Input count: varint
17
+ * - Inputs: txid (reversed) + vout + scriptSig (empty for witness) + sequence
18
+ * - Output count: varint
19
+ * - Outputs: value + scriptPubKey
20
+ * - Locktime: 4 bytes
21
+ *
22
+ * For BIP 143 SIGHASH_ALL signature hash (P2WPKH):
23
+ * The sighash preimage includes:
24
+ * 1. nVersion (4 bytes)
25
+ * 2. hashPrevouts (32 bytes) - double SHA256 of all input outpoints
26
+ * 3. hashSequence (32 bytes) - double SHA256 of all input sequences
27
+ * 4. outpoint (36 bytes) - txid + vout of input being signed
28
+ * 5. scriptCode (variable) - for P2WPKH: OP_DUP OP_HASH160 <20-byte-hash> OP_EQUALVERIFY OP_CHECKSIG
29
+ * 6. value (8 bytes) - value of output being spent
30
+ * 7. nSequence (4 bytes) - sequence of input being signed
31
+ * 8. hashOutputs (32 bytes) - double SHA256 of all outputs
32
+ * 9. nLocktime (4 bytes)
33
+ * 10. nHashType (4 bytes) - SIGHASH_ALL = 0x01000000
34
+ *
35
+ * @param params - Transaction parameters
36
+ * @returns Transaction hex and signature hash
37
+ */
38
+ function buildBitcoinTransaction(params) {
39
+ const { utxo, destination, amount, changeAddress, changeAmount, pkpPublicKey, } = params;
40
+ // Transaction structure components
41
+ const txVersion = "02000000"; // Version 2 (little endian)
42
+ const inputCount = "01"; // 1 input
43
+ // Input: txid (reversed) + vout + empty scriptSig + sequence
44
+ const txidReversed = reverseHex(utxo.txid);
45
+ const voutHex = numToLittleEndianHex(utxo.vout, 4);
46
+ const sequence = "ffffffff"; // No locktime
47
+ // Build outputs
48
+ const outputs = [];
49
+ // Output 1: To destination
50
+ const destinationScript = (0, address_1.addressToScriptPubKey)(destination);
51
+ const destinationValue = numToLittleEndianHex(amount, 8);
52
+ const destinationScriptLen = numToVarInt(destinationScript.length / 2);
53
+ outputs.push(destinationValue + destinationScriptLen + destinationScript);
54
+ // Output 2: Change (if any)
55
+ if (changeAmount > 0) {
56
+ const changeScript = (0, address_1.addressToScriptPubKey)(changeAddress);
57
+ const changeValue = numToLittleEndianHex(changeAmount, 8);
58
+ const changeScriptLen = numToVarInt(changeScript.length / 2);
59
+ outputs.push(changeValue + changeScriptLen + changeScript);
60
+ }
61
+ const outputCount = numToVarInt(outputs.length);
62
+ const outputsHex = outputs.join("");
63
+ const locktime = "00000000"; // No locktime
64
+ // ========================================================================
65
+ // BIP 143 Signature Hash Computation (for P2WPKH)
66
+ // ========================================================================
67
+ // 1. nVersion (4 bytes)
68
+ const nVersion = txVersion;
69
+ // 2. hashPrevouts - double SHA256 of all input outpoints (txid + vout)
70
+ const outpoint = reverseHex(utxo.txid) + voutHex;
71
+ // @ts-ignore - ethers available in LIT runtime
72
+ const hashPrevouts = ethers.utils.sha256(
73
+ // @ts-ignore
74
+ ethers.utils.sha256("0x" + outpoint));
75
+ // 3. hashSequence - double SHA256 of all input sequences
76
+ // @ts-ignore - ethers available in LIT runtime
77
+ const hashSequence = ethers.utils.sha256(
78
+ // @ts-ignore
79
+ ethers.utils.sha256("0x" + sequence));
80
+ // 4. outpoint being signed (txid + vout)
81
+ const outpointSigning = outpoint;
82
+ // 5. scriptCode for P2WPKH
83
+ // For P2WPKH, scriptCode is: OP_DUP OP_HASH160 <20-byte-pubkey-hash> OP_EQUALVERIFY OP_CHECKSIG
84
+ // Extract the 20-byte hash from the P2WPKH scriptPubKey
85
+ const scriptPubKeyHex = utxo.scriptPubKey.startsWith("0x")
86
+ ? utxo.scriptPubKey.slice(2)
87
+ : utxo.scriptPubKey;
88
+ // P2WPKH scriptPubKey format: OP_0 (0x00) + PUSH20 (0x14) + 20-byte-hash
89
+ // Extract the 20-byte hash (skip first 2 bytes: 0x00 0x14)
90
+ const pubkeyHash = scriptPubKeyHex.slice(4); // Skip "0014"
91
+ // Build scriptCode: OP_DUP OP_HASH160 <20-byte-hash> OP_EQUALVERIFY OP_CHECKSIG
92
+ // 0x76 = OP_DUP, 0xa9 = OP_HASH160, 0x14 = PUSH 20 bytes, 0x88 = OP_EQUALVERIFY, 0xac = OP_CHECKSIG
93
+ const scriptCode = "1976a914" + pubkeyHash + "88ac";
94
+ // 6. value of output being spent (8 bytes, little endian)
95
+ const valueHex = numToLittleEndianHex(utxo.value, 8);
96
+ // 7. nSequence of input being signed
97
+ const nSequence = sequence;
98
+ // 8. hashOutputs - double SHA256 of all outputs
99
+ // @ts-ignore - ethers available in LIT runtime
100
+ const hashOutputs = ethers.utils.sha256(
101
+ // @ts-ignore
102
+ ethers.utils.sha256("0x" + outputsHex));
103
+ // 9. nLocktime
104
+ const nLocktime = locktime;
105
+ // 10. nHashType (SIGHASH_ALL = 0x01000000)
106
+ const nHashType = "01000000";
107
+ // Build BIP 143 preimage
108
+ const bip143Preimage = nVersion +
109
+ hashPrevouts.slice(2) + // Remove 0x prefix
110
+ hashSequence.slice(2) +
111
+ outpointSigning +
112
+ scriptCode +
113
+ valueHex +
114
+ nSequence +
115
+ hashOutputs.slice(2) +
116
+ nLocktime +
117
+ nHashType;
118
+ // Double SHA256 for BIP 143 signature hash
119
+ // @ts-ignore - ethers available in LIT runtime
120
+ const hash1 = ethers.utils.sha256("0x" + bip143Preimage);
121
+ // @ts-ignore - ethers available in LIT runtime
122
+ const sigHash = ethers.utils.sha256(hash1);
123
+ // Unsigned transaction WITHOUT SegWit marker/flag
124
+ // SDK will convert this to proper SegWit format using PSBT
125
+ // For P2WPKH, the scriptSig MUST be empty (witness data separate)
126
+ const unsignedTx = txVersion +
127
+ inputCount +
128
+ txidReversed +
129
+ voutHex +
130
+ "00" + // Empty scriptSig - P2WPKH requires this
131
+ sequence +
132
+ outputCount +
133
+ outputsHex +
134
+ locktime;
135
+ return {
136
+ txHex: unsignedTx,
137
+ sigHash: sigHash,
138
+ };
139
+ }
140
+ /**
141
+ * Reverse hex string (for txid byte order)
142
+ * Bitcoin stores txid in reverse byte order
143
+ */
144
+ function reverseHex(hex) {
145
+ const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
146
+ const bytes = clean.match(/../g);
147
+ if (!bytes) {
148
+ throw new Error(`Invalid hex string: ${hex}`);
149
+ }
150
+ return bytes.reverse().join("");
151
+ }
152
+ /**
153
+ * Convert number to little-endian hex
154
+ * Bitcoin uses little-endian byte order
155
+ */
156
+ function numToLittleEndianHex(num, bytes) {
157
+ let hex = num.toString(16).padStart(bytes * 2, "0");
158
+ const pairs = hex.match(/../g);
159
+ if (!pairs) {
160
+ throw new Error(`Invalid hex conversion: ${num}`);
161
+ }
162
+ return pairs.reverse().join("");
163
+ }
164
+ /**
165
+ * VarInt encoding (Bitcoin compact size)
166
+ *
167
+ * Format:
168
+ * - < 0xfd: 1 byte
169
+ * - <= 0xffff: 0xfd + 2 bytes (little endian)
170
+ * - <= 0xffffffff: 0xfe + 4 bytes (little endian)
171
+ * - > 0xffffffff: 0xff + 8 bytes (little endian)
172
+ */
173
+ function numToVarInt(num) {
174
+ if (num < 0xfd) {
175
+ return num.toString(16).padStart(2, "0");
176
+ }
177
+ else if (num <= 0xffff) {
178
+ return "fd" + numToLittleEndianHex(num, 2);
179
+ }
180
+ else if (num <= 0xffffffff) {
181
+ return "fe" + numToLittleEndianHex(num, 4);
182
+ }
183
+ else {
184
+ return "ff" + numToLittleEndianHex(num, 8);
185
+ }
186
+ }
187
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../src/modules/bitcoin/transaction.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA8DH,0DA2IC;AAvMD,uCAAkD;AAiClD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,uBAAuB,CACrC,MAAyB;IAEzB,MAAM,EACJ,IAAI,EACJ,WAAW,EACX,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,GACb,GAAG,MAAM,CAAC;IAEX,mCAAmC;IACnC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,4BAA4B;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,UAAU;IAEnC,6DAA6D;IAC7D,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,cAAc;IAE3C,gBAAgB;IAChB,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,2BAA2B;IAC3B,MAAM,iBAAiB,GAAG,IAAA,+BAAqB,EAAC,WAAW,CAAC,CAAC;IAC7D,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzD,MAAM,oBAAoB,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,gBAAgB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC,CAAC;IAE1E,4BAA4B;IAC5B,IAAI,YAAY,GAAG,CAAC,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,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;SAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,OAAO,IAAI,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;SAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,OAAO,IAAI,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
@@ -20,6 +20,13 @@ export declare class BitcoinDataProvider implements IBitcoinDataProvider {
20
20
  private config;
21
21
  private timeout;
22
22
  constructor(config: BitcoinDataProviderConfig);
23
+ /**
24
+ * Get current Bitcoin block height from provider
25
+ *
26
+ * Returns null if block height cannot be fetched (e.g., provider doesn't support it).
27
+ * This allows graceful degradation for providers that don't implement the Esplora API fully.
28
+ */
29
+ private getCurrentBlockHeight;
23
30
  /**
24
31
  * Fetch all UTXOs for a Bitcoin address
25
32
  *
@@ -49,6 +56,7 @@ export declare class BitcoinDataProvider implements IBitcoinDataProvider {
49
56
  * - Blockstream format: {txid, vout, value, confirmations}
50
57
  *
51
58
  * @param data Raw response from provider API
59
+ * @param currentBlockHeight Current block height (for calculating confirmations from block_height), or null if unavailable
52
60
  * @returns Array of normalized UTXOs
53
61
  */
54
62
  private parseBlockstreamUTXOs;
@@ -71,6 +79,17 @@ export declare class BitcoinDataProvider implements IBitcoinDataProvider {
71
79
  * @returns Complete UTXO set with balance breakdown
72
80
  */
73
81
  getUTXOSet(address: string, minConfirmations: number): Promise<UTXOSet>;
82
+ /**
83
+ * Get balance for a Bitcoin address (fast, no UTXO details)
84
+ *
85
+ * This method uses the standard Esplora /address/:address endpoint
86
+ * to get confirmed balance from chain_stats.
87
+ *
88
+ * @param address - Bitcoin address
89
+ * @returns Balance in satoshis (confirmed balance only)
90
+ * @throws Error if the request fails or response is invalid
91
+ */
92
+ getBalance(address: string): Promise<bigint>;
74
93
  /**
75
94
  * Get transaction with confirmation count
76
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bitcoin-data-provider.module.d.ts","sourceRoot":"","sources":["../../../src/modules/bitcoin-data-provider.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,yBAAyB,EACzB,IAAI,EACJ,OAAO,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,yBAAyB;IAK7C;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAqDhD;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;YACW,iBAAiB;IAqB/B;;;;;;;;;OASG;IACH,OAAO,CAAC,qBAAqB;IAyC7B;;;;;;OAMG;YACW,sBAAsB;IAkDpC;;;;;;;;;OASG;IACG,UAAU,CACd,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,OAAO,CAAC;IAkBnB;;;;;;;;OAQG;IACG,cAAc,CAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CA+E3D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,mBAAmB,CAErB"}
1
+ {"version":3,"file":"bitcoin-data-provider.module.d.ts","sourceRoot":"","sources":["../../../src/modules/bitcoin-data-provider.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,yBAAyB,EACzB,IAAI,EACJ,OAAO,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,yBAAyB;IAO7C;;;;;OAKG;YACW,qBAAqB;IA+DnC;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAqDhD;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;YACW,iBAAiB;IAqB/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,qBAAqB;IA4C7B;;;;;;OAMG;YACW,sBAAsB;IA2DpC;;;;;;;;;OASG;IACG,UAAU,CACd,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,OAAO,CAAC;IAkBnB;;;;;;;;;OASG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuElD;;;;;;;;OAQG;IACG,cAAc,CAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CA+E3D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,mBAAmB,CAErB"}