Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onlyf0ur/solana-svelte
Solana wallet adapter library for Svelte 5.
https://github.com/onlyf0ur/solana-svelte
library solana svelte sveltekit
Last synced: 5 days ago
JSON representation
Solana wallet adapter library for Svelte 5.
- Host: GitHub
- URL: https://github.com/onlyf0ur/solana-svelte
- Owner: OnlyF0uR
- License: apache-2.0
- Created: 2024-08-18T14:56:35.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-10T18:20:35.000Z (about 2 months ago)
- Last Synced: 2024-11-03T23:03:34.365Z (5 days ago)
- Topics: library, solana, svelte, sveltekit
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/solana-svelte
- Size: 130 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# solana-svelte
Solana wallet adapter support for Svelte 5. Works by utilising the [wallet-adapter](https://github.com/anza-xyz/wallet-adapter) library.
## Important information
This library is the bare basics for how to interact with solana wallets on svelte. It has all the functionalities,
expected like other libraries but leaves some implementations up to the user. The library comes with a UI component
for choosing a wallet but as a developer you are required to control when this is shown, using your own state. Support for
backpack wallet is also added. So this one is retrieved from the solana-svelte library instead of the regular wallet-adapter by anza-xyz. Lastly SignInWithSolana is now also supported. However instead of first returning SolanaSignInOutput, it returns both the signed data and the siganture in order to have the function fallback to a normal sign message if the signIn method is not supported by the wallet.## Example setup
```svelte
import { clusterApiUrl } from '@solana/web3.js';
import { blockchain } from 'solana-svelte/core';$effect.pre(async () => {
const {
PhantomWalletAdapter,
SolflareWalletAdapter,
CoinbaseWalletAdapter,
LedgerWalletAdapter,
TrezorWalletAdapter,
KeystoneWalletAdapter,
TrustWalletAdapter,
MathWalletAdapter
} = await import('@solana/wallet-adapter-wallets');
const { BackpackWalletAdapter } = await import('solana-svelte/wallets');
const network = clusterApiUrl('devnet');blockchain.init(network, {
walletAdapters: [
new PhantomWalletAdapter(),
new SolflareWalletAdapter({ network }),
new CoinbaseWalletAdapter(),
new BackpackWalletAdapter(),
new LedgerWalletAdapter(),
new TrezorWalletAdapter(),
new KeystoneWalletAdapter(),
new TrustWalletAdapter(),
new MathWalletAdapter()
],
autoConnect: true
});
});{@render children()}
```