Quoting gas payments
Pay for message delivery on the origin chain
Applications can use the HyperlaneIgp
in the Hyperlane SDK to quote when dispatching a message. See the example below illustrating how to estimate and pay interchain gas payments.
Getting a quote Using the SDK
An interchain gas payment quote will call the quoteGasPayment
function on an Interchain Gas Paymaster contract.
In this example, we'll get an interchain gas payment quote for a message from Avalanche to Polygon.
First, let's create the HyperlaneIgp
instance. See RPC Providers for creating a MultiProvider
with your own RPC providers.
There are two functions that can be used to quote interchain gas payment. See Choosing an interchain gas paymaster contract to understand which IGP contract you should be using and to get more information on gas amounts.
Function | IGP contract | Gas amount |
---|---|---|
| The provided | The gas amount used by the message's recipient |
| The provided | All gas required to process the message, which includes the cost of ISM verification |
Now, we can use the HyperlaneIgp
to find how much AVAX should be paid for our message from Avalanche to Polygon that we expect to consume 200,000 gas in the recipient contract's handle
function.
Last updated