跳到主要内容

如何扩展现有的 Warp 路由

使用 Hyperlane CLI

在部署您的 warp 路由后,您可能希望将其扩展到新的链。扩展 warp 路由涉及在目标链上部署新的代币合约并将现有代币注册到其中。

您可以使用 Hyperlane CLI 扩展现有的 warp 路由。

前提条件

  • warp 路由配置。
    • 对于新的部署,此配置可以使用 CURRENT_DIR/configs/warp-route-deployment.yaml 的文件路径。
    • 对于现有的部署,如果在注册表中存在,可以使用 hyperlane warp read 生成配置。
  • warp 路由代币符号。
    • 代币符号可以在链上找到,或在本地的 Hyperlane 注册表中找到。默认情况下,它被写入到 $HOME/.hyperlane/deployments/warp_routes/<tokenSymbol>
  • 访问当前拥有 warp 路由的私钥。
注意

Gnosis Safe 用户:拥有 warp 路由的 EOA 必须是 Safe 签名者或 委托,才能提出更新交易。

如果您已经拥有 warp 配置,请跳过到 步骤 1

要使用 Hyperlane CLI 生成 warp 路由配置,请在其部署的链上找到您的代币符号:

hyperlane warp read --symbol <tokenSymbol>

您应该看到一个类似的传送路线选择器:

超高速传送读取器
---------------------
为符号 eth 找到了多个传送路线
? 从匹配的传送路线中选择
ETH/以太坊-维克顿
ETH/基础塞波利亚
ETH/霍尔斯基-塞波利亚
❯ ETH/基础塞波利亚-塞波利亚
ETH/贝塔-伽马

然后您可以选择要扩展的 warp 路由。

在运行 hyperlane warp read 后,CLI 将显示类似以下的配置:

basesepolia:
mailbox: "0x6966b0E55883d49BFB24539356a2f8A673E02039"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: "1"
remoteRouters:
"11155111": "0x8A73F6E36735d8C4b9A00Af910746173050B754E"
type: "synthetic"
sepolia:
mailbox: "0xfFAEF09B3cd11D9b20d1a19bECca54EEC2884766"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: 0
remoteRouters:
"84532": "0x26243aaD2d03AAbafaCE785808Ae64fc32aFB8A1"
type: "native"

此特定配置有 2 条链:basesepolia 和 sepolia。这意味着消息可以在这两条链之间中继。

默认情况下,warp read 将输出保存到 CURRENT_DIR/configs/warp-route-deployment.yaml。请按照以下步骤将链添加到现有的 warp 路由中。

步骤 1:配置

通过添加新链的配置来更新 warp-route-deployment.yaml

warp-route-deployment.yaml
sepolia:
mailbox: "0xfFAEF09B3cd11D9b20d1a19bECca54EEC2884766"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: 0
remoteRouters:
"84532": "0x26243aaD2d03AAbafaCE785808Ae64fc32aFB8A1"
type: "native"
basesepolia:
mailbox: "0x6966b0E55883d49BFB24539356a2f8A673E02039"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: "1"
remoteRouters:
"11155111": "0x8A73F6E36735d8C4b9A00Af910746173050B754E"
type: "synthetic"
+ holesky:
+ mailbox: "0x46f7C5D896bbeC89bE1B19e4485e59b4Be49e9Cc"
+ owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
+ name: "Ether"
+ symbol: "ETH"
+ decimals: 18
+ totalSupply: "1"
+ type: "synthetic"
注意

EOA 用户:扩展配置的 owner 必须与先决条件步骤中的 EOA 地址匹配,以避免部署失败。

步骤 2:应用

使用 CLI,执行适用于您的 warp 路由所有者设置的命令:

hyperlane warp apply \
--symbol <tokenSymbol> \
--config $(pwd)/configs/warp-route-deployment.yaml

执行后,您应该会看到一批交易在链上执行,并且最后一条消息指示 warp 配置已更新。

步骤 3:确认

要确认使用 Hyperlane CLI 成功扩展了 warp 路由,请在其部署的链上运行以下命令,使用您的代币符号:

hyperlane warp read --symbol <tokenSymbol>

在运行 warp read 后,确认 warp 路由已扩展:

basesepolia:
mailbox: "0x6966b0E55883d49BFB24539356a2f8A673E02039"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: 0
remoteRouters:
"17000": "0x9B18AfD7aB869C6B011F44638ff71786447B785B"
"11155111": "0x4e63147e72d029Eb8b37F375B3837B2644622686"
type: native
sepolia:
mailbox: "0xfFAEF09B3cd11D9b20d1a19bECca54EEC2884766"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: "0"
remoteRouters:
"17000": "0x9B18AfD7aB869C6B011F44638ff71786447B785B"
"84532": "0xB38cc797Ccc6D8763439a07CEa052AF253281de6"
type: "synthetic"
holesky:
mailbox: "0x46f7C5D896bbeC89bE1B19e4485e59b4Be49e9Cc"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name: "Ether"
symbol: "ETH"
decimals: 18
totalSupply: "0"
remoteRouters:
"84532": "0xB38cc797Ccc6D8763439a07CEa052AF253281de6"
"11155111": "0x4e63147e72d029Eb8b37F375B3837B2644622686"
type: "synthetic"