Skip to content

Commit ea7bca6

Browse files
committed
feat(sdk-core): staking tx STX validate type
the staking tx type will always be contract call type but the one in the staking params is staking lock so the checks will fail need to validate it is actually `ContractCall` SC-3403 TICKET: SC-3403
1 parent fa707e6 commit ea7bca6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/sdk-core/src/bitgo/staking/stakingWallet.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ export class StakingWallet implements IStakingWallet {
184184
);
185185
}
186186

187+
private isStx() {
188+
return this.wallet.baseCoin.getFamily() === 'stx';
189+
}
190+
187191
private isTrxStaking(transaction: StakingTransaction) {
188192
return this.wallet.baseCoin.getFamily() === 'trx';
189193
}
@@ -448,7 +452,8 @@ export class StakingWallet implements IStakingWallet {
448452
if (
449453
buildParams?.type &&
450454
(explainedTransaction as any).type !== undefined &&
451-
TransactionType[buildParams.type] !== (explainedTransaction as any).type
455+
((this.isStx() && TransactionType.ContractCall !== (explainedTransaction as any).type) || // for STX the tx type should always ContractCall
456+
(!this.isStx() && TransactionType[buildParams.type] !== (explainedTransaction as any).type))
452457
) {
453458
mismatchErrors.push(
454459
`Transaction type mismatch. Expected: '${buildParams.type}', Got: '${(explainedTransaction as any).type}'`

0 commit comments

Comments
 (0)