-
Notifications
You must be signed in to change notification settings - Fork 0
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 changes #134
base: dev
Are you sure you want to change the base?
Staking changes #134
Conversation
e615701
to
26463a3
Compare
} | ||
|
||
return claimable; | ||
return Asset.fromUnits(claimable, network.chain.systemToken!.symbol); |
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.
return Asset.fromUnits(claimable, network.chain.systemToken!.symbol); | |
return Asset.fromUnits(claimable, network.chain.systemToken?.symbol || '4,UNKNOWN); |
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 would do something like this everywhere that you're using the !
operand.
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.
Just checked that we are using this.chain.systemToken.symbol
almost everywhere, without !
or ?
. Your IDE doesn't report the error or you ignore it?
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.
Oh yeah, that was my bad, it was because I was using an old version of the wharfkit/common package 😅 I have that all cleaned up in my latest PR 👍
try { | ||
const result = await this.wharf!.transact({ | ||
if (!this.network || !this.account || !this.account.name || !this.wharf) { |
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 still think that this doesn't belong in a state file.
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 could use another class name like WithdrawManager
, instead of xxxState
, lol. Yeah i agree a pure state should not hold more logics, but here i think what we need is not a pure state. I know how you've wrote other pages, like ram and send pages, read all about them before coding this, but i think this approach in staking is more clear and easy. Tell me which one you like, WithdrawManager
or a pure state and dissecting it in another page file? Keep in mind that, there is consistently only 5 lines of code in every page file, it's fully abstraction between ui and logic :
const { data } = $props();
let stakeState: StakeState = $state(new StakeState(data.network));
$effect(() => {
stakeState.sync(data.network, context.account, context.wharf);
});
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.
Renaming it would be a step in the right direction, but my other issue with your approach is that it's not consistent with what we've been doing on the other pages.
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.
How about you follow the state class format that we have in the other pages, but you can also have another class to manage the action handling? Maybe it can even take a state class instance as a param? The result would be similar to what you have here, but more consistent with the other pages.
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 don't think state and state manager should be separated. They are just class's members
and class's method properties
. Why would we make them two classes?
If you think the withdrawManager
is the right direction, why not using this approach in all other pages?
fab1a81
to
ff02841
Compare
e89ed43
to
0194b5f
Compare
No description provided.