Skip to Content

createCashout

Submits a cashout order.

ℹ️

You can find more information Here.

Usage

import { getCalculatedCashout, getCashoutTypedData, createCashout } from '@azuro-org/toolkit' const { id, tokenId } = bet // user's bet const { calculationId, cashoutOdds, expiredAt } = await getCalculatedCashout({ chainId: 137, account: '0x...', graphBetId: id, }) const typedData = getCashoutTypedData({ chainId: 137, account: '0x...', attention: '...', tokenId, cashoutOdds, expiredAt, }) const signature = await walletClient.data.signTypedData(typedData) const createdOrder = await createCashout({ chainId: 137, calculationId, attention: '...', signature, })

Props

{ chainId: ChainId calculationId: string // precalculated cashout id from getCalculatedCashout attention: string signature: Hex // signed typed data }
type ChainId = | 100 // Gnosis | 137 // Polygon | 80002 // Polygon Amoy | 88888 // Chiliz | 88882 // Chiliz Spicy | 8453 // Base | 84532 // Base Sepolia import { type Hex, type Address } from 'viem'

Return Value

type CreateCashoutResponse = { id: string state: CashoutState errorMessage?: string } enum CashoutState { Processing = 'PROCESSING', Accepted = 'ACCEPTED', Rejected = 'REJECTED', Open = 'OPEN' }
Last updated on