@xchainjs/xchain-wallet 1.0.12 → 1.1.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/lib/index.esm.js +23 -1
- package/lib/index.js +23 -1
- package/lib/wallet.d.ts +10 -0
- package/package.json +3 -2
package/lib/index.esm.js
CHANGED
|
@@ -16,7 +16,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
16
16
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
17
|
PERFORMANCE OF THIS SOFTWARE.
|
|
18
18
|
***************************************************************************** */
|
|
19
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
19
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -369,6 +369,28 @@ class Wallet {
|
|
|
369
369
|
return client.getFees();
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Estimates gas limit for a transaction.
|
|
374
|
+
*
|
|
375
|
+
* @param {TxParams} params The transaction and fees options.
|
|
376
|
+
* @returns {BigNumber} The estimated gas limit.
|
|
377
|
+
*/
|
|
378
|
+
estimateGasLimit({ asset, recipient, amount, memo, from, isMemoEncoded, }) {
|
|
379
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
380
|
+
const client = this.getClient(asset.chain);
|
|
381
|
+
if (!this.isEvmClient(client)) {
|
|
382
|
+
throw Error(`estimateGasLimit method not supported in ${asset.chain} chain`);
|
|
383
|
+
}
|
|
384
|
+
return client.estimateGasLimit({
|
|
385
|
+
asset,
|
|
386
|
+
recipient,
|
|
387
|
+
amount,
|
|
388
|
+
memo,
|
|
389
|
+
from,
|
|
390
|
+
isMemoEncoded,
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
}
|
|
372
394
|
/**
|
|
373
395
|
* Make a transaction
|
|
374
396
|
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -371,6 +371,28 @@ class Wallet {
|
|
|
371
371
|
return client.getFees();
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Estimates gas limit for a transaction.
|
|
376
|
+
*
|
|
377
|
+
* @param {TxParams} params The transaction and fees options.
|
|
378
|
+
* @returns {BigNumber} The estimated gas limit.
|
|
379
|
+
*/
|
|
380
|
+
estimateGasLimit({ asset, recipient, amount, memo, from, isMemoEncoded, }) {
|
|
381
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
382
|
+
const client = this.getClient(asset.chain);
|
|
383
|
+
if (!this.isEvmClient(client)) {
|
|
384
|
+
throw Error(`estimateGasLimit method not supported in ${asset.chain} chain`);
|
|
385
|
+
}
|
|
386
|
+
return client.estimateGasLimit({
|
|
387
|
+
asset,
|
|
388
|
+
recipient,
|
|
389
|
+
amount,
|
|
390
|
+
memo,
|
|
391
|
+
from,
|
|
392
|
+
isMemoEncoded,
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
374
396
|
/**
|
|
375
397
|
* Make a transaction
|
|
376
398
|
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
package/lib/wallet.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { AssetInfo, Balance, FeeOption, Fees, Network, Protocol, Tx, TxHash, Txs
|
|
|
5
5
|
import { GasPrices } from '@xchainjs/xchain-evm';
|
|
6
6
|
import { DepositParam } from '@xchainjs/xchain-mayachain';
|
|
7
7
|
import { Address, AnyAsset, BaseAmount, Chain, TokenAsset } from '@xchainjs/xchain-util';
|
|
8
|
+
import { BigNumber } from 'ethers';
|
|
8
9
|
import { ChainBalances, CosmosTxParams, EvmTxParams, RadixTxParams, UtxoTxParams } from './types';
|
|
9
10
|
export type NodeUrls = Record<Network, string>;
|
|
10
11
|
export declare class Wallet {
|
|
@@ -153,6 +154,15 @@ export declare class Wallet {
|
|
|
153
154
|
* @returns {Fees} Estimated fees
|
|
154
155
|
*/
|
|
155
156
|
estimateTransferFees(params: UtxoTxParams | EvmTxParams | CosmosTxParams | RadixTxParams): Promise<Fees>;
|
|
157
|
+
/**
|
|
158
|
+
* Estimates gas limit for a transaction.
|
|
159
|
+
*
|
|
160
|
+
* @param {TxParams} params The transaction and fees options.
|
|
161
|
+
* @returns {BigNumber} The estimated gas limit.
|
|
162
|
+
*/
|
|
163
|
+
estimateGasLimit({ asset, recipient, amount, memo, from, isMemoEncoded, }: EvmTxParams & {
|
|
164
|
+
from?: Address;
|
|
165
|
+
}): Promise<BigNumber>;
|
|
156
166
|
/**
|
|
157
167
|
* Make a transaction
|
|
158
168
|
* @param {UtxoTxParams | EvmTxParams | CosmosTxParams} params txParams - The parameters to make the transfer
|
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": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"@xchainjs/xchain-radix": "1.1.4",
|
|
36
36
|
"@xchainjs/xchain-thorchain": "2.0.8",
|
|
37
37
|
"@xchainjs/xchain-util": "1.0.5",
|
|
38
|
-
"@xchainjs/xchain-utxo": "1.0.6"
|
|
38
|
+
"@xchainjs/xchain-utxo": "1.0.6",
|
|
39
|
+
"ethers": "5.7.2"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@xchainjs/xchain-bitcoin": "1.1.2",
|