Skip to content

Commit

Permalink
Use URL and URLSearchParams to pass ledger live preference
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Feb 10, 2021
1 parent 4526734 commit d70554f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { EventEmitter } = require('events')
const HDKey = require('hdkey')
const ethUtil = require('ethereumjs-util')
const sigUtil = require('eth-sig-util')
const { URL, URLSearchParams } = require('globalthis/implementation')

const hdPathString = `m/44'/60'/0'`
const type = 'Ledger Hardware'
Expand Down Expand Up @@ -47,7 +48,11 @@ class LedgerBridgeKeyring extends EventEmitter {

deserialize (opts = {}) {
this.hdPath = opts.hdPath || hdPathString
this.bridgeUrl = opts.bridgeUrl || BRIDGE_URL

const bridgeUrl = new URL(opts.bridgeUrl || BRIDGE_URL);
bridgeUrl.search = new URLSearchParams({ useLedgerLive: !!opts.useLedgerLive })
this.bridgeUrl = bridgeUrl.toString()

this.accounts = opts.accounts || []
this.accountIndexes = opts.accountIndexes || {}
this.implementFullBIP44 = opts.implementFullBIP44 || false
Expand Down

0 comments on commit d70554f

Please sign in to comment.