UNPKG

@azuro-org/toolkit

Version:

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

39 lines (38 loc) 1.29 kB
import { type SignTypedDataParameters, type Address } from 'viem'; import { BET_DATA_TYPES } from '../../config'; import { type BetClientData } from '../../global'; export type GetBetTypedDataParams = { account: Address; clientData: BetClientData; bet: { conditionId: string | bigint; outcomeId: string | bigint; minOdds: string | bigint; amount: string | bigint; nonce: string | bigint; }; }; /** * Generates EIP-712 typed data for signing a single (ordinary) bet. * This typed data is used with wallet signing methods to create a bet signature. * * - Docs: https://gem.azuro.org/hub/apps/toolkit/bet/getBetTypedData * * @example * import { getBetTypedData } from '@azuro-org/toolkit' * import { signTypedData } from 'viem/actions' * * const account = '0x...' * const clientData = { chainId: 137, core: '0x...', ... } * const bet = { * conditionId: '1', * outcomeId: '1', * minOdds: '1500000000000', * amount: '1000000', * nonce: '1', * } * * const typedData = getBetTypedData({ account, clientData, bet }) * const signature = await signTypedData(walletClient, typedData) * */ export declare const getBetTypedData: (props: GetBetTypedDataParams) => SignTypedDataParameters<typeof BET_DATA_TYPES>;