Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/developers/evm/api/hyper-fungible-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ function onAccept(IncomingPostRequest calldata incoming) external onlyHost whenN

---

### onPostRequestTimeout(request)
### onPostRequestTimeout(incoming)

Called when a sent message times out. Re-mints tokens to the original sender.

```solidity lineNumbers
function onPostRequestTimeout(PostRequest memory request) external onlyHost whenNotPaused
function onPostRequestTimeout(PostRequestTimeout memory incoming) external onlyHost whenNotPaused
```

---
Expand Down
8 changes: 4 additions & 4 deletions docs/content/developers/evm/api/hyperapp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ function onAccept(IncomingPostRequest calldata incoming) external virtual onlyHo
Called when a POST request you sent has timed out. Override to handle cleanup. Default implementation reverts with `UnexpectedCall()`.

```solidity lineNumbers
function onPostRequestTimeout(PostRequest memory request) external virtual onlyHost
function onPostRequestTimeout(PostRequestTimeout memory incoming) external virtual onlyHost
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | `PostRequest` | The timed-out request |
| `incoming` | `PostRequestTimeout` | The timed-out POST request and the relayer that submitted the timeout proof |

**Access:** Only callable by Host

Expand Down Expand Up @@ -176,12 +176,12 @@ function onGetResponse(IncomingGetResponse memory incoming) external virtual onl
Called when a GET request you sent has timed out. Default implementation reverts with `UnexpectedCall()`.

```solidity lineNumbers
function onGetTimeout(GetRequest memory request) external virtual onlyHost
function onGetTimeout(GetRequestTimeout memory incoming) external virtual onlyHost
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | `GetRequest` | The timed-out GET request |
| `incoming` | `GetRequestTimeout` | The timed-out GET request and the relayer that submitted the timeout proof |

**Access:** Only callable by Host

Expand Down
44 changes: 40 additions & 4 deletions docs/content/developers/evm/api/iapp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ function onAccept(IncomingPostRequest calldata incoming) external
Called when a POST request you sent has timed out on the destination chain.

```solidity lineNumbers
function onPostRequestTimeout(PostRequest memory request) external
function onPostRequestTimeout(PostRequestTimeout memory incoming) external
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | `PostRequest` | The timed-out POST request |
| `incoming` | `PostRequestTimeout` | Struct containing the timed-out POST request and the relayer that submitted the timeout proof |

**Access:** Only callable by the Host contract

Expand Down Expand Up @@ -115,12 +115,12 @@ function onGetResponse(IncomingGetResponse memory incoming) external
Called when a GET request you sent has timed out.

```solidity lineNumbers
function onGetTimeout(GetRequest memory request) external
function onGetTimeout(GetRequestTimeout memory incoming) external
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | `GetRequest` | The timed-out GET request |
| `incoming` | `GetRequestTimeout` | Struct containing the timed-out GET request and the relayer that submitted the timeout proof |

**Access:** Only callable by the Host contract

Expand Down Expand Up @@ -174,6 +174,42 @@ struct IncomingGetResponse {

---

### PostRequestTimeout

Encapsulates a timed-out POST request with relayer information.

```solidity lineNumbers
struct PostRequestTimeout {
PostRequest request;
address relayer;
}
```

| Field | Type | Description |
|-------|------|-------------|
| `request` | `PostRequest` | The timed-out POST request |
| `relayer` | `address` | Who submitted the timeout proof |

---

### GetRequestTimeout

Encapsulates a timed-out GET request with relayer information.

```solidity lineNumbers
struct GetRequestTimeout {
GetRequest request;
address relayer;
}
```

| Field | Type | Description |
|-------|------|-------------|
| `request` | `GetRequest` | The timed-out GET request |
| `relayer` | `address` | Who submitted the timeout proof |

---

### PostRequest

Represents a POST request.
Expand Down
12 changes: 6 additions & 6 deletions docs/content/developers/evm/api/ihost.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,21 @@ function dispatchIncoming(GetResponse memory response, address relayer) external

---

### dispatchTimeOut(GetRequest)
### dispatchTimeOut(GetRequestTimeout)

Dispatches a timed-out GET request to the source application's `onGetTimeout()` callback.

```solidity lineNumbers
function dispatchTimeOut(
GetRequest memory timeout,
GetRequestTimeout memory timeout,
FeeMetadata memory meta,
bytes32 commitment
) external
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `timeout` | `GetRequest` | The timed-out GET request |
| `timeout` | `GetRequestTimeout` | The timed-out GET request bundled with the relayer that submitted the timeout proof |
| `meta` | `FeeMetadata` | Fee metadata |
| `commitment` | `bytes32` | Request commitment hash |

Expand All @@ -393,21 +393,21 @@ function dispatchTimeOut(

---

### dispatchTimeOut(PostRequest)
### dispatchTimeOut(PostRequestTimeout)

Dispatches a timed-out POST request to the source application's `onPostRequestTimeout()` callback. If the callback succeeds, refunds the relayer fee to the payer.

```solidity lineNumbers
function dispatchTimeOut(
PostRequest memory timeout,
PostRequestTimeout memory timeout,
FeeMetadata memory meta,
bytes32 commitment
) external
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `timeout` | `PostRequest` | The timed-out POST request |
| `timeout` | `PostRequestTimeout` | The timed-out POST request bundled with the relayer that submitted the timeout proof |
| `meta` | `FeeMetadata` | Fee metadata (contains payer and relayer fee) |
| `commitment` | `bytes32` | Request commitment hash |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ function onAccept(IncomingPostRequest calldata incoming) external onlyHost whenN

---

## onPostRequestTimeout(request)
## onPostRequestTimeout(incoming)

Called when a sent message times out. For WETH: unwraps and sends native tokens. For ERC20: transfers the underlying back to the sender.

```solidity lineNumbers
function onPostRequestTimeout(PostRequest calldata request) external onlyHost whenNotPaused
function onPostRequestTimeout(PostRequestTimeout calldata incoming) external onlyHost whenNotPaused
```

---
Expand Down
13 changes: 7 additions & 6 deletions docs/content/developers/evm/messaging/get-requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -576,19 +576,20 @@ Your contract must implement [`onGetTimeout()`](/developers/evm/api/iapp#ongetti

```solidity lineNumbers title="MyApp.sol"
contract MyApp is HyperApp {
function onGetTimeout(GetRequest memory request)
function onGetTimeout(GetRequestTimeout memory incoming)
external
override
onlyHost
{
// Clean up any pending state associated with the request
bytes32 commitment = request.hash();

// `incoming.request` is the timed-out GET request.
// `incoming.relayer` is the relayer that submitted the timeout proof.
bytes32 commitment = incoming.request.hash();

// Remove tracked request
delete pendingRequests[commitment];

// Emit event for off-chain tracking
emit GetRequestTimedOut(commitment, request.dest, request.keys);
emit GetRequestTimedOut(commitment, incoming.request.dest, incoming.request.keys);
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion docs/content/developers/evm/messaging/post-requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,13 @@ Your contract must implement `onPostRequestTimeout` to handle timed-out requests

```solidity lineNumbers title="MyApp.sol"
contract MyApp is HyperApp {
function onPostRequestTimeout(PostRequest memory request)
function onPostRequestTimeout(PostRequestTimeout memory incoming)
external
override
onlyHost
{
// `incoming.request` is the timed-out POST request.
// `incoming.relayer` is the relayer that submitted the timeout proof.
// Handle the timeout - maybe refund user or retry
emit RequestTimedOut(commitment, user, amount);
}
Expand Down
6 changes: 4 additions & 2 deletions docs/content/developers/evm/messaging/receiving.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ contract CrossChainMessenger is HyperApp {
}

// Optional: Handle timeouts
function onPostRequestTimeout(PostRequest memory request)
function onPostRequestTimeout(PostRequestTimeout memory incoming)
external
override
onlyHost
{
// Cleanup logic when messages timeout
// Cleanup logic when messages timeout. `incoming.request` is the
// original POST request and `incoming.relayer` is the relayer that
// submitted the timeout proof.
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion evm/rust/abi/EvmHost.json

Large diffs are not rendered by default.

Loading
Loading