Irys in the Browser

The Irys SDK reduces dependency bloat by providing dedicated packages for each token. Your install statements, import and connection code will differ depending on the token used for payment and the provider used.

Choose the code for your provider:

If you're using Irys with React, follow these extra setup steps. If you're using Irys with Vite, follow these steps.

EVM Chains

When connecting from an EVM chain, your connection code will differ based on the token you're using. The examples below use Ethereum and the WebEthereum class. To change tokens, use one from the following list.

Token
Class Name

Polygon

WebMatic

Binance Coin

WebBNB

Avalanche C-Chain

WebAvalanche

Base Ethereum

WebBaseEth

USDC (on Ethereum)

WebUSDCEth

Arbitrum

WebArbitrum

Chainlink

WebChainlink

USDC (on Polygon)

WebUSDCPolygon

Berachain

WebBera

Scroll Ethereum

WebScrollEth

Linea Ethereum

WebLineaEth

IoTeX

WebIotex

Ethereum

WebEthereum

Installing:

Importing & Configuring:

Ethers v6

Installing:

Importing & Configuring:

Viem v2

Installing:

Importing & Configuring:

Solana

Installing:

Importing & Configuring:

The Solana library uses the React provider pattern. Start by setting up a top-level file named ClientProviders.tsx that wraps all your child components.

Then load this component via layout.tsx:

Solana's wallet-adapter library make it easy to manage wallet connections. Create a component using this library to connect to a Solana wallet:

Then create a component called ConnectIrys.tsx that connects to an Irys bundler.

And load them all through your page.tsx file:

Start by scaffolding a blank Aptos project using npx create-aptos-dapparrow-up-right.

Next, install the following packages needed by Irys:

Replace your App.tsx file with the following:

The npx create-aptos-dapp CLI uses React + Vite. Vite does not automatically polyfill Node.js core modules like crypto, stream, os, or path. To fix compatibility issues, install the necessary polyfill packages:

Modify your vite.config.js to use vite-plugin-node-polyfills to handle the polyfills required for Node.js core modules:

After making these changes, restart your development server:

Last updated