npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svelte-dapp

v1.0.1

Published

> DApp SSO made easy with 3Box and Svelte.

Readme

svelte-dapp

DApp SSO made easy with 3Box and Svelte.

Demo

Check out the demo here.

Installation

npm install --save svelte-dapp

Usage

You can browse the example folder to find out about a more advanced usage.

// MainComponent.svelte

<script>
  import 'Dapp' from '@osarrouy/svelte-dapp'
  import 'App'  from './App.svelte'
</script>

<Dapp id="myawesomedapp" network="kovan" fortmatic={{ key: 'my_key'}}>
  <App />
</Dapp>
// ChildComponent.svelte

<script>
  import { dapp } from '@osarrouy/svelte-dapp'
  import { wallet, profile } from '@osarrouy/svelte-dapp/stores'

  const login = async () => {
    await dapp.login('metamask')
  }

  const logout = async () => {
    await dapp.logout()
  }
</script>

<section>
  <section>
    {#if $profile}
      <img src={$profile.avatar} />
      <p>{$profile.address}</p>
      <p>{$profile.did}</p>
      <p>{$profile.name}</p>
      <p>{$profile.url}</p>
    {:else}
      <p>Please login.</p>
    {/if}
  </section>
  <section>
    {#if $profile}
      <a on:click={login}>logout</a>
    {:else}
      <a on:click={login}>login</a>
    {/if}
  </section>
</section>

API

login / logout

dapp.login

svelte-dapp allows to log users in through multiple ethereum wallets while transparently syncing their 3Box profile informations and enabling access to their dapp specific storage space. Supported wallet for now:

  • Metamask
  • Fortmatic
await dapp
  .login("metamask")
  .on("wallet:syncing", () => {
    // waiting for the user to log in and / or enable her wallet
  })
  .on("wallet:synced", account => {
    // the user has logged in and / or enabled her wallet
    // the wallet store is filled with informations
  })
  .on("profile:syncing", () => {
    // waiting for the user 3Box profile to be synced
  })
  .on("profile:synced", profile => {
    // the user 3Box profile is now synced
    // the profile store is filled with informations
  })
  .on("storage:syncing", () => {
    // waiting for the user 3Box dapp storage space to be synced
  })
  .on("storage:synced", space => {
    // the user 3Box dapp storage space is now synced
    // the dapp can read and write from dapp.storage
  });

dapp.logout

await dapp.logout();

profile / storage

svelte-dapp provides a set of helpers to: a. access and update a user's 3Box generic profile b. access and update a user's 3Box dapp specific storage space.

If your dapp needs to read / write generic informations about a user's profile: use the dapp.profile helpers. If your dapp needs to read / write app specific informations about a user such as settings or preferences: use the dapp.storage helpers.

dapp.profile

await dapp.profile.set('name', 'John Doe')
await dapp.profile.get('name')
// => 'John Doe'
await dapp.profile.set('age', 18, { private: true })
await dapp.profile.get('age', { private: true})
// => 18

dapp.storage

await dapp.storage.set('lang', 'en')
await dapp.storage.get('lang')
// => 'en'
await dapp.storage.set('relationship', 'complicated', { private: true })
await dapp.storage.get('relationship', { private: true})
// => 'complicated'

Stores

wallet

<script>
  import { dapp }   from '@osarrouy/svelte-dapp'
  import { wallet } from '@osarrouy/svelte-dapp/stores'

  dapp
    .login('formatic')
    .then(_ => {
      console.log($wallet)
      // {
      //   type:    'metamask' || 'fortmatic' || ...
      //   account: '0x76...',
      //   network: 'mainnet' || 'kovan' || ...
      //   provider: Object
      // }
    })
<script>

profile

<script>
  import { dapp }    from '@osarrouy/svelte-dapp'
  import { profile } from '@osarrouy/svelte-dapp/stores'

  dapp
    .login('formatic')
    .then(_ => {
      console.log($profile)
      // {
      //    address 0x85c...
      //    did     did:3:....
      //    name    John Doe
      //    avatar  url of a user-defined picture and standard Ethereum blockie otherwise
      //    url     https://3box.io/0x85c...
      //    raw:    Object [raw 3Box profile]
      // }
    })
<script>

isLoggedIn

<script>
  import { dapp }       from '@osarrouy/svelte-dapp'
  import { isLoggedIn } from '@osarrouy/svelte-dapp/stores'

  isLoggedIn.subscribe(_isLoggedIn => {
    if (_isLoggedIn) {
      console.log('User is now logged in!')
      console.log('You can use dapp.profile and dapp.storage safely.')
    }
  })
<script>