File tree Expand file tree Collapse file tree 4 files changed +23
-36
lines changed
packages/wasm-utxo/test/fixedScript Expand file tree Collapse file tree 4 files changed +23
-36
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,10 @@ import {
77 getExtractedTransactionHex ,
88 type Fixture ,
99} from "./fixtureUtil.js" ;
10+ import { getFixtureNetworks } from "./networkSupport.util.js" ;
1011
1112describe ( "finalize and extract transaction" , function ( ) {
12- const supportedNetworks = utxolib . getNetworkList ( ) . filter ( ( network ) => {
13- return (
14- utxolib . isMainnet ( network ) &&
15- network !== utxolib . networks . bitcoincash &&
16- network !== utxolib . networks . bitcoingold &&
17- network !== utxolib . networks . bitcoinsv &&
18- network !== utxolib . networks . ecash &&
19- network !== utxolib . networks . zcash
20- ) ;
21- } ) ;
22-
23- supportedNetworks . forEach ( ( network ) => {
13+ getFixtureNetworks ( ) . forEach ( ( network ) => {
2414 const networkName = utxolib . getNetworkName ( network ) ;
2515
2616 describe ( `network: ${ networkName } ` , function ( ) {
Original file line number Diff line number Diff line change 1+ import * as utxolib from "@bitgo/utxo-lib" ;
2+
3+ /**
4+ * Get networks that have psbt fixtures
5+ */
6+ export function getFixtureNetworks ( ) : utxolib . Network [ ] {
7+ return utxolib . getNetworkList ( ) . filter ( ( network ) => {
8+ return (
9+ // we only have fixtures for mainnet networks
10+ utxolib . isMainnet ( network ) &&
11+ // we don't have fixtures for bitcoinsv since it is not really supported any longer
12+ network !== utxolib . networks . bitcoinsv &&
13+ // we do have zcash fixtures but it is not fully implemented yet
14+ network !== utxolib . networks . zcash
15+ ) ;
16+ } ) ;
17+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 loadReplayProtectionKeyFromFixture ,
1212 type Fixture ,
1313} from "./fixtureUtil.js" ;
14+ import { getFixtureNetworks } from "./networkSupport.util.js" ;
1415
1516function getExpectedInputScriptType ( fixtureScriptType : string ) : InputScriptType {
1617 // Map fixture types to InputScriptType values
@@ -38,18 +39,7 @@ function getOtherWalletKeys(): utxolib.bitgo.RootWalletKeys {
3839}
3940
4041describe ( "parseTransactionWithWalletKeys" , function ( ) {
41- const supportedNetworks = utxolib . getNetworkList ( ) . filter ( ( network ) => {
42- return (
43- utxolib . isMainnet ( network ) &&
44- network !== utxolib . networks . bitcoincash &&
45- network !== utxolib . networks . bitcoingold &&
46- network !== utxolib . networks . bitcoinsv &&
47- network !== utxolib . networks . ecash &&
48- network !== utxolib . networks . zcash
49- ) ;
50- } ) ;
51-
52- supportedNetworks . forEach ( ( network ) => {
42+ getFixtureNetworks ( ) . forEach ( ( network ) => {
5343 const networkName = utxolib . getNetworkName ( network ) ;
5444
5545 describe ( `network: ${ networkName } ` , function ( ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 type Fixture ,
1515 loadReplayProtectionKeyFromFixture ,
1616} from "./fixtureUtil.js" ;
17+ import { getFixtureNetworks } from "./networkSupport.util.js" ;
1718
1819type SignatureStage = "unsigned" | "halfsigned" | "fullsigned" ;
1920
@@ -279,18 +280,7 @@ function runTestsForFixture(
279280}
280281
281282describe ( "verifySignature" , function ( ) {
282- const supportedNetworks = utxolib . getNetworkList ( ) . filter ( ( network ) => {
283- return (
284- utxolib . isMainnet ( network ) &&
285- network !== utxolib . networks . bitcoincash &&
286- network !== utxolib . networks . bitcoingold &&
287- network !== utxolib . networks . bitcoinsv &&
288- network !== utxolib . networks . ecash &&
289- network !== utxolib . networks . zcash
290- ) ;
291- } ) ;
292-
293- supportedNetworks . forEach ( ( network ) => {
283+ getFixtureNetworks ( ) . forEach ( ( network ) => {
294284 const networkName = utxolib . getNetworkName ( network ) ;
295285
296286 describe ( `network: ${ networkName } ` , function ( ) {
You can’t perform that action at this time.
0 commit comments