withdrawAll()

The withdrawAll() method removes an entire account balance from the Irys system. The unit of withdrawal corresponds to the token parameter specified during Irys object instantiation. Users with multiple token balances must reinitialize the Irys object for each token type.

Returns

TypeDescription
stringHTTP status code (400 or 200) with response data

Response structure:

// 400 - something went wrong

// 200 - Ok
response.data = {
  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
}

Example

Note
Note
Use a token-specific version of getIrysUploader() to connect to an Irys Bundler before uploading.
try {
  const irys = await getIrysUploader();
  const tx = await irys.withdrawAll();
} catch (e) {
  console.log("Error withdrawing funds ", e);
}