Repository navigation
feat: add key rental marketplace with listings, rent flow and active rental view (#1360) - #1362
Merged
Chucks1093 merged 1 commit intoNov 22, 2026
Conversation
…erorg#1360) Holders can list creator keys for a daily fee and renters can pay for a number of days to get access, following the rental contract interface from accesslayer-contracts#1227 (list_rental, rent, is_active_renter, end_rental, claim_collateral). - /rentals lists available rentals with fee per day, maximum days and collateral, with a List your keys modal validated against the holder's available balance and a Rent modal whose total is fee per day times days, computed exactly in stroops. - /rentals/mine shows Listed, Rented out and Rented in tabs with time remaining. End rental appears only after expiry and Claim collateral only for the owner after the grace period. - Keys listed for rent are taken out of the sellable and transferable balance on the portfolio row and the key page, which explain why. - Gated content unlocks for an active renter (is_active_renter) and shows a Rented badge with the time left. - Rentals stay disabled behind a "not live yet" notice until VITE_KEY_RENTAL_CONTRACT_ID is set; listings are read from the backend (GET /rentals, GET /users/:wallet/rentals) like other contract-backed lists.
|
@maleficboss Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
@Chucks1093 this is ready for review whenever you have a moment.
Thanks! |
Member
✅ PR Ready for ReviewDue to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging. This PR has passed all automated checks:
Next step: Please share this PR link in our Telegram group so a maintainer can review and merge it: https://t.me/c/accesslayerorg/8514 |
This was referenced Nov 22, 2026
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
Closes #1360.
Adds the key rental marketplace and the rental management view: holders list keys for a daily fee, renters rent them by the day, and gated content recognises rental access.
Heads-up: the rental contract is not on chain yet. accesslayerorg/accesslayer-contracts#1227 (the rental contract) was closed by accesslayerorg/accesslayer-contracts#1245, but that PR's merged diff only adds the anti-sniper launch window (
creator-keys/src/launch_window.rs,lib.rs,test_launch_window.rs). There is nolist_rental,rentoris_active_renteranywhere in the contracts repo, and accesslayer-server has no rental endpoints. So this PR:list_rental(owner, key_id, quantity, fee_per_day, max_days, collateral),rent(renter, listing_id, days),is_active_renter(wallet, key_id),end_rental(listing_id)andclaim_collateral(owner, listing_id);GET /rentalsandGET /users/:wallet/rentals, the same split the airdrop flow uses (backend lists, contract writes), because the spec emitsrental_listed,rental_startedandrental_endedevents but has no list views;VITE_KEY_RENTAL_CONTRACT_ID. While it is unset, the rental pages show a "not live yet" notice, no rental query runs, every rental action is disabled, and existing pages behave exactly as before.What's included
/rentals(RentalMarketPage): available listings with fee per day, maximum days and collateral, plus loading, error, empty and not-live states.ListRentalModal: key, quantity, fee per day, maximum days and collateral. The quantity is validated against the holder's available balance (liquid keys minus keys already listed). The modal explains that listed keys are escrowed.RentModal: a day selector (input, stepper and quick picks, capped at the listing's maximum) showing the rental fee (fee per day times days), the collateral and the total due. All amounts are integer stroops, so totals are exact, e.g. 1.2345678 XLM × 7 = 8.6419746 XLM./rentals/mine(MyRentalsPage): Listed, Rented out and Rented in tabs with time remaining. End rental appears only after expiry. Claim collateral appears only for the owner, after the grace period.SubscriptionAccessGateunlocks for an active renter viais_active_renterand shows a Rented badge with the time left instead of the holder banner.keyRentalContract.service.ts(injectable client factory, likeairdropContract.service.ts),keyRental.service.ts,useKeyRentals.ts,keyRental.utils.tsandtypes/keyRental.ts..env.exampleand the CONTRIBUTING env table.RentalListingCard;RentalMarketPage.test.tsxchecks exact values, including 0.1234567 XLMcalculateRentalFeeStroops(bigint);RentModal.test.tsxandkeyRental.utils.test.tsRentalEscrowNoticeplus balance changes inPortfolioHoldingRowandCreatorDetailPage;PortfolioHoldingRow.rentalEscrow.test.tsxcanEndRentalandcanClaimCollateral;RentalRow.test.tsxandMyRentalsPage.test.tsxSubscriptionAccessGateandRentedBadge; 3 new cases inSubscriptionAccessGate.test.tsxAssumptions to confirm once the contract lands
u64, day countsu32and amountsi128stroops.list_rentalmoves keys out instead, drop the subtraction ingetEscrowedKeyQuantity's two call sites.grace_ends_at). The normalizer also accepts camelCase, contract field names, seconds, milliseconds and ISO dates, and stroop or XLM amounts.Testing
pnpm lint: pass (same asdev)pnpm build: pass (same asdev)Run locally on Node 22 and pnpm 10.6.5 with
pnpm install --frozen-lockfile, comparingdevat7da03cdwith this branch:devpnpm lint,pnpm build,scripts/check-no-package-lock.sh(the CI steps)pnpm test(not in CI)LandingPage.buyFlowEndToEnd› "reports the submitted quantity while the transaction is pending" (failed ondev, passed once and failed twice in three reruns here) andCreatorDashboardPage.whitelist› "renders whitelist management panel…" (failed once, passed in two of three reruns; that page imports none of the changed code)keyRental.utils23,keyRentalContract.service8,RentModal3,ListRentalModal5,RentalRow5,RentalMarketPage6,MyRentalsPage4,PortfolioHoldingRow.rentalEscrow3,SubscriptionAccessGate+3malware-scan.yml, run on the diff)Mutation checks: making the fee a sum instead of a product fails 4 of the new tests, letting anyone claim collateral fails 2, and ignoring escrow on the holding row fails 1.
SubscriptionAccessGate.test.tsx› "shows locked state when holding is below minimum threshold" already fails ondev: it looks for a "Buy Keys to Unlock" button the component doesn't render. I added the rental-hook mock to that file but left the test as is.Screenshots: I couldn't take any, because the client doesn't boot locally on
devat7da03cd:viteandvite previewboth throwBuffer is not definedat startup (the Stellar SDK with no Buffer polyfill);useLocation() may be used only in the context of a <Router> component.Both happen on untouched
dev, on every route, and could be a separate issue. The new UI is covered by the component and page tests above.Checklist
.env.example, CONTRIBUTING env table)