Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof window === 'undefined') {
throw new Error(`You really shouldnt be importing ${__filename} outsite of the app`)
}
import {
ResponseSuccess,
ResponseMessage,
Input,
Output,
PublicKey,
SignedTransaction,
EthereumSignedTransaction,
} from 'trezor-connect'
// tslint:disable-next-line:no-var-requires
const TrezorConnect = require('trezor-connect').default
import log from 'Utilities/log'
import { NetworkConfig } from 'Utilities/networks'
import {
convertHdKeyPrefixForPath, getHdKeyPrefix,
derivationPathStringToArray, getPaymentTypeForPath,
} from 'Utilities/bitcoin'
import { toHex } from 'Utilities/convert'
import { PaymentTx } from 'Services/Bitcore'
import { HdAccount } from 'Types'
import { AddressFormat } from 'Utilities/addressFormat'
import { bchCashAddrFormat } from 'Utilities/addressFormat/assets/BCH'
export {
Input as TrezorInput,
Output as TrezorOutput,
const TrezorConnect = require('trezor-connect').default
/*
* this is a temporary fix until trezor.io will (hopefully) properly notify about
* wrong firmware version
*/
async function alertIfUnsupportedTrezorFwVersion() {
try {
const minSupportedFwVersion = '2.1.0'
const {model, fwVersion} = await getTrezorInfo()
if (model === 'T' && versionCompare(fwVersion, minSupportedFwVersion) < 0) {
// eslint-disable-next-line no-alert
alert(`
Please update to firmware version
${minSupportedFwVersion} or higher. Your firmware version is ${fwVersion}
`)
multisigPublicKeys,
multisigRequiredSigners,
multisigAddressType,
MULTISIG_ADDRESS_TYPES,
} from "unchained-bitcoin";
import {
WalletInteraction,
PENDING,
ACTIVE,
INFO,
ERROR,
WARNING,
} from "./interaction";
const TrezorConnect = require("trezor-connect").default;
TrezorConnect.manifest({email: "foo@bar.com", appUrl: "https://localhost:3000"});
/**
* Interaction with Trezor hardware wallets
* @extends {module:interaction.WalletInteraction}
*/
export class TrezorInteraction extends WalletInteraction {
/**
* @param {object} options
* @param {string} options.network - bitcoin network
*/
constructor({network}) {
super({network});
this.trezorCoin = coin(network);
const TrezorConnect = require('trezor-connect').default;
/**
* The class wraps api from trezor-connect
* with ES6 async/await syntax
*/
class Trezor {
/**
* the params for trezor-connect api are key-value pairs inside Object
* @param {string} currency - Stellar or Ethereum only
*/
constructor(currency) {
this.currency = currency;
this.hardware = 'trezor';
}
/**
const CardanoTrezorCryptoProvider = (ADALITE_CONFIG, walletState) => {
const state = Object.assign(walletState, {
rootHdPassphrase: null,
derivedAddresses: {},
derivationScheme: derivationSchemes.v2,
})
const TrezorConnect = ADALITE_CONFIG.ADALITE_TREZOR_CONNECT_URL
? (window as any).TrezorConnect
: require('trezor-connect').default
TrezorConnect.manifest({
email: ADALITE_SUPPORT_EMAIL,
appUrl: ADALITE_CONFIG.ADALITE_SERVER_URL,
})
const isHwWallet = () => true
const getHwWalletName = () => 'Trezor'
const deriveXpub = CachedDeriveXpubFactory(state.derivationScheme, async (absDerivationPath) => {
const response = await TrezorConnect.cardanoGetPublicKey({
path: absDerivationPath,
showOnTrezor: false,
})
throwIfNotSuccess(response)
return Buffer.from(response.payload.publicKey, 'hex')
const TrezorConnect = require('trezor-connect').default
const EventEmitter = require('events')
const events = new EventEmitter()
let ready = false
class Device {
constructor (device, emit) {
this.device = device
this.id = device.path
this.emit = emit
if (ready) return this.setup()
events.once('ready', () => this.setup())
}
setup () {
this.connect()
}