Methods
WaaP for Solana exposes standard features via the Solana Wallet Standard . You can use either wallet-adapter hooks (recommended) or WaaP’s features directly.
Accessing the wallet
You need a reference to the WaaP Solana wallet to call methods. Two common patterns:
From the initializer
If you followed Quick Start, you have the facade returned by initWaaP:
import { initWaaP } from '@human.tech/waap-sdk'
// `initWaaP` returns the facade directly — there is nothing to destructure.
const wallet = initWaaP({ chain: 'solana' })
const { accounts } = await wallet.connect()
const [account] = accounts
// Direct helpers, for wallet-adapter-style consumers
const [{ signature }] = await wallet.signMessage({
account,
message: new TextEncoder().encode('Hello, WaaP!')
})
// Release when the owning UI unmounts
wallet.destroy()initWaaP takes a singular chain and returns that facade directly. Passing chains throws. Use initWaaPSquid({ chains }) for Squid, or initWaaPSolana() if you prefer a dedicated initializer.
From the Wallet Standard registry
Use this when you need the standard Wallet object, or when a wallet-adapter picks WaaP up automatically:
import { getWallets } from '@wallet-standard/app'
const wallets = getWallets().get()
const waapWallet = wallets.find((w) => w.name === 'WaaP')
if (waapWallet) {
const { accounts } = await waapWallet.features['standard:connect'].connect()
const [account] = accounts ?? []
}Wallet Standard methods
WaaP supports these Wallet Standard features:
| Feature | Description |
|---|---|
standard:connect | Connect the wallet and get accounts |
standard:disconnect | Disconnect the wallet |
standard:events | Subscribe to account/chain changes |
solana:signMessage | Sign a message |
solana:signTransaction | Sign a transaction (no submission) |
solana:signAndSendTransaction | Sign a transaction and submit it |
Supported chains: solana:mainnet, solana:devnet, solana:testnet, solana:localnet. Both legacy and version 0 transactions are supported.
The signing features take variadic inputs and return arrays, per the Wallet Standard. Even for a single transaction you destructure the result: const [{ signature }] = await wallet.signMessage({ ... }).
connect & disconnect
Connecting is usually handled by your wallet-adapter’s button. To connect or disconnect programmatically:
// Interactive: opens the WaaP modal if there is no session
const { accounts } = await wallet.connect()
// Silent: reconnect an existing session without showing UI
const { accounts } = await wallet.connect({ silent: true })
await wallet.disconnect()Use { silent: true } on page load to restore a session without interrupting the user, then fall back to an interactive connect() behind a button.
solana:signMessage
Sign a message. The user approves in the WaaP modal.
const [account] = wallet.accounts
const [result] = await wallet.signMessage({
account,
message: new TextEncoder().encode('Hello, WaaP!')
})
console.log('Signature:', result.signature) // Uint8Array
console.log('Signed message:', result.signedMessage)Returns signedMessage, signature, and signatureType ('ed25519').
For the standard API and more options, see Sign Messages.
solana:signTransaction
Sign a transaction without submitting it. Returns the signed bytes to your app so you can submit them yourself. The user approves in the WaaP modal.
import { Connection, SystemProgram, Transaction, PublicKey } from '@solana/web3.js'
const connection = new Connection('https://api.mainnet-beta.solana.com')
const [account] = wallet.accounts
const tx = new Transaction().add(
SystemProgram.transfer({
fromPubkey: new PublicKey(account.address),
toPubkey: new PublicKey('RecipientAddress...'),
lamports: 1_000_000
})
)
tx.feePayer = new PublicKey(account.address)
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash
const [{ signedTransaction }] = await wallet.signTransaction({
account,
transaction: tx.serialize({ requireAllSignatures: false }),
chain: 'solana:mainnet'
})
// Submit it yourself
await connection.sendRawTransaction(signedTransaction)options accepts preflightCommitment and minContextSlot.
A transaction you build keeps its exact bytes. WaaP does not rewrite it, so its recentBlockhash will expire on the normal Solana schedule. Roughly a minute. Fetch the blockhash immediately before signing, not when the page loads. See Solana Networks.
solana:signAndSendTransaction
Sign a transaction and submit it to the cluster. The user approves in the WaaP modal.
const [{ signature }] = await wallet.signAndSendTransaction({
account,
transaction: tx.serialize({ requireAllSignatures: false }),
chain: 'solana:mainnet'
})
console.log('Signature:', signature) // Uint8Arraychain is required here. options accepts commitment, skipPreflight, maxRetries, plus preflightCommitment and minContextSlot.
The returned signature confirms submission, not finality. Query the cluster if your flow depends on confirmation.
For full details, see Transactions.
standard:events
Subscribe to account and chain changes. The 'change' event fires when the wallet’s accounts or connection state change.
import { getWallets } from '@wallet-standard/app'
const wallet = getWallets().get().find((w) => w.name === 'WaaP')
if (wallet?.features['standard:events']) {
const { on } = wallet.features['standard:events']
const unsubscribe = on('change', ({ accounts }) => {
const primary = accounts?.[0]
console.log(primary ? `Primary account: ${primary.address}` : 'Wallet disconnected')
})
// Later: remove the listener (e.g. on component unmount)
unsubscribe()
}In a React component (with cleanup):
import { useEffect } from 'react'
import { getWallets } from '@wallet-standard/app'
function useWaapAccountChange(callback: (accounts: readonly { address: string }[]) => void) {
useEffect(() => {
const wallet = getWallets().get().find((w) => w.name === 'WaaP')
if (!wallet?.features['standard:events']) return
const { on } = wallet.features['standard:events']
return on('change', ({ accounts }) => callback(accounts ?? []))
}, [callback])
}Notes
requestEmail is a Sui-only WaaP method and is not available on the Solana facade.
Permission-token requests are supported on Solana. Request a token, then opt into it per call with withPT: true on signTransaction or signAndSendTransaction. It is ignored on signMessage, which is permission-token-ineligible wallet-side whatever the caller passes. See Privileges.
Summary
| Need | Approach |
|---|---|
| Connect / disconnect | wallet.connect() / wallet.disconnect(), or your wallet-adapter’s button |
| Silent reconnect | wallet.connect({ silent: true }) |
| Current accounts | wallet.accounts, or the 'change' event |
| Sign message | wallet.signMessage({ account, message }) or Sign Messages |
| Sign only | wallet.signTransaction({ account, transaction, chain }) |
| Sign & submit | wallet.signAndSendTransaction({ account, transaction, chain }) |
| Distributed key material | Squid Mode |
For full setup and provider wiring, see Setup & Initialization.