Skip to content
Open
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
14 changes: 14 additions & 0 deletions python/coinbase-agentkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,20 @@ This section provides a detailed list of all available action providers and thei
</table>
</details>

<details>
<summary><strong>Hyperlane</strong></summary>
<table width="100%">
<tr>
<td width="200"><code>transfer_remote</code></td>
<td width="768">Bridges an ERC-20 token to a recipient on another chain via a Hyperlane Warp Route.</td>
</tr>
<tr>
<td width="200"><code>quote_transfer_remote</code></td>
<td width="768">Previews the interchain gas payment for a Hyperlane Warp Route transfer to a destination chain.</td>
</tr>
</table>
</details>

<details>
<summary><strong>Morpho</strong></summary>
<table width="100%">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added new Hyperlane action provider for cross-chain ERC-20 transfers via Hyperlane Warp Routes. The provider supports `transfer_remote` and `quote_transfer_remote` from Base, Ethereum, Optimism, and Arbitrum mainnets.
2 changes: 2 additions & 0 deletions python/coinbase-agentkit/coinbase_agentkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
erc20_action_provider,
erc721_action_provider,
hyperbolic_action_provider,
hyperlane_action_provider,
morpho_action_provider,
nillion_action_provider,
onramp_action_provider,
Expand Down Expand Up @@ -68,6 +69,7 @@
"erc20_action_provider",
"erc721_action_provider",
"hyperbolic_action_provider",
"hyperlane_action_provider",
"morpho_action_provider",
"nillion_action_provider",
"onramp_action_provider",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
HyperbolicActionProvider,
hyperbolic_action_provider,
)
from .hyperlane.hyperlane_action_provider import (
HyperlaneActionProvider,
hyperlane_action_provider,
)
from .morpho.morpho_action_provider import MorphoActionProvider, morpho_action_provider
from .nillion.nillion_action_provider import NillionActionProvider, nillion_action_provider
from .onramp.onramp_action_provider import OnrampActionProvider, onramp_action_provider
Expand Down Expand Up @@ -51,6 +55,7 @@
"ERC20ActionProvider",
"Erc721ActionProvider",
"HyperbolicActionProvider",
"HyperlaneActionProvider",
"MorphoActionProvider",
"NillionActionProvider",
"OnrampActionProvider",
Expand All @@ -72,6 +77,7 @@
"erc20_action_provider",
"erc721_action_provider",
"hyperbolic_action_provider",
"hyperlane_action_provider",
"morpho_action_provider",
"nillion_action_provider",
"onramp_action_provider",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Hyperlane Action Provider

This directory contains the **HyperlaneActionProvider** implementation, which provides actions for cross-chain ERC-20 token transfers via [Hyperlane](https://hyperlane.xyz/) Warp Routes.

## Directory Structure

```
hyperlane/
├── hyperlane_action_provider.py # Hyperlane action provider
├── constants.py # Domain IDs and Warp Route ABI
├── schemas.py # Action input schemas
├── utils.py # Encoding and ERC-20 helpers
├── __init__.py # Main exports
└── README.md # This file

# From python/coinbase-agentkit/
tests/action_providers/hyperlane/
├── conftest.py # Test fixtures
├── test_hyperlane_provider.py # Provider-level tests
├── test_hyperlane_schemas.py # Schema validation tests
└── test_hyperlane_transfer.py # transfer_remote action tests
```

## Actions

- `transfer_remote`: Bridge an ERC-20 to a recipient on another chain via a Hyperlane Warp Route.
- `quote_transfer_remote`: Preview the interchain gas payment for a Warp Route transfer to a destination chain.

## Network Support

Origin chains (the network the current wallet is connected to):

- Base Mainnet (`base-mainnet`)
- Ethereum Mainnet (`ethereum-mainnet`)
- Optimism Mainnet (`optimism-mainnet`)
- Arbitrum Mainnet (`arbitrum-mainnet`)

Destination chains are resolved by name to Hyperlane domain IDs. Supported destinations include `ethereum`, `optimism`, `bsc`, `gnosis`, `polygon`, `base`, `arbitrum`, `celo`, `avalanche`, `mantle`, `mode`, `linea`, `scroll`, and `zora`.

## Notes

- Warp Route addresses differ per (origin chain, token) pair. Find them in the [Hyperlane Registry](https://github.com/hyperlane-xyz/hyperlane-registry/tree/main/deployments/warp_routes).
- Interchain gas is read from the Warp Route via `quoteGasPayment(uint32)` and attached as `msg.value` on `transferRemote`.
- The Warp Route is approved to spend the underlying ERC-20 before each transfer.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Hyperlane action provider for cross-chain token transfers."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Constants for Hyperlane action provider."""

SUPPORTED_NETWORKS = [
"base-mainnet",
"ethereum-mainnet",
"optimism-mainnet",
"arbitrum-mainnet",
]

# Hyperlane destination domain IDs.
# Source: https://github.com/hyperlane-xyz/hyperlane-registry (per-chain metadata.yaml).
# For most chains the domain ID matches the EVM chain ID by convention.
DESTINATION_DOMAINS = {
"ethereum": 1,
"optimism": 10,
"bsc": 56,
"gnosis": 100,
"polygon": 137,
"base": 8453,
"arbitrum": 42161,
"celo": 42220,
"avalanche": 43114,
"mantle": 5000,
"mode": 34443,
"linea": 59144,
"scroll": 534352,
"zora": 7777777,
}

# Hyperlane Warp Route (TokenRouter) ABI - transfer + quote functions.
# Reference: https://github.com/hyperlane-xyz/hyperlane-monorepo
# (solidity/contracts/token/libs/TokenRouter.sol)
WARP_ROUTE_ABI = [
{
"inputs": [
{"internalType": "uint32", "name": "_destination", "type": "uint32"},
{"internalType": "bytes32", "name": "_recipient", "type": "bytes32"},
{"internalType": "uint256", "name": "_amountOrId", "type": "uint256"},
],
"name": "transferRemote",
"outputs": [{"internalType": "bytes32", "name": "messageId", "type": "bytes32"}],
"stateMutability": "payable",
"type": "function",
},
{
"inputs": [
{"internalType": "uint32", "name": "_destinationDomain", "type": "uint32"},
],
"name": "quoteGasPayment",
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
"stateMutability": "view",
"type": "function",
},
]
Loading
Loading