我正试图将Gnosis实现为一个使用元as作为提供者的。在遵循安装教程之后,我偶然发现了以下错误:
Safe.ts:164 Uncaught (承诺) TypeError:无法读取未定义的属性(读“getChainId”)
我的组成部分如下:
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();
}发布于 2022-08-10 16:38:52
我一直都有同样的问题-知道该怎么解决吗?或者为什么这是不断发生的原因?我正在学习DeploySafe教程,并且已经对CommonJS和ES6的问题进行了分类,但这在两种情况下都发生了。
发布于 2022-08-11 08:56:32
如果有人面临同样的错误,在这里的示例中,https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-web3-lib#initialization const web3 = new Web3(provider);在const web3 = new Web3.providers.HttpProvider('http://localhost:8545')之后缺少一行。
https://ethereum.stackexchange.com/questions/131179
复制相似问题