-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(governance): Add governance feature #2931
Conversation
"@emurgo/csl-mobile-bridge": "5.1.3", | ||
"@emurgo/cross-csl-core": "^4.0.0-alpha.1", | ||
"@emurgo/cross-csl-mobile": "^4.0.0-alpha.1", | ||
"@emurgo/csl-mobile-bridge": "6.0.0-alpha.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
library updates
setShowCatalystBanner((canVote && isRegistrationOpen(fundInfo)) || isNightly() || __DEV__) | ||
const catalyst = catalystManagerMaker() | ||
|
||
setShowCatalystBanner((canVote && catalyst.isRegistrationOpen(fundInfo)) || isNightly() || __DEV__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this helper to @yoroi/staking
walletNavigateTo.navigateToGovernanceCentre({navigateToStakingOnSuccess: true}) | ||
} | ||
|
||
const onWithdraw = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const walletNavigateTo = useWalletNavigation() | ||
|
||
const onParticipatePress = () => { | ||
walletNavigateTo.navigateToGovernanceCentre({navigateToStakingOnSuccess: true}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user clicks on participate on the modal below and they cast a vote, then they are redirected back to staking dashboard
options={{ | ||
title: walletName, | ||
headerRight: () => <HeaderRight />, | ||
<GovernanceProvider manager={manager}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GovernanceProvider needs to be here since we need to check in staking dashboard whether the user participates or not
@@ -197,6 +200,25 @@ const OnlyNightlyShelleyTestnetButton = () => { | |||
) | |||
} | |||
|
|||
const OnlyNightlyShelleySanchonetButton = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {mocks} from '../../yoroi-wallets/mocks' | ||
import {ConfirmTxWithHwModal} from './ConfirmTxWithHwModal' | ||
|
||
storiesOf('ConfirmTxWithHwModal', module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved these TX funnel components into src/components
folder, so it's easier to re-use them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nops, let's use these as base for the funnel refactor next quarter.
value={spendingPassword} | ||
onChangeText={(text) => setSpendingPassword(text)} | ||
autoComplete="off" | ||
right={isPasswordCorrect ? <Checkmark /> : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now display a green check mark icon if the password is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color?: string | ||
} | ||
|
||
export const Governance = ({size = 36, color = '#6B7384'}: Props) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -56,6 +59,18 @@ export const Menu = () => { | |||
/> | |||
</Boundary> | |||
|
|||
{CONFIG.GOVERNANCE_CENTRE_ENABLED && isSanchoNetworkId(wallet.networkId) && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Menu item is shown only if enabled with feature flag and wallet is on sanchonet
showRightArrow?: boolean | ||
} | ||
|
||
export const Action = ({title, description, onPress, pending, children, showRightArrow}: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {COLORS} from '../../../../../theme' | ||
import {useStrings} from '../strings' | ||
|
||
const LEARN_MORE_LINK = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links are hidden until we have them ready. Not a blocker.
children: ReactNode | ||
} | ||
|
||
export const SafeArea = ({children}: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted this into a component, so it can be used as a decorator in stories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's ok, just a friendly reminder that bottom
is controlled by BottomTabNav
, if eventually part of the funnel display the bottom nav, this will have to change, dunno if worth it. 🤔 it will expose 1:1 to SAV.
onSubmit?: (drepId: string) => void | ||
} | ||
|
||
const FIND_DREPS_LINK = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links are hidden until we have them ready. Not a blocker.
suspense: true, | ||
}) | ||
|
||
useWalletEvent(wallet, 'utxos', refetchStakingKeyState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We refetch staking key state when there is a new utxo to show correct vote and hide pending status
const isTxPending = isString(submittedTxId) && !isTxConfirmed(submittedTxId, txInfos) | ||
|
||
if (wallet.isHW) { | ||
return <HardwareWalletSupportComingSoon /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ledger does not support governance actions yet.
Hello @stackchain I've removed the env variables and created a hook that checks the block number based on network, see commit here 9beeb3d |
apps/wallet-mobile/src/features/Staking/Governance/common/navigation.ts
Outdated
Show resolved
Hide resolved
apps/wallet-mobile/src/features/Staking/Governance/useCases/FailedTx/FailedTxScreen.tsx
Outdated
Show resolved
Hide resolved
apps/wallet-mobile/src/features/Staking/Governance/common/BrokenImage.tsx
Outdated
Show resolved
Hide resolved
apps/wallet-mobile/src/features/Staking/Governance/useCases/Home/HomeScreen.tsx
Outdated
Show resolved
Hide resolved
apps/wallet-mobile/src/features/Staking/Governance/useCases/Home/HomeScreen.tsx
Outdated
Show resolved
Hide resolved
apps/wallet-mobile/src/features/Staking/Governance/useCases/SuccessTx/SuccessTxImage.tsx
Outdated
Show resolved
Hide resolved
return new Api({networkId, client}) | ||
} | ||
|
||
class Api implements GovernanceApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally I don't like using classes in JS, cuz every time you find a callback, and sometimes it can be nested deep in the code, you have to .bind
the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm the same, but I saw other packages using classes as well, so I did not want to start new approaches while also this PR being so BIG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the manager should receive the api and storage ready, instead of configuring it locally, besides that lgtm.
Resolves YOMO-843
This PR contains all Governance changes.
To test governance yourself
abandon ... share
orabandon ... address
)Todo
governance.mp4