Svelte Web3 screenshot

Svelte Web3

Author Avatar Theme by Clbrge
Updated: 17 Jul 2023
140 Stars

web3.js library integration as a Svelte store

Overview

svelte-web3 is a library that allows you to use the web3.js library as a collection of readable Svelte stores for Svelte or SvelteKit. If you prefer to use the ethers.js library to interact with EVM, you may be interested in the sister package svelte-ethers-store.

Features

  • Readable Svelte stores: The library creates readable Svelte stores that are automatically updated when a new connection is established, or when the chain or selected account changes.
  • Connection with browser provider: You can easily enable a connection with the current EIP-1193 provider injected in the browser window context by calling setProvider on the library abstract helper with no argument.
  • Connection with non-injected providers: You can connect to non-injected EIP-1193 providers like web3-onboard, buidler.dev, ethers.js, eth-provider, WalletConnect, etc. by calling setProvider on the library abstract helper with the JavaScript provider instance object of the library.

Installation

To install svelte-web3, follow these steps:

  1. Add the svelte-web3 package to your project.
  2. Add the web3.js library in the main HTML page (index.html in Svelte, src/template.html in Sapper, or src/app.html in SvelteKit).

Summary

svelte-web3 is a library that allows you to use the web3.js library as a collection of readable Svelte stores. It provides easy connection with both browser provider and non-injected EIP-1193 providers. With svelte-web3, you can effortlessly manage connections, accounts, and chain data in your Svelte or SvelteKit application.