@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
43 lines (42 loc) • 1.39 kB
TypeScript
import { type SignTypedDataParameters, type Address } from 'viem';
import { COMBO_BET_DATA_TYPES } from '../../config';
import { type BetClientData } from '../../global';
export type GetComboBetTypedDataParams = {
account: Address;
minOdds: string | bigint;
amount: string | bigint;
nonce: string | bigint;
clientData: BetClientData;
bets: {
conditionId: string | bigint;
outcomeId: string | bigint;
}[];
};
/**
* Generates EIP-712 typed data for signing a combo (parlay) bet.
* This typed data is used with wallet signing methods to create a combo bet signature.
*
* - Docs: https://gem.azuro.org/hub/apps/toolkit/bet/getComboBetTypedData
*
* @example
* import { getComboBetTypedData } from '@azuro-org/toolkit'
* import { signTypedData } from 'viem/actions'
*
* const account = '0x...'
* const clientData = { chainId: 137, core: '0x...', ... }
* const bets = [
* { conditionId: '1', outcomeId: '1' },
* { conditionId: '2', outcomeId: '2' },
* ]
*
* const typedData = getComboBetTypedData({
* account,
* clientData,
* bets,
* amount: '1000000',
* minOdds: '3000000000000',
* nonce: '1',
* })
* const signature = await signTypedData(walletClient, typedData)
* */
export declare const getComboBetTypedData: (props: GetComboBetTypedDataParams) => SignTypedDataParameters<typeof COMBO_BET_DATA_TYPES>;