Skip to content

Commit 1f4533d

Browse files
fix(sdk-core): exempt FLRP import from TSS recipient guard on PascalCase buildParams
signTransactionTss passes buildParams.type as 'Import' while WP stores intentType as 'import', so the WCN-151 recipient guard still threw after adding lowercase import to NO_RECIPIENT_TX_TYPES. Also check intentType when resolving the exemption. Co-authored-by: Cursor <cursoragent@cursor.com> TICKET: CECHO-1425
1 parent 068d9ec commit 1f4533d

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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
);

modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)