Skip to content

Commit

Permalink
feat(governance): add drep script id support to staking package (#3589)
Browse files Browse the repository at this point in the history
Signed-off-by: Juliano Lazzarotto <[email protected]>
Co-authored-by: Juliano Lazzarotto <[email protected]>
  • Loading branch information
banklesss and stackchain authored Sep 3, 2024
1 parent b7b1234 commit 23675b0
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const useStrings = () => {
goToStaking: intl.formatMessage(messages.goToStaking),
readyToCollectRewards: intl.formatMessage(messages.readyToCollectRewards),
notSupportedVersionButton: intl.formatMessage(messages.notSupportedVersionButton),
scriptNotSupported: intl.formatMessage(messages.scriptNotSupported),
}
}

Expand Down Expand Up @@ -143,7 +144,7 @@ const messages = defineMessages({
},
drepID: {
id: 'components.governance.drepID',
defaultMessage: '!!!Drep ID',
defaultMessage: '!!!Drep ID (fingerprint)',
},
thankYouForParticipating: {
id: 'components.governance.thankYouForParticipating',
Expand Down Expand Up @@ -280,4 +281,8 @@ const messages = defineMessages({
id: 'components.governance.notSupportedVersionButton',
defaultMessage: '!!!Go to main wallet page',
},
scriptNotSupported: {
id: 'components.governance.scriptNotSupported',
defaultMessage: '!!!Script DReps ids will be supported soon.',
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {isNonNullable} from '@yoroi/common'
import {parseDrepId, useIsValidDRepID} from '@yoroi/staking'
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {Linking, StyleSheet, View} from 'react-native'
import {Alert, Linking, StyleSheet, View} from 'react-native'

import {Button, Spacer, Text, TextInput} from '../../../../../components'
import {CardanoMobile} from '../../../../../yoroi-wallets/wallets'
Expand All @@ -22,7 +22,14 @@ export const EnterDrepIdModal = ({onSubmit}: Props) => {
const {error, isFetched, isFetching} = useIsValidDRepID(drepId, {retry: false, enabled: drepId.length > 0})

const handleOnPress = () => {
parseDrepId(drepId, CardanoMobile).then((parsedId) => onSubmit?.(parsedId))
parseDrepId(drepId, CardanoMobile).then(({type, hash}) => {
if (type === 'key') {
onSubmit?.(hash)
return
}

Alert.alert(strings.error, strings.scriptNotSupported)
})
}

const handleOnLinkPress = () => {
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/src/kernel/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"components.governance.confirmTxTitle": "Confirm transaction",
"components.governance.delegateVotingToDRep": "Delegate voting to\n{drepID}",
"components.governance.delegatingToADRep": "Delegating to a DRep",
"components.governance.drepID": "Drep ID",
"components.governance.drepID": "Drep ID (fingerprint)",
"components.governance.drepKey": "DRep Key",
"components.governance.enterADrepIDAndPassword": "Enter a Drep ID and password to sign this transaction",
"components.governance.enterDRepID": "Choose your Drep",
Expand Down Expand Up @@ -187,6 +187,7 @@
"components.governance.notSupportedVersionTitle": "Error",
"components.governance.notSupportedVersionDescription": "To be able to vote you need to update your Cardano ADA app to 7.",
"components.governance.notSupportedVersionButton": "Go to main wallet page",
"components.governance.scriptNotSupported": "Script DReps ids will be supported soon",
"components.initialization.acepttermsofservicescreen.aggreeClause": "I agree with the Terms of Service",
"components.initialization.acepttermsofservicescreen.continueButton": "Accept",
"components.initialization.acepttermsofservicescreen.savingConsentModalTitle": "Initializing",
Expand Down
Loading

0 comments on commit 23675b0

Please sign in to comment.