2019-02-08 12:45:23 -08:00
|
|
|
// +build cgo,ledger,!test_ledger_mock
|
2018-07-13 19:17:53 -07:00
|
|
|
|
|
|
|
package crypto
|
|
|
|
|
2019-03-06 03:37:27 -08:00
|
|
|
import ledger "github.com/cosmos/ledger-cosmos-go"
|
2018-07-13 19:17:53 -07:00
|
|
|
|
2018-08-28 05:16:50 -07:00
|
|
|
// If ledger support (build tag) has been enabled, which implies a CGO dependency,
|
|
|
|
// set the discoverLedger function which is responsible for loading the Ledger
|
|
|
|
// device at runtime or returning an error.
|
2018-07-13 19:17:53 -07:00
|
|
|
func init() {
|
2018-08-27 15:57:06 -07:00
|
|
|
discoverLedger = func() (LedgerSECP256K1, error) {
|
2018-11-30 06:23:55 -08:00
|
|
|
device, err := ledger.FindLedgerCosmosUserApp()
|
2018-08-27 15:42:03 -07:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return device, nil
|
2018-07-13 19:17:53 -07:00
|
|
|
}
|
|
|
|
}
|