LogoLogo
  • ⏩Introduction
    • Hyperlane Introduction
    • Getting started
    • Why Should You Use Hyperlane?
  • Permissionless Interoperability
    • Overview
    • Deploy Hyperlane
    • Warp Routes
      • Deploy a Warp Route
      • Deploy a UI for your Warp Route
    • Modular Rollup Interoperability
  • Build With Hyperlane
    • Quickstarts
      • Messaging
      • Accounts
      • Queries
      • hyperlane-quickstart repo
    • Guides
      • Finding my messages
      • Automatically pay for interchain gas
      • Manually pay for interchain gas
      • Choosing an interchain gas paymaster contract
      • Unit testing
      • Specifying an ISM
      • V2 migration guide
    • Explorer
      • Debugging messages
      • Configuring PI Chains
      • REST API
      • GraphQL API
    • Troubleshooting/Developer FAQ
    • Example apps
  • APIs and SDKs
    • Messaging API
      • Send
      • Receive
    • Accounts API
    • Queries API
    • Warp Route API
    • Interchain gas paymaster API
    • Hyperlane App Framework
      • Example usage
        • HelloWorld
        • Interchain Token
      • Solidity SDK
        • HyperlaneConnectionClient
        • Router
      • NodeJS SDK
        • RPC Providers
        • Deployment
        • Interchain testing
        • Quoting gas payments
        • App Abstraction
    • Hooks API
      • Contract addresses
  • Protocol
    • Overview
    • Mailbox
    • Interchain security modules
      • Interface
      • Multisig ISM
      • Routing ISM
      • Aggregation ISM
      • Optimistic ISM
      • Wormhole ISM
      • Hook ISM
      • CCIP-Read ISM
    • Interchain gas payments
    • Staking and slashing
    • Agents
      • Validators
      • Relayers
      • Watchtowers
    • Warp Routes
    • Implementation Guide
  • Operators
    • Validators
      • Guide
      • AWS setup
      • Monitoring and alerting
    • Relayers
      • Guide
      • Message filtering
    • Agent keys
      • Hexadecimal keys
      • AWS KMS keys
    • Agent configuration
      • Configuration reference
    • Running with docker compose
  • Resources
    • FAQ
    • Glossary
    • Contract addresses
      • Permissionless Deployment Contract Addresses
    • Domain identifiers
      • Permissionless Domain Identifiers
    • Default ISM settings
    • Coming Soon: Hyperlane v3
    • Token sources & faucets
    • Latencies
    • Github
    • Discord
    • Website
Powered by GitBook
On this page
  • Implement
  • Interact
  1. APIs and SDKs
  2. Hyperlane App Framework
  3. NodeJS SDK

App Abstraction

Interact with your application on multiple chains

PreviousQuoting gas paymentsNextHooks API

Last updated 2 years ago

The Hyperlane SDK simplifies the interface for smart contract applications deployed across multiple chains. It provides utilties for invoking a contract's methods on a target chain and a for managing chain connections.

Implement

The HyperlaneApp abstraction is a mapping that resolves a chain to a collection of . Developers should extend HyperlaneApp and can add methods for different kinds of contract calls/transactions they would like to initiate.

A simple HyperlaneApp extension could look like this:

export class MyHyperlaneApp<Chain extends ChainName = ChainName> 
  extends HyperlaneApp<MyContracts, Chain> 
{
  async myMethod(from: Chain, to: Chain, message: string) {
    const myContract = this.getContracts(from).router;
    const toDomain = ChainNameToDomainId[to];
    const tx = await helloWorldContract.myMethod(toDomain, message);
    return tx.wait();
  }
}

See the app for an example of how to extend HyperlaneApp.

Interact

Once a HyperlaneApp implementation is defined, it can be instantiated using the output generated from the HyperlaneAppDeployer and an instance of the .

const chainToContracts = await myDeployer.deploy();
const app = new mydApp(chainToContracts, multiProvider);

To interact with contracts on a particular network, simply provide the namespace to the app.

const ethereumContracts = myApp.getContracts('ethereum');
MultiProvider
ethers Contracts
Hyperlane Hello World
MultiProvider