@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
40 lines (39 loc) • 1.27 kB
TypeScript
import { type SignTypedDataParameters, type Address } from 'viem';
import { type ChainId, CASHOUT_DATA_TYPES } from '../../config';
export type GetCashoutTypedDataParams = {
chainId: ChainId;
account: Address;
attention: string;
tokenId: string | bigint;
cashoutOdds: string | bigint;
expiredAt: number;
};
/**
* Generates EIP-712 typed data for signing a cashout order.
* This typed data must be signed by the user before submitting the cashout.
*
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getCashoutTypedData
*
* @example
* import { getCashoutTypedData } from '@azuro-org/toolkit'
* import { signTypedData } from 'viem/accounts'
*
* const chainId = 100
* const account = '0x123...'
* const tokenId = '456'
* const cashoutOdds = '1.85'
* const expiredAt = Math.floor(Date.now() / 1000) + 3600
* const attention = 'By signing this transaction, I agree to cash out on Azuro'
*
* const typedData = getCashoutTypedData({
* chainId,
* account,
* attention,
* tokenId,
* cashoutOdds,
* expiredAt,
* })
*
* const signature = await signTypedData(typedData)
* */
export declare const getCashoutTypedData: (props: GetCashoutTypedDataParams) => SignTypedDataParameters<typeof CASHOUT_DATA_TYPES>;