From 34b0b525fc78736c009465f1a8e602f565d5c3d3 Mon Sep 17 00:00:00 2001
From: junderw <junderwood@bitcoinbank.co.jp>
Date: Thu, 12 Sep 2019 15:20:33 +0900
Subject: [PATCH] Update @types/node and fix problems with types

---
 package-lock.json                             | 13 ++++++++++---
 package.json                                  |  2 +-
 test/integration/cltv.spec.ts                 |  2 +-
 test/integration/csv.spec.ts                  |  2 +-
 test/psbt.spec.ts                             |  2 +-
 types/address.d.ts                            |  1 -
 types/block.d.ts                              |  1 -
 types/bufferutils.d.ts                        |  1 -
 types/classify.d.ts                           |  1 -
 types/crypto.d.ts                             |  1 -
 types/ecpair.d.ts                             |  1 -
 types/payments/index.d.ts                     |  1 -
 types/psbt.d.ts                               |  1 -
 types/script.d.ts                             |  1 -
 types/script_number.d.ts                      |  1 -
 types/script_signature.d.ts                   |  1 -
 types/templates/multisig/input.d.ts           |  1 -
 types/templates/multisig/output.d.ts          |  1 -
 types/templates/nulldata.d.ts                 |  1 -
 types/templates/pubkey/input.d.ts             |  1 -
 types/templates/pubkey/output.d.ts            |  1 -
 types/templates/pubkeyhash/input.d.ts         |  1 -
 types/templates/pubkeyhash/output.d.ts        |  1 -
 types/templates/scripthash/input.d.ts         |  1 -
 types/templates/scripthash/output.d.ts        |  1 -
 types/templates/witnesscommitment/output.d.ts |  1 -
 types/templates/witnesspubkeyhash/input.d.ts  |  1 -
 types/templates/witnesspubkeyhash/output.d.ts |  1 -
 types/templates/witnessscripthash/input.d.ts  |  1 -
 types/templates/witnessscripthash/output.d.ts |  1 -
 types/transaction.d.ts                        |  1 -
 types/transaction_builder.d.ts                |  1 -
 32 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 5812365..4c3dd29 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -156,9 +156,9 @@
       "dev": true
     },
     "@types/node": {
-      "version": "10.12.18",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz",
-      "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ=="
+      "version": "12.7.5",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
+      "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w=="
     },
     "@types/proxyquire": {
       "version": "1.3.28",
@@ -261,6 +261,13 @@
         "tiny-secp256k1": "^1.1.0",
         "typeforce": "^1.11.5",
         "wif": "^2.0.6"
+      },
+      "dependencies": {
+        "@types/node": {
+          "version": "10.12.18",
+          "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz",
+          "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ=="
+        }
       }
     },
     "bip39": {
diff --git a/package.json b/package.json
index 700b7fd..f624f76 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
     "types"
   ],
   "dependencies": {
-    "@types/node": "10.12.18",
+    "@types/node": "12.7.5",
     "bech32": "^1.1.2",
     "bip174": "^1.0.1",
     "bip32": "^2.0.4",
diff --git a/test/integration/cltv.spec.ts b/test/integration/cltv.spec.ts
index 3bc0b14..f83f0e2 100644
--- a/test/integration/cltv.spec.ts
+++ b/test/integration/cltv.spec.ts
@@ -10,7 +10,7 @@ function toOutputScript(address: string): Buffer {
 }
 
 function idToHash(txid: string): Buffer {
-  return Buffer.from(txid, 'hex').reverse() as Buffer;
+  return Buffer.from(txid, 'hex').reverse();
 }
 
 const alice = bitcoin.ECPair.fromWIF(
diff --git a/test/integration/csv.spec.ts b/test/integration/csv.spec.ts
index 7d4f4a4..316d227 100644
--- a/test/integration/csv.spec.ts
+++ b/test/integration/csv.spec.ts
@@ -10,7 +10,7 @@ function toOutputScript(address: string): Buffer {
 }
 
 function idToHash(txid: string): Buffer {
-  return Buffer.from(txid, 'hex').reverse() as Buffer;
+  return Buffer.from(txid, 'hex').reverse();
 }
 
 const alice = bitcoin.ECPair.fromWIF(
diff --git a/test/psbt.spec.ts b/test/psbt.spec.ts
index 02a420d..39647b1 100644
--- a/test/psbt.spec.ts
+++ b/test/psbt.spec.ts
@@ -14,7 +14,7 @@ const initBuffers = (object: any): typeof preFixtures =>
     const data = result[1];
     const encoding = result[2];
 
-    return Buffer.from(data, encoding);
+    return Buffer.from(data, encoding as any);
   });
 
 const fixtures = initBuffers(preFixtures);
diff --git a/types/address.d.ts b/types/address.d.ts
index be0e00a..5c7ed5a 100644
--- a/types/address.d.ts
+++ b/types/address.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Network } from './networks';
 export interface Base58CheckResult {
     hash: Buffer;
diff --git a/types/block.d.ts b/types/block.d.ts
index 0cda4c8..d77bb1b 100644
--- a/types/block.d.ts
+++ b/types/block.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Transaction } from './transaction';
 export declare class Block {
     static fromBuffer(buffer: Buffer): Block;
diff --git a/types/bufferutils.d.ts b/types/bufferutils.d.ts
index 2686e4e..1eff78d 100644
--- a/types/bufferutils.d.ts
+++ b/types/bufferutils.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function readUInt64LE(buffer: Buffer, offset: number): number;
 export declare function writeUInt64LE(buffer: Buffer, value: number, offset: number): number;
 export declare function reverseBuffer(buffer: Buffer): Buffer;
diff --git a/types/classify.d.ts b/types/classify.d.ts
index d0f07b4..6ea4754 100644
--- a/types/classify.d.ts
+++ b/types/classify.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 declare const types: {
     P2MS: string;
     NONSTANDARD: string;
diff --git a/types/crypto.d.ts b/types/crypto.d.ts
index 1743681..5d93acd 100644
--- a/types/crypto.d.ts
+++ b/types/crypto.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function ripemd160(buffer: Buffer): Buffer;
 export declare function sha1(buffer: Buffer): Buffer;
 export declare function sha256(buffer: Buffer): Buffer;
diff --git a/types/ecpair.d.ts b/types/ecpair.d.ts
index 0b69dfe..447c608 100644
--- a/types/ecpair.d.ts
+++ b/types/ecpair.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Network } from './networks';
 interface ECPairOptions {
     compressed?: boolean;
diff --git a/types/payments/index.d.ts b/types/payments/index.d.ts
index 1edf071..922e0bf 100644
--- a/types/payments/index.d.ts
+++ b/types/payments/index.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Network } from '../networks';
 import { p2data as embed } from './embed';
 import { p2ms } from './p2ms';
diff --git a/types/psbt.d.ts b/types/psbt.d.ts
index 4db075c..b1bacea 100644
--- a/types/psbt.d.ts
+++ b/types/psbt.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Psbt as PsbtBase } from 'bip174';
 import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput } from 'bip174/src/lib/interfaces';
 import { Signer, SignerAsync } from './ecpair';
diff --git a/types/script.d.ts b/types/script.d.ts
index 52ad4dd..4b04615 100644
--- a/types/script.d.ts
+++ b/types/script.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from './payments';
 import * as scriptNumber from './script_number';
 import * as scriptSignature from './script_signature';
diff --git a/types/script_number.d.ts b/types/script_number.d.ts
index 015bb89..cf535fc 100644
--- a/types/script_number.d.ts
+++ b/types/script_number.d.ts
@@ -1,3 +1,2 @@
-/// <reference types="node" />
 export declare function decode(buffer: Buffer, maxLength?: number, minimal?: boolean): number;
 export declare function encode(_number: number): Buffer;
diff --git a/types/script_signature.d.ts b/types/script_signature.d.ts
index 2057dd9..fbf18d5 100644
--- a/types/script_signature.d.ts
+++ b/types/script_signature.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 interface ScriptSignature {
     signature: Buffer;
     hashType: number;
diff --git a/types/templates/multisig/input.d.ts b/types/templates/multisig/input.d.ts
index a207dd6..6d46515 100644
--- a/types/templates/multisig/input.d.ts
+++ b/types/templates/multisig/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack, allowIncomplete?: boolean): boolean;
 export declare namespace check {
diff --git a/types/templates/multisig/output.d.ts b/types/templates/multisig/output.d.ts
index a207dd6..6d46515 100644
--- a/types/templates/multisig/output.d.ts
+++ b/types/templates/multisig/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack, allowIncomplete?: boolean): boolean;
 export declare namespace check {
diff --git a/types/templates/nulldata.d.ts b/types/templates/nulldata.d.ts
index aff3cd0..bf6497c 100644
--- a/types/templates/nulldata.d.ts
+++ b/types/templates/nulldata.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/pubkey/input.d.ts b/types/templates/pubkey/input.d.ts
index c4ffeab..4b70d2d 100644
--- a/types/templates/pubkey/input.d.ts
+++ b/types/templates/pubkey/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack): boolean;
 export declare namespace check {
diff --git a/types/templates/pubkey/output.d.ts b/types/templates/pubkey/output.d.ts
index c4ffeab..4b70d2d 100644
--- a/types/templates/pubkey/output.d.ts
+++ b/types/templates/pubkey/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack): boolean;
 export declare namespace check {
diff --git a/types/templates/pubkeyhash/input.d.ts b/types/templates/pubkeyhash/input.d.ts
index c4ffeab..4b70d2d 100644
--- a/types/templates/pubkeyhash/input.d.ts
+++ b/types/templates/pubkeyhash/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack): boolean;
 export declare namespace check {
diff --git a/types/templates/pubkeyhash/output.d.ts b/types/templates/pubkeyhash/output.d.ts
index 091758f..d66d8ac 100644
--- a/types/templates/pubkeyhash/output.d.ts
+++ b/types/templates/pubkeyhash/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/scripthash/input.d.ts b/types/templates/scripthash/input.d.ts
index a04d03c..14bbd5b 100644
--- a/types/templates/scripthash/input.d.ts
+++ b/types/templates/scripthash/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>, allowIncomplete?: boolean): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/scripthash/output.d.ts b/types/templates/scripthash/output.d.ts
index 091758f..d66d8ac 100644
--- a/types/templates/scripthash/output.d.ts
+++ b/types/templates/scripthash/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/witnesscommitment/output.d.ts b/types/templates/witnesscommitment/output.d.ts
index 778c9a1..ec155a2 100644
--- a/types/templates/witnesscommitment/output.d.ts
+++ b/types/templates/witnesscommitment/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/witnesspubkeyhash/input.d.ts b/types/templates/witnesspubkeyhash/input.d.ts
index c4ffeab..4b70d2d 100644
--- a/types/templates/witnesspubkeyhash/input.d.ts
+++ b/types/templates/witnesspubkeyhash/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Stack } from '../../payments';
 export declare function check(script: Buffer | Stack): boolean;
 export declare namespace check {
diff --git a/types/templates/witnesspubkeyhash/output.d.ts b/types/templates/witnesspubkeyhash/output.d.ts
index 091758f..d66d8ac 100644
--- a/types/templates/witnesspubkeyhash/output.d.ts
+++ b/types/templates/witnesspubkeyhash/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/witnessscripthash/input.d.ts b/types/templates/witnessscripthash/input.d.ts
index b2a6e8a..767df3a 100644
--- a/types/templates/witnessscripthash/input.d.ts
+++ b/types/templates/witnessscripthash/input.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(chunks: Buffer[], allowIncomplete?: boolean): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/templates/witnessscripthash/output.d.ts b/types/templates/witnessscripthash/output.d.ts
index 091758f..d66d8ac 100644
--- a/types/templates/witnessscripthash/output.d.ts
+++ b/types/templates/witnessscripthash/output.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export declare function check(script: Buffer | Array<number | Buffer>): boolean;
 export declare namespace check {
     var toJSON: () => string;
diff --git a/types/transaction.d.ts b/types/transaction.d.ts
index 9bdba19..d7462b4 100644
--- a/types/transaction.d.ts
+++ b/types/transaction.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 export interface BlankOutput {
     script: Buffer;
     valueBuffer: Buffer;
diff --git a/types/transaction_builder.d.ts b/types/transaction_builder.d.ts
index 2799464..a80fc0f 100644
--- a/types/transaction_builder.d.ts
+++ b/types/transaction_builder.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" />
 import { Signer } from './ecpair';
 import { Network } from './networks';
 import { Transaction } from './transaction';