Skip to content

Commit

Permalink
docs: transaction fees page
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Jul 16, 2023
1 parent 4b85e4a commit 3cdc051
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Providers](./providers.md)
- [Signers](./signers.md)
- [Accounts](./accounts.md)
- [Transaction fees](./transaction-fees.md)
- [Argument resolution](./argument-resolution.md)

# Cookbooks
Expand Down
31 changes: 31 additions & 0 deletions book/src/transaction-fees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Transaction fees

Starknet transactions are priced using a single `max_fee` value, which indicates the maximum amount of fees (in `Wei`) that an account is willing to pay.

For commands that send out transactions, Starkli needs to come up with this value. By default, a fee estimate is requested from the [provider](./providers.md), and a 50% buffer is added on top of the estimate to avoid failures due to price fluctuations.

## Setting `max_fee` manually

It's possible to skip the entire fee estimation process by manually providing a `max_fee` value.

The recommended way to do it is through the `--max-fee` option, which accepts a decimal value in Ether (18 decimals). For example, to perform an `ETH` transfer with a `max_fee` of `0.01 ETH`:

```console
starkli invoke eth transfer 0x1234 u256:100 --max-fee 0.01
```

If you already have the `max_fee` value in `Wei`, it's also possible to use the raw value directly via the `--max-fee-raw` option. An equivalent command to the example above would be:

```console
starkli invoke eth transfer 0x1234 u256:100 --max-fee-raw 10000000000000000
```

## Estimating fee only (dry run)

Commands that send out transactions accept a `--estimate-only` flag, which stops command execution as soon as an estimate is generated.

An example command to estimate the fee for an `ETH` transfer:

```console
starkli invoke eth transfer 0x1234 u256:100 --estimate-only
```

0 comments on commit 3cdc051

Please sign in to comment.