Refactor: Use varint from BIP174

This commit is contained in:
junderw 2019-07-09 13:02:34 +09:00
parent 479c56bbb4
commit 0f76aa935a
No known key found for this signature in database
GPG key ID: B256185D3A971908
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const bip174_1 = require('bip174');
const varuint = require('bip174/src/lib/converter/varint');
const utils_1 = require('bip174/src/lib/utils');
const address_1 = require('./address');
const bufferutils_1 = require('./bufferutils');
@ -10,7 +11,6 @@ const networks_1 = require('./networks');
const payments = require('./payments');
const bscript = require('./script');
const transaction_1 = require('./transaction');
const varuint = require('varuint-bitcoin');
const DEFAULT_OPTS = {
network: networks_1.bitcoin,
maximumFeeRate: 5000,

View file

@ -1,4 +1,5 @@
import { Psbt as PsbtBase } from 'bip174';
import * as varuint from 'bip174/src/lib/converter/varint';
import {
NonWitnessUtxo,
PartialSig,
@ -19,7 +20,6 @@ import { bitcoin as btcNetwork, Network } from './networks';
import * as payments from './payments';
import * as bscript from './script';
import { Output, Transaction } from './transaction';
const varuint = require('varuint-bitcoin');
const DEFAULT_OPTS: PsbtOpts = {
network: btcNetwork,
@ -946,7 +946,7 @@ function scriptWitnessToWitnessStack(buffer: Buffer): Buffer[] {
function readVarInt(): number {
const vi = varuint.decode(buffer, offset);
offset += varuint.decode.bytes;
offset += (varuint.decode as any).bytes;
return vi;
}