Skip to content

Commit

Permalink
Fix account type comparisons for staking
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Nov 19, 2024
1 parent fe15560 commit 5d0f5a8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/views/SignStaking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ export default class SignStaking extends Vue {
console.log(transaction);
// @ts-ignore Wrong type definition
if (transaction.senderType === 3) {
if (transaction.senderType === 'staking') {
const signerAddress = transaction.recipient;
const wallet = this.findWalletByAddress(signerAddress, false);
const signer = wallet?.findSignerForAddress(Nimiq.Address.fromUserFriendlyAddress(signerAddress));
if (!wallet || !signer) throw new Error('Signer not found');
// @ts-ignore Wrong type definition
if (transaction.recipientType !== 0) {
if (transaction.recipientType !== 'basic') {
throw new Error('Recipient must be a basic account when sender is staking contract');
}
Expand All @@ -45,15 +43,13 @@ export default class SignStaking extends Vue {
keyLabel = wallet.labelForKeyguard;
senderLabel = this.request.senderLabel || this.$t('Staking Contract') as string;
recipientLabel = signer.label;
// @ts-ignore Wrong type
} else if (transaction.recipientType === 3) {
} else if (transaction.recipientType === 'staking') {
const signerAddress = transaction.sender;
const wallet = this.findWalletByAddress(signerAddress, false);
const signer = wallet?.findSignerForAddress(Nimiq.Address.fromUserFriendlyAddress(signerAddress));
if (!wallet || !signer) throw new Error('Signer not found');
// @ts-ignore Wrong type definition
if (transaction.senderType !== 0) {
if (transaction.senderType !== 'basic') {
throw new Error('Sender must be a basic account when recipient is staking contract');
}
Expand Down

0 comments on commit 5d0f5a8

Please sign in to comment.