Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiuzon/svelteweb3
A simple, dependency minimized package for building modern dApps with Svelte
https://github.com/chiuzon/svelteweb3
dapps ethereum react svelte sveltejs web3
Last synced: 18 days ago
JSON representation
A simple, dependency minimized package for building modern dApps with Svelte
- Host: GitHub
- URL: https://github.com/chiuzon/svelteweb3
- Owner: chiuzon
- Created: 2021-11-07T22:09:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-17T20:11:06.000Z (almost 3 years ago)
- Last Synced: 2024-10-09T10:19:36.569Z (29 days ago)
- Topics: dapps, ethereum, react, svelte, sveltejs, web3
- Language: TypeScript
- Homepage:
- Size: 302 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `svelteWeb3`
A simple, dependency minimized package for building modern dApps with Svelte
## ⚠️ Warning 0.3.0
After 0.3.0 version we don't do any polyfills for the `web3-react` connectors, the `injected-connector` works without any polyfills but packages like `walletconnect-connector` might require `buffer` polyfill.\For some connectors you might be required to disable `ssr`
## Projects using `svelteWeb3`
`Open a PR to add your project to the list!`
## Installation
`pnpm install @chiuzon/svelteweb3`
## Usage
```js
//store.js
import { createWeb3Store } from '@chiuzon/svelteweb3'//You can have any number of Web3Store
export const web3Store = createWeb3Store((provider) => {
return new ethers.providers.Web3Provider(provider)
})
``````svelte
//index.svelteimport { web3Store } from './store.js'
import { InjectedConnector } from '@web3-react/injected-connector'const injectedConnector = new InjectedConnector({supportedChainIds: [1]})
const {account, activate} = web3Store
async function onConnectHandle() {
await activate(injectedConnector, (error) => {
console.error(error)
})
}Account Address: {$account}
{
onConnectHandle()
}}>Connect
```## Local Development
- Clone repo\
`https://github.com/chiuzon/svelteWeb3`- Install dependencies\
`pnpm install`- Build and watch for changes\
`pnpm dev`