-
Notifications
You must be signed in to change notification settings - Fork 198
feat: more yield feats, fixes, and polishes #11627
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
Changes from all commits
358ed56
8fa0fd8
7843007
2e027cc
83c7e35
7bea932
0623238
14b7524
8111b55
5305b6f
6916645
9452076
a4e4d9d
dafa3b8
c954a35
89936b5
ac4fa04
4d132d8
1452d11
4326075
52c6556
3d0121e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import type { ChainId } from '@shapeshiftoss/caip' | ||
|
|
||
| import { | ||
| COSMOS_NETWORK_FALLBACK_APR, | ||
| isSupportedYieldNetwork, | ||
| SHAPESHIFT_COSMOS_VALIDATOR_ADDRESS, | ||
| YIELD_NETWORK_TO_CHAIN_ID, | ||
|
|
@@ -16,29 +17,29 @@ export const yieldNetworkToChainId = (network: string): ChainId | undefined => { | |
|
|
||
| const TX_TITLE_PATTERNS: [RegExp, string][] = [ | ||
| [/approv/i, 'Approve'], | ||
| [/supply|deposit|enter/i, 'Deposit'], | ||
| [/withdraw|exit/i, 'Withdraw'], | ||
| [/supply|deposit|enter/i, 'Enter'], | ||
| [/withdraw|exit|unstake|undelegate/i, 'Exit'], | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future we could probably make this better and really use the same verbiage as upstream but for now, things are unified |
||
| [/claim/i, 'Claim'], | ||
| [/unstake|undelegate/i, 'Unstake'], | ||
| [/stake|delegate/i, 'Stake'], | ||
| [/stake|delegate/i, 'Enter'], | ||
| [/bridge/i, 'Bridge'], | ||
| [/swap/i, 'Swap'], | ||
| ] | ||
|
|
||
| // Map of transaction types to user-friendly button labels | ||
| // These should match the action verbs shown in the step row (without the asset symbol) | ||
| // Yield.xyz uses Enter/Exit terminology consistently | ||
| const TX_TYPE_TO_LABEL: Record<string, string> = { | ||
| APPROVE: 'Approve', | ||
| APPROVAL: 'Approve', | ||
| DELEGATE: 'Stake', // Monad uses DELEGATE for staking | ||
| UNDELEGATE: 'Unstake', // Monad uses UNDELEGATE for unstaking | ||
| STAKE: 'Stake', | ||
| UNSTAKE: 'Unstake', | ||
| DEPOSIT: 'Deposit', | ||
| WITHDRAW: 'Withdraw', | ||
| SUPPLY: 'Deposit', | ||
| EXIT: 'Withdraw', | ||
| ENTER: 'Deposit', | ||
| DELEGATE: 'Enter', // Monad uses DELEGATE for staking | ||
| UNDELEGATE: 'Exit', // Monad uses UNDELEGATE for unstaking | ||
| STAKE: 'Enter', | ||
| UNSTAKE: 'Exit', | ||
| DEPOSIT: 'Enter', | ||
| WITHDRAW: 'Exit', | ||
| SUPPLY: 'Enter', | ||
| EXIT: 'Exit', | ||
| ENTER: 'Enter', | ||
| BRIDGE: 'Bridge', | ||
| SWAP: 'Swap', | ||
| CLAIM: 'Claim', | ||
|
|
@@ -147,3 +148,15 @@ export const sortValidators = ( | |
|
|
||
| export const toUserCurrency = (usdAmount: string | number, rate: string | number): string => | ||
| bnOrZero(usdAmount).times(rate).toFixed() | ||
|
|
||
| export const ensureValidatorApr = (validator: ValidatorDto): ValidatorDto => | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does what it says on the name! |
||
| validator.rewardRate?.total | ||
| ? validator | ||
| : { | ||
| ...validator, | ||
| rewardRate: { | ||
| total: COSMOS_NETWORK_FALLBACK_APR, | ||
| rateType: 'APR' as const, | ||
| components: validator.rewardRate?.components ?? [], | ||
| }, | ||
| } | ||
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.
Whitespaces off - fixes annoying JSX warnings re: keys