Skip to content

Frog.transaction Response

The response returned from the .transaction handler.

There are three types of responses:

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1'),
  })
})
 
app.transaction('/mint', (c) => {
  return c.contract({
    abi,
    chainId: 'eip155:10',
    functionName: 'mint',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
  })
})
 
app.transaction('/raw-send', (c) => {
  return c.res({
    chainId: 'eip155:10',
    method: 'eth_sendTransaction',
    params: {
      to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
      value: 1n,
    },
  })
})

Send Transaction (c.send)

chainId

  • Type: "eip155:${number}"

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

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1')
  }) 
})

gas (optional)

  • Type: BigInt

Gas limit of the transaction to send.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    gas: 100_000n,
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1'),
  }) 
})

to

  • Type: Address

Transaction recipient.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1')
  }) 
})

value

  • Type: Bigint

Value (in wei) to send with the transaction.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1')
  }) 
})

abi (optional)

  • Type: Abi

The ABI of the contract.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    abi,
  }) 
})

attribution (optional)

  • Type: boolean
  • Default: false

Includes client calldata suffix

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    abi, 
    attribution: true,
  }) 
})

data (optional)

  • Type: Hex

Calldata to send with the transaction

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/send-ether', (c) => {
  return c.send({ 
    chainId: 'eip155:10',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    data: '0xdeadbeef',
  }) 
})

Contract Transaction (c.contract)

abi

  • Type: Abi

The ABI of the contract.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10', 
    functionName: 'mint', 
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
  }) 
})

chainId

  • Type: "eip155:${number}"

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

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    functionName: 'mint', 
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
  }) 
})

functionName

  • Type: string

Function to invoke on the contract.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    functionName: 'mint',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
  }) 
})

gas (optional)

  • Type: Bigint

Gas limit of the transaction to send.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    gas: 100_000n,
    functionName: 'mint',
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
  }) 
})

args

  • Type: unknown

Args to pass to the contract function.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    functionName: 'mint',
    args: [69420n],
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
  }) 
})

to

  • Type: Address

The address of the contract.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    functionName: 'mint',
    args: [69420n],
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
  }) 
})

attribution (optional)

  • Type: boolean
  • Default: false

Includes client calldata suffix

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi, 
    chainId: 'eip155:10', 
    functionName: 'mint', 
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
    attribution: true,
  }) 
})

value (optional)

  • Type: Bigint

Value to send with the transaction.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/mint', (c) => {
  return c.contract({ 
    abi,
    chainId: 'eip155:10',
    functionName: 'mint',
    args: [69420n],
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('1'),
  }) 
})

Raw Transaction (c.res)

chainId

  • Type: "eip155:${number}"

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

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/raw-send', (c) => {
  return c.res({ 
    chainId: 'eip155:10',
    method: 'eth_sendTransaction', 
    params: { 
      to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
      value: 1n, 
    }, 
  }) 
})

method

  • Type: "eth_sendTransaction"

A method ID to identify the type of transaction request.

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/raw-send', (c) => {
  return c.res({ 
    chainId: 'eip155:10',
    method: 'eth_sendTransaction',
    params: { 
      to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
      value: 1n, 
    }, 
  }) 
})

params

  • Type: EthSendTransactionParameters

Transaction parameters

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/raw-send', (c) => {
  return c.res({ 
    chainId: 'eip155:10',
    method: 'eth_sendTransaction',
    params: {
      to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
      value: 1n,
    },
  }) 
})

attribution (optional)

  • Type: boolean
  • Default: false

Includes client calldata suffix

import { Frog, parseEther } from 'frog'
 
export const app = new Frog({ title: 'Frog Frame' })
 
app.transaction('/raw-send', (c) => {
  return c.res({ 
    chainId: 'eip155:10',
    method: 'eth_sendTransaction',
    params: { 
      to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', 
      value: 1n,
    }, 
    attribution: true,
  }) 
})