
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@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()],
// ... use the same implementation from the SvelteKit ui
optimizeDeps: {
include: ['@project-serum/anchor', '@solana/web3.js', 'buffer'],
// ... use the same implementation from the SvelteKit ui
}
// ... use the same implementation from the SvelteKit ui
}
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';
const localStorageKey = 'walletAdapter';
const network = clusterApiUrl('devnet'); // localhost or mainnet
let wallets;
onMount(async () => {
const {
PhantomWalletAdapter,
SlopeWalletAdapter,
SolflareWalletAdapter,
SolletExtensionWalletAdapter,
TorusWalletAdapter,
} = await import('@solana/wallet-adapter-wallets');
const walletsMap = [
new PhantomWalletAdapter(),
new SlopeWalletAdapter(),
new SolflareWalletAdapter(),
new SolletExtensionWalletAdapter(),
new TorusWalletAdapter(),
];
wallets = walletsMap;
});
</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 8 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.