diff --git a/README.md b/README.md index 00b5816..6f46004 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,14 @@ The below examples are implemented as integration tests, they should be very eas Otherwise, pull requests are appreciated. Some examples interact (via HTTPS) with a 3rd Party Blockchain Provider (3PBP). +### Warning: Currently the tests use TransactionBuilder, which will be removed in the future (v6.x.x or higher) +We will move towards replacing all instances of TransactionBuilder in the tests with the new Psbt. + +Currently we have a few examples on how to use the newer Psbt class at the following link: +- [Psbt examples](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/transactions-psbt.js) + +The rest of the examples are below (using TransactionBuilder for Transaction creation) + - [Generate a random address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js) - [Import an address via WIF](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js) - [Generate a 2-of-3 P2SH multisig address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index e63bdd0..a13c481 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -57,6 +57,13 @@ class TransactionBuilder { this.__TX = new transaction_1.Transaction(); this.__TX.version = 2; this.__USE_LOW_R = false; + console.warn( + 'Deprecation Warning: TransactionBuilder will be removed in the future. ' + + '(v6.x.x or later) Please use the Psbt class instead. Examples of usage ' + + 'are available in the transactions-psbt.js integration test file on our ' + + 'Github. A high level explanation is available in the psbt.ts and psbt.js ' + + 'files as well.', + ); } static fromTransaction(transaction, network) { const txb = new TransactionBuilder(network); diff --git a/test/integration/cltv.js b/test/integration/cltv.js index b2fd478..e123652 100644 --- a/test/integration/cltv.js +++ b/test/integration/cltv.js @@ -7,6 +7,7 @@ const bip65 = require('bip65') const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest) const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest) +console.warn = () => {} // Silence the Deprecation Warning describe('bitcoinjs-lib (transactions w/ CLTV)', () => { // force update MTP diff --git a/test/integration/csv.js b/test/integration/csv.js index f213c6c..2e133f0 100644 --- a/test/integration/csv.js +++ b/test/integration/csv.js @@ -9,6 +9,7 @@ const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGk const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest) const charles = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsMSb4Ubnf', regtest) const dave = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsMwS4pqnx', regtest) +console.warn = () => {} // Silence the Deprecation Warning describe('bitcoinjs-lib (transactions w/ CSV)', () => { // force update MTP diff --git a/test/integration/payments.js b/test/integration/payments.js index 256bd00..905eda8 100644 --- a/test/integration/payments.js +++ b/test/integration/payments.js @@ -7,6 +7,7 @@ const keyPairs = [ bitcoin.ECPair.makeRandom({ network: NETWORK }), bitcoin.ECPair.makeRandom({ network: NETWORK }) ] +console.warn = () => {} // Silence the Deprecation Warning async function buildAndSign (depends, prevOutput, redeemScript, witnessScript) { const unspent = await regtestUtils.faucetComplex(prevOutput, 5e4) diff --git a/test/integration/transactions.js b/test/integration/transactions.js index 464460e..a75b6f2 100644 --- a/test/integration/transactions.js +++ b/test/integration/transactions.js @@ -3,6 +3,7 @@ const assert = require('assert') const bitcoin = require('../../') const regtestUtils = require('./_regtest') const regtest = regtestUtils.network +console.warn = () => {} // Silence the Deprecation Warning function rng () { return Buffer.from('YT8dAtK4d16A3P1z+TpwB2jJ4aFH3g9M1EioIBkLEV4=', 'base64') diff --git a/test/transaction_builder.js b/test/transaction_builder.js index a135cca..6374161 100644 --- a/test/transaction_builder.js +++ b/test/transaction_builder.js @@ -9,6 +9,8 @@ const Transaction = require('..').Transaction const TransactionBuilder = require('..').TransactionBuilder const NETWORKS = require('../src/networks') +console.warn = () => {} // Silence the Deprecation Warning + const fixtures = require('./fixtures/transaction_builder') function constructSign (f, txb, useOldSignArgs) { diff --git a/ts_src/transaction_builder.ts b/ts_src/transaction_builder.ts index c486285..1edf0f2 100644 --- a/ts_src/transaction_builder.ts +++ b/ts_src/transaction_builder.ts @@ -146,6 +146,13 @@ export class TransactionBuilder { this.__TX = new Transaction(); this.__TX.version = 2; this.__USE_LOW_R = false; + console.warn( + 'Deprecation Warning: TransactionBuilder will be removed in the future. ' + + '(v6.x.x or later) Please use the Psbt class instead. Examples of usage ' + + 'are available in the transactions-psbt.js integration test file on our ' + + 'Github. A high level explanation is available in the psbt.ts and psbt.js ' + + 'files as well.', + ); } setLowR(setting?: boolean): boolean {