OrbisWeb3 / orbis-sdk

Official repository for the Orbis SDK.
67 stars 26 forks source link

Other provider support #1

Open nullart2 opened 2 years ago

nullart2 commented 2 years ago

I tried to use ceramic's key-did-provider-ed25519

but seem to get this error:

provider.enable is not a function

code:

async connectOrbis(seed:string) {

    const enc = new TextEncoder();
    const authSecret = enc.encode(seed);

    const provider = new Ed25519Provider(authSecret)

    let res = await this.orbis.connect(provider);
    console.log('orbit connect', res);
  }

Thanks

sirpy commented 1 year ago

This should be defined as a bug. Because it doesnt allow to use standard providers and relies only on "metamask" style providers. If using a provider from frameworks like wagmi/usedapp/web3modal then it won't work, since the standard provider doesnt have the enable method

From looking at the code it seems enable is only for getting the account address, so instead provider.send('eth_accounts',[]) should be called and error thrown if result is empty

donatandelic commented 1 year ago

This should be defined as a bug. Because it doesnt allow to use standard providers and relies only on "metamask" style providers. If using a provider from frameworks like wagmi/usedapp/web3modal then it won't work, since the standard provider doesnt have the enable method

The Ed25519Provider from this issue is not a supported provider for the connect method, despite the existing enable issue. connectWithSeed should be used instead.

sirpy commented 1 year ago

@donatandelic i'm talking about other eip1193 providers that want to use pkh auth orbis will not work with providers returned from web3modal etc..., ie the standard dapp provider

Pfed-prog commented 10 months ago

At the moment I am trying to accomplish simple querying of the data via back end and this is not possible because we have to connect to window object. I have delved into https://did.js.org/docs/api/modules/pkh_ethereum It works the same way only with window.ethereum

In the best case scenario, it would be amazing we could connect to Infura Provider

donatandelic commented 10 months ago

@Pfed-prog here's an example of using Ethers in the backend with Orbis SDK. We had to shim window and localStorage in order to make certain dependencies work.

https://gist.github.com/donatandelic/320b739a78bca34fa929cbc7656e94a1