【发布时间】:2019-09-26 12:34:27
【问题描述】:
我在节点 js 中使用 web3 来创建带有 infura 项目的新 Web3.providers.HttpProvider,其配置为“所有请求都需要项目密码”
infura:
https://infura.io/docs/gettingStarted/authentication
说明 curl 调用是:
curl --user :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 中?
提前致谢!
【问题讨论】: