@usebutr/wallet-standard-shared
v2.0.1
Published
Shared Wallet Standard discovery primitives used by @usebutr/svm, @usebutr/sui, @usebutr/bitcoin.
Downloads
673
Maintainers
Readme
@usebutr/wallet-standard-shared
Shared Wallet Standard discovery primitives used by @usebutr/svm, @usebutr/sui, @usebutr/bitcoin.
Part of butr, a multi-chain wallet discovery and connection-state library. Your application owns the picker UI and chain client.
Install
npm install @usebutr/wallet-standard-shared @wallet-standard/app zustandFor adapter authors. The package supplies discovery, the session plumbing every Wallet Standard adapter shares, and getFeature. The default registry loader requires @wallet-standard/app; tests can inject a loader. Importing it registers the wallet-standard signer kind, so every adapter built on it resolves getSigner() to { kind: "wallet-standard", wallet }.
Usage
import type { SvmAdapter } from "@usebutr/core";
import { SVM_CHAINS_LIST } from "@usebutr/core";
import type { WalletStandardWallet } from "@usebutr/wallet-standard-shared";
import { createWalletStandardCore, slugify } from "@usebutr/wallet-standard-shared";
export const buildAdapter = (wallet: WalletStandardWallet): SvmAdapter | null => {
const core = createWalletStandardCore({
chains: SVM_CHAINS_LIST,
// Namespace the id so a multi-chain wallet has one adapter per platform.
id: slugify("svm", wallet.name),
label: "Solana",
namespace: "solana",
preferredChainIds: ["solana:mainnet"],
trackChainChanges: true,
wallet,
});
// `base` defines `disconnect`, `subscribe` and `switchChain` only when the
// wallet supports them. Add platform methods the same way: only when the
// wallet advertises the feature, routing `options.account` through
// `core.resolveAccount` and `options.chain` through `core.resolveChainId`.
return core === null ? null : { ...core.base, chainPlatform: "svm" };
};Documentation
License
MIT, copyright 2026 Pedro Filho.
