Installing, Importing & Configuring

The Irys SDK minimizes dependency bloat by providing dedicated packages for each token. Installation statements, imports, and connection code differ based on the payment token selected.

Info
Info
The following code examples connect to our alpha testnet. To switch to our devnet, append the functions withRpc() and devnet() as detailed in the networks documentation.

Aptos

Installing:

npm install @irys/upload @irys/upload-aptos

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Aptos } from "@irys/upload-aptos";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Aptos).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Arbitrum

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Arbitrum } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Arbitrum).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Avalanche C-Chain

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Avalanche } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Avalanche).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Berachain

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Bera } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Bera).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

BNB

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { BNB } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(BNB).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Chainlink } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Chainlink).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Eclipse-eth

Installing:

npm install @irys/upload @irys/upload-solana

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { EclipseEth } from "@irys/upload-solana";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(EclipseEth).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Ethereum

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Ethereum } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Ethereum).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Base Ethereum

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { BaseEth } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(BaseEth).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Linea Ethereum

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { LineaEth } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(LineaEth).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Scroll Ethereum

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { ScrollEth } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(ScrollEth).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

IoTeX

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Iotex } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Iotex).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Polygon

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Matic } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Matic).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

Solana

Installing:

npm install @irys/upload @irys/upload-solana

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { Solana } from "@irys/upload-solana";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(Solana).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

USDC (on Ethereum)

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { USDCEth } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(USDCEth).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};

USDC (on Polygon)

Installing:

npm install @irys/upload @irys/upload-ethereum

Importing & Configuring:

import { Uploader } from "@irys/upload";
import { USDCPolygon } from "@irys/upload-ethereum";

const getIrysUploader = async () => {
  const irysUploader = await Uploader(USDCPolygon).withWallet(process.env.PRIVATE_KEY);
  return irysUploader;
};