我在node js中使用web3来创建一个带有infura项目的新Web3.providers.HttpProvider,其中配置了"Require project secret for all request“。
在infura中:
https://infura.io/docs/gettingStarted/authentication
解释curl的调用方式是:
curl --用户:YOUR-PROJECT-SECRET \ https://.infura.io/v3/YOUR-PROJECT-ID
我使用过:
const client = new Web3(new Web3.providers.HttpProvider('https://YOUR-PROJECT-SECRET@<network>.infura.io/v3/YOUR-PROJECT-ID');但它不起作用。
请问如何将--user标记及其值添加到新的Web3.providers.HttpProvider中?
提前感谢!
发布于 2019-05-09 02:05:45
我在回答我的问题:
我解决了这个问题,在你的-PROJECT-SECRET前添加了":“,如下所示:
const client = new Web3(new Web3.providers.HttpProvider('https://:YOUR-PROJECT-SECRET@<network>.infura.io/v3/YOUR-PROJECT-ID');它现在可以工作了!
https://stackoverflow.com/questions/56046443
复制相似问题