diff --git a/frontend/src/services/contract.js b/frontend/src/services/contract.js index 72443aa1..110f9469 100644 --- a/frontend/src/services/contract.js +++ b/frontend/src/services/contract.js @@ -1,5 +1,5 @@ import { connect } from 'get-starknet'; -import { getDeployContractData } from 'src/utils/constants'; +import { getDeployContractData } from '../utils/constants'; import { axiosInstance } from '../utils/axios'; export async function deployContract(walletId) { diff --git a/frontend/src/services/transaction.js b/frontend/src/services/transaction.js index e5222ffd..94983e21 100644 --- a/frontend/src/services/transaction.js +++ b/frontend/src/services/transaction.js @@ -3,6 +3,7 @@ import { CallData } from 'starknet'; import { erc20abi } from '../abis/erc20'; import { abi } from '../abis/abi'; import { axiosInstance } from '../utils/axios'; +import {checkAndDeployContract} from './contract'; export async function sendTransaction(loopLiquidityData, contractAddress) { try { @@ -71,7 +72,15 @@ export const handleTransaction = async (connectedWalletId, formData, setError, s setLoading(true); setError(''); - + try{ + await checkAndDeployContract(connectedWalletId); + } catch (error) { + console.error('Error deploying contract:', error); + setError('Error deploying contract. Please try again.'); + setSuccessful(false) + setLoading(false); + return; + } try { const response = await axiosInstance.post(`/api/create-position`, formData);