Feat: Wire frontend to backend, add wallet API endpoints

- Replace frontend mock with real fetch calls to POST /api/wallet/analyze and GET /api/wallet/{id}/utxos
- Add Vite dev proxy for /api to avoid CORS in development
- Implement WalletResource.java with the two endpoints
- Add WalletMockData.java with the 5-UTXO dataset
- Configure CORS and port in application.properties
- Add backend/requests/wallet.http with kulala tests (29 assertions, all passing)
This commit is contained in:
LORDBABUINO
2026-02-26 23:14:19 -03:00
parent e6a8e77134
commit 1f7ecf321c
5 changed files with 207 additions and 4 deletions
+49
View File
@@ -0,0 +1,49 @@
@baseUrl = http://localhost:8080
@descriptor = wpkh([a1b2c3d4/84h/0h/0h]xpub6CatWdiZynkCminahu8Gmr7FAVnQXBTSMaBxn6qmBNkdm9tDkFzWmjmDrLBCQSTa7BHgpEjCXzMTCyDsQLSmcGYJHBB7cTwpqLNRKGP47uw/0/*)#qwer1234
### Analyze wallet
# @name analyze
POST {{baseUrl}}/api/wallet/analyze
Content-Type: application/json
{
"descriptor": "{{descriptor}}"
}
> {%
client.test("status is 200", function() {
client.assert(response.status === 200, "expected 200");
});
client.test("response has analysisId", function() {
client.assert(typeof response.body.analysisId === "string", "expected analysisId string");
client.assert(response.body.analysisId.length > 0, "expected non-empty analysisId");
});
%}
### Get UTXOs
GET {{baseUrl}}/api/wallet/{{analyze.response.body.$.analysisId}}/utxos
> {%
client.test("status is 200", function() {
client.assert(response.status === 200, "expected 200");
});
client.test("response has descriptor", function() {
client.assert(typeof response.body.descriptor === "string", "expected descriptor string");
});
client.test("summary totals are correct", function() {
client.assert(response.body.summary.total === 5, "expected 5 utxos");
client.assert(response.body.summary.clean === 1, "expected 1 clean");
client.assert(response.body.summary.vulnerable === 4, "expected 4 vulnerable");
});
client.test("utxos array has 5 items", function() {
client.assert(response.body.utxos.length === 5, "expected 5 utxos in array");
});
client.test("each utxo has required fields", function() {
response.body.utxos.forEach(function(utxo) {
client.assert(typeof utxo.txid === "string", "expected txid");
client.assert(typeof utxo.address === "string", "expected address");
client.assert(typeof utxo.amountBtc === "number", "expected amountBtc");
client.assert(Array.isArray(utxo.vulnerabilities), "expected vulnerabilities array");
});
});
%}