@xchainjs/xchain-doge 0.7.12 → 0.7.13

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,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { AssetInfo, FeeRate, PreparedTx, TxHash, TxParams } from '@xchainjs/xchain-client';
2
+ import { AssetInfo, FeeRate, PreparedTx, TxParams } from '@xchainjs/xchain-client';
3
3
  import { Address } from '@xchainjs/xchain-util';
4
4
  import { Client as UTXOClient, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo';
5
5
  import * as Dogecoin from 'bitcoinjs-lib';
@@ -13,7 +13,7 @@ export declare const defaultDogeParams: UtxoClientParams;
13
13
  * Custom Dogecoin client extending UTXOClient.
14
14
  * Implements methods for Dogecoin-specific functionality.
15
15
  */
16
- declare class Client extends UTXOClient {
16
+ declare abstract class Client extends UTXOClient {
17
17
  /**
18
18
  * Constructor for initializing the Dogecoin client.
19
19
  * Initializes the client with the provided parameters.
@@ -21,46 +21,12 @@ declare class Client extends UTXOClient {
21
21
  * @param {DogecoinClientParams} params Parameters for initializing the Dogecoin client.
22
22
  */
23
23
  constructor(params?: UtxoClientParams);
24
- /**
25
- * Get the Dogecoin address.
26
- *
27
- * Generates a Dogecoin address using the provided phrase and index.
28
- * @param {number} index The index of the address to retrieve. Default is 0.
29
- * @returns {Address} The Dogecoin address.
30
- * @throws {"index must be greater than zero"} Thrown if the index is less than zero.
31
- * @throws {"Phrase must be provided"} Thrown if the phrase is not provided.
32
- * @throws {"Address not defined"} Thrown if failed to create the address from the phrase.
33
- */
34
- getAddress(index?: number): Address;
35
- /**
36
- * Get the current address.
37
- * Asynchronous version of getAddress method.
38
- * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)
39
- * The address is then decoded into type P2WPKH and returned.
40
- * @returns {Address} The current address.
41
- *
42
- * @throws {"Phrase must be provided"} Thrown if phrase has not been set before.
43
- * @throws {"Address not defined"} Thrown if failed creating account from phrase.
44
- */
45
- getAddressAsync(index?: number): Promise<string>;
46
24
  /**
47
25
  * Get Dogecoin asset information.
48
26
  *
49
27
  * @returns {AssetInfo} Dogecoin asset information.
50
28
  */
51
29
  getAssetInfo(): AssetInfo;
52
- /**
53
- * @private
54
- * Get private key.
55
- *
56
- * Private function to get keyPair from the this.phrase
57
- *
58
- * @param {string} phrase The phrase to be used for generating privkey
59
- * @returns {ECPairInterface} The privkey generated from the given phrase
60
- *
61
- * @throws {"Could not get private key from phrase"} Throws an error if failed creating Doge keys from the given phrase
62
- * */
63
- private getDogeKeys;
64
30
  /**
65
31
  * Validate the given address.
66
32
  *
@@ -68,16 +34,6 @@ declare class Client extends UTXOClient {
68
34
  * @returns {boolean} `true` if the address is valid, otherwise `false`.
69
35
  */
70
36
  validateAddress(address: string): boolean;
71
- /**
72
- * Asynchronously transfers Dogecoin.
73
- *
74
- * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.
75
- * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.
76
- * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.
77
- */
78
- transfer(params: TxParams & {
79
- feeRate?: FeeRate;
80
- }): Promise<TxHash>;
81
37
  /**
82
38
  * Builds a Dogecoin transaction (PSBT).
83
39
  *
@@ -0,0 +1,53 @@
1
+ import { FeeRate, TxHash, TxParams } from '@xchainjs/xchain-client';
2
+ import { Address } from '@xchainjs/xchain-util';
3
+ import { Client } from './client';
4
+ /**
5
+ * Custom Doge client extended to support keystore functionality
6
+ */
7
+ declare class ClientKeystore extends Client {
8
+ /**
9
+ * Get the Dogecoin address.
10
+ *
11
+ * Generates a Dogecoin address using the provided phrase and index.
12
+ * @param {number} index The index of the address to retrieve. Default is 0.
13
+ * @returns {Address} The Dogecoin address.
14
+ * @throws {"index must be greater than zero"} Thrown if the index is less than zero.
15
+ * @throws {"Phrase must be provided"} Thrown if the phrase is not provided.
16
+ * @throws {"Address not defined"} Thrown if failed to create the address from the phrase.
17
+ */
18
+ getAddress(index?: number): Address;
19
+ /**
20
+ * @private
21
+ * Get private key.
22
+ *
23
+ * Private function to get keyPair from the this.phrase
24
+ *
25
+ * @param {string} phrase The phrase to be used for generating privkey
26
+ * @returns {ECPairInterface} The privkey generated from the given phrase
27
+ *
28
+ * @throws {"Could not get private key from phrase"} Throws an error if failed creating Doge keys from the given phrase
29
+ * */
30
+ private getDogeKeys;
31
+ /**
32
+ * Get the current address.
33
+ * Asynchronous version of getAddress method.
34
+ * Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF)
35
+ * The address is then decoded into type P2WPKH and returned.
36
+ * @returns {Address} The current address.
37
+ *
38
+ * @throws {"Phrase must be provided"} Thrown if phrase has not been set before.
39
+ * @throws {"Address not defined"} Thrown if failed creating account from phrase.
40
+ */
41
+ getAddressAsync(index?: number): Promise<string>;
42
+ /**
43
+ * Asynchronously transfers Dogecoin.
44
+ *
45
+ * Builds, signs, and broadcasts a Dogecoin transaction with the specified parameters.
46
+ * @param {TxParams & { feeRate?: FeeRate }} params The transfer parameters including transaction details and optional fee rate.
47
+ * @returns {TxHash} A promise that resolves to the transaction hash once the transfer is completed.
48
+ */
49
+ transfer(params: TxParams & {
50
+ feeRate?: FeeRate;
51
+ }): Promise<TxHash>;
52
+ }
53
+ export { ClientKeystore };
@@ -0,0 +1,22 @@
1
+ import AppBtc from '@ledgerhq/hw-app-btc';
2
+ import { FeeRate, TxHash, TxParams } from '@xchainjs/xchain-client';
3
+ import { Address } from '@xchainjs/xchain-util';
4
+ import { UtxoClientParams } from '@xchainjs/xchain-utxo';
5
+ import { Client } from './client';
6
+ /**
7
+ * Custom Ledger Bitcoin client
8
+ */
9
+ declare class ClientLedger extends Client {
10
+ private transport;
11
+ private app;
12
+ constructor(params: UtxoClientParams & {
13
+ transport: any;
14
+ });
15
+ getApp(): Promise<AppBtc>;
16
+ getAddress(): string;
17
+ getAddressAsync(index?: number, verify?: boolean): Promise<Address>;
18
+ transfer(params: TxParams & {
19
+ feeRate?: FeeRate;
20
+ }): Promise<TxHash>;
21
+ }
22
+ export { ClientLedger };
package/lib/index.d.ts CHANGED
@@ -2,14 +2,13 @@
2
2
  * Export all types defined in the 'types.ts' file.
3
3
  */
4
4
  export * from './types';
5
- /**
6
- * Export the Dogecoin client implementation defined in the 'client.ts' file.
7
- */
8
- export * from './client';
5
+ export { ClientKeystore as Client } from './clientKeystore';
6
+ export { ClientLedger } from './clientLedger';
9
7
  /**
10
8
  * Export all constants defined in the 'const.ts' file.
11
9
  */
12
10
  export * from './const';
11
+ export { defaultDogeParams } from './client';
13
12
  /**
14
13
  * Export utility functions for validating Dogecoin addresses and getting address prefixes
15
14
  * from the 'utils.ts' file.