effectai / effect-js

JavaScript Library to access and develop dApps on Effect Network.
https://effect.network
Other
58 stars 3 forks source link

Re-export @wharfkit types #110

Open djmbritt opened 5 months ago

djmbritt commented 5 months ago

Currently, a user needs to import these types to get started:

import { Session } from "@wharfkit/session";
import { WalletPluginPrivateKey } from "@wharfkit/wallet-plugin-privatekey";

We should re-export these types from the SDK so that users don't need to install @wharkit/package to get started with the @effectai/sdk

For the user, it would look like:

import { createClient, Session, WalletPluginPrivateKey } from "@effectai/sdk"
Jeffrieh commented 5 months ago

Hi David!

I agree, i think including and exporting the wharfkit session functionality inside of the SDK is a better approach then what we have now, we just have to be a bit careful that the bundle size doesnt increase for people that do not wish to use any session related stuff, e.g. using the sdk to get EFX price or other simple calls. I think wharfkit packages are tree shakable so that should be doable, but let me double check it and i'll report back here.

Jeffrieh commented 5 months ago

i re-exported the Session class from @wharfkit/session so that one can be extracted from the @effectai/sdk now. I think re-exporting the wharfkit/wallet-plugin-privatekey doesn't make much sense because its not used inside of the sdk, only for testing purposes, so it should be included into the devDependencies.

I think some further discussion is needed to determine which other wharfkit packages we will include/re-export into the SDK, if any at all, since some of them are very dependent on a specific flow that the user requires. for example, UI based clients need @wharfkit/web-renderer, some need @wharfkit/wallet-plugin-privatekey while others want wallet plugins like @wharfkit/wallet-plugin-anchor etc.

I get that we want to make the initial setup as easy as possible, but we would be making the dependancies and logic inside of the sdk more complicated, perhaps something to tackle for our next release (v.2.1.0)

djmbritt commented 5 months ago

Good points, I think all the WalletPlugins should be imported by users themselves, except for @wharfkit/wallet-plugin-privatekey.

The initial setup has been cleaned up a lot, and it's a lot easier to hook up the basic variables needed to set up the client.