Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xchainjs/xchain-evm

Package Overview
Dependencies
Maintainers
10
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xchainjs/xchain-evm - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

4

lib/client.d.ts

@@ -235,6 +235,8 @@ import { Provider, TransactionResponse } from '@ethersproject/abstract-provider';

*/
transfer({ walletIndex, signer: txSigner, asset, memo, amount, recipient, feeOption, gasPrice, gasLimit, }: TxParams & {
transfer({ walletIndex, signer: txSigner, asset, memo, amount, recipient, feeOption, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, }: TxParams & {
signer?: Signer;
feeOption?: FeeOption;
gasPrice?: BaseAmount;
maxFeePerGas?: BaseAmount;
maxPriorityFeePerGas?: BaseAmount;
gasLimit?: BigNumber;

@@ -241,0 +243,0 @@ }): Promise<TxHash>;

@@ -748,9 +748,34 @@ import { BaseXChainClient, Network, FeeOption, checkFeeBounds, standardFeeRates, FeeType } from '@xchainjs/xchain-client';

*/
transfer({ walletIndex = 0, signer: txSigner, asset = this.gasAsset, memo, amount, recipient, feeOption = FeeOption.Fast, gasPrice, gasLimit, }) {
transfer({ walletIndex = 0, signer: txSigner, asset = this.gasAsset, memo, amount, recipient, feeOption = FeeOption.Fast, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, }) {
return __awaiter(this, void 0, void 0, function* () {
const txGasPrice = gasPrice
? BigNumber.from(gasPrice.amount().toFixed())
: yield this.estimateGasPrices()
.then((prices) => prices[feeOption])
.then((gp) => BigNumber.from(gp.amount().toFixed()));
if (gasPrice && (maxFeePerGas || maxPriorityFeePerGas)) {
throw new Error('gasPrice is not compatible with EIP 1559 (maxFeePerGas and maxPriorityFeePerGas) params');
}
const feeData = {
lastBaseFeePerGas: null,
maxFeePerGas: null,
maxPriorityFeePerGas: null,
gasPrice: null,
};
if (maxFeePerGas || maxPriorityFeePerGas) {
const feeInfo = yield this.getProvider().getFeeData();
if (maxFeePerGas) {
feeData.maxFeePerGas = BigNumber.from(maxFeePerGas.amount().toFixed());
}
else if (maxPriorityFeePerGas && feeInfo.lastBaseFeePerGas) {
feeData.maxFeePerGas = feeInfo.lastBaseFeePerGas.mul(2).add(maxPriorityFeePerGas.amount().toFixed());
}
feeData.maxPriorityFeePerGas = maxPriorityFeePerGas
? BigNumber.from(maxPriorityFeePerGas.amount().toFixed())
: feeInfo.maxPriorityFeePerGas;
}
else {
const txGasPrice = gasPrice
? BigNumber.from(gasPrice.amount().toFixed())
: yield this.estimateGasPrices()
.then((prices) => prices[feeOption])
.then((gp) => BigNumber.from(gp.amount().toFixed()));
checkFeeBounds(this.feeBounds, txGasPrice.toNumber());
feeData.gasPrice = txGasPrice;
}
const sender = this.getAddress(walletIndex || 0);

@@ -771,7 +796,2 @@ let txGasLimit;

}
const overrides = {
gasLimit: txGasLimit,
gasPrice: txGasPrice,
};
checkFeeBounds(this.feeBounds, overrides.gasPrice.toNumber());
const { rawUnsignedTx } = yield this.prepareTx({

@@ -786,3 +806,13 @@ sender,

const signer = txSigner || this.getWallet(walletIndex);
const { hash } = yield signer.sendTransaction(Object.assign({ from: transactionRequest.from, to: transactionRequest.to, data: transactionRequest.data, value: transactionRequest.value }, overrides));
const tx = yield signer.populateTransaction({
from: transactionRequest.from,
to: transactionRequest.to,
data: transactionRequest.data,
value: transactionRequest.value,
gasLimit: txGasLimit,
gasPrice: feeData.gasPrice || undefined,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas || undefined,
maxFeePerGas: feeData.maxFeePerGas || undefined,
});
const { hash } = yield signer.sendTransaction(tx);
return hash;

@@ -789,0 +819,0 @@ });

@@ -752,9 +752,34 @@ 'use strict';

*/
transfer({ walletIndex = 0, signer: txSigner, asset = this.gasAsset, memo, amount, recipient, feeOption = xchainClient.FeeOption.Fast, gasPrice, gasLimit, }) {
transfer({ walletIndex = 0, signer: txSigner, asset = this.gasAsset, memo, amount, recipient, feeOption = xchainClient.FeeOption.Fast, gasPrice, maxFeePerGas, maxPriorityFeePerGas, gasLimit, }) {
return __awaiter(this, void 0, void 0, function* () {
const txGasPrice = gasPrice
? ethers.BigNumber.from(gasPrice.amount().toFixed())
: yield this.estimateGasPrices()
.then((prices) => prices[feeOption])
.then((gp) => ethers.BigNumber.from(gp.amount().toFixed()));
if (gasPrice && (maxFeePerGas || maxPriorityFeePerGas)) {
throw new Error('gasPrice is not compatible with EIP 1559 (maxFeePerGas and maxPriorityFeePerGas) params');
}
const feeData = {
lastBaseFeePerGas: null,
maxFeePerGas: null,
maxPriorityFeePerGas: null,
gasPrice: null,
};
if (maxFeePerGas || maxPriorityFeePerGas) {
const feeInfo = yield this.getProvider().getFeeData();
if (maxFeePerGas) {
feeData.maxFeePerGas = ethers.BigNumber.from(maxFeePerGas.amount().toFixed());
}
else if (maxPriorityFeePerGas && feeInfo.lastBaseFeePerGas) {
feeData.maxFeePerGas = feeInfo.lastBaseFeePerGas.mul(2).add(maxPriorityFeePerGas.amount().toFixed());
}
feeData.maxPriorityFeePerGas = maxPriorityFeePerGas
? ethers.BigNumber.from(maxPriorityFeePerGas.amount().toFixed())
: feeInfo.maxPriorityFeePerGas;
}
else {
const txGasPrice = gasPrice
? ethers.BigNumber.from(gasPrice.amount().toFixed())
: yield this.estimateGasPrices()
.then((prices) => prices[feeOption])
.then((gp) => ethers.BigNumber.from(gp.amount().toFixed()));
xchainClient.checkFeeBounds(this.feeBounds, txGasPrice.toNumber());
feeData.gasPrice = txGasPrice;
}
const sender = this.getAddress(walletIndex || 0);

@@ -775,7 +800,2 @@ let txGasLimit;

}
const overrides = {
gasLimit: txGasLimit,
gasPrice: txGasPrice,
};
xchainClient.checkFeeBounds(this.feeBounds, overrides.gasPrice.toNumber());
const { rawUnsignedTx } = yield this.prepareTx({

@@ -790,3 +810,13 @@ sender,

const signer = txSigner || this.getWallet(walletIndex);
const { hash } = yield signer.sendTransaction(Object.assign({ from: transactionRequest.from, to: transactionRequest.to, data: transactionRequest.data, value: transactionRequest.value }, overrides));
const tx = yield signer.populateTransaction({
from: transactionRequest.from,
to: transactionRequest.to,
data: transactionRequest.data,
value: transactionRequest.value,
gasLimit: txGasLimit,
gasPrice: feeData.gasPrice || undefined,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas || undefined,
maxFeePerGas: feeData.maxFeePerGas || undefined,
});
const { hash } = yield signer.sendTransaction(tx);
return hash;

@@ -793,0 +823,0 @@ });

{
"name": "@xchainjs/xchain-evm",
"version": "0.3.5",
"version": "0.3.6",
"description": "Genereic EVM client for XChainJS",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc