Skip to content

SDP-1614: Create account creation service and request handler - #686

Merged
philipliu merged 4 commits into
feature/c-accountsfrom
philip/sdp-1614-create-account-service
May 22, 2025
Merged

SDP-1614: Create account creation service and request handler#686
philipliu merged 4 commits into
feature/c-accountsfrom
philip/sdp-1614-create-account-service

Conversation

@philipliu

@philipliu philipliu commented May 19, 2025

Copy link
Copy Markdown
Contributor

What

This PR implements the embedded wallet account creation service scaffolding. It introduces:

  • New data model
    • EmbeddedWallet manages and tracks the lifecycle of an embedded wallet.
    • Records will be created when disbursement instructions are processed, and the corresponding TSS Transaction will be inserted into the TSS database when this API is called.
    • Implemented as a separate table from receivers_wallet. receivers_wallet manages the relationship between the receiver and their wallets registration status, while embedded_wallet manages the lifecycle of an embedded wallet. An embedded_wallet is created for a receiver, but it is not associated with the receiver until the wallet is created and the receiver is registered in SEP-24.
  • New service
    • EmbeddedWalletService, creates and checks the status of embedded wallets.
  • New API handlers
    • WalletCreationHandler with REST endpoints;
      • POST /embedded_wallets/ to create a new embedded wallet.
      • GET /embedded_wallets/status?token={token} to check the status of an embedded wallet.

Why

Account creation API

Known limitations

  • TSS transaction worker not implemented
  • Dependency injection is not implemented

These will be implemented in other PRs.

Checklist

  • Title follows SDP-1234: Add new feature or Chore: Refactor package xyz format. The Jira ticket code was included if available.
  • PR has a focused scope and doesn't mix features with refactoring
  • Tests are included (if applicable)
  • CHANGELOG.md is updated (if applicable)
  • CONFIG/SECRETS changes are updated in helmcharts and deployments (if applicable)
  • Preview deployment works as expected
  • Ready for production

@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 19, 2025 21:00 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 19, 2025 21:00 — with GitHub Actions Inactive
@philipliu
philipliu force-pushed the philip/sdp-1614-create-account-service branch from e944246 to 349d333 Compare May 19, 2025 21:11
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 19, 2025 21:11 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 19, 2025 21:11 — with GitHub Actions Inactive
@philipliu
philipliu force-pushed the philip/sdp-1614-create-account-service branch from 349d333 to 9f984c1 Compare May 19, 2025 21:35
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 19, 2025 21:35 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 19, 2025 21:35 — with GitHub Actions Inactive
@philipliu
philipliu force-pushed the philip/sdp-1614-create-account-service branch from 9f984c1 to a7b30dd Compare May 20, 2025 00:47
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 20, 2025 00:47 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 20, 2025 00:47 — with GitHub Actions Inactive
@philipliu
philipliu force-pushed the philip/sdp-1614-create-account-service branch from a7b30dd to 8caf57d Compare May 20, 2025 14:10
@philipliu
philipliu had a problem deploying to Receiver Registration - E2E Integration Tests (Stellar) May 20, 2025 14:10 — with GitHub Actions Failure
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 20, 2025 14:10 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 20, 2025 14:11 — with GitHub Actions Inactive
@philipliu
philipliu requested a review from Copilot May 20, 2025 14:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new embedded wallet account creation service, including the data model, service layer, API endpoints, and comprehensive tests.

  • Added new database table and migration for embedded wallets.
  • Created EmbeddedWalletService with corresponding unit tests and mocks.
  • Integrated new REST endpoints for creating and checking wallet status.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
stellar-multitenant/internal/provisioning/manager_test.go Added "embedded_wallets" to the expected tables list.
stellar-multitenant/internal/httphandler/tenants_handler_test.go Added "embedded_wallets" entry in tenant handler tests.
internal/services/mocks/mock_embedded_wallet_service.go New mock implementation for EmbeddedWalletService.
internal/services/embedded_wallet_service_test.go Unit tests for wallet creation and retrieval.
internal/services/embedded_wallet_service.go Implementation of wallet creation and status retrieval logic.
internal/serve/httphandler/wallet_creation_handler_test.go Tests for the new wallet creation and status API endpoints.
internal/serve/httphandler/wallet_creation_handler.go API endpoints for creating and retrieving embedded wallets.
internal/data/models.go Updated to include the EmbeddedWalletModel.
internal/data/fixtures.go Introduced fixtures for creating and deleting embedded wallet records.
internal/data/embedded_wallet_test.go Tests for the embedded wallet data model and update validations.
internal/data/embedded_wallet.go Implementation of the embedded wallet model including update and column names.
db/migrations/sdp-migrations/2025-05-18.1-create-embedded-wallet.sql Migration script to create the embedded_wallets table and enum type.
Comments suppressed due to low confidence (1)

internal/data/embedded_wallet.go:54

  • Consider renaming 'EmbeddWalletColumnNames' to 'EmbeddedWalletColumnNames' to improve clarity and maintain consistency with other naming conventions in the code.
func EmbeddWalletColumnNames(tableReference, resultAlias string) string {

@philipliu
philipliu marked this pull request as ready for review May 20, 2025 14:15
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 20, 2025 14:21 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 20, 2025 14:21 — with GitHub Actions Inactive

@marcelosalloum marcelosalloum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

I'm leaving a few comments below. Plz DM me if you have any questions.

Comment thread internal/data/embedded_wallet.go
Comment thread internal/data/embedded_wallet.go
Comment thread internal/serve/httphandler/wallet_creation_handler.go Outdated
Comment thread internal/serve/httphandler/wallet_creation_handler.go Outdated
Comment thread internal/serve/httphandler/wallet_creation_handler.go
Comment thread internal/serve/httphandler/wallet_creation_handler.go
Comment thread internal/services/embedded_wallet_service.go Outdated
Comment thread internal/services/embedded_wallet_service.go Outdated
Comment thread internal/services/embedded_wallet_service.go Outdated
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 21, 2025 19:31 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 21, 2025 19:31 — with GitHub Actions Inactive

@marcelosalloum marcelosalloum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Plz, feel free to merge it after addressing the comments below.

Comment thread db/migrations/sdp-migrations/2025-05-18.1-create-embedded-wallet.sql Outdated
Comment thread db/migrations/sdp-migrations/2025-05-18.1-create-embedded-wallet.sql Outdated
Comment thread internal/services/embedded_wallet_service.go Outdated
Comment thread internal/services/embedded_wallet_service.go Outdated
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 22, 2025 21:01 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Anchor Integration Tests May 22, 2025 21:01 — with GitHub Actions Inactive
@philipliu
philipliu merged commit f705b04 into feature/c-accounts May 22, 2025
@philipliu
philipliu deleted the philip/sdp-1614-create-account-service branch May 22, 2025 21:15
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.

4 participants