File tree Expand file tree Collapse file tree
test/unit/bitgo/utils/tss Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,9 +96,15 @@ export class Flrp extends BaseCoin {
9696 const explainedTx = tx . explainTransaction ( ) ;
9797
9898 const type = params . txParams . type ;
99- // 'stake' is the intent-type alias for AddPermissionlessDelegator; normalize it
100- // so the TransactionType enum lookup succeeds.
101- const normalizedType = type === 'stake' ? 'AddPermissionlessDelegator' : type ;
99+ // WP intentType aliases (lowercase) must map to TransactionType enum keys.
100+ const normalizedType =
101+ type === 'stake'
102+ ? 'AddPermissionlessDelegator'
103+ : type === 'import'
104+ ? 'Import'
105+ : type === 'importtoc'
106+ ? 'ImportToC'
107+ : type ;
102108
103109 // When type is provided, verify it matches the parsed transaction.
104110 // When type is not provided (MPC/TSS intent flow where buildParams are unavailable),
Original file line number Diff line number Diff line change @@ -940,6 +940,19 @@ describe('Flrp test cases', function () {
940940 isVerified . should . equal ( true ) ;
941941 } ) ;
942942
943+ it ( 'should verify MPC ImportInP transaction when txParams.type is the "import" intent alias' , async ( ) => {
944+ const txHex = await buildUnsignedImportInP ( ) ;
945+ const txPrebuild = { txHex, txInfo : { } } ;
946+ const txParams = {
947+ recipients : [ ] ,
948+ type : 'import' ,
949+ locktime : 0 ,
950+ } ;
951+
952+ const isVerified = await basecoin . verifyTransaction ( { txParams, txPrebuild } ) ;
953+ isVerified . should . equal ( true ) ;
954+ } ) ;
955+
943956 it ( 'should verify MPC ExportInP transaction' , async ( ) => {
944957 const txHex = await buildUnsignedExportInP ( ) ;
945958 const txPrebuild = { txHex, txInfo : { } } ;
Original file line number Diff line number Diff line change @@ -117,7 +117,16 @@ export function resolveEffectiveTxParams(
117117 // Use its presence as a generic staking signal — no need to enumerate every intentType.
118118 const isStakingIntent = ! ! ( txRequest . intent as PopulatedIntent ) ?. stakingRequestId ;
119119
120- if ( ! effectiveTxParams . recipients ?. length && ! isStakingIntent && ! NO_RECIPIENT_TX_TYPES . has ( txType ) ) {
120+ // buildParams.type from the wallet UI is PascalCase ('Import'); intent.intentType from WP
121+ // is lowercase ('import'). Either may be the source of truth depending on the signing path.
122+ const intentType = ( txRequest . intent as PopulatedIntent ) ?. intentType ?? '' ;
123+
124+ if (
125+ ! effectiveTxParams . recipients ?. length &&
126+ ! isStakingIntent &&
127+ ! NO_RECIPIENT_TX_TYPES . has ( txType ) &&
128+ ! NO_RECIPIENT_TX_TYPES . has ( intentType )
129+ ) {
121130 throw new InvalidTransactionError (
122131 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.'
123132 ) ;
Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ describe('recipientUtils', function () {
126126 }
127127 } ) ;
128128
129+ it ( 'does not throw when buildParams.type is PascalCase but intent.intentType is lowercase' , function ( ) {
130+ // signTransactionTss passes txPrebuild.buildParams as txParams. Prebuild uses
131+ // type: 'Import' while WP stores intentType: 'import' on the txRequest.
132+ const txRequest = makeTxRequest ( { intent : { intentType : 'import' , recipients : [ ] } as any } ) ;
133+ assert . doesNotThrow ( ( ) => resolveEffectiveTxParams ( txRequest , { type : 'Import' , recipients : [ ] } ) ) ;
134+ } ) ;
135+
129136 it ( 'throws InvalidTransactionError for unknown types with no recipients' , function ( ) {
130137 const txRequest = makeTxRequest ( ) ;
131138 assert . throws (
You can’t perform that action at this time.
0 commit comments