0

I followed the docs of Protocol Kit. I want to connect to a Safe Wallet if it already exists or create a new one. My code : (assume things are defined above)

     signer = provider.getSigner();
     ethAdapterOwner1 = new EthersAdapter({
       ethers,
       signerOrProvider: signer
     })
    
    safeFactory = await SafeFactory.create({ ethAdapter: ethAdapterOwner1 })

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

     // if safe exists then get it's address and connect to it
     let retrievedSafeAddress = localStorage.getItem("safeAddress");
     if(retrievedSafeAddress){
       const safeSdk = await Safe.create({ ethAdapterOwner1, retrievedSafeAddress })
       return safeSdk;
     }

    const safeSdkOwner1 = await safeFactory.deploySafe({ safeAccountConfig })

    const safeAddress = await safeSdkOwner1.getAddress()

I am getting the following error : "Argument of type '{ ethAdapterOwner1: EthersAdapter; retrievedSafeAddress: string; }' is not assignable to parameter of type 'SafeConfig'. Object literal may only specify known properties, and 'ethAdapterOwner1' does not exist in type 'SafeConfig'."

2 Answers 2

1

This line:

const safeSdk = await Safe.create({ ethAdapterOwner1, retrievedSafeAddress })

is not correct, it should be:

const safeSdk = await Safe.create({
  ethAdapter: ethAdapterOwner1,
  safeAddress: retrievedSafeAddress
})

or like this is you rename the variables:

const safeSdk = await Safe.create({ ethAdapter, safeAddress })
-1

To obtain an EthAdapter, you can access the appropriate contract or application on the Ethereum blockchain to connect and interact with Ethereum and other blockchains.

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.