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/sdk
or yarn:
yarn add @irys/sdk
Imports
Change your import statements from:
import Bundlr from "@bundlr-network/client";
to:
import Irys from "@irys/sdk";
Name Changes
Apart from rebrand to Irys, certain elements within the SDK have undergone a name change.
WebBundlr and (Node)Bundlr have been changed to WebIrys and (Node)Irys respectively.
All usage of currency
in the SDK has been replaced with token
, notably the argument as part of client instantiation (see Constructor)
as well as internal APIs (such as currencyConfig -> tokenConfig)
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";
// Devnet RPC URLs change often, use a recent one from https://chainlist.org/chain/80001
const providerUrl = "";
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 shouldsla 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";
// Devnet RPC URLs change often, use a recent one from https://chainlist.org/chain/80001
const rpcUrl = "";
// 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;
};