Skip to content
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

Add address to GetAvailableUtxos in NodeguardService #377

Merged
merged 9 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
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
93 changes: 93 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#####################
# Project variables #
#####################

# Version of this template
TEMPLATE_VERSION := "0.1.1"
# Project directory (relative to the justfile)
PROJECT_DIR := 'src'
# Docker directory
DOCKER_DIR := 'docker'
# Docker compose dev file name
DOCKER_COMPOSE_FILE := 'docker-compose.yml'

##################
# Just variables #
##################

# Fallback to a justfile in a parent directory
set fallback := true
# Load .env file in the current directory
set dotenv-load := true

###########
# Aliases #
###########

alias i := install
alias b := build
alias r := run
alias t := test
alias f := format
alias ddb := drop-db
alias am := add-migration
alias rm := remove-migration
alias du := docker-up
alias ddn := docker-down
alias drm := docker-rm

#######
# All#
#######

# Everything necessary to install the project
[macos]
install:
#!/usr/bin/env bash
set -euxo pipefail
# Add your installation steps here

##########
# Dotnet #
##########

build:
cd {{PROJECT_DIR}} && dotnet build

run:
cd {{PROJECT_DIR}} && dotnet run

test:
dotnet test

format:
dotnet format

drop-db:
cd {{PROJECT_DIR}} && dotnet ef database drop -f --context ApplicationDbContext
add-license-cs:
go install github.com/fbiville/headache/cmd/headache@latest
headache --configuration ./configuration-cs.json
add-migration name:
cd {{PROJECT_DIR}} dotnet ef migrations add --context ApplicationDbContext {{name}}
remove-migration:
cd {{PROJECT_DIR}} dotnet ef migrations remove --context ApplicationDbContext
mine:
while true; do docker exec polar-n1-backend1 bitcoin-cli -regtest -rpcuser=polaruser -rpcpassword=polarpass -generate 1; sleep 60; done

##########
# Docker #
##########

# Builds and runs the development docker containers in the background, add DOCKER_COMPOSE_FILE to override the default file
docker-up *args:
cd {{DOCKER_DIR}} && docker compose -f {{DOCKER_COMPOSE_FILE}} up --build -d {{args}}

# Stops the development docker containers, add DOCKER_COMPOSE_FILE to override the default file
docker-down:
cd {{DOCKER_DIR}} && docker compose -f {{DOCKER_COMPOSE_FILE}} down

# Stops the development docker containers and removes the volumes, add DOCKER_COMPOSE_FILE to override the default file
docker-rm:
cd {{DOCKER_DIR}} && docker compose -f {{DOCKER_COMPOSE_FILE}} down -v
14 changes: 0 additions & 14 deletions justfile

This file was deleted.

6 changes: 4 additions & 2 deletions src/Data/Repositories/FUTXORepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public FUTXORepository(IRepository<FMUTXO> repository,

public async Task<List<FMUTXO>> GetAll()
{
throw new NotImplementedException();
await using var applicationDbContext = await _dbContextFactory.CreateDbContextAsync();

return await applicationDbContext.FMUTXOs.ToListAsync();
}

public async Task<(bool, string?)> AddAsync(FMUTXO type)
Expand Down Expand Up @@ -143,4 +145,4 @@ public async Task<List<FMUTXO>> GetLockedUTXOs(int? ignoredWalletWithdrawalReque
return result;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
}
}
}
}
}
17 changes: 13 additions & 4 deletions src/Proto/nodeguard.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ service NodeGuardService {
rpc AddLiquidityRule(AddLiquidityRuleRequest) returns (AddLiquidityRuleResponse);

/*
Gets a list of available UTXOs for a wallet
Gets a list of available UTXOs for a single wallet
*/
rpc GetAvailableUtxos(GetAvailableUtxosRequest) returns (GetAvailableUtxosResponse);
rpc GetAvailableUtxos(GetAvailableUtxosRequest) returns (GetUtxosResponse);

/*
Gets a list of all UTXOs from all available wallets
*/
rpc GetUtxos(GetUtxosRequest) returns (GetUtxosResponse);

/*
Gets the status for the provided withdrawals request ids
Expand Down Expand Up @@ -312,6 +317,9 @@ enum COIN_SELECTION_STRATEGY
UP_TO_AMOUNT = 3;
}

message GetUtxosRequest {
}

message GetAvailableUtxosRequest {
// Wallet ID as stored in the NG's database
int32 wallet_id = 1;
Expand All @@ -328,9 +336,10 @@ message GetAvailableUtxosRequest {
message Utxo {
int64 amount = 1;
string outpoint = 2;
string address = 3;
}

message GetAvailableUtxosResponse {
message GetUtxosResponse {
repeated Utxo confirmed = 1;
repeated Utxo unconfirmed = 2;
}
Expand Down Expand Up @@ -391,4 +400,4 @@ message AddTagsRequest {
}

message AddTagsResponse {
}
}
Loading
Loading