@@ -73,6 +73,20 @@ export default class RequestSignTransactionBitcoin extends RequestBitcoin<string
7373 public readonly network : Exclude < Network , Network . DEVNET > ;
7474 private _inputType : AddressTypeBitcoin ;
7575
76+ public get requiredApp ( ) : string {
77+ // The new Bitcoin app does not allow custom input scripts (for example custom witness scripts) unless an
78+ // associated wallet policy had been registered. For this reason, we currently still require using the old api
79+ // if custom input scripts are set.
80+ if ( ! this . transaction . inputs . some ( ( { customScript } ) => ! ! customScript ) ) return super . requiredApp ;
81+ if ( this . _coinAppConnection && this . _coinAppConnection . app === super . requiredApp
82+ && ! RequestBitcoin . _isNewApiSupported ( this . _coinAppConnection . app , this . _coinAppConnection . appVersion ) ) {
83+ // We're already connected to an appropriate Bitcoin app on which we don't use the new api, e.g. a Bitcoin
84+ // app before 2.0. Thus, no need to specifically require the Legacy app variant.
85+ return super . requiredApp ;
86+ }
87+ return getLegacyApp ( super . requiredApp ) ; // require Legacy app variant
88+ }
89+
7690 constructor ( transaction : TransactionInfoBitcoin , expectedWalletId ?: string ) {
7791 super ( expectedWalletId ) ;
7892
@@ -145,20 +159,6 @@ export default class RequestSignTransactionBitcoin extends RequestBitcoin<string
145159 this . _loadBitcoinLibIfNeeded ( ) . catch ( ( ) => { } ) ;
146160 }
147161
148- public get requiredApp ( ) : string {
149- // The new Bitcoin app does not allow custom input scripts (for example custom witness scripts) unless an
150- // associated wallet policy had been registered. For this reason, we currently still require using the old api
151- // if custom input scripts are set.
152- if ( ! this . transaction . inputs . some ( ( { customScript } ) => ! ! customScript ) ) return super . requiredApp ;
153- if ( this . _coinAppConnection && this . _coinAppConnection . app === super . requiredApp
154- && ! RequestBitcoin . _isNewApiSupported ( this . _coinAppConnection . app , this . _coinAppConnection . appVersion ) ) {
155- // We're already connected to an appropriate Bitcoin app on which we don't use the new api, e.g. a Bitcoin
156- // app before 2.0. Thus, no need to specifically require the Legacy app variant.
157- return super . requiredApp ;
158- }
159- return getLegacyApp ( super . requiredApp ) ; // require Legacy app variant
160- }
161-
162162 public async call ( transport : Transport ) : Promise < string > {
163163 // Resources:
164164 // - to learn more about scripts and how input and output script relate to each other:
0 commit comments