Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 1 addition & 3 deletions packages/connect/src/api/eos/eosSignTx.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions packages/connect/src/api/tezos/tezosSignTx.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
5 changes: 4 additions & 1 deletion packages/e2e-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion packages/suite-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/suite-desktop-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions packages/suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
},
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/suite/src/utils/suite/metadata.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
14 changes: 7 additions & 7 deletions packages/utxo-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 0 additions & 8 deletions packages/utxo-lib/src/address.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions packages/utxo-lib/src/bip32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Comment thread
Lemonexe marked this conversation as resolved.
import { typeforce } from './types/typeforce';
import * as bs58check from './bs58check';
import * as crypto from './crypto';
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/utxo-lib/src/derivation.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/utxo-lib/src/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/utxo-lib/src/script/scriptSignature.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
15 changes: 0 additions & 15 deletions packages/utxo-lib/tests/address.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion suite-common/wallet-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion suite-common/wallet-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions suite-native/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion suite-native/module-accounts-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion suite-native/module-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion suite-native/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions suite-native/storage/src/migrations/account/v3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { decode } from 'bs58';
import bs58 from 'bs58';

const BIP32_PAYMENT_TYPES = {
0x0488b21e: 'p2pkh', // 76067358, xpub
Expand Down Expand Up @@ -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];
};
Expand Down
Loading