fix: always set new web3 providers despite one being previously set
feat: separate eth wallet names
This commit is contained in:
parent
c94d767f0b
commit
4af07a3609
4 changed files with 12 additions and 10 deletions
|
|
@ -11,7 +11,6 @@ const pify = require('pify')
|
||||||
const BN = require('../../../bn')
|
const BN = require('../../../bn')
|
||||||
const ABI = require('../../tokens')
|
const ABI = require('../../tokens')
|
||||||
|
|
||||||
const NAME = 'geth'
|
|
||||||
exports.SUPPORTED_MODULES = ['wallet']
|
exports.SUPPORTED_MODULES = ['wallet']
|
||||||
|
|
||||||
const paymentPrefixPath = "m/44'/60'/0'/0'"
|
const paymentPrefixPath = "m/44'/60'/0'/0'"
|
||||||
|
|
@ -19,7 +18,6 @@ const defaultPrefixPath = "m/44'/60'/1'/0'"
|
||||||
let lastUsedNonces = {}
|
let lastUsedNonces = {}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
NAME,
|
|
||||||
balance,
|
balance,
|
||||||
sendCoins,
|
sendCoins,
|
||||||
newAddress,
|
newAddress,
|
||||||
|
|
@ -35,9 +33,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function connect (url) {
|
function connect (url) {
|
||||||
if (!web3.isConnected()) {
|
return web3.setProvider(new web3.providers.HttpProvider(url))
|
||||||
web3.setProvider(new web3.providers.HttpProvider(url))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const hex = bigNum => '0x' + bigNum.integerValue(BN.ROUND_DOWN).toString(16)
|
const hex = bigNum => '0x' + bigNum.integerValue(BN.ROUND_DOWN).toString(16)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
const base = require('./base')
|
const base = require('./base')
|
||||||
|
|
||||||
const { utils: coinUtils } = require('@lamassu/coins')
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
const cryptoRec = coinUtils.getCryptoCurrency('ETH')
|
const cryptoRec = coinUtils.getCryptoCurrency('ETH')
|
||||||
const defaultPort = cryptoRec.defaultPort
|
const defaultPort = cryptoRec.defaultPort
|
||||||
|
|
||||||
base.connect(`http://localhost:${defaultPort}`)
|
const NAME = 'geth'
|
||||||
|
|
||||||
module.exports = base
|
function run (account) {
|
||||||
|
base.connect(`http://localhost:${defaultPort}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = _.merge(base, { NAME, run })
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const base = require('../geth/base')
|
const base = require('../geth/base')
|
||||||
|
|
||||||
|
const NAME = 'infura'
|
||||||
|
|
||||||
function run (account) {
|
function run (account) {
|
||||||
if (!account.endpoint) throw new Error('Need to configure API endpoint for Infura')
|
if (!account.endpoint) throw new Error('Need to configure API endpoint for Infura')
|
||||||
|
|
||||||
|
|
@ -10,4 +12,4 @@ function run (account) {
|
||||||
base.connect(endpoint)
|
base.connect(endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = _.merge(base, {run})
|
module.exports = _.merge(base, { NAME, run })
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,6 @@ const Wallet = ({ name: SCREEN_KEY }) => {
|
||||||
const [advancedSettings, setAdvancedSettings] = useState(false)
|
const [advancedSettings, setAdvancedSettings] = useState(false)
|
||||||
const { data } = useQuery(GET_INFO)
|
const { data } = useQuery(GET_INFO)
|
||||||
|
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
const [saveConfig, { error }] = useMutation(SAVE_CONFIG, {
|
const [saveConfig, { error }] = useMutation(SAVE_CONFIG, {
|
||||||
onCompleted: () => setWizard(false),
|
onCompleted: () => setWizard(false),
|
||||||
refetchQueries: () => ['getData']
|
refetchQueries: () => ['getData']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue