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.

import {
} from "@hyperlane-xyz/sdk";
import { ethers } from "ethers";

// Set up a MultiProvider with the default providers.
const multiProvider = new MultiProvider({
  avalanche: chainConnectionConfigs.avalanche,
  polygon: chainConnectionConfigs.polygon,

// Create the HyperlaneIgp instance.
const igp = HyperlaneIgp.fromEnvironment(

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.

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.

// Calculate the AVAX payment to send from Avalanche to Polygon,
// with the recipient's `handle` function consuming 200,000 gas.
const avaxPayment = await igp.quoteGasPaymentForDefaultIsmIgp(

console.log('Avalanche -> Polygon payment for 200k handle gas on destination:');
console.log(`${ethers.utils.formatEther(avaxPayment)} AVAX`);

// At the time of writing, this outputs:

// Avalanche -> Polygon payment for 200k handle gas on destination:
// 0.00071510955746088 AVAX

Last updated