0

I have Two questions,

Question 1

  • Please how do i sign an ETH_SIGN_TYPED_DATA_V4 with gnosis safe passkey wallet, I have tried using the protocolKit interface from Safe4337Pack instance like the below example;
let createMessage = await safeErc4337Pack.protocolKit.createMessage(TYPED_MESSAGE)
await safeErc4337Pack.protocolKit.SignMessage(createMessage)

I get an error with the message. Passkey Signers cannot sign signTypedData, they can only sign data.

Question 2

  • How can i check if a transaction signed with safeErc4337Pack instance is valid, I tried the protocolKit interface isValidTransaction but got error.
await safeErc4337Pack.protocolKit.isValidTransaction(signedSafeOperation)

I get an error with the message Safe is not deploy despite safe has already been deployed with several transactions

1 Answer 1

0

et’s break down and address both of your questions, one at a time:

Question 1: Signing with ETH_SIGN_TYPED_DATAko // Hash the typed data const hashedMessage = _TypedDataEncoder.hash(domain, types, value);

// Sign the hashed message using eth_sign let signature = await safeErc4337Pack.protocolKit.signMessage(hashedMessage); If signMessage doesn’t work, another approach would be using safe-core-sdk to submit the typed data in a transaction or finding another method of signature delegation if eth_signTypedData is crucial for your use case.

Question 2: Validating a Transaction with safeErc4337Pack You’re trying to check if a transaction is valid using the method protocolKit.isValidTransaction, but you’re getting an error saying "Safe is not deployed," despite the Safe being deployed.

Here’s why this might be happening and how to address it:

Error Cause: The error suggests that the safeErc4337Pack instance does not recognize that the Safe has been deployed. Even though the Safe has had transactions and is deployed, the instance you're working with might not have the correct reference to the Safe or could be missing some deployment checks internally.

Potential Causes:

Incorrect Safe Address in the Instance: Ensure that the Safe address you are using with safeErc4337Pack is the correct one and corresponds to the deployed Safe. Initialization Problem: Sometimes, you need to initialize or validate the Safe instance before performing certain actions. Backend Deployment Checks: The isValidTransaction method might be querying the backend or blockchain for Safe deployment status, which could be failing for some reason (e.g., network issues, missing Safe in the backend). Solution:

Check if the Safe is deployed in the contract: Before calling isValidTransaction, you can directly check if the Safe is deployed by calling a method like isSafeDeployed() (assuming it exists) or manually checking on-chain if the Safe exists at that address.

Check Safe Address Initialization: Make sure that the instance of safeErc4337Pack is properly initialized with the correct Safe address. Here’s a simple check to see if the Safe is initialized:

js
const safeInstance = safeErc4337Pack.safeSdk;
const isDeployed = await safeInstance.isSafeDeployed(); // Check if the Safe is deployed
console.log("Safe deployed:", isDeployed);

Check the Correct Transaction Type: Ensure that the transaction being validated (signedSafeOperation) matches the type of transaction the Safe expects. Safe transactions often involve complex multi-signature setups or batch operations, so the method you’re using might not recognize the structure if it’s incomplete.

Network Issues or Sync Delays: If your Safe was recently deployed, there might be network issues or a delay in syncing the deployment status on some backends. You could try waiting for a few more blocks or verifying the deployment manually on a block explorer.

Example Validation Check:

If you’re still having trouble with isValidTransaction, consider wrapping the call in a try-catch block and logging the complete error for better debugging:

js

try {
  const isValid = await safeErc4337Pack.protocolKit.isValidTransaction(signedSafeOperation);
  console.log("Transaction is valid:", isValid);
} catch (error) {
  console.error("Error validating transaction:", error);
}

Summary: For signing ETH_SIGN_TYPED_DATA_V4 with a Gnosis Safe Passkey Wallet, you’ll likely need to hash the typed data and use a simpler signing method (like eth_sign). Typed data signing is often unsupported by passkey-based signers.

For checking if a transaction is valid with safeErc4337Pack, ensure that the Safe instance is correctly initialized and deployed. You can verify the deployment on-chain manually if needed, or debug the Safe address being used to ensure it’s the correct one.

1
  • Hi, Thanks for the explanation. I will try this and revert back.
    – Garantor
    Commented Sep 21 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.