The Safe Core SDK takes all the safe contracts and network configuration from safe-deployments. Specifically on this case, from here, meaning that if the Mumbai chainId (80001) is not present below the networkAddresses
key, the Safe contracts are not deployed in that network.
When that happens, you need to deploy the contracts manually. Once deployed, the Safe Core SDK offers the possibility to use Safe contract instances from networks that are not supported in safe-deployments
. This can be done this way:
import { ContractNetworksConfig } from '@gnosis.pm/safe-core-sdk'
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
multiSendAddress: '<MULTI_SEND_ADDRESS>',
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>'
}
}
const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks })
Where MULTI_SEND_ADDRESS
, MASTER_COPY_ADDRESS
and PROXY_FACTORY_ADDRESS
are the addreses of your recently deployed Safe contracts in Mumbai network.
Now you can create a new Safe with your safeFactory
instance:
const safeSdk = await safeFactory.deploySafe(safeAccountConfig, safeDeploymentConfig)
When instantiating the Safe Core SDK to be used with an unsopported network, you will always need to use this same contractNetworks
parameter the same way:
import { ContractNetworksConfig } from '@gnosis.pm/safe-core-sdk'
const chainId = await ethAdapter.getChainId()
const contractNetworks: ContractNetworksConfig = {
[chainId]: {
multiSendAddress: '<MULTI_SEND_ADDRESS>',
safeMasterCopyAddress: '<MASTER_COPY_ADDRESS>',
safeProxyFactoryAddress: '<PROXY_FACTORY_ADDRESS>'
}
}
const safeSdk = await Safe.create({ ethAdapter, safeAddress, contractNetworks })
Find here the latest documentation regarding the SafeFactory and Safe Core SDK API references with all the optional params