Skip to main content

Documentation Index

Fetch the complete documentation index at: https://seilabs-docs-evm-reference-and-sei-js-examples.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Signing

Signing on Sei works through standard EVM libraries and wallet standards. The methods available depend on which wallet the user has connected.

Wallet Signing Support

MethodStandardSei Global WalletMetaMaskWalletConnect wallets
personal_signEIP-191SupportedSupportedWallet-dependent
eth_signTypedData_v4EIP-712SupportedSupportedWallet-dependent
eth_signLegacyNot recommendedSupportedWallet-dependent
Transaction signingSupportedSupportedSupported
Do not assume all wallets support all methods. Always handle rejection gracefully.

Personal Sign

import { createWalletClient, custom } from 'viem';
import { sei } from '@sei-js/precompiles/viem';

const client = createWalletClient({
  chain: sei,
  transport: custom(window.ethereum),
});

const [account] = await client.getAddresses();

const signature = await client.signMessage({
  account,
  message: 'Hello Sei',
});

EIP-712 Typed Data

const [account] = await client.getAddresses();

const signature = await client.signTypedData({
  account,
  domain: {
    name: 'My App',
    version: '1',
    chainId: 1329, // Sei mainnet
    verifyingContract: '0xContractAddress',
  },
  types: {
    Order: [
      { name: 'maker', type: 'address' },
      { name: 'amount', type: 'uint256' },
      { name: 'expiry', type: 'uint256' },
    ],
  },
  primaryType: 'Order',
  message: {
    maker: account,
    amount: 1000000n,
    expiry: BigInt(Math.floor(Date.now() / 1000) + 3600),
  },
});

Verifying Signatures

viem
import { verifyMessage, verifyTypedData } from 'viem';

// Verify personal sign
const valid = await verifyMessage({
  address: '0xSignerAddress',
  message: 'Hello Sei',
  signature,
});

// Verify EIP-712
const validTyped = await verifyTypedData({
  address: '0xSignerAddress',
  domain,
  types,
  primaryType: 'Order',
  message: value,
  signature,
});

EIP-1271 Contract Signatures

Smart contract wallets on Sei can validate signatures via EIP-1271 (isValidSignature). Use viem’s verifyMessage with a contract address — it automatically uses EIP-1271 when the address is a contract.
viem
const valid = await verifyMessage({
  address: '0xSmartContractWallet',
  message: 'Hello Sei',
  signature,
});
// viem calls isValidSignature if the address is a contract