Skip to content

Commit

Permalink
convert hot signers to TS (#1462)
Browse files Browse the repository at this point in the history
* Integrate pylon evm (#1478)

* bump version

* remove infura and alchemy presets, use pylon

* update package lock

* remove gnosis chain preset

* fix chain name

* move migrations to separate files, use TS (#1482)

* add Zod validation of state chain objects, infer types (#1485)

* add Zod validation of state chain objects, infer types

* move state files to TS, add more inferred types

* fix persist mock for tests

* add types to main state

* update test

* add mute notification schema

* move type export to state main

* move legacy file to TS

* try new migration format

* update legacy migrations and tests

* fix gas fees type

* fix gas type

* move legacy mapping

* final migration prototype

* finish migration poc

* finish cleaning up migrations

* test cleanup

* fix compilation error

* fix state parsing

* Choose summon keybinding (#1494)

Co-authored-by: goosewobbler <goosewobbler@pm.me>
Co-authored-by: goosewobbler <goosewobbler@protonmail.com>

* re-order migrations

* convert hot signers to TS, make tests run reliably

* more commits

* update comment

* remove unneeded assignment

* make worker interaction more typesafe

* remove unused code

* remove unused interface

* fix tests

* revert weird test change

* try revert file

* try move

* decouple worker controller and launch script, write controller tests

* fix worker exit in tests

* remove double cast

* rename some files

* remove ignore

* clean up worker interface

* last cleanup, fix typed data

* more type safety

* rebase, add bip39 type

* remove ts-ignores

* remove rebase artifact

* remove migration files

* update package lock

---------

Co-authored-by: goosewobbler <goosewobbler@pm.me>
Co-authored-by: goosewobbler <goosewobbler@protonmail.com>
  • Loading branch information
3 people committed Jun 23, 2023
1 parent 4e4d25e commit e1eb3b4
Show file tree
Hide file tree
Showing 28 changed files with 3,144 additions and 1,683 deletions.
1 change: 1 addition & 0 deletions @types/frame/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

type NullableTimeout = NodeJS.Timeout | null
type Callback<T> = (err: Error | null, result?: T) => void
type ErrorOnlyCallback = Callback<void>
5 changes: 4 additions & 1 deletion @types/frame/state.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ interface Frame {
views: Record<string, ViewMetadata>
}

type SignerType = 'ring' | 'seed' | 'trezor' | 'ledger' | 'lattice'
type HotSignerType = 'ring' | 'seed'
type HardwareSignerType = 'trezor' | 'ledger' | 'lattice'
type SignerType = HotSignerType | HardwareSignerType

type AccountStatus = 'ok'

interface Signer {
Expand Down
6 changes: 2 additions & 4 deletions main/crypt/index.js → main/crypt/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const crypto = require('crypto')
import crypto from 'crypto'

const stringToKey = (pass) => {
export function stringToKey(pass: string) {
const hash = crypto.createHash('sha256').update(pass)
return Buffer.from(hash.digest('hex').substring(0, 32))
}

module.exports = { stringToKey }
112 changes: 0 additions & 112 deletions main/crypt/typedDataUtils.js

This file was deleted.

6 changes: 0 additions & 6 deletions main/signers/Signer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import EventEmitter from 'stream'
import { addHexPrefix } from '@ethereumjs/util'

import { deriveHDAccounts } from './derive'
import crypt from '../../crypt'
import { TransactionData } from '../../../resources/domain/transaction'
import { getSignerDisplayType } from '../../../resources/domain/signer'
import type { TypedMessage } from '../../accounts/types'
Expand Down Expand Up @@ -45,11 +44,6 @@ export default class Signer extends EventEmitter {
deriveHDAccounts(publicKey, chainCode, cb)
}

fingerprint() {
if (this.addresses && this.addresses.length)
return crypt.stringToKey(this.addresses.join()).toString('hex')
}

getCoinbase(cb: Callback<string>) {
cb(null, this.addresses[0].toString())
}
Expand Down
183 changes: 0 additions & 183 deletions main/signers/hot/HotSigner/index.js

This file was deleted.

Loading

0 comments on commit e1eb3b4

Please sign in to comment.