1

I am trying to implement Gnosis into a react Webapp with using metamask as provider. Upon following the Setup Tutorial i stumbled on this error:

Safe.ts:164 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getChainId')

My component is as follows:

  import Safe, { SafeFactory, SafeAccountConfig } from '@gnosis.pm/safe-core-sdk'

  const web3Provider = window.ethereum;
  const provider = new ethers.providers.Web3Provider(web3Provider)
  const safeOwner = provider.getSigner(0)

  const ethAdapter = new EthersAdapter({
  ethers,
  signer: safeOwner
  })

  const createSafe = async () =>{
    const safeFactory =  await SafeFactory.create({ ethAdapter });
    const safeSdk =  await safeFactory.deploySafe({ safeAccountConfig });  
    safeSdk();
  }

2 Answers 2

1

I keep having this same issue - any idea how to sort this out? Or why is it the reason for keep happening? I am following the tutorial DeploySafe and sorted already the problems with CommonJS and ES6 but this is happening in both...

1

if anyone face this same error, there is a line missing in the example here https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-web3-lib#initialization const web3 = new Web3(provider); after const web3 = new Web3.providers.HttpProvider('http://localhost:8545')

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.