# EVMFees

Defined in: [atomiq-chain-evm/src/evm/chain/modules/EVMFees.ts:19](https://github.com/atomiqlabs/atomiq-chain-evm/blob/98ca6f16fbfb37e521f8c27b4f942642fe00c2ee/src/evm/chain/modules/EVMFees.ts#L19)

Fee estimation service for EVM chains.

## Extended by

* [`CitreaFees`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-evm/src/classes/CitreaFees.md)

## Constructors

### Constructor

```
new EVMFees(

   provider, 

   maxFeeRatePerGas, 

   priorityFee, 

   feeMultiplier): EVMFees;
```

Defined in: [atomiq-chain-evm/src/evm/chain/modules/EVMFees.ts:59](https://github.com/atomiqlabs/atomiq-chain-evm/blob/98ca6f16fbfb37e521f8c27b4f942642fe00c2ee/src/evm/chain/modules/EVMFees.ts#L59)

#### Parameters

| Parameter          | Type                 | Default value | Description                                                         |
| ------------------ | -------------------- | ------------- | ------------------------------------------------------------------- |
| `provider`         | `JsonRpcApiProvider` | `undefined`   | Underlying RPC provider providing read access to the EVM network    |
| `maxFeeRatePerGas` | `bigint`             | `...`         | Maximum fee rate for a transaction, default to 500 GWei             |
| `priorityFee`      | `bigint`             | `...`         | Priority fee (or tip) to add to the transactions, default to 1 GWei |
| `feeMultiplier`    | `number`             | `1.25`        | Fee multiplier to multiply the RPC-returned fee rate with           |

#### Returns

`EVMFees`

## Methods

### applyFeeRate()

```
static applyFeeRate(

   tx, 

   gas, 

   feeRate): void;
```

Defined in: [atomiq-chain-evm/src/evm/chain/modules/EVMFees.ts:137](https://github.com/atomiqlabs/atomiq-chain-evm/blob/98ca6f16fbfb37e521f8c27b4f942642fe00c2ee/src/evm/chain/modules/EVMFees.ts#L137)

Applies the gas limit and fee rate to a transaction

#### Parameters

| Parameter | Type                 | Description                                                                         |
| --------- | -------------------- | ----------------------------------------------------------------------------------- |
| `tx`      | `TransactionRequest` | EVM Transaction to apply the fee rate to                                            |
| `gas`     | `number`             | Gas limit to add to the transaction                                                 |
| `feeRate` | `string`             | Serialized fee rate to add to the transaction, in format: `<baseFee>,<priorityFee>` |

#### Returns

`void`

***

### getFeeRate()

```
getFeeRate(): Promise<string>;
```

Defined in: [atomiq-chain-evm/src/evm/chain/modules/EVMFees.ts:91](https://github.com/atomiqlabs/atomiq-chain-evm/blob/98ca6f16fbfb37e521f8c27b4f942642fe00c2ee/src/evm/chain/modules/EVMFees.ts#L91)

Gets the gas price with caching, format: `<base fee Wei>,<priority fee Wei>`

#### Returns

`Promise`<`string`>

***

### getGasFee()

```
static getGasFee(gas, feeRate): bigint;
```

Defined in: [atomiq-chain-evm/src/evm/chain/modules/EVMFees.ts:122](https://github.com/atomiqlabs/atomiq-chain-evm/blob/98ca6f16fbfb37e521f8c27b4f942642fe00c2ee/src/evm/chain/modules/EVMFees.ts#L122)

Calculates the total gas fee paid for a given gas limit at a given fee rate

#### Parameters

| Parameter | Type     | Description                                                                         |
| --------- | -------- | ----------------------------------------------------------------------------------- |
| `gas`     | `number` | Gas limit to add to the transaction                                                 |
| `feeRate` | `string` | Serialized fee rate to add to the transaction, in format: `<baseFee>,<priorityFee>` |

#### Returns

`bigint`
