Skip to content

Commit

Permalink
fix: replace /protocol-params endpoint with /protocol-parameters and …
Browse files Browse the repository at this point in the history
…update types
  • Loading branch information
stanvladut committed Aug 27, 2024
1 parent c747a20 commit 22c4646
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 56 deletions.
8 changes: 4 additions & 4 deletions src/api/general/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export const GeneralApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protocolParams: (options: AxiosRequestConfig = {}): RequestArgs => {
const localVarPath = `/protocol-params`;
protocolParameters: (options: AxiosRequestConfig = {}): RequestArgs => {
const localVarPath = `/protocol-parameters`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
Expand Down Expand Up @@ -177,8 +177,8 @@ export const GeneralApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protocolParams(options?: AxiosRequestConfig): () => Promise<TimestampedProtocolParameters> {
const localVarAxiosArgs = localVarAxiosParamCreator.protocolParams(options);
protocolParameters(options?: AxiosRequestConfig): () => Promise<TimestampedProtocolParameters> {
const localVarAxiosArgs = localVarAxiosParamCreator.protocolParameters(options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand Down
4 changes: 2 additions & 2 deletions src/api/general/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class GeneralApi extends BaseAPI {
* @throws {RequiredError}
* @memberof GeneralApi
*/
public protocolParams(options?: AxiosRequestConfig) {
return GeneralApiFp(this.configuration).protocolParams(options)();
public protocolParameters(options?: AxiosRequestConfig) {
return GeneralApiFp(this.configuration).protocolParameters(options)();
}

/**
Expand Down
132 changes: 82 additions & 50 deletions src/api/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ export interface AccountUpdate {
tx_hash: string;
}

/**
*
* @export
* @interface AdaAmount
*/
export interface AdaAmount {
ada: {
lovelace: number;
};
}

/**
* Information decoded from a Cardano address
* @export
Expand Down Expand Up @@ -693,6 +704,21 @@ export interface Bound {
*/
time: number;
}

/**
*
* @export
* @interface BytesSize
*/
export interface BytesSize {
/**
*
* @type {number}
* @memberof BytesSize
*/
bytes: number;
}

/**
*
* @export
Expand Down Expand Up @@ -1185,19 +1211,19 @@ export interface EraSummary {
* @export
* @interface ExUnit
*/
export interface ExUnit {
export interface ExUnit<T> {
/**
* Memory execution units
* @type {number}
* @type {T}
* @memberof ExUnit
*/
memory: number;
memory: T;
/**
* CPU execution units
* @type {number}
* @type {T}
* @memberof ExUnit
*/
steps: number;
cpu: T;
}
/**
*
Expand Down Expand Up @@ -2803,138 +2829,144 @@ export interface Prices {
* @interface ProtocolParameters
*/
export interface ProtocolParameters {
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
coins_per_utxo_byte: number;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
collateral_percentage: number;
/**
*
* @type {{ [key: string]: { [key: string]: number; }; }}
* @memberof ProtocolParameters
*/
cost_models: { [key: string]: { [key: string]: number } };
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
desired_number_of_pools: number;
desired_number_of_stake_pools: number;
/**
*
* @type {number}
* Maximum number of bytes allowed for a block body
* @type {BytesSize}
* @memberof ProtocolParameters
*/
max_block_body_size: number;
max_block_body_size: BytesSize;
/**
*
* @type {number}
* Maximum number of bytes allowed for a block header
* @type {BytesSize}
* @memberof ProtocolParameters
*/
max_block_header_size: number;
max_block_header_size: BytesSize;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
max_collateral_inputs: number;
/**
*
* Maximum execution units allowed for a block
* @type {ExUnit}
* @memberof ProtocolParameters
*/
max_execution_units_per_block: ExUnit;
max_execution_units_per_block: ExUnit<number>;
/**
*
* Maximum execution units allowed for a transaction
* @type {ExUnit}
* @memberof ProtocolParameters
*/
max_execution_units_per_transaction: ExUnit;
max_execution_units_per_transaction: ExUnit<number>;
/**
*
* Maximum number of bytes allowed for a transaction
* @type {number}
* @memberof ProtocolParameters
*/
max_tx_size: number;
max_transaction_size: BytesSize;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
max_value_size: number;
max_value_size: BytesSize;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
min_fee_coefficient: number;
/**
*
* @type {number}
* Minimum ADA fee
* @type {AdaAmount}
* @memberof ProtocolParameters
*/
min_fee_constant: number;
min_fee_constant: AdaAmount;
/**
* Minimum stake pool cost
* @type {AdaAmount}
* @memberof ProtocolParameters
*/
min_stake_pool_cost: AdaAmount;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
min_pool_cost: number;
min_utxo_deposit_coefficient: number;
/**
* Minimum UTxO deposit amount
* @type {AdaAmount}
* @memberof ProtocolParameters
*/
min_utxo_deposit_constant: AdaAmount;
/**
*
* @type {string}
* @memberof ProtocolParameters
*/
monetary_expansion: string;
/**
*
* @type {number}
* Plutust script execution cost models
* @type {{ plutus_v1: number[]; plutus_v2: number[] }}
* @memberof ProtocolParameters
*/
pool_deposit: number;
plutus_cost_models: { plutus_v1: number[]; plutus_v2: number[] };
/**
*
* @type {string}
* Script execution prices
* @type {ExUnit}
* @memberof ProtocolParameters
*/
pool_influence: string;
script_execution_prices: ExUnit<string>;
/**
*
* @type {number}
* Stake deposit amount
* @type {AdaAmount}
* @memberof ProtocolParameters
*/
pool_retirement_epoch_bound: number;
stake_credential_deposit: AdaAmount;
/**
*
* @type {Prices}
* Stake deposit amount
* @type {AdaAmount}
* @memberof ProtocolParameters
*/
prices: Prices;
stake_pool_deposit: AdaAmount;
/**
*
* @type {Version}
* @type {string}
* @memberof ProtocolParameters
*/
protocol_version: Version;
stake_pool_pledge_influence: string;
/**
*
* @type {number}
* @memberof ProtocolParameters
*/
stake_key_deposit: number;
stake_pool_retirement_epoch_bound: number;
/**
*
* @type {string}
* @memberof ProtocolParameters
*/
treasury_expansion: string;
/**
*
* @type {Version}
* @memberof ProtocolParameters
*/
version: Version;
}
/**
*
Expand Down

0 comments on commit 22c4646

Please sign in to comment.