Skip to content
Merged
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
34 changes: 17 additions & 17 deletions src/core/zhtp-api-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
// ==================== Network Operations ====================

async getNetworkInfo(): Promise<NetworkStatus> {
return this.request<NetworkStatus>('/mesh/peers');
return this.request<NetworkStatus>('/api/v1/blockchain/network/peers');
}

// ==================== Wallet & Transaction Operations ====================
Expand Down Expand Up @@ -409,7 +409,7 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
amount: number,
metadata?: Record<string, any>
): Promise<Transaction> {
return this.request<Transaction>('/wallet/send', {
return this.request<Transaction>('/api/v1/wallet/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ from, to, amount, metadata }),
Expand All @@ -419,7 +419,7 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
// ==================== DAO Operations ====================

async getDaoProposals(): Promise<DaoProposal[]> {
return this.request<DaoProposal[]>('/dao/proposals');
return this.request<DaoProposal[]>('/api/v1/dao/proposals/list');
}

async getDaoStats(): Promise<DaoStats> {
Expand Down Expand Up @@ -447,7 +447,7 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
}

async createProposal(proposal: any): Promise<DaoProposal> {
return this.request<DaoProposal>('/dao/proposals', {
return this.request<DaoProposal>('/api/v1/dao/proposals', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(proposal),
Expand All @@ -459,15 +459,15 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
vote: boolean,
voterDid: string
): Promise<void> {
await this.request<void>('/dao/vote', {
await this.request<void>('/api/v1/dao/vote/cast', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ proposalId, vote, voterDid }),
});
}

async getDaoTreasury(): Promise<number> {
const response = await this.request<any>('/dao/treasury');
const response = await this.request<any>('/api/v1/dao/treasury/balance');
return response?.balance || 0;
}

Expand All @@ -476,39 +476,39 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
}

async getDaoData(): Promise<Record<string, any>> {
return this.request<Record<string, any>>('/dao/data');
return this.request<Record<string, any>>('/api/v1/dao/data');
}

async getDaoDelegates(): Promise<Delegate[]> {
return this.request<Delegate[]>('/dao/delegates');
return this.request<Delegate[]>('/api/v1/dao/delegates');
}

async getDelegateProfile(delegateId: string): Promise<Delegate> {
return this.request<Delegate>(`/dao/delegates/${delegateId}`);
}

async registerDelegate(userDid: string, delegateInfo: Record<string, any>): Promise<Delegate> {
return this.request<Delegate>('/dao/delegates/register', {
return this.request<Delegate>('/api/v1/dao/delegates/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userDid, delegateInfo }),
});
}

async revokeDelegation(userDid: string): Promise<void> {
await this.request<void>('/dao/delegates/revoke', {
await this.request<void>('/api/v1/dao/delegates/revoke', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userDid }),
});
}

async getTreasuryHistory(): Promise<TreasuryRecord[]> {
return this.request<TreasuryRecord[]>('/dao/treasury/history');
return this.request<TreasuryRecord[]>('/api/v1/dao/treasury/history');
}

async createSpendingProposal(proposalData: Record<string, any>): Promise<DaoProposal> {
return this.request<DaoProposal>('/dao/proposals/spending', {
return this.request<DaoProposal>('/api/v1/dao/proposals/spending', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(proposalData),
Expand Down Expand Up @@ -572,19 +572,19 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {
// ==================== Blockchain Operations ====================

async getBlockchainInfo(): Promise<any> {
return this.request<any>('/blockchain/info');
return this.request<any>('/api/v1/blockchain/status');
}

async getGasInfo(): Promise<any> {
return this.request<any>('/network/gas');
return this.request<any>('/api/v1/network/gas');
}

async getNodeStatus(): Promise<NodeStatus> {
return this.request<NodeStatus>('/node/status');
return this.request<NodeStatus>('/api/v1/protocol/info');
}

async getMeshPeers(): Promise<{ peers: string[]; count: number }> {
return this.request<{ peers: string[]; count: number }>('/mesh/peers');
return this.request<{ peers: string[]; count: number }>('/api/v1/blockchain/network/peers');
}

async getNetworkStats(): Promise<{
Expand Down Expand Up @@ -709,7 +709,7 @@ export abstract class ZhtpApiMethods extends ZhtpApiCore {

async getProtocolInfo() {
try {
const response = await this.request<any>('/node/status');
const response = await this.request<any>('/api/v1/protocol/info');

return {
success: true,
Expand Down