Skip to content

Commit d05806f

Browse files
committed
Update README, add deprecation warning
1 parent e19bc58 commit d05806f

File tree

8 files changed

+28
-0
lines changed

8 files changed

+28
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ The below examples are implemented as integration tests, they should be very eas
8585
Otherwise, pull requests are appreciated.
8686
Some examples interact (via HTTPS) with a 3rd Party Blockchain Provider (3PBP).
8787

88+
### Warning: Currently the tests use TransactionBuilder, which will be removed in the future (v6.x.x or higher)
89+
We will move towards replacing all instances of TransactionBuilder in the tests with the new Psbt.
90+
91+
Currently we have a few examples on how to use the newer Psbt class at the following link:
92+
- [Psbt examples](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/transactions-psbt.js)
93+
94+
The rest of the examples are below (using TransactionBuilder for Transaction creation)
95+
8896
- [Generate a random address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js)
8997
- [Import an address via WIF](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js)
9098
- [Generate a 2-of-3 P2SH multisig address](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js)

src/transaction_builder.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ class TransactionBuilder {
5757
this.__TX = new transaction_1.Transaction();
5858
this.__TX.version = 2;
5959
this.__USE_LOW_R = false;
60+
console.warn(
61+
'Deprecation Warning: TransactionBuilder will be removed in the future. ' +
62+
'(v6.x.x or later) Please use the Psbt class instead. Examples of usage ' +
63+
'are available in the transactions-psbt.js integration test file on our ' +
64+
'Github. A high level explanation is available in the psbt.ts and psbt.js ' +
65+
'files as well.',
66+
);
6067
}
6168
static fromTransaction(transaction, network) {
6269
const txb = new TransactionBuilder(network);

test/integration/cltv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const bip65 = require('bip65')
77

88
const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest)
99
const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
10+
console.warn = () => {} // Silence the Deprecation Warning
1011

1112
describe('bitcoinjs-lib (transactions w/ CLTV)', () => {
1213
// force update MTP

test/integration/csv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGk
99
const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest)
1010
const charles = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsMSb4Ubnf', regtest)
1111
const dave = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsMwS4pqnx', regtest)
12+
console.warn = () => {} // Silence the Deprecation Warning
1213

1314
describe('bitcoinjs-lib (transactions w/ CSV)', () => {
1415
// force update MTP

test/integration/payments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const keyPairs = [
77
bitcoin.ECPair.makeRandom({ network: NETWORK }),
88
bitcoin.ECPair.makeRandom({ network: NETWORK })
99
]
10+
console.warn = () => {} // Silence the Deprecation Warning
1011

1112
async function buildAndSign (depends, prevOutput, redeemScript, witnessScript) {
1213
const unspent = await regtestUtils.faucetComplex(prevOutput, 5e4)

test/integration/transactions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const assert = require('assert')
33
const bitcoin = require('../../')
44
const regtestUtils = require('./_regtest')
55
const regtest = regtestUtils.network
6+
console.warn = () => {} // Silence the Deprecation Warning
67

78
function rng () {
89
return Buffer.from('YT8dAtK4d16A3P1z+TpwB2jJ4aFH3g9M1EioIBkLEV4=', 'base64')

test/transaction_builder.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const Transaction = require('..').Transaction
99
const TransactionBuilder = require('..').TransactionBuilder
1010
const NETWORKS = require('../src/networks')
1111

12+
console.warn = () => {} // Silence the Deprecation Warning
13+
1214
const fixtures = require('./fixtures/transaction_builder')
1315

1416
function constructSign (f, txb, useOldSignArgs) {

ts_src/transaction_builder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ export class TransactionBuilder {
146146
this.__TX = new Transaction();
147147
this.__TX.version = 2;
148148
this.__USE_LOW_R = false;
149+
console.warn(
150+
'Deprecation Warning: TransactionBuilder will be removed in the future. ' +
151+
'(v6.x.x or later) Please use the Psbt class instead. Examples of usage ' +
152+
'are available in the transactions-psbt.js integration test file on our ' +
153+
'Github. A high level explanation is available in the psbt.ts and psbt.js ' +
154+
'files as well.',
155+
);
149156
}
150157

151158
setLowR(setting?: boolean): boolean {

0 commit comments

Comments
 (0)