UNPKG

@azuro-org/toolkit

Version:

This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.

45 lines (44 loc) 1.36 kB
import { type Hex } from 'viem'; import { type ChainId } from '../../config'; export declare enum CashoutState { Processing = "PROCESSING", Accepted = "ACCEPTED", Rejected = "REJECTED", Open = "OPEN" } export type CreateCashoutResponse = { id: string; state: CashoutState; errorMessage?: string; }; export type CreateCashoutResult = CreateCashoutResponse; export type CreateCashoutParams = { chainId: ChainId; calculationId: string; attention: string; signature: Hex; }; /** * Creates a cashout order for an existing bet by submitting the signed cashout calculation to the Azuro API. * This finalizes the cashout process after obtaining a calculation and signing the typed data. * * - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/createCashout * * @example * import { createCashout } from '@azuro-org/toolkit' * * const chainId = 100 * const calculationId = 'gnosis_0x123_456' * const attention = 'By signing this transaction, I agree to cash out on Azuro' * const signature = '0xabc...' * * const result = await createCashout({ * chainId, * calculationId, * attention, * signature, * }) * * console.log(result.state) // 'PROCESSING', 'ACCEPTED', 'REJECTED', or 'OPEN' * */ export declare const createCashout: (props: CreateCashoutParams) => Promise<CreateCashoutResult>;