Skip to main content

Prerequisites

  • Ensure you have a wallet created.
  • API Key: Ensure you have an API key with the scopes: wallets:signatures.create.
If you are signing with a delegated signer, the wallet must have executed at least one transaction before signatures will work. This is because the wallet needs to be deployed on-chain first.

Signing a Message

import { useWallet, EVMWallet } from '@crossmint/client-sdk-react-ui';

const { wallet } = useWallet();

const evmWallet = EVMWallet.from(wallet);

const signedMessage = await evmWallet.signMessage({ message: "Hello, world!" });
See the React SDK reference for more details.

Signing Typed Data

import { useWallet, EVMWallet } from '@crossmint/client-sdk-react-ui';

const { wallet } = useWallet();

const evmWallet = EVMWallet.from(wallet);
const typedData = {
    "types": {
        "EIP712Domain": [{
            "name": "name",
            "type": "string"
        }],
    },
    "primaryType": "Mail",
    "domain": {
        "name": "example.com",
        "version": "1"
    },
    "message": {
        "from": {
            "name": "John Doe"
        },
        "to": {
            "name": "Jane Doe"
        },
        "contents": "Hello, world!"
    }
};
const signedMessage = await evmWallet.signTypedData(typedData);
See the React SDK reference for more details.