Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 6, 2026

jk, disregard the below this is a PoC
Just digging around and starting exploration with minimax/opus here. Implementation plan really isn't one, more like references of sorts, augmented by actual curls with test API key:

Master plan:

  • Exploration md files
  • Actual implementation plan md
  • Execute plan
  • Test
  • POC ready - most likely throw visual work away (or not?)

Macro plan:

  • Test, test, more tests
  • Fix filters
  • Surface gas estimates from yield if handy (KISS, no own estimates)
  • Triple-check deposit/exit position updated on success
  • Cosmos claims, can do?
  • Cosmos multiple validators display?
  • Ensure all images present, report svgs 500 to yield
  • Curate more in dashboard?
  • Constant chainIds etc vs. magic strings
  • Remove logs
  • More cleanup
  • Perf
  • Less slop
  • ???
  • PROFIT

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_yield

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Add Phase 1.0 TypeScript types with full API enums (TransactionType, ActionType, YieldNetwork, etc.)
- Add Phase 1.0.1 network/chainId mapping utilities (CAIP-2 <-> Yield.xyz network)
- Document all API response structures from actual testing
- Include parsing utilities for JSON string fields (unsignedTransaction, gasEstimate)
- Define request/response types for all endpoints
- Add VITE_YIELD_XYZ_API_KEY, VITE_YIELD_XYZ_BASE_URL, VITE_FEATURE_YIELD_XYZ env vars
- Add YieldXyz feature flag to preferencesSlice and test mocks
- Add CSP for api.yield.xyz and assets.stakek.it
- Create types.ts with API response types (no derived types)
- Create constants.ts with CHAIN_ID_TO_YIELD_NETWORK mapping
- Create utils.ts with parsing and conversion utilities
- Create api.ts with all Yield.xyz API endpoints
- Create React Query hooks (useYields, useYield, useYieldBalances, useEnterYield, useExitYield, useSubmitYieldTransaction)
- Filter out SKIPPED and CREATED transactions in YieldActionModal before
  building steps array and execution loop, preventing phantom approval steps
- Update YieldStats to use AugmentedYieldDto instead of YieldDto for type safety
- Fix YieldEnterExit dependency arrays (use exitBalance instead of withdrawableBalance)
- Switch YieldYourInfo formatters to use shared formatLargeNumber helper
- Remove unused inputTokenBalance variable from YieldYourInfo
- Fix invalid bgOpacity prop in YieldPositionCard (use bg='color.900' pattern)
- Remove unused Button import from YieldCard
- Add formatLargeNumber utility for consistent number formatting
The yield-xyz provider logoURI from the API returns 403, so we override
it with a locally hosted PNG using react-query's select option.
- Add YieldFilters component with network/provider filtering and sort options
- Add transaction confirmation polling before marking tx as success
- Remove redundant tags display from YieldCard and table
- Add pagination params to getProviders API
- Show ResultsEmptyNoWallet for positions tab when disconnected
The wip commits broke AssetIcon's discriminated union types and added
a proxy asset creation that caused double icon rendering. Reverted to
original and updated Yields components to use only src prop.
@gomesalexandre
Copy link
Contributor Author

Ok maybe that is a bit more than an exploration PR.

@gomesalexandre gomesalexandre changed the title feat: yield.xyz exploration feat: yield.xyz ~~exploration~~ POC Jan 7, 2026
@gomesalexandre gomesalexandre changed the title feat: yield.xyz ~~exploration~~ POC feat: yield.xyz POC Jan 7, 2026
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can revert already, fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert, now useless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert, captured as an issue, all done thru dashboard

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sanity-check no useless ones here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

triple-check this is feature-flag gated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Triple-check this one, seems flaky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm yeah no

'Content-Type': 'application/json',
}

const handleResponse = async <T>(response: Response): Promise<T> => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems sloppy - should be handled by axios

if (params?.limit) searchParams.set('limit', String(params.limit))
if (params?.offset) searchParams.set('offset', String(params.offset))

const response = await fetch(`${BASE_URL}/yields?${searchParams}`, { headers })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

axios vs. fetch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Augments pure response with bits we need - clear separation between server response and our augmented DTOs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also:

  • few squirly braces we can remove here
  • tokenToAssetId seems flaky, clean it up
  • bnOrZero vs. Number things
  • no eip155:${evmChainId} as ChainId - use toChainId()
  • naming

import { assertGetSuiChainAdapter } from '@/lib/utils/sui'
import { isStakingChainAdapter } from '@/plugins/cosmos/components/modals/Staking/StakingCommon'

type ParsedEvmTransaction = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

types should live in a types.ts

* Parse the JSON string unsignedTransaction from Yield.xyz API
*/
export const parseUnsignedTransaction = (tx: TransactionDto): ParsedUnsignedTransaction => {
if (typeof tx.unsignedTransaction === 'string') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems... flaky.

/**
* Yield.xyz API Types
* These types are derived from actual API responses.
* DO NOT add derived/composite types - only what the API returns.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe worth a diff naming for this one then, so other types can live in types.ts

} from './constants'
import type { TransactionDto, YieldDto, YieldNetwork } from './types'

export const chainIdToYieldNetwork = (chainId: ChainId): YieldNetwork | undefined =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a constant but should probably be colocated in constants.ts, ditto below

export const filterSupportedYields = (yields: YieldDto[]): YieldDto[] =>
yields.filter(y => isSupportedYieldNetwork(y.network))

export type ParsedUnsignedTransaction = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto types.ts

}

export const parseUnsignedTransaction = (tx: TransactionDto): ParsedUnsignedTransaction => {
if (typeof tx.unsignedTransaction === 'string') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto flaky

- Add CHAIN_NAMESPACE.Solana case to executeTransaction switch
- Implement executeSolanaTransaction that decompiles yield.xyz
  transactions, filters compute budget instructions, and rebuilds
  with fresh blockhash
- Fix amount format for Solana - yield.xyz expects human-readable
  SOL, not lamports
- Add minimum compute unit buffer (50k) for staking operations
…e types

- Show YieldActivePositions on account page (was only on asset page)
- Sum all balance types (active, entering, exiting, withdrawable) for
  total value display instead of just active balance
Query Key Fixes:
- useEnterYield: invalidate ['yieldxyz', 'balances', yieldId, address] + allBalances
- useExitYield: invalidate ['yieldxyz', 'balances', yieldId, address] + allBalances
- useSubmitYieldTransactionHash: accept optional yieldId/address params, invalidate properly
- YieldActionModal: remove inline invalidations, pass yieldId/address to mutation

The original code had incorrect query key patterns that caused cache
invalidation to fail. Mutations were invalidating partial keys that
didn't match the actual query keys, leading to stale data after transactions.

Bug Fixes:
- useYieldOpportunities: add guardrail throw when multiAccountEnabled without accountId
- Header: gate Yields nav item behind YieldXyz feature flag

Chores:
- augment.ts: rename evmChainIdFromString → parseEvmNetworkId, use toChainId() validation
- types.ts: rename evmChainId → evmNetworkId for clarity
- Remove unused useQueryClient from YieldActionModal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants