Upgrade to new 0.2 version of ic-siwe

If you are using ic-siwe to let Ethereum users log in to your app, now is a good time to upgrade. ic-siwe has received a major rework to add support for more than React frontends. Plus, the setup of the provider component has been simplified.

Added

  • Support for vanilla JS/TS projects. This should mean ic-siwe-js is usable with little to no headache in Svelte, Solid.JS and Lit. Vue still needs a custom submodule I believe.

Changed

  • Library renamed to ic-siwe-js and moved to the ic-siwe monorepo.
  • SiweIdentityProvider now requires only the canister id as a parameter.
  • React hook renamed from useSiweIdentity to useSiwe.
  • Project now uses xstate/store under the hood for state management instead of messy React Context.

Migration from v0.1.x

Replace dependency in package.json:

- "ic-use-siwe-identity": "^0.1.2",
+ "ic-siwe-js": "^0.2.2",

Import new name React hook from new location:

- import { useSiweIdentity } from "ic-use-siwe-identity";
+ import { useSiwe } from "ic-siwe-js/react";

Import SiweIdentityProvider from new location:

- import { SiweIdentityProvider } from "ic-use-siwe-identity";
+ import { SiweIdentityProvider } from "ic-siwe-js/react";

Use new simplified config for SiweIdentityProvider:

- <SiweIdentityProvider<_SERVICE>
-   canisterId={canisterId}
-   idlFactory={idlFactory}
- >
+ <SiweIdentityProvider canisterId={canisterId}>

Let’s build!

:seedling:

4 Likes