⚑Solid.js Quick Start

Guide for using the @txnlab/use-wallet-solid package in your Solid.js project

The useWallet function provides access to the WalletManager instance and its state. It abstracts the WalletManager API and provides a simple interface for building a wallet menu and interacting with the active wallet.

circle-info

Before proceeding with this Quick Start guide, please read the Get Started section for installation and configuration instructions.

WalletProvider

In the root of your application, create a WalletManager instance with your configuration object. Wrap your app with the WalletProvider and pass the WalletManager instance as a prop.

import {
  NetworkId,
  WalletId,
  WalletManager,
  WalletProvider
} from '@txnlab/use-wallet-solid'
import { render } from 'solid-js/web'

// Create a manager instance
const walletManager = new WalletManager({
  wallets: [...],
  network: NetworkId.TESTNET
})

function App() {
  return (
    // Provide the manager to your App
    <WalletProvider manager={walletManager}>
      <MyApp />
    </WalletProvider>
  )
}

render(<App />, document.getElementById('root')!)

Wallet Menu

Now, in any component, you can use the useWallet function to access the wallet manager and its state. Here is an example of a basic wallet menu implementation:

Signing Transactions

To sign and send transactions, you can use the library's algodClient instance and the transactionSigner provided by the active wallet.

Example Application

To see a fully functioning Solid.js example, check out the example app:

Last updated