#nullable enable using BTCPayServer.Abstractions; using BTCPayServer.Controllers; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; namespace BTCPayServer.Plugins.Wallets; public static class UrlHelperExtensions { public static string? WalletReservedAddresses(this IUrlHelper helper, WalletId walletId) => helper.Action(nameof(UIWalletsController.ReservedAddresses), "UIWallets", new { area = WalletsPlugin.Area, walletId }); public static string? WalletReceive(this IUrlHelper helper, WalletId walletId) => helper.Action(nameof(UIWalletsController.WalletReceive), "UIWallets", new { area = WalletsPlugin.Area, walletId }); public static string? WalletSettings(this IUrlHelper helper, WalletId walletId) => helper.Action(nameof(UIStoreOnChainWalletsController.WalletSettings), "UIStoreOnChainWallets", new { area = WalletsPlugin.Area, storeId = walletId.StoreId, cryptoCode = walletId.CryptoCode }); public static string? WalletSend(this IUrlHelper helper, WalletId walletId) => helper.Action(nameof(UIWalletsController.WalletSend), "UIWallets", new { area = WalletsPlugin.Area, walletId }); public static string? WalletTransactions(this IUrlHelper helper, string walletId) => WalletTransactions(helper, WalletId.Parse(walletId)); public static string? WalletTransactions(this IUrlHelper helper, WalletId walletId) => helper.Action(nameof(UIWalletsController.WalletTransactions), "UIWallets", new { area = WalletsPlugin.Area, walletId }); public static string WalletPendingTransactionLink(this LinkGenerator urlHelper, WalletId walletId, string pendingTransactionId, RequestBaseUrl baseUrl) => urlHelper.GetUriByAction( action: nameof(UIWalletsController.ViewPendingTransaction), controller: "UIWallets", values: new { area = WalletsPlugin.Area, walletId = walletId.ToString(), pendingTransactionId }, baseUrl ); }