Skip to content

Wallet Standard

How Morsel registers with the Wallet Standard, the features it supports, and how to pick the right chain for Cookie Chain and Solana.

Morsel registers itself with the Wallet Standard in the Chrome extension and in the Morsel app's browser. Libraries that discover Wallet Standard wallets, such as @solana/wallet-adapter and @wallet-standard/app, list it automatically.

Registration

FieldValue
nameMorsel
version1.0.0
iconThe Morsel mark, as a data URI
chainsSolana mainnet, devnet and testnet, plus Cookie Chain

Features

FeatureNotes
standard:connectSupports silent: true for sites the user already approved.
standard:disconnect
standard:eventschange events for accounts.
solana:signTransactionLegacy and version 0 transactions.
solana:signAndSendTransactionLegacy and version 0. Always pass a chain.
solana:signMessageShows the text to the user.
solana:signInSign in with Solana. Also exposed as experimental:signIn.

Find Morsel

find-morsel.ts
import { getWallets } from '@wallet-standard/app';

const morsel = getWallets()
  .get()
  .find((wallet) => wallet.name === 'Morsel');

Choose the chain

Read chain identifiers from the wallet instead of hard-coding them. Solana uses the standard solana:mainnet. Cookie Chain has its own identifier in the same list.

chains.ts
const solana = morsel.chains.find((c) => c === 'solana:mainnet');
const cookie = morsel.chains.find((c) => !c.startsWith('solana:'));

const [{ signature }] = await morsel.features['solana:signAndSendTransaction'].signAndSendTransaction({
  account: morsel.accounts[0],
  chain: cookie, // or solana
  transaction: serializedTransaction,
});

Morsel also checks for itself which network a transaction was built for before showing it to the user, and sends it there.

Sign in with Solana

sign-in.ts
const [result] = await morsel.features['solana:signIn'].signIn({
  domain: window.location.host,
  statement: 'Sign in to MyDapp',
});

Morsel shows Matches this site when domain is the site making the request. A sign-in for another domain asks the user to confirm they trust it. An expired sign-in, or one naming a different address, can't be signed.

Try one of these