@argonprotocol/bitcoin 1.4.12 → 1.4.13-dev.94019742

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,14 +2,11 @@ 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 };
9
9
 
10
- /* tslint:disable */
11
- /* eslint-disable */
12
-
13
10
  declare enum BitcoinNetwork {
14
11
  /**
15
12
  * Mainnet Bitcoin.
@@ -29,20 +26,43 @@ declare enum BitcoinNetwork {
29
26
  Regtest = 3,
30
27
  }
31
28
 
29
+ type ICosignScriptLock = {
30
+ createdAtHeight: number;
31
+ fundedSatoshis: bigint;
32
+ openClaimHeight: number;
33
+ ownerPubkey: string;
34
+ p2wshScriptHashHex: string;
35
+ securitizedSatoshis: bigint;
36
+ vaultClaimHeight: number;
37
+ vaultClaimPubkey: string;
38
+ vaultPubkey: string;
39
+ vaultXpubSources: {
40
+ parentFingerprint: Uint8Array;
41
+ cosignHdIndex: number;
42
+ };
43
+ };
44
+ type IBitcoinReleaseRequest = {
45
+ bitcoinNetworkFee: bigint;
46
+ destinationSatoshis: bigint;
47
+ changeSatoshis: bigint;
48
+ toScriptPubkey: string;
49
+ };
32
50
  declare class CosignScript {
33
- readonly lock: IBitcoinLock;
51
+ readonly lock: ICosignScriptLock;
34
52
  private network;
35
- constructor(lock: IBitcoinLock, network: BitcoinNetwork);
53
+ constructor(lock: ICosignScriptLock, network: BitcoinNetwork);
36
54
  getFundingPsbt(): Uint8Array;
37
- calculateFee(feeRatePerSatVb: bigint, toScriptPubkey: string): bigint;
55
+ calculateFee(feeRatePerSatVb: bigint, inputCount: number, toScriptPubkey: string, hasChange: boolean): bigint;
38
56
  calculateScriptPubkey(): string;
39
57
  getCosignPsbt(args: {
40
- utxoRef: {
41
- txid: string;
42
- vout: number;
43
- };
44
- releaseRequest: IReleaseRequest;
45
- utxoSatoshis?: bigint;
58
+ utxos: {
59
+ utxoRef: {
60
+ txid: string;
61
+ vout: number;
62
+ };
63
+ satoshis: bigint;
64
+ }[];
65
+ releaseRequest: IBitcoinReleaseRequest;
46
66
  }): Transaction;
47
67
  psbtFromHex(psbtHex: string): Transaction;
48
68
  /**
@@ -51,20 +71,22 @@ declare class CosignScript {
51
71
  * @param lock - The Bitcoin lock containing the vault information.
52
72
  * @param vaultXpriv - The vault's extended private key of which the xpub was used to create the vault.
53
73
  */
54
- vaultCosignPsbt(psbt: Transaction, lock: IBitcoinLock, vaultXpriv: HDKey): Transaction;
74
+ vaultCosignPsbt(psbt: Transaction, lock: ICosignScriptLock, vaultXpriv: HDKey): Transaction;
55
75
  /**
56
76
  * Cosigns the transaction.
57
77
  */
58
78
  cosignAndGenerateTx(args: {
59
- releaseRequest: IReleaseRequest;
60
- vaultCosignature: Uint8Array;
61
- utxoRef: {
62
- txid: string;
63
- vout: number;
64
- };
79
+ releaseRequest: IBitcoinReleaseRequest;
80
+ vaultCosignatures: Uint8Array[];
81
+ utxos: {
82
+ utxoRef: {
83
+ txid: string;
84
+ vout: number;
85
+ };
86
+ satoshis: bigint;
87
+ }[];
65
88
  ownerXpriv: HDKey;
66
89
  ownerXprivChildHdPath?: string;
67
- addTx?: string;
68
90
  }): Transaction;
69
91
  }
70
92
  declare function getBitcoinNetworkFromApi(network: ArgonPrimitivesBitcoinBitcoinNetwork): BitcoinNetwork;
@@ -72,6 +94,7 @@ declare function getBitcoinNetworkFromApi(network: ArgonPrimitivesBitcoinBitcoin
72
94
  declare function getBip32Version(network?: BitcoinNetwork): Versions | undefined;
73
95
  declare function getChildXpriv(bip39Seed: Uint8Array, hdPath: string, network?: BitcoinNetwork): HDKey;
74
96
  declare function getXpubFromXpriv(xpriv: HDKey): string;
97
+ declare function getXpubBytes(xpub: string): Uint8Array;
75
98
  declare function getCompressedPubkey(pubkey: string | Uint8Array): Uint8Array;
76
99
  declare function getBech32Prefix(network: BitcoinNetwork): string;
77
100
  declare function p2wshScriptHexToAddress(scriptPubKeyHex: string, network: BitcoinNetwork): string;
@@ -79,4 +102,4 @@ declare function addressBytesHex(address: string, network: BitcoinNetwork): stri
79
102
  declare function keyToU8a(pubkey: string | Uint8Array): Uint8Array;
80
103
  declare function getScureNetwork(network: BitcoinNetwork): BTC_NETWORK;
81
104
 
82
- export { BitcoinNetwork, CosignScript, addressBytesHex, getBech32Prefix, getBip32Version, getBitcoinNetworkFromApi, getChildXpriv, getCompressedPubkey, getScureNetwork, getXpubFromXpriv, keyToU8a, p2wshScriptHexToAddress };
105
+ export { BitcoinNetwork, CosignScript, type IBitcoinReleaseRequest, type ICosignScriptLock, addressBytesHex, getBech32Prefix, getBip32Version, getBitcoinNetworkFromApi, getChildXpriv, getCompressedPubkey, getScureNetwork, getXpubBytes, getXpubFromXpriv, keyToU8a, p2wshScriptHexToAddress };