Add whitelisting and admin

This commit is contained in:
2025-11-07 23:46:48 +07:00
parent 21110cd771
commit e0795677e4
17 changed files with 2280 additions and 10 deletions

View File

@@ -66,6 +66,18 @@ public class WhitelistService : IWhitelistService
return await _whitelistRepository.GetByIdAsync(id);
}
public async Task<bool> IsEmbeddedWalletWhitelistedAsync(string embeddedWallet)
{
if (string.IsNullOrWhiteSpace(embeddedWallet))
{
return false;
}
var account = await _whitelistRepository.GetByEmbeddedWalletAsync(embeddedWallet);
return account?.IsWhitelisted ?? false;
}
public async Task<WhitelistAccount> ProcessPrivyWebhookAsync(
string privyUserId,
long privyCreatedAt,
@@ -76,8 +88,8 @@ public class WhitelistService : IWhitelistService
_logger.LogInformation("Processing Privy webhook - PrivyId: {PrivyId}, Wallet: {Wallet}, ExternalEthereum: {ExternalEthereum}, Twitter: {Twitter}",
privyUserId, walletAddress, externalEthereumAccount ?? "null", twitterAccount ?? "null");
// Convert Unix timestamp to DateTime
var privyCreationDate = DateTimeOffset.FromUnixTimeSeconds(privyCreatedAt).DateTime;
// Convert Unix timestamp to UTC DateTime (PostgreSQL requires UTC)
var privyCreationDate = DateTimeOffset.FromUnixTimeSeconds(privyCreatedAt).UtcDateTime;
// Check if account already exists
var existing = await _whitelistRepository.GetByPrivyIdAsync(privyUserId) ??