Skip to content

Commit

Permalink
Ignore gas station (#1050)
Browse files Browse the repository at this point in the history
* Ignore gas station

* Turned off Gas station everywhere

* Ignore another one gas station call
  • Loading branch information
bobo-k2 committed Nov 26, 2023
1 parent 9613a72 commit 3fd6793
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
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

0 comments on commit 3fd6793

Please sign in to comment.