diff --git a/modules/sdk-coin-flrp/src/flrp.ts b/modules/sdk-coin-flrp/src/flrp.ts index 3f5ad08638..4fc79fc75f 100644 --- a/modules/sdk-coin-flrp/src/flrp.ts +++ b/modules/sdk-coin-flrp/src/flrp.ts @@ -92,8 +92,11 @@ export class Flrp extends BaseCoin { const explainedTx = tx.explainTransaction(); const type = params.txParams.type; + // 'stake' is the intent-type alias for AddPermissionlessDelegator; normalize it + // so the TransactionType enum lookup succeeds. + const normalizedType = type === 'stake' ? 'AddPermissionlessDelegator' : type; - if (!type || (type !== 'ImportToC' && explainedTx.type !== TransactionType[type])) { + if (!normalizedType || (normalizedType !== 'ImportToC' && explainedTx.type !== TransactionType[normalizedType])) { throw new Error('Tx type does not match with expected txParams type'); } diff --git a/modules/sdk-coin-flrp/test/unit/flrp.ts b/modules/sdk-coin-flrp/test/unit/flrp.ts index e189d92092..96956c4259 100644 --- a/modules/sdk-coin-flrp/test/unit/flrp.ts +++ b/modules/sdk-coin-flrp/test/unit/flrp.ts @@ -9,6 +9,10 @@ import { EXPORT_IN_C } from '../resources/transactionData/exportInC'; import { EXPORT_IN_P } from '../resources/transactionData/exportInP'; import { IMPORT_IN_P } from '../resources/transactionData/importInP'; import { IMPORT_IN_C } from '../resources/transactionData/importInC'; +import { + MULTISIG_DELEGATION_FULLY_SIGNED_TX_HEX, + MULTISIG_DELEGATION_PARAMS, +} from '../resources/transactionData/multisigDelegationTx'; import { HalfSignedAccountTransaction, TransactionType, MPCAlgorithm } from '@bitgo/sdk-core'; import { secp256k1 } from '@flarenetwork/flarejs'; import { FlrpContext } from '@bitgo/public-types'; @@ -958,6 +962,22 @@ describe('Flrp test cases', function () { const isVerified = await basecoin.verifyTransaction({ txParams, txPrebuild }); isVerified.should.equal(true); }); + + it('should verify delegation transaction when txParams.type is the "stake" intent alias', async () => { + const txPrebuild = { txHex: MULTISIG_DELEGATION_FULLY_SIGNED_TX_HEX, txInfo: {} }; + const txParams = { + type: 'stake', // intent-type alias used by wallet-platform; must normalise to AddPermissionlessDelegator + stakingOptions: { + nodeID: MULTISIG_DELEGATION_PARAMS.nodeID, + amount: MULTISIG_DELEGATION_PARAMS.stakeAmount, + durationSeconds: MULTISIG_DELEGATION_PARAMS.duration * 24 * 60 * 60, + rewardAddress: MULTISIG_DELEGATION_PARAMS.rewardAddress, + }, + }; + + const isVerified = await basecoin.verifyTransaction({ txParams, txPrebuild }); + isVerified.should.equal(true); + }); }); describe('verifyTransaction with TSS wallet (Avalanche atomic)', () => {