Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Update README, add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
junderw committed Jul 19, 2019
1 parent e19bc58 commit d05806f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/transaction_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions test/integration/cltv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/integration/csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/integration/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/integration/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions test/transaction_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions ts_src/transaction_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d05806f

Please sign in to comment.