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sBAAe,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,OAAO,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;AACpC,CAAC,2EAEgB,OAAY;IAC3B,MAAM,kBAAkB,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;IACvD,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,IAAI,kBAAkB,KAAK,uBAAA,IAAI,iEAAkB,MAAtB,IAAI,EAAmB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC/D,KAAK,GAAG,CAAC,CAAC;gBACV,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;AACnC,CAAC;AAveM,kBAAI,GAAW,WAAW,AAAtB,CAAuB","sourcesContent":["import { TransactionFactory } from '@ethereumjs/tx';\nimport type { TypedTransaction, TypedTxData } from '@ethereumjs/tx';\nimport { publicToAddress, toChecksumAddress } from '@ethereumjs/util';\nimport {\n  TypedMessage,\n  SignTypedDataVersion,\n  MessageTypes,\n} from '@metamask/eth-sig-util';\nimport type { Keyring } from '@metamask/keyring-utils';\nimport {\n  add0x,\n  bytesToHex,\n  getChecksumAddress,\n  Hex,\n  remove0x,\n} from '@metamask/utils';\nimport { transformTypedData } from '@trezor/connect-plugin-ethereum';\nimport type {\n  EthereumTransactionEIP1559,\n  EthereumSignedTx,\n  EthereumTransaction,\n} from '@trezor/connect-web';\nimport type OldEthJsTransaction from 'ethereumjs-tx';\nimport HDKey from 'hdkey';\n\nimport { TrezorBridge } from './trezor-bridge';\n\nconst hdPathString = `m/44'/60'/0'/0`;\nconst SLIP0044TestnetPath = `m/44'/1'/0'/0`;\nconst legacyMewPath = `m/44'/60'/0'`;\n\nconst ALLOWED_HD_PATHS = {\n  [hdPathString]: true,\n  [legacyMewPath]: true,\n  [SLIP0044TestnetPath]: true,\n} as const;\n\nconst keyringType = 'Trezor Hardware';\nconst pathBase = 'm';\nconst MAX_INDEX = 1000;\nconst DELAY_BETWEEN_POPUPS = 1000;\nexport const TREZOR_CONNECT_MANIFEST = {\n  appName: 'MetaMask',\n  email: 'support@metamask.io',\n  appUrl: 'https://metamask.io',\n};\n\nexport type AccountPageEntry = {\n  address: Hex;\n  balance: number | null;\n  index: number;\n};\n\nexport type AccountPage = AccountPageEntry[];\n\nexport type TrezorControllerOptions = {\n  hdPath?: string;\n  accounts?: Hex[];\n  page?: number;\n  perPage?: number;\n};\n\nexport type TrezorControllerState = {\n  hdPath: string;\n  accounts: Hex[];\n  page: number;\n  paths: Record<Hex, number>;\n  perPage: number;\n  unlockedAccount: number;\n};\n\nasync function wait(ms: number): Promise<void> {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Check if the given transaction is made with ethereumjs-tx or @ethereumjs/tx\n *\n * Transactions built with older versions of ethereumjs-tx have a\n * getChainId method that newer versions do not.\n * Older versions are mutable\n * while newer versions default to being immutable.\n * Expected shape and type\n * of data for v, r and s differ (Buffer (old) vs BN (new)).\n *\n * @param tx\n * @returns Returns `true` if tx is an old-style ethereumjs-tx transaction.\n */\nfunction isOldStyleEthereumjsTx(\n  tx: TypedTransaction | OldEthJsTransaction,\n): tx is OldEthJsTransaction {\n  return typeof (tx as OldEthJsTransaction).getChainId === 'function';\n}\n\nexport class TrezorKeyring implements Keyring {\n  static type: string = keyringType;\n\n  readonly type: string = keyringType;\n\n  accounts: readonly Hex[] = [];\n\n  hdk: HDKey = new HDKey();\n\n  hdPath: string = hdPathString;\n\n  page = 0;\n\n  perPage = 5;\n\n  unlockedAccount = 0;\n\n  paths: Record<string, number> = {};\n\n  bridge: TrezorBridge;\n\n  constructor({ bridge }: { bridge: TrezorBridge }) {\n    if (!bridge) {\n      throw new Error('Bridge is a required dependency for the keyring');\n    }\n\n    this.bridge = bridge;\n  }\n\n  /**\n   * Gets the model, if known.\n   * This may be `undefined` if the model hasn't been loaded yet.\n   *\n   * @returns\n   */\n  getModel(): string | undefined {\n    return this.bridge.model;\n  }\n\n  async init(): Promise<void> {\n    return this.bridge.init({\n      manifest: TREZOR_CONNECT_MANIFEST,\n      lazyLoad: true,\n    });\n  }\n\n  async destroy(): Promise<void> {\n    return this.bridge.dispose();\n  }\n\n  async serialize(): Promise<TrezorControllerState> {\n    return Promise.resolve({\n      hdPath: this.hdPath,\n      accounts: this.accounts.slice(),\n      page: this.page,\n      paths: this.paths,\n      perPage: this.perPage,\n      unlockedAccount: this.unlockedAccount,\n    });\n  }\n\n  async deserialize(opts: TrezorControllerOptions): Promise<void> {\n    this.hdPath = opts.hdPath ?? hdPathString;\n    this.accounts = opts.accounts ?? [];\n    this.page = opts.page ?? 0;\n    this.perPage = opts.perPage ?? 5;\n    return Promise.resolve();\n  }\n\n  isUnlocked(): boolean {\n    return Boolean(this.hdk?.publicKey);\n  }\n\n  async unlock(): Promise<string> {\n    if (this.isUnlocked()) {\n      return Promise.resolve('already unlocked');\n    }\n    return new Promise((resolve, reject) => {\n      this.bridge\n        .getPublicKey({\n          path: this.hdPath,\n          coin: 'ETH',\n        })\n        .then((response) => {\n          if (response.success) {\n            this.hdk.publicKey = Buffer.from(response.payload.publicKey, 'hex');\n            this.hdk.chainCode = Buffer.from(response.payload.chainCode, 'hex');\n            resolve('just unlocked');\n          } else {\n            reject(new Error(response.payload?.error || 'Unknown error'));\n          }\n        })\n        .catch((e) => {\n          reject(new Error(e?.toString() || 'Unknown error'));\n        });\n    });\n  }\n\n  setAccountToUnlock(index: number | string): void {\n    this.unlockedAccount = parseInt(String(index), 10);\n  }\n\n  async addAccounts(numberOfAccounts: number): Promise<Hex[]> {\n    return new Promise((resolve, reject) => {\n      this.unlock()\n        .then((_) => {\n          const from = this.unlockedAccount;\n          const to = from + numberOfAccounts;\n          const newAccounts: Hex[] = [];\n\n          for (let i = from; i < to; i++) {\n            const address = this.#addressFromIndex(pathBase, i);\n            if (!this.accounts.includes(address)) {\n              this.accounts = [...this.accounts, address];\n              newAccounts.push(address);\n            }\n            this.page = 0;\n          }\n          resolve(newAccounts);\n        })\n        .catch((e: Error) => {\n          reject(e);\n        });\n    });\n  }\n\n  async getFirstPage(): Promise<AccountPage> {\n    this.page = 0;\n    return this.#getPage(1);\n  }\n\n  async getNextPage(): Promise<AccountPage> {\n    return this.#getPage(1);\n  }\n\n  async getPreviousPage(): Promise<AccountPage> {\n    return this.#getPage(-1);\n  }\n\n  async #getPage(increment: number): Promise<AccountPage> {\n    this.page += increment;\n\n    if (this.page <= 0) {\n      this.page = 1;\n    }\n\n    return new Promise((resolve, reject) => {\n      this.unlock()\n        .then((_) => {\n          const from = (this.page - 1) * this.perPage;\n          const to = from + this.perPage;\n\n          const accounts = [];\n\n          for (let i = from; i < to; i++) {\n            const address = this.#addressFromIndex(pathBase, i);\n            accounts.push({\n              address,\n              balance: null,\n              index: i,\n            });\n            this.paths[getChecksumAddress(address)] = i;\n          }\n          resolve(accounts);\n        })\n        .catch((e: Error) => {\n          reject(e);\n        });\n    });\n  }\n\n  async getAccounts(): Promise<Hex[]> {\n    return Promise.resolve(this.accounts.slice());\n  }\n\n  removeAccount(address: string): void {\n    if (\n      !this.accounts.map((a) => a.toLowerCase()).includes(address.toLowerCase())\n    ) {\n      throw new Error(`Address ${address} not found in this keyring`);\n    }\n\n    this.accounts = this.accounts.filter(\n      (a) => a.toLowerCase() !== address.toLowerCase(),\n    );\n  }\n\n  /**\n   * Signs a transaction using Trezor.\n   *\n   * Accepts either an ethereumjs-tx or @ethereumjs/tx transaction, and returns\n   * the same type.\n   *\n   * @param address - Hex string address.\n   * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n   * @returns The signed transaction, an instance of either new-style or old-style\n   * ethereumjs transaction.\n   */\n  async signTransaction(\n    address: Hex,\n    tx: TypedTransaction | OldEthJsTransaction,\n  ): Promise<TypedTransaction | OldEthJsTransaction> {\n    if (isOldStyleEthereumjsTx(tx)) {\n      // In this version of ethereumjs-tx we must add the chainId in hex format\n      // to the initial v value. The chainId must be included in the serialized\n      // transaction which is only communicated to ethereumjs-tx in this\n      // value. In newer versions the chainId is communicated via the 'Common'\n      // object.\n      return this.#signTransaction(\n        address,\n        // @types/ethereumjs-tx and old ethereumjs-tx versions document\n        // this function return value as Buffer, but the actual\n        // Transaction._chainId will always be a number.\n        // See https://github.com/ethereumjs/ethereumjs-tx/blob/v1.3.7/index.js#L126\n        tx.getChainId() as unknown as number,\n        tx,\n        (payload) => {\n          tx.v = Buffer.from(payload.v, 'hex');\n          tx.r = Buffer.from(payload.r, 'hex');\n          tx.s = Buffer.from(payload.s, 'hex');\n          return tx;\n        },\n      );\n    }\n    return this.#signTransaction(\n      address,\n      Number(tx.common.chainId()),\n      tx,\n      (payload) => {\n        // Because tx will be immutable, first get a plain javascript object that\n        // represents the transaction. Using txData here as it aligns with the\n        // nomenclature of ethereumjs/tx.\n        const txData: TypedTxData = tx.toJSON();\n        // The fromTxData utility expects a type to support transactions with a type other than 0\n        txData.type = tx.type;\n        // The fromTxData utility expects v,r and s to be hex prefixed\n        txData.v = add0x(payload.v);\n        txData.r = add0x(payload.r);\n        txData.s = add0x(payload.s);\n        // Adopt the 'common' option from the original transaction and set the\n        // returned object to be frozen if the original is frozen.\n        return TransactionFactory.fromTxData(txData, {\n          common: tx.common,\n          freeze: Object.isFrozen(tx),\n        });\n      },\n    );\n  }\n\n  /**\n   *\n   * @param address - Hex string address.\n   * @param chainId - Chain ID\n   * @param tx - Instance of either new-style or old-style ethereumjs transaction.\n   * @param handleSigning - Converts signed transaction\n   * to the same new-style or old-style ethereumjs-tx.\n   * @returns The signed transaction, an instance of either new-style or old-style\n   * ethereumjs transaction.\n   */\n  async #signTransaction<T extends TypedTransaction | OldEthJsTransaction>(\n    address: Hex,\n    chainId: number,\n    tx: T,\n    handleSigning: (tx: EthereumSignedTx) => T,\n  ): Promise<T> {\n    let transaction: EthereumTransaction | EthereumTransactionEIP1559;\n    if (isOldStyleEthereumjsTx(tx)) {\n      // legacy transaction from ethereumjs-tx package has no .toJSON() function,\n      // so we need to convert to hex-strings manually manually\n      transaction = {\n        to: this.#normalize(tx.to),\n        value: this.#normalize(tx.value),\n        data: this.#normalize(tx.data),\n        chainId,\n        nonce: this.#normalize(tx.nonce),\n        gasLimit: this.#normalize(tx.gasLimit),\n        gasPrice: this.#normalize(tx.gasPrice),\n      };\n    } else {\n      // new-style transaction from @ethereumjs/tx package\n      // we can just copy tx.toJSON() for everything except chainId, which must be a number\n      transaction = {\n        ...tx.toJSON(),\n        chainId,\n        to: this.#normalize(Buffer.from(tx.to?.bytes ?? [])),\n      } as EthereumTransaction | EthereumTransactionEIP1559;\n    }\n\n    try {\n      const status = await this.unlock();\n      await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n      const response = await this.bridge.ethereumSignTransaction({\n        path: this.#pathFromAddress(address),\n        transaction,\n      });\n      if (response.success) {\n        const newOrMutatedTx = handleSigning(response.payload);\n\n        const addressSignedWith = getChecksumAddress(\n          add0x(newOrMutatedTx.getSenderAddress().toString('hex')),\n        );\n        const correctAddress = getChecksumAddress(address);\n        if (addressSignedWith !== correctAddress) {\n          throw new Error(\"signature doesn't match the right address\");\n        }\n\n        return newOrMutatedTx;\n      }\n      throw new Error(response.payload?.error || 'Unknown error');\n    } catch (e) {\n      throw new Error(e?.toString() ?? 'Unknown error');\n    }\n  }\n\n  async signMessage(withAccount: Hex, data: string): Promise<string> {\n    return this.signPersonalMessage(withAccount, data);\n  }\n\n  // For personal_sign, we need to prefix the message:\n  async signPersonalMessage(\n    withAccount: Hex,\n    message: string,\n  ): Promise<string> {\n    return new Promise((resolve, reject) => {\n      this.unlock()\n        .then((status) => {\n          setTimeout(\n            () => {\n              this.bridge\n                .ethereumSignMessage({\n                  path: this.#pathFromAddress(withAccount),\n                  message: remove0x(message),\n                  hex: true,\n                })\n                .then((response) => {\n                  if (response.success) {\n                    if (\n                      response.payload.address !==\n                      getChecksumAddress(withAccount)\n                    ) {\n                      reject(\n                        new Error('signature doesnt match the right address'),\n                      );\n                    }\n                    const signature = `0x${response.payload.signature}`;\n                    resolve(signature);\n                  } else {\n                    reject(\n                      new Error(response.payload?.error || 'Unknown error'),\n                    );\n                  }\n                })\n                .catch((e) => {\n                  reject(new Error(e?.toString() || 'Unknown error'));\n                });\n              // This is necessary to avoid popup collision\n              // between the unlock & sign trezor popups\n            },\n            status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0,\n          );\n        })\n        .catch((e) => {\n          reject(new Error(e?.toString() || 'Unknown error'));\n        });\n    });\n  }\n\n  // EIP-712 Sign Typed Data\n  async signTypedData<\n    Version extends SignTypedDataVersion.V3 | SignTypedDataVersion.V4,\n    Types extends MessageTypes,\n    Options extends { version?: Version },\n  >(\n    address: Hex,\n    data: TypedMessage<Types>,\n    options?: Options,\n  ): Promise<string> {\n    const { version } = options ?? { version: SignTypedDataVersion.V4 };\n\n    const dataWithHashes = transformTypedData(\n      data,\n      version === SignTypedDataVersion.V4,\n    );\n\n    // set default values for signTypedData\n    // Trezor is stricter than @metamask/eth-sig-util in what it accepts\n    const {\n      types,\n      message = {},\n      domain = {},\n      primaryType,\n      // snake_case since Trezor uses Protobuf naming conventions here\n      domain_separator_hash, // eslint-disable-line camelcase\n      message_hash, // eslint-disable-line camelcase\n    } = dataWithHashes;\n\n    // This is necessary to avoid popup collision\n    // between the unlock & sign trezor popups\n    const status = await this.unlock();\n    await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);\n\n    const response = await this.bridge.ethereumSignTypedData({\n      path: this.#pathFromAddress(address),\n      data: {\n        types: { ...types, EIP712Domain: types.EIP712Domain ?? [] },\n        message,\n        domain,\n        primaryType,\n      },\n      metamask_v4_compat: true, // eslint-disable-line camelcase\n      // Trezor 1 only supports blindly signing hashes\n      domain_separator_hash, // eslint-disable-line camelcase\n      message_hash: message_hash ?? '', // eslint-disable-line camelcase\n    });\n\n    if (response.success) {\n      if (getChecksumAddress(address) !== response.payload.address) {\n        throw new Error('signature doesnt match the right address');\n      }\n      return response.payload.signature;\n    }\n\n    throw new Error(response.payload?.error || 'Unknown error');\n  }\n\n  forgetDevice(): void {\n    this.accounts = [];\n    this.hdk = new HDKey();\n    this.page = 0;\n    this.unlockedAccount = 0;\n    this.paths = {};\n  }\n\n  /**\n   * Set the HD path to be used by the keyring. Only known supported HD paths are allowed.\n   *\n   * If the given HD path is already the current HD path, nothing happens. Otherwise the new HD\n   * path is set, and the wallet state is completely reset.\n   *\n   * @throws {Error] Throws if the HD path is not supported.\n   *\n   * @param hdPath - The HD path to set.\n   */\n  setHdPath(hdPath: keyof typeof ALLOWED_HD_PATHS): void {\n    if (!ALLOWED_HD_PATHS[hdPath]) {\n      throw new Error(\n        `The setHdPath method does not support setting HD Path to ${hdPath}`,\n      );\n    }\n\n    // Reset HDKey if the path changes\n    if (this.hdPath !== hdPath) {\n      this.hdk = new HDKey();\n      this.accounts = [];\n      this.page = 0;\n      this.perPage = 5;\n      this.unlockedAccount = 0;\n      this.paths = {};\n    }\n    this.hdPath = hdPath;\n  }\n\n  #normalize(buf: Buffer): string {\n    return bytesToHex(buf);\n  }\n\n  #addressFromIndex(basePath: string, i: number): Hex {\n    const dkey = this.hdk.derive(`${basePath}/${i}`);\n    const address = bytesToHex(publicToAddress(dkey.publicKey, true));\n    return toChecksumAddress(address);\n  }\n\n  #pathFromAddress(address: Hex): string {\n    const checksummedAddress = getChecksumAddress(address);\n    let index = this.paths[checksummedAddress];\n    if (typeof index === 'undefined') {\n      for (let i = 0; i < MAX_INDEX; i++) {\n        if (checksummedAddress === this.#addressFromIndex(pathBase, i)) {\n          index = i;\n          break;\n        }\n      }\n    }\n\n    if (typeof index === 'undefined') {\n      throw new Error('Unknown address');\n    }\n    return `${this.hdPath}/${index}`;\n  }\n}\n"]}