another one try to fix the metamask inner state
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
e583a591f1
commit
1eefdfc7ca
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.7.45",
|
"version": "0.7.46",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
FTSO_DAI_LP_ADDRESSES,
|
FTSO_DAI_LP_ADDRESSES,
|
||||||
WETH_ADDRESSES,
|
WETH_ADDRESSES,
|
||||||
} from "../constants/addresses";
|
} from "../constants/addresses";
|
||||||
import { isNetworkLegacyType } from "../constants";
|
|
||||||
import { config } from "../config";
|
import { config } from "../config";
|
||||||
|
|
||||||
import { tokenNameConverter } from "../helpers/tokenConverter";
|
import { tokenNameConverter } from "../helpers/tokenConverter";
|
||||||
@ -207,17 +206,6 @@ export const getTokenPurchaseLink = (chainId, tokenAddress, chainName) => {
|
|||||||
return purchaseUrl;
|
return purchaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sanitizeTransactionRequest = (request, isLegacy) => {
|
|
||||||
const finalRequest = { ...request };
|
|
||||||
if (isLegacy) {
|
|
||||||
delete finalRequest.maxFeePerGas;
|
|
||||||
delete finalRequest.maxPriorityFeePerGas;
|
|
||||||
} else {
|
|
||||||
delete finalRequest.gasPrice;
|
|
||||||
}
|
|
||||||
return finalRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const executeOnChainTransaction = async ({
|
export const executeOnChainTransaction = async ({
|
||||||
chainId,
|
chainId,
|
||||||
abi,
|
abi,
|
||||||
@ -229,7 +217,6 @@ export const executeOnChainTransaction = async ({
|
|||||||
value
|
value
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
const isLegacy = isNetworkLegacyType(chainId);
|
|
||||||
const { request } = await simulateContract(config, {
|
const { request } = await simulateContract(config, {
|
||||||
abi,
|
abi,
|
||||||
address,
|
address,
|
||||||
@ -238,11 +225,9 @@ export const executeOnChainTransaction = async ({
|
|||||||
account,
|
account,
|
||||||
chainId,
|
chainId,
|
||||||
value,
|
value,
|
||||||
type: isLegacy ? 'legacy' : 'eip1559',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const finalRequest = sanitizeTransactionRequest(request, isLegacy);
|
const txHash = await writeContract(config, request);
|
||||||
const txHash = await writeContract(config, { ...finalRequest });
|
|
||||||
await waitForTransactionReceipt(config, {
|
await waitForTransactionReceipt(config, {
|
||||||
hash: txHash,
|
hash: txHash,
|
||||||
onReplaced: () => toast(messages.replacedMsg),
|
onReplaced: () => toast(messages.replacedMsg),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user