How to use the trezor-connect.default function in trezor-connect

To help you get started, we’ve selected a few trezor-connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github go-faast / faast-web / src / services / Trezor.ts View on Github external
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,
github vacuumlabs / adalite / app / frontend / wallet / helpers / alertIfUnsupportedTrezorFwVersion.js View on Github external
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}
      `)
github unchained-capital / unchained-wallets / src / trezor.js View on Github external
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);
github rate-engineering / rate3-monorepo / packages / wallet / Trezor.js View on Github external
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';
  }

  /**
github vacuumlabs / adalite / app / frontend / wallet / cardano-trezor-crypto-provider.ts View on Github external
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')
github floating / frame / app / flex / trezor / index.js View on Github external
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()
  }