Skip to content

[FRONTEND]: Network gas pricing endpoint missing #10

@umwelt

Description

@umwelt

Problem

The API client library has a getGasInfo() method that calls /network/gas but should use the versioned path /api/v1/network/gas.

Current State

The library currently uses:

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

Required Change

Update the path to use the /api/v1 prefix:

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

Implementation

File: src/core/zhtp-api-methods.ts
Line: 579

Change:

return this.request<any>('/network/gas');

To:

return this.request<GasInfo>('/api/v1/network/gas');

Type Definition

Ensure GasInfo type is properly defined in src/core/types.ts:

export interface GasInfo {
  gasPrice: number;
  estimatedCost: number;
  baseFee?: number;
  priorityFee?: number;
}

Benefits

  1. Consistency: Uses /api/v1 prefix like other endpoints
  2. Type Safety: Uses GasInfo type instead of any
  3. Future-proof: Aligns with node's versioned API

Dependencies

Blocked by: Node Issue #112 - Missing /api/v1/network/gas endpoint

The node must implement this endpoint first before the library method will work.

Acceptance Criteria

  • Path updated from /network/gas to /api/v1/network/gas
  • Return type changed from any to GasInfo
  • GasInfo type properly defined
  • Library builds successfully
  • Method will work once node implements endpoint

Priority

P1 - HIGH - Required for transaction fee estimation in wallet

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions