feat: add DeFi portfolio actions#11801
Draft
zhaono1 wants to merge 41 commits into
Draft
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
153843a to
f609dd3
Compare
ea708de to
f8fd310
Compare
f8fd310 to
e72024e
Compare
# Conflicts: # packages/shared/src/locale/json/bn.json # packages/shared/src/locale/json/de.json # packages/shared/src/locale/json/es.json # packages/shared/src/locale/json/fr_FR.json # packages/shared/src/locale/json/hi_IN.json # packages/shared/src/locale/json/id.json # packages/shared/src/locale/json/it_IT.json # packages/shared/src/locale/json/ja_JP.json # packages/shared/src/locale/json/ko_KR.json # packages/shared/src/locale/json/pt.json # packages/shared/src/locale/json/pt_BR.json # packages/shared/src/locale/json/ru.json # packages/shared/src/locale/json/th_TH.json # packages/shared/src/locale/json/uk_UA.json # packages/shared/src/locale/json/vi.json # packages/shared/src/locale/json/zh_HK.json # packages/shared/src/locale/json/zh_TW.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/earn/v1/defi/supported-protocols.Intent & Context
The wallet Home DeFi module exposes portfolio operations based on the Earn service contract. The UI renders only actions returned by
/earn/v1/defi/supported-protocolsand hides actions when required build-transaction metadata is missing.Design Decisions
protocolId,networkId, position category, asset/reward category, and server-provided action metadata.accountIdandindexedAccountIdon transformed protocol data so detail pages and Aave Borrow Manage route handoffs do not fall back to a different current selector account.permit, sign typed data, then build the withdraw transaction withsignatureanddeadline.approvalTxresponses until a dedicated approval UX exists.claimWithdrawal, submit a singleunbondNonces[0]per transaction to match the current service handler behavior.Changes Detail
ServiceDeFi: fetch supported DeFi actions and build action transactions through the Earn API.Risk Assessment
Test plan
npx jest packages/shared/src/utils/defiActionUtils.test.ts packages/shared/src/utils/defiUtils.test.ts --runInBandnpx oxlint --tsconfig ./tsconfig.json --type-aware --deny-warnings packages/shared/types/defi.ts packages/shared/src/utils/defiUtils.ts packages/kit-bg/src/services/ServiceDeFi.ts packages/kit/src/views/Home/components/DeFiListBlock/DeFiListBlock.tsx packages/kit/src/views/Home/components/DeFiListBlock/Protocol.tsx packages/kit/src/views/Home/components/DeFiListBlock/ProtocolCategoryGroup.tsx packages/kit/src/views/Home/components/DeFiListBlock/ProtocolUnifiedTable.tsx packages/kit/src/views/AssetDetails/pages/DeFiProtocolDetails.tsx packages/kit/src/components/DeFi/ProtocolPositionActionButton.tsx packages/kit/src/components/DeFi/ProtocolPositionActionDialog.tsx packages/shared/src/utils/defiActionUtils.ts packages/shared/src/utils/defiActionUtils.test.ts packages/shared/src/utils/defiUtils.test.tsgit diff --cached --checkyarn lint:stagedyarn tsc:stagedcurrently blocked by existing unrelated errors inpackages/kit/src/views/Perp/components/OrderBook/AnimatedDepthBlock.native.tsxandpackages/shared/src/errors/**ThirdParty*(ThirdPartyHwErrorCode.NetworkError).Runtime Validation Targets
accountId/indexedAccountId.tokenId.claimWithdrawalsubmits one nonce per transaction.permit -> typed-data sign -> withdraw.poolAddressremains fail-closed.