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
  • Configure
  • Interact
  • Test
  1. APIs and SDKs
  2. Hyperlane App Framework
  3. NodeJS SDK

RPC Providers

Manage RPC providers for Hyperlane supported chains in one place

MultiProvider is a utility used throughout the Hyperlane Application SDK. In essence, it is a mapping that resolves a chain namespace to a configured node (JSON RPC) provider.

Configure

To configure and create your MultiProvider, create ethers.js-compatible providers and optionally specify a block confirmation threshold:

import {chainConnectionConfigs} from '@hyperlane-xyz/sdk';
// You can use a custom defined provider, say for a local node:
const ethereum = {
    provider: new ethers.providers.UrlJsonRpcProvider('http://localhost:8545/')
};
const polygon = {
    provider: new ethers.providers.UrlJsonRpcProvider('https://rpc-mainnet.matic.network'),
    confirmations: 10, // wait 10 blocks for finality
};
// Or you can use the SDK's default configs and providers:
const celo = chainConnectionConfigs.celo
const multiProvider = new MultiProvider({ ethereum, polygon, celo });

Interact

MultiProvider allows, for example, an application to have static node provisioning per target chain and register a user's signer for the duration of a session.

const userSigner = await getSessionSigner();
serverMultiProvider.getDomainConnection('ethereum').registerSigner(userSigner);

Test

For use in tests, the Hardhat signer can be used to emulate a multichain system locally. The chains shown (test1, test2, test3) are included for convenience.

import { ethers } from 'hardhat';

const [signer] = await ethers.getSigners();
const testMultiProvider = new MultiProvider({
    test1: { signer },
    test2: { signer },
    test3: { signer },
});
PreviousNodeJS SDKNextDeployment

Last updated 2 years ago