Skip to content

Commit

Permalink
created feemarketAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
freeelancer committed Jan 25, 2024
1 parent 93a5757 commit 17d2631
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/client/lcd/api/FeemarketAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Params } from '@terra-money/terra.proto/feemarket/feemarket/v1/params';
import {
BaseFeeResponse,
StateResponse,
} from '@terra-money/terra.proto/feemarket/feemarket/v1/query';
import { APIParams, PaginationOptions } from '../APIRequester';
import { LCDClient } from '../LCDClient';
import { BaseAPI } from './BaseAPI';

export class FeemarketAPI extends BaseAPI {
constructor(public lcd: LCDClient) {
super(lcd.apiRequesters, lcd.config);
}

/**
* Query the feemarket module params
*
* @tags Query
* @name params
* @request GET:/feemarket/v1/params
*/
public async params(
chainId: string,
params: Partial<PaginationOptions & APIParams> = {}
) {
return this.getReqFromChainID(chainId).get<{ params: Params }>(
`/feemarket/v1/params`,
params
);
}

/**
* Query all paginated feemarket states. When fee_denom is not specified, it returns all states,
* otherwise it returns the state of the specific fee_denom.
*
* @tags Query
* @name state
* @summary Query all paginated states of feemarket fee_denoms.
* @request GET:/feemarket/v1/state or GET:/feemarket/v1/state?fee_denom=${feeDenom}
*/
public async state(
chainId: string,
feeDenom?: string,
params?: Partial<PaginationOptions & APIParams>
) {
const url = feeDenom
? `/feemarket/v1/state?fee_denom=${feeDenom}`
: `/feemarket/v1/state`;

return this.getReqFromChainID(chainId).get<StateResponse>(url, params);
}

/**
* Query the current basefee for fee_denom.
*
* @tags Query
* @name baseFee
* @summary Query the current basefee for fee_denom.
* @request GET:/feemarket/v1/base_fee?fee_denom=${feeDenom}
*/
public async baseFee(
chainId: string,
feeDenom: string,
params?: Partial<PaginationOptions & APIParams>
) {
const url = `/feemarket/v1/base_fee?fee_denom=${feeDenom}`;

return this.getReqFromChainID(chainId).get<BaseFeeResponse>(url, params);
}
}

0 comments on commit 17d2631

Please sign in to comment.