1

I'm trying to create new safe wallet for my current wallet using deploySafe method. Following is my implementation:

const provider = new ethers.providers.JsonRpcProvider('https://polygon-rpc.com);
const ownerSigner = new ethers.Wallet(this.METAMASK_PRIVATE_KEY, provider);
const ethAdapter = new EthersAdapter({
  ethers,
  signerOrProvider: ownerSigner,
});
const safeFactory = await SafeFactory.create({
  ethAdapter,
});

const safeAccountConfig: SafeAccountConfig = {
  owners: [await ownerSigner.getAddress()],
  threshold: 1,
};

const gasPriceNew = Number(ethers.utils.parseUnits('200', 'gwei')); // Set a custom gas price in Gwei
const newWallet = await safeFactory.deploySafe({
  safeAccountConfig,
  options: {
    gasPrice: gasPriceNew,
    gasLimit: 1000000,
  },
  callback: (txHash: string): void => {
    console.log('Create wallet txHash:', txHash);
  },
});
const newAddress = await newWallet.getAddress();

return newAddress;

I got error:

Error: transaction failed [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ]

  1. How to define gas fee and gas limit for deploySafe transaction in Polygon network?
  2. I cannot make deploySafe without optionsm it throws error about absence of gas gee.
  3. Sometimes the transaction works well, but it is 1 of 10 with the same settings. How to make it stable?
1
  • there must be some gas configuration issue... Its better to share this question here.. t.me/blockchainworldco its a group of web3 devs... the might be able to help
    – Harsh
    Jan 19 at 17:39

1 Answer 1

0

It seems that you are using ethers v5, while the latest version of the SDK uses ethers v6. I would suggest to update to the latest packages, and retry without the options parameter, as the SDK calculates them internally. Another thing also is to provide saltNonce, in order to make sure that each try resolves to a different eth address.

Hope it helps! Louis

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.