8000 Added check for investment in the indexer to notify the founder of the final state by DavidGershony · Pull Request #356 · block-core/angor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added check for investment in the indexer to notify the founder of the final state #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions src/Angor/Client/Pages/Signatures.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@inject NavMenuState NavMenuState
@inject NostrConversionHelper NostrHelper
@inject INetworkService _networkService
@inject IIndexerService indexerService

@inherits BaseComponent

Expand Down Expand Up @@ -135,7 +136,7 @@
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Investment</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Received</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Status</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Npub</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Investor Npub</th>
<th class="text-uppercase text-xxs font-weight-bolder opacity-7">Chat</th>
</tr>
</thead>
Expand Down Expand Up @@ -168,15 +169,30 @@
}
else
{
<span class="badge bg-success">
<Icon IconName="check" Width="16" Height="16" class="me-1" />
Approved on @signature.TimeApproved.Value.ToString("dd/MM/yyyy HH:mm")
</span>
@if (signature.Invested != null)
{
<span class="badge bg-success">
<Icon IconName="invest" Width="16" Height="16" class="me-1"/>
Invested
</span>
<a href="@($"{_networkService.GetPrimaryExplorer().Url}/tx/{signature.Invested.TransactionId}")"
target="_blank" class="d-inline mt-2 ms-2">view transaction</a>
}
else
{
<span class="badge bg-info">
<Icon IconName="check" Width="16" Height="16" class="me-1" />
Approved on @signature.TimeApproved.Value.ToString("dd/MM/yyyy HH:mm")
</span>
}
}
</td>
<td>
Investment npub: @NostrHelper.ConvertHexToNpub(signature.investorNostrPubKey) <br />
Additional npub: @signature.SignRecoveryRequest?.AdditionalNpub
@NostrHelper.ConvertHexToNpub(signature.investorNostrPubKey) <br />
@if (signature.SignRecoveryRequest?.AdditionalNpub != null)
{
<span>Additional NPUB: @signature.SignRecoveryRequest?.AdditionalNpub</span>
}
</td>
<td class="d-flex justify-content-end align-items-center">
<button class="btn btn-sm btn-border-success" @ => ShowChatModal(signature.investorNostrPubKey)">
Expand Down Expand Up @@ -304,6 +320,7 @@
private string currentInvestorNpub = "";
private string currentInvestorHexPub = "";
private string founderNpub = "";
private List<ProjectInvestment> investments = new();

protected override async Task OnInitializedAsync()
{
Expand All @@ -317,6 +334,9 @@
?? throw new ArgumentException("The project was not found, try to scan in the founder page");

await FetchPendingSignatures(FounderProject);

investments = await indexerService.GetInvestmentsAsync(FounderProject.ProjectInfo.ProjectIdentifier);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this go in the refresh button?


}
Logger.LogDebug("End of OnInitializedAsync");
}
Expand Down Expand Up @@ -421,6 +441,8 @@
// Todo get the actual outputs with taproot type
pendingSignature.AmountToInvest = investorTrx.Outputs.AsIndexedOutputs().Skip(2).Take(investorTrx.Outputs.Count - 3)
.Sum(_ => _.TxOut.Value.Satoshi);

pendingSignature.Invested = investments.FirstOrDefault(_ => _.TransactionId == investorTrx.GetHash().ToString());
}
catch (FormatException fe)
{
Expand Down Expand Up @@ -656,8 +678,7 @@
var nostrPrivateKey = await DerivationOperations.DeriveProjectNostrPrivateKeyAsync(words, FounderProject.ProjectInfo.FounderKey);
var nostrPrivateKeyHex = Encoders.Hex.EncodeData(nostrPrivateKey.ToBytes());

var encryptedContent = await encryption.EncryptNostrContentAsync(
nostrPrivateKeyHex, signature.investorNostrPubKey, sigJson);
var encryptedContent = await encryption.EncryptNostrContentAsync(nostrPrivateKeyHex, signature.investorNostrPubKey, sigJson);

FounderProject.LastRequestForSignaturesTime = SignService.SendSignaturesToInvestor(encryptedContent, nostrPrivateKeyHex, signature.investorNostrPubKey, signature.EventId);

Expand Down Expand Up @@ -703,6 +724,7 @@
public string? EncryptedMessage { get; set; }

public string EventId { get; set; }
public ProjectInvestment? Invested { get; set; }
}

private async Task CopyToClipboard(string text)
Expand Down
0