@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
47 lines (46 loc) • 1.44 kB
TypeScript
import { type Address } from 'viem';
import { type Environment } from '../../envs';
import { type ChainId } from '../../config';
export type GetCalculatedCashoutResult = {
calculationId: string;
account: string;
environment: Environment;
tokenId: string;
cashoutAmount: string;
cashoutOdds: string;
expiredAt: number;
approveExpiredAt: number;
isLive: boolean;
} | null;
/** @deprecated use GetCalculatedCashoutResult instead */
export type GetCalculatedCashout = GetCalculatedCashoutResult;
export type GetCalculatedCashoutParams = {
chainId: ChainId;
account: Address;
graphBetId: string;
};
/**
* Retrieves the calculated cashout information for a specific bet, including the cashout amount and odds.
* Returns null if no cashout calculation is available for the bet.
*
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getCalculatedCashout
*
* @example
* import { getCalculatedCashout } from '@azuro-org/toolkit'
*
* const chainId = 100
* const account = '0x123...'
* const graphBetId = '456'
*
* const cashout = await getCalculatedCashout({
* chainId,
* account,
* graphBetId,
* })
*
* if (cashout) {
* console.log(`Cashout amount: ${cashout.cashoutAmount}`)
* console.log(`Cashout odds: ${cashout.cashoutOdds}`)
* }
* */
export declare const getCalculatedCashout: (props: GetCalculatedCashoutParams) => Promise<GetCalculatedCashoutResult>;