Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@svelte-on-solana/wallet-adapter-anchor
Advanced tools
`AnchorConnectionProvider` component and `workSpace` for Solana wallets using Svelte
@svelte-on-solana/wallet-adapter-anchor
AnchorConnectionProvider
component and workSpace
for Solana wallets using Svelte
You have already installed the core package to run the wallet Svelte Store @svelte-on-solana/wallet-adapter-core and the UI components to use the wallet @svelte-on-solana/wallet-adapter-ui. Then install the AnchorConnectionProvider
component and workSpace
file contained in this package.
npm i @svelte-on-solana/wallet-adapter-anchor
Add @project-serum/anchor
to optimizeDeps
inside vite.config.js
. This pre-bundles the @project-serum/anchor
package. This steps converts CommonJS dependencies into ESM ( Vite's dev server serves all code as native ESM ).
import { sveltekit } from '@sveltejs/kit/vite'
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
define: {
'process.env.BROWSER': true
},
optimizeDeps: {
include: ['@project-serum/anchor', '@solana/web3.js', 'buffer'],
}
}
export default config
The AnchorConnectionProvider
for Anchor Dapps accepts the next props.
prop | type | default |
---|---|---|
network | string | |
idl | Idl |
It is automatically connected to the workSpace
defining all the parameters to share among the components in your Anchor Dapp (baseAccount, connection, provider, program, systemProgram and network).
In the __layout.svelte component you can import the wallets and setup the UI components.
<script lang="ts">
import { walletStore } from '@svelte-on-solana/wallet-adapter-core';
import { WalletProvider, WalletMultiButton } from '@svelte-on-solana/wallet-adapter-ui';
import { AnchorConnectionProvider, workSpace } from '@svelte-on-solana/wallet-adapter-anchor';
import { clusterApiUrl } from '@solana/web3.js';
import idl from '../../../target/idl/<my-anchor-project>.json';
import { PhantomWalletAdapter, SolflareWalletAdapter } from '@solana/wallet-adapter-wallets';
const localStorageKey = 'walletAdapter';
const network = clusterApiUrl('devnet'); // localhost or mainnet
let wallets = [new PhantomWalletAdapter(), new SolflareWalletAdapter()];;
</script>
<WalletProvider {localStorageKey} {wallets} autoConnect />
<AnchorConnectionProvider {network} {idl} />
<div>
<slot />
</div>
<WalletMultiButton />
In App.svelte
or the entry point of your SPA, you can setup the wallet and components like this.
<script lang="ts">
import { walletStore } from '@svelte-on-solana/wallet-adapter-core';
import { WalletProvider, WalletMultiButton } from '@svelte-on-solana/wallet-adapter-ui';
import { AnchorConnectionProvider, workSpace } from '@svelte-on-solana/wallet-adapter-anchor';
import { clusterApiUrl } from '@solana/web3.js';
import idl from '../../../target/idl/<my-anchor-project>.json';
import { PhantomWalletAdapter, SolflareWalletAdapter } from '@solana/wallet-adapter-wallets';
const localStorageKey = 'walletAdapter';
const network = clusterApiUrl('devnet'); // localhost or mainnet
let wallets = [new PhantomWalletAdapter(), new SolflareWalletAdapter()];
</script>
<WalletProvider {localStorageKey} {wallets} autoConnect />
<AnchorConnectionProvider {network} {idl} />
<WalletMultiButton />
{#if $walletStore?.connected}
<div>My wallet is connected</div>
{/if}
See example implementations of the @svelte-on-solana/wallet-adapter-ui
library.
FAQs
`AnchorConnectionProvider` component and `workSpace` for Solana wallets using Svelte
The npm package @svelte-on-solana/wallet-adapter-anchor receives a total of 118 weekly downloads. As such, @svelte-on-solana/wallet-adapter-anchor popularity was classified as not popular.
We found that @svelte-on-solana/wallet-adapter-anchor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.