@xchainjs/xchain-bitcoin 0.23.6 → 0.23.7

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/lib/client.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { AssetInfo, FeeRate, PreparedTx, TxHash, TxParams, UTXO, UTXOClient, UtxoClientParams } from '@xchainjs/xchain-client';
2
+ import { AssetInfo, FeeRate, PreparedTx, TxParams, UTXO, UTXOClient, UtxoClientParams } from '@xchainjs/xchain-client';
3
3
  import { Address } from '@xchainjs/xchain-util';
4
4
  import * as Bitcoin from 'bitcoinjs-lib';
5
5
  export declare const defaultBTCParams: UtxoClientParams;
6
6
  /**
7
7
  * Custom Bitcoin client
8
8
  */
9
- declare class Client extends UTXOClient {
9
+ declare abstract class Client extends UTXOClient {
10
10
  /**
11
11
  * Constructor
12
12
  * Client is initialised with network type
@@ -14,39 +14,11 @@ declare class Client extends UTXOClient {
14
14
  * @param {UtxoClientParams} params
15
15
  */
16
16
  constructor(params?: UtxoClientParams);
17
- /**
18
- * @deprecated this function eventually will be removed use getAddressAsync instead
19
- */
20
- getAddress(index?: number): Address;
21
- /**
22
- * Get the current address.
23
- *
24
- * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)
25
- * The address is then decoded into type P2WPKH and returned.
26
- *
27
- * @returns {Address} The current address.
28
- *
29
- * @throws {"Phrase must be provided"} Thrown if phrase has not been set before.
30
- * @throws {"Address not defined"} Thrown if failed creating account from phrase.
31
- */
32
- getAddressAsync(index?: number): Promise<string>;
33
17
  /**
34
18
  *
35
19
  * @returns BTC asset info
36
20
  */
37
21
  getAssetInfo(): AssetInfo;
38
- /**
39
- * @private
40
- * Get private key.
41
- *
42
- * Private function to get keyPair from the this.phrase
43
- *
44
- * @param {string} phrase The phrase to be used for generating privkey
45
- * @returns {ECPairInterface} The privkey generated from the given phrase
46
- *
47
- * @throws {"Could not get private key from phrase"} Throws an error if failed creating BTC keys from the given phrase
48
- * */
49
- private getBtcKeys;
50
22
  /**
51
23
  * Validate the given address.
52
24
  *
@@ -70,17 +42,6 @@ declare class Client extends UTXOClient {
70
42
  * @returns {number} The fee amount.
71
43
  */
72
44
  protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data?: Buffer | null): number;
73
- /**
74
- * Transfer BTC.
75
- *
76
- * @param {TxParams&FeeRate} params The transfer options.
77
- * @returns {TxHash} The transaction hash.
78
- *
79
- * @throws {"memo too long"} Thrown if memo longer than 80 chars.
80
- */
81
- transfer(params: TxParams & {
82
- feeRate?: FeeRate;
83
- }): Promise<TxHash>;
84
45
  /**
85
46
  *
86
47
  * @param param0
@@ -0,0 +1,48 @@
1
+ import { FeeRate, TxHash, TxParams } from '@xchainjs/xchain-client';
2
+ import { Address } from '@xchainjs/xchain-util';
3
+ import { Client } from './client';
4
+ /**
5
+ * Custom Bitcoin client
6
+ */
7
+ declare class ClientKeystore extends Client {
8
+ /**
9
+ * @deprecated this function eventually will be removed use getAddressAsync instead
10
+ */
11
+ getAddress(index?: number): Address;
12
+ /**
13
+ * Get the current address.
14
+ *
15
+ * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)
16
+ * The address is then decoded into type P2WPKH and returned.
17
+ *
18
+ * @returns {Address} The current address.
19
+ *
20
+ * @throws {"Phrase must be provided"} Thrown if phrase has not been set before.
21
+ * @throws {"Address not defined"} Thrown if failed creating account from phrase.
22
+ */
23
+ getAddressAsync(index?: number): Promise<string>;
24
+ /**
25
+ * @private
26
+ * Get private key.
27
+ *
28
+ * Private function to get keyPair from the this.phrase
29
+ *
30
+ * @param {string} phrase The phrase to be used for generating privkey
31
+ * @returns {ECPairInterface} The privkey generated from the given phrase
32
+ *
33
+ * @throws {"Could not get private key from phrase"} Throws an error if failed creating BTC keys from the given phrase
34
+ * */
35
+ private getBtcKeys;
36
+ /**
37
+ * Transfer BTC.
38
+ *
39
+ * @param {TxParams&FeeRate} params The transfer options.
40
+ * @returns {TxHash} The transaction hash.
41
+ *
42
+ * @throws {"memo too long"} Thrown if memo longer than 80 chars.
43
+ */
44
+ transfer(params: TxParams & {
45
+ feeRate?: FeeRate;
46
+ }): Promise<TxHash>;
47
+ }
48
+ export { ClientKeystore };
@@ -0,0 +1,21 @@
1
+ import AppBtc from '@ledgerhq/hw-app-btc';
2
+ import { FeeRate, TxHash, TxParams, UtxoClientParams } from '@xchainjs/xchain-client';
3
+ import { Address } from '@xchainjs/xchain-util';
4
+ import { Client } from './client';
5
+ /**
6
+ * Custom Ledger Bitcoin client
7
+ */
8
+ declare class ClientLedger extends Client {
9
+ private transport;
10
+ private app;
11
+ constructor(params: UtxoClientParams & {
12
+ transport: any;
13
+ });
14
+ getApp(): Promise<AppBtc>;
15
+ getAddress(): string;
16
+ getAddressAsync(index?: number): Promise<Address>;
17
+ transfer(params: TxParams & {
18
+ feeRate?: FeeRate;
19
+ }): Promise<TxHash>;
20
+ }
21
+ export { ClientLedger };
package/lib/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './types';
2
- export * from './client';
2
+ export { ClientKeystore as Client } from './clientKeystore';
3
+ export { ClientLedger } from './clientLedger';
4
+ export { defaultBTCParams } from './client';
3
5
  export * from './const';
4
6
  export { getPrefix, validateAddress } from './utils';