feat: add approveForTrustline functionality and integrate with token …#94
feat: add approveForTrustline functionality and integrate with token …#94
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR introduces a two-step investment flow by adding trustline approval support. It includes a new DTO and service method for approving tokens, a controller endpoint to handle approval requests, a Soroban helper to fetch ledger sequences, and UI updates to add tokens to Freighter before completing purchases. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant InvestDialog
participant TokenService
participant Core API
participant Soroban RPC
participant Freighter
participant Contract
User->>InvestDialog: Click invest (trustline step)
InvestDialog->>TokenService: approveForTrustline(payload)
TokenService->>Core API: POST /participate-token/approve-for-trustline
Core API->>Soroban RPC: getLatestLedgerSequence()
Soroban RPC-->>Core API: ledger sequence
Core API->>Contract: buildContractCallTransaction(approve)
Contract-->>Core API: unsignedXdr
Core API-->>TokenService: { unsignedXdr }
TokenService-->>InvestDialog: { xdr }
InvestDialog->>Freighter: addToken(tokenFactoryId)
Freighter-->>InvestDialog: token added
InvestDialog->>InvestDialog: Switch to buy step
User->>InvestDialog: Click invest (buy step)
InvestDialog->>TokenService: buyToken(payload)
TokenService->>Core API: POST /participate-token/buy
Core API-->>TokenService: { xdr }
TokenService-->>InvestDialog: { xdr }
InvestDialog->>Freighter: Sign and submit transaction
Freighter-->>InvestDialog: transaction complete
InvestDialog->>User: Investment successful
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
…service
Summary by CodeRabbit
New Features