Solid.js adapter for the core-2.0
package
npm install @your-repository-name/solid-2.0
# or
yarn add @your-repository-name/solid-2.0
# or
pnpm add @your-repository-name/solid-2.0
import { WalletProvider } from "@your-repository-name/solid-2.0"
// App.tsx
<WalletProvider
autoConnect={true}
disconnectOnAccountChange={true}
localStorageKey="unified:wallet-storage-key"
env={"devnet"}
// NOTE: only wallet adapters that use
// @solana/web3.js v2.x.x should be added
additionalWallets={[]}
>
{props.children}
</WalletProvider>
// Example.tsx
import { useWallet } from "@your-repository-name/solid-2.0"
const Example: Component = () => {
const { connectedAccount, signMessage, getTransactionSendingSigner } = useWallet()
const publicKey = createMemo<string | undefined>(() => {
const accInfo = connectedAccount()
if (!accInfo) {
return
}
return accInfo.type === "standard"
? accInfo.info?.pubKey
: (accInfo.info.publicKey?.toString() ?? undefined)
})
return (
<>
...
</>
)
}
See CHANGELOG.md.