@@ -4,7 +4,7 @@ import { randomBytes } from 'crypto';
44import _ from 'lodash' ;
55import * as utxolib from '@bitgo/utxo-lib' ;
66import { bip32 } from '@bitgo/secp256k1' ;
7- import { bitgo , getMainnet , isMainnet , isTestnet } from '@bitgo/utxo-lib' ;
7+ import { bitgo , getMainnet , isMainnet } from '@bitgo/utxo-lib' ;
88import {
99 AddressCoinSpecific ,
1010 BaseCoin ,
@@ -80,6 +80,7 @@ import {
8080 getFullNameFromCoinName ,
8181 getMainnetCoinName ,
8282 getNetworkFromCoinName ,
83+ isTestnetCoin ,
8384 UtxoCoinName ,
8485 UtxoCoinNameMainnet ,
8586} from './names' ;
@@ -387,7 +388,10 @@ export abstract class AbstractUtxoCoin
387388 this . amountType = amountType ;
388389 }
389390
390- /** @deprecated - will be removed when we drop support for utxolib */
391+ /**
392+ * @deprecated - will be removed when we drop support for utxolib
393+ * Use `name` property instead.
394+ */
391395 get network ( ) : utxolib . Network {
392396 return getNetworkFromCoinName ( this . name ) ;
393397 }
@@ -546,7 +550,7 @@ export abstract class AbstractUtxoCoin
546550 }
547551
548552 if ( utxolib . bitgo . isPsbt ( input ) ) {
549- return decodePsbtWith ( input , this . network , decodeWith ) ;
553+ return decodePsbtWith ( input , this . name , decodeWith ) ;
550554 } else {
551555 if ( decodeWith !== 'utxolib' ) {
552556 console . error ( 'received decodeWith hint %s, ignoring for legacy transaction' , decodeWith ) ;
@@ -688,7 +692,7 @@ export abstract class AbstractUtxoCoin
688692 throw new Error ( 'keychains must be a triple' ) ;
689693 }
690694 assertDescriptorWalletAddress (
691- this . network ,
695+ this . name ,
692696 params ,
693697 getDescriptorMapFromWallet ( wallet , toBip32Triple ( keychains ) , getPolicyForEnv ( this . bitgo . env ) )
694698 ) ;
@@ -705,7 +709,7 @@ export abstract class AbstractUtxoCoin
705709 throw new Error ( 'missing required param keychains' ) ;
706710 }
707711
708- assertFixedScriptWalletAddress ( this . network , {
712+ assertFixedScriptWalletAddress ( this . name , {
709713 address,
710714 keychains,
711715 format : params . format ?? 'base58' ,
@@ -763,9 +767,9 @@ export abstract class AbstractUtxoCoin
763767 . send ( { psbt : buffer . toString ( 'hex' ) } )
764768 . result ( ) ;
765769 if ( psbt instanceof utxolib . bitgo . UtxoPsbt ) {
766- return decodePsbtWith ( response . psbt , this . network , 'utxolib' ) as T ;
770+ return decodePsbtWith ( response . psbt , this . name , 'utxolib' ) as T ;
767771 } else {
768- return decodePsbtWith ( response . psbt , this . network , 'wasm-utxo' ) as T ;
772+ return decodePsbtWith ( response . psbt , this . name , 'wasm-utxo' ) as T ;
769773 }
770774 }
771775
@@ -862,7 +866,7 @@ export abstract class AbstractUtxoCoin
862866 * @returns {boolean }
863867 */
864868 isBitGoTaintedUnspent < TNumber extends number | bigint > ( unspent : Unspent < TNumber > ) : boolean {
865- return isReplayProtectionUnspent < TNumber > ( unspent , this . network ) ;
869+ return isReplayProtectionUnspent ( unspent , this . name ) ;
866870 }
867871
868872 /**
@@ -873,7 +877,7 @@ export abstract class AbstractUtxoCoin
873877 override async explainTransaction < TNumber extends number | bigint = number > (
874878 params : ExplainTransactionOptions < TNumber >
875879 ) : Promise < TransactionExplanation > {
876- return explainTx ( this . decodeTransactionFromPrebuild ( params ) , params , this . network ) ;
880+ return explainTx ( this . decodeTransactionFromPrebuild ( params ) , params , this . name ) ;
877881 }
878882
879883 /**
@@ -968,14 +972,14 @@ export abstract class AbstractUtxoCoin
968972 getDefaultTxFormat ( wallet : Wallet , requestedFormat ?: TxFormat ) : TxFormat | undefined {
969973 // If format is explicitly requested, use it
970974 if ( requestedFormat !== undefined ) {
971- if ( isTestnet ( this . network ) && requestedFormat === 'legacy' ) {
975+ if ( isTestnetCoin ( this . name ) && requestedFormat === 'legacy' ) {
972976 throw new ErrorDeprecatedTxFormat ( requestedFormat ) ;
973977 }
974978
975979 return requestedFormat ;
976980 }
977981
978- if ( isTestnet ( this . network ) ) {
982+ if ( isTestnetCoin ( this . name ) ) {
979983 return 'psbt-lite' ;
980984 }
981985
0 commit comments