Assume https:// at the start of infura endpoint

This commit is contained in:
Rafael Taranto 2019-07-15 21:14:41 +01:00 committed by Josh Harvey
parent 2f451c5893
commit c5398c4b86

View file

@ -2,8 +2,10 @@ const _ = require('lodash/fp')
const base = require('../geth/base')
function run (account) {
const endpoint = account.endpoint
if (!endpoint) throw new Error('Need to configure API endpoint for Infura')
if (!account.endpoint) throw new Error('Need to configure API endpoint for Infura')
const endpoint = _.startsWith('https://')(account.endpoint)
? account.endpoint : `https://${account.endpoint}`
base.connect(endpoint)
}