Project Identifier: @project.ProjectIdentifier
+
+ @if (SessionStorage.IsProjectMetadataStorageByPubkey(project.NostrPubKey))
+ {
+ var metadata = SessionStorage.GetProjectMetadataByPubkey(project.NostrPubKey);
+
+
+
@metadata?.Name
+
@metadata?.About
+
+ }
+
View the transaction on the explorer.
Founder Key: @project.FounderKey
Start Date: @project.StartDate.ToString("dd/MM/yyyy")
diff --git a/src/Angor/Client/Storage/LocalSessionStorage.cs b/src/Angor/Client/Storage/LocalSessionStorage.cs
index eb8136ec..d98a038c 100644
--- a/src/Angor/Client/Storage/LocalSessionStorage.cs
+++ b/src/Angor/Client/Storage/LocalSessionStorage.cs
@@ -1,3 +1,4 @@
+using Angor.Client.Models;
using Angor.Client.Services;
using Angor.Shared.Models;
using Angor.Shared.Services;
@@ -21,10 +22,26 @@ public void StoreProjectInfo(ProjectInfo project)
_sessionStorageService.SetItem(project.ProjectIdentifier,project);
}
+ public ProjectMetadata? GetProjectMetadataByPubkey(string pubkey)
+ {
+ return _sessionStorageService.GetItem
(pubkey);
+ }
+
+ public void StoreProjectMetadata(string pubkey, ProjectMetadata projectMetadata)
+ {
+ _sessionStorageService.SetItem(pubkey, projectMetadata);
+ }
+
+ public bool IsProjectMetadataStorageByPubkey(string pubkey)
+ {
+ return _sessionStorageService.ContainKey(pubkey);
+ }
+
public ProjectInfo? GetProjectById(string projectId)
{
return _sessionStorageService.GetItem(projectId);
}
+
public bool IsProjectInStorageById(string projectId)
{
return _sessionStorageService.ContainKey(projectId);
diff --git a/src/Angor/Client/Models/ProjectMetadata.cs b/src/Angor/Shared/Models/ProjectMetadata.cs
similarity index 98%
rename from src/Angor/Client/Models/ProjectMetadata.cs
rename to src/Angor/Shared/Models/ProjectMetadata.cs
index cc6e02b1..06c64a7f 100644
--- a/src/Angor/Client/Models/ProjectMetadata.cs
+++ b/src/Angor/Shared/Models/ProjectMetadata.cs
@@ -1,6 +1,6 @@
using Nostr.Client.Messages.Metadata;
-namespace Angor.Client.Models;
+namespace Angor.Shared.Models;
public class ProjectMetadata
{
diff --git a/src/Angor/Shared/Services/ICacheStorage.cs b/src/Angor/Shared/Services/ICacheStorage.cs
index 079e0a6d..3cd57606 100644
--- a/src/Angor/Shared/Services/ICacheStorage.cs
+++ b/src/Angor/Shared/Services/ICacheStorage.cs
@@ -8,6 +8,9 @@ public interface ICacheStorage
void StoreProjectInfo(ProjectInfo project);
ProjectInfo? GetProjectById(string projectId);
bool IsProjectInStorageById(string projectId);
+ ProjectMetadata? GetProjectMetadataByPubkey(string pubkey);
+ void StoreProjectMetadata(string pubkey, ProjectMetadata projectMetadata);
+ bool IsProjectMetadataStorageByPubkey(string pubkey);
List? GetProjectIndexerData();
void SetProjectIndexerData(List list);
List GetUnconfirmedInboundFunds();
diff --git a/src/Angor/Shared/Services/IndexerService.cs b/src/Angor/Shared/Services/IndexerService.cs
index f5327531..72e2a67a 100644
--- a/src/Angor/Shared/Services/IndexerService.cs
+++ b/src/Angor/Shared/Services/IndexerService.cs
@@ -9,7 +9,7 @@ namespace Angor.Client.Services
{
public interface IIndexerService
{
- Task> GetProjectsAsync();
+ Task> GetProjectsAsync(int? offset, int limit);
Task GetProjectByIdAsync(string projectId);
Task> GetInvestmentsAsync(string projectId);
Task PublishTransactionAsync(string trxHex);
@@ -58,11 +58,10 @@ public IndexerService(INetworkConfiguration networkConfiguration, HttpClient htt
_networkService = networkService;
}
- public async Task> GetProjectsAsync()
+ public async Task> GetProjectsAsync(int? offset, int limit)
{
var indexer = _networkService.GetPrimaryIndexer();
- // todo: dan - make this proper paging
- var response = await _httpClient.GetAsync($"{indexer.Url}/api/query/Angor/projects?offset=0&limit=50");
+ var response = await _httpClient.GetAsync($"{indexer.Url}/api/query/Angor/projects?offset={offset}&limit={limit}");
_networkService.CheckAndHandleError(response);
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync>();
@@ -70,6 +69,11 @@ public async Task> GetProjectsAsync()
public async Task GetProjectByIdAsync(string projectId)
{
+ if (string.IsNullOrEmpty(projectId))
+ {
+ return null;
+ }
+
var indexer = _networkService.GetPrimaryIndexer();
var response = await _httpClient.GetAsync($"{indexer.Url}/api/query/Angor/projects/{projectId}");
_networkService.CheckAndHandleError(response);