@argonprotocol/bitcoin 1.4.11-dev.f3bdc948 → 1.4.12-dev.2afa6e4a

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.
@@ -2,7 +2,7 @@ import { Transaction } from '@scure/btc-signer';
2
2
  export { Address, Transaction, p2pk, p2pkh, p2sh, p2wpkh, p2wsh } from '@scure/btc-signer';
3
3
  import { HDKey, Versions } from '@scure/bip32';
4
4
  export { HDKey } from '@scure/bip32';
5
- import { IBitcoinLock, IReleaseRequest, ArgonPrimitivesBitcoinBitcoinNetwork } from '@argonprotocol/mainchain';
5
+ import { ArgonPrimitivesBitcoinBitcoinNetwork } from '@argonprotocol/mainchain';
6
6
  import { BTC_NETWORK } from '@scure/btc-signer/utils';
7
7
  import * as bip39 from '@scure/bip39';
8
8
  export { bip39 };
@@ -29,10 +29,29 @@ declare enum BitcoinNetwork {
29
29
  Regtest = 3,
30
30
  }
31
31
 
32
+ type ICosignScriptLock = {
33
+ createdAtHeight: number;
34
+ fundedSatoshis: bigint;
35
+ openClaimHeight: number;
36
+ ownerPubkey: string;
37
+ p2wshScriptHashHex: string;
38
+ securitizedSatoshis: bigint;
39
+ vaultClaimHeight: number;
40
+ vaultClaimPubkey: string;
41
+ vaultPubkey: string;
42
+ vaultXpubSources: {
43
+ parentFingerprint: Uint8Array;
44
+ cosignHdIndex: number;
45
+ };
46
+ };
47
+ type IBitcoinReleaseRequest = {
48
+ bitcoinNetworkFee: bigint;
49
+ toScriptPubkey: string;
50
+ };
32
51
  declare class CosignScript {
33
- readonly lock: IBitcoinLock;
52
+ readonly lock: ICosignScriptLock;
34
53
  private network;
35
- constructor(lock: IBitcoinLock, network: BitcoinNetwork);
54
+ constructor(lock: ICosignScriptLock, network: BitcoinNetwork);
36
55
  getFundingPsbt(): Uint8Array;
37
56
  calculateFee(feeRatePerSatVb: bigint, toScriptPubkey: string): bigint;
38
57
  calculateScriptPubkey(): string;
@@ -41,8 +60,8 @@ declare class CosignScript {
41
60
  txid: string;
42
61
  vout: number;
43
62
  };
44
- releaseRequest: IReleaseRequest;
45
- utxoSatoshis?: bigint;
63
+ releaseRequest: IBitcoinReleaseRequest;
64
+ utxoSatoshis: bigint;
46
65
  }): Transaction;
47
66
  psbtFromHex(psbtHex: string): Transaction;
48
67
  /**
@@ -51,17 +70,18 @@ declare class CosignScript {
51
70
  * @param lock - The Bitcoin lock containing the vault information.
52
71
  * @param vaultXpriv - The vault's extended private key of which the xpub was used to create the vault.
53
72
  */
54
- vaultCosignPsbt(psbt: Transaction, lock: IBitcoinLock, vaultXpriv: HDKey): Transaction;
73
+ vaultCosignPsbt(psbt: Transaction, lock: ICosignScriptLock, vaultXpriv: HDKey): Transaction;
55
74
  /**
56
75
  * Cosigns the transaction.
57
76
  */
58
77
  cosignAndGenerateTx(args: {
59
- releaseRequest: IReleaseRequest;
78
+ releaseRequest: IBitcoinReleaseRequest;
60
79
  vaultCosignature: Uint8Array;
61
80
  utxoRef: {
62
81
  txid: string;
63
82
  vout: number;
64
83
  };
84
+ utxoSatoshis: bigint;
65
85
  ownerXpriv: HDKey;
66
86
  ownerXprivChildHdPath?: string;
67
87
  addTx?: string;
@@ -72,6 +92,7 @@ declare function getBitcoinNetworkFromApi(network: ArgonPrimitivesBitcoinBitcoin
72
92
  declare function getBip32Version(network?: BitcoinNetwork): Versions | undefined;
73
93
  declare function getChildXpriv(bip39Seed: Uint8Array, hdPath: string, network?: BitcoinNetwork): HDKey;
74
94
  declare function getXpubFromXpriv(xpriv: HDKey): string;
95
+ declare function getXpubBytes(xpub: string): Uint8Array;
75
96
  declare function getCompressedPubkey(pubkey: string | Uint8Array): Uint8Array;
76
97
  declare function getBech32Prefix(network: BitcoinNetwork): string;
77
98
  declare function p2wshScriptHexToAddress(scriptPubKeyHex: string, network: BitcoinNetwork): string;
@@ -79,4 +100,4 @@ declare function addressBytesHex(address: string, network: BitcoinNetwork): stri
79
100
  declare function keyToU8a(pubkey: string | Uint8Array): Uint8Array;
80
101
  declare function getScureNetwork(network: BitcoinNetwork): BTC_NETWORK;
81
102
 
82
- export { BitcoinNetwork, CosignScript, addressBytesHex, getBech32Prefix, getBip32Version, getBitcoinNetworkFromApi, getChildXpriv, getCompressedPubkey, getScureNetwork, getXpubFromXpriv, keyToU8a, p2wshScriptHexToAddress };
103
+ export { BitcoinNetwork, CosignScript, type IBitcoinReleaseRequest, type ICosignScriptLock, addressBytesHex, getBech32Prefix, getBip32Version, getBitcoinNetworkFromApi, getChildXpriv, getCompressedPubkey, getScureNetwork, getXpubBytes, getXpubFromXpriv, keyToU8a, p2wshScriptHexToAddress };