@xchainjs/xchain-wallet 0.1.6 → 0.1.8
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.esm.js +34 -3
- package/lib/index.js +34 -3
- package/lib/wallet.d.ts +9 -2
- package/package.json +10 -9
package/lib/index.esm.js
CHANGED
|
@@ -3014,6 +3014,9 @@ var AssetCurrencySymbol;
|
|
|
3014
3014
|
AssetCurrencySymbol["SATOSHI"] = "\u26A1";
|
|
3015
3015
|
AssetCurrencySymbol["ETH"] = "\u039E";
|
|
3016
3016
|
AssetCurrencySymbol["USD"] = "$";
|
|
3017
|
+
AssetCurrencySymbol["DASH"] = "\u0110";
|
|
3018
|
+
AssetCurrencySymbol["LTC"] = "\u0141";
|
|
3019
|
+
AssetCurrencySymbol["DOGE"] = "\u00D0";
|
|
3017
3020
|
})(AssetCurrencySymbol || (AssetCurrencySymbol = {}));
|
|
3018
3021
|
/**
|
|
3019
3022
|
* Removes `0x` or `0X` from address
|
|
@@ -12348,6 +12351,34 @@ class Wallet {
|
|
|
12348
12351
|
throw Error(`getFeeRates method not supported in ${chain} chain`);
|
|
12349
12352
|
});
|
|
12350
12353
|
}
|
|
12354
|
+
/**
|
|
12355
|
+
* Estimate transfer fees
|
|
12356
|
+
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
12357
|
+
* @returns {Fees} Estimated fees
|
|
12358
|
+
*/
|
|
12359
|
+
estimateTransferFees(params) {
|
|
12360
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12361
|
+
const client = this.getClient(params.asset.chain);
|
|
12362
|
+
if (this.isEvmClient(client)) {
|
|
12363
|
+
if (!this.isEvmTxParams(params))
|
|
12364
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
12365
|
+
return client.getFees(params);
|
|
12366
|
+
}
|
|
12367
|
+
if (this.isUtxoClient(client)) {
|
|
12368
|
+
if (!this.isUtxoTxParams(params))
|
|
12369
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
12370
|
+
let sender;
|
|
12371
|
+
try {
|
|
12372
|
+
sender = yield this.getAddress(params.asset.chain);
|
|
12373
|
+
}
|
|
12374
|
+
catch (_a) {
|
|
12375
|
+
/* Empty */
|
|
12376
|
+
}
|
|
12377
|
+
return client.getFees({ sender, memo: params.memo });
|
|
12378
|
+
}
|
|
12379
|
+
return client.getFees();
|
|
12380
|
+
});
|
|
12381
|
+
}
|
|
12351
12382
|
/**
|
|
12352
12383
|
* Make a transaction
|
|
12353
12384
|
* @param {TxParams} txParams txParams - The parameters to make the transfer
|
|
@@ -12395,11 +12426,11 @@ class Wallet {
|
|
|
12395
12426
|
* @returns {string} the hash of the deposit
|
|
12396
12427
|
* @throws {Error} if cannot make deposit with the asset
|
|
12397
12428
|
*/
|
|
12398
|
-
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }) {
|
|
12429
|
+
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }) {
|
|
12399
12430
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12400
|
-
const client = this.getClient(
|
|
12431
|
+
const client = this.getClient(chain);
|
|
12401
12432
|
if (!('deposit' in client))
|
|
12402
|
-
throw Error(`Can not deposit with ${
|
|
12433
|
+
throw Error(`Can not deposit with ${chain} client`);
|
|
12403
12434
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
12404
12435
|
});
|
|
12405
12436
|
}
|
package/lib/index.js
CHANGED
|
@@ -3018,6 +3018,9 @@ var AssetCurrencySymbol;
|
|
|
3018
3018
|
AssetCurrencySymbol["SATOSHI"] = "\u26A1";
|
|
3019
3019
|
AssetCurrencySymbol["ETH"] = "\u039E";
|
|
3020
3020
|
AssetCurrencySymbol["USD"] = "$";
|
|
3021
|
+
AssetCurrencySymbol["DASH"] = "\u0110";
|
|
3022
|
+
AssetCurrencySymbol["LTC"] = "\u0141";
|
|
3023
|
+
AssetCurrencySymbol["DOGE"] = "\u00D0";
|
|
3021
3024
|
})(AssetCurrencySymbol || (AssetCurrencySymbol = {}));
|
|
3022
3025
|
/**
|
|
3023
3026
|
* Removes `0x` or `0X` from address
|
|
@@ -12352,6 +12355,34 @@ class Wallet {
|
|
|
12352
12355
|
throw Error(`getFeeRates method not supported in ${chain} chain`);
|
|
12353
12356
|
});
|
|
12354
12357
|
}
|
|
12358
|
+
/**
|
|
12359
|
+
* Estimate transfer fees
|
|
12360
|
+
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
12361
|
+
* @returns {Fees} Estimated fees
|
|
12362
|
+
*/
|
|
12363
|
+
estimateTransferFees(params) {
|
|
12364
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12365
|
+
const client = this.getClient(params.asset.chain);
|
|
12366
|
+
if (this.isEvmClient(client)) {
|
|
12367
|
+
if (!this.isEvmTxParams(params))
|
|
12368
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
12369
|
+
return client.getFees(params);
|
|
12370
|
+
}
|
|
12371
|
+
if (this.isUtxoClient(client)) {
|
|
12372
|
+
if (!this.isUtxoTxParams(params))
|
|
12373
|
+
throw Error(`Invalid params for estimating ${params.asset.chain} transfer`);
|
|
12374
|
+
let sender;
|
|
12375
|
+
try {
|
|
12376
|
+
sender = yield this.getAddress(params.asset.chain);
|
|
12377
|
+
}
|
|
12378
|
+
catch (_a) {
|
|
12379
|
+
/* Empty */
|
|
12380
|
+
}
|
|
12381
|
+
return client.getFees({ sender, memo: params.memo });
|
|
12382
|
+
}
|
|
12383
|
+
return client.getFees();
|
|
12384
|
+
});
|
|
12385
|
+
}
|
|
12355
12386
|
/**
|
|
12356
12387
|
* Make a transaction
|
|
12357
12388
|
* @param {TxParams} txParams txParams - The parameters to make the transfer
|
|
@@ -12399,11 +12430,11 @@ class Wallet {
|
|
|
12399
12430
|
* @returns {string} the hash of the deposit
|
|
12400
12431
|
* @throws {Error} if cannot make deposit with the asset
|
|
12401
12432
|
*/
|
|
12402
|
-
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }) {
|
|
12433
|
+
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }) {
|
|
12403
12434
|
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12404
|
-
const client = this.getClient(
|
|
12435
|
+
const client = this.getClient(chain);
|
|
12405
12436
|
if (!('deposit' in client))
|
|
12406
|
-
throw Error(`Can not deposit with ${
|
|
12437
|
+
throw Error(`Can not deposit with ${chain} client`);
|
|
12407
12438
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
12408
12439
|
});
|
|
12409
12440
|
}
|
package/lib/wallet.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Import necessary modules and libraries
|
|
3
3
|
*/
|
|
4
|
-
import { Balance, FeeOption, Network, Protocol, Tx, TxHash, TxsPage, XChainClient } from '@xchainjs/xchain-client';
|
|
4
|
+
import { 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
7
|
import { Address, Asset, BaseAmount, Chain } from '@xchainjs/xchain-util';
|
|
@@ -135,6 +135,12 @@ export declare class Wallet {
|
|
|
135
135
|
* @throws {Error} if the fee rates can not be returned from the chain
|
|
136
136
|
*/
|
|
137
137
|
getFeeRates(chain: Chain, protocol?: Protocol): Promise<Record<FeeOption, BaseAmount>>;
|
|
138
|
+
/**
|
|
139
|
+
* Estimate transfer fees
|
|
140
|
+
* @param {UtxoTxParams | EvmTxParams} params to make the transfer estimation
|
|
141
|
+
* @returns {Fees} Estimated fees
|
|
142
|
+
*/
|
|
143
|
+
estimateTransferFees(params: UtxoTxParams | EvmTxParams): Promise<Fees>;
|
|
138
144
|
/**
|
|
139
145
|
* Make a transaction
|
|
140
146
|
* @param {TxParams} txParams txParams - The parameters to make the transfer
|
|
@@ -147,8 +153,9 @@ export declare class Wallet {
|
|
|
147
153
|
* @returns {string} the hash of the deposit
|
|
148
154
|
* @throws {Error} if cannot make deposit with the asset
|
|
149
155
|
*/
|
|
150
|
-
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }: DepositParam & {
|
|
156
|
+
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, chain, }: DepositParam & {
|
|
151
157
|
asset: Asset;
|
|
158
|
+
chain: Chain;
|
|
152
159
|
}): Promise<string>;
|
|
153
160
|
/**
|
|
154
161
|
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
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": "0.1.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -28,16 +28,17 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@xchainjs/xchain-evm": "0.4.
|
|
32
|
-
"@xchainjs/xchain-util": "0.13.
|
|
33
|
-
"@xchainjs/xchain-client": "0.16.
|
|
34
|
-
"@xchainjs/xchain-thorchain": "1.0.
|
|
35
|
-
"@xchainjs/xchain-mayachain": "1.0.
|
|
36
|
-
"@xchainjs/xchain-utxo": "0.1.
|
|
31
|
+
"@xchainjs/xchain-evm": "0.4.5",
|
|
32
|
+
"@xchainjs/xchain-util": "0.13.3",
|
|
33
|
+
"@xchainjs/xchain-client": "0.16.2",
|
|
34
|
+
"@xchainjs/xchain-thorchain": "1.0.4",
|
|
35
|
+
"@xchainjs/xchain-mayachain": "1.0.1",
|
|
36
|
+
"@xchainjs/xchain-utxo": "0.1.4",
|
|
37
37
|
"ethers": "5.6.6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@xchainjs/xchain-bitcoin": "0.23.
|
|
41
|
-
"@xchainjs/xchain-
|
|
40
|
+
"@xchainjs/xchain-bitcoin": "0.23.13",
|
|
41
|
+
"@xchainjs/xchain-bitcoincash": "0.17.9",
|
|
42
|
+
"@xchainjs/xchain-ethereum": "0.31.6"
|
|
42
43
|
}
|
|
43
44
|
}
|