From 7f568ef59345594ddbd5d3527d7cf6bbbc8f882b Mon Sep 17 00:00:00 2001 From: Jan Komarek Date: Thu, 22 Aug 2024 14:15:15 +0200 Subject: [PATCH 1/3] chore: update react-hook-form --- packages/suite/package.json | 4 +-- suite-common/wallet-core/package.json | 2 +- suite-common/wallet-utils/package.json | 2 +- suite-native/forms/package.json | 4 +-- .../module-accounts-management/package.json | 2 +- suite-native/module-send/package.json | 2 +- yarn.lock | 36 +++++++++---------- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/suite/package.json b/packages/suite/package.json index d0d4d0fefb7d..8f4a06d7763a 100644 --- a/packages/suite/package.json +++ b/packages/suite/package.json @@ -22,7 +22,7 @@ "@everstake/wallet-sdk": "^0.3.49", "@floating-ui/react": "^0.26.9", "@formatjs/intl": "2.10.0", - "@hookform/resolvers": "3.3.4", + "@hookform/resolvers": "3.9.0", "@mobily/ts-belt": "^3.13.1", "@reduxjs/toolkit": "1.9.5", "@sentry/core": "^7.100.1", @@ -97,7 +97,7 @@ "react-dom": "18.2.0", "react-focus-lock": "^2.9.7", "react-helmet-async": "^2.0.4", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "react-intl": "^6.6.8", "react-qr-reader": "^2.2.1", "react-redux": "8.0.7", diff --git a/suite-common/wallet-core/package.json b/suite-common/wallet-core/package.json index 3de725a2c201..73b1c0de0baa 100644 --- a/suite-common/wallet-core/package.json +++ b/suite-common/wallet-core/package.json @@ -37,7 +37,7 @@ "@trezor/utils": "workspace:*", "date-fns": "^2.30.0", "proxy-memoize": "2.0.2", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "web3-utils": "^4.3.1" } } diff --git a/suite-common/wallet-utils/package.json b/suite-common/wallet-utils/package.json index 5b1486628268..ce3922f1f3ef 100644 --- a/suite-common/wallet-utils/package.json +++ b/suite-common/wallet-utils/package.json @@ -35,7 +35,7 @@ "@trezor/utils": "workspace:*", "date-fns": "^2.30.0", "react": "18.2.0", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "web3-utils": "^4.3.1" } } diff --git a/suite-native/forms/package.json b/suite-native/forms/package.json index cc5ca1f3e664..752964068b84 100644 --- a/suite-native/forms/package.json +++ b/suite-native/forms/package.json @@ -11,11 +11,11 @@ "type-check": "yarn g:tsc --build" }, "dependencies": { - "@hookform/resolvers": "3.3.4", + "@hookform/resolvers": "3.9.0", "@suite-common/icons": "workspace:*", "@suite-native/atoms": "workspace:*", "react": "18.2.0", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "react-native": "0.74.1", "yup": "^1.4.0" } diff --git a/suite-native/module-accounts-management/package.json b/suite-native/module-accounts-management/package.json index c3e57abb8632..ae8b969947d4 100644 --- a/suite-native/module-accounts-management/package.json +++ b/suite-native/module-accounts-management/package.json @@ -40,7 +40,7 @@ "date-fns": "^2.30.0", "jotai": "1.9.1", "react": "18.2.0", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "react-native": "0.74.1", "react-native-reanimated": "3.11.0", "react-redux": "8.0.7" diff --git a/suite-native/module-send/package.json b/suite-native/module-send/package.json index 441a89a7038a..e32243cc0646 100644 --- a/suite-native/module-send/package.json +++ b/suite-native/module-send/package.json @@ -39,7 +39,7 @@ "@trezor/theme": "workspace:*", "@trezor/utils": "workspace:*", "react": "18.2.0", - "react-hook-form": "^7.50.1", + "react-hook-form": "^7.53.0", "react-native": "0.74.1", "react-native-reanimated": "3.11.0", "react-redux": "8.0.7" diff --git a/yarn.lock b/yarn.lock index fe98e7170142..b8aa4b8f215c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4530,12 +4530,12 @@ __metadata: languageName: node linkType: hard -"@hookform/resolvers@npm:3.3.4": - version: 3.3.4 - resolution: "@hookform/resolvers@npm:3.3.4" +"@hookform/resolvers@npm:3.9.0": + version: 3.9.0 + resolution: "@hookform/resolvers@npm:3.9.0" peerDependencies: react-hook-form: ^7.0.0 - checksum: 10/0845e15f53b515ab5dc8d970d4ee7f47bbdfc4f4391bc166361535482d96b6ae3d1812669107fca05bf8687fa5447e3ed65f2eee3e349759b23b229ca978f917 + checksum: 10/b878e92cebc703106a70987437ab4add0e71a327a0bb9864f82ab480b5d9a38b0d639f6154b138c3c4828af0db00c1b413279c102715146b19edc76b9786f1c3 languageName: node linkType: hard @@ -9233,7 +9233,7 @@ __metadata: "@trezor/utils": "workspace:*" date-fns: "npm:^2.30.0" proxy-memoize: "npm:2.0.2" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" web3-utils: "npm:^4.3.1" languageName: unknown linkType: soft @@ -9281,7 +9281,7 @@ __metadata: "@trezor/utils": "workspace:*" date-fns: "npm:^2.30.0" react: "npm:18.2.0" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" web3-utils: "npm:^4.3.1" languageName: unknown linkType: soft @@ -9746,11 +9746,11 @@ __metadata: version: 0.0.0-use.local resolution: "@suite-native/forms@workspace:suite-native/forms" dependencies: - "@hookform/resolvers": "npm:3.3.4" + "@hookform/resolvers": "npm:3.9.0" "@suite-common/icons": "workspace:*" "@suite-native/atoms": "workspace:*" react: "npm:18.2.0" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" react-native: "npm:0.74.1" yup: "npm:^1.4.0" languageName: unknown @@ -9930,7 +9930,7 @@ __metadata: date-fns: "npm:^2.30.0" jotai: "npm:1.9.1" react: "npm:18.2.0" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" react-native: "npm:0.74.1" react-native-reanimated: "npm:3.11.0" react-redux: "npm:8.0.7" @@ -10131,7 +10131,7 @@ __metadata: "@trezor/theme": "workspace:*" "@trezor/utils": "workspace:*" react: "npm:18.2.0" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" react-native: "npm:0.74.1" react-native-reanimated: "npm:3.11.0" react-redux: "npm:8.0.7" @@ -11724,7 +11724,7 @@ __metadata: "@floating-ui/react": "npm:^0.26.9" "@formatjs/cli": "npm:^6.2.7" "@formatjs/intl": "npm:2.10.0" - "@hookform/resolvers": "npm:3.3.4" + "@hookform/resolvers": "npm:3.9.0" "@mobily/ts-belt": "npm:^3.13.1" "@reduxjs/toolkit": "npm:1.9.5" "@sentry/core": "npm:^7.100.1" @@ -11820,7 +11820,7 @@ __metadata: react-dom: "npm:18.2.0" react-focus-lock: "npm:^2.9.7" react-helmet-async: "npm:^2.0.4" - react-hook-form: "npm:^7.50.1" + react-hook-form: "npm:^7.53.0" react-intl: "npm:^6.6.8" react-qr-reader: "npm:^2.2.1" react-redux: "npm:8.0.7" @@ -19118,7 +19118,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:*, debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2, debug@npm:~4.3.4": +"debug@npm:*, debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:~4.3.1, debug@npm:~4.3.2, debug@npm:~4.3.4": version: 4.3.6 resolution: "debug@npm:4.3.6" dependencies: @@ -35248,12 +35248,12 @@ __metadata: languageName: node linkType: hard -"react-hook-form@npm:^7.50.1": - version: 7.50.1 - resolution: "react-hook-form@npm:7.50.1" +"react-hook-form@npm:^7.53.0": + version: 7.53.0 + resolution: "react-hook-form@npm:7.53.0" peerDependencies: - react: ^16.8.0 || ^17 || ^18 - checksum: 10/54a9daa2143c601a9867e96a2159a0bbe98707b5bbeb5953bfdf3342d2f04bfcaa6169907ed167c5c1f3a044630860d4f43685f4ac4e15b9cd892d1b00d54dde + react: ^16.8.0 || ^17 || ^18 || ^19 + checksum: 10/b7d73696b7c10e042f6ea6fcec01f951091146bfbc89d1378327a970bcd724b968e93fae1657bddada75caf648cfaf8693c5ba03c25e96816b755079d29f65da languageName: node linkType: hard From c04c08144d3aa22642f1358d66729112902c700c Mon Sep 17 00:00:00 2001 From: Jan Komarek Date: Thu, 22 Aug 2024 14:36:11 +0200 Subject: [PATCH 2/3] chore(utxo-lib): remove unused util --- packages/utxo-lib/src/address.ts | 8 -------- packages/utxo-lib/tests/address.test.ts | 15 --------------- 2 files changed, 23 deletions(-) diff --git a/packages/utxo-lib/src/address.ts b/packages/utxo-lib/src/address.ts index 6c29d396dd6a..b55f8fe6e068 100644 --- a/packages/utxo-lib/src/address.ts +++ b/packages/utxo-lib/src/address.ts @@ -1,14 +1,12 @@ // upstream: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/address.ts // differences: // - `fromBase58Check` method is using additional "network" param and bs58check.decodeAddress instead of bs58check.decode. checking multibyte version (Zcash and Decred support). -// - `toBase58Check` method is using additional "network" param and bs58check.encodeAddress instead of bs58check.encode. import { bech32, bech32m } from 'bech32'; import * as bs58check from './bs58check'; import * as bscript from './script'; import * as payments from './payments'; import { bitcoin as BITCOIN_NETWORK, Network } from './networks'; -import * as types from './types'; export interface Base58CheckResult { hash: Buffer; @@ -52,12 +50,6 @@ export function fromBech32(address: string): Bech32Result { }; } -export function toBase58Check(hash: Buffer, version: number, network = BITCOIN_NETWORK): string { - types.typeforce(types.tuple(types.Hash160bit, types.UInt16), [hash, version]); - - return bs58check.encodeAddress(hash, version, network); -} - export function toBech32(data: Buffer, version: number, prefix: string) { const words = bech32.toWords(data); words.unshift(version); diff --git a/packages/utxo-lib/tests/address.test.ts b/packages/utxo-lib/tests/address.test.ts index 7f2a84ad1e8a..2cd368a116d5 100644 --- a/packages/utxo-lib/tests/address.test.ts +++ b/packages/utxo-lib/tests/address.test.ts @@ -74,21 +74,6 @@ describe('address', () => { }); }); - describe('toBase58Check', () => { - fixtures.standard.forEach(f => { - if (!f.base58check) return; - it(`encodes ${f.hash} (${f.network})`, () => { - const address = baddress.toBase58Check( - Buffer.from(f.hash, 'hex'), - f.version, - getNetwork(f.network), - ); - - expect(address).toEqual(f.base58check); - }); - }); - }); - describe('toBech32', () => { fixtures.bech32.forEach(f => { const data = Buffer.from(f.data, 'hex'); From 92f5195faee0b0d3ea700ca209a3f04e9054277c Mon Sep 17 00:00:00 2001 From: Jan Komarek Date: Thu, 22 Aug 2024 14:36:41 +0200 Subject: [PATCH 3/3] chore: update crypto libs --- packages/connect/package.json | 4 +- packages/connect/src/api/eos/eosSignTx.ts | 4 +- packages/connect/src/api/tezos/tezosSignTx.ts | 4 +- packages/e2e-utils/package.json | 5 +- packages/suite-data/package.json | 2 +- packages/suite-desktop-core/package.json | 2 +- packages/suite/package.json | 6 +- packages/suite/src/utils/suite/metadata.ts | 2 +- packages/utxo-lib/package.json | 14 +- packages/utxo-lib/src/bip32.ts | 8 +- packages/utxo-lib/src/derivation.ts | 4 +- packages/utxo-lib/src/script/index.ts | 2 +- .../utxo-lib/src/script/scriptSignature.ts | 2 +- suite-native/storage/package.json | 2 +- .../storage/src/migrations/account/v3.ts | 4 +- yarn.lock | 121 +++++++++++------- 16 files changed, 110 insertions(+), 76 deletions(-) diff --git a/packages/connect/package.json b/packages/connect/package.json index 97c4e9677bcc..50005de1b4fc 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -82,8 +82,8 @@ "@trezor/utils": "workspace:*", "@trezor/utxo-lib": "workspace:*", "blakejs": "^1.2.1", - "bs58": "^5.0.0", - "bs58check": "^3.0.1", + "bs58": "^6.0.0", + "bs58check": "^4.0.0", "cross-fetch": "^4.0.0" }, "devDependencies": { diff --git a/packages/connect/src/api/eos/eosSignTx.ts b/packages/connect/src/api/eos/eosSignTx.ts index 872f43217104..9c5f8a90d591 100644 --- a/packages/connect/src/api/eos/eosSignTx.ts +++ b/packages/connect/src/api/eos/eosSignTx.ts @@ -1,6 +1,4 @@ -// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/helpers/eosSignTx.js - -import * as bs58 from 'bs58'; +import bs58 from 'bs58'; import { PROTO, ERRORS } from '../../constants'; import type { diff --git a/packages/connect/src/api/tezos/tezosSignTx.ts b/packages/connect/src/api/tezos/tezosSignTx.ts index b2d21f1f5e1a..268f2198c00b 100644 --- a/packages/connect/src/api/tezos/tezosSignTx.ts +++ b/packages/connect/src/api/tezos/tezosSignTx.ts @@ -1,6 +1,4 @@ -// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/helpers/tezosSignTx.js - -import * as bs58check from 'bs58check'; +import bs58check from 'bs58check'; import { PROTO, ERRORS } from '../../constants'; import { TezosOperation } from '../../types/api/tezos'; import { Assert } from '@trezor/schema-utils'; diff --git a/packages/e2e-utils/package.json b/packages/e2e-utils/package.json index 7b63bef1af01..d0cbf5dc51a8 100644 --- a/packages/e2e-utils/package.json +++ b/packages/e2e-utils/package.json @@ -12,7 +12,10 @@ }, "dependencies": { "express": "^4.19.2", - "uuid": "^9.0.1", + "uuid": "^10.0.0", "ws": "^8.18.0" + }, + "devDependencies": { + "@types/uuid": "^10.0.0" } } diff --git a/packages/suite-data/package.json b/packages/suite-data/package.json index fc9daf8bc3fb..a1fea903aeb6 100644 --- a/packages/suite-data/package.json +++ b/packages/suite-data/package.json @@ -37,7 +37,7 @@ "postcss-modules-local-by-default": "^4.0.5", "postcss-modules-scope": "^3.2.0", "postcss-modules-values": "^4.0.0", - "simple-git": "^3.22.0", + "simple-git": "^3.25.0", "style-loader": "^3.3.4", "tsx": "^4.16.3", "webpack": "^5.93.0", diff --git a/packages/suite-desktop-core/package.json b/packages/suite-desktop-core/package.json index a706776b11db..bd7814a0f2f1 100644 --- a/packages/suite-desktop-core/package.json +++ b/packages/suite-desktop-core/package.json @@ -37,7 +37,7 @@ "electron-store": "8.2.0", "electron-updater": "6.3.3", "openpgp": "^5.11.2", - "systeminformation": "^5.23.4" + "systeminformation": "^5.23.5" }, "devDependencies": { "@currents/playwright": "^1.3.1", diff --git a/packages/suite/package.json b/packages/suite/package.json index 8f4a06d7763a..8ace4dd4fd4e 100644 --- a/packages/suite/package.json +++ b/packages/suite/package.json @@ -79,7 +79,7 @@ "@trezor/type-utils": "workspace:*", "@trezor/urls": "workspace:*", "@trezor/utils": "workspace:*", - "bs58check": "^3.0.1", + "bs58check": "^4.0.0", "date-fns": "^2.30.0", "dropbox": "^10.34.0", "file-saver": "^2.0.5", @@ -113,7 +113,7 @@ "redux-thunk": "^2.4.2", "semver": "^7.6.3", "styled-components": "^6.1.8", - "uuid": "^9.0.1", + "uuid": "^10.0.0", "web3-utils": "^4.3.1", "zxcvbn": "^4.4.2" }, @@ -137,7 +137,7 @@ "@types/redux-mock-store": "^1.0.6", "@types/semver": "^7.5.8", "@types/ua-parser-js": "^0.7.39", - "@types/uuid": "^9.0.6", + "@types/uuid": "^10.0.0", "@types/zxcvbn": "^4.4.4", "jest-canvas-mock": "^2.5.2", "jest-watch-typeahead": "2.2.2", diff --git a/packages/suite/src/utils/suite/metadata.ts b/packages/suite/src/utils/suite/metadata.ts index 6b8d39a801a5..71efb1081b04 100644 --- a/packages/suite/src/utils/suite/metadata.ts +++ b/packages/suite/src/utils/suite/metadata.ts @@ -1,5 +1,5 @@ import * as crypto from 'crypto'; -import * as base58check from 'bs58check'; +import base58check from 'bs58check'; import { FetchIntervalTrackingId } from 'src/actions/suite/metadataProviderActions'; import { DataType, MetadataProvider } from '@suite-common/metadata-types'; import { TrezorDevice } from '@suite-common/suite-types'; diff --git a/packages/utxo-lib/package.json b/packages/utxo-lib/package.json index 2106a99fd3ba..ce9c4eadba7a 100644 --- a/packages/utxo-lib/package.json +++ b/packages/utxo-lib/package.json @@ -42,26 +42,26 @@ "@trezor/utils": "workspace:*", "bchaddrjs": "^0.5.2", "bech32": "^2.0.0", - "bip66": "^1.1.5", + "bip66": "^2.0.0", "bitcoin-ops": "^1.4.1", "blake-hash": "^2.0.0", "blakejs": "^1.2.1", "bn.js": "^5.2.1", - "bs58": "^5.0.0", - "bs58check": "^3.0.1", + "bs58": "^6.0.0", + "bs58check": "^4.0.0", "create-hmac": "^1.1.7", "int64-buffer": "^1.0.1", "pushdata-bitcoin": "^1.0.1", "tiny-secp256k1": "^1.1.6", "typeforce": "^1.18.0", "varuint-bitcoin": "^1.1.2", - "wif": "^4.0.0" + "wif": "^5.0.0" }, "devDependencies": { - "@types/bchaddrjs": "^0.4.2", + "@types/bchaddrjs": "^0.4.3", "@types/bs58": "^4.0.4", - "@types/bs58check": "^2.1.1", - "@types/create-hmac": "^1.1.2", + "@types/bs58check": "^2.1.2", + "@types/create-hmac": "^1.1.3", "@types/wif": "^2.0.5", "minimaldata": "^1.0.2", "tsx": "^4.16.3" diff --git a/packages/utxo-lib/src/bip32.ts b/packages/utxo-lib/src/bip32.ts index 9d6d1f94cb87..ebb65afb129d 100644 --- a/packages/utxo-lib/src/bip32.ts +++ b/packages/utxo-lib/src/bip32.ts @@ -6,7 +6,7 @@ // - `fromBase58` and `toBase58` methods are using additional "network" param in bs58check.encode/decode (Decred support). import ecc from 'tiny-secp256k1'; -import wif from 'wif'; +import * as wif from 'wif'; import { typeforce } from './types/typeforce'; import * as bs58check from './bs58check'; import * as crypto from './crypto'; @@ -210,7 +210,11 @@ class BIP32 implements BIP32Interface { toWIF(): string { if (!this.privateKey) throw new TypeError('Missing private key'); - return wif.encode(this.network.wif, this.privateKey, true); + return wif.encode({ + version: this.network.wif, + privateKey: this.privateKey, + compressed: true, + }); } // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions diff --git a/packages/utxo-lib/src/derivation.ts b/packages/utxo-lib/src/derivation.ts index 69861d5c1a8f..f029336879c0 100644 --- a/packages/utxo-lib/src/derivation.ts +++ b/packages/utxo-lib/src/derivation.ts @@ -1,4 +1,4 @@ -import { decode } from 'bs58'; +import bs58 from 'bs58'; import { throwError } from '@trezor/utils'; import { p2pkh, p2sh, p2wpkh, p2tr } from './payments'; import { fromBase58 } from './bip32'; @@ -40,7 +40,7 @@ const validateVersion = (version: number): version is VersionBytes => !!BIP32_PAYMENT_TYPES[version as VersionBytes]; const getVersion = (xpub: string) => { - const version = Buffer.from(decode(xpub)).readUInt32BE(); + const version = Buffer.from(bs58.decode(xpub)).readUInt32BE(); if (!validateVersion(version)) throw new Error(`Unknown xpub version: ${xpub}`); return version; diff --git a/packages/utxo-lib/src/script/index.ts b/packages/utxo-lib/src/script/index.ts index c109ab516d18..0a188a198d79 100644 --- a/packages/utxo-lib/src/script/index.ts +++ b/packages/utxo-lib/src/script/index.ts @@ -2,7 +2,7 @@ // differences: // - bitcoin-ops extended by decred codes. -import bip66 from 'bip66'; +import * as bip66 from 'bip66'; import pushdata from 'pushdata-bitcoin'; import ecc from 'tiny-secp256k1'; import * as scriptNumber from './scriptNumber'; diff --git a/packages/utxo-lib/src/script/scriptSignature.ts b/packages/utxo-lib/src/script/scriptSignature.ts index 57590980b313..2d7c0e700938 100644 --- a/packages/utxo-lib/src/script/scriptSignature.ts +++ b/packages/utxo-lib/src/script/scriptSignature.ts @@ -1,6 +1,6 @@ // upstream: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/script_signature.ts -import bip66 from 'bip66'; +import * as bip66 from 'bip66'; import * as types from '../types'; const ZERO = Buffer.alloc(1, 0); diff --git a/suite-native/storage/package.json b/suite-native/storage/package.json index 005972e156b8..cd2dfcc5b147 100644 --- a/suite-native/storage/package.json +++ b/suite-native/storage/package.json @@ -17,7 +17,7 @@ "@sentry/react-native": "5.22.3", "@suite-common/suite-types": "workspace:*", "@suite-common/wallet-core": "workspace:*", - "bs58": "^5.0.0", + "bs58": "^6.0.0", "expo-crypto": "13.0.2", "expo-secure-store": "13.0.1", "expo-splash-screen": "0.27.4", diff --git a/suite-native/storage/src/migrations/account/v3.ts b/suite-native/storage/src/migrations/account/v3.ts index 1e91e6edd1eb..577ca63f4a43 100644 --- a/suite-native/storage/src/migrations/account/v3.ts +++ b/suite-native/storage/src/migrations/account/v3.ts @@ -1,4 +1,4 @@ -import { decode } from 'bs58'; +import bs58 from 'bs58'; const BIP32_PAYMENT_TYPES = { 0x0488b21e: 'p2pkh', // 76067358, xpub @@ -42,7 +42,7 @@ type XpubVersion = keyof typeof BIP32_PAYMENT_TYPES; const getPaymentTypeFromXpub = (xpub: string) => { if (xpub.startsWith('tr(')) return 'p2tr'; - const xpubVersion = Buffer.from(decode(xpub)).readUInt32BE(); + const xpubVersion = Buffer.from(bs58.decode(xpub)).readUInt32BE(); return BIP32_PAYMENT_TYPES[xpubVersion as XpubVersion]; }; diff --git a/yarn.lock b/yarn.lock index b8aa4b8f215c..790ca89a3f51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10358,7 +10358,7 @@ __metadata: "@sentry/react-native": "npm:5.22.3" "@suite-common/suite-types": "workspace:*" "@suite-common/wallet-core": "workspace:*" - bs58: "npm:^5.0.0" + bs58: "npm:^6.0.0" expo-crypto: "npm:13.0.2" expo-secure-store: "npm:13.0.1" expo-splash-screen: "npm:0.27.4" @@ -11256,8 +11256,8 @@ __metadata: "@types/karma": "npm:^6.3.8" babel-loader: "npm:^9.1.3" blakejs: "npm:^1.2.1" - bs58: "npm:^5.0.0" - bs58check: "npm:^3.0.1" + bs58: "npm:^6.0.0" + bs58check: "npm:^4.0.0" cross-fetch: "npm:^4.0.0" jest: "npm:29.7.0" karma: "npm:^6.4.4" @@ -11301,8 +11301,9 @@ __metadata: version: 0.0.0-use.local resolution: "@trezor/e2e-utils@workspace:packages/e2e-utils" dependencies: + "@types/uuid": "npm:^10.0.0" express: "npm:^4.19.2" - uuid: "npm:^9.0.1" + uuid: "npm:^10.0.0" ws: "npm:^8.18.0" languageName: unknown linkType: soft @@ -11546,7 +11547,7 @@ __metadata: postcss-modules-local-by-default: "npm:^4.0.5" postcss-modules-scope: "npm:^3.2.0" postcss-modules-values: "npm:^4.0.0" - simple-git: "npm:^3.22.0" + simple-git: "npm:^3.25.0" style-loader: "npm:^3.3.4" tsx: "npm:^4.16.3" webpack: "npm:^5.93.0" @@ -11602,7 +11603,7 @@ __metadata: fs-extra: "npm:^11.2.0" glob: "npm:^10.3.10" openpgp: "npm:^5.11.2" - systeminformation: "npm:^5.23.4" + systeminformation: "npm:^5.23.5" terser-webpack-plugin: "npm:^5.3.9" webpack: "npm:^5.93.0" xvfb-maybe: "npm:^0.2.1" @@ -11798,9 +11799,9 @@ __metadata: "@types/redux-mock-store": "npm:^1.0.6" "@types/semver": "npm:^7.5.8" "@types/ua-parser-js": "npm:^0.7.39" - "@types/uuid": "npm:^9.0.6" + "@types/uuid": "npm:^10.0.0" "@types/zxcvbn": "npm:^4.4.4" - bs58check: "npm:^3.0.1" + bs58check: "npm:^4.0.0" date-fns: "npm:^2.30.0" dropbox: "npm:^10.34.0" file-saver: "npm:^2.0.5" @@ -11842,7 +11843,7 @@ __metadata: stylelint: "npm:^16.2.1" stylelint-config-standard: "npm:^36.0.0" typescript-styled-plugin: "npm:^0.18.3" - uuid: "npm:^9.0.1" + uuid: "npm:^10.0.0" web3-utils: "npm:^4.3.1" zxcvbn: "npm:^4.4.2" languageName: unknown @@ -11973,20 +11974,20 @@ __metadata: resolution: "@trezor/utxo-lib@workspace:packages/utxo-lib" dependencies: "@trezor/utils": "workspace:*" - "@types/bchaddrjs": "npm:^0.4.2" + "@types/bchaddrjs": "npm:^0.4.3" "@types/bs58": "npm:^4.0.4" - "@types/bs58check": "npm:^2.1.1" - "@types/create-hmac": "npm:^1.1.2" + "@types/bs58check": "npm:^2.1.2" + "@types/create-hmac": "npm:^1.1.3" "@types/wif": "npm:^2.0.5" bchaddrjs: "npm:^0.5.2" bech32: "npm:^2.0.0" - bip66: "npm:^1.1.5" + bip66: "npm:^2.0.0" bitcoin-ops: "npm:^1.4.1" blake-hash: "npm:^2.0.0" blakejs: "npm:^1.2.1" bn.js: "npm:^5.2.1" - bs58: "npm:^5.0.0" - bs58check: "npm:^3.0.1" + bs58: "npm:^6.0.0" + bs58check: "npm:^4.0.0" create-hmac: "npm:^1.1.7" int64-buffer: "npm:^1.0.1" minimaldata: "npm:^1.0.2" @@ -11995,7 +11996,7 @@ __metadata: tsx: "npm:^4.16.3" typeforce: "npm:^1.18.0" varuint-bitcoin: "npm:^1.1.2" - wif: "npm:^4.0.0" + wif: "npm:^5.0.0" peerDependencies: tslib: ^2.6.2 languageName: unknown @@ -12120,7 +12121,7 @@ __metadata: languageName: node linkType: hard -"@types/bchaddrjs@npm:^0.4.2": +"@types/bchaddrjs@npm:^0.4.3": version: 0.4.3 resolution: "@types/bchaddrjs@npm:0.4.3" checksum: 10/ebffc96914a95b3251ca5ce023105a4977a02032a994a2765f8620ffe43c55a283753f50347b592f8b89726e14d15be884563e723bdadf7689f43fd9b868fdff @@ -12165,7 +12166,7 @@ __metadata: languageName: node linkType: hard -"@types/bs58check@npm:^2.1.1": +"@types/bs58check@npm:^2.1.2": version: 2.1.2 resolution: "@types/bs58check@npm:2.1.2" dependencies: @@ -12317,7 +12318,7 @@ __metadata: languageName: node linkType: hard -"@types/create-hmac@npm:^1.1.2": +"@types/create-hmac@npm:^1.1.3": version: 1.1.3 resolution: "@types/create-hmac@npm:1.1.3" dependencies: @@ -13467,6 +13468,13 @@ __metadata: languageName: node linkType: hard +"@types/uuid@npm:^10.0.0": + version: 10.0.0 + resolution: "@types/uuid@npm:10.0.0" + checksum: 10/e3958f8b0fe551c86c14431f5940c3470127293280830684154b91dc7eb3514aeb79fe3216968833cf79d4d1c67f580f054b5be2cd562bebf4f728913e73e944 + languageName: node + linkType: hard + "@types/uuid@npm:^8.3.4": version: 8.3.4 resolution: "@types/uuid@npm:8.3.4" @@ -13474,7 +13482,7 @@ __metadata: languageName: node linkType: hard -"@types/uuid@npm:^9.0.1, @types/uuid@npm:^9.0.6": +"@types/uuid@npm:^9.0.1": version: 9.0.8 resolution: "@types/uuid@npm:9.0.8" checksum: 10/b8c60b7ba8250356b5088302583d1704a4e1a13558d143c549c408bf8920535602ffc12394ede77f8a8083511b023704bc66d1345792714002bfa261b17c5275 @@ -15602,6 +15610,13 @@ __metadata: languageName: node linkType: hard +"base-x@npm:^5.0.0": + version: 5.0.0 + resolution: "base-x@npm:5.0.0" + checksum: 10/fa82bc9a963f7a765a3287ba632661669fe553d06ee0d4d4e282640335bff30ec685e3c3b1714e265f697b234facd02a310f1e2465db88f4f1a448e6267fbc65 + languageName: node + linkType: hard + "base32.js@npm:^0.1.0": version: 0.1.0 resolution: "base32.js@npm:0.1.0" @@ -15787,12 +15802,10 @@ __metadata: languageName: node linkType: hard -"bip66@npm:^1.1.5": - version: 1.1.5 - resolution: "bip66@npm:1.1.5" - dependencies: - safe-buffer: "npm:^5.0.1" - checksum: 10/6257e90ff2149aa08740ff4009730c1bceb1a3456571d3006a36b39f30044f2973e05f043ea6977046d6ab66e4a8d6f5c9785094f8317f4ff546a325baece1ab +"bip66@npm:^2.0.0": + version: 2.0.0 + resolution: "bip66@npm:2.0.0" + checksum: 10/919b25d3ed2b9d774eefe550ae6e825e29e1aa450fc1af12e7cef39115a8bc867018b5aa3d8e68b459ec198decabfc1ebe2bdbae9edfdca61c97e862d1db098d languageName: node linkType: hard @@ -16193,6 +16206,15 @@ __metadata: languageName: node linkType: hard +"bs58@npm:^6.0.0": + version: 6.0.0 + resolution: "bs58@npm:6.0.0" + dependencies: + base-x: "npm:^5.0.0" + checksum: 10/7c9bb2b2d93d997a8c652de3510d89772007ac64ee913dc4e16ba7ff47624caad3128dcc7f360763eb6308760c300b3e9fd91b8bcbd489acd1a13278e7949c4e + languageName: node + linkType: hard + "bs58check@npm:2.1.2, bs58check@npm:^2.1.2": version: 2.1.2 resolution: "bs58check@npm:2.1.2" @@ -16204,13 +16226,13 @@ __metadata: languageName: node linkType: hard -"bs58check@npm:^3.0.1": - version: 3.0.1 - resolution: "bs58check@npm:3.0.1" +"bs58check@npm:^4.0.0": + version: 4.0.0 + resolution: "bs58check@npm:4.0.0" dependencies: "@noble/hashes": "npm:^1.2.0" - bs58: "npm:^5.0.0" - checksum: 10/dbbecc7a09f3836e821149266c864c4bbd545539cea43c35f23f4c3c46b54c86c52b65d224b9ea2e916fa6d93bd2ce9fac5b6c6bfcf19621a9c209a5602f71c8 + bs58: "npm:^6.0.0" + checksum: 10/cf5691bdfdf317574f722582360a834f01a36e8f6c850bd5791f04e040b334a0800b7c322ad24c77979c3ed6ef6cf31a6373366b4018223e3005278d491d8799 languageName: node linkType: hard @@ -37832,14 +37854,14 @@ __metadata: languageName: node linkType: hard -"simple-git@npm:^3.22.0": - version: 3.22.0 - resolution: "simple-git@npm:3.22.0" +"simple-git@npm:^3.25.0": + version: 3.25.0 + resolution: "simple-git@npm:3.25.0" dependencies: "@kwsites/file-exists": "npm:^1.1.1" "@kwsites/promise-deferred": "npm:^1.1.1" - debug: "npm:^4.3.4" - checksum: 10/309e7f0b73550f99949c0c6cfd4b4799ec0452fc4835dc440f89ec9351fe553c979c4e2bf7a772308e608697d3a27512281fbc64df0328a73607641f389b0aaf + debug: "npm:^4.3.5" + checksum: 10/f284162c941e36970db171eacfe0df1f7ce50313fa7841b95abb704ec78ffe4f27b6a46a4b621ed88711104faa295eb47fb2b54b23cead4400cb2204ed491074 languageName: node linkType: hard @@ -39310,12 +39332,12 @@ __metadata: languageName: node linkType: hard -"systeminformation@npm:^5.23.4": - version: 5.23.4 - resolution: "systeminformation@npm:5.23.4" +"systeminformation@npm:^5.23.5": + version: 5.23.5 + resolution: "systeminformation@npm:5.23.5" bin: systeminformation: lib/cli.js - checksum: 10/ab2c51d9755ba9a9ece3cc67fedf7079860345b6c6e687c10d5b18d5ff48602675ef8b330accf2a1a16cef434f84caeaab00b804e451fd7e3c17868252cd3749 + checksum: 10/cc7afa317cf6f106ae89fb533f65ea47982972e3a5b4a8747ddc34d4bf06052bfba4ca64a0320828b62155f0e34c42a9b79520a75f9c8db632cad2dfc77dce98 conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android) languageName: node linkType: hard @@ -41350,6 +41372,15 @@ __metadata: languageName: node linkType: hard +"uuid@npm:^10.0.0": + version: 10.0.0 + resolution: "uuid@npm:10.0.0" + bin: + uuid: dist/bin/uuid + checksum: 10/35aa60614811a201ff90f8ca5e9ecb7076a75c3821e17f0f5ff72d44e36c2d35fcbc2ceee9c4ac7317f4cc41895da30e74f3885e30313bee48fda6338f250538 + languageName: node + linkType: hard + "uuid@npm:^3.0.1, uuid@npm:^3.3.2": version: 3.4.0 resolution: "uuid@npm:3.4.0" @@ -42902,12 +42933,12 @@ __metadata: languageName: node linkType: hard -"wif@npm:^4.0.0": - version: 4.0.0 - resolution: "wif@npm:4.0.0" +"wif@npm:^5.0.0": + version: 5.0.0 + resolution: "wif@npm:5.0.0" dependencies: - bs58check: "npm:^3.0.1" - checksum: 10/5b3438202c0e4509c1963872730d8aa33dd34f0da5c65d8fde8e1cd6338bae78d1f2144099d5cb2a4a9de4679e13a09e4d3da8a22af52be98dc9abf4de0581e4 + bs58check: "npm:^4.0.0" + checksum: 10/3af0d4e9f1d1b35672b860470b6545f34f77b4a804e06ccae2f06f43c96a31fba859cf64889344eded621433eb609fc4c95aa28d62c02057372232b85231e414 languageName: node linkType: hard