diff --git a/test/fixtures/psbt.json b/test/fixtures/psbt.json index 7242b03..00877f9 100644 --- a/test/fixtures/psbt.json +++ b/test/fixtures/psbt.json @@ -391,5 +391,11 @@ } } ] - } + }, + "fromTransaction": [ + { + "transaction": "020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000", + "result": "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAAAAAA=" + } + ] } diff --git a/test/psbt.js b/test/psbt.js index 5d59a88..290c5e5 100644 --- a/test/psbt.js +++ b/test/psbt.js @@ -169,4 +169,13 @@ describe(`Psbt`, () => { }) }) }) + + describe('fromTransaction', () => { + fixtures.fromTransaction.forEach(f => { + it('Creates the expected PSBT from a transaction buffer', () => { + const psbt = Psbt.fromTransaction(Buffer.from(f.transaction, 'hex')) + assert.strictEqual(psbt.toBase64(), f.result) + }) + }) + }) })