-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Problem
The API client library is using old-style paths without the /api/v1 prefix. While the ZHTP node has added backward-compatible aliases (PR #109), the library should be updated to use the canonical /api/v1 paths.
Current State
The library uses these old paths:
/mesh/peers/node/status/blockchain/info/dao/proposals/dao/vote/dao/treasury/dao/data/dao/delegates/wallet/send/health
Required Changes
Update src/core/zhtp-api-methods.ts to use /api/v1 prefix for all endpoints:
| Current Path | Should Be |
|---|---|
/mesh/peers |
/api/v1/blockchain/network/peers |
/node/status |
/api/v1/protocol/info |
/blockchain/info |
/api/v1/blockchain/status |
/dao/proposals |
/api/v1/dao/proposals/list |
/dao/vote |
/api/v1/dao/vote/cast |
/dao/treasury |
/api/v1/dao/treasury/balance |
/dao/data |
/api/v1/dao/data |
/dao/delegates |
/api/v1/dao/delegates |
/dao/delegates/register |
/api/v1/dao/delegates/register |
/dao/delegates/revoke |
/api/v1/dao/delegates/revoke |
/dao/treasury/history |
/api/v1/dao/treasury/history |
/dao/proposals/spending |
/api/v1/dao/proposals/spending |
/wallet/send |
/api/v1/wallet/send |
/health |
/api/v1/protocol/health |
Implementation
File: src/core/zhtp-api-methods.ts
Lines to update:
- Line 375:
/mesh/peers→/api/v1/blockchain/network/peers - Line 412:
/wallet/send→/api/v1/wallet/send - Line 422:
/dao/proposals→/api/v1/dao/proposals/list - Line 450:
/dao/proposals→/api/v1/dao/proposals(create) - Line 462:
/dao/vote→/api/v1/dao/vote/cast - Line 470:
/dao/treasury→/api/v1/dao/treasury/balance - Line 479:
/dao/data→/api/v1/dao/data - Line 483:
/dao/delegates→/api/v1/dao/delegates - Line 491:
/dao/delegates/register→/api/v1/dao/delegates/register - Line 499:
/dao/delegates/revoke→/api/v1/dao/delegates/revoke - Line 507:
/dao/treasury/history→/api/v1/dao/treasury/history - Line 511:
/dao/proposals/spending→/api/v1/dao/proposals/spending - Line 575:
/blockchain/info→/api/v1/blockchain/status - Line 579:
/network/gas→/api/v1/network/gas - Line 583:
/node/status→/api/v1/protocol/info - Line 587:
/mesh/peers→/api/v1/blockchain/network/peers - Line 712:
/node/status→/api/v1/protocol/info
Benefits
- Future-proof: Uses canonical versioned API paths
- Consistency: All endpoints follow same pattern
- Clarity: Explicit about API version
- Best practice: Follows REST API versioning conventions
Acceptance Criteria
- All old-style paths updated to
/api/v1/*format - Library builds successfully
- Tests pass (if any)
- No breaking changes to public API surface
- Version bumped appropriately (minor or patch)
Priority
P1 - HIGH - Good practice, but node aliases provide backward compatibility
Related
- Node PR #109: Added backward-compatible path aliases
- Node Issue #112: Missing endpoint implementations
Metadata
Metadata
Assignees
Labels
No labels