@trezor/utxo-lib
Advanced tools
+4
-0
@@ -0,1 +1,5 @@ | ||
| # 1.0.5 | ||
| chore(utxo-lib): update deps, update bs58check bitcoin lib | ||
| # 1.0.4 | ||
@@ -2,0 +6,0 @@ |
+2
-2
@@ -195,5 +195,5 @@ "use strict"; | ||
| function fromBase58(inString, network) { | ||
| const buffer = (0, networks_1.isNetworkType)('decred', network) | ||
| const buffer = Buffer.from((0, networks_1.isNetworkType)('decred', network) | ||
| ? bs58check.decodeBlake256Key(inString) | ||
| : bs58check.decode(inString, network); | ||
| : bs58check.decode(inString, network)); | ||
| if (buffer.length !== 78) | ||
@@ -200,0 +200,0 @@ throw new TypeError('Invalid buffer length'); |
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
| export declare function encode(payload: Buffer, network?: import("./networks").Network): string; | ||
| export declare function decode(payload: string, network?: import("./networks").Network): Buffer; | ||
| export declare function decode(payload: string, network?: import("./networks").Network): Buffer | Uint8Array; | ||
| export declare function decodeAddress(address: string, network?: import("./networks").Network): { | ||
@@ -10,0 +10,0 @@ version: number; |
+2
-2
@@ -60,6 +60,6 @@ "use strict"; | ||
| throw Error(`${address} is not a cash address`); | ||
| payload = bs58check.decode(bchaddrjs.toLegacyAddress(address)); | ||
| payload = Buffer.from(bs58check.decode(bchaddrjs.toLegacyAddress(address))); | ||
| } | ||
| else { | ||
| payload = decode(address, network); | ||
| payload = Buffer.from(decode(address, network)); | ||
| } | ||
@@ -66,0 +66,0 @@ if (payload.length < 21) |
+16
-0
| import { Network } from './networks'; | ||
| declare const BIP32_PAYMENT_TYPES: { | ||
| readonly 76067358: "p2pkh"; | ||
| readonly 77429938: "p2sh"; | ||
| readonly 78792518: "p2wpkh"; | ||
| readonly 70617039: "p2pkh"; | ||
| readonly 71979618: "p2sh"; | ||
| readonly 73342198: "p2wpkh"; | ||
| }; | ||
| type VersionBytes = keyof typeof BIP32_PAYMENT_TYPES; | ||
| export type PaymentType = (typeof BIP32_PAYMENT_TYPES)[VersionBytes] | 'p2tr'; | ||
| export declare const getXpubOrDescriptorInfo: (descriptor: string, network?: Network) => { | ||
| levels: string[]; | ||
| paymentType: PaymentType; | ||
| node: import("./bip32").BIP32Interface; | ||
| }; | ||
| export declare const deriveAddresses: (descriptor: string, type: 'receive' | 'change', from: number, count: number, network?: Network) => { | ||
@@ -6,2 +21,3 @@ address: string; | ||
| }[]; | ||
| export {}; | ||
| //# sourceMappingURL=derivation.d.ts.map |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.deriveAddresses = void 0; | ||
| exports.deriveAddresses = exports.getXpubOrDescriptorInfo = void 0; | ||
| const bs58_1 = require("bs58"); | ||
@@ -84,3 +84,3 @@ const utils_1 = require("@trezor/utils"); | ||
| }; | ||
| const getXpubOrDescriptorInfo = (descriptor, network) => { | ||
| const getXpubOrDescriptorInfo = (descriptor, network = networks_1.bitcoin) => { | ||
| if (descriptor.startsWith('pkh(')) { | ||
@@ -100,4 +100,5 @@ return getDescriptorInfo('p2pkh', descriptor, network); | ||
| }; | ||
| exports.getXpubOrDescriptorInfo = getXpubOrDescriptorInfo; | ||
| const deriveAddresses = (descriptor, type, from, count, network = networks_1.bitcoin) => { | ||
| const { levels, node, paymentType } = getXpubOrDescriptorInfo(descriptor, network); | ||
| const { levels, node, paymentType } = (0, exports.getXpubOrDescriptorInfo)(descriptor, network); | ||
| const getAddress = getPubkeyToPayment(paymentType, network); | ||
@@ -104,0 +105,0 @@ const change = type === 'receive' ? 0 : 1; |
+3
-2
@@ -9,6 +9,7 @@ import * as address from './address'; | ||
| import { composeTx } from './compose'; | ||
| import { deriveAddresses } from './derivation'; | ||
| import { deriveAddresses, getXpubOrDescriptorInfo } from './derivation'; | ||
| import { discovery } from './discovery'; | ||
| export { Transaction } from './transaction'; | ||
| export { address, bip32, bufferutils, crypto, payments, script, networks, composeTx, deriveAddresses, discovery, }; | ||
| export { address, bip32, bufferutils, crypto, payments, script, networks, composeTx, deriveAddresses, getXpubOrDescriptorInfo, discovery, }; | ||
| export type { PaymentType } from './derivation'; | ||
| export type { Network } from './networks'; | ||
@@ -15,0 +16,0 @@ export type { BIP32Interface } from './bip32'; |
+2
-1
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.discovery = exports.deriveAddresses = exports.composeTx = exports.networks = exports.script = exports.payments = exports.crypto = exports.bufferutils = exports.bip32 = exports.address = exports.Transaction = void 0; | ||
| exports.discovery = exports.getXpubOrDescriptorInfo = exports.deriveAddresses = exports.composeTx = exports.networks = exports.script = exports.payments = exports.crypto = exports.bufferutils = exports.bip32 = exports.address = exports.Transaction = void 0; | ||
| const address = require("./address"); | ||
@@ -22,2 +22,3 @@ exports.address = address; | ||
| Object.defineProperty(exports, "deriveAddresses", { enumerable: true, get: function () { return derivation_1.deriveAddresses; } }); | ||
| Object.defineProperty(exports, "getXpubOrDescriptorInfo", { enumerable: true, get: function () { return derivation_1.getXpubOrDescriptorInfo; } }); | ||
| const discovery_1 = require("./discovery"); | ||
@@ -24,0 +25,0 @@ Object.defineProperty(exports, "discovery", { enumerable: true, get: function () { return discovery_1.discovery; } }); |
+5
-5
| { | ||
| "name": "@trezor/utxo-lib", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "author": "Trezor <info@trezor.io>", | ||
@@ -39,3 +39,3 @@ "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/utxo-lib", | ||
| "dependencies": { | ||
| "@trezor/utils": "^9.0.6", | ||
| "@trezor/utils": "9.0.7", | ||
| "bchaddrjs": "^0.5.2", | ||
@@ -49,3 +49,3 @@ "bech32": "^2.0.0", | ||
| "bs58": "^5.0.0", | ||
| "bs58check": "^2.1.2", | ||
| "bs58check": "^3.0.1", | ||
| "create-hash": "^1.2.0", | ||
@@ -69,6 +69,6 @@ "create-hmac": "^1.1.7", | ||
| "minimaldata": "^1.0.2", | ||
| "rimraf": "^4.1.2", | ||
| "tsx": "^3.12.3", | ||
| "rimraf": "^4.4.1", | ||
| "tsx": "^3.12.6", | ||
| "typescript": "4.9.5" | ||
| } | ||
| } |
217126
0.51%5599
0.34%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated