Files
stealth/backend/requests/wallet.http
LORDBABUINO 1f7ecf321c 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)
2026-02-27 02:06:31 -03:00

50 lines
1.9 KiB
HTTP

@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");
});
});
%}