Queries
Make a view call across chains using IQS.
This tutorial demonstrates how to make a simple interchain view call via the Queries API from pre-deployed TestQuerySender
contracts to any arbitrary target on which Hyperlane is deployed.
Inputs
$DESTINATION_DOMAIN
: The domain ID of the destination chain. You can use43113
to send to Fuji, or choose from any of the known Domain identifiers$TARGET
: The address of the contract on the destination chain you want to query. You could just query for theowner()
of theInterchainAccountRouter
contract which is found at0xc61Bbf8eAb0b748Ecb532A7ffC49Ab7ca6D3a39D
on every testnet chain$TARGET_DATA
: The ABI encoded call, if you want to make anowner()
call that would be0x8da5cb5b
$GAS_AMOUNT
: The amount of gas on the destination chain to pay for. For the simpleowner()
example, we can set this to a generous200000
gas. See Interchain gas payments to learn more.
How TestQuerySender works
TestQuerySender
calls theInterchainQueryRouter
and designates a callback function for the result of the query itself. It will Automatically pay for interchain gas.
Make a query
Getting the Interchain Gas Payment Quote
Under the
Contract
tab, selectRead Contract
.Expand the
quoteGasPayment
function.For the destination domain, enter
$DESTINATION_DOMAIN
.For gas amount, enter
$GAS_AMOUNT
, which is200000
.Click
Query
and make note of the amount returned as$GAS_PAYMENT_QUOTE
. For example, at the time of writing, the quote is1
wei.
Making the Query
Under the
Contract
tab, find theWrite Contract
button.Click on the
Connect to Web3
button to connect your Wallet (i.e. Metamask). Make sure that you are on the correct network.Expand the
queryAddress
box.For destination domain, enter
$DESTINATION_DOMAIN
.For the target, enter
$TARGET
, i.e. the address of the contract you like to query on the destination.For target data, enter
$TARGET_DATA
, i.e. the ABI encoded call of the query itself.For gas amount, enter
$GAS_AMOUNT
.Submit the transaction via your wallet/Metamask
Confirm query
Last updated