sed -i 's/^var /const /'
This commit is contained in:
parent
93b1ae4303
commit
91b8823aa8
37 changed files with 197 additions and 197 deletions
|
@ -1,11 +1,11 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var bech32 = require('bech32')
|
||||
var bs58check = require('bs58check')
|
||||
var bscript = require('./script')
|
||||
var btemplates = require('./templates')
|
||||
var networks = require('./networks')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bech32 = require('bech32')
|
||||
const bs58check = require('bs58check')
|
||||
const bscript = require('./script')
|
||||
const btemplates = require('./templates')
|
||||
const networks = require('./networks')
|
||||
const typeforce = require('typeforce')
|
||||
const types = require('./types')
|
||||
|
||||
function fromBase58Check (address) {
|
||||
var payload = bs58check.decode(address)
|
||||
|
|
14
src/block.js
14
src/block.js
|
@ -1,11 +1,11 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var bcrypto = require('./crypto')
|
||||
var fastMerkleRoot = require('merkle-lib/fastRoot')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
var varuint = require('varuint-bitcoin')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bcrypto = require('./crypto')
|
||||
const fastMerkleRoot = require('merkle-lib/fastRoot')
|
||||
const typeforce = require('typeforce')
|
||||
const types = require('./types')
|
||||
const varuint = require('varuint-bitcoin')
|
||||
|
||||
var Transaction = require('./transaction')
|
||||
const Transaction = require('./transaction')
|
||||
|
||||
function Block () {
|
||||
this.version = 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var createHash = require('create-hash')
|
||||
const createHash = require('create-hash')
|
||||
|
||||
function ripemd160 (buffer) {
|
||||
return createHash('rmd160').update(buffer).digest()
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var bip66 = require('bip66')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bip66 = require('bip66')
|
||||
const ecc = require('tiny-secp256k1')
|
||||
var pushdata = require('pushdata-bitcoin')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
var scriptNumber = require('./script_number')
|
||||
const pushdata = require('pushdata-bitcoin')
|
||||
const typeforce = require('typeforce')
|
||||
const types = require('./types')
|
||||
const scriptNumber = require('./script_number')
|
||||
|
||||
var OPS = require('bitcoin-ops')
|
||||
var REVERSE_OPS = require('bitcoin-ops/map')
|
||||
var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||
const OPS = require('bitcoin-ops')
|
||||
const REVERSE_OPS = require('bitcoin-ops/map')
|
||||
const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||
|
||||
function isOPInt (value) {
|
||||
return types.Number(value) &&
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
|
||||
function decode (buffer, maxLength, minimal) {
|
||||
maxLength = maxLength || 4
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var decompile = require('../script').decompile
|
||||
var multisig = require('./multisig')
|
||||
var nullData = require('./nulldata')
|
||||
var pubKey = require('./pubkey')
|
||||
var pubKeyHash = require('./pubkeyhash')
|
||||
var scriptHash = require('./scripthash')
|
||||
var witnessPubKeyHash = require('./witnesspubkeyhash')
|
||||
var witnessScriptHash = require('./witnessscripthash')
|
||||
var witnessCommitment = require('./witnesscommitment')
|
||||
const decompile = require('../script').decompile
|
||||
const multisig = require('./multisig')
|
||||
const nullData = require('./nulldata')
|
||||
const pubKey = require('./pubkey')
|
||||
const pubKeyHash = require('./pubkeyhash')
|
||||
const scriptHash = require('./scripthash')
|
||||
const witnessPubKeyHash = require('./witnesspubkeyhash')
|
||||
const witnessScriptHash = require('./witnessscripthash')
|
||||
const witnessCommitment = require('./witnesscommitment')
|
||||
|
||||
var types = {
|
||||
const types = {
|
||||
MULTISIG: 'multisig',
|
||||
NONSTANDARD: 'nonstandard',
|
||||
NULLDATA: 'nulldata',
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// OP_0 [signatures ...]
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var bscript = require('../../script')
|
||||
var p2mso = require('./output')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bscript = require('../../script')
|
||||
const p2mso = require('./output')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function partialSignature (value) {
|
||||
return value === OPS.OP_0 || bscript.isCanonicalScriptSignature(value)
|
||||
|
@ -23,7 +23,7 @@ function check (script, allowIncomplete) {
|
|||
}
|
||||
check.toJSON = function () { return 'multisig input' }
|
||||
|
||||
var EMPTY_BUFFER = Buffer.allocUnsafe(0)
|
||||
const EMPTY_BUFFER = Buffer.allocUnsafe(0)
|
||||
|
||||
function encodeStack (signatures, scriptPubKey) {
|
||||
typeforce([partialSignature], signatures)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// m [pubKeys ...] n OP_CHECKMULTISIG
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
const OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1
|
||||
|
||||
function check (script, allowIncomplete) {
|
||||
var chunks = bscript.decompile(script)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// OP_RETURN {data}
|
||||
|
||||
var bscript = require('../script')
|
||||
var types = require('../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../script')
|
||||
const types = require('../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// {signature}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var typeforce = require('typeforce')
|
||||
const bscript = require('../../script')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
function check (script) {
|
||||
var chunks = bscript.decompile(script)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// {pubKey} OP_CHECKSIG
|
||||
|
||||
var bscript = require('../../script')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../../script')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var chunks = bscript.decompile(script)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// {signature} {pubKey}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var typeforce = require('typeforce')
|
||||
const bscript = require('../../script')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
function check (script) {
|
||||
var chunks = bscript.decompile(script)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// <scriptSig> {serialized scriptPubKey script}
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var bscript = require('../../script')
|
||||
var typeforce = require('typeforce')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bscript = require('../../script')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
var p2ms = require('../multisig/')
|
||||
var p2pk = require('../pubkey/')
|
||||
var p2pkh = require('../pubkeyhash/')
|
||||
var p2wpkho = require('../witnesspubkeyhash/output')
|
||||
var p2wsho = require('../witnessscripthash/output')
|
||||
const p2ms = require('../multisig/')
|
||||
const p2pk = require('../pubkey/')
|
||||
const p2pkh = require('../pubkeyhash/')
|
||||
const p2wpkho = require('../witnesspubkeyhash/output')
|
||||
const p2wsho = require('../witnessscripthash/output')
|
||||
|
||||
function check (script, allowIncomplete) {
|
||||
var chunks = bscript.decompile(script)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// OP_HASH160 {scriptHash} OP_EQUAL
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// OP_RETURN {aa21a9ed} {commitment}
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
var HEADER = Buffer.from('aa21a9ed', 'hex')
|
||||
const HEADER = Buffer.from('aa21a9ed', 'hex')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// {signature} {pubKey}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var typeforce = require('typeforce')
|
||||
const bscript = require('../../script')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
function isCompressedCanonicalPubKey (pubKey) {
|
||||
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// OP_0 {pubKeyHash}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// <scriptSig> {serialized scriptPubKey script}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
var p2ms = require('../multisig/')
|
||||
var p2pk = require('../pubkey/')
|
||||
var p2pkh = require('../pubkeyhash/')
|
||||
const p2ms = require('../multisig/')
|
||||
const p2pk = require('../pubkey/')
|
||||
const p2pkh = require('../pubkeyhash/')
|
||||
|
||||
function check (chunks, allowIncomplete) {
|
||||
typeforce(types.Array, chunks)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// OP_0 {scriptHash}
|
||||
|
||||
var bscript = require('../../script')
|
||||
var types = require('../../types')
|
||||
var typeforce = require('typeforce')
|
||||
var OPS = require('bitcoin-ops')
|
||||
const bscript = require('../../script')
|
||||
const types = require('../../types')
|
||||
const typeforce = require('typeforce')
|
||||
const OPS = require('bitcoin-ops')
|
||||
|
||||
function check (script) {
|
||||
var buffer = bscript.compile(script)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var bcrypto = require('./crypto')
|
||||
var bscript = require('./script')
|
||||
var bufferutils = require('./bufferutils')
|
||||
var opcodes = require('bitcoin-ops')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
var varuint = require('varuint-bitcoin')
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const bcrypto = require('./crypto')
|
||||
const bscript = require('./script')
|
||||
const bufferutils = require('./bufferutils')
|
||||
const opcodes = require('bitcoin-ops')
|
||||
const typeforce = require('typeforce')
|
||||
const types = require('./types')
|
||||
const varuint = require('varuint-bitcoin')
|
||||
|
||||
function varSliceSize (someScript) {
|
||||
var length = someScript.length
|
||||
|
@ -36,12 +36,12 @@ Transaction.SIGHASH_ANYONECANPAY = 0x80
|
|||
Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
|
||||
Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
|
||||
|
||||
var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
|
||||
var EMPTY_WITNESS = []
|
||||
var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
|
||||
var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
|
||||
var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
|
||||
var BLANK_OUTPUT = {
|
||||
const EMPTY_SCRIPT = Buffer.allocUnsafe(0)
|
||||
const EMPTY_WITNESS = []
|
||||
const ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
|
||||
const ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
|
||||
const VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
|
||||
const BLANK_OUTPUT = {
|
||||
script: EMPTY_SCRIPT,
|
||||
valueBuffer: VALUE_UINT64_MAX
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var baddress = require('./address')
|
||||
var bcrypto = require('./crypto')
|
||||
var bscript = require('./script')
|
||||
var btemplates = require('./templates')
|
||||
var networks = require('./networks')
|
||||
var ops = require('bitcoin-ops')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
var scriptTypes = btemplates.types
|
||||
var SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
|
||||
var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const baddress = require('./address')
|
||||
const bcrypto = require('./crypto')
|
||||
const bscript = require('./script')
|
||||
const btemplates = require('./templates')
|
||||
const networks = require('./networks')
|
||||
const ops = require('bitcoin-ops')
|
||||
const typeforce = require('typeforce')
|
||||
const types = require('./types')
|
||||
const scriptTypes = btemplates.types
|
||||
const SIGNABLE = [btemplates.types.P2PKH, btemplates.types.P2PK, btemplates.types.MULTISIG]
|
||||
const P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH])
|
||||
|
||||
var ECPair = require('./ecpair')
|
||||
var Transaction = require('./transaction')
|
||||
const ECPair = require('./ecpair')
|
||||
const Transaction = require('./transaction')
|
||||
|
||||
function supportedType (type) {
|
||||
return SIGNABLE.indexOf(type) !== -1
|
||||
|
|
12
src/types.js
12
src/types.js
|
@ -1,6 +1,6 @@
|
|||
var typeforce = require('typeforce')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
var UINT31_MAX = Math.pow(2, 31) - 1
|
||||
const UINT31_MAX = Math.pow(2, 31) - 1
|
||||
function UInt31 (value) {
|
||||
return typeforce.UInt32(value) && value <= UINT31_MAX
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ function BIP32Path (value) {
|
|||
}
|
||||
BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
|
||||
|
||||
var SATOSHI_MAX = 21 * 1e14
|
||||
const SATOSHI_MAX = 21 * 1e14
|
||||
function Satoshi (value) {
|
||||
return typeforce.UInt53(value) && value <= SATOSHI_MAX
|
||||
}
|
||||
|
||||
// external dependent types
|
||||
var ECPoint = typeforce.quacksLike('Point')
|
||||
const ECPoint = typeforce.quacksLike('Point')
|
||||
|
||||
// exposed, external API
|
||||
var Network = typeforce.compile({
|
||||
const Network = typeforce.compile({
|
||||
messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
|
||||
bip32: {
|
||||
public: typeforce.UInt32,
|
||||
|
@ -31,7 +31,7 @@ var Network = typeforce.compile({
|
|||
})
|
||||
|
||||
// extend typeforce types with ours
|
||||
var types = {
|
||||
const types = {
|
||||
BIP32Path: BIP32Path,
|
||||
Buffer256bit: typeforce.BufferN(32),
|
||||
ECPoint: ECPoint,
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var base58 = require('bs58')
|
||||
var bitcoin = require('../')
|
||||
const assert = require('assert')
|
||||
const base58 = require('bs58')
|
||||
const bitcoin = require('../')
|
||||
|
||||
var base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json')
|
||||
var base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json')
|
||||
var base58KeysValid = require('./fixtures/core/base58_keys_valid.json')
|
||||
var blocksValid = require('./fixtures/core/blocks.json')
|
||||
var sigCanonical = require('./fixtures/core/sig_canonical.json')
|
||||
var sigHash = require('./fixtures/core/sighash.json')
|
||||
var sigNoncanonical = require('./fixtures/core/sig_noncanonical.json')
|
||||
var txValid = require('./fixtures/core/tx_valid.json')
|
||||
const base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json')
|
||||
const base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json')
|
||||
const base58KeysValid = require('./fixtures/core/base58_keys_valid.json')
|
||||
const blocksValid = require('./fixtures/core/blocks.json')
|
||||
const sigCanonical = require('./fixtures/core/sig_canonical.json')
|
||||
const sigHash = require('./fixtures/core/sighash.json')
|
||||
const sigNoncanonical = require('./fixtures/core/sig_noncanonical.json')
|
||||
const txValid = require('./fixtures/core/tx_valid.json')
|
||||
|
||||
describe('Bitcoin-core', function () {
|
||||
// base58EncodeDecode
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* global describe, it, beforeEach */
|
||||
|
||||
var assert = require('assert')
|
||||
var Block = require('../src/block')
|
||||
const assert = require('assert')
|
||||
const Block = require('../src/block')
|
||||
|
||||
var fixtures = require('./fixtures/block')
|
||||
const fixtures = require('./fixtures/block')
|
||||
|
||||
describe('Block', function () {
|
||||
describe('version', function () {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bufferutils = require('../src/bufferutils')
|
||||
const assert = require('assert')
|
||||
const bufferutils = require('../src/bufferutils')
|
||||
|
||||
var fixtures = require('./fixtures/bufferutils.json')
|
||||
const fixtures = require('./fixtures/bufferutils.json')
|
||||
|
||||
describe('bufferutils', function () {
|
||||
describe('readUInt64LE', function () {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bcrypto = require('../src/crypto')
|
||||
const assert = require('assert')
|
||||
const bcrypto = require('../src/crypto')
|
||||
|
||||
var fixtures = require('./fixtures/crypto')
|
||||
const fixtures = require('./fixtures/crypto')
|
||||
|
||||
describe('crypto', function () {
|
||||
['hash160', 'hash256', 'ripemd160', 'sha1', 'sha256'].forEach(function (algorithm) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
var assert = require('assert')
|
||||
var bitcoin = require('../../')
|
||||
var dhttp = require('dhttp/200')
|
||||
const assert = require('assert')
|
||||
const bitcoin = require('../../')
|
||||
const dhttp = require('dhttp/200')
|
||||
|
||||
var APIPASS = process.env.APIPASS || 'satoshi'
|
||||
var APIURL = 'https://api.dcousens.cloud/1'
|
||||
const APIPASS = process.env.APIPASS || 'satoshi'
|
||||
const APIURL = 'https://api.dcousens.cloud/1'
|
||||
|
||||
function broadcast (txHex, callback) {
|
||||
dhttp({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* global describe, it */
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var bitcoin = require('../../')
|
||||
const assert = require('assert')
|
||||
const bitcoin = require('../../')
|
||||
|
||||
describe('bitcoinjs-lib (blocks)', function () {
|
||||
it('can extract a height from a CoinBase transaction', function () {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* global describe, it, before */
|
||||
|
||||
var assert = require('assert')
|
||||
var bitcoin = require('../../')
|
||||
var regtestUtils = require('./_regtest')
|
||||
var regtest = regtestUtils.network
|
||||
var bip65 = require('bip65')
|
||||
const assert = require('assert')
|
||||
const bitcoin = require('../../')
|
||||
const regtestUtils = require('./_regtest')
|
||||
const regtest = regtestUtils.network
|
||||
const bip65 = require('bip65')
|
||||
|
||||
var alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest)
|
||||
var bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
|
||||
const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest)
|
||||
const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
|
||||
|
||||
describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
|
||||
// force update MTP
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bigi = require('bigi')
|
||||
var bitcoin = require('../../')
|
||||
var bip32 = require('bip32')
|
||||
var crypto = require('crypto')
|
||||
var tinysecp = require('tiny-secp256k1')
|
||||
const assert = require('assert')
|
||||
const bigi = require('bigi')
|
||||
const bitcoin = require('../../')
|
||||
const bip32 = require('bip32')
|
||||
const crypto = require('crypto')
|
||||
const tinysecp = require('tiny-secp256k1')
|
||||
|
||||
var ecurve = require('ecurve')
|
||||
var secp256k1 = ecurve.getCurveByName('secp256k1')
|
||||
const ecurve = require('ecurve')
|
||||
const secp256k1 = ecurve.getCurveByName('secp256k1')
|
||||
|
||||
describe('bitcoinjs-lib (crypto)', function () {
|
||||
it('can recover a private key from duplicate R values', function () {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bscript = require('../src/script')
|
||||
var minimalData = require('minimaldata')
|
||||
const assert = require('assert')
|
||||
const bscript = require('../src/script')
|
||||
const minimalData = require('minimaldata')
|
||||
|
||||
var fixtures = require('./fixtures/script.json')
|
||||
var fixtures2 = require('./fixtures/templates.json')
|
||||
const fixtures = require('./fixtures/script.json')
|
||||
const fixtures2 = require('./fixtures/templates.json')
|
||||
|
||||
describe('script', function () {
|
||||
// TODO
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var scriptNumber = require('../src/script_number')
|
||||
var fixtures = require('./fixtures/script_number.json')
|
||||
const assert = require('assert')
|
||||
const scriptNumber = require('../src/script_number')
|
||||
const fixtures = require('./fixtures/script_number.json')
|
||||
|
||||
describe('script-number', function () {
|
||||
describe('decode', function () {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bscriptSig = require('../src/script').signature
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var fixtures = require('./fixtures/signature.json')
|
||||
const assert = require('assert')
|
||||
const bscriptSig = require('../src/script').signature
|
||||
const Buffer = require('safe-buffer').Buffer
|
||||
const fixtures = require('./fixtures/signature.json')
|
||||
|
||||
describe('Script Signatures', function () {
|
||||
function fromRaw (signature) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var bcrypto = require('../src/crypto')
|
||||
var bscript = require('../src/script')
|
||||
var btemplates = require('../src/templates')
|
||||
var ops = require('bitcoin-ops')
|
||||
const assert = require('assert')
|
||||
const bcrypto = require('../src/crypto')
|
||||
const bscript = require('../src/script')
|
||||
const btemplates = require('../src/templates')
|
||||
const ops = require('bitcoin-ops')
|
||||
|
||||
var fixtures = require('./fixtures/templates.json')
|
||||
const fixtures = require('./fixtures/templates.json')
|
||||
|
||||
function fromHex (x) { return Buffer.from(x, 'hex') }
|
||||
function toHex (x) { return x.toString('hex') }
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* global describe, it, beforeEach */
|
||||
|
||||
var assert = require('assert')
|
||||
var bscript = require('../src/script')
|
||||
var fixtures = require('./fixtures/transaction')
|
||||
var Transaction = require('../src/transaction')
|
||||
const assert = require('assert')
|
||||
const bscript = require('../src/script')
|
||||
const fixtures = require('./fixtures/transaction')
|
||||
const Transaction = require('../src/transaction')
|
||||
|
||||
describe('Transaction', function () {
|
||||
function fromRaw (raw, noWitness) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var types = require('../src/types')
|
||||
var typeforce = require('typeforce')
|
||||
const assert = require('assert')
|
||||
const types = require('../src/types')
|
||||
const typeforce = require('typeforce')
|
||||
|
||||
describe('types', function () {
|
||||
describe('Buffer Hash160/Hash256', function () {
|
||||
|
|
Loading…
Reference in a new issue