StarknetFees
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:33
A module for starknet fee estimation
Constructors
Constructor
new StarknetFees(
provider,
maxFeeRate,
feeMultiplier,
da): StarknetFees;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:77
Constructs a new Starknet fee module
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
provider | Provider | undefined | A starknet.js provider to use for fee estimation |
maxFeeRate | StarknetFeeRate | ... | Fee rate limits in base units, defaults to L1: 20 PFri, L2: 4 PFri, L1 data: 10 PFri |
feeMultiplier | number | 1.25 | A multiplier to use for the returned fee rates |
da | { fee?: "L1" | "L2"; nonce?: "L1" | "L2"; } | ... | Data-availability mode - currently just L1 |
da.fee? | "L1" | "L2" | undefined | - |
da.nonce? | "L1" | "L2" | undefined | - |
Returns
StarknetFees
Methods
extractFromFeeRateString()
static extractFromFeeRateString(feeRate): StarknetFeeRate;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:147
A utility function for deserializing a stringified starknet fee rate to its constituent fees
Parameters
| Parameter | Type | Description |
|---|---|---|
feeRate | string | Serialized fee rate in format: [l1Gas],[l2Gas],[l1DataGas] |
Returns
getFeeDetails()
getFeeDetails(gas, feeRate): object;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:179
Returns transaction details that apply the corresponding gas limits and gas price to the transaction
Parameters
| Parameter | Type | Description |
|---|---|---|
gas | StarknetGas | Gas limits |
feeRate | string | Fee rate to use for the calculation, serialized as a string: [l1Gas],[l2Gas],[l1DataGas] |
Returns
object
getGasFee()
static getGasFee(gas, feeRate): bigint;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:163
Calculates the total gas fee paid for a given gas limit at a given fee rate
Parameters
| Parameter | Type | Description |
|---|---|---|
gas | StarknetGas | Gas limits |
feeRate | string | Fee rate to use for the calculation, serialized as a string: [l1Gas],[l2Gas],[l1DataGas] |
Returns
bigint
starknetGasAdd()
static starknetGasAdd(a, b?): StarknetGas;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:51
Sums up all the gas parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
a | StarknetGas | |
b? | StarknetGas |
Returns
starknetGasMul()
static starknetGasMul(gas, scalar): StarknetGas;
Defined in: atomiq-chain-starknet/src/starknet/chain/modules/StarknetFees.ts:41
Multiplies all the gas parameters by a specific scalar
Parameters
| Parameter | Type | Description |
|---|---|---|
gas | StarknetGas | |
scalar | number |