@xchainjs/xchain-wallet 0.1.19 → 1.0.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/lib/index.d.ts +1 -1
- package/lib/index.esm.js +4 -3
- package/lib/index.js +4 -3
- package/lib/types.d.ts +10 -3
- package/lib/wallet.d.ts +13 -12
- package/package.json +10 -10
package/lib/index.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -168,6 +168,7 @@ class Wallet {
|
|
|
168
168
|
/**
|
|
169
169
|
* Get chain balances
|
|
170
170
|
* @param {Chain} chain The chain to retrieve the balance of
|
|
171
|
+
* @param {AnyAsset[]} chain Optional - Assets to retrieve the balance of
|
|
171
172
|
* @returns {Balance[]} the chain balances
|
|
172
173
|
*/
|
|
173
174
|
getBalance(chain, assets) {
|
|
@@ -179,7 +180,7 @@ class Wallet {
|
|
|
179
180
|
/**
|
|
180
181
|
* By default, it returns all the wallet balances unless assets are provided, in that case,
|
|
181
182
|
* only asset balances will be returned by chain
|
|
182
|
-
* @param {
|
|
183
|
+
* @param {AnyAsset[]} assets - Optional. Assets of which return the balance
|
|
183
184
|
* @returns {Record<Chain, Balance[]>} Balances by chain
|
|
184
185
|
*/
|
|
185
186
|
getBalances(assets = Object.keys(this.clients).reduce((prev, client) => {
|
|
@@ -322,7 +323,7 @@ class Wallet {
|
|
|
322
323
|
}
|
|
323
324
|
/**
|
|
324
325
|
* Estimate transfer fees
|
|
325
|
-
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
326
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params to make the transfer estimation
|
|
326
327
|
* @returns {Fees} Estimated fees
|
|
327
328
|
*/
|
|
328
329
|
estimateTransferFees(params) {
|
|
@@ -350,7 +351,7 @@ class Wallet {
|
|
|
350
351
|
}
|
|
351
352
|
/**
|
|
352
353
|
* Make a transaction
|
|
353
|
-
* @param {
|
|
354
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
|
354
355
|
* @returns The transaction hash
|
|
355
356
|
*/
|
|
356
357
|
transfer(params) {
|
package/lib/index.js
CHANGED
|
@@ -172,6 +172,7 @@ class Wallet {
|
|
|
172
172
|
/**
|
|
173
173
|
* Get chain balances
|
|
174
174
|
* @param {Chain} chain The chain to retrieve the balance of
|
|
175
|
+
* @param {AnyAsset[]} chain Optional - Assets to retrieve the balance of
|
|
175
176
|
* @returns {Balance[]} the chain balances
|
|
176
177
|
*/
|
|
177
178
|
getBalance(chain, assets) {
|
|
@@ -183,7 +184,7 @@ class Wallet {
|
|
|
183
184
|
/**
|
|
184
185
|
* By default, it returns all the wallet balances unless assets are provided, in that case,
|
|
185
186
|
* only asset balances will be returned by chain
|
|
186
|
-
* @param {
|
|
187
|
+
* @param {AnyAsset[]} assets - Optional. Assets of which return the balance
|
|
187
188
|
* @returns {Record<Chain, Balance[]>} Balances by chain
|
|
188
189
|
*/
|
|
189
190
|
getBalances(assets = Object.keys(this.clients).reduce((prev, client) => {
|
|
@@ -326,7 +327,7 @@ class Wallet {
|
|
|
326
327
|
}
|
|
327
328
|
/**
|
|
328
329
|
* Estimate transfer fees
|
|
329
|
-
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
330
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params to make the transfer estimation
|
|
330
331
|
* @returns {Fees} Estimated fees
|
|
331
332
|
*/
|
|
332
333
|
estimateTransferFees(params) {
|
|
@@ -354,7 +355,7 @@ class Wallet {
|
|
|
354
355
|
}
|
|
355
356
|
/**
|
|
356
357
|
* Make a transaction
|
|
357
|
-
* @param {
|
|
358
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
|
358
359
|
* @returns The transaction hash
|
|
359
360
|
*/
|
|
360
361
|
transfer(params) {
|
package/lib/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Balance, TxParams as BaseTxParams } from '@xchainjs/xchain-client';
|
|
2
2
|
import { TxParams as BaseEvmTxParams } from '@xchainjs/xchain-evm';
|
|
3
|
-
import { Asset, BaseAmount, Chain } from '@xchainjs/xchain-util';
|
|
3
|
+
import { Asset, BaseAmount, Chain, SynthAsset, TokenAsset } from '@xchainjs/xchain-util';
|
|
4
|
+
import { TxParams as BaseUtxoTxParams } from '@xchainjs/xchain-utxo';
|
|
4
5
|
/**
|
|
5
6
|
* UTXO transfer params
|
|
6
7
|
*/
|
|
7
|
-
export type UtxoTxParams =
|
|
8
|
+
export type UtxoTxParams = BaseUtxoTxParams & {
|
|
8
9
|
asset: Asset;
|
|
9
10
|
feeRate?: BaseAmount;
|
|
10
11
|
};
|
|
@@ -12,7 +13,13 @@ export type UtxoTxParams = BaseTxParams & {
|
|
|
12
13
|
* EVM transfer params
|
|
13
14
|
*/
|
|
14
15
|
export type EvmTxParams = BaseEvmTxParams & {
|
|
15
|
-
asset: Asset;
|
|
16
|
+
asset: Asset | TokenAsset;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Cosmos transfer params
|
|
20
|
+
*/
|
|
21
|
+
export type CosmosTxParams = BaseTxParams & {
|
|
22
|
+
asset: Asset | TokenAsset | SynthAsset;
|
|
16
23
|
};
|
|
17
24
|
/**
|
|
18
25
|
* Fulfilled balance from a Chain
|
package/lib/wallet.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { AssetInfo, Balance, FeeOption, Fees, Network, Protocol, Tx, TxHash, TxsPage, XChainClient } from '@xchainjs/xchain-client';
|
|
5
5
|
import { GasPrices } from '@xchainjs/xchain-evm';
|
|
6
6
|
import { DepositParam } from '@xchainjs/xchain-mayachain';
|
|
7
|
-
import { Address,
|
|
8
|
-
import { ChainBalances, EvmTxParams, UtxoTxParams } from './types';
|
|
7
|
+
import { Address, AnyAsset, BaseAmount, Chain, TokenAsset } from '@xchainjs/xchain-util';
|
|
8
|
+
import { ChainBalances, CosmosTxParams, EvmTxParams, UtxoTxParams } from './types';
|
|
9
9
|
export type NodeUrls = Record<Network, string>;
|
|
10
10
|
export declare class Wallet {
|
|
11
11
|
private clients;
|
|
@@ -73,16 +73,17 @@ export declare class Wallet {
|
|
|
73
73
|
/**
|
|
74
74
|
* Get chain balances
|
|
75
75
|
* @param {Chain} chain The chain to retrieve the balance of
|
|
76
|
+
* @param {AnyAsset[]} chain Optional - Assets to retrieve the balance of
|
|
76
77
|
* @returns {Balance[]} the chain balances
|
|
77
78
|
*/
|
|
78
|
-
getBalance(chain: Chain, assets?:
|
|
79
|
+
getBalance(chain: Chain, assets?: AnyAsset[]): Promise<Balance[]>;
|
|
79
80
|
/**
|
|
80
81
|
* By default, it returns all the wallet balances unless assets are provided, in that case,
|
|
81
82
|
* only asset balances will be returned by chain
|
|
82
|
-
* @param {
|
|
83
|
+
* @param {AnyAsset[]} assets - Optional. Assets of which return the balance
|
|
83
84
|
* @returns {Record<Chain, Balance[]>} Balances by chain
|
|
84
85
|
*/
|
|
85
|
-
getBalances(assets?: Record<Chain,
|
|
86
|
+
getBalances(assets?: Record<Chain, AnyAsset[] | undefined>): Promise<ChainBalances>;
|
|
86
87
|
/**
|
|
87
88
|
* Get transaction data from hash
|
|
88
89
|
* @param {Chain} chain - Chain in which the transaction was done
|
|
@@ -142,16 +143,16 @@ export declare class Wallet {
|
|
|
142
143
|
getFeeRates(chain: Chain, protocol?: Protocol): Promise<Record<FeeOption, BaseAmount>>;
|
|
143
144
|
/**
|
|
144
145
|
* Estimate transfer fees
|
|
145
|
-
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
146
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params to make the transfer estimation
|
|
146
147
|
* @returns {Fees} Estimated fees
|
|
147
148
|
*/
|
|
148
|
-
estimateTransferFees(params: UtxoTxParams | EvmTxParams): Promise<Fees>;
|
|
149
|
+
estimateTransferFees(params: UtxoTxParams | EvmTxParams | CosmosTxParams): Promise<Fees>;
|
|
149
150
|
/**
|
|
150
151
|
* Make a transaction
|
|
151
|
-
* @param {
|
|
152
|
+
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
|
152
153
|
* @returns The transaction hash
|
|
153
154
|
*/
|
|
154
|
-
transfer(params: UtxoTxParams | EvmTxParams): Promise<string>;
|
|
155
|
+
transfer(params: UtxoTxParams | EvmTxParams | CosmosTxParams): Promise<string>;
|
|
155
156
|
/**
|
|
156
157
|
* Make a deposit
|
|
157
158
|
* @param {DepositParam} depositParams
|
|
@@ -159,7 +160,7 @@ export declare class Wallet {
|
|
|
159
160
|
* @throws {Error} if cannot make deposit with the asset
|
|
160
161
|
*/
|
|
161
162
|
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }: DepositParam & {
|
|
162
|
-
asset:
|
|
163
|
+
asset: AnyAsset;
|
|
163
164
|
chain: Chain;
|
|
164
165
|
}): Promise<string>;
|
|
165
166
|
/**
|
|
@@ -171,7 +172,7 @@ export declare class Wallet {
|
|
|
171
172
|
* @returns true if the spenderAddress is allowed to spend the amount, otherwise, false
|
|
172
173
|
* @throws {Error} If asset is a non ERC20 asset
|
|
173
174
|
*/
|
|
174
|
-
approve(asset:
|
|
175
|
+
approve(asset: TokenAsset, amount: BaseAmount, spenderAddress: string): Promise<string>;
|
|
175
176
|
/**
|
|
176
177
|
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
177
178
|
* @param {Asset} asset The asset to check
|
|
@@ -181,7 +182,7 @@ export declare class Wallet {
|
|
|
181
182
|
* @returns true if the spenderAddress is allowed to spend the amount, otherwise, false
|
|
182
183
|
* @throws {Error} If asset is a non ERC20 asset
|
|
183
184
|
*/
|
|
184
|
-
isApproved(asset:
|
|
185
|
+
isApproved(asset: TokenAsset, amount: BaseAmount, fromAddress: string, spenderAddress: string): Promise<boolean>;
|
|
185
186
|
/**
|
|
186
187
|
* Broadcast transaction
|
|
187
188
|
* @param {Chain} chain The chain in which broadcast the signed raw transaction
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-wallet",
|
|
3
3
|
"description": "XChainjs clients wrapper to work with several chains at the same time",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"directory": "release/package"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xchainjs/xchain-client": "0.
|
|
33
|
-
"@xchainjs/xchain-evm": "0.
|
|
34
|
-
"@xchainjs/xchain-mayachain": "
|
|
35
|
-
"@xchainjs/xchain-thorchain": "
|
|
36
|
-
"@xchainjs/xchain-util": "0.
|
|
37
|
-
"@xchainjs/xchain-utxo": "0.1
|
|
32
|
+
"@xchainjs/xchain-client": "1.0.1",
|
|
33
|
+
"@xchainjs/xchain-evm": "1.0.1",
|
|
34
|
+
"@xchainjs/xchain-mayachain": "2.0.1",
|
|
35
|
+
"@xchainjs/xchain-thorchain": "2.0.1",
|
|
36
|
+
"@xchainjs/xchain-util": "1.0.0",
|
|
37
|
+
"@xchainjs/xchain-utxo": "1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@xchainjs/xchain-bitcoin": "0.
|
|
41
|
-
"@xchainjs/xchain-bitcoincash": "0.
|
|
42
|
-
"@xchainjs/xchain-ethereum": "0.
|
|
40
|
+
"@xchainjs/xchain-bitcoin": "1.0.1",
|
|
41
|
+
"@xchainjs/xchain-bitcoincash": "1.0.1",
|
|
42
|
+
"@xchainjs/xchain-ethereum": "1.0.1"
|
|
43
43
|
}
|
|
44
44
|
}
|