@xchainjs/xchain-bitcoin 0.18.1 → 0.18.2

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,12 @@
1
+ # v.0.18.2 (2022-05-05)
2
+
3
+ ## Update
4
+
5
+ - Add `deposit` function to Bitcoin `Client`
6
+ - Update latest dependencies
7
+ - Add tests for `deposit`
8
+
9
+
1
10
  # v.0.18.1 (2022-03-15)
2
11
 
3
12
  ## Fix
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # `@xchainjs/xchain-client`
1
+ # `@xchainjs/xchain-bitcoin`
2
2
 
3
3
  ## Modules
4
4
 
@@ -16,6 +16,13 @@ Following peer dependencies have to be installed into your project. These are no
16
16
  yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios bitcoinjs-lib wif
17
17
  ```
18
18
 
19
+ ## Documentation
20
+
21
+ ### [`xchain bitcoin`](http://docs.xchainjs.org/xchain-client/xchain-bitcoin/)
22
+ [`How xchain-bitcoin works`](http://docs.xchainjs.org/xchain-client/xchain-bitcoin/how-it-works.html)\
23
+ [`How to use xchain-bitcoin`](http://docs.xchainjs.org/xchain-client/xchain-bitcoin/how-to-use.html)
24
+
25
+
19
26
  ## Service Providers
20
27
 
21
28
  This package uses the following service providers:
@@ -33,46 +40,7 @@ Sochain API rate limits: https://sochain.com/api#rate-limits (300 requests/minut
33
40
 
34
41
  Bitgo API rate limits: https://app.bitgo.com/docs/#section/Rate-Limiting (10 requests/second)
35
42
 
36
- ## Usage
37
-
38
- Initialize client and use class methods:
39
-
40
- ```
41
-
42
- import { Client, Network } from '../src/client'
43
-
44
- // Create a new client interface
45
- const btcClient = new Client({ network: Network.Mainnet, nodeUrl: 'https://sochain.com/api/v2' })
46
-
47
- // Set phrase
48
- btcClient.setPhrase('phrase here')
49
-
50
- // Get address
51
- const address = btcClient.getAddress()
52
43
 
53
- // Get balance
54
- const balance = await btcClient.getBalance()
55
44
 
56
- // Transfer with feeRate
57
- const txid = await btcClient.transfer({ asset: AssetBTC, recipient: 'recipient address here', amount: baseAmount(100, BTC_DECIMAL), feeRate: 1 })
58
45
 
59
- // Transfer with default feeRate (default is `fast`)
60
- const txid = await btcClient.transfer({ asset: AssetBTC, recipient: 'recipient address here', amount: baseAmount(100, BTC_DECIMAL) })
61
46
 
62
- // Get fee estimations
63
- const { fast, fastest, average } = await btcClient.getFees()
64
-
65
- // Get feeRate estimations
66
- const { fast, fastest, average } = await btcClient.getFeeRates()
67
-
68
- // Search transactions
69
- const transactions = await btcClient.getTransactions({ address: 'address here', limit: 4 })
70
-
71
- // Get a transaction with a given txId/hash
72
- const txData = await btcClient.getTransactionData('b660ee07167cfa32681e2623f3a29dc64a089cabd9a3a07dd17f9028ac956eb8')
73
-
74
- ```
75
-
76
- ```
77
-
78
- ```
package/lib/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Address, Balance, Fee, FeeRate, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, UTXOClient, XChainClientParams } from '@xchainjs/xchain-client';
1
+ import { Address, Balance, DepositParams, Fee, FeeRate, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, UTXOClient, XChainClientParams } from '@xchainjs/xchain-client';
2
2
  import { Asset } from '@xchainjs/xchain-util';
3
3
  import { ClientUrl } from './types/client-types';
4
4
  export declare type BitcoinClientParams = XChainClientParams & {
@@ -112,5 +112,15 @@ declare class Client extends UTXOClient {
112
112
  transfer(params: TxParams & {
113
113
  feeRate?: FeeRate;
114
114
  }): Promise<TxHash>;
115
+ /**
116
+ * Transaction to THORChain inbound address.
117
+ *
118
+ * @param {DepositParams} params The transaction options.
119
+ * @returns {TxHash} The transaction hash.
120
+ *
121
+ * @throws {"halted chain"} Thrown if chain is halted.
122
+ * @throws {"halted trading"} Thrown if trading is halted.
123
+ */
124
+ deposit({ walletIndex, asset, amount, memo }: DepositParams): Promise<TxHash>;
115
125
  }
116
126
  export { Client };