Irys-xyz / arweave-js-sdk

JS SDK for Irys on Arweave
111 stars 96 forks source link

WebIrys. how do I connect to the arweave wallet? #135

Closed zqplugins closed 2 months ago

zqplugins commented 3 months ago

Hello, I have a arweave wallet private key, but i can't to connect.

I don't see anywhere in the documentation an option to specify a key

https://docs.irys.xyz/developer-docs/irys-sdk/irys-in-the-browser

I have already tried different methods but they all give the same error.

Снимок экрана 2024-07-30 в 18 21 44
JesseTheRobot commented 3 months ago

WebIrys, by default, doesn't support private keys - however you can use the following code to add support:

import ArweaveConfig from "@irys/sdk/node/tokens/ethereum";
import { BaseWebIrys } from "@irys/sdk/web/base";
import { type WebToken } from "@irys/sdk/web/types";
const wallet = <JWK object here>;
const config = { providerUrl: "" };
const irys = new BaseWebIrys({
  network: "mainnet",
  config,
  getTokenConfig: (i): WebToken =>
    new ArweaveConfig({
      irys: i,
      name: "arweave",
      ticker: "AR",
      minConfirm: 10,
      isSlow: true,
      providerUrl: config.providerUrl ?? "https://arweave.net",
      wallet,
    }) as unknown as WebToken,
});
zqplugins commented 3 months ago

Thanks, I'll give it a try

zqplugins commented 3 months ago

@JesseTheRobot Hello, can you tell me the structure of the key? I have an error-

Снимок экрана 2024-08-13 в 12 13 54 Снимок экрана 2024-08-13 в 12 14 13
JesseTheRobot commented 3 months ago

that key format looks correct - are you passing the entire object as the key as the wallet object, and can you show me the new Qu function so I can see exactly what function is causing the issue? also, I noticed an issue with my initial code, the first import should be: import ArweaveConfig from "@irys/sdk/node/tokens/arweave";

zqplugins commented 3 months ago

@JesseTheRobot we use cdn import with webpack build. so we have a slightly different entry. I also tried via node js to make a connection via arweave key, but I get the same error. Do you have an example of a working app with connection via arweave key?

Снимок экрана 2024-08-14 в 17 27 36
zqplugins commented 3 months ago

@JesseTheRobot Hello, Do you have an example of a working app with connection via arweave key?

JesseTheRobot commented 2 months ago

For using WebIrys, no - I'm not entirely sure why the code I gave you isn't working can you show me the code you're using now? I might be able to spot the problem.

zqplugins commented 2 months ago

@JesseTheRobot I made a video showing how I configured webIrys and Irys/sdk (node js server).

https://mega.nz/file/gNE2RQBB#5y5bc5-jL6QQe0EiyOshVl0L37fqbWJIgHhRxDiG7y4

JesseTheRobot commented 2 months ago

why did you remove the BaseWebIrys code? without that it won't work

zqplugins commented 2 months ago

@JesseTheRobot I did not delete, I showed you two separate examples on client side and server side. I have the same error.