UNPKG

@azuro-org/sdk

Version:

One-stop solution for building betting dApps on the Azuro Protocol.

33 lines (32 loc) 1.24 kB
import { type Hex, type TransactionReceipt, type WaitForTransactionReceiptReturnType } from 'viem'; import { type polygon } from 'viem/chains'; import { type ChainId, type GetCalculatedCashout } from '@azuro-org/toolkit'; import { type UseQueryResult } from '@tanstack/react-query'; import { type Bet } from '../../global'; export type UseCashoutProps = { bet: Pick<Bet, 'tokenId' | 'outcomes'>; chainId?: ChainId; EIP712Attention?: string; onSuccess?(receipt?: TransactionReceipt): void; onError?(err?: Error): void; }; export type UseCashout = (props: UseCashoutProps) => { submit: () => Promise<void>; calculationQuery: UseQueryResult<GetCalculatedCashout, Error>; approveTx: { data: Hex | undefined; receipt: WaitForTransactionReceiptReturnType<typeof polygon> | undefined; isPending: boolean; isProcessing: boolean; }; cashoutTx: { data: Hex | undefined; receipt: WaitForTransactionReceiptReturnType<typeof polygon> | undefined; isPending: boolean; isProcessing: boolean; }; isAllowanceFetching: boolean; isCashoutAvailable: boolean; isApproveRequired: boolean; }; export declare const useCashout: UseCashout;