@xchainjs/xchain-bitcoin 0.15.10 → 0.16.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # v.0.16.0 (2021-12-29)
2
+
3
+ ## Breaking change
4
+
5
+ - Add stagenet environment handling for `Network` and `BaseXChainClient` changes client to default to mainnet values until stagenet is configured.
6
+
7
+ # v.0.15.13 (2021-11-12)
8
+
9
+ - updated haskoin api URL
10
+
11
+ # v.0.15.12 (2021-09-03)
12
+
13
+ - updated to the latest dependencies
14
+
15
+ # v.0.15.11 (2021-07-07)
16
+
17
+ - Use latest `xchain-client@0.10.1` + `xchain-util@0.3.0`
18
+
1
19
  # v.0.15.10 (2021-07-03)
2
20
 
3
21
  - refactored client methods to use regular method syntax (not fat arrow) in order for bcall to super.xxx() to work properly
package/README.md CHANGED
@@ -42,7 +42,7 @@ Initialize client and use class methods:
42
42
  import { Client, Network } from '../src/client'
43
43
 
44
44
  // Create a new client interface
45
- const btcClient = new Client({ network: 'mainnet', nodeUrl: 'https://sochain.com/api/v2' })
45
+ const btcClient = new Client({ network: Network.Mainnet, nodeUrl: 'https://sochain.com/api/v2' })
46
46
 
47
47
  // Set phrase
48
48
  btcClient.setPhrase('phrase here')
package/lib/client.d.ts CHANGED
@@ -1,12 +1,4 @@
1
- import { BaseXChainClient, TxHistoryParams, TxsPage, Address, XChainClient, Tx, TxParams, TxHash, Balance, Network, Fees, XChainClientParams, FeeRates, FeeRate, FeesWithRates } from '@xchainjs/xchain-client';
2
- /**
3
- * BitcoinClient Interface
4
- */
5
- interface BitcoinClient {
6
- getFeesWithRates(memo?: string): Promise<FeesWithRates>;
7
- getFeesWithMemo(memo: string): Promise<Fees>;
8
- getFeeRates(): Promise<FeeRates>;
9
- }
1
+ import { Address, Balance, Fee, FeeRate, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, UTXOClient, XChainClientParams } from '@xchainjs/xchain-client';
10
2
  export declare type BitcoinClientParams = XChainClientParams & {
11
3
  sochainUrl?: string;
12
4
  blockstreamUrl?: string;
@@ -14,7 +6,7 @@ export declare type BitcoinClientParams = XChainClientParams & {
14
6
  /**
15
7
  * Custom Bitcoin client
16
8
  */
17
- declare class Client extends BaseXChainClient implements BitcoinClient, XChainClient {
9
+ declare class Client extends UTXOClient {
18
10
  private sochainUrl;
19
11
  private blockstreamUrl;
20
12
  /**
@@ -93,7 +85,7 @@ declare class Client extends BaseXChainClient implements BitcoinClient, XChainCl
93
85
  * Get the BTC balance of a given address.
94
86
  *
95
87
  * @param {Address} the BTC address
96
- * @returns {Array<Balance>} The BTC balance of the address.
88
+ * @returns {Balance[]} The BTC balance of the address.
97
89
  */
98
90
  getBalance(address: Address): Promise<Balance[]>;
99
91
  /**
@@ -111,34 +103,8 @@ declare class Client extends BaseXChainClient implements BitcoinClient, XChainCl
111
103
  * @returns {Tx} The transaction details of the given transaction id.
112
104
  */
113
105
  getTransactionData(txId: string): Promise<Tx>;
114
- /**
115
- * Get the rates and fees.
116
- *
117
- * @param {string} memo The memo to be used for fee calculation (optional)
118
- * @returns {FeesWithRates} The fees and rates
119
- */
120
- getFeesWithRates(memo?: string): Promise<FeesWithRates>;
121
- /**
122
- * Get the current fees.
123
- *
124
- * @returns {Fees} The fees without memo
125
- */
126
- getFees(): Promise<Fees>;
127
- /**
128
- * Get the fees for transactions with memo.
129
- * If you want to get `Fees` and `FeeRates` at once, use `getFeesAndRates` method
130
- *
131
- * @param {string} memo
132
- * @returns {Fees} The fees with memo
133
- */
134
- getFeesWithMemo(memo: string): Promise<Fees>;
135
- /**
136
- * Get the fee rates for transactions without a memo.
137
- * If you want to get `Fees` and `FeeRates` at once, use `getFeesAndRates` method
138
- *
139
- * @returns {FeeRates} The fee rate
140
- */
141
- getFeeRates(): Promise<FeeRates>;
106
+ protected getSuggestedFeeRate(): Promise<FeeRate>;
107
+ protected calcFee(feeRate: FeeRate, memo?: string): Promise<Fee>;
142
108
  /**
143
109
  * Transfer BTC.
144
110
  *
@@ -149,4 +115,4 @@ declare class Client extends BaseXChainClient implements BitcoinClient, XChainCl
149
115
  feeRate?: FeeRate;
150
116
  }): Promise<TxHash>;
151
117
  }
152
- export { Client, Network };
118
+ export { Client };
package/lib/const.d.ts CHANGED
@@ -4,3 +4,4 @@
4
4
  * @see https://github.com/bitcoin/bitcoin/blob/db88db47278d2e7208c50d16ab10cb355067d071/src/validation.h#L56
5
5
  */
6
6
  export declare const MIN_TX_FEE = 1000;
7
+ export declare const BTC_DECIMAL = 8;
@@ -1,5 +1,5 @@
1
- import { Address } from '@xchainjs/xchain-client/lib';
2
- import { BaseAmount } from '@xchainjs/xchain-util/lib';
1
+ import { Address } from '@xchainjs/xchain-client';
2
+ import { BaseAmount } from '@xchainjs/xchain-util';
3
3
  export declare type UtxoData = {
4
4
  txid: string;
5
5
  index: number;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
2
  export * from './client';
3
- export { broadcastTx, getDefaultFees, getDefaultFeesWithRates, getPrefix, BTC_DECIMAL, scanUTXOs, buildTx, validateAddress, calcFee, } from './utils';
3
+ export * from './const';
4
+ export { broadcastTx, getDefaultFees, getDefaultFeesWithRates, getPrefix, scanUTXOs, buildTx, validateAddress, calcFee, } from './utils';
4
5
  export { createTxInfo } from './ledger';