Migration guide
Migrating your application from the Bundlr SDK to the Irys SDK is a simple process.
All existing legacy packages will be maintained until October 2024 and will continue to work until at least October 2025. All domains will be supported in perpetuity (e.g., https://node1.bundlr.network (opens in a new tab))
Installation
Install the Irys SDK using npm:
npm install @irys/sdkor yarn:
yarn add @irys/sdkImports
Change your import statements from:
import Bundlr from "@bundlr-network/client";to:
import Irys from "@irys/sdk";Constructor
In the Bundlr SDK, parameters are passed directly. In the Irys SDK, parameters are passed inside an options object.
Update new Bundlr to new Irys and then wrap your constructor arguments in {}.
const url = "https://devnet.irys.xyz";
const providerUrl = "https://rpc-mumbai.maticvigil.com";
const token = "matic";
const bundlr = new Bundlr(url, token, process.env.PRIVATE_KEY);
const irys = new Irys({
url, // URL of the node you want to connect to
token, // Token used to pay for uploads
key: process.env.PRIVATE_KEY, // ETH or SOL private key
config: { providerUrl }, // Optional provider URL, only required when using Devnet
});Domain Changes
With the release of the Irys SDK our domain has changed from https://bundlr.network to https://irys.xyz. When upgrading your code, you must change your Node URLs:
| Bundlr Node Address | Irys Node Address |
|---|---|
https://node1.bundlr.network | https://node1.irys.xyz |
https://node2.bundlr.network | https://node2.irys.xyz |
https://devnet.bundlr.network | https://devnet.irys.xyz |
And your GraphQL endpoints
| Bundlr GraphQL Endpoint | Irys GraphQL Endpoint |
|---|---|
https://node1.bundlr.network/graphql | https://node1.irys.xyz/graphql |
https://node2.bundlr.network/graphql | https://node2.irys.xyz/graphql |
https://devnet.bundlr.network/graphql | https://devnet.irys.xyz/graphql |
Changes to upload functions
In the Bundlr SDK there were separate upload functions depending on whether you wanted a receipt or not. With the Irys SDK, all upload functions return a receipt.
The following function is deprecated:
bundlr.uploadWithReceipt()
The following functions upload data as before however, the return type has changed to be a receipt.
irys.upload()To upload any datairys.uploadFile()To upload a fileirys.uploadFolder()To upload a folder
Change to WebBundlr / WebIrys
With the Bundlr SDK, using providers other than Ethers 5 required extra setup code unique to each provider. Now, we natively support multiple different provider types.
When connecting to a WebIrys class, you pass both a reference to a provider and the provider type. The following example is for Ethers 5, we also have a full list of supported provider types see Irys in the browser.
const getWebIrys = async () => {
// Ethers5 provider
await window.ethereum.enable();
const provider = new providers.Web3Provider(window.ethereum);
const url = "https://node1.irys.xyz";
const token = "matic";
const rpcURL = "https://rpc-mumbai.maticvigil.com"; // Optional parameter
// Create a wallet object
const wallet = { rpcUrl: rpcURL, name: "ethersv5", provider: provider };
// Use the wallet object
const webIrys = new WebIrys({ url, token, wallet });
await webIrys.ready();
return webIrys;
};