Irys-xyz / arweave-js-sdk

JS SDK for Irys on Arweave
110 stars 95 forks source link

Solana devent wallet balance is not getting detected when using uploadFolder #136

Closed Haseebshah936 closed 3 weeks ago

Haseebshah936 commented 1 month ago

The solana devnet wallet balance is not getting detected when I am trying to upload multiple files using UploadFolder method. The weird thing is that it was working fine a few days ago but now if I upload a single file it goes through. It give error if I try to upload more than one file. Have tried it with multiple browsers and wallets as well. My current wallet has 10 devnet SOL in it.

const getIrys = async (): Promise<WebIrys> => {
    const w = { rpcUrl: endpoint, name: "solana", provider: wallet };
    const webIrys = new WebIrys({
      network: "devnet",
      token: "solana",
      wallet: w,
    });
    await webIrys.ready();
    return webIrys;
  };
const handleUploadFiles = async (files: BrowserFile[], bytes: number) => {
    try {
      const webIrys = await getIrys();
      // Convert from atomic units to standard units

      const receipt = await webIrys.uploadFolder(files);

      console.log(
        `Files uploaded. Manifest Id=${receipt.manifestId} Receipt Id=${receipt.id}`,
        `https://gateway.irys.xyz/${receipt.manifestId}`
      );

      const json = await fetch(
        `https://gateway.irys.xyz/${receipt.manifestId}`,
        {
          method: "GET",
          headers: {
            "Content-Type": "application/json",
          },
        }
      ).then((res) => res.json());

      console.log("JSON: ", json);

      toast.success("Images uploaded successfully");
    } catch (error) {
      console.log("Error: ", error);
      toast.error("Error uploading images");
    }
  };
Screenshot 2024-08-11 at 8 49 22 PM
JesseTheRobot commented 1 month ago

Hey @Haseebshah936 , this looks like you haven't funded your Irys arweave bundler account (we work off a deposit based system) - if you use the irys.fund and irys.getLoadedBalance methods, you should be able to fund and see the current balance of your account. See our docs for more information. The uploads were probably working before due to our policy of free uploads for items <100KiB. If you have any more questions, feel free to ask!

Haseebshah936 commented 1 month ago

@JesseTheRobot The weird thing is that it is letting me upload single files using the uploadFolder Method. But as soon as I select more that 1 file it restricts me and moreover I have uploaded folders of upto 450MB multiple times on Devnet. But now when I am even trying it to mainnet it is doing the same uploading a single file. I will try to fund the node and try what you are suggesting but I think in total I have uploaded at least 3-4 GB of data. Before this started happening and Just to inform you I was able to upload it again from my other device as well after this Ticket was created. It seems that this device of mine has been restricted in some way IDK.

Haseebshah936 commented 1 month ago

@JesseTheRobot Also I am using Web Irys will this solution will Funding work with it?

Haseebshah936 commented 1 month ago

@JesseTheRobot It is working after Funding the Irys Node.

JesseTheRobot commented 3 weeks ago

Hey @Haseebshah936 - Please move this issue, if it still applies, to our new SDK repo: https://github.com/Irys-xyz/js-sdk