File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
modules/utxo-core/test/bip322 Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 1+ import { payments , ECPair } from '@bitgo/utxo-lib' ;
2+
3+ export const BIP322_WIF_FIXTURE = 'L3VFeEujGtevx9w18HD1fhRbCH67Az2dpCymeRE1SoPK6XQtaN2k' ;
4+ export const BIP322_PRV_FIXTURE = ECPair . fromWIF ( BIP322_WIF_FIXTURE ) ;
5+ export const BIP322_PAYMENT_P2WPKH_FIXTURE = payments . p2wpkh ( {
6+ address : 'bc1q9vza2e8x573nczrlzms0wvx3gsqjx7vavgkx0l' ,
7+ } ) ;
Original file line number Diff line number Diff line change 11import assert from 'assert' ;
22
3- import { payments , ECPair , Transaction } from '@bitgo/utxo-lib' ;
3+ import { Transaction } from '@bitgo/utxo-lib' ;
44
55import * as bip322 from '../../src/bip322' ;
66
7+ import { BIP322_PAYMENT_P2WPKH_FIXTURE , BIP322_PRV_FIXTURE as prv } from './bip322.utils' ;
78describe ( 'BIP322 toSign' , function ( ) {
89 describe ( 'buildToSignPsbt' , function ( ) {
9- const WIF = 'L3VFeEujGtevx9w18HD1fhRbCH67Az2dpCymeRE1SoPK6XQtaN2k' ;
10- const prv = ECPair . fromWIF ( WIF ) ;
11- const scriptPubKey = payments . p2wpkh ( {
12- address : 'bc1q9vza2e8x573nczrlzms0wvx3gsqjx7vavgkx0l' ,
13- } ) . output as Buffer ;
14-
10+ const scriptPubKey = BIP322_PAYMENT_P2WPKH_FIXTURE . output as Buffer ;
1511 // Source: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki#transaction-hashes
1612 const fixtures = [
1713 {
Original file line number Diff line number Diff line change 11import assert from 'assert' ;
22
3- import { payments } from '@bitgo/utxo-lib' ;
4-
53import { buildToSpendTransaction , hashMessageWithTag } from '../../src/bip322' ;
64
5+ import { BIP322_PAYMENT_P2WPKH_FIXTURE } from './bip322.utils' ;
6+
77describe ( 'to_spend' , function ( ) {
88 describe ( 'Message hashing' , function ( ) {
99 // Test vectors from BIP322
@@ -31,9 +31,7 @@ describe('to_spend', function () {
3131 } ) ;
3232
3333 describe ( 'build to_spend transaction' , function ( ) {
34- const scriptPubKey = payments . p2wpkh ( {
35- address : 'bc1q9vza2e8x573nczrlzms0wvx3gsqjx7vavgkx0l' ,
36- } ) . output as Buffer ;
34+ const scriptPubKey = BIP322_PAYMENT_P2WPKH_FIXTURE . output as Buffer ;
3735
3836 // Source: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki#transaction-hashes
3937 const fixtures = [
You can’t perform that action at this time.
0 commit comments