@xchainjs/xchain-thorchain 0.24.0 → 0.25.1
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 +27 -0
- package/README.md +10 -33
- package/lib/client.d.ts +11 -4
- package/lib/index.esm.js +2953 -17
- package/lib/index.js +2955 -17
- package/lib/types/client-types.d.ts +17 -4
- package/lib/util.d.ts +20 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# v0.25.1 (2022-06-17)
|
|
2
|
+
|
|
3
|
+
## Fix
|
|
4
|
+
|
|
5
|
+
- Remove estimation of gas in `transfer` and `deposit` (introduced by #564) in favour of using `DEFAULT_GAS_LIMIT_VALUE` or `DEPOSIT_GAS_LIMIT_VALUE` (both can be overridden by users in `transfer` or `deposit`)
|
|
6
|
+
- Increase `DEPOSIT_GAS_LIMIT_VALUE` to `600000000` (before `500000000`)
|
|
7
|
+
|
|
8
|
+
# v0.25.0 (2022-06-16)
|
|
9
|
+
|
|
10
|
+
## Fix
|
|
11
|
+
|
|
12
|
+
- Before sending a transaction, gas limits are estimated
|
|
13
|
+
- Helper `getEstimatedGas`
|
|
14
|
+
|
|
15
|
+
## Breaking changes
|
|
16
|
+
|
|
17
|
+
- Client's `transferOffline` requires `fromAccountNumber` and `fromSequence`
|
|
18
|
+
- Rename parameters in `transferOffline` to keep names in camel case (not snake case)
|
|
19
|
+
- Rename `DEFAULT_GAS_VALUE` to `DEFAULT_GAS_LIMIT_VALUE`
|
|
20
|
+
- Rename `DEPOSIT_GAS_VALUE` to `DEPOSIT_GAS_LIMIT_VALUE`
|
|
21
|
+
|
|
22
|
+
# v0.24.1 (2022-04-23)
|
|
23
|
+
|
|
24
|
+
## Fix
|
|
25
|
+
|
|
26
|
+
- Increase `DEFAULT_GAS_VALUE` to `4000000` (before `3000000`)
|
|
27
|
+
|
|
1
28
|
# v0.24.0 (2022-03-23)
|
|
2
29
|
|
|
3
30
|
## Update
|
package/README.md
CHANGED
|
@@ -11,17 +11,20 @@ yarn add @xchainjs/xchain-thorchain
|
|
|
11
11
|
Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-thorchain`.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @xchainjs/xchain-cosmos axios cosmos-client bech32-buffer
|
|
14
|
+
yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @xchainjs/xchain-cosmos axios @cosmos-client/core bech32-buffer
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Important note: Make sure to install same version of `@cosmos-client/core` as `xchain-thorchain` is using (currently `@cosmos-client/core@0.45.1` ). In other case things might break.
|
|
18
18
|
|
|
19
|
-
## Thorchain Client Testing
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
## Documentation
|
|
21
|
+
|
|
22
|
+
### [`xchain thorchain`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/)
|
|
23
|
+
[`How xchain-thorchain works`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/how-it-works.html)\
|
|
24
|
+
[`How to use xchain-thorchain`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/how-to-use.html)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
For more examples check out tests in `./__tests__/client.test.ts`
|
|
25
28
|
|
|
26
29
|
## Service Providers
|
|
27
30
|
|
|
@@ -37,33 +40,7 @@ This package uses the following service providers:
|
|
|
37
40
|
|
|
38
41
|
Rate limits: No
|
|
39
42
|
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
// import `xchain-thorchain`
|
|
44
|
-
import { Client } from '@xchainjs/xchain-thorchain'
|
|
45
|
-
|
|
46
|
-
// Create a `Client`
|
|
47
|
-
const client = new Client({ network: Network.Testnet, phrase: 'my secret phrase' })
|
|
48
|
-
|
|
49
|
-
// get address
|
|
50
|
-
const address = client.getAddress()
|
|
51
|
-
console.log('address:', client.getAddress()) // address: tthor13gym97tmw3axj3hpewdggy2cr288d3qffr8skg
|
|
52
|
-
|
|
53
|
-
// get balances
|
|
54
|
-
const balances = await client.getBalance(address)
|
|
55
|
-
console.log('balances:', balances[0].amount.amount().toString()) // balance: 6968080395099
|
|
56
|
-
|
|
57
|
-
// get transactions
|
|
58
|
-
const txs = await client.getTransactions({ address })
|
|
59
|
-
console.log('txs total:', txs.total) // txs total: 100
|
|
60
|
-
|
|
61
|
-
// get transaction details
|
|
62
|
-
const tx = await client.getTransactionData('any-tx-hash', address)
|
|
63
|
-
console.log('tx asset:', tx.asset) // tx asset: { chain: 'THOR', symbol: 'RUNE', ticker: 'RUNE' }
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
For more examples check out tests in `./__tests__/client.test.ts`
|
|
43
|
+
## Extras
|
|
67
44
|
|
|
68
45
|
## Creating protobuffer typescript bindings
|
|
69
46
|
|
package/lib/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { cosmosclient, proto } from '@cosmos-client/core';
|
|
|
2
2
|
import { Address, Balance, BaseXChainClient, Fees, Network, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, XChainClient, XChainClientParams } from '@xchainjs/xchain-client';
|
|
3
3
|
import { CosmosSDKClient, RPCTxResult } from '@xchainjs/xchain-cosmos';
|
|
4
4
|
import { Asset } from '@xchainjs/xchain-util';
|
|
5
|
+
import BigNumber from 'bignumber.js';
|
|
5
6
|
import { ChainId, ClientUrl, DepositParam, ExplorerUrls, NodeUrl, ThorchainClientParams, TxOfflineParams } from './types';
|
|
6
7
|
/**
|
|
7
8
|
* Interface for custom Thorchain client
|
|
@@ -12,6 +13,7 @@ export interface ThorchainClient {
|
|
|
12
13
|
setExplorerUrls(explorerUrls: ExplorerUrls): void;
|
|
13
14
|
getCosmosClient(): CosmosSDKClient;
|
|
14
15
|
deposit(params: DepositParam): Promise<TxHash>;
|
|
16
|
+
transferOffline(params: TxOfflineParams): Promise<string>;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Custom Thorchain Client
|
|
@@ -181,23 +183,28 @@ declare class Client extends BaseXChainClient implements ThorchainClient, XChain
|
|
|
181
183
|
* @returns {TxHash} The transaction hash.
|
|
182
184
|
*
|
|
183
185
|
* @throws {"insufficient funds"} Thrown if the wallet has insufficient funds.
|
|
184
|
-
* @throws {"
|
|
186
|
+
* @throws {"Invalid transaction hash"} Thrown by missing tx hash
|
|
185
187
|
*/
|
|
186
|
-
deposit({ walletIndex, asset, amount, memo }: DepositParam): Promise<TxHash>;
|
|
188
|
+
deposit({ walletIndex, asset, amount, memo, gasLimit, }: DepositParam): Promise<TxHash>;
|
|
187
189
|
/**
|
|
188
190
|
* Transfer balances with MsgSend
|
|
189
191
|
*
|
|
190
192
|
* @param {TxParams} params The transfer options.
|
|
191
193
|
* @returns {TxHash} The transaction hash.
|
|
194
|
+
*
|
|
195
|
+
* @throws {"insufficient funds"} Thrown if the wallet has insufficient funds.
|
|
196
|
+
* @throws {"Invalid transaction hash"} Thrown by missing tx hash
|
|
192
197
|
*/
|
|
193
|
-
transfer({ walletIndex, asset, amount, recipient, memo }: TxParams
|
|
198
|
+
transfer({ walletIndex, asset, amount, recipient, memo, gasLimit, }: TxParams & {
|
|
199
|
+
gasLimit?: BigNumber;
|
|
200
|
+
}): Promise<TxHash>;
|
|
194
201
|
/**
|
|
195
202
|
* Transfer without broadcast balances with MsgSend
|
|
196
203
|
*
|
|
197
204
|
* @param {TxOfflineParams} params The transfer offline options.
|
|
198
205
|
* @returns {string} The signed transaction bytes.
|
|
199
206
|
*/
|
|
200
|
-
transferOffline({ walletIndex, asset, amount, recipient, memo, from_rune_balance, from_asset_balance,
|
|
207
|
+
transferOffline({ walletIndex, asset, amount, recipient, memo, fromRuneBalance: from_rune_balance, fromAssetBalance: from_asset_balance, fromAccountNumber, fromSequence, gasLimit, }: TxOfflineParams): Promise<string>;
|
|
201
208
|
/**
|
|
202
209
|
* Gets fees from Node
|
|
203
210
|
*
|