Browse Source

Merge pull request #1381 from bitcoinjs/fixTypes

Fix address.*OutputScript and ECPairOptions rng
trimSpace
Jonathan Underwood 6 years ago
committed by GitHub
parent
commit
a52ef82e4f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package-lock.json
  2. 2
      package.json
  3. 4
      ts_src/address.ts
  4. 2
      ts_src/ecpair.ts
  5. 4
      types/address.d.ts
  6. 2
      types/ecpair.d.ts

2
package-lock.json

@ -1,6 +1,6 @@
{ {
"name": "bitcoinjs-lib", "name": "bitcoinjs-lib",
"version": "5.0.1", "version": "5.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "bitcoinjs-lib", "name": "bitcoinjs-lib",
"version": "5.0.1", "version": "5.0.2",
"description": "Client-side Bitcoin JavaScript library", "description": "Client-side Bitcoin JavaScript library",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",

4
ts_src/address.ts

@ -64,7 +64,7 @@ export function toBech32(
return bech32.encode(prefix, words); return bech32.encode(prefix, words);
} }
export function fromOutputScript(output: Buffer, network: Network): string { export function fromOutputScript(output: Buffer, network?: Network): string {
// TODO: Network // TODO: Network
network = network || networks.bitcoin; network = network || networks.bitcoin;
@ -84,7 +84,7 @@ export function fromOutputScript(output: Buffer, network: Network): string {
throw new Error(bscript.toASM(output) + ' has no matching Address'); throw new Error(bscript.toASM(output) + ' has no matching Address');
} }
export function toOutputScript(address: string, network: Network): Buffer { export function toOutputScript(address: string, network?: Network): Buffer {
network = network || networks.bitcoin; network = network || networks.bitcoin;
let decodeBase58: Base58CheckResult | undefined; let decodeBase58: Base58CheckResult | undefined;

2
ts_src/ecpair.ts

@ -16,7 +16,7 @@ const isOptions = typeforce.maybe(
interface ECPairOptions { interface ECPairOptions {
compressed?: boolean; compressed?: boolean;
network?: Network; network?: Network;
rng?(arg0: Buffer): Buffer; rng?(arg0: number): Buffer;
} }
export interface ECPairInterface { export interface ECPairInterface {

4
types/address.d.ts

@ -13,5 +13,5 @@ export declare function fromBase58Check(address: string): Base58CheckResult;
export declare function fromBech32(address: string): Bech32Result; export declare function fromBech32(address: string): Bech32Result;
export declare function toBase58Check(hash: Buffer, version: number): string; export declare function toBase58Check(hash: Buffer, version: number): string;
export declare function toBech32(data: Buffer, version: number, prefix: string): string; export declare function toBech32(data: Buffer, version: number, prefix: string): string;
export declare function fromOutputScript(output: Buffer, network: Network): string; export declare function fromOutputScript(output: Buffer, network?: Network): string;
export declare function toOutputScript(address: string, network: Network): Buffer; export declare function toOutputScript(address: string, network?: Network): Buffer;

2
types/ecpair.d.ts

@ -3,7 +3,7 @@ import { Network } from './networks';
interface ECPairOptions { interface ECPairOptions {
compressed?: boolean; compressed?: boolean;
network?: Network; network?: Network;
rng?(arg0: Buffer): Buffer; rng?(arg0: number): Buffer;
} }
export interface ECPairInterface { export interface ECPairInterface {
compressed: boolean; compressed: boolean;

Loading…
Cancel
Save