Frog.transaction
Import
import { Frog } from 'frog'
Usage
import { Button, Frog, parseEther } from 'frog'
const app = new Frog()
app.transaction('/send-ether', (c) => {
// Send transaction response.
return c.send({
chainId: 'eip155:10',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('1'),
})
})
app.transaction('/mint', (c) => {
// Contract transaction response.
return c.contract({
abi,
chainId: 'eip155:10',
functionName: 'mint',
args: [69420n],
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B'
})
})
Parameters
path
- Type:
string
Path of the route.
import { Button, Frog, parseEther } from 'frog'
const app = new Frog()
app.transaction(
'/send-ether',
(c) => {
// Send transaction response.
return c.send({
chainId: 'eip155:10',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('1'),
})
}
)
handler
- Type:
(c: Context) => FrameResponse
Handler function for the route.
import { Button, Frog, parseEther } from 'frog'
const app = new Frog()
app.transaction(
'/send-ether',
(c) => {
return c.send({
chainId: 'eip155:10',
to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
value: parseEther('1'),
})
}
)