Skip to content

[PLA-2417] Update to SDK v3 - #6

Merged
Bradez merged 10 commits into
masterfrom
feature/PLA-2417/update-to-v3
Jun 22, 2026
Merged

[PLA-2417] Update to SDK v3#6
Bradez merged 10 commits into
masterfrom
feature/PLA-2417/update-to-v3

Conversation

@JayPavlina

@JayPavlina JayPavlina commented May 27, 2026

Copy link
Copy Markdown
Collaborator
  • rewrites server to use .Net and use v3 of C# sdk
  • has been tested with the unity and godot clients

Additional Info

This pull request introduces a new C# web API server for the Enjin platform sample game, replacing the previous Node.js implementation. The new server is structured with modern .NET practices and provides endpoints for authentication, wallet management, token operations, and setup. It also introduces a new DTO model layer and configuration via appsettings/environment variables. The most important changes are summarized below:

API Endpoint Implementation

  • Added new endpoint groups for authentication (AuthEndpoints), wallet management (WalletEndpoints), token operations (TokenEndpoints), and setup (SetupEndpoints). These endpoints follow RESTful conventions and match the expected shapes for the Unity client, supporting features like user registration/login, wallet querying, token mint/melt/transfer, and collection ID retrieval. [1] [2] [3] [4]

Data Transfer Objects (DTOs) and Models

  • Introduced a comprehensive set of request and response DTOs in Dtos.cs, ensuring wire compatibility with the Unity client and encapsulating all API request/response shapes. Also added an in-memory User model for authentication. [1] [2]

Server Configuration and Bootstrap

  • Replaced the .env.example with strongly-typed configuration using appsettings and environment variables, and removed the old environment variable file. The server now bootstraps the Enjin collection at startup and supports skipping bootstrap for local testing. [1] [2]

Project Structure and Dependencies

  • Added a new .NET project file (PlatformSampleGameServer.csproj) targeting .NET 9, with dependencies for JWT authentication, cryptography, and the Enjin Platform SDK.

Authentication and Security

  • Implemented JWT-based authentication and authorization, with secure defaults and automatic dev secret generation if not configured. Endpoints are protected as appropriate, with setup endpoints intentionally left unauthenticated for initial provisioning. [1] [2] [3]

These changes lay the foundation for a robust, modern, and maintainable sample game server for Enjin platform integration.

Copilot AI left a comment

Copy link
Copy Markdown

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 replaces the previous Node.js Express sample server with a new .NET 9 (C#) minimal-API server that integrates with Enjin Platform SDK v3 while preserving the Unity client’s expected HTTP routes and JSON shapes.

Changes:

  • Introduces a new .NET 9 web API project with minimal API endpoint groups for auth, wallet, token operations, and setup.
  • Adds a C# service layer for Enjin Platform v3 interactions (collection bootstrap, managed wallets, mint/melt/transfer, transaction polling, ENJ drip) plus SS58 address encoding.
  • Removes the legacy Node.js implementation and its npm dependencies; moves configuration to appsettings*.json + environment variables.

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/Ss58SelfTest/Ss58SelfTest.csproj Adds a small console tool project referencing the server for SS58 encoding verification.
tools/Ss58SelfTest/Program.cs Runs a simple SS58 encode example for manual validation.
src/services/enjinService.js Removes old Node.js Enjin platform integration service.
src/services/authService.js Removes old Node.js auth service (bcrypt/jwt).
src/routes/wallet.js Removes old Node.js wallet routes.
src/routes/token.js Removes old Node.js token routes.
src/routes/auth.js Removes old Node.js auth routes.
src/models/user.js Removes old in-memory user model.
src/middlewares/jwtAuth.js Removes old JWT middleware.
src/index.js Removes old Node.js server bootstrap.
Services/UserStore.cs Adds in-memory, process-local user registry for the C# server.
Services/SubstrateAddress.cs Adds SS58 encoding utility to convert platform public keys to SS58 addresses.
Services/Options.cs Adds strongly typed configuration options for Enjin/JWT/Server settings.
Services/EnjinService.cs Implements all Enjin Platform SDK v3 interactions + persisted bootstrap state.
Services/AuthService.cs Implements bcrypt password hashing + JWT issuance for Unity client auth.
README.md Updates documentation to reflect the new .NET server and setup flow.
Program.cs Adds .NET host configuration, DI, auth, routing, and bootstrap orchestration.
PlatformSampleGameServer.csproj Adds new .NET 9 web project and NuGet dependencies (JWT, bcrypt, Enjin SDK, blake2).
package.json Removes Node.js package manifest.
package-lock.json Removes Node.js lockfile.
Models/User.cs Adds C# user record for in-memory auth store.
Models/Dtos.cs Adds DTOs matching Unity client wire format.
Endpoints/WalletEndpoints.cs Adds JWT-protected wallet endpoints (get managed wallet tokens).
Endpoints/TokenEndpoints.cs Adds JWT-protected token endpoints (mint/melt/transfer).
Endpoints/SetupEndpoints.cs Adds unauthenticated setup endpoint(s) for Unity editor tooling.
Endpoints/AuthEndpoints.cs Adds auth endpoints (health-check, register-or-login).
appsettings.Sample.json Adds sample configuration template for local setup.
appsettings.json Adds default config for logging/server/jwt/enjin/resource tokens.
.gitignore Updates ignored files for .NET build artifacts and local config/state.
.env.example Removes Node.js .env template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Program.cs
Comment thread Program.cs
Comment thread Services/EnjinService.cs Outdated
Comment thread Services/EnjinService.cs Outdated
Comment thread appsettings.Sample.json Outdated
Comment thread Endpoints/AuthEndpoints.cs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 30 changed files in this pull request and generated 8 comments.

Comment thread Services/SubstrateAddress.cs
Comment thread Services/EnjinService.cs
Comment thread Program.cs Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread tools/Ss58SelfTest/Program.cs
Comment thread Endpoints/SetupEndpoints.cs Outdated
Comment thread Endpoints/AuthEndpoints.cs
@JayPavlina
JayPavlina marked this pull request as ready for review May 27, 2026 23:56
@JayPavlina
JayPavlina requested a review from Bradez May 27, 2026 23:57
@JayPavlina

Copy link
Copy Markdown
Collaborator Author

CI will fail until the C# SDK is published to Nuget

@JayPavlina JayPavlina changed the title PLA-2417: Update to sdk v3 [PLA-2417] Update to sdk v3 May 28, 2026
@Bradez Bradez changed the title [PLA-2417] Update to sdk v3 [PLA-2417] Update to SDK v3 Jun 22, 2026
@Bradez
Bradez merged commit 5cb7ba8 into master Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants