Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore gas station #1050

Merged
merged 3 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/hooks/wallet/useAccountUnification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,12 @@ export const useAccountUnification = () => {
const from = selectedEvmAddress.value;
const [nonce, gasPrice] = await Promise.all([
web3.value.eth.getTransactionCount(from),
getEvmGas(web3.value, gas.value.evmGasPrice.fast),
getEvmGas(web3.value, '0'), // gas.value.evmGasPrice.fast),
]);
const multipliedGas = Math.round(Number(gasPrice) * 1.01);
const rawTx = {
nonce,
gasPrice: web3.value.utils.toHex(gasPrice),
gasPrice: web3.value.utils.toHex(multipliedGas.toString()),
from,
to: evmPrecompiledContract.dispatch,
value: '0x0',
Expand Down
8 changes: 6 additions & 2 deletions src/v2/services/implementations/MetamaskWalletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export class MetamaskWalletService extends WalletService implements IWalletServi
const web3 = new Web3(this.provider as any);
const [nonce, gasPrice] = await Promise.all([
web3.eth.getTransactionCount(from),
getEvmGas(web3, this.gasPriceProvider.getGas().price),
// memo, ignore gas station for now.
getEvmGas(web3, '0'),
]);

const rawTx = {
Expand All @@ -137,9 +138,12 @@ export class MetamaskWalletService extends WalletService implements IWalletServi
data,
};

const multipliedGas = Math.round(Number(gasPrice) * 1.01);
const connectedChainId = await web3.eth.net.getId();
const isSetGasByWallet = checkIsSetGasByWallet(connectedChainId);
const txParam = isSetGasByWallet ? rawTx : { ...rawTx, gasPrice: web3.utils.toHex(gasPrice) };
const txParam = isSetGasByWallet
? rawTx
: { ...rawTx, gasPrice: web3.utils.toHex(multipliedGas.toString()) };
const estimatedGas = await web3.eth.estimateGas(txParam);
const transactionHash = await web3.eth
.sendTransaction({ ...txParam, gas: estimatedGas })
Expand Down
5 changes: 3 additions & 2 deletions src/v2/services/implementations/XcmEvmService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ export class XcmEvmService implements IXcmEvmService {

const [nonce, gasPrice] = await Promise.all([
web3.eth.getTransactionCount(senderAddress),
getEvmGas(web3, this.gasPriceProvider.getGas().price),
getEvmGas(web3, '0'), //this.gasPriceProvider.getGas().price),
]);
const multipliedGas = Math.round(Number(gasPrice) * 1.01);

const rawTx: TransactionConfig = {
nonce,
gasPrice: web3.utils.toHex(gasPrice),
gasPrice: web3.utils.toHex(multipliedGas.toString()),
from: senderAddress,
to: evmPrecompiledContract.xcm,
value: '0x0',
Expand Down
Loading