Skip to content

Commit

Permalink
chore: move gas and timeout details to Engine FAQ (#4914)
Browse files Browse the repository at this point in the history
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating the documentation for transaction settings in the `Engine` feature. It clarifies the structure and usage of `txOverrides` for sending native currency and overriding gas settings, including examples and warnings about transaction timeouts.

### Detailed summary
- Changed keys in `txOverrides` from unquoted to quoted strings in the JSON structure.
- Added a section on sending native currency with examples.
- Introduced a section on overriding gas settings with examples.
- Included a warning about setting a timeout for transactions.
- Added a section on specifying transaction timeouts with examples.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
arcoraven committed Oct 3, 2024
1 parent b31ab5a commit b2276e9
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 22 deletions.
62 changes: 62 additions & 0 deletions apps/portal/src/app/engine/faq/page.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Callout } from "@doc";

# FAQ

## About Engine
Expand Down Expand Up @@ -45,6 +47,66 @@ Here are three ways to determine when the job is mined:
};
```

### How do I send native currency with my transaction?

To send native tokens (e.g. ETH on Ethereum), set `txOverrides.value`.
This may be required when calling a `payable` contract method.

Here's an example of sending 0.2 ETH:
```json
{
// ...other arguments in the write transaction
"txOverrides": {
"value": "200000000000000000"
}
}
```
### How do I override gas settings?
To override the gas settings, set relevant `txOverrides` gas fields.
Each field is optional and will be estimated by Engine if omitted.
Here's an example of setting a gas limit of 210,000 gas units, 1 gwei max fee, and 1 gwei max priority fee:

```json
{
// ...other arguments in the write transaction
"txOverrides": {
"gas": "210000",
"maxFeePerGas": "1000000000",
"maxPriorityFeePerGas": "1000000000"
}
}
```

<Callout variant='warning' title="It is highly recommended to set a timeout when setting a maxFeePerGas.">

Otherwise if gas prices don't fall, transactions may be in your queue indefinitely.
</Callout>
### How do I set a timeout on transactions?
To specify a transaction timeout, set `txOverrides.timeoutSeconds`.
Engine flags transactions as `errored` if they are not sent before the timeout. An `errored` webhook will be sent.
Note: A transaction sent before the timeout may be mined after the timeout.
Here's an example of a 2-hour timeout:
```json
{
// ...other arguments in the write transaction
"txOverrides": {
"timeoutSeconds": 7200
}
}
```

### How do I customize my RPC?

Use [Update Chain Configuration](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Configuration/operation/updateChainsConfiguration) to override a chain's settings.
Expand Down
26 changes: 4 additions & 22 deletions apps/portal/src/app/engine/features/contracts/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,14 @@ To send native tokens to a payable method (e.g. ETH on Ethereum), set `txOverrid

```json
{
functionName: "...",
args: [ ... ],
txOverrides: {
value: 1000000000000000, // 0.001 ETH in wei
"functionName": "...",
"args": [ ... ],
"txOverrides": {
"value": "1000000000000000", // 0.001 ETH in wei
}
}
```

### Override gas settings

To override the gas settings for your transaction, set `txOverrides` in the request body to any write transaction. Each of these fields are optional and will be estimated by Engine if omitted.

```json
{
functionName: "...",
args: [ ... ],
txOverrides: {
// The limit of gas units to use for this transaction.
gas: "530000",
// The max fee (e.g. gas price) to use in wei.
maxFeePerGas: "1000000000",
// The max priority fee to use in wei.
maxPriorityFeePerGas: "1000000000",
}
```

## Read from a contract

```ts
Expand Down

0 comments on commit b2276e9

Please sign in to comment.