Skip to main content

JS Client

Installing the library


These docs are still a WIP, if you notice any issues/have any suggestions, let us know via our discord

using npm:

npm install @bundlr-network/client

using Yarn:

yarn add @bundlr-network/client


All the below examples are for the currency Arweave. For other currencies, simply change your wallet and currency parameters.
For a list of supported currencies, see here
For an API reference, see our API Docs

All units used by this Library are atomic units - see the faq to learn more. To convert to regular units, use bundlr.utils.unitConverter(atomic)

Create a new Bundlr instance

import Bundlr from '@bundlr-network/client';

const jwk = JSON.parse(fs.readFileSync("wallet.json").toString());

const bundlr = new Bundlr("", "arweave", jwk);

If you are using CJS / get a "Bundlr is not a constructor" error, try Bundlr.default(...), or add .default to the end of your require statement.

Use another Currency

As easy as changing the currency and private key - Bundlr does the rest!

import Bundlr from '@bundlr-network/client';

const bundlr = new Bundlr("", "currencyName", "privateKey");

privateKey accepts paths to key files, raw key strings, or even objects - if you have questions about what key formats a specific currency supports let us know!

Get the loaded wallet's address

bundlr.address // "OXcT1sVRSA5eGwt2k6Yuz8-3e3g9WJi5uSE99CWqsBs"

Get the loaded address' balance with the Bundlr node in atomic units

await bundlr.getLoadedBalance() // 109864 

Convert it from atomic units

const balance = await bundlr.getLoadedBalance()
const converted = bundlr.utils.unitConverter(balance) // 0.000000109864 - traditional decimal units

Get the balance of an arbitrary address with the Bundlr node

await bundlr.getBalance(address) // 10000 

Get the address the Bundlr node uses for the current currency

await bundlr.getBundlerAddress(); // "OXcT1sVRSA5eGwt2k6Yuz8-3e3g9WJi5uSE99CWqsBs"

Get the price for n bytes in atomic units

await bundlr.getPrice(1000); // 540672

Convert it from atomic units

const price = await bundlr.getPrice(1000);
const amount = bundlr.utils.unitConverter(price) //0.000000540672

Fund the Bundlr node

let response = await;
response = {
id, // the txID of the fund transfer
quantity, // how much is being transferred
reward, // the amount taken by the network as a fee
target // the address the funds were sent to

Request a withdrawal from the Bundlr node

let response = await bundlr.withdrawBalance(price)

// withdrawal request status
response.status // http status code

// 400 - something went wrong = "Not enough balance for requested withdrawal"

// 200 - Ok = {
requested, // the requested amount,
fee, // the reward required by the network (network fee)
final, // total cost to your account (requested + fee)
tx_id, // the ID of the withdrawal transaction

In the event a withdrawal transaction is dropped, your Bundlr balance won't be affected.

Upload a file to the Bundlr node

await bundlr.uploadFile("./llama.jpg") // Returns an axios response

Upload a folder to the Bundlr node

await bundlr.uploader.uploadFolder("./path/to/folder","./optionalIndex.html") //returns the manifest ID if successful.

See upload for more information about some of the behaviors of the folderUploader

Chunk upload a Transaction

Chunked uploads are an advanced feature designed to improve reliability for uploads, and allow for larger uploads (200MB+). For more info about chunked (advanced) uploading, see Advanced uploading

await bundlr.uploader.chunkedUploader.uploadTransaction(transaction)

Uploader Global Overrides

The bundlr.uploader class has two global overrides for it's behavior. as the name global suggests, once set, all operations by this uploader instance will be affected by these values!


Set this to a boolean (true or -default- false) to enable/disable forced usage of chunked uploading.


Set this to override the content type tag for all uploads, set back to the default of undefined to clear the override.