Skip to content
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

Staking UI - escrow, grants, delegation actions and summary #205

Merged
merged 27 commits into from
Apr 5, 2024

Conversation

dmytrotkk
Copy link
Contributor

@dmytrotkk dmytrotkk commented Mar 24, 2024

This PR includes:

  • skale-contracts library integration for all staking-related contract interactions
  • Updated Start page - added Changelog banner, added Staking card
  • Added Validatros page with basic validators info
  • Staking summary for regular accounts, escrow and grant escrow
  • Escrow info section - vested tokens, unlocked amount, etc
  • Preview mode to see summary without connecting an actual wallet
  • Delegation actions - undelegate, cancel pending request, etc
  • New Changelog page
  • Validator icons
  • Updated version of metaport library with improved transaction handling and additional wallet support

Mainnet preview can be found on Vercel.

Tested manually on Testnet and Mainnet contracts, since there are no automated tests for portal repo.
No performance changes.

Copy link

vercel bot commented Mar 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 6:33pm

@dmytrotkk dmytrotkk changed the title portal#121 Add validator icons Staking UI - escrow, grants, delegation actions and summary Mar 27, 2024
@dmytrotkk dmytrotkk linked an issue Mar 27, 2024 that may be closed by this pull request
export default function Delegate(props: {
mpc: MetaportCore
validator: IValidator | undefined
si: StakingInfoMap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest full name for easier updates in the future

src/components/delegation/Delegate.tsx Outdated Show resolved Hide resolved
async function stake() {
setLoading(true)
try {
console.log(`Delegating SKL...`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should debug log only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced with log()

'delegation'
)
const res = await sendTransaction(delegationContract.delegate, [
props.validator?.id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be left nullable? Maybe better to handle potential null value above and inform user accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handled missed validator

export default function DelegationTypeSelect(props: {
delegationType: DelegationType
handleChange: (event: any) => void
si: StakingInfoMap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest potentially making si full variable name to improve readiablity later

</p>
</div>
) : null}
{/* <div className={cls(cmn.flexg)}></div> */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

src/core/contracts.ts Outdated Show resolved Hide resolved
Comment on lines 103 to 113
// if (!currentValidator) {
// return <Loader text="Loading validator info" />
// }

// if (loaded && !available) {
// return <div>
// <Container maxWidth="md">
// <ErrorTile errorMsg="Delegation type is not available" setErrorMsg={setErrorMsg} />
// </Container>
// </div>
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 38 to 42
// export interface IDelegatorInfo {
// balance: bigint
// staked: bigint
// rewards: bigint
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 93 to 95
// if (ESCROW_VALIDATORS.includes(a.id) !== ESCROW_VALIDATORS.includes(b.id)) {
// return a.acceptNewRequests ? -1 : 1
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@dmytrotkk dmytrotkk merged commit 26f7db9 into develop Apr 5, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2024
@dmytrotkk dmytrotkk deleted the add-delegation-ui branch July 25, 2024 12:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delegation UI
3 participants