Browse Source

Update README, add deprecation warning

psbt
junderw 6 years ago
parent
commit
d05806fe69
No known key found for this signature in database GPG Key ID: B256185D3A971908
  1. 8
      README.md
  2. 7
      src/transaction_builder.js
  3. 1
      test/integration/cltv.js
  4. 1
      test/integration/csv.js
  5. 1
      test/integration/payments.js
  6. 1
      test/integration/transactions.js
  7. 2
      test/transaction_builder.js
  8. 7
      ts_src/transaction_builder.ts

8
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)

7
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);

1
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

1
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

1
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)

1
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')

2
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) {

7
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 {

Loading…
Cancel
Save