feat: add Router Lockup creation - #4
Conversation
📝 WalkthroughWalkthroughAdds Stellar Router Lockup creation with typed inputs, schedule validation, contract invocation, mocked and testnet simulation coverage, documentation updates, and version ChangesStellar Lockup Router
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant StellarRouterClient
participant RouterContract
Caller->>StellarRouterClient: createLockup(input)
StellarRouterClient->>StellarRouterClient: validate and normalize schedule
StellarRouterClient->>RouterContract: create_lockup_stream(params)
RouterContract-->>StellarRouterClient: simulation result
StellarRouterClient-->>Caller: transaction result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)package.jsonTraceback (most recent call last): 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 47-60: Update the README configuration example preceding the
createLockup call to include a contracts.router contract ID alongside
contracts.flow, ensuring fundable.router is initialized and the example remains
executable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: acf95f34-1c25-4b3f-b3d5-5408d58b1ff5
📒 Files selected for processing (12)
README.mddocs/generated-bindings.mddocs/getting-started.mddocs/router-paymaster.mdpackage.jsonsrc/core/amounts.tssrc/core/types.tssrc/index.tssrc/stellar/protocol-clients.test.tssrc/stellar/router-client.tssrc/stellar/testnet.integration.test.tssrc/stellar/validation.ts
| Create NFT-backed Flow and Lockup streams through the Router: | ||
|
|
||
| ```ts | ||
| const lockup = await fundable.router?.createLockup({ | ||
| sender: "G...", | ||
| recipient: "G...", | ||
| token: { address: "C...", decimals: 7 }, | ||
| totalAmount: 1_000_000_000n, | ||
| startTime: new Date(), | ||
| endTime: new Date(Date.now() + 30 * 24 * 60 * 60 * 1_000), | ||
| cancelable: true, | ||
| }); | ||
| ``` | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add the Router contract ID to the README example configuration.
The preceding configuration only supplies contracts.flow, but this example calls fundable.router?.createLockup. Without contracts.router, the optional chain returns undefined instead of a transaction. Add a router contract ID to the setup example or make this example’s configuration self-contained.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 47 - 60, Update the README configuration example
preceding the createLockup call to include a contracts.router contract ID
alongside contracts.flow, ensuring fundable.router is initialized and the
example remains executable.
Summary
Verification
Summary by CodeRabbit
New Features
Documentation
Chores
0.1.0-alpha.3.