Updated all API methods in src/core/zhtp-api-methods.ts to use the standardized /api/v1 path prefix, ensuring compatibility with the ZHTP node's current API structure.
All wallet methods now use /api/v1/wallet prefix:
-
getWallets() (line 381)
- ❌ Old:
/wallet/balance?address=... - ✅ New:
/api/v1/wallet/balance?address=...
- ❌ Old:
-
getTransactionHistory() (line 395)
- ❌ Old:
/wallet/transactions?address=... - ✅ New:
/api/v1/wallet/transactions?address=...
- ❌ Old:
-
getAssets() (line 403)
- ❌ Old:
/wallet/assets?address=... - ✅ New:
/api/v1/wallet/assets?address=...
- ❌ Old:
All DAO methods now use /api/v1/dao prefix:
-
getProposalDetails() (line 475)
- ❌ Old:
/dao/proposals/${proposalId} - ✅ New:
/api/v1/dao/proposals/${proposalId}
- ❌ Old:
-
getDelegateProfile() (line 487)
- ❌ Old:
/dao/delegates/${delegateId} - ✅ New:
/api/v1/dao/delegates/${delegateId}
- ❌ Old:
-
getVotingPower() (line 521)
- ❌ Old:
/dao/voting-power/${userDid} - ✅ New:
/api/v1/dao/voting-power/${userDid}
- ❌ Old:
-
getUserVotes() (line 532)
- ❌ Old:
/dao/user-votes/${userDid} - ✅ New:
/api/v1/dao/user-votes/${userDid}
- ❌ Old:
The following sections were already using /api/v1 paths correctly:
✅ Identity Operations (lines 44-370)
- All
/api/v1/identity/*endpoints
✅ Backup Operations (lines 198-219)
- All
/api/v1/identity/backup/*endpoints
✅ Guardian Management (lines 238-305)
- All
/api/v1/guardian/*and/api/v1/identity/guardians/*endpoints
✅ Network Operations (lines 375, 607)
/api/v1/blockchain/network/peers
✅ Blockchain Operations (lines 595-642)
- All
/api/v1/blockchain/*endpoints
✅ Smart Contract Operations (lines 641-684)
- All
/api/v1/blockchain/contracts/*endpoints - All
/api/v1/contract/*endpoints
✅ Zero-Knowledge Proof Operations (lines 689-708)
/api/v1/zkp/generate/api/v1/zkp/verify
✅ Protocol Operations (lines 599, 603, 726)
/api/v1/protocol/info/api/v1/network/gas
✅ Web4/DHT Operations (lines 539-590)
- All
/api/v1/dht/*and/api/v1/web4/*endpoints
The ZHTP node supports backward compatibility through path aliases (see zhtp/src/server/http/router.rs:187-256):
/wallet/*→/api/v1/wallet/*✅/dao/*→/api/v1/dao/*✅/mesh/peers→/api/v1/blockchain/network/peers✅/node/status→/api/v1/protocol/info✅/blockchain/info→/api/v1/blockchain/status✅/contract/*→/api/v1/blockchain/contracts/*✅
Result: Even though we updated the client to use /api/v1 paths, the old paths would have still worked due to node-side aliasing. However, using the standard paths directly is cleaner and more future-proof.
Total API methods checked: 70+ methods
Path Distribution:
- Methods using
/api/v1: 70 methods ✅ - Methods using
/health: 1 method ✅ (health check endpoint) - Methods using legacy paths: 0 methods ✅
All paths now conform to the /api/v1 standard!
-
Wallet Methods Test:
await client.getWallets(testDid); await client.getTransactionHistory(testAddress); await client.getAssets(testAddress);
-
DAO Methods Test:
await client.getProposalDetails(testProposalId); await client.getDelegateProfile(testDelegateId); await client.getVotingPower(testDid); await client.getUserVotes(testDid);
-
End-to-End Test:
- Run full API client test suite against ZHTP node
- Verify all methods return expected responses
- Check error handling for invalid paths
Breaking Changes: ❌ None
- All changes are path updates only
- No method signatures changed
- No request/response formats changed
- Backward compatible with existing code
Benefits:
- ✅ Consistent API path structure
- ✅ Future-proof against potential removal of legacy aliases
- ✅ Clearer API documentation
- ✅ Easier to maintain and understand
src/core/zhtp-api-methods.ts- 7 path updates
- Issue #18: [P1] Verify and update API paths to /api/v1 standard
- Parent Issue #17: Implementation Guide - Complete ZHTP Node API Endpoint Reference
- Node Issue SOVEREIGN-NET/The-Sovereign-Network#112 (closed - all endpoints implemented)
- Run TypeScript compilation check
- Run test suite
- Update issue #18 with completion status
- Move to Priority 2: Backup & Recovery methods (Issue #19)