i have my website deployed on vercel and using react framework. i am trying to create a web3 dapp that uses zksync paymaster. in the docs it says
import { Signer, Web3Provider } from "zksync-ethers";
import * as ethers from "ethers";
const signer = Web3Provider.getSigner
rawTx = Apiresponse.txData
//since the API returns the transaction payload in the ethers format, we can use it as is
txHash = await signer.sendTransaction(rawTx);
for my specifc use. i have it set as
const apiResponse = await postTransactionData(payload); // Send payload to zyfi API
const txData = apiResponse.txData; // Extract txData from API response
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const txHash = await signer.sendTransaction(txData); // Send transaction using txData
console.log("Transaction Hash:", txHash); // Log the transaction hash
} catch (error) {
console.error("Error:", error); // Log any errors
}
};
but with countless debugging it still doesnt work i have tried all the recommendations on stackoverflow. i am just trying to deploy a website not a smart contract
i tried changing
import { ethers } from "ethers";
to
const ethers = require("ethers");
i also tried just like this
const signer = Web3Provider.getSigner();
and
const provider = new ethers.providers.BrowserProvider(window.ethereum);
and this
const provider = new ethers.providers.BrowserProvider();
but it all keeps on failing with this error in console
Error: TypeError: a.providers is undefined
onPress App.js:40
React 18
Le
He
Fn
Fn
Dn
Wn
ll
Re
Wn
qt
Vt
Gn
jn
zn
zn
a
$l
render
<anonymous> index.js:6
<anonymous> index.js:10
<anonymous> index.js:10
some other info. i am trying to do this on zksync and have only as my imports
import * as ethers from “ethers”; but dont have import { Signer, Web3Provider } from “zksync-ethers”; since it givescauses my deploymemt to fail since its not in use in the code.