|
|
@ -126,10 +126,6 @@ describe(`Psbt`, () => { |
|
|
|
it('Finalizes inputs and gives the expected PSBT', () => { |
|
|
|
const psbt = Psbt.fromBase64(f.psbt) |
|
|
|
|
|
|
|
assert.throws(() => { |
|
|
|
psbt.getFeeRate() |
|
|
|
}, new RegExp('PSBT must be finalized to calculate fee rate')) |
|
|
|
|
|
|
|
psbt.finalizeAllInputs() |
|
|
|
|
|
|
|
assert.strictEqual(psbt.toBase64(), f.result) |
|
|
@ -407,6 +403,23 @@ describe(`Psbt`, () => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe('getFeeRate', () => { |
|
|
|
it('Throws error if called before inputs are finalized', () => { |
|
|
|
const f = fixtures.getFeeRate |
|
|
|
const psbt = Psbt.fromBase64(f.psbt) |
|
|
|
|
|
|
|
assert.throws(() => { |
|
|
|
psbt.getFeeRate() |
|
|
|
}, new RegExp('PSBT must be finalized to calculate fee rate')) |
|
|
|
|
|
|
|
psbt.finalizeAllInputs() |
|
|
|
|
|
|
|
assert.doesNotThrow(() => { |
|
|
|
psbt.getFeeRate() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe('create 1-to-1 transaction', () => { |
|
|
|
const alice = ECPair.fromWIF('L2uPYXe17xSTqbCjZvL2DsyXPCbXspvcu5mHLDYUgzdUbZGSKrSr') |
|
|
|
const psbt = new Psbt() |
|
|
|