Skip to content

feature/seller-soroban-registration#171

Merged
KevinLatino merged 2 commits intoStarShopCr:mainfrom
noelia-matarrita03:feature/seller-soroban-registration
Sep 29, 2025
Merged

feature/seller-soroban-registration#171
KevinLatino merged 2 commits intoStarShopCr:mainfrom
noelia-matarrita03:feature/seller-soroban-registration

Conversation

@noelia-matarrita03
Copy link
Contributor

@noelia-matarrita03 noelia-matarrita03 commented Sep 19, 2025

🚀 StarShop Pull Request

#156

Mark with an x all the checkboxes that apply (like [x])


📌 Type of Change

  • Documentation (updates to README, docs, or comments)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

📝 Changes description

  • Implemented seller registration endpoints for Soroban payout wallet linking.
  • Added validation to ensure only one payout wallet per seller and uniqueness across users.
  • Mocked XDR building and submission logic (ready for real Soroban integration).
  • Updated user entity to store payout wallet and registration status.
  • Added and updated unit/e2e tests for all flows and edge cases.

⏰ Time spent breakdown

  • Coding & implementation: 2h
  • Writing/adjusting tests: 1h
  • Manual testing & review: 30m
  • Documenting & PR: 15m

Summary by CodeRabbit

  • New Features

    • Introduced seller on-chain registration flow with authenticated endpoints to build an unsigned registration transaction, submit a signed transaction, and check registration status.
    • Added support for setting a payout wallet and tracking on-chain registration state.
    • Consistent success/data response format across endpoints with detailed API docs.
  • Tests

    • Added comprehensive unit and end-to-end tests covering success and error scenarios for all seller registration endpoints.

@coderabbitai
Copy link

coderabbitai bot commented Sep 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds seller on-chain registration feature: new Seller module (controller, service, DTOs), routes for building and submitting registration XDRs, and status retrieval. Updates User entity and introduces a migration to add payout wallet and registration flag. Includes unit and e2e tests. Changes primary key strategy for users to numeric IDs.

Changes

Cohort / File(s) Summary of Changes
User schema changes
src/migrations/1751199300000-AddSellerSorobanFields.ts, src/modules/users/entities/user.entity.ts
Migration adds payout_wallet (unique, nullable) and seller_onchain_registered (boolean, default false). User entity switches id to numeric auto-generated, adds payoutWallet and sellerOnchainRegistered fields.
Seller module wiring
src/modules/seller/seller.module.ts
New Nest module registering controller, service; imports User repository and SharedModule; exports SellerService.
Seller controller
src/modules/seller/controllers/seller.controller.ts
New controller with guarded routes: POST build-register, POST submit, GET status; calls service with authenticated user id; Swagger decorators and uniform { success, data } responses.
Seller DTOs
src/modules/seller/dto/build-register.dto.ts, src/modules/seller/dto/submit-register.dto.ts
Request/response DTOs for build and submit flows with validation and API docs.
Seller service
src/modules/seller/services/seller.service.ts
New service implementing registration build/submit/status logic with mock Soroban helpers; validates roles, uniqueness, and updates user record.
Tests
src/modules/seller/tests/seller.service.spec.ts, src/modules/seller/tests/seller.e2e.spec.ts
Unit tests for service error/success paths; e2e tests covering auth, validation, and endpoints with in-memory DB setup.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Seller as Seller (authenticated)
  participant API as SellerController
  participant Svc as SellerService
  participant DB as Users Repo

  Seller->>API: POST /seller/contract/build-register {payoutWallet}
  API->>Svc: buildRegister(userId, dto)
  Svc->>DB: findOne(userId)
  DB-->>Svc: User
  Svc->>DB: findOne({payoutWallet})
  DB-->>Svc: (exists?|null)
  Svc-->>API: { unsignedXdr, contractAddress }
  API-->>Seller: { success, data }

  rect rgba(230, 245, 255, 0.5)
    note over Svc: Mock Soroban XDR build (placeholder)
  end
Loading
sequenceDiagram
  autonumber
  actor Seller as Seller (authenticated)
  participant API as SellerController
  participant Svc as SellerService
  participant DB as Users Repo

  Seller->>API: POST /seller/contract/submit {signedXdr}
  API->>Svc: submitRegister(userId, dto)
  Svc->>DB: findOne(userId)
  DB-->>Svc: User
  Svc->>Svc: validate signedXdr (mock)
  alt valid
    Svc->>DB: update(userId, { payoutWallet, sellerOnchainRegistered: true })
    DB-->>Svc: OK
    Svc-->>API: { transactionHash, contractId, payoutWallet, registered: true }
    API-->>Seller: { success, data }
  else invalid
    Svc-->>API: BadRequestException
    API-->>Seller: 400 error
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Villarley

Poem

A whisk of bytes, a hop through chain,
I stamp my paw—contracts attain!
Unsigned dreams to XDR flight,
Then hashes twinkle, starry night.
Wallets tucked, flags set true—
Thump-thump! Seller bun approves you. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21c3513 and 0b5400f.

📒 Files selected for processing (9)
  • src/migrations/1751199300000-AddSellerSorobanFields.ts (1 hunks)
  • src/modules/seller/controllers/seller.controller.ts (1 hunks)
  • src/modules/seller/dto/build-register.dto.ts (1 hunks)
  • src/modules/seller/dto/submit-register.dto.ts (1 hunks)
  • src/modules/seller/seller.module.ts (1 hunks)
  • src/modules/seller/services/seller.service.ts (1 hunks)
  • src/modules/seller/tests/seller.e2e.spec.ts (1 hunks)
  • src/modules/seller/tests/seller.service.spec.ts (1 hunks)
  • src/modules/users/entities/user.entity.ts (1 hunks)

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.

@KevinLatino KevinLatino merged commit b80d6d8 into StarShopCr:main Sep 29, 2025
1 check was pending
@coderabbitai coderabbitai bot mentioned this pull request Oct 1, 2025
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

Comments