Skip to content

Frog.signature Response

The response returned from the .signature handler.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.signTypedData({
    chainId: 'eip155:84532',
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  })
})

Sign Typed Data (c.signTypedData)

chainId

  • Type: "eip155:${number}"

A CAIP-2 Chain ID to identify the signature network.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  }) 
})

domain (optional)

  • Type: TypedDataDomain

The typed data domain.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.signTypedData({
    chainId: 'eip155:84532',
    domain: {
      name: 'Frog Swamp',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
    },
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  }) 
})

types

The type definitions for the typed data.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.signTypedData({
    chainId: 'eip155:84532',
    domain: {
      name: 'Frog Swamp',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
    },
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  }) 
})

primaryType

  • Type: Inferred string.

The primary type to extract from types and use in value.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.signTypedData({
    chainId: 'eip155:84532',
    domain: {
      name: 'Frog Swamp',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
    },
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  }) 
})

message

  • Type: Inferred from types & primaryType.
import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.signature('/sign', (c) => {
  return c.signTypedData({
    chainId: 'eip155:84532',
    domain: {
      name: 'Frog Swamp',
      version: '1',
      chainId: 1,
      verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
    },
    types: {
      Swamp: [{ name: 'frog', type: 'string' }],
    },
    primaryType: 'Swamp',
    message: {
      frog: 'Robert',
    },
  }) 
})