Facing issue while making a user operation with alchemy #945
Replies: 3 comments 1 reply
-
Hey @PradipBambharoliya03 - have you considered using the alchemy signer instead? this will greatly simplify your integration! What sign on mechanism are you looking for? Execution reverted errors are related to issues with the call data encoding or the signature of the user operation typically. You'll need to check the call data you are sending and the signature to debug why this transaction is reverting during simulation. If you do want to use a third party signer, i'd recommend following this guide. |
Beta Was this translation helpful? Give feedback.
-
As I see you're trying to withdraw some tokens from the contract. Usually it requires contract to have approval, have you checked that? |
Beta Was this translation helpful? Give feedback.
-
I think the issue is here:
the data passed to the UO should be the call that is being made by the account, no need to sign the message:
|
Beta Was this translation helpful? Give feedback.
-
Hello Alchemy team,
I'm a developer, working on a Next JS project, and trying to make a user operation by sponsoring gas fees. This is a reference I'm using to create an Alchemy client, and I'm using web3auth to create a signer (Here is the reference for it)
Code snippet of image 1 :
`
const provider = new ethers.providers.Web3Provider(web3auth.provider!);
const web3authSigner = provider.getSigner();
const smartAccountClient = await createModularAccountAlchemyClient({
apiKey: ALCHEMY_API_KEY,
chain: polygon,
signer: web3authSigner as any,
gasManagerConfig: {
policyId: GAS_MANAGER_POLICY_ID,
},
});
const contract = new ethers.Contract(
TOKENS.SABLIER_POLYGON_MAINNET,
sablierABI,
web3authSigner,
);
const callData = contract.interface.encodeFunctionData("withdraw", [
item.streamId,
userDetails.address,
remaining,
]);
const dataMessage = await web3authSigner.signMessage(callData);
const uo = await smartAccountClient.sendUserOperation({
uo: {
target: TOKENS.SABLIER_POLYGON_MAINNET,
data: dataMessage as Hex,
},
});
const txHash = await smartAccountClient.waitForUserOperationTransaction(uo);
console.log("\n txHash --->", txHash);
`
And I'm facing TRX call issue while calling
smartAccountClient.sendUserOperation
HttpRequestError: HTTP request failed. Status: 400 URL: https://polygon-mainnet.g.alchemy.com/v2/vcvxFcf0fcfdsfs Request body: {"method":"alchemy_requestGasAndPaymasterAndData","params":[{"policyId":"1a01de5d-754c-4402-9ee4-7084721da429","entryPoint":"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789","userOperation":{"initCode":"0x000000e92D78D90000007F0082006FDA09BD5f1173876732000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000666d89da2fd53626155b77bcae0b2137366ab361","sender":"0x428607e542BDF60E1343868E6A155900556f18a1","nonce":"0x0","callData":"0xb61d27f60000000000000000000000008d87c5eddb5644d1a714f85930ca940166e465f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000041918ff0a32ad5f50dff99584849cfa93bef289e114f3a882cc36007c2da311e9b07cc4c4080eef617996e016c2da4916a6fca3f152849cfe60d8a25bb77978b9a1b00000000000000000000000000000000000000000000000000000000000000","signature":"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c","paymasterAndData":"0x4Fd9098af9ddcB41DA48A1d78F91F1398965addcfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"},"dummySignature":"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c","overrides":{}}]} Details: {"code":-32521,"message":"execution reverted","data":{"revertData":"0x"}} Version: viem@2.8.6
I am sending userOperation of getStream function from Sablier docs using address and ABI to withdraw tokens from token vesting.
I also tried to execute a smart contract call for getStream, which I am sending as userOperation, that smart contract call gives me a successful transaction hash.
Please guide me about this issue, and how I can fix this issue.
Beta Was this translation helpful? Give feedback.
All reactions