BJ Patel is an expert user of Umbraco. Always keen to share hints and tips on getting the best out of Umbraco.
Compatible with Visual Studio 2022 & Umbraco Cloud, No npm Required (without NPM)
⚠️ Critical Update: Reown Replaces WalletConnect SDKs
Reference key points from Reown’s WalletKit and AppKit architecture:
🧠 Solution Architecture Overview
Our integration architecture separates frontend and backend concerns cleanly:
-
Backend: ASP.NET / C# using NuGet packages from Reown
-
Frontend: Pure JavaScript using CDN scripts (no npm)
-
Hosting: Compatible with Umbraco Cloud, no custom build pipelines required
I. 🔧 Backend Setup (C#)
1. Install Reown NuGet Packages
Install the following packages in your ASP.NET Core project:
Install-Package Reown.Sign
Install-Package Reown.WalletKit
Here's how to initialize the Reown client in your WalletService class: csharp Copy Edit
2. Initialize WalletConnect Client
using Reown.Sign;
public class WalletService
{
private readonly WalletConnectClient _client;
public WalletService()
{
_client = new WalletConnectClient(new ClientOptions
{
ProjectId = "YOUR_PROJECT_ID",
OptionalNamespaces = new List { "eip155:1" },
Metadata = new Metadata
{
Name = "Your App",
Description = "Umbraco Wallet Integration",
Url = "https://yourdomain.com",
Icons = new[] { "https://yourdomain.com/icon.png" }
}
});
}
}
Add these scripts to your .cshtml view or layout: html Copy Edit
II. 🖥️ Frontend Integration (JavaScript + CDN)
1. Load Required Scripts
Add these scripts to your .cshtml view or layout:
script src="https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@latest/dist/appkit.js"
script src="https://cdn.jsdelivr.net/npm/@reown/walletkit-cdn@latest/dist/walletkit.umd.js
vvvvvvvvvvvv vvvvvvvvvvvv CND Structure vvvvvvvvvvvv vvvvvvvvvvvv
"https://cdn.jsdelivr.net/npm/@reown/[package]@[version]/dist/[file].js"
-
Note: @reown/appkit-cdn download information can be found from the following links
https://socket.dev/npm/package/@reown/appkit-cdn
- Critical: projectId is mandatory (create one at Reown Cloud)
Place a connect button and wire up the connection logic: html Copy Edit
2. Handle Wallet Connection
button id="connect-btn" >Connect Wallet< button
< script >
document.getElement ByI d('connect-btn').addEventListener('click', async () => {
const appKit = new Reown.AppKit({
projectId: 'YOUR_PROJECT_ID', // From Reown Cloud
relayUrl: 'wss://relay.reown.com'
});
const walletKit = new Reown.WalletKit(appKit);
try {
const session = await walletKit.connect();
console.log('Connected wallet:', session.accounts[0]);
// Send address to .NET backend
await fetch('/api/wallet/connect', {
method: 'POST',
body: JSON.stringify({ address: session.accounts[0] })
});
} catch (error) {
console.error('Connection failed:', error);
}
});
< / script >
add this to your WalletService
Add Session Management
public class WalletSession
{
public string Address { get; set; }
public DateTime Expiry { get; set; }
}
// In WalletService
private static readonly ConcurrentDictionary _sessions = new();
public void StoreSession(string sessionId, string address)
{
_sessions[sessionId] = new WalletSession
{
Address = address,
Expiry = DateTime.UtcNow.AddHours(24)
};
}
// Payment Processing Update
// Modify the payment method to verify sessions:
public async Task ProcessPayment(string sessionId, decimal amount)
{
if (!_sessions.TryGetValue(sessionId, out var session) || session.Expiry < DateTime.UtcNow)
return Unauthorized();
var txData = new
{
to = "YOUR_WALLET_ADDRESS",
value = Web3.Convert.ToWei(amount).ToString(),
from = session.Address // Critical!
};
return Json(txData);
}
Add API Controller (/Controllers/WalletController.cs):
[Route("api/[controller]")]
public class WalletController : ControllerBase
{
private readonly WalletService _walletService;
public WalletController(WalletService walletService)
=> _walletService = walletService;
[HttpPost("connect")]
public IActionResult Connect([FromBody] WalletConnectRequest request)
{
_walletService.StoreSession(Request.Cookies["session_id"], request.Address);
return Ok();
}
}
// >>>>>>> Session Middleware (Startup.cs):
app.UseCookiePolicy(new CookiePolicyOptions {
MinimumSameSitePolicy = SameSiteMode.Strict
});
app.Use(async (context, next) => {
context.Response.Cookies.Append("session_id", Guid.NewGuid().ToString());
await next();
});
⚠️ Critical Security Notes
-
Always validate transactions server-side - don't trust frontend inputs
-
Use HTTPS everywhere - especially for relay URL (wss://)
-
Set CORS policies
services.AddCors(options => options.AddPolicy("Wallet", builder =>
builder.WithOrigins("https://yourdomain.com")
.AllowAnyHeader()
.AllowAnyMethod()));
Here's a sample C# method for processing wallet-based payments: csharp Copy Edit
III. 💳 Payment Processing Workflow
public async Task ProcessPayment(string userId, decimal amount)
{
// Build transaction
var txData = new
{
to = "YOUR_WALLET_ADDRESS",
value = Web3.Convert.ToWei(amount).ToString(),
data = "0x"
};
// Send to frontend for signing
return Json(new {
txData,
user = userId
});
}
No build system customization is required. Simply:
IV. 🚀 Deploying to Umbraco Cloud
If a CDN path is published, you may need to inspect the actual file structure via jsDelivr’s package browser
E.g. https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.7.17/
and look for available files—though current evidence suggests none match /appkit.umd.js.
alternative CDN like UNPKG
Some users opt for UNPKG instead. You may check to see if it hosts a valid umd build path, e.g.:
https://unpkg.com/@reown/appkit-cdn@1.7.17/
and inspect the directory or try common UMD filenames like index.umd.js.
- ✅ Use Visual Studio 2022
- ✅ Skip npm, Webpack, or Node.js
- ✅ Push to Umbraco Cloud / GIT normally
- ✅ CDN-based scripts load at runtime
This ensures a clean, maintainable integration without any frontend build complexity.
This solution maintains the "no npm" approach while fixing the CDN issue. The guide you found appears to contain outdated URLs - I recommend verifying all resources against Reown's official documentation.
Alternative: NPM Installation (If CDN Persistently Fails)
import { createAppKit } from "@reown/appkit"; import { mainnet } from "@reown/appkit/networks";
-
Use this if CDN issues persist in your environment 515.
Join Our Community
Your contributions help us continue creating valuable content. Consider supporting us by sharing our content.
Junagadh, Gujarat
Latest Blog Posts