-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93a5757
commit 17d2631
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |